lyq 1 gadu atpakaļ
vecāks
revīzija
90664e573e

+ 40 - 3
src/main/java/com/sooka/sponest/event/centereventteventcatalogue/controller/CentereventTEventcatalogueController.java

@@ -1,5 +1,6 @@
 package com.sooka.sponest.event.centereventteventcatalogue.controller;
 
+import com.alibaba.fastjson.JSON;
 import com.ruoyi.common.core.constant.HttpStatus;
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.common.core.utils.SpringUtils;
@@ -31,6 +32,8 @@ import com.sooka.sponest.event.remoteapi.domain.CenterdataTAttach;
 import com.sooka.sponest.event.utils.EventProducerUtil;
 import com.sooka.sponest.event.utils.ExcelUtil;
 import com.sooka.sponest.event.utils.RemoteApiUtil;
+import com.sooka.sponest.exchange.api.RemoteExchangeService;
+import com.sooka.sponest.exchange.api.domain.FireEventVO;
 import com.sooka.sponest.monitor.api.RemoteMonitorService;
 import com.sooka.sponest.monitor.api.domain.CenterdataTAidevicedept;
 import io.swagger.annotations.Api;
@@ -75,9 +78,9 @@ public class CentereventTEventcatalogueController extends BaseController {
     @Autowired
     private ICentereventTDownloadsService centereventTDownloadsService;
 
-    @Autowired
-    @Qualifier("asyncTaskExecutor")
-    private ThreadPoolTaskExecutor asyncTaskExecutor;
+//    @Autowired
+//    @Qualifier("asyncTaskExecutor")
+//    private ThreadPoolTaskExecutor asyncTaskExecutor;
 
     /**
      * 查询事件目录列表
@@ -381,4 +384,38 @@ public class CentereventTEventcatalogueController extends BaseController {
             return AjaxResult.success(centereventTEventcatalogueService.eventhandleDownload(id));
         }
     }
+
+    /**
+     * 119事件推送
+     *
+     * @param fireEventVO
+     * @return
+     */
+    @PostMapping("/push3rdSystemEvent")
+    public R push3rdSystemEvent(@Validated @RequestBody FireEventVO fireEventVO) {
+        if (StringUtils.isBlank(fireEventVO.getEventId()) || StringUtils.isBlank(fireEventVO.getEventCode())) {
+            return R.ok(HttpStatus.UNSUPPORTED_TYPE, "参数异常");
+        }
+        // 101森林火情、102秸秆禁烧、103建筑物火情、1002消防占道、510水压监测异常、1001电瓶车进电梯
+        if (!Arrays.asList("101", "102", "103", "510", "1001", "1002", "1003", "1004").contains(fireEventVO.getEventType())) {
+            return R.ok(HttpStatus.UNSUPPORTED_TYPE, "无法推送该类型事件");
+        }
+        List<String> pictures = fireEventVO.getEventPicture().stream().map(item -> item.substring(item.indexOf("group1"))).collect(Collectors.toList());
+        fireEventVO.setPictureUrlList(pictures);
+        R result = SpringUtils.getBean(RemoteExchangeService.class).receiveEventData(fireEventVO);
+        logger.info("事件接受参数:{}, 事件结果返回:{}", JSON.toJSONString(fireEventVO), JSON.toJSONString(result));
+        if (200 == result.getCode()) {
+            // log
+            CentereventTFireLog log = new CentereventTFireLog();
+            log.setId(IdUtils.simpleUUID());
+            log.setEventCode(fireEventVO.getEventCode());
+            log.setLogContent(SecurityUtils.getLoginUser().getSysUser().getNickName() + "推送该事件至119接处警");
+            centereventTFireLogService.insertCentereventTFireLog(log);
+            CentereventTEventcatalogue centereventTEventcatalogue = new CentereventTEventcatalogue();
+            centereventTEventcatalogue.setId(fireEventVO.getEventId());
+            centereventTEventcatalogue.setIsPush("1");
+            return R.ok(centereventTEventcatalogueService.updateCentereventTEventcatalogue(centereventTEventcatalogue));
+        }
+        return result;
+    }
 }

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

@@ -86,5 +86,5 @@ public interface ICentereventTEventcatalogueService {
 
     CentereventTEventcatalogue mqtest(String start, String end, int limit);
 
-    void downloadsCommon(Map<String, Object> params);
+    void downloadsCommon(Map<String, Object> params) throws InterruptedException;
 }