浏览代码

合并代码

Memory_LG 1 月之前
父节点
当前提交
39722847c3

+ 5 - 0
pom.xml

@@ -116,6 +116,11 @@
             <version>5.8.24</version>
         </dependency>
 
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+        </dependency>
+
     </dependencies>
 
     <build>

文件差异内容过多而无法显示
+ 203 - 7
src/main/java/com/sooka/sponest/event/centereventteventcatalogue/controller/AlarmEventController.java


+ 85 - 0
src/main/java/com/sooka/sponest/event/centereventteventcatalogue/domain/haikang/EventSmokeVo.java

@@ -0,0 +1,85 @@
+package com.sooka.sponest.event.centereventteventcatalogue.domain.haikang;
+
+import com.sooka.sponest.monitor.api.domain.CenterdataTCamera;
+import lombok.Data;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import java.util.List;
+import java.util.Map;
+
+@Data
+public class EventSmokeVo {
+    private String componentId;
+    private String deploySubType;
+    private String deploymentId;
+    private String eventId;
+    private List<String> tenants;
+    private int eventLvl;
+    private String eventName;
+    private String eventType;
+    private String eventTypeCode;
+    private String happenTime;
+    private String stopTime;
+    private String snappedPicUrl;
+    private String srcIndex;
+    private String externalIndexCode;
+    private String srcName;
+    private String srcType;
+    private int status;
+    private int eventConfirmStatus;
+    private String strEventType;
+    private int timeout;
+    private Map<String, Object> data;
+    private String eventSource;
+    private String tenantIndexCode;
+    private int verifyTimeLimit;
+    private String algorithmCode;
+    private String rect;
+    private int lockTime;
+    private String deploymentIdDetail;
+    private String aiFunctionCode;
+    private int presetIndex;
+    private String tag;
+    private String ruleId;
+    private int lockTimeBefore;
+    private String longitude;
+    private String baseAlgorithmId;
+    private String locationName;
+    private String address;
+    private int level;
+    private boolean verified;
+    private boolean videoLock;
+    private String resourceName;
+    private Map<String, Object> aiStrategyOutput;
+    private String resourceIndexCode;
+    private List<Map<String, Object>> ruleRegion;
+    private String applicant;
+    private long eventCode;
+    private String jobId;
+    private String targetList;
+    private String ptzValue;
+    private String region;
+    private long subEventCode;
+    private String taskId;
+    private String resourceType;
+    private String externalIndexCodeDetail;
+    private int strategyStatus;
+    private String presetIndexCode;
+    private boolean manualConfirmFlag;
+    private boolean autoVerify;
+
+
+    public String toString(CenterdataTCamera centerdataTCamera) {
+        String toString = new ToStringBuilder(this, ToStringStyle.NO_CLASS_NAME_STYLE)
+                .append("行政区:", centerdataTCamera.getCameraRegion())
+                .append("瞭望塔:", getSrcName())
+//                .append("方向:", getDirection())
+//                .append("距离:", getDistance())
+//                .append("高程:", getHeight())
+                .append("经度:", centerdataTCamera.getLongitude())
+                .append("纬度:", centerdataTCamera.getLatitude())
+                .toString().replaceAll("=", "");
+        return toString.substring(1, toString.length() - 1);
+    }
+}

+ 22 - 10
src/main/java/com/sooka/sponest/event/centereventteventcatalogue/domain/haikang/EventsVo.java

@@ -5,32 +5,44 @@ import lombok.Data;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 
+import java.util.Map;
+
 @Data
 public class EventsVo {
 
-    private DataVo data;
-
-    private String eventId;
+    private String snappedPicUrl;
 
-    private String eventType;
+    private Integer eventConfirmStatus;
 
-    private String happenTime;
+    private String eventId;
 
-    private String srcIndex;
+    private String tenants;
 
     private String srcName;
 
-    private String srcParentIndex;
+    private String componentId;
 
-    private String srcType;
+    private String eventTypeCode;
 
-    private String status;
+    private Map<String, Object> data;
 
     private String timeout;
 
+    private String eventName;
+
+    private String stopTime;
+
+    private String srcIndex;
+
+    private String happenTime;
+
+    private String externalIndexCode;
+
+    private String status;
+
     public String toString(CenterdataTCamera centerdataTCamera) {
         String toString = new ToStringBuilder(this, ToStringStyle.NO_CLASS_NAME_STYLE)
-                .append("行政区:", getData().getText()[0].getOrgName())
+                .append("行政区:", centerdataTCamera.getCameraRegion())
                 .append("瞭望塔:", getSrcName())
 //                .append("方向:", getDirection())
 //                .append("距离:", getDistance())

+ 19 - 0
src/main/java/com/sooka/sponest/event/centereventteventcatalogue/domain/haikang/HaiKangEventSmokeVo.java

@@ -0,0 +1,19 @@
+package com.sooka.sponest.event.centereventteventcatalogue.domain.haikang;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class HaiKangEventSmokeVo {
+
+    private String ability;
+
+    private EventSmokeVo[] events;
+
+    private String quids;
+
+    @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss", timezone = "GMT+8")
+    public Date sendTime;
+}

+ 67 - 0
src/main/java/com/sooka/sponest/event/centereventteventcatalogue/domain/vo/DroneVO.java

@@ -0,0 +1,67 @@
+package com.sooka.sponest.event.centereventteventcatalogue.domain.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.*;
+import org.apache.ibatis.type.Alias;
+
+import java.util.Date;
+
+@Setter
+@Getter
+@NoArgsConstructor
+@AllArgsConstructor
+@ToString
+@Alias("droneVo")
+public class DroneVO {
+
+    /**
+     * 数据id
+     */
+    private String id;
+    /**
+     * 上报无人机id
+     */
+    private String copterId;
+    /**
+     * 时间戳
+     */
+    private Long timeStamp;
+    /**
+     * 海拔高度
+     */
+    private Double altitude;
+    /**
+     * 隐患类型
+     */
+    private String alarmType;
+    /**
+     * 隐患时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date creationTime;
+    /**
+     * 隐患图片地址
+     */
+    private String photoPath;
+    /**
+     * 隐患纬度
+     */
+    private String latitude;
+    /**
+     * 隐患经度
+     */
+    private String longitude;
+    /**
+     * 隐患图片id
+     */
+    private Integer photoId;
+    /**
+     * 图片名称
+     */
+    private String photoName;
+    /**
+     * 本地图片路径
+     */
+    private String localPath;
+
+}

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

@@ -0,0 +1,9 @@
+package com.sooka.sponest.event.centereventteventcatalogue.mapper;
+
+import com.sooka.sponest.event.centereventteventcatalogue.domain.vo.DroneVO;
+
+import java.util.List;
+
+public interface AlarmEventMapper {
+    int insertDrone(List<DroneVO> alarmData);
+}

+ 8 - 2
src/main/java/com/sooka/sponest/event/centereventteventcatalogue/service/AlarmEventService.java

@@ -4,18 +4,22 @@ import com.dahuatech.icc.exception.ClientException;
 import com.sooka.sponest.event.centereventteventcatalogue.domain.DaHuaEventBO;
 import com.sooka.sponest.event.centereventteventcatalogue.domain.dahua.DaHuaFireEventVO;
 import com.sooka.sponest.event.centereventteventcatalogue.domain.dahua.DaHuaOtherEventVO;
-import com.sooka.sponest.event.centereventteventcatalogue.domain.haikang.EventsVo;
+import com.sooka.sponest.event.centereventteventcatalogue.domain.haikang.HaiKangEventSmokeVo;
 import com.sooka.sponest.event.centereventteventcatalogue.domain.haikang.HaiKangEventVo;
 import com.sooka.sponest.event.centereventteventcatalogue.domain.sensor.SensorEventVo;
 import com.sooka.sponest.event.centereventteventcatalogue.domain.tower.TowerEventVo;
+import com.sooka.sponest.event.centereventteventcatalogue.domain.vo.DroneVO;
+
+import java.util.List;
 
 public interface AlarmEventService {
 
     // 海康火情事件
-    String insertHaiKangFireEvent(EventsVo eventsVo);
+    String insertHaiKangFireEvent(HaiKangEventVo haiKangEventVo);
 
     // 海康城管事件
     String insertHaiKangCityEvent(HaiKangEventVo haiKangEventVo);
+    String insertHaiKangSmokeEvent(HaiKangEventSmokeVo eventSmokeVo);
 
 
     // 大华火情事件
@@ -39,4 +43,6 @@ public interface AlarmEventService {
 
     // 住建事件
     String insertHousingConstructionEvent(SensorEventVo sensorEventVo);
+
+    int insertDroneEvent(List<DroneVO> droneArray);
 }

+ 198 - 22
src/main/java/com/sooka/sponest/event/centereventteventcatalogue/service/impl/AlarmEventServiceImpl.java

@@ -9,16 +9,21 @@ import com.ruoyi.common.core.utils.SpringUtils;
 import com.ruoyi.common.core.utils.StringUtils;
 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.sooka.sponest.event.centereventtdeptevent.domain.CentereventDeptEvent;
 import com.sooka.sponest.event.centereventtdeptevent.service.ICentereventDeptEventService;
 import com.sooka.sponest.event.centereventteventcatalogue.domain.CentereventTEventcatalogue;
 import com.sooka.sponest.event.centereventteventcatalogue.domain.DaHuaEventBO;
 import com.sooka.sponest.event.centereventteventcatalogue.domain.dahua.*;
+import com.sooka.sponest.event.centereventteventcatalogue.domain.haikang.EventSmokeVo;
 import com.sooka.sponest.event.centereventteventcatalogue.domain.haikang.EventsVo;
+import com.sooka.sponest.event.centereventteventcatalogue.domain.haikang.HaiKangEventSmokeVo;
 import com.sooka.sponest.event.centereventteventcatalogue.domain.haikang.HaiKangEventVo;
 import com.sooka.sponest.event.centereventteventcatalogue.domain.sensor.SensorEventVo;
 import com.sooka.sponest.event.centereventteventcatalogue.domain.tower.TowerEventVo;
+import com.sooka.sponest.event.centereventteventcatalogue.domain.vo.DroneVO;
+import com.sooka.sponest.event.centereventteventcatalogue.mapper.AlarmEventMapper;
 import com.sooka.sponest.event.centereventteventcatalogue.service.AlarmEventService;
 import com.sooka.sponest.event.centereventteventcatalogue.service.ICentereventTEventcatalogueService;
 import com.sooka.sponest.event.centereventteventtype.domain.CentereventTEventtype;
@@ -28,10 +33,12 @@ import com.sooka.sponest.event.centereventtfirelog.service.ICentereventTFireLogS
 import com.sooka.sponest.event.remoteapi.RemoteDataService;
 import com.sooka.sponest.event.remoteapi.domain.CenterdataTAttach;
 import com.sooka.sponest.event.utils.GWHttpUtilsTest65;
+import com.sooka.sponest.event.utils.NetworkImageToMultipartFile;
 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;
@@ -44,9 +51,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.client.RestTemplate;
 
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
 
 import static com.ruoyi.common.core.utils.DateUtils.YYYY_MM_DD_HH_MM_SS;
 import static com.sooka.sponest.event.utils.EventConstants.*;
@@ -71,6 +76,12 @@ public class AlarmEventServiceImpl implements AlarmEventService {
     @Autowired
     private ICentereventTEventtypeService centereventTEventtypeService;
 
+    @Autowired
+    private RemoteFileService fileService;
+
+    @Autowired
+    private AlarmEventMapper alarmEventMapper;
+
     @Value("${sooka.dahuaservice.detail}")
     private String detailUrl;
 
@@ -83,7 +94,8 @@ public class AlarmEventServiceImpl implements AlarmEventService {
 
     @Transactional
     @Override
-    public String insertHaiKangFireEvent(EventsVo eventsVo) {
+    public String insertHaiKangFireEvent(HaiKangEventVo haiKangEventVo) {
+        EventsVo eventsVo = haiKangEventVo.getEvents()[0];
         // 验证是否配置摄像头通道
         CenterdataTCamera centerdataTCamera = SpringUtils.getBean(RemoteMonitorService.class).getInfoByChannelCode(eventsVo.getSrcIndex()).getData();
         if (StringUtils.isNull(centerdataTCamera)) {
@@ -97,13 +109,13 @@ public class AlarmEventServiceImpl implements AlarmEventService {
             return "";
         }
         // 事件目录
-        String eventName = eventsVo.getData().getAlarm().getEventName();
-        String eventDescription = eventsVo.getData().getAlarm().toString();
-        String longitude = eventsVo.getData().getAlarm().getLongitude();
-        String latitude = eventsVo.getData().getAlarm().getLatitude();
-        String reportor = eventsVo.getSrcName();
-        Date reportTime = eventsVo.getData().getSendTime();
-        String address = eventsVo.getData().getAlarm().getPlaceName();
+        String eventName = centerdataTCamera.getCameraName() + DateUtils.parseDateToStr(YYYY_MM_DD_HH_MM_SS, haiKangEventVo.getSendTime()) + "火情事件";
+        String eventDescription = eventsVo.toString(centerdataTCamera);
+        String longitude = centerdataTCamera.getLongitude();
+        String latitude = centerdataTCamera.getLatitude();
+        String reportor = centerdataTCamera.getCameraName();
+        Date reportTime = haiKangEventVo.getSendTime();
+        String address = eventsVo.getSrcName();
         CentereventTEventcatalogue centereventTEventcatalogue = new CentereventTEventcatalogue("1", null, eventName, eventDescription, longitude, latitude, reportor, reportTime, address);
         centereventTEventcatalogue = this.insertEventCatalogue(centereventTEventcatalogue, centerdataTCamera, null);
         // 事件部门
@@ -111,19 +123,20 @@ public class AlarmEventServiceImpl implements AlarmEventService {
         // 事件日志
         String logId = this.insertEventLog(centereventTEventcatalogue);
         // 附件
-        if (StringUtils.isNotBlank(eventsVo.getData().getImageUrl())) {
+        JSONObject picObj = JSONObject.parseObject(JSON.toJSONString(eventsVo.getData())).getJSONArray("fireDetection").getJSONObject(0);
+        if (StringUtils.isNotBlank(picObj.getString("imageUrl"))) {
             CenterdataTAttach tAttach = new CenterdataTAttach();
             tAttach.setBusId(logId);
-            tAttach.setAttachPath(eventsVo.getData().getImageUrl());
+            tAttach.setAttachPath(picObj.getString("imageUrl").substring(picObj.getString("imageUrl").indexOf("/pic?")));
             tAttach.setBusIndx(BUS_INDEX_1);
             tAttach.setBusSource("HIK_1");
             tAttach.setFileType(FILE_TYPE_1);
             remoteDataService.insertAttach(tAttach);
         }
-        if (StringUtils.isNotBlank(eventsVo.getData().getVisiblePicUrl())) {
+        if (StringUtils.isNotBlank(picObj.getString("visiblePicUrl"))) {
             CenterdataTAttach tAttach = new CenterdataTAttach();
             tAttach.setBusId(logId);
-            tAttach.setAttachPath(eventsVo.getData().getVisiblePicUrl());
+            tAttach.setAttachPath(picObj.getString("visiblePicUrl").substring(picObj.getString("visiblePicUrl").indexOf("/pic?")));
             tAttach.setBusIndx(BUS_INDEX_1);
             tAttach.setBusSource("HIK_1");
             tAttach.setFileType(FILE_TYPE_1);
@@ -149,31 +162,31 @@ public class AlarmEventServiceImpl implements AlarmEventService {
             return "";
         }
         // 验证事件类型是否配置对应报文码值--只能从数据库配
-        CentereventTEventtype centereventTEventtype = centereventTEventtypeService.selectCentereventTEventtypeByCode(haiKangEventVo.getEvents()[0].getData().getText()[0].getAlarmType());
+        CentereventTEventtype centereventTEventtype = centereventTEventtypeService.selectCentereventTEventtypeByCode(eventsVo.getEventTypeCode());
         if (StringUtils.isNull(centereventTEventtype)) {
-            logger.info("无法匹配相关事件!报文码值为:{}", haiKangEventVo.getEvents()[0].getData().getText()[0].getAlarmType());
+            logger.info("无法匹配相关事件!报文码值为:{}", eventsVo.getEventTypeCode());
             return "";
         }
         // 事件目录
         String eventType = centereventTEventtype.getParentId();
         String eventTypeXl = centereventTEventtype.getId();
-        String eventName = centerdataTCamera.getCameraName() + haiKangEventVo.getSendTime() + eventsVo.getData().getText()[0].getAlarmTypeName();
+        String eventName = centerdataTCamera.getCameraName() + DateUtils.parseDateToStr(YYYY_MM_DD_HH_MM_SS, haiKangEventVo.getSendTime()) + eventsVo.getEventName();
         String eventDescription = eventsVo.toString(centerdataTCamera);
         String longitude = centerdataTCamera.getLongitude();
         String latitude = centerdataTCamera.getLatitude();
-        String reportor = eventsVo.getSrcName();
+        String reportor = centerdataTCamera.getCameraName();
         Date reportTime = haiKangEventVo.getSendTime();
-        String address = eventsVo.getData().getText()[0].getOrgName();
+        String address = eventsVo.getSrcName();
         CentereventTEventcatalogue centereventTEventcatalogue = new CentereventTEventcatalogue(eventType, eventTypeXl, eventName, eventDescription, longitude, latitude, reportor, reportTime, address);
         centereventTEventcatalogue = this.insertEventCatalogue(centereventTEventcatalogue, centerdataTCamera, null);
         // 事件部门
         this.insertEventDept(centereventTEventcatalogue, listDept);
         // 事件日志
         String logId = this.insertEventLog(centereventTEventcatalogue);
-        if (StringUtils.isNotBlank(eventsVo.getData().getText()[0].getAlarmPicUrl())) {
+        if (StringUtils.isNotBlank(eventsVo.getSnappedPicUrl())) {
             CenterdataTAttach tAttach = new CenterdataTAttach();
             tAttach.setBusId(logId);
-            tAttach.setAttachPath(eventsVo.getData().getText()[0].getAlarmPicUrl());
+            tAttach.setAttachPath(eventsVo.getSnappedPicUrl());
             tAttach.setBusIndx("bus_indx_city");
             tAttach.setBusSource("HIK_2");
             tAttach.setFileType(FILE_TYPE_1);
@@ -201,6 +214,7 @@ public class AlarmEventServiceImpl implements AlarmEventService {
         centereventTEventcatalogue.setCreateBy(centerdataTCamera.getId());
         centereventTEventcatalogue.setCreateName(centerdataTCamera.getCameraName());
         centereventTEventcatalogue.setCreateTime(null == createTime ? DateUtils.getNowDate() : createTime);
+        logger.info("写入事件主表:-->{}", centereventTEventcatalogue.getEventCode());
         centereventTEventcatalogueService.insertCentereventTEventcatalogue(centereventTEventcatalogue);
         return centereventTEventcatalogue;
     }
@@ -256,6 +270,7 @@ public class AlarmEventServiceImpl implements AlarmEventService {
             centereventTDeptEvent.setCreateTime(centereventTEventcatalogue.getCreateTime());
             centereventTDeptEventService.insertCentereventTDeptEvent(centereventTDeptEvent);
         });
+        logger.info("写入事件部门表:-->{}", centereventTEventcatalogue.getEventCode());
     }
 
     // 事件日志
@@ -268,6 +283,13 @@ public class AlarmEventServiceImpl implements AlarmEventService {
         centereventTFireLog.setOperationType(LOG_OPER_TYPE_3);
         centereventTFireLog.setCreateName(centereventTEventcatalogue.getCreateName());
         centereventTFireLog.setCreateTime(centereventTEventcatalogue.getCreateTime());
+        if(StringUtils.isNotEmpty(centereventTEventcatalogue.getLongitude())){
+            centereventTFireLog.setLongitude(centereventTEventcatalogue.getLongitude());
+        }
+        if(StringUtils.isNotEmpty(centereventTEventcatalogue.getLatitude())){
+            centereventTFireLog.setLatitude(centereventTEventcatalogue.getLatitude());
+        }
+        logger.info("写入事件部门表:-->{}", centereventTEventcatalogue.getEventCode());
         centereventTFireLogService.insertCentereventTFireLog(centereventTFireLog);
         return centereventTFireLog.getId();
     }
@@ -673,4 +695,158 @@ public class AlarmEventServiceImpl implements AlarmEventService {
         this.insertEventLog(centereventTEventcatalogue);
         return centereventTEventcatalogue.getEventCode() + "_" + eventtype.getEventTypeName();
     }
+
+
+    @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 {
+                Optional.ofNullable(NetworkImageToMultipartFile.downloadImageToMultipartFile(item.getPhotoPath()))
+                        .map(multipartFile -> fileService.upload(multipartFile).getData())
+                        .ifPresent(data -> item.setLocalPath(data.getUrl()));
+            } catch (Exception e) {
+                logger.error("Failed to process image for item {}: {}", item.getId(), e.getMessage());
+            }
+        });
+        // 通过无人机id, 获取无人机信息和绑定的指挥中心
+        alarmData.forEach(alarm->{
+            CentermonitorTUav data = SpringUtils.getBean(RemoteMonitorService.class).selectUavByUavId(alarm.getCopterId()).getData();
+            /**
+             * 牛羊 Sheep:222
+             * 车辆 Car: 218
+             */
+
+            String eventName = data.getUavName()+"上报"+MapUtils.getString(eventLabel, alarm.getAlarmType())+"事件";
+            String eventDescription = "基站:"+data.getBaseStationName()+",无人机:"+data.getUavName()+",经度:"+alarm.getLongitude()+",纬度:"+alarm.getLatitude()+",海拔:"+alarm.getAltitude();
+
+            //创建事件主体, 写入事件表.
+            CentereventTEventcatalogue centereventTEventcatalogue = new CentereventTEventcatalogue("2", MapUtils.getString(eventType, alarm.getAlarmType()), eventName, eventDescription, alarm.getLongitude(), alarm.getLatitude(), data.getUavName(), alarm.getCreationTime(), "");
+            centereventTEventcatalogue.setLongitude(alarm.getLongitude());
+            centereventTEventcatalogue.setLatitude(alarm.getLatitude());
+            centereventTEventcatalogue.setReportSource(REPORTING_SOURCE_6);
+            CenterdataTCamera centerdataTCamera = new CenterdataTCamera();
+            centerdataTCamera.setId(alarm.getCopterId());
+            centerdataTCamera.setCameraName(data.getUavName());
+            centereventTEventcatalogue = this.insertEventCatalogue(centereventTEventcatalogue, centerdataTCamera, alarm.getCreationTime());
+
+            String eventCode = centereventTEventcatalogue.getEventCode();
+            String createName = centereventTEventcatalogue.getCreateName();
+            Date createTime = centereventTEventcatalogue.getCreateTime();
+            // 事件部门
+            data.getDeptList().forEach(item -> {
+                CentereventDeptEvent centereventTDeptEvent = new CentereventDeptEvent();
+                centereventTDeptEvent.setId(IdUtils.fastSimpleUUID());
+                centereventTDeptEvent.setEventCode(eventCode);
+                centereventTDeptEvent.setDeptId(item.getDeptId());
+                centereventTDeptEvent.setDeptName(item.getDeptName());
+                centereventTDeptEvent.setIsUrged(SYS_ISURGE_2);
+                centereventTDeptEvent.setEventStatus("上报");
+                centereventTDeptEvent.setEventStatusValue(FOREST_EVENT_STATUS_1);
+                centereventTDeptEvent.setDeptHandleType(DEPT_HANDLE_TYPE_2);
+                centereventTDeptEvent.setCreateBy(alarm.getCopterId());
+                centereventTDeptEvent.setCreateName(createName);
+                centereventTDeptEvent.setCreateTime(createTime);
+                centereventTDeptEventService.insertCentereventTDeptEvent(centereventTDeptEvent);
+            });
+
+
+            //事件日志
+            CentereventTFireLog centereventTFireLog = new CentereventTFireLog();
+            centereventTFireLog.setId(IdUtils.simpleUUID());
+            centereventTFireLog.setEventCode(centereventTEventcatalogue.getEventCode());
+            centereventTFireLog.setLogContent(centereventTEventcatalogue.getEventName() + System.getProperty("line.separator") + centereventTEventcatalogue.getEventDescription());
+            centereventTFireLog.setOperation(BUS_OPER_TYPE_2);
+            centereventTFireLog.setOperationType(LOG_OPER_TYPE_4);
+            centereventTFireLog.setCreateBy(alarm.getCopterId());
+            centereventTFireLog.setCreateName(centereventTEventcatalogue.getCreateName());
+            centereventTFireLog.setCreateTime(centereventTEventcatalogue.getCreateTime());
+            if(StringUtils.isNotEmpty(centereventTEventcatalogue.getLongitude())){
+                centereventTFireLog.setLongitude(centereventTEventcatalogue.getLongitude());
+            }
+            if(StringUtils.isNotEmpty(centereventTEventcatalogue.getLatitude())){
+                centereventTFireLog.setLatitude(centereventTEventcatalogue.getLatitude());
+            }
+            centereventTFireLogService.insertCentereventTFireLog(centereventTFireLog);
+
+            //事件附件
+            if (StringUtils.isNotBlank(alarm.getLocalPath())) {
+                CenterdataTAttach tAttach = new CenterdataTAttach();
+                tAttach.setBusId(centereventTFireLog.getId());
+                tAttach.setAttachPath(alarm.getLocalPath());
+                tAttach.setBusIndx(BUS_INDEX_2);
+                tAttach.setBusSource("UAV_1");
+                tAttach.setFileType(FILE_TYPE_1);
+                remoteDataService.insertAttach(tAttach);
+            }
+        });
+
+        return alarmEventMapper.insertDrone(alarmData);
+    }
+
+
+    @Transactional
+    @Override
+    public String insertHaiKangSmokeEvent(HaiKangEventSmokeVo eventSmokeVo) {
+        EventSmokeVo eventsVo = eventSmokeVo.getEvents()[0];
+        // 验证是否配置摄像头通道
+        CenterdataTCamera centerdataTCamera = SpringUtils.getBean(RemoteMonitorService.class).getInfoByChannelCode(eventsVo.getSrcIndex()).getData();
+        if (StringUtils.isNull(centerdataTCamera)) {
+            logger.info(ERROR_MSG_CHANNEL, eventsVo.getSrcIndex());
+            return "";
+        }
+        // 验证是否配置指挥中心
+        List<CenterdataTAidevicedept> listDept = SpringUtils.getBean(RemoteMonitorService.class).listForCommandCenter(centerdataTCamera.getId(), "1", "1").getData();
+        if (StringUtils.isEmpty(listDept)) {
+            logger.info(ERROR_MSG_DEPT, centerdataTCamera.getCameraCode());
+            return "";
+        }
+        // 验证事件类型是否配置对应报文码值--只能从数据库配
+        CentereventTEventtype centereventTEventtype = centereventTEventtypeService.selectCentereventTEventtypeByCode(eventsVo.getEventTypeCode());
+        if (StringUtils.isNull(centereventTEventtype)) {
+            logger.info("无法匹配相关事件!报文码值为:{}", eventsVo.getEventTypeCode());
+            return "";
+        }
+        // 事件目录
+        String eventType = centereventTEventtype.getParentId();
+        String eventTypeXl = centereventTEventtype.getId();
+        String eventName = centerdataTCamera.getCameraName() + DateUtils.parseDateToStr(YYYY_MM_DD_HH_MM_SS, eventSmokeVo.getSendTime()) + eventsVo.getEventName();
+        String eventDescription = eventsVo.toString(centerdataTCamera);
+        String longitude = centerdataTCamera.getLongitude();
+        String latitude = centerdataTCamera.getLatitude();
+        String reportor = centerdataTCamera.getCameraName();
+        Date reportTime = eventSmokeVo.getSendTime();
+        String address = eventsVo.getSrcName();
+        CentereventTEventcatalogue centereventTEventcatalogue = new CentereventTEventcatalogue(eventType, eventTypeXl, eventName, eventDescription, longitude, latitude, reportor, reportTime, address);
+        centereventTEventcatalogue = this.insertEventCatalogue(centereventTEventcatalogue, centerdataTCamera, null);
+        // 事件部门
+        this.insertEventDept(centereventTEventcatalogue, listDept);
+        // 事件日志
+        String logId = this.insertEventLog(centereventTEventcatalogue);
+        if (StringUtils.isNotBlank(eventsVo.getSnappedPicUrl())) {
+            CenterdataTAttach tAttach = new CenterdataTAttach();
+            tAttach.setBusId(logId);
+            JSONObject jsonObject = JSON.parseObject(MapUtils.getString(eventsVo.getData(),"transInfo"));
+            String imageUrl = jsonObject.getString("imageUrl");
+
+            Optional.ofNullable(NetworkImageToMultipartFile.downloadImageToMultipartFile(imageUrl))
+                    .map(multipartFile -> fileService.upload(multipartFile).getData())
+                    .ifPresent(data -> tAttach.setAttachPath(data.getUrl()));
+
+            tAttach.setBusIndx("bus_indx_smoke");
+            tAttach.setBusSource("HIK_3");
+            tAttach.setFileType(FILE_TYPE_1);
+            remoteDataService.insertAttach(tAttach);
+        }
+        return centereventTEventcatalogue.getEventCode();
+    }
 }

+ 1 - 1
src/main/java/com/sooka/sponest/event/centereventteventcatalogue/service/impl/CenterEventViewServiceImpl.java

@@ -135,7 +135,7 @@ public class CenterEventViewServiceImpl extends BaseService implements ICenterEv
         // 查附件
         List<CenterdataTAttach> files = remoteDataService.remotelistNew(new CenterdataTAttach(logIds)).getData();
         // 附件前缀
-        Map<String, String> keyMap = SpringUtils.getBean(RemoteConfigService.class).remotegetConfigMap(Arrays.asList(FILE_DOWNLOAD, FILE_PREFIX_LOCAL, FILE_PREFIX_HIK1, FILE_PREFIX_HIK2, FILE_PREFIX_DH1, FILE_PREFIX_DH2)).getData();
+        Map<String, String> keyMap = SpringUtils.getBean(RemoteConfigService.class).remotegetConfigMap(Arrays.asList(FILE_DOWNLOAD, FILE_PREFIX_LOCAL, FILE_PREFIX_HIK1, FILE_PREFIX_HIK2, FILE_PREFIX_HIK3, FILE_PREFIX_DH1, FILE_PREFIX_DH2)).getData();
         String token = RemoteApiUtil.getInstance().getToken();// 大华token
         // 拼接组合
         logs.forEach(log -> {

+ 8 - 0
src/main/java/com/sooka/sponest/event/test/TestController.java

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.common.core.utils.DateUtils;
 import com.ruoyi.common.core.web.controller.BaseController;
+import com.ruoyi.common.core.web.domain.AjaxResult;
 import com.sooka.sponest.event.centereventteventcatalogue.domain.dahua.DaHuaFireEventVO;
 import com.sooka.sponest.event.centereventteventcatalogue.domain.dahua.InfoVO;
 import org.slf4j.Logger;
@@ -42,4 +43,11 @@ public class TestController extends BaseController {
         logger.info("===接口耗时:" + (System.currentTimeMillis() - start));
         return R.ok();
     }
+
+
+    @PostMapping("/testReport")
+    public AjaxResult testReportJsonObj(@RequestBody String jsonStr){
+        logger.info("测试接受数据--->: {}", jsonStr);
+        return AjaxResult.success();
+    }
 }

+ 3 - 0
src/main/java/com/sooka/sponest/event/utils/EventConstants.java

@@ -20,6 +20,7 @@ public class EventConstants {
     public static final String REPORTING_SOURCE_1 = "reporting_source_1";// AI
     public static final String REPORTING_SOURCE_4 = "reporting_source_4";// 传感器
     public static final String REPORTING_SOURCE_5 = "reporting_source_5";// 数字住建
+    public static final String REPORTING_SOURCE_6 = "reporting_source_6";// 数字住建
 
     // 是否催办
     public static final String SYS_ISURGE_2 = "sys_isurge_2";// 否
@@ -36,6 +37,7 @@ public class EventConstants {
     public static final String LOG_OPER_TYPE_1 = "log_oper_type_1";
     public static final String LOG_OPER_TYPE_2 = "log_oper_type_2";
     public static final String LOG_OPER_TYPE_3 = "log_oper_type_3";// AI反馈
+    public static final String LOG_OPER_TYPE_4 = "log_oper_type_4";// 无人机
 
     // 附件索引
     public static final String BUS_INDEX_1 = "bus_indx_forest";// 火情事件
@@ -51,6 +53,7 @@ public class EventConstants {
     public static final String FILE_PREFIX_APP = "appUrl";
     public static final String FILE_PREFIX_HIK1 = "HIK_1";
     public static final String FILE_PREFIX_HIK2 = "HIK_2";
+    public static final String FILE_PREFIX_HIK3 = "HIK_3";
     public static final String FILE_PREFIX_DH1 = "DH_1";
     public static final String FILE_PREFIX_DH2 = "DH_2";
     public static final String FILE_DOWNLOAD = "downloadUrl";

+ 112 - 0
src/main/java/com/sooka/sponest/event/utils/NetworkImageToMultipartFile.java

@@ -0,0 +1,112 @@
+package com.sooka.sponest.event.utils;
+
+import org.springframework.mock.web.MockMultipartFile;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.net.ssl.*;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.X509Certificate;
+
+public class NetworkImageToMultipartFile {
+
+    /**
+     * 从网络路径下载图片并转换为 MultipartFile
+     * @param imageUrl 图片的网络路径
+     * @return MultipartFile 对象
+     */
+    public static MultipartFile downloadImageToMultipartFile(String imageUrl) {
+        try {
+            // 禁用 SSL 证书验证(仅适用于开发环境)
+            disableSSLVerification();
+
+            // 打开连接
+            URL url = new URL(imageUrl);
+            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+            connection.setRequestMethod("GET");
+
+            int responseCode = connection.getResponseCode();
+            if (responseCode == HttpURLConnection.HTTP_OK) {
+                // 获取输入流
+                InputStream inputStream = connection.getInputStream();
+
+                // 获取文件名(从 URL 中提取)
+                String fileName = imageUrl.substring(imageUrl.lastIndexOf('/') + 1);
+
+                // 创建 MockMultipartFile
+                MultipartFile multipartFile = new MockMultipartFile(
+                        fileName, // 文件名
+                        fileName, // 原始文件名
+                        "image/jpeg", // 文件内容类型
+                        inputStream // 输入流
+                );
+
+                // 关闭输入流
+                inputStream.close();
+
+                return multipartFile;
+            } else {
+                System.out.println("Failed to download image. Server responded with code: " + responseCode);
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+            System.out.println("Error downloading image: " + e.getMessage());
+        } catch (NoSuchAlgorithmException | KeyManagementException e) {
+            e.printStackTrace();
+            System.out.println("Error disabling SSL verification: " + e.getMessage());
+        }
+        return null;
+    }
+
+    /**
+     * 禁用 SSL 证书验证(仅适用于开发环境)
+     */
+    public static void disableSSLVerification() throws NoSuchAlgorithmException, KeyManagementException {
+        // 创建一个信任所有证书的 TrustManager
+        TrustManager[] trustAllCerts = new TrustManager[]{
+                new X509TrustManager() {
+                    public X509Certificate[] getAcceptedIssuers() {
+                        return null;
+                    }
+
+                    public void checkClientTrusted(X509Certificate[] certs, String authType) {
+                    }
+
+                    public void checkServerTrusted(X509Certificate[] certs, String authType) {
+                    }
+                }
+        };
+
+        // 安装全局的信任管理器
+        SSLContext sc = SSLContext.getInstance("SSL");
+        sc.init(null, trustAllCerts, new java.security.SecureRandom());
+        HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
+
+        // 创建一个 HostnameVerifier,跳过主机名验证
+        HostnameVerifier allHostsValid = new HostnameVerifier() {
+            public boolean verify(String hostname, SSLSession session) {
+                return true;
+            }
+        };
+
+        HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid);
+    }
+
+    public static void main(String[] args) {
+        String imageUrl = "https://47.93.50.30:443/media/dji-photos/wayline/1742354657053.JPG";
+
+        // 下载图片并转换为 MultipartFile
+        MultipartFile multipartFile = downloadImageToMultipartFile(imageUrl);
+
+        if (multipartFile != null) {
+            System.out.println("File Name: " + multipartFile.getOriginalFilename());
+            System.out.println("File Size: " + multipartFile.getSize() + " bytes");
+        } else {
+            System.out.println("Failed to convert image to MultipartFile.");
+        }
+    }
+}

+ 48 - 0
src/main/java/com/sooka/sponest/event/utils/URLToJSONConverter.java

@@ -0,0 +1,48 @@
+package com.sooka.sponest.event.utils;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+
+public class URLToJSONConverter {
+
+    /**
+     * 将 URL 编码的字符串转换为格式化的 JSON 字符串
+     * @param encodedData URL 编码的字符串
+     * @return 格式化的 JSON 字符串
+     */
+    public static String convertURLToJSON(String encodedData) {
+        try {
+            // 解码 URL 编码的字符串
+            String decodedData = URLDecoder.decode(encodedData, "UTF-8");
+
+            // 去掉等号(如果存在)
+            if (decodedData.endsWith("=")) {
+                decodedData = decodedData.substring(0, decodedData.length() - 1);
+            }
+
+            // 将字符串解析为 JSON 对象
+            JSONObject jsonObject = JSON.parseObject(decodedData);
+
+            // 格式化 JSON 输出
+            return jsonObject.toJSONString();
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+            return "Error: UnsupportedEncodingException";
+        } catch (Exception e) {
+            e.printStackTrace();
+            return "Error: Invalid input format";
+        }
+    }
+
+    public static void main(String[] args) {
+        // 示例 URL 编码的 JSON 数据
+        String encodedData = "%7B%22data%22%3A%5B%7B%22alarmType%22%3A%22Sleep%22%2C%22altitude%22%3A0.0%2C%22createTime%22%3A1742354657000%2C%22latitude%22%3A38.185382%2C%22longitude%22%3A107.487296322%2C%22photoId%22%3A518%2C%22photoPath%22%3A%22https%3A%2F%2F47.93.50.30%3A443%2Fmedia%2Fdji-photos%2Fwayline%2F1742354657053.JPG%22%2C%22timeStamp%22%3A0%7D%5D%7D";
+
+        // 调用方法并打印结果
+        String result = convertURLToJSON(encodedData);
+        System.out.println(result);
+    }
+}

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

@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.sooka.sponest.event.centereventteventcatalogue.mapper.AlarmEventMapper">
+    <resultMap id="resultDroneMapper" type="droneVo">
+        <id column="id" jdbcType="VARCHAR" property="id"/>
+        <result column="time_stamp" jdbcType="VARCHAR" property="timeStamp"/>
+        <result column="altitude" jdbcType="VARCHAR" property="altitude"/>
+        <result column="alarm_type" jdbcType="VARCHAR" property="alarmType"/>
+        <result column="create_time" jdbcType="VARCHAR" property="createTime"/>
+        <result column="photo_path" jdbcType="VARCHAR" property="photoPath"/>
+        <result column="latitude" jdbcType="VARCHAR" property="latitude"/>
+        <result column="longitude" jdbcType="VARCHAR" property="longitude"/>
+        <result column="photo_id" jdbcType="VARCHAR" property="photoId"/>
+        <result column="photo_name" jdbcType="VARCHAR" property="photoName"/>
+        <result column="local_path" jdbcType="VARCHAR" property="localPath"/>
+    </resultMap>
+
+    <insert id="insertDrone" parameterType="list">
+        insert into centerevent_t_drone
+        (id, time_stamp, altitude, alarm_type, create_time, photo_path, latitude, longitude, photo_id, photo_name, local_path)
+        values
+        <foreach collection="list" item="item" index="index" separator=",">
+            (#{item.id}, #{item.timeStamp}, #{item.altitude}, #{item.alarmType}, #{item.creationTime}, #{item.photoPath}, #{item.latitude}, #{item.longitude}, #{item.photoId}, #{item.photoName}, #{item.localPath})
+        </foreach>
+    </insert>
+</mapper>