Browse Source

无人机事件类型修正

Memory_LG 1 week ago
parent
commit
ec5457fd3c

+ 4 - 0
src/main/java/com/sooka/sponest/event/centereventteventcatalogue/mapper/AlarmEventMapper.java

@@ -1,9 +1,13 @@
 package com.sooka.sponest.event.centereventteventcatalogue.mapper;
 
 import com.sooka.sponest.event.centereventteventcatalogue.domain.vo.DroneVO;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
+import java.util.Map;
 
 public interface AlarmEventMapper {
     int insertDrone(List<DroneVO> alarmData);
+
+    Map<Object, Object> getEventTypeByCodeTower(@Param("codeTower") String codeTower);
 }

+ 16 - 32
src/main/java/com/sooka/sponest/event/centereventteventcatalogue/service/impl/AlarmEventServiceImpl.java

@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.dahuatech.icc.exception.ClientException;
 import com.dahuatech.icc.oauth.http.IccHttpHttpRequest;
-import com.ruoyi.common.core.domain.R;
 import com.ruoyi.common.core.utils.DateUtils;
 import com.ruoyi.common.core.utils.SpringUtils;
 import com.ruoyi.common.core.utils.StringUtils;
@@ -13,7 +12,6 @@ import com.ruoyi.common.core.utils.uuid.IdUtils;
 import com.ruoyi.system.api.RemoteDeptService;
 import com.ruoyi.system.api.RemoteFileService;
 import com.ruoyi.system.api.domain.SysDept;
-import com.ruoyi.system.api.domain.SysFile;
 import com.sooka.sponest.event.centereventtdeptevent.domain.CentereventDeptEvent;
 import com.sooka.sponest.event.centereventtdeptevent.service.ICentereventDeptEventService;
 import com.sooka.sponest.event.centereventteventcatalogue.domain.CentereventTEventcatalogue;
@@ -41,18 +39,12 @@ import com.sooka.sponest.event.utils.RemoteApiUtil;
 import com.sooka.sponest.monitor.api.RemoteMonitorService;
 import com.sooka.sponest.monitor.api.domain.CenterdataTAidevicedept;
 import com.sooka.sponest.monitor.api.domain.CenterdataTCamera;
-import com.sooka.sponest.monitor.api.domain.CentermonitorTUav;
 import org.apache.commons.collections4.MapUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.MediaType;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.client.RestTemplate;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
@@ -291,10 +283,10 @@ public class AlarmEventServiceImpl implements AlarmEventService {
         centereventTFireLog.setOperationType(LOG_OPER_TYPE_3);
         centereventTFireLog.setCreateName(centereventTEventcatalogue.getCreateName());
         centereventTFireLog.setCreateTime(centereventTEventcatalogue.getCreateTime());
-        if(StringUtils.isNotEmpty(centereventTEventcatalogue.getLongitude())){
+        if (StringUtils.isNotEmpty(centereventTEventcatalogue.getLongitude())) {
             centereventTFireLog.setLongitude(centereventTEventcatalogue.getLongitude());
         }
-        if(StringUtils.isNotEmpty(centereventTEventcatalogue.getLatitude())){
+        if (StringUtils.isNotEmpty(centereventTEventcatalogue.getLatitude())) {
             centereventTFireLog.setLatitude(centereventTEventcatalogue.getLatitude());
         }
         logger.info("写入事件部门表:-->{}", centereventTEventcatalogue.getEventCode());
@@ -310,8 +302,10 @@ public class AlarmEventServiceImpl implements AlarmEventService {
         // 313:烟雾,5122:热感
         if (type == 313 || type == 5122) {
             return insertFireEvent(daHuaFireEventVO);
-        } else if (type == 302 || type == 303 || type == 962 || type == 963 || type == 964 || type == 965) {
+        } else if (type == 302 || type == 303 || type == 962 || type == 963 || type == 964 || type == 965
+                || type == 987654321 || type == 987654322 || type == 987654333 || type == 987654334) {
             // 302:绊线入侵,303:区域入侵 ,962:人穿越警戒线,963:机动车穿越警戒线,964:人穿越区域,965:机动车穿越区域
+            //鄂前大华新事件类型 987654321:违法畜牧,987654322:违章建筑,987654333:河岸垃圾倾倒,987654334:耕地保护
             return insertBayonetEvent(daHuaFireEventVO);
         }
         return "";
@@ -708,15 +702,7 @@ public class AlarmEventServiceImpl implements AlarmEventService {
 
     @Override
     public int insertDroneEvent(List<DroneVO> alarmData) {
-        Map<Object, Object> eventType = new HashMap<>();
-        eventType.put("Sheep","222");
-        eventType.put("Car","218");
-
-        Map<Object, Object> eventLabel = new HashMap<>();
-        eventLabel.put("Sheep","区域入侵");
-        eventLabel.put("Car","工程车检测");
-
-        // 将告警图片转换为本地图片
+         // 将告警图片转换为本地图片
         alarmData.parallelStream().forEach(item -> {
             item.setId(IdUtils.simpleUUID());
             try {
@@ -727,18 +713,16 @@ public class AlarmEventServiceImpl implements AlarmEventService {
             }
         });
         // 通过无人机id, 获取无人机信息和绑定的指挥中心
-        alarmData.forEach(alarm->{
+        alarmData.forEach(alarm -> {
             Map<String, Object> data = (Map<String, Object>) SpringUtils.getBean(RemoteMonitorService.class).selectUavByUavId(alarm.getCopterId(), "1").get("data");
-            /**
-             * 牛羊 Sheep:222
-             * 车辆 Car: 218
-             */
 
-            String eventName = MapUtils.getString(data, "uavName")+"上报"+MapUtils.getString(eventLabel, alarm.getAlarmType())+"事件";
-            String eventDescription = "基站:"+MapUtils.getString(data, "baseStationName")+",无人机:"+MapUtils.getString(data, "uavName")+",经度:"+alarm.getLongitude()+",纬度:"+alarm.getLatitude()+",海拔:"+alarm.getAltitude();
+            Map<Object, Object> eventType = alarmEventMapper.getEventTypeByCodeTower(alarm.getAlarmType());
+
+            String eventName = MapUtils.getString(data, "uavName") + "上报" + MapUtils.getString(eventType, "eventTypeName") + "事件";
+            String eventDescription = "基站:" + MapUtils.getString(data, "baseStationName") + ",无人机:" + MapUtils.getString(data, "uavName") + ",经度:" + alarm.getLongitude() + ",纬度:" + alarm.getLatitude() + ",海拔:" + alarm.getAltitude();
 
             //创建事件主体, 写入事件表.
-            CentereventTEventcatalogue centereventTEventcatalogue = new CentereventTEventcatalogue("2", MapUtils.getString(eventType, alarm.getAlarmType()), eventName, eventDescription, alarm.getLongitude(), alarm.getLatitude(), MapUtils.getString(data, "uavName"), alarm.getCreationTime(), "");
+            CentereventTEventcatalogue centereventTEventcatalogue = new CentereventTEventcatalogue("2", MapUtils.getString(eventType, "eventType"), eventName, eventDescription, alarm.getLongitude(), alarm.getLatitude(), MapUtils.getString(data, "uavName"), alarm.getCreationTime(), "");
             centereventTEventcatalogue.setLongitude(alarm.getLongitude());
             centereventTEventcatalogue.setLatitude(alarm.getLatitude());
             centereventTEventcatalogue.setReportSource(REPORTING_SOURCE_6);
@@ -758,7 +742,7 @@ public class AlarmEventServiceImpl implements AlarmEventService {
                 centereventTDeptEvent.setId(IdUtils.fastSimpleUUID());
                 centereventTDeptEvent.setEventCode(eventCode);
                 centereventTDeptEvent.setDeptId(MapUtils.getLong(item, "mapDeptId"));
-                centereventTDeptEvent.setDeptName(MapUtils.getString(item,"mapDeptName"));
+                centereventTDeptEvent.setDeptName(MapUtils.getString(item, "mapDeptName"));
                 centereventTDeptEvent.setIsUrged(SYS_ISURGE_2);
                 centereventTDeptEvent.setEventStatus("上报");
                 centereventTDeptEvent.setEventStatusValue(FOREST_EVENT_STATUS_1);
@@ -780,10 +764,10 @@ public class AlarmEventServiceImpl implements AlarmEventService {
 //            centereventTFireLog.setCreateBy(alarm.getCopterId());
             centereventTFireLog.setCreateName(centereventTEventcatalogue.getCreateName());
             centereventTFireLog.setCreateTime(centereventTEventcatalogue.getCreateTime());
-            if(StringUtils.isNotEmpty(centereventTEventcatalogue.getLongitude())){
+            if (StringUtils.isNotEmpty(centereventTEventcatalogue.getLongitude())) {
                 centereventTFireLog.setLongitude(centereventTEventcatalogue.getLongitude());
             }
-            if(StringUtils.isNotEmpty(centereventTEventcatalogue.getLatitude())){
+            if (StringUtils.isNotEmpty(centereventTEventcatalogue.getLatitude())) {
                 centereventTFireLog.setLatitude(centereventTEventcatalogue.getLatitude());
             }
             centereventTFireLogService.insertCentereventTFireLog(centereventTFireLog);
@@ -845,7 +829,7 @@ public class AlarmEventServiceImpl implements AlarmEventService {
         if (StringUtils.isNotBlank(eventsVo.getSnappedPicUrl())) {
             CenterdataTAttach tAttach = new CenterdataTAttach();
             tAttach.setBusId(logId);
-            JSONObject jsonObject = JSON.parseObject(MapUtils.getString(eventsVo.getData(),"transInfo"));
+            JSONObject jsonObject = JSON.parseObject(MapUtils.getString(eventsVo.getData(), "transInfo"));
             String imageUrl = jsonObject.getString("imageUrl");
 
             Optional.ofNullable(NetworkImageToMultipartFile.downloadImageToMultipartFile(imageUrl))

+ 5 - 0
src/main/resources/mapper/centereventteventcatalogue/AlarmEventMapper.xml

@@ -29,4 +29,9 @@
              )
         </foreach>
     </insert>
+
+    <select id="getEventTypeByCodeTower" parameterType="string" resultType="map">
+        select event_type_name eventTypeName, id eventType from centerevent_t_eventtype
+        where code_tower = #{codeTower}
+    </select>
 </mapper>

+ 9 - 4
src/main/resources/mapper/centereventteventcatalogue/CenterEventViewMapper.xml

@@ -438,13 +438,18 @@
         eventStatus, a.is_examine isExamine, a.version, a.address, a.create_by cameraCode, e.event_type_name eventTypeName
         from centerevent_t_eventcatalogue a
         left join centerevent_t_eventtype e on a.event_type_xl = e.id
-        where (report_source = 'reporting_source_1' or report_source = 'reporting_source_6') and event_status_value = 'forest_event_status_1'
+        where (report_source = 'reporting_source_1' or report_source = 'reporting_source_6')
         <if test="eventName != null and eventName != ''">
             and event_name like concat('%', #{eventName},'%')
         </if>
-        <if test="eventStatusValue != null and eventStatusValue != ''">
-            and event_status_value = #{eventStatusValue}
-        </if>
+          <choose>
+              <when test="eventStatusValue != null and eventStatusValue != ''">
+                  and event_status_value = #{eventStatusValue}
+              </when>
+          <otherwise>
+              and (event_status_value = 'forest_event_status_1' or event_status_value = 'forest_event_status_5')
+          </otherwise>
+          </choose>
         <if test="day != null and day != ''">
             and DATE_FORMAT(create_time,'%Y-%m-%d') = #{day}
         </if>