فهرست منبع

Merge branch 'feature_zhujian' into dev

lyq 10 ماه پیش
والد
کامیت
8281d95ea7

+ 22 - 0
src/main/java/com/sooka/sponest/event/centereventteventcatalogue/controller/CenterEventViewController.java

@@ -137,4 +137,26 @@ public class CenterEventViewController extends BaseController {
         startPage();
         return getDataTable(centerEventViewService.listAll(visuForestCloudMapVO));
     }
+
+    /**
+     * 住建事件统计
+     *
+     * @param visuForestCloudMapVO
+     * @return
+     */
+    @PostMapping("/getHousingConstructionEventCount")
+    public R getHousingConstructionEventCount(@RequestBody VisuForestCloudMapVO visuForestCloudMapVO) {
+        return R.ok(centerEventViewService.getHousingConstructionEventCount(visuForestCloudMapVO));
+    }
+
+    /**
+     * 住建事件列表
+     *
+     * @param visuForestCloudMapVO
+     * @return
+     */
+    @PostMapping("/getHousingConstructionEventList")
+    public R getHousingConstructionEventList(@RequestBody VisuForestCloudMapVO visuForestCloudMapVO) {
+        return R.ok(centerEventViewService.getHousingConstructionEventList(visuForestCloudMapVO));
+    }
 }

+ 36 - 6
src/main/java/com/sooka/sponest/event/centereventteventcatalogue/controller/FireIncidentController.java

@@ -11,7 +11,6 @@ import com.sooka.sponest.event.centereventteventcatalogue.domain.sensor.SensorEv
 import com.sooka.sponest.event.centereventteventcatalogue.service.AlarmEventService;
 import com.sooka.sponest.event.centereventtreportmessage.domain.CentereventTReportmessage;
 import com.sooka.sponest.event.centereventtreportmessage.service.ICentereventTReportmessageService;
-import io.swagger.annotations.ApiOperation;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -37,6 +36,7 @@ public class FireIncidentController {
 
     /**
      * 传感器事件上报
+     *
      * @param sensorEventVo
      * @return R
      */
@@ -49,7 +49,7 @@ public class FireIncidentController {
             logger.error(e.getMessage());
         }
         if (StringUtils.isBlank(eventCode)) {
-            eventCode = String.valueOf(System.currentTimeMillis()) + "_";
+            eventCode = System.currentTimeMillis() + "_ ";
         }
         try {
             String[] array = eventCode.split("_");
@@ -66,14 +66,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获取报文信息
@@ -89,4 +89,34 @@ public class FireIncidentController {
         eventBO.setDbType("0");
         return AjaxResult.success(alarmEventService.updateFireEventImage(eventBO));
     }
+
+    /**
+     * 住建事件上报
+     *
+     * @param sensorEventVo
+     * @return R
+     */
+    @PostMapping("/insertHousingConstructionEvent")
+    public R insertHousingConstructionEvent(@RequestBody SensorEventVo sensorEventVo) {
+        String eventCode = null;
+        try {
+            eventCode = alarmEventService.insertHousingConstructionEvent(sensorEventVo);
+        } catch (Exception e) {
+            logger.error(e.getMessage());
+        }
+        if (StringUtils.isBlank(eventCode)) {
+            eventCode = System.currentTimeMillis() + "_ ";
+        }
+        try {
+            String[] array = eventCode.split("_");
+            CentereventTReportmessage tReportMessage = new CentereventTReportmessage();
+            tReportMessage.setId(array[0]);
+            tReportMessage.setSource("数字住建-" + array[1]);
+            tReportMessage.setContext(JSON.toJSONString(sensorEventVo));
+            centereventTReportmessageService.insertCentereventTReportmessage(tReportMessage);
+        } catch (Exception e) {
+            logger.error(e.getMessage());
+        }
+        return R.ok();
+    }
 }

+ 2 - 0
src/main/java/com/sooka/sponest/event/centereventteventcatalogue/domain/sensor/SensorEventVo.java

@@ -34,4 +34,6 @@ public class SensorEventVo {
     private String address;// 地址
 
     private String picture;// 图片
+
+    private String deptType;
 }

+ 3 - 1
src/main/java/com/sooka/sponest/event/centereventteventcatalogue/mapper/CenterEventViewMapper.java

@@ -36,5 +36,7 @@ public interface CenterEventViewMapper {
 
     List<VisuForestCloudMapEventListBO> listAll(VisuForestCloudMapVO visuForestCloudMapVO);
 
-    List<VisuForestCloudMapEventListBO> getEventFileAll(VisuForestCloudMapVO visuForestCloudMapVO);
+    Map<String, Object> getHousingConstructionEventCount(VisuForestCloudMapVO visuForestCloudMapVO);
+
+    List<VisuForestCloudMapEventListBO> getHousingConstructionEventList(VisuForestCloudMapVO visuForestCloudMapVO);
 }

+ 3 - 0
src/main/java/com/sooka/sponest/event/centereventteventcatalogue/service/AlarmEventService.java

@@ -29,4 +29,7 @@ public interface AlarmEventService {
 
     // 传感器事件
     String insertSensorEvent(SensorEventVo sensorEventVo);
+
+    // 住建事件
+    String insertHousingConstructionEvent(SensorEventVo sensorEventVo);
 }

+ 4 - 0
src/main/java/com/sooka/sponest/event/centereventteventcatalogue/service/ICenterEventViewService.java

@@ -35,4 +35,8 @@ public interface ICenterEventViewService {
     VisuForestEventTodayEventListBO eventPush(VisuForestCloudMapVO visuForestCloudMapVO);
 
     List<VisuForestCloudMapEventListBO> listAll(VisuForestCloudMapVO visuForestCloudMapVO);
+
+    Map<String, Object> getHousingConstructionEventCount(VisuForestCloudMapVO visuForestCloudMapVO);
+
+    List<VisuForestCloudMapEventListBO> getHousingConstructionEventList(VisuForestCloudMapVO visuForestCloudMapVO);
 }

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

@@ -8,6 +8,8 @@ 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.system.api.RemoteDeptService;
+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;
@@ -178,7 +180,6 @@ public class AlarmEventServiceImpl implements AlarmEventService {
         String eventCode = IdUtils.simpleUUID();
         centereventTEventcatalogue.setId(eventCode);
         centereventTEventcatalogue.setEventCode(eventCode);
-
         if (null == centereventTEventcatalogue.getReportSource()) {
             centereventTEventcatalogue.setReportSource(REPORTING_SOURCE_1);//reporting_source_1
         }
@@ -403,4 +404,57 @@ public class AlarmEventServiceImpl implements AlarmEventService {
         }
         return centereventTEventcatalogue.getEventCode() + "_" + eventtype.getEventTypeName();
     }
+
+    @Transactional
+    @Override
+    public String insertHousingConstructionEvent(SensorEventVo sensorEventVo) {
+        // 验证是否配置市级住建局
+        SysDept sysDept = new SysDept();
+        sysDept.setDeptId(Long.valueOf(SI_PING));
+        sysDept.setDeptType(sensorEventVo.getDeptType());// 住建:sys_dept_type_31,执法:
+        List<SysDept> listDept = SpringUtils.getBean(RemoteDeptService.class).getDeptsByDeptType(sysDept).getData();
+        if (StringUtils.isEmpty(listDept)) {
+            logger.info("无法匹配相关部门!");
+            return "";
+        }
+        // 事件目录
+        CentereventTEventtype eventtype = centereventTEventtypeService.selectCentereventTEventtypeById(sensorEventVo.getEventTypeXl());
+        String eventName = sensorEventVo.getReportor() + DateUtils.parseDateToStr(YYYY_MM_DD_HH_MM_SS, sensorEventVo.getReportTime()) + eventtype.getEventTypeName();
+        CentereventTEventcatalogue centereventTEventcatalogue = new CentereventTEventcatalogue(sensorEventVo.getEventType(), sensorEventVo.getEventTypeXl(), eventName, sensorEventVo.getEventDescription(), sensorEventVo.getLongitude(), sensorEventVo.getLatitude(), sensorEventVo.getReportor(), sensorEventVo.getReportTime(), sensorEventVo.getAddress());
+        centereventTEventcatalogue.setId(IdUtils.simpleUUID());
+        centereventTEventcatalogue.setEventCode(centereventTEventcatalogue.getId());
+        centereventTEventcatalogue.setReportSource(REPORTING_SOURCE_5);
+        centereventTEventcatalogue.setIsUrged(SYS_ISURGE_2);//sys_isurge_2
+        centereventTEventcatalogue.setEventStatus("归档");
+        centereventTEventcatalogue.setEventStatusValue(FOREST_EVENT_STATUS_6);//forest_event_status_6
+        if ("sys_dept_type_31".equals(sensorEventVo.getDeptType())) {
+            centereventTEventcatalogue.setDeptId(Long.parseLong(sensorEventVo.getSensorId()));
+            centereventTEventcatalogue.setDeptName(sensorEventVo.getReportor());
+        } else {
+            centereventTEventcatalogue.setDeptId(listDept.get(0).getDeptId());
+            centereventTEventcatalogue.setDeptName(listDept.get(0).getDeptName());
+        }
+        centereventTEventcatalogue.setCreateBy(sensorEventVo.getSensorId());
+        centereventTEventcatalogue.setCreateName(sensorEventVo.getReportor());
+        centereventTEventcatalogue.setCreateTime(DateUtils.getNowDate());
+        centereventTEventcatalogueService.insertCentereventTEventcatalogue(centereventTEventcatalogue);
+        // 事件部门
+        listDept.forEach(item -> {
+            CentereventDeptEvent centereventTDeptEvent = new CentereventDeptEvent();
+            centereventTDeptEvent.setId(IdUtils.fastSimpleUUID());
+            centereventTDeptEvent.setEventCode(centereventTEventcatalogue.getEventCode());
+            centereventTDeptEvent.setDeptId(item.getDeptId());
+            centereventTDeptEvent.setDeptName(item.getDeptName());
+            centereventTDeptEvent.setIsUrged(SYS_ISURGE_2);
+            centereventTDeptEvent.setEventStatus("归档");
+            centereventTDeptEvent.setEventStatusValue(FOREST_EVENT_STATUS_6);
+            centereventTDeptEvent.setDeptHandleType(DEPT_HANDLE_TYPE_3);
+            centereventTDeptEvent.setCreateName(centereventTEventcatalogue.getCreateName());
+            centereventTDeptEvent.setCreateTime(centereventTEventcatalogue.getCreateTime());
+            centereventTDeptEventService.insertCentereventTDeptEvent(centereventTDeptEvent);
+        });
+        // 事件日志
+        this.insertEventLog(centereventTEventcatalogue);
+        return centereventTEventcatalogue.getEventCode() + "_" + eventtype.getEventTypeName();
+    }
 }

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

@@ -174,11 +174,11 @@ public class CenterEventViewServiceImpl extends BaseService implements ICenterEv
         resultMap.put("visuForestCloudYuAnBo", yuAnMap);
         resultMap.put("eventlog", logs);
         // 摄像头上报
-        if ("reporting_source_1".equals(catalogue.getReportSource())) {
+        if (REPORTING_SOURCE_1.equals(catalogue.getReportSource())) {
             resultMap.put("centermonitorTCamera", SpringUtils.getBean(RemoteMonitorService.class).selectByCameraId(catalogue.getCreateBy()).getData());
         }
         // 传感器上报
-        if ("reporting_source_4".equals(catalogue.getReportSource())) {
+        if (REPORTING_SOURCE_4.equals(catalogue.getReportSource())) {
             resultMap.put("centermonitorTCamera", new CenterdataTCamera(catalogue.getCreateBy(), catalogue.getCreateName()));
         }
         return resultMap;
@@ -288,7 +288,7 @@ public class CenterEventViewServiceImpl extends BaseService implements ICenterEv
         String token = RemoteApiUtil.getInstance().getToken();// 大华token
         List<String> eventCodes = result.stream().map(VisuForestCloudMapEventListBO::getEventCode).collect(Collectors.toList());
         visuForestCloudMapVO.setEventStatus(eventCodes);
-        List<VisuForestCloudMapEventListBO> attachs = centerEventViewMapper.getEventFileAll(visuForestCloudMapVO);
+        List<VisuForestCloudMapEventListBO> attachs = centerEventViewMapper.getEventFile(visuForestCloudMapVO);
         result.forEach(event -> {
             for (VisuForestCloudMapEventListBO attach : attachs) {
                 if (event.getEventCode().equals(attach.getEventCode())) {
@@ -302,4 +302,35 @@ public class CenterEventViewServiceImpl extends BaseService implements ICenterEv
         });
         return result;
     }
+
+    @Override
+    public Map<String, Object> getHousingConstructionEventCount(VisuForestCloudMapVO visuForestCloudMapVO) {
+        return centerEventViewMapper.getHousingConstructionEventCount(visuForestCloudMapVO);
+    }
+
+    @Override
+    public List<VisuForestCloudMapEventListBO> getHousingConstructionEventList(VisuForestCloudMapVO visuForestCloudMapVO) {
+        setSookaDataBase(visuForestCloudMapVO);
+        List<VisuForestCloudMapEventListBO> result = centerEventViewMapper.getHousingConstructionEventList(visuForestCloudMapVO);
+        if (StringUtils.isEmpty(result)) {
+            return result;
+        }
+        Map<String, String> keyMap = SpringUtils.getBean(RemoteConfigService.class).remotegetConfigMap(Arrays.asList(FILE_PREFIX_LOCAL, FILE_PREFIX_HIK1, FILE_PREFIX_HIK2, FILE_PREFIX_DH1, FILE_PREFIX_DH2)).getData();
+        String token = RemoteApiUtil.getInstance().getToken();// 大华token
+        List<String> eventCodes = result.stream().map(VisuForestCloudMapEventListBO::getEventCode).collect(Collectors.toList());
+        visuForestCloudMapVO.setEventStatus(eventCodes);
+        List<VisuForestCloudMapEventListBO> attachs = centerEventViewMapper.getEventFile(visuForestCloudMapVO);
+        result.forEach(event -> {
+            for (VisuForestCloudMapEventListBO attach : attachs) {
+                if (event.getEventCode().equals(attach.getEventCode())) {
+                    if ("DH_1".equals(attach.getPictureSource())) {
+                        event.setPicturePath(FilePrefixUtils.getUrlPrefix(attach.getPictureSource(), keyMap) + attach.getPicturePath() + "?token=" + token);
+                    } else {
+                        event.setPicturePath(FilePrefixUtils.getUrlPrefix(attach.getPictureSource(), keyMap) + attach.getPicturePath());
+                    }
+                }
+            }
+        });
+        return result;
+    }
 }

+ 2 - 2
src/main/java/com/sooka/sponest/event/centereventteventcatalogue/service/impl/CentereventTEventcatalogueServiceImpl.java

@@ -501,14 +501,14 @@ public class CentereventTEventcatalogueServiceImpl extends BaseService implement
                 break;
             case "gd":
                 centereventTEventcatalogue.setEventStatus("归档");
-                centereventTEventcatalogue.setEventStatusValue("forest_event_status_6");
+                centereventTEventcatalogue.setEventStatusValue(FOREST_EVENT_STATUS_6);
                 centereventTEventcatalogue.setGdTime(new Date());
                 // 填写火灾报告
                 centereventtDeptEventBO.setEventType(centereventTEventcatalogue.getEventTypeXl());
                 insertReportByEventtype(centereventtDeptEventBO);
 
                 centereventTDeptEvent.setEventStatus("归档");
-                centereventTDeptEvent.setEventStatusValue("forest_event_status_6");
+                centereventTDeptEvent.setEventStatusValue(FOREST_EVENT_STATUS_6);
                 break;
             default:
                 break;

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

@@ -13,11 +13,13 @@ public class EventConstants {
     public static final String FOREST_EVENT_STATUS_1 = "forest_event_status_1";// 上报
     public static final String FOREST_EVENT_STATUS_2 = "forest_event_status_2";// 签收
     public static final String FOREST_EVENT_STATUS_5 = "forest_event_status_5";// 办结
+    public static final String FOREST_EVENT_STATUS_6 = "forest_event_status_6";// 归档
     public static final String FOREST_EVENT_STATUS_7 = "forest_event_status_7";// 确认
 
     // 事件来源
     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 SYS_ISURGE_2 = "sys_isurge_2";// 否

+ 55 - 13
src/main/resources/mapper/centereventteventcatalogue/CenterEventViewMapper.xml

@@ -8,7 +8,8 @@
         select
         count( event_status_value in ('forest_event_status_1','forest_event_status_7') OR NULL ) newReport,
         count( event_status_value = 'forest_event_status_2' OR NULL) readySure,
-        count( event_status_value = 'forest_event_status_5' OR event_status_value = 'forest_event_status_6' OR NULL ) readyFinish,
+        count( event_status_value = 'forest_event_status_5' OR event_status_value = 'forest_event_status_6' OR NULL )
+        readyFinish,
         count( report_source in ('reporting_source_1','reporting_source_4') OR NULL ) aiTotal,
         count( report_source in ('reporting_source_2','reporting_source_3') OR NULL ) otherTotal
         from (select a.* from (
@@ -53,8 +54,10 @@
 
     <select id="selectDeptEventCount" parameterType="VisuForestCloudMapVO"
             resultType="VisuForestCloudMapDeptEventCountBO">
-        select t.deptId,replace( group_concat( dept_name order by find_in_set( d.dept_id, t.ancestors ) ), ',', '' ) deptName,t.eventCount from (
-        select a.dept_id deptId,count(*) eventCount,concat( replace( c.ancestors, '0,100', '' ), ',', c.dept_id ) ancestors from (
+        select t.deptId,replace( group_concat( dept_name order by find_in_set( d.dept_id, t.ancestors ) ), ',', '' )
+        deptName,t.eventCount from (
+        select a.dept_id deptId,count(*) eventCount,concat( replace( c.ancestors, '0,100', '' ), ',', c.dept_id )
+        ancestors from (
         <if test="isHgj != null and isHgj == 'false'">
             select distinct e.event_code,de.dept_id from centerevent_t_eventcatalogue e
             left join centerevent_t_dept_event de on de.event_code = e.event_code
@@ -427,19 +430,58 @@
         order by create_time desc
     </select>
 
-    <select id="getEventFileAll" resultType="VisuForestCloudMapEventListBO">
-        select event_code eventCode,attach_path picturePath,bus_source pictureSource,file_type pictureType from (
-        select SUBSTRING_INDEX(GROUP_CONCAT(id order by create_time),',',1) id,event_code
-        from centerevent_t_fire_log
+    <select id="getHousingConstructionEventCount" parameterType="VisuForestCloudMapVO" resultType="map">
+        select label_1,IFNULL(label_2,0) label_2, IFNULL(label_3,0) label_3,IFNULL(label_4,0) label_4 from (
+            select count(*) label_1 from centerevent_t_eventcatalogue
+            where event_status_value in ('forest_event_status_7','forest_event_status_2','forest_event_status_5','forest_event_status_6' )
+            <if test="day != null and day != ''">
+                and DATE_FORMAT(create_time,'%Y-%m-%d') = #{day}
+            </if>
+            <if test="createBy != null and createBy != ''">
+                and create_by in ( ${createBy} )
+            </if> and event_type = 1
+        ) a, (
+            select sum(event_type_xl in ( '1201','1202','1203','1204','1205' )) label_2, sum(event_type_xl in ( '802' )) label_3, sum(event_type_xl in ( '1206','1207' )) label_4
+            from (
+                select event_type_xl from centerevent_t_eventcatalogue
+                where 1=1
+                <if test="day != null and day != ''">
+                    and DATE_FORMAT(create_time,'%Y-%m-%d') = #{day}
+                </if>
+                <if test="deptId != null and deptId != ''">
+                    and create_by = #{deptId}
+                </if>
+                and event_type in (12,8)) t
+        ) b
+    </select>
+
+    <select id="getHousingConstructionEventList" parameterType="VisuForestCloudMapVO"
+            resultType="VisuForestCloudMapEventListBO">
+        select event_code eventCode,event_name eventName,longitude,latitude,reportor,event_status
+        eventStatus,event_status_value eventStatusValue,create_time createTime,urge_count urgeCount,event_type_xl
+        eventType,report_source reportSource
+        from centerevent_t_eventcatalogue
         <where>
-            <if test="eventStatus != null and eventStatus.size > 0">
-                and event_code in
-                <foreach item="item" collection="eventStatus" open="(" separator="," close=")">
-                    #{item}
+            <if test="day != null and day != ''">
+                and DATE_FORMAT(create_time,'%Y-%m-%d') = #{day}
+            </if>
+            <if test="createBy != null and createBy != ''">
+                and create_by in ( ${createBy} )
+            </if>
+            <if test="eventTypeIdDl != null and eventTypeIdDl.length > 0">
+                and event_status_value in (
+                'forest_event_status_7','forest_event_status_2','forest_event_status_5','forest_event_status_6' )
+                and event_type in
+                <foreach item="eventTypeIdDl" collection="eventTypeIdDl" open="(" separator="," close=")">
+                    #{eventTypeIdDl}
+                </foreach>
+            </if>
+            <if test="eventTypeId != null and eventTypeId.length > 0">
+                and event_type_xl in
+                <foreach item="eventTypeId" collection="eventTypeId" open="(" separator="," close=")">
+                    #{eventTypeId}
                 </foreach>
             </if>
         </where>
-        group by event_code) l
-        left join ${database_data}.centerdata_t_attach f on f.bus_id = l.id
     </select>
 </mapper>