|
@@ -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;
|
|
|
+ }
|
|
|
}
|