فهرست منبع

pc事件上报接口

Memory_LG 2 ماه پیش
والد
کامیت
3232d2fe08

+ 1 - 1
event-ui/src/views/event/eventProcess/index.vue

@@ -163,7 +163,7 @@
 </template>
 <script>
 import {getCompositeEventDetail, selectCompositeEventList} from "@/api/event/eventProcess/eventProcess";
-import {getEventTypeTree} from "@/api/event/eventType/eventType";
+import {getEventTypeTree} from "@/api/event/eventtype/eventtype";
 
 export default {
   name: "eventProcess",

+ 1 - 1
event-ui/src/views/event/eventtype/index.vue

@@ -73,7 +73,7 @@ import {
   addEventType,
   updateEventType,
   delEventType
-} from "@/api/event/eventType/eventType";
+} from "@/api/event/eventtype/eventtype";
 import treeSelect from "@riophae/vue-treeselect";
 import "@riophae/vue-treeselect/dist/vue-treeselect.css";
 

+ 7 - 0
src/main/java/com/sooka/sponest/event/eventProcess/controller/EventProcessController.java

@@ -58,6 +58,13 @@ public class EventProcessController extends BaseController {
         return AjaxResult.success(eventProcessService.getCompositeEventDetail(eventInfo));
     }
 
+    /**
+     * 事件中心 - 事件上报
+     */
+    @PostMapping("/insertProcessEvent")
+    public AjaxResult insertProcessEvent(@RequestBody EventInfo eventInfo){
+        return eventProcessService.insertProcessEvent(eventInfo);
+    }
     //******************************************待确认事件块**************************************************/
 
     /**

+ 2 - 0
src/main/java/com/sooka/sponest/event/eventProcess/service/EventProcessService.java

@@ -73,4 +73,6 @@ public interface EventProcessService {
     void insertHousingEvent(SensorEventVo sensorEventVo);
 
     List<EventInfoBO> selectProcessAttachFromUnconfirmed();
+
+    AjaxResult insertProcessEvent(EventInfo eventInfo);
 }

+ 52 - 7
src/main/java/com/sooka/sponest/event/eventProcess/service/impl/EventProcessServiceImpl.java

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
 import com.ruoyi.common.core.utils.DateUtils;
 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.common.core.web.domain.AjaxResult;
 import com.ruoyi.common.datascope.annotation.DataScopeMutiDept;
 import com.ruoyi.common.security.utils.SecurityUtils;
@@ -660,6 +661,52 @@ public class EventProcessServiceImpl extends BaseServiceImpl implements EventPro
         return eventProcessMapper.selectProcessAttachFromUnconfirmed();
     }
 
+    @Override
+    public AjaxResult insertProcessEvent(EventInfo eventInfo) {
+        try {
+            SysUser sysUser = SecurityUtils.getLoginUser().getSysUser();
+            if (null == sysUser) {
+                return AjaxResult.error(EventEnum.USER_NOT_FOUND.getDescribe());
+            }
+
+            //设置事件Id
+            eventInfo.setEventId(IdUtils.fastSimpleUUID());
+
+            // 验证是否配置摄像头通道
+            CenterdataTCamera centerdataTCamera = SpringUtils.getBean(RemoteMonitorService.class).getInfoByChannelCode(eventInfo.getCameraCode()).getData();
+            if (StringUtils.isNull(centerdataTCamera)) {
+                logger.error("无法匹配相关设备!ChannelSn:{}", eventInfo.getCameraCode());
+                return AjaxResult.error(EventEnum.CAMERA_NOT_FOUND.getDescribe());
+            }
+
+            // 验证是否配置指挥中心
+            List<CenterdataTAidevicedept> listDept = SpringUtils.getBean(RemoteMonitorService.class).listForCommandCenter(eventInfo.getCameraCode(), "1", "0").getData();
+            if (StringUtils.isEmpty(listDept)) {
+                logger.info("无法匹配相关部门!摄像头编号为:{}", centerdataTCamera.getCameraCode());
+                return AjaxResult.error(EventEnum.DEPT_NOT_FOUND.getDescribe());
+            }
+
+            //插入行管局部门
+            eventDeptService.insertEventDept(eventInfo.getEventId(), listDept);
+
+            // 插入事件日志
+            String logId = eventLogService.insertEventLog(eventInfo.getEventId(), sysUser.getDeptNames() + sysUser.getNickName() + EventEnum.EVENT_CONFIRM.getDescribe(), EVENT_LOG_TYPE_2, EVENT_LOG_SOURCE_2, String.valueOf(sysUser.getUserId()), DateUtils.getNowDate());
+
+            //存储附件
+            if (!eventInfo.getPictureList().isEmpty()) {
+                List<EventAttach> attachList = new ArrayList<>();
+                for (int i = 0; i < eventInfo.getPictureList().size(); i++) {
+                    attachList.add(new EventAttach(logId, eventInfo.getEventId(), eventInfo.getPictureList().get(i), EVENT_LOG_FILE_SOURCE_2, FILE_URL, i));
+                }
+                moveAttach(attachList, eventInfo.getEventId());
+            }
+            return AjaxResult.success("创建成功");
+        } catch (Exception e) {
+            return AjaxResult.error(e.getMessage());
+        }
+
+    }
+
     /**
      * 列表设置附件路径
      *
@@ -686,20 +733,18 @@ public class EventProcessServiceImpl extends BaseServiceImpl implements EventPro
 
     private void moveAttach(List<EventAttach> attachList, String eventId) {
 
-//        List<Integer> ids = new ArrayList<>();
-//        List<String> newPathList = new ArrayList<>();
         //附件拼接前缀
         attachList = AttachUtils.setPath(attachList, eventId, eventAttachService);
 
         Map<String, Object> fileResult = AttachUtils.uploadUrlToFileServer(attachList, fileService);
 
-
-
         //存储附件信息
         if (MapUtils.getBoolean(fileResult, "flag")) {
-            eventAttachService.batchInsertEventAttachProcess(attachList.get(0).getLogId(), eventId, Arrays.asList(MapUtils.getString(fileResult,"paths").split(",")), EVENT_LOG_FILE_SOURCE_99, FILE_URL);
-            eventAttachService.removeAttachByIds(Arrays.asList(MapUtils.getString(fileResult,"ids").split(",")));
-        }else{
+            eventAttachService.batchInsertEventAttachProcess(attachList.get(0).getLogId(), eventId, Arrays.asList(MapUtils.getString(fileResult, "paths").split(",")), EVENT_LOG_FILE_SOURCE_99, FILE_URL);
+            if (StringUtils.isNotEmpty(MapUtils.getString(fileResult, "ids"))) {
+                eventAttachService.removeAttachByIds(Arrays.asList(MapUtils.getString(fileResult, "ids").split(",")));
+            }
+        } else {
             //将事件id写入到补偿表; 等待补偿机制处理附件
             eventAttachService.insertCompensationByEventId(eventId, DateUtils.getTime());
         }