lyq 1 rok temu
rodzic
commit
1bf4717920

+ 0 - 8
src/main/java/com/sooka/sponest/event/centereventteventcatalogue/controller/AlarmEventController.java

@@ -1,16 +1,11 @@
 package com.sooka.sponest.event.centereventteventcatalogue.controller;
 
-import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
-import com.dahuatech.icc.exception.ClientException;
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.common.core.utils.StringUtils;
-import com.ruoyi.common.core.web.domain.AjaxResult;
-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.HaiKangEventVo;
-import com.sooka.sponest.event.centereventteventcatalogue.domain.sensor.SensorEventVo;
 import com.sooka.sponest.event.centereventteventcatalogue.service.AlarmEventService;
 import com.sooka.sponest.event.centereventtreportmessage.domain.CentereventTReportmessage;
 import com.sooka.sponest.event.centereventtreportmessage.service.ICentereventTReportmessageService;
@@ -24,8 +19,6 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.text.SimpleDateFormat;
-import java.util.Date;
 import java.util.List;
 
 @Api(tags = "海康")
@@ -143,7 +136,6 @@ public class AlarmEventController {
     }
 
 
-
 //    /**
 //     * 签收后图片异常补救接口
 //     *

+ 9 - 13
src/main/java/com/sooka/sponest/event/centereventteventcatalogue/controller/FireIncidentController.java

@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.dahuatech.icc.exception.ClientException;
 import com.ruoyi.common.core.domain.R;
-import com.ruoyi.common.core.utils.SpringUtils;
 import com.ruoyi.common.core.utils.StringUtils;
 import com.ruoyi.common.core.web.domain.AjaxResult;
 import com.sooka.sponest.event.centereventteventcatalogue.domain.DaHuaEventBO;
@@ -26,9 +25,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.text.SimpleDateFormat;
-import java.util.Arrays;
 import java.util.Date;
-import java.util.List;
 
 @RestController
 @RequestMapping("/fireIncident")
@@ -42,7 +39,6 @@ public class FireIncidentController {
     @Autowired
     private ICentereventTReportmessageService centereventTReportmessageService;
 
-
     @Autowired
     private IFireIncidentService fireIncidentService;
 
@@ -51,6 +47,7 @@ public class FireIncidentController {
 
     /**
      * 传感器事件上报
+     *
      * @param sensorEventVo
      * @return R
      */
@@ -80,14 +77,14 @@ public class FireIncidentController {
 
     /**
      * 事件回查图片
-     * @param eventBO
-     *  eventCode 事件编号
-     *  logId  事件日志id
+     *
+     * @param eventBO eventCode 事件编号
+     *                logId  事件日志id
      * @return AjaxResult
      * @throws ClientException 异常类
      */
     @PostMapping("/updateFireEventImage")
-    public AjaxResult  updateFireEventImage(@RequestBody DaHuaEventBO eventBO) throws ClientException {
+    public AjaxResult updateFireEventImage(@RequestBody DaHuaEventBO eventBO) throws ClientException {
         CentereventTReportmessage centereventTReportmessage = null;
         if (StringUtils.isNotBlank(eventBO.getEventCode()) && StringUtils.isNotBlank(eventBO.getLogId())) {
             // 通过eventCode获取报文信息
@@ -106,6 +103,7 @@ public class FireIncidentController {
 
     /**
      * 上报事件
+     *
      * @param RemoteFireVO
      * @return
      */
@@ -114,8 +112,8 @@ public class FireIncidentController {
         try {
             //根据事件小类,反查事件大类
             CentereventTEventtype eventtype = centereventTEventtypeService.selectCentereventTEventtypeById(remoteFireVO.getEventType());
-            if(StringUtils.isNull(eventtype)){
-                return AjaxResult.error(201,"参数错误");
+            if (StringUtils.isNull(eventtype)) {
+                return AjaxResult.error(201, "参数错误");
             }
             remoteFireVO.setEventSubType(eventtype.getParentId());
             //处理上报逻辑
@@ -129,11 +127,9 @@ public class FireIncidentController {
             tReportMessage.setContext(JSON.toJSONString(remoteFireVO));
             centereventTReportmessageService.insertCentereventTReportmessage(tReportMessage);
         } catch (Exception e) {
-            e.printStackTrace();
             logger.error(e.getMessage());
-            return AjaxResult.error(500,"上报失败");
+            return AjaxResult.error(500, "上报失败");
         }
         return AjaxResult.success("上报成功");
     }
-
 }

+ 16 - 21
src/main/java/com/sooka/sponest/event/centereventteventcatalogue/service/impl/FireInsidentServiceImpl.java

@@ -25,6 +25,7 @@ import static com.sooka.sponest.event.utils.EventConstants.*;
 
 @Service
 public class FireInsidentServiceImpl implements IFireIncidentService {
+
     Logger logger = LoggerFactory.getLogger(FireInsidentServiceImpl.class);
 
     @Autowired
@@ -33,8 +34,6 @@ public class FireInsidentServiceImpl implements IFireIncidentService {
     @Autowired
     private RemoteDataService remoteDataService;
 
-
-
     /**
      * 119平台上报事件
      *
@@ -43,28 +42,25 @@ public class FireInsidentServiceImpl implements IFireIncidentService {
      */
     @Override
     public String insertFireIncident(RemoteFireVO remoteFireVO) {
-
         // 事件目录
-        CentereventTEventcatalogue eventcatalogue =
-                new CentereventTEventcatalogue(
-                        remoteFireVO.getEventSubType(),
-                        remoteFireVO.getEventType(),
-                        null == remoteFireVO.getEventName() || "".equals(remoteFireVO.getEventName())?remoteFireVO.getEventLocation() + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(remoteFireVO.getEventReportTime()) + remoteFireVO.getEventType():remoteFireVO.getEventName(),
-                        remoteFireVO.getEventDescription(),
-                        remoteFireVO.getEventLongitude(),
-                        remoteFireVO.getEventLatitude(),
-                        remoteFireVO.getEventReporter(),
-                        remoteFireVO.getEventReportTime(),
-                        remoteFireVO.getEventLocation(),
-                        REPORTING_SOURCE_5,
-                        "确认",
-                        FOREST_EVENT_STATUS_7
-                );
+        CentereventTEventcatalogue eventcatalogue = new CentereventTEventcatalogue(
+                remoteFireVO.getEventSubType(),
+                remoteFireVO.getEventType(),
+                null == remoteFireVO.getEventName() || "".equals(remoteFireVO.getEventName()) ? remoteFireVO.getEventLocation() + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(remoteFireVO.getEventReportTime()) + remoteFireVO.getEventType() : remoteFireVO.getEventName(),
+                remoteFireVO.getEventDescription(),
+                remoteFireVO.getEventLongitude(),
+                remoteFireVO.getEventLatitude(),
+                remoteFireVO.getEventReporter(),
+                remoteFireVO.getEventReportTime(),
+                remoteFireVO.getEventLocation(),
+                REPORTING_SOURCE_5,
+                "确认",
+                FOREST_EVENT_STATUS_7);
         //增加判断,防止没有token时空指针异常。
         LoginUser loginUser = SecurityUtils.getLoginUser();
         StringBuilder userId = new StringBuilder();
         StringBuilder nickName = new StringBuilder();
-        if(null != loginUser){
+        if (null != loginUser) {
             userId.append(loginUser.getSysUser().getUserId());
             nickName.append(loginUser.getSysUser().getNickName());
         }
@@ -74,7 +70,7 @@ public class FireInsidentServiceImpl implements IFireIncidentService {
         listDept.add(new CenterdataTAidevicedept(3777L, "市消防救援支队"));
         String logId = alarmEventService.getFunction(eventcatalogue, camera, null, listDept);
         if (StringUtils.isNotBlank(remoteFireVO.getEventPicture())) {
-            String[] pictures =remoteFireVO.getEventPicture().split(",");
+            String[] pictures = remoteFireVO.getEventPicture().split(",");
             // 添加新附件
             List<CenterdataTAttach> attachList = new ArrayList<>();
             for (String picture : pictures) {
@@ -90,5 +86,4 @@ public class FireInsidentServiceImpl implements IFireIncidentService {
         }
         return eventcatalogue.getEventCode();
     }
-
 }