Przeglądaj źródła

大屏定时任务逻辑

jichaobo 2 lat temu
rodzic
commit
423b93f028
27 zmienionych plików z 543 dodań i 55 usunięć
  1. 6 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/BscEnterpriseScreenController.java
  2. 1 1
      service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/AlarmElectricalFire.java
  3. 1 1
      service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/AlarmFire.java
  4. 1 1
      service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/AlarmHydrantWater.java
  5. 1 1
      service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/AlarmSmokeControl.java
  6. 1 1
      service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/AlarmSprayWater.java
  7. 1 1
      service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/AlarmVideo.java
  8. 1 1
      service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/BaseDevice.java
  9. 6 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/mapper/AlarmElectricalFireMapper.java
  10. 6 2
      service-fire/service-fire-biz/src/main/java/com/usky/fire/mapper/ReservePlanMapper.java
  11. 17 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/AlarmElectricalFireService.java
  12. 13 3
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/AlarmFireService.java
  13. 9 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/BaseDeviceService.java
  14. 32 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/BscEnterpriseScreenService.java
  15. 9 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/PostInspectService.java
  16. 11 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/ReservePlanService.java
  17. 0 4
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/AlarmDetectorServiceImpl.java
  18. 43 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/AlarmElectricalFireServiceImpl.java
  19. 10 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/AlarmFireServiceImpl.java
  20. 10 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/BaseDeviceServiceImpl.java
  21. 268 3
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/BscEnterpriseScreenServiceImpl.java
  22. 1 2
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/DemBuildScoreServiceImpl.java
  23. 9 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PostInspectServiceImpl.java
  24. 7 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/ReservePlanServiceImpl.java
  25. 1 1
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/vo/AlarmFireVo.java
  26. 52 23
      service-fire/service-fire-biz/src/main/resources/mapper/fire/AlarmElectricalFireMapper.xml
  27. 26 10
      service-fire/service-fire-biz/src/main/resources/mapper/fire/ReservePlanMapper.xml

+ 6 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/BscEnterpriseScreenController.java

@@ -37,5 +37,11 @@ public class BscEnterpriseScreenController {
         return ApiResult.success(bscEnterpriseScreenService.screenDataStatistic(dataType, moduleType));
     }
 
+
+    @GetMapping("postInspectStatistics")
+    public ApiResult<Object> postInspectStatistics(@RequestParam(value = "companyId") String companyId) {
+        return ApiResult.success(bscEnterpriseScreenService.hiddenDangerStatistics(companyId));
+    }
+
 }
 

+ 1 - 1
service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/AlarmElectricalFire.java

@@ -72,7 +72,7 @@ public class AlarmElectricalFire implements Serializable {
     /**
      * 单位ID
      */
-    private Integer companyId;
+    private String companyId;
 
     /**
      * 单位名称

+ 1 - 1
service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/AlarmFire.java

@@ -70,7 +70,7 @@ public class AlarmFire implements Serializable {
     /**
      * 单位ID
      */
-    private Integer companyId;
+    private String companyId;
 
     /**
      * 单位名称

+ 1 - 1
service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/AlarmHydrantWater.java

@@ -71,7 +71,7 @@ public class AlarmHydrantWater implements Serializable {
     /**
      * 单位ID
      */
-    private Integer companyId;
+    private String companyId;
 
     /**
      * 单位名称

+ 1 - 1
service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/AlarmSmokeControl.java

@@ -71,7 +71,7 @@ public class AlarmSmokeControl implements Serializable {
     /**
      * 单位ID
      */
-    private Integer companyId;
+    private String companyId;
 
     /**
      * 单位名称

+ 1 - 1
service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/AlarmSprayWater.java

@@ -71,7 +71,7 @@ public class AlarmSprayWater implements Serializable {
     /**
      * 单位ID
      */
-    private Integer companyId;
+    private String companyId;
 
     /**
      * 单位名称

+ 1 - 1
service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/AlarmVideo.java

@@ -71,7 +71,7 @@ public class AlarmVideo implements Serializable {
     /**
      * 单位ID
      */
-    private Integer companyId;
+    private String companyId;
 
     /**
      * 单位名称

+ 1 - 1
service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/BaseDevice.java

@@ -108,7 +108,7 @@ public class BaseDevice implements Serializable {
     /**
      * 所属单位ID
      */
-    private Integer companyId;
+    private String companyId;
 
     /**
      * 创建时间

+ 6 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/mapper/AlarmElectricalFireMapper.java

@@ -3,6 +3,7 @@ package com.usky.fire.mapper;
 import com.usky.common.mybatis.core.CrudMapper;
 import com.usky.fire.domain.AlarmElectricalFire;
 import com.usky.fire.service.vo.AlarmFireStatisticalVo;
+import com.usky.fire.service.vo.DataCountVo;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
@@ -22,4 +23,9 @@ public interface AlarmElectricalFireMapper extends CrudMapper<AlarmElectricalFir
                                                                  @Param("companyIdList") List<String> companyIdList,
                                                                  @Param("startDate") String startDate,
                                                                  @Param("endDate") String endDate);
+
+    List<DataCountVo> alarmCount(@Param("table") String table,
+                                 @Param("companyId") String companyId);
+
+    List<DataCountVo> alarmFireCount(@Param("companyId") String companyId);
 }

+ 6 - 2
service-fire/service-fire-biz/src/main/java/com/usky/fire/mapper/ReservePlanMapper.java

@@ -1,7 +1,11 @@
 package com.usky.fire.mapper;
 
-import com.usky.fire.domain.ReservePlan;
 import com.usky.common.mybatis.core.CrudMapper;
+import com.usky.fire.domain.ReservePlan;
+import com.usky.fire.service.vo.DataCountVo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * <p>
@@ -12,5 +16,5 @@ import com.usky.common.mybatis.core.CrudMapper;
  * @since 2022-09-05
  */
 public interface ReservePlanMapper extends CrudMapper<ReservePlan> {
-
+    List<DataCountVo> reservePlanCount(@Param("companyId") String companyId);
 }

+ 17 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/AlarmElectricalFireService.java

@@ -118,4 +118,21 @@ public interface AlarmElectricalFireService extends CrudService<AlarmElectricalF
      * @return
      */
     List<AlarmHiddenDangerVo> alarmHiddenDangerListOne(Integer systemType, String companyName, Integer handlingStatus, String startDate, String endDate);
+
+    /**
+     * 根据单位ID查询隐患数量
+     *
+     * @param companyId 单位ID
+     * @param table     表名
+     * @return
+     */
+    Map<String, Object> alarmCount(String companyId, String table);
+
+    /**
+     * 根据单位ID查询火警隐患数量
+     *
+     * @param companyId 单位ID
+     * @return
+     */
+    Map<String, Object> alarmFireCount(String companyId);
 }

+ 13 - 3
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/AlarmFireService.java

@@ -21,7 +21,7 @@ public interface AlarmFireService extends CrudService<AlarmFire> {
     CommonPage<AlarmFireVo> alarmFireLowerList(String companyName, Integer handlingStatus, String startDate, String endDate,
                                                Integer pageNum, Integer pageSize, String alarmType);
 
-    Map<String, Object> fireStatistics(String companyName,String alarmType,String startDate,String endDate);
+    Map<String, Object> fireStatistics(String companyName, String alarmType, String startDate, String endDate);
 
     Map<String, Object> fireStatisticalChart(String alarmType, String startDate, String endDate);
 
@@ -29,7 +29,7 @@ public interface AlarmFireService extends CrudService<AlarmFire> {
 
     List<AlarmFireVo> alarmFireLowerListExport(String companyName, Integer handlingStatus, String startDate, String endDate, String alarmType);
 
-    String alarmFireExport(String companyName, Integer handlingStatus, String startDate, String endDate, String alarmType,String exportTitle);
+    String alarmFireExport(String companyName, Integer handlingStatus, String startDate, String endDate, String alarmType, String exportTitle);
 
     /**
      * 火警告警处置/故障告警处置-数量统计
@@ -39,7 +39,7 @@ public interface AlarmFireService extends CrudService<AlarmFire> {
      * @param alarmTypeList  告警类型(2 火警、4 故障、16 监管等)
      * @return
      */
-    Integer fireCount(List<String> companyIdList, Integer handlingStatus, List<String> alarmTypeList,String companyName,String startDate,String endDate);
+    Integer fireCount(List<String> companyIdList, Integer handlingStatus, List<String> alarmTypeList, String companyName, String startDate, String endDate);
 
     /**
      * 火警告警处置/故障告警处置-列表数据查询
@@ -56,4 +56,14 @@ public interface AlarmFireService extends CrudService<AlarmFire> {
      */
     CommonPage<AlarmFire> alarmFireList(List<String> companyIdList, String companyName, Integer handlingStatus, String startDate,
                                         String endDate, Integer pageNum, Integer pageSize, List<String> alarmTypeList);
+
+    /**
+     * 根据单位ID查询火警告警数量
+     *
+     * @param companyId      单位ID
+     * @param handlingStatus 处理状态(0、未处理 1、已处理)
+     * @param alarmType      告警类型(2 火警、4 故障、16 监管等)
+     * @return
+     */
+    Integer fireAlarmCount(String companyId, Integer handlingStatus, String alarmType);
 }

+ 9 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/BaseDeviceService.java

@@ -22,4 +22,13 @@ public interface BaseDeviceService extends CrudService<BaseDevice> {
      * @return
      */
     List<BaseDevice> deviceData(String deviceCode);
+
+    /**
+     * 根据单位ID查询设备数量
+     *
+     * @param companyId  单位ID
+     * @param deviceType 设备类型
+     * @return
+     */
+    Integer deviceCount(String companyId, Integer deviceType);
 }

+ 32 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/BscEnterpriseScreenService.java

@@ -21,4 +21,36 @@ public interface BscEnterpriseScreenService extends CrudService<BscEnterpriseScr
      * @return
      */
     Object screenDataStatistic(String dataType, String moduleType);
+
+    /**
+     * 大屏值班查岗JSON数据查询
+     *
+     * @param companyId 单位ID
+     * @return
+     */
+    Object postInspectStatistics(String companyId);
+
+    /**
+     * 大屏火警报告JSON数据查询
+     *
+     * @param companyId 单位ID
+     * @return
+     */
+    Object fireAlarmStatistics(String companyId);
+
+    /**
+     * 大屏预案场景JSON数据查询
+     *
+     * @param companyId 单位ID
+     * @return
+     */
+    Object reservePlanStatistics(String companyId);
+
+    /**
+     * 大屏隐患告警JSON数据查询
+     *
+     * @param companyId 单位ID
+     * @return
+     */
+    Object hiddenDangerStatistics(String companyId);
 }

+ 9 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/PostInspectService.java

@@ -42,4 +42,13 @@ public interface PostInspectService extends CrudService<PostInspect> {
      * @param postInspect
      */
     void postInspectAnswerUpdate(PostInspect postInspect);
+
+    /**
+     * 根据单位ID查询值班查岗数量
+     *
+     * @param companyId     单位ID
+     * @param inspectStatus 查岗状态(1、已响应 0、未响应)
+     * @return
+     */
+    Integer postInspectCount(String companyId, Integer inspectStatus);
 }

+ 11 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/ReservePlanService.java

@@ -3,6 +3,9 @@ package com.usky.fire.service;
 import com.usky.common.core.bean.CommonPage;
 import com.usky.common.mybatis.core.CrudService;
 import com.usky.fire.domain.ReservePlan;
+import com.usky.fire.service.vo.DataCountVo;
+
+import java.util.List;
 
 /**
  * <p>
@@ -46,4 +49,12 @@ public interface ReservePlanService extends CrudService<ReservePlan> {
      * @return
      */
     CommonPage<Object> reservePlanDataList(String reserveName, String startDate, String endDate, Integer pageNum, Integer pageSize);
+
+    /**
+     * 根据单位ID查询预案数量
+     *
+     * @param companyId 单位ID
+     * @return
+     */
+    List<DataCountVo> reservePlanCount(String companyId);
 }

+ 0 - 4
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/AlarmDetectorServiceImpl.java

@@ -83,8 +83,6 @@ public class AlarmDetectorServiceImpl implements AlarmDetectorService {
                     map.put(columns.get(i), null);
                 }
             }
-        } else {
-            throw new BusinessException(query.getError());
         }
         return map;
     }
@@ -108,8 +106,6 @@ public class AlarmDetectorServiceImpl implements AlarmDetectorService {
                 map.put("time", time);
                 map.put("value", value);
             }
-        } else {
-            throw new BusinessException(query.getError());
         }
         return map;
     }

+ 43 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/AlarmElectricalFireServiceImpl.java

@@ -16,6 +16,7 @@ import com.usky.fire.service.*;
 import com.usky.fire.service.util.OnlineMethod;
 import com.usky.fire.service.vo.AlarmFireStatisticalVo;
 import com.usky.fire.service.vo.AlarmHiddenDangerVo;
+import com.usky.fire.service.vo.DataCountVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -352,5 +353,47 @@ public class AlarmElectricalFireServiceImpl extends AbstractCrudService<AlarmEle
         return list;
     }
 
+    @Override
+    public Map<String, Object> alarmCount(String companyId, String table) {
+        List<DataCountVo> dataCountVos = baseMapper.alarmCount(table, companyId);
+        int count1 = 0;
+        int count2 = 0;
+        int count3 = 0;
+        for (int i = 0; i < dataCountVos.size(); i++) {
+            if (dataCountVos.get(0).getId() == 0) {
+                count1 = dataCountVos.get(0).getListCount();
+            } else if (dataCountVos.get(0).getId() == 1) {
+                count2 = dataCountVos.get(0).getListCount();
+            }
+        }
+        count3 = count1 + count2;
+        Map<String, Object> map = new HashMap<>();
+        map.put("count", count3);
+        map.put("processed", count2);
+        map.put("untreated", count1);
+        return map;
+    }
+
+    @Override
+    public Map<String, Object> alarmFireCount(String companyId){
+        List<DataCountVo> dataCountVos = baseMapper.alarmFireCount(companyId);
+        int count1 = 0;
+        int count2 = 0;
+        int count3 = 0;
+        for (int i = 0; i < dataCountVos.size(); i++) {
+            if (dataCountVos.get(0).getId() == 0) {
+                count1 = dataCountVos.get(0).getListCount();
+            } else if (dataCountVos.get(0).getId() == 1) {
+                count2 = dataCountVos.get(0).getListCount();
+            }
+        }
+        count3 = count1 + count2;
+        Map<String, Object> map = new HashMap<>();
+        map.put("count", count3);
+        map.put("processed", count2);
+        map.put("untreated", count1);
+        return map;
+    }
+
 
 }

+ 10 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/AlarmFireServiceImpl.java

@@ -371,4 +371,14 @@ public class AlarmFireServiceImpl extends AbstractCrudService<AlarmFireMapper, A
         List<AlarmFire> list = this.list(queryWrapper);
         return new CommonPage<>(list, total, pageSize, pageNum);
     }
+
+    @Override
+    public Integer fireAlarmCount(String companyId, Integer handlingStatus, String alarmType) {
+        LambdaQueryWrapper<AlarmFire> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.eq(AlarmFire::getCompanyId, companyId)
+                .eq(handlingStatus != null, AlarmFire::getHandlingStatus, handlingStatus)
+                .eq(StringUtils.isNotBlank(alarmType), AlarmFire::getAlarmType, alarmType);
+        int count = this.count(queryWrapper);
+        return count;
+    }
 }

+ 10 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/BaseDeviceServiceImpl.java

@@ -32,4 +32,14 @@ public class BaseDeviceServiceImpl extends AbstractCrudService<BaseDeviceMapper,
         return list;
     }
 
+    @Override
+    public Integer deviceCount(String companyId,Integer deviceType){
+        LambdaQueryWrapper<BaseDevice> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.eq(BaseDevice::getEnable, 1)
+                .eq(BaseDevice::getCompanyId, companyId)
+                .eq(BaseDevice::getDeviceType, deviceType);
+        int count = this.count(queryWrapper);
+        return count;
+    }
+
 }

+ 268 - 3
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/BscEnterpriseScreenServiceImpl.java

@@ -6,15 +6,19 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.usky.common.core.exception.BusinessException;
+import com.usky.common.core.util.Arith;
 import com.usky.common.mybatis.core.AbstractCrudService;
 import com.usky.fire.domain.BscEnterpriseScreen;
 import com.usky.fire.mapper.BscEnterpriseScreenMapper;
-import com.usky.fire.service.BaseUserCompanyService;
-import com.usky.fire.service.BscEnterpriseScreenService;
+import com.usky.fire.service.*;
+import com.usky.fire.service.vo.DataCountVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -30,6 +34,21 @@ public class BscEnterpriseScreenServiceImpl extends AbstractCrudService<BscEnter
     @Autowired
     private BaseUserCompanyService baseUserCompanyService;
 
+    @Autowired
+    private PostInspectService postInspectService;
+
+    @Autowired
+    private AlarmFireService alarmFireService;
+
+    @Autowired
+    private BaseDeviceService baseDeviceService;
+
+    @Autowired
+    private ReservePlanService reservePlanService;
+
+    @Autowired
+    private AlarmElectricalFireService alarmElectricalFireService;
+
     @Override
     public Object screenDataStatistic(String dataType, String moduleType) {
         String companyId = baseUserCompanyService.companyId();
@@ -86,7 +105,253 @@ public class BscEnterpriseScreenServiceImpl extends AbstractCrudService<BscEnter
         }
         JSONObject jsonObject = JSONObject.parseObject(data.toString());
         Object disparateData = jsonObject.get(dataType);
-
         return disparateData;
     }
+
+
+    public void dataSynchro() {
+
+    }
+
+    @Override
+    public Object postInspectStatistics(String companyId) {
+        int uncharCount = postInspectService.postInspectCount(companyId, 0);
+        int chagasCount = postInspectService.postInspectCount(companyId, 1);
+        int count = chagasCount + uncharCount;
+        Map<String, Object> map = new HashMap<>();
+        map.put("value", count);
+        List<Object> data = new ArrayList<>();
+        for (int i = 0; i < 2; i++) {
+            Map<String, Object> map1 = new HashMap<>();
+            if (i == 0) {
+                map1.put("name", "应答数");
+                map1.put("value", chagasCount);
+            } else {
+                map1.put("name", "未应答数");
+                map1.put("value", uncharCount);
+            }
+            data.add(map1);
+        }
+        Map<String, Object> map2 = new HashMap<>();
+        map2.put("data", data);
+        Map<String, Object> map3 = new HashMap<>();
+        map3.put("data1", map);
+        map3.put("data2", map2);
+        return map3;
+    }
+
+    @Override
+    public Object fireAlarmStatistics(String companyId) {
+        int fireUntreated = alarmFireService.fireAlarmCount(companyId, 0, "2");
+        int fireProcessed = alarmFireService.fireAlarmCount(companyId, 1, "2");
+        int fireCount = fireUntreated + fireProcessed;
+        double fireRatio = Arith.div(fireProcessed, fireCount, 2) * 100;
+        int faultUntreated = alarmFireService.fireAlarmCount(companyId, 0, "4");
+        int faultProcessed = alarmFireService.fireAlarmCount(companyId, 1, "4");
+        int faultCount = faultUntreated + faultProcessed;
+        double faultRatio = Arith.div(faultProcessed, faultCount, 2) * 100;
+        int deviceCount = baseDeviceService.deviceCount(companyId, 1);
+
+        Map<String, Object> map1 = new HashMap<>();
+        map1.put("min", 1);
+        map1.put("max", 100);
+        map1.put("label", "火警告警报告");
+        map1.put("value", fireRatio);
+        map1.put("unit", "%");
+        Map<String, Object> map15 = new HashMap<>();
+        map15.put("data", map1);
+
+        Map<String, Object> map2 = new HashMap<>();
+        map2.put("value", fireCount);
+
+        Map<String, Object> map3 = new HashMap<>();
+        map3.put("value", fireUntreated);
+
+        Map<String, Object> map4 = new HashMap<>();
+        map4.put("value", fireProcessed);
+
+        List<Object> data = new ArrayList<>();
+        for (int i = 0; i < 2; i++) {
+            Map<String, Object> map5 = new HashMap<>();
+            if (i == 1) {
+                map5.put("name", "已处理");
+                map5.put("value", fireProcessed);
+            } else {
+                map5.put("name", "待处理");
+                map5.put("value", fireUntreated);
+            }
+            data.add(map5);
+        }
+        Map<String, Object> map16 = new HashMap<>();
+        map16.put("data", data);
+
+        Map<String, Object> map6 = new HashMap<>();
+        map6.put("value", deviceCount);
+
+        Map<String, Object> map7 = new HashMap<>();
+        map7.put("value", fireRatio);
+
+        Map<String, Object> map8 = new HashMap<>();
+        map8.put("min", 1);
+        map8.put("max", 100);
+        map8.put("label", "故障告警报告");
+        map8.put("value", faultRatio);
+        map8.put("unit", "%");
+        Map<String, Object> map17 = new HashMap<>();
+        map17.put("data", map8);
+
+        Map<String, Object> map9 = new HashMap<>();
+        map9.put("value", faultCount);
+
+        Map<String, Object> map10 = new HashMap<>();
+        map10.put("value", faultUntreated);
+
+        Map<String, Object> map11 = new HashMap<>();
+        map11.put("value", faultProcessed);
+
+        List<Object> data1 = new ArrayList<>();
+        for (int i = 0; i < 2; i++) {
+            Map<String, Object> map12 = new HashMap<>();
+            if (i == 1) {
+                map12.put("name", "已处理");
+                map12.put("value", faultProcessed);
+            } else {
+                map12.put("name", "待处理");
+                map12.put("value", faultUntreated);
+            }
+            data1.add(map12);
+        }
+        Map<String, Object> map18 = new HashMap<>();
+        map18.put("data", data1);
+
+        Map<String, Object> map13 = new HashMap<>();
+        map13.put("value", deviceCount);
+
+        Map<String, Object> map14 = new HashMap<>();
+        map14.put("value", faultRatio);
+
+        Map<String, Object> map = new HashMap<>();
+        map.put("data1", map15);
+        map.put("data2", map2);
+        map.put("data3", map3);
+        map.put("data4", map4);
+        map.put("data5", map16);
+        map.put("data6", map6);
+        map.put("data7", map7);
+        map.put("data8", map17);
+        map.put("data9", map9);
+        map.put("data10", map10);
+        map.put("data11", map11);
+        map.put("data12", map18);
+        map.put("data13", map13);
+        map.put("data14", map14);
+        return map;
+    }
+
+
+    @Override
+    public Object reservePlanStatistics(String companyId) {
+        List<DataCountVo> dataCountVos = reservePlanService.reservePlanCount(companyId);
+        List<Object> data = new ArrayList<>();
+        int count1 = 0;
+        int count2 = 0;
+        int count3 = 0;
+        for (int i = 0; i < dataCountVos.size(); i++) {
+            if (dataCountVos.get(i).getId() == 1) {
+                count1 = dataCountVos.get(i).getListCount();
+            } else if (dataCountVos.get(i).getId() == 2) {
+                count2 = dataCountVos.get(i).getListCount();
+            } else if (dataCountVos.get(i).getId() == 3) {
+                count3 = dataCountVos.get(i).getListCount();
+            }
+        }
+        Map<String, Object> map1 = new HashMap<>();
+        map1.put("name", "小型火灾扑灭");
+        map1.put("value", count1);
+        Map<String, Object> map2 = new HashMap<>();
+        map2.put("name", "人员疏散场景");
+        map2.put("value", count2);
+        Map<String, Object> map3 = new HashMap<>();
+        map3.put("name", "重点风险处置");
+        map3.put("value", count3);
+        data.add(map1);
+        data.add(map2);
+        data.add(map3);
+        Map<String, Object> map4 = new HashMap<>();
+        map4.put("data", data);
+        Map<String, Object> map = new HashMap<>();
+        map.put("data1", map4);
+        return map;
+    }
+
+    @Override
+    public Object hiddenDangerStatistics(String companyId) {
+        Map<String, Object> fireData = alarmElectricalFireService.alarmFireCount(companyId);
+        Map<String, Object> electricalFireData = alarmElectricalFireService.alarmCount(companyId, "alarm_electrical_fire");
+        Map<String, Object> hydrantWaterData = alarmElectricalFireService.alarmCount(companyId, "alarm_hydrant_water");
+        Map<String, Object> smokeControlData = alarmElectricalFireService.alarmCount(companyId, "alarm_smoke_control");
+        Map<String, Object> sprayWaterData = alarmElectricalFireService.alarmCount(companyId, "alarm_spray_water");
+        Map<String, Object> videoData = alarmElectricalFireService.alarmCount(companyId, "alarm_video");
+        int count = Integer.parseInt(fireData.get("count").toString()) + Integer.parseInt(electricalFireData.get("count").toString())
+                + Integer.parseInt(hydrantWaterData.get("count").toString()) + Integer.parseInt(smokeControlData.get("count").toString())
+                + Integer.parseInt(sprayWaterData.get("count").toString()) + Integer.parseInt(videoData.get("count").toString());
+        Map<String, Object> map1 = new HashMap<>();
+        map1.put("value", count);
+        List<Object> data1 = new ArrayList<>();
+        for (int i = 0; i < 3; i++) {
+            List<Object> data = new ArrayList<>();
+            Map<String, Object> map3 = new HashMap<>();
+            String find = "count";
+            if (i == 0) {
+                map3.put("seriesName", "总数");
+                map3.put("type", "bar");
+            } else if (i == 1) {
+                map3.put("seriesName", "已处理");
+                map3.put("type", "bar");
+                find = "processed";
+            } else if (i == 2) {
+                map3.put("seriesName", "待处理");
+                map3.put("type", "line");
+                find = "untreated";
+            }
+            for (int j = 0; j < 6; j++) {
+                Map<String, Object> map2 = new HashMap<>();
+                switch (j) {
+                    case 0:
+                        map2.put("name", "火灾");
+                        map2.put("value", Integer.parseInt(fireData.get(find).toString()));
+                        break;
+                    case 1:
+                        map2.put("name", "电器火灾");
+                        map2.put("value", Integer.parseInt(electricalFireData.get(find).toString()));
+                        break;
+                    case 2:
+                        map2.put("name", "视频监控");
+                        map2.put("value", Integer.parseInt(videoData.get(find).toString()));
+                        break;
+                    case 3:
+                        map2.put("name", "自动喷水灭火");
+                        map2.put("value", Integer.parseInt(sprayWaterData.get(find).toString()));
+                        break;
+                    case 4:
+                        map2.put("name", "消防给水及消火栓");
+                        map2.put("value", Integer.parseInt(hydrantWaterData.get(find).toString()));
+                        break;
+                    case 5:
+                        map2.put("name", "防排烟");
+                        map2.put("value", Integer.parseInt(smokeControlData.get(find).toString()));
+                        break;
+                }
+                data.add(map2);
+            }
+            map3.put("data", data);
+            data1.add(map3);
+        }
+        Map<String, Object> map4 = new HashMap<>();
+        map4.put("data", data1);
+        Map<String, Object> map = new HashMap<>();
+        map.put("data1", map1);
+        map.put("data2", map4);
+        return map;
+    }
 }

+ 1 - 2
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/DemBuildScoreServiceImpl.java

@@ -46,8 +46,7 @@ public class DemBuildScoreServiceImpl extends AbstractCrudService<DemBuildScoreM
     public List<Object> buildScoreList() {
         List<Object> list = new ArrayList<>();
         LambdaQueryWrapper<DemBuildScore> queryWrapper = Wrappers.lambdaQuery();
-        queryWrapper.eq(DemBuildScore::getEnable, 1)
-                .eq(DemBuildScore::getTenantId, SecurityUtils.getTenantId());
+        queryWrapper.eq(DemBuildScore::getEnable, 1);
         List<DemBuildScore> list1 = this.list(queryWrapper);
         if (CollectionUtils.isNotEmpty(list1)) {
             for (int i = 0; i < list1.size(); i++) {

+ 9 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PostInspectServiceImpl.java

@@ -103,4 +103,13 @@ public class PostInspectServiceImpl extends AbstractCrudService<PostInspectMappe
         }
     }
 
+    @Override
+    public Integer postInspectCount(String companyId, Integer inspectStatus) {
+        LambdaQueryWrapper<PostInspect> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.eq(PostInspect::getCompanyId, companyId)
+                .eq(inspectStatus != null, PostInspect::getInspectStatus, inspectStatus);
+        int count = this.count(queryWrapper);
+        return count;
+    }
+
 }

+ 7 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/ReservePlanServiceImpl.java

@@ -13,6 +13,7 @@ import com.usky.common.security.utils.SecurityUtils;
 import com.usky.fire.domain.ReservePlan;
 import com.usky.fire.mapper.ReservePlanMapper;
 import com.usky.fire.service.ReservePlanService;
+import com.usky.fire.service.vo.DataCountVo;
 import org.springframework.stereotype.Service;
 
 import java.time.LocalDateTime;
@@ -102,4 +103,10 @@ public class ReservePlanServiceImpl extends AbstractCrudService<ReservePlanMappe
         return new CommonPage<>(list, page.getTotal(), pageSize, pageNum);
     }
 
+    @Override
+    public List<DataCountVo> reservePlanCount(String companyId) {
+        List<DataCountVo> dataCountVos = baseMapper.reservePlanCount(companyId);
+        return dataCountVos;
+    }
+
 }

+ 1 - 1
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/vo/AlarmFireVo.java

@@ -118,7 +118,7 @@ public class AlarmFireVo implements Serializable {
     /**
      * 单位ID
      */
-    private Integer companyId;
+    private String companyId;
 
     /**
      * 原始告警类型

+ 52 - 23
service-fire/service-fire-biz/src/main/resources/mapper/fire/AlarmElectricalFireMapper.xml

@@ -4,28 +4,28 @@
 
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.usky.fire.domain.AlarmElectricalFire">
-        <id column="id" property="id" />
-        <result column="device_code" property="deviceCode" />
-        <result column="device_name" property="deviceName" />
-        <result column="alarm_type" property="alarmType" />
-        <result column="alarm_time" property="alarmTime" />
-        <result column="address" property="address" />
-        <result column="alarm_status" property="alarmStatus" />
-        <result column="system_type" property="systemType" />
-        <result column="port_num" property="portNum" />
-        <result column="company_id" property="companyId" />
-        <result column="company_name" property="companyName" />
-        <result column="attribute_value1" property="attributeValue1" />
-        <result column="attribute_value2" property="attributeValue2" />
-        <result column="attribute_value3" property="attributeValue3" />
-        <result column="attribute_value4" property="attributeValue4" />
-        <result column="handler" property="handler" />
-        <result column="handling_time" property="handlingTime" />
-        <result column="handling_content" property="handlingContent" />
-        <result column="handler_phone" property="handlerPhone" />
-        <result column="handling_status" property="handlingStatus" />
-        <result column="false_alarm" property="falseAlarm" />
-        <result column="site_photo" property="sitePhoto" />
+        <id column="id" property="id"/>
+        <result column="device_code" property="deviceCode"/>
+        <result column="device_name" property="deviceName"/>
+        <result column="alarm_type" property="alarmType"/>
+        <result column="alarm_time" property="alarmTime"/>
+        <result column="address" property="address"/>
+        <result column="alarm_status" property="alarmStatus"/>
+        <result column="system_type" property="systemType"/>
+        <result column="port_num" property="portNum"/>
+        <result column="company_id" property="companyId"/>
+        <result column="company_name" property="companyName"/>
+        <result column="attribute_value1" property="attributeValue1"/>
+        <result column="attribute_value2" property="attributeValue2"/>
+        <result column="attribute_value3" property="attributeValue3"/>
+        <result column="attribute_value4" property="attributeValue4"/>
+        <result column="handler" property="handler"/>
+        <result column="handling_time" property="handlingTime"/>
+        <result column="handling_content" property="handlingContent"/>
+        <result column="handler_phone" property="handlerPhone"/>
+        <result column="handling_status" property="handlingStatus"/>
+        <result column="false_alarm" property="falseAlarm"/>
+        <result column="site_photo" property="sitePhoto"/>
     </resultMap>
 
     <select id="selectElectricalFireStatistical" resultType="com.usky.fire.service.vo.AlarmFireStatisticalVo">
@@ -43,11 +43,40 @@
                 </foreach>
             </if>
             <if test="startDate != null and startDate != '' and startDate != null and startDate != ''">
-                and  alarm_time BETWEEN  #{startDate} AND  #{endDate}
+                and alarm_time BETWEEN #{startDate} AND #{endDate}
             </if>
         </where>
         GROUP BY
         alarmTime
     </select>
 
+    <select id="alarmCount" resultType="com.usky.fire.service.vo.DataCountVo">
+        SELECT
+        handling_status as id,
+        count(*) AS listCount
+        FROM
+        ${table}
+        <where>
+            <if test="companyId != null and companyId != '' ">
+                company_id = #{companyId}
+            </if>
+        </where>
+        GROUP BY
+        handling_status
+    </select>
+
+    <select id="alarmFireCount" resultType="com.usky.fire.service.vo.DataCountVo">
+        SELECT
+        handling_status as id,
+        count(*) AS listCount
+        FROM
+        alarm_fire
+        <where>
+            alarm_type not in('2','4')
+            and company_id = #{companyId}
+        </where>
+        GROUP BY
+        handling_status
+    </select>
+
 </mapper>

+ 26 - 10
service-fire/service-fire-biz/src/main/resources/mapper/fire/ReservePlanMapper.xml

@@ -4,16 +4,32 @@
 
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.usky.fire.domain.ReservePlan">
-        <id column="id" property="id" />
-        <result column="reserve_name" property="reserveName" />
-        <result column="reserve_type" property="reserveType" />
-        <result column="reserve_url" property="reserveUrl" />
-        <result column="company_id" property="companyId" />
-        <result column="creator" property="creator" />
-        <result column="create_time" property="createTime" />
-        <result column="update_person" property="updatePerson" />
-        <result column="update_time" property="updateTime" />
-        <result column="enable" property="enable" />
+        <id column="id" property="id"/>
+        <result column="reserve_name" property="reserveName"/>
+        <result column="reserve_type" property="reserveType"/>
+        <result column="reserve_url" property="reserveUrl"/>
+        <result column="company_id" property="companyId"/>
+        <result column="creator" property="creator"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_person" property="updatePerson"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="enable" property="enable"/>
     </resultMap>
 
+    <select id="reservePlanCount" resultType="com.usky.fire.service.vo.DataCountVo">
+        SELECT
+        reserve_type as id,
+        count(*) AS listCount
+        FROM
+        reserve_plan
+        <where>
+            enable=1
+            <if test="companyId != null and companyId != '' ">
+                AND company_id = #{companyId}
+            </if>
+        </where>
+        GROUP BY
+        reserve_type
+    </select>
+
 </mapper>