Browse Source

事件管理-隐患管理-自动喷水灭火系统相关接口开发

jichaobo 2 years ago
parent
commit
9838632ba6

+ 4 - 4
service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/AlarmDetectorController.java

@@ -44,7 +44,7 @@ public class AlarmDetectorController {
 
     @GetMapping("alarmDetectorLowerList")
     public ApiResult<CommonPage<AlarmDetectorVo>> alarmDetectorLowerList(@RequestParam(value = "handlingStatus", required = false) Integer handlingStatus,
-                                                                         @RequestParam(value = "systemType", required = false) Integer systemType,
+                                                                         @RequestParam(value = "systemType", required = false) String systemType,
                                                                          @RequestParam(value = "startDate", required = false) String startDate,
                                                                          @RequestParam(value = "endDate", required = false) String endDate,
                                                                          @RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
@@ -59,7 +59,7 @@ public class AlarmDetectorController {
      * @return
      */
     @GetMapping("detectorStatistics")
-    public ApiResult<Map<String, Object>> detectorStatistics(@RequestParam(value = "systemType", required = false) Integer systemType) {
+    public ApiResult<Map<String, Object>> detectorStatistics(@RequestParam(value = "systemType", required = false) String systemType) {
         return ApiResult.success(alarmDetectorService.detectorStatistics(systemType));
     }
 
@@ -72,7 +72,7 @@ public class AlarmDetectorController {
      * @return
      */
     @GetMapping("detectorStatisticalChart")
-    public ApiResult<Map<String, Object>> detectorStatisticalChart(@RequestParam(value = "systemType", required = false) Integer systemType,
+    public ApiResult<Map<String, Object>> detectorStatisticalChart(@RequestParam(value = "systemType", required = false) String systemType,
                                                                    @RequestParam(value = "startDate", required = false) String startDate,
                                                                    @RequestParam(value = "endDate", required = false) String endDate) {
         return ApiResult.success(alarmDetectorService.detectorStatisticalChart(systemType, startDate, endDate));
@@ -104,7 +104,7 @@ public class AlarmDetectorController {
     @GetMapping("alarmDetectorLowerListExport")
     public void export(HttpServletResponse response,
                        @RequestParam(value = "handlingStatus", required = false) Integer handlingStatus,
-                       @RequestParam(value = "systemType", required = false) Integer systemType,
+                       @RequestParam(value = "systemType", required = false) String systemType,
                        @RequestParam(value = "startDate", required = false) String startDate,
                        @RequestParam(value = "endDate", required = false) String endDate,
                        @RequestParam(value = "exportTitle") String exportTitle) throws IOException {

+ 1 - 1
service-fire/service-fire-biz/src/main/java/com/usky/fire/mapper/AlarmDetectorMapper.java

@@ -18,7 +18,7 @@ import java.util.List;
 public interface AlarmDetectorMapper extends CrudMapper<AlarmDetector> {
 
     List<AlarmFireStatisticalVo> selectAlarmDetectorStatistical(@Param("deviceList") List<String> deviceList,
-                                                                @Param("systemType") Integer systemType,
+                                                                @Param("systemTypeList") List<Integer> systemTypeList,
                                                                 @Param("startDate") String startDate,
                                                                 @Param("endDate") String endDate);
 }

+ 6 - 6
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/AlarmDetectorService.java

@@ -29,7 +29,7 @@ public interface AlarmDetectorService extends CrudService<AlarmDetector> {
      * @return
      */
     CommonPage<AlarmDetectorVo> alarmDetectorLowerList(Integer handlingStatus, String startDate, String endDate,
-                                                       Integer pageNum, Integer pageSize, Integer systemType);
+                                                       Integer pageNum, Integer pageSize, String systemType);
 
     /**
      * 事件管理-隐患管理-自动喷水灭火系统-左侧统计
@@ -37,7 +37,7 @@ public interface AlarmDetectorService extends CrudService<AlarmDetector> {
      * @param systemType 系统类型(1.火灾自动报警系统 2.自动喷水灭火系统 3.消防给水及消火栓系统 4.防排烟系统 5.电气火灾系统 6.消防视频监控系统)
      * @return
      */
-    Map<String, Object> detectorStatistics(Integer systemType);
+    Map<String, Object> detectorStatistics(String systemType);
 
 
     /**
@@ -48,7 +48,7 @@ public interface AlarmDetectorService extends CrudService<AlarmDetector> {
      * @param endDate    结束时间  格式:yyyy-MM-dd HH:mm:ss
      * @return
      */
-    Map<String, Object> detectorStatisticalChart(Integer systemType, String startDate, String endDate);
+    Map<String, Object> detectorStatisticalChart(String systemType, String startDate, String endDate);
 
     /**
      * 事件管理-隐患管理-自动喷水灭火系统-告警处理
@@ -67,7 +67,7 @@ public interface AlarmDetectorService extends CrudService<AlarmDetector> {
      * @param systemType     系统类型(1.火灾自动报警系统 2.自动喷水灭火系统 3.消防给水及消火栓系统 4.防排烟系统 5.电气火灾系统 6.消防视频监控系统)
      * @return
      */
-    List<AlarmDetectorVo> alarmDetectorLowerListExport(Integer handlingStatus, String startDate, String endDate, Integer systemType);
+    List<AlarmDetectorVo> alarmDetectorLowerListExport(Integer handlingStatus, String startDate, String endDate, String systemType);
 
     /**
      * 事件管理-隐患管理-自动喷水灭火系统-数量统计
@@ -77,7 +77,7 @@ public interface AlarmDetectorService extends CrudService<AlarmDetector> {
      * @param systemType     系统类型(1.火灾自动报警系统 2.自动喷水灭火系统 3.消防给水及消火栓系统 4.防排烟系统 5.电气火灾系统 6.消防视频监控系统)
      * @return
      */
-    Integer detectorCount(List<String> deviceCodeList, Integer handlingStatus, Integer systemType);
+    Integer detectorCount(List<String> deviceCodeList, Integer handlingStatus, List<Integer> systemTypeList);
 
     /**
      * 事件管理-隐患管理-自动喷水灭火系统-列表查询一
@@ -92,5 +92,5 @@ public interface AlarmDetectorService extends CrudService<AlarmDetector> {
      * @return
      */
     CommonPage<AlarmDetector> alarDetectorList(List<String> deviceCodeList, Integer handlingStatus, String startDate,
-                                               String endDate, Integer pageNum, Integer pageSize, Integer systemType);
+                                               String endDate, Integer pageNum, Integer pageSize, List<Integer> systemTypeList);
 }

+ 49 - 15
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/AlarmDetectorServiceImpl.java

@@ -34,7 +34,15 @@ public class AlarmDetectorServiceImpl extends AbstractCrudService<AlarmDetectorM
 
     @Override
     public CommonPage<AlarmDetectorVo> alarmDetectorLowerList(Integer handlingStatus, String startDate, String endDate,
-                                                              Integer pageNum, Integer pageSize, Integer systemType) {
+                                                              Integer pageNum, Integer pageSize, String systemType) {
+        List<Integer> systemTypeList = new ArrayList<>();
+        if (systemType != null && !"".equals(systemType)) {
+            String[] alarmTypeArray = systemType.split(",");
+            for (int i = 0; i < alarmTypeArray.length; i++) {
+                systemTypeList.add(Integer.parseInt(alarmTypeArray[i]));
+            }
+        }
+
         DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
         String userType = null;
         LoginUser loginUser = SecurityUtils.getLoginUser();
@@ -43,7 +51,7 @@ public class AlarmDetectorServiceImpl extends AbstractCrudService<AlarmDetectorM
         }
         //缺少维保单位部分代码
         List<String> devcieCodeList = new ArrayList<>();
-        CommonPage<AlarmDetector> alarmDetectorList = this.alarDetectorList(devcieCodeList, handlingStatus, startDate, endDate, pageNum, pageSize, systemType);
+        CommonPage<AlarmDetector> alarmDetectorList = this.alarDetectorList(devcieCodeList, handlingStatus, startDate, endDate, pageNum, pageSize, systemTypeList);
         List<AlarmDetectorVo> list = new ArrayList<>();
         for (int i = 0; i < alarmDetectorList.getRecords().size(); i++) {
             AlarmDetectorVo alarmDetectorVo = new AlarmDetectorVo();
@@ -77,7 +85,15 @@ public class AlarmDetectorServiceImpl extends AbstractCrudService<AlarmDetectorM
     }
 
     @Override
-    public Map<String, Object> detectorStatistics(Integer systemType) {
+    public Map<String, Object> detectorStatistics(String systemType) {
+        List<Integer> systemTypeList = new ArrayList<>();
+        if (systemType != null && !"".equals(systemType)) {
+            String[] alarmTypeArray = systemType.split(",");
+            for (int i = 0; i < alarmTypeArray.length; i++) {
+                systemTypeList.add(Integer.parseInt(alarmTypeArray[i]));
+            }
+        }
+
         String userType = null;
         LoginUser loginUser = SecurityUtils.getLoginUser();
         if (loginUser != null && !"".equals(loginUser)) {
@@ -86,8 +102,8 @@ public class AlarmDetectorServiceImpl extends AbstractCrudService<AlarmDetectorM
         //缺少维保单位部分代码
         List<String> devcieCodeList = new ArrayList<>();
 
-        int untreated = this.detectorCount(devcieCodeList, 0, systemType);
-        int processed = this.detectorCount(devcieCodeList, 1, systemType);
+        int untreated = this.detectorCount(devcieCodeList, 0, systemTypeList);
+        int processed = this.detectorCount(devcieCodeList, 1, systemTypeList);
 //        String disposalRate =  processed / (untreated + processed) + "%";
         Integer count = untreated + processed;
         String disposalRate = OnlineMethod.myPercent(processed, count);
@@ -100,7 +116,15 @@ public class AlarmDetectorServiceImpl extends AbstractCrudService<AlarmDetectorM
     }
 
     @Override
-    public Map<String, Object> detectorStatisticalChart(Integer systemType, String startDate, String endDate) {
+    public Map<String, Object> detectorStatisticalChart(String systemType, String startDate, String endDate) {
+        List<Integer> systemTypeList = new ArrayList<>();
+        if (systemType != null && !"".equals(systemType)) {
+            String[] alarmTypeArray = systemType.split(",");
+            for (int i = 0; i < alarmTypeArray.length; i++) {
+                systemTypeList.add(Integer.parseInt(alarmTypeArray[i]));
+            }
+        }
+
         String userType = null;
         LoginUser loginUser = SecurityUtils.getLoginUser();
         if (loginUser != null && !"".equals(loginUser)) {
@@ -108,7 +132,7 @@ public class AlarmDetectorServiceImpl extends AbstractCrudService<AlarmDetectorM
         }
         //缺少维保单位部分代码
         List<String> devcieCodeList = new ArrayList<>();
-        List<AlarmFireStatisticalVo> list = baseMapper.selectAlarmDetectorStatistical(devcieCodeList, systemType, startDate, endDate);
+        List<AlarmFireStatisticalVo> list = baseMapper.selectAlarmDetectorStatistical(devcieCodeList, systemTypeList, startDate, endDate);
         List<Integer> alarmCountList = new ArrayList<>();
         List<Integer> handleCountList = new ArrayList<>();
         List<String> alarmTimeList = new ArrayList<>();
@@ -136,8 +160,17 @@ public class AlarmDetectorServiceImpl extends AbstractCrudService<AlarmDetectorM
     }
 
     @Override
-    public List<AlarmDetectorVo> alarmDetectorLowerListExport(Integer handlingStatus, String startDate, String endDate, Integer systemType) {
+    public List<AlarmDetectorVo> alarmDetectorLowerListExport(Integer handlingStatus, String startDate, String endDate, String systemType) {
         DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+
+        List<Integer> systemTypeList = new ArrayList<>();
+        if (systemType != null && !"".equals(systemType)) {
+            String[] alarmTypeArray = systemType.split(",");
+            for (int i = 0; i < alarmTypeArray.length; i++) {
+                systemTypeList.add(Integer.parseInt(alarmTypeArray[i]));
+            }
+        }
+
         String userType = null;
         LoginUser loginUser = SecurityUtils.getLoginUser();
         if (loginUser != null && !"".equals(loginUser)) {
@@ -145,7 +178,7 @@ public class AlarmDetectorServiceImpl extends AbstractCrudService<AlarmDetectorM
         }
         //缺少维保单位部分代码
         List<String> devcieCodeList = new ArrayList<>();
-        CommonPage<AlarmDetector> alarmDetectorList = this.alarDetectorList(devcieCodeList, handlingStatus, startDate, endDate, 0, 0, systemType);
+        CommonPage<AlarmDetector> alarmDetectorList = this.alarDetectorList(devcieCodeList, handlingStatus, startDate, endDate, 0, 0, systemTypeList);
         List<AlarmDetectorVo> list = new ArrayList<>();
         for (int i = 0; i < alarmDetectorList.getRecords().size(); i++) {
             AlarmDetectorVo alarmDetectorVo = new AlarmDetectorVo();
@@ -180,7 +213,7 @@ public class AlarmDetectorServiceImpl extends AbstractCrudService<AlarmDetectorM
 
 
     @Override
-    public Integer detectorCount(List<String> deviceCodeList, Integer handlingStatus, Integer systemType) {
+    public Integer detectorCount(List<String> deviceCodeList, Integer handlingStatus, List<Integer> systemTypeList) {
         LambdaQueryWrapper<AlarmDetector> queryWrapper = Wrappers.lambdaQuery();
         if (deviceCodeList.size() > 0) {
             queryWrapper.in(AlarmDetector::getDeviceCode, deviceCodeList);
@@ -188,15 +221,15 @@ public class AlarmDetectorServiceImpl extends AbstractCrudService<AlarmDetectorM
         if (handlingStatus != null) {
             queryWrapper.eq(AlarmDetector::getHandlingStatus, handlingStatus);
         }
-        if (systemType != null && systemType != 0) {
-            queryWrapper.eq(AlarmDetector::getSystemType, systemType);
+        if (systemTypeList != null && systemTypeList.size() > 0) {
+            queryWrapper.in(AlarmDetector::getSystemType, systemTypeList);
         }
         int total = this.count(queryWrapper);
         return total;
     }
 
     public CommonPage<AlarmDetector> alarDetectorList(List<String> deviceCodeList, Integer handlingStatus, String startDate,
-                                                      String endDate, Integer pageNum, Integer pageSize, Integer systemType) {
+                                                      String endDate, Integer pageNum, Integer pageSize, List<Integer> systemTypeList) {
         LambdaQueryWrapper<AlarmDetector> queryWrapper = Wrappers.lambdaQuery();
         if (deviceCodeList.size() > 0) {
             queryWrapper.in(AlarmDetector::getDeviceCode, deviceCodeList);
@@ -204,8 +237,9 @@ public class AlarmDetectorServiceImpl extends AbstractCrudService<AlarmDetectorM
         if (handlingStatus != null) {
             queryWrapper.eq(AlarmDetector::getHandlingStatus, handlingStatus);
         }
-        if (systemType != 0 && systemType != null) {
-            queryWrapper.in(AlarmDetector::getSystemType, systemType);
+
+        if (systemTypeList != null && systemTypeList.size() > 0) {
+            queryWrapper.in(AlarmDetector::getSystemType, systemTypeList);
         }
         if (startDate != null && !"".equals(startDate) && endDate != null && !"".equals(endDate)) {
             queryWrapper.between(AlarmDetector::getDataTime, startDate, endDate);

+ 6 - 3
service-fire/service-fire-biz/src/main/resources/mapper/fire/AlarmDetectorMapper.xml

@@ -26,7 +26,7 @@
 
     <select id="selectAlarmDetectorStatistical" resultType="com.usky.fire.service.vo.AlarmFireStatisticalVo">
         SELECT
-        DATE_FORMAT(data_time, "%Y-%m-%d") AS dataTime,
+        DATE_FORMAT(data_time, "%Y-%m-%d") AS alarmTime,
         count(*) AS `count`,
         sum(handling_status) AS `sum`
         FROM
@@ -41,8 +41,11 @@
             <if test="startDate != null and startDate != '' and startDate != null and startDate != ''">
                 and data_time BETWEEN #{startDate} AND #{endDate}
             </if>
-            <if test="systemType != null and systemType!=0">
-                AND system_type = #{systemType}
+            <if test="systemTypeList != null and systemTypeList.size() > 0">
+                AND system_type in
+                <foreach item="item" collection="systemTypeList" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
             </if>
         </where>
         GROUP BY