|
@@ -1,20 +1,20 @@
|
|
package com.usky.issue.service.impl;
|
|
package com.usky.issue.service.impl;
|
|
|
|
|
|
-
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
import com.usky.common.core.bean.CommonPage;
|
|
import com.usky.common.core.bean.CommonPage;
|
|
import com.usky.common.core.exception.BusinessException;
|
|
import com.usky.common.core.exception.BusinessException;
|
|
import com.usky.issue.domain.YtDeviceStatus;
|
|
import com.usky.issue.domain.YtDeviceStatus;
|
|
import com.usky.issue.mapper.YtDeviceStatusMapper;
|
|
import com.usky.issue.mapper.YtDeviceStatusMapper;
|
|
|
|
+import com.usky.issue.service.SpHj2017Service;
|
|
|
|
+import com.usky.issue.service.SpRtu2017Service;
|
|
|
|
+import com.usky.issue.service.SpSj2017Service;
|
|
import com.usky.issue.service.YtDeviceStatusService;
|
|
import com.usky.issue.service.YtDeviceStatusService;
|
|
import com.usky.common.mybatis.core.AbstractCrudService;
|
|
import com.usky.common.mybatis.core.AbstractCrudService;
|
|
import com.usky.issue.service.vo.YtDeviceStatusRequestVO;
|
|
import com.usky.issue.service.vo.YtDeviceStatusRequestVO;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.math.BigDecimal;
|
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -30,7 +30,16 @@ import java.util.stream.Collectors;
|
|
public class YtDeviceStatusServiceImpl extends AbstractCrudService<YtDeviceStatusMapper, YtDeviceStatus> implements YtDeviceStatusService {
|
|
public class YtDeviceStatusServiceImpl extends AbstractCrudService<YtDeviceStatusMapper, YtDeviceStatus> implements YtDeviceStatusService {
|
|
@Autowired
|
|
@Autowired
|
|
private YtDeviceStatusMapper ytDeviceStatusMapper;
|
|
private YtDeviceStatusMapper ytDeviceStatusMapper;
|
|
|
|
+ @Autowired
|
|
|
|
+ private SpRtu2017Service spRtu2017Service;
|
|
|
|
+ @Autowired
|
|
|
|
+ private SpSj2017Service spSj2017Service;
|
|
|
|
+ @Autowired
|
|
|
|
+ private SpHj2017Service spHj2017Service;
|
|
|
|
|
|
|
|
+ /*
|
|
|
|
+ 分页查询
|
|
|
|
+ */
|
|
@Override
|
|
@Override
|
|
public CommonPage<YtDeviceStatus> page(YtDeviceStatusRequestVO requestVO) {
|
|
public CommonPage<YtDeviceStatus> page(YtDeviceStatusRequestVO requestVO) {
|
|
|
|
|
|
@@ -62,6 +71,7 @@ public class YtDeviceStatusServiceImpl extends AbstractCrudService<YtDeviceStatu
|
|
return new CommonPage<>(records, total, pageSize, pageCurrent);
|
|
return new CommonPage<>(records, total, pageSize, pageCurrent);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
/*
|
|
/*
|
|
导出离线数据查询结果
|
|
导出离线数据查询结果
|
|
*/
|
|
*/
|
|
@@ -70,6 +80,11 @@ public class YtDeviceStatusServiceImpl extends AbstractCrudService<YtDeviceStatu
|
|
return ytDeviceStatusMapper.exportData();
|
|
return ytDeviceStatusMapper.exportData();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ 告警设备数量统计
|
|
|
|
+ */
|
|
|
|
+
|
|
/*
|
|
/*
|
|
根据传入单位编号查询所有设备信息
|
|
根据传入单位编号查询所有设备信息
|
|
*/
|
|
*/
|
|
@@ -77,12 +92,68 @@ public class YtDeviceStatusServiceImpl extends AbstractCrudService<YtDeviceStatu
|
|
public List<Map<String, Object>> deviceList(String requestBody) {
|
|
public List<Map<String, Object>> deviceList(String requestBody) {
|
|
JSONObject requestVO = JSONObject.parseObject(requestBody);
|
|
JSONObject requestVO = JSONObject.parseObject(requestBody);
|
|
String companyCode = requestVO.get("companyCode").toString();
|
|
String companyCode = requestVO.get("companyCode").toString();
|
|
- QueryWrapper<YtDeviceStatus> queryWrapper = Wrappers.query();
|
|
|
|
- queryWrapper.select("device_type AS deviceType","COUNT(*) AS deviceTypeCounts","COUNT(difference < 48 OR " +
|
|
|
|
- "NULL) AS onlineCount","COUNT(difference >= 48 OR NULL) AS offlineCount")
|
|
|
|
- .eq("company_code",companyCode)
|
|
|
|
- .groupBy("device_type");
|
|
|
|
|
|
+ QueryWrapper<YtDeviceStatus> queryWrapper = new QueryWrapper<>();
|
|
|
|
+ queryWrapper.select("device_type AS deviceType","COUNT(*) AS deviceTypeCounts",
|
|
|
|
+ "COUNT(difference < 48 OR NULL) AS onlineCount",
|
|
|
|
+ "COUNT(difference >= 48 OR NULL) AS offlineCount")
|
|
|
|
+ .eq("company_code",companyCode)
|
|
|
|
+ .groupBy("device_type");
|
|
List<Map<String, Object>> deviceStatusList = this.listMaps(queryWrapper);
|
|
List<Map<String, Object>> deviceStatusList = this.listMaps(queryWrapper);
|
|
|
|
+ if (deviceStatusList.size() == 0) {
|
|
|
|
+ throw new BusinessException("暂无设备");
|
|
|
|
+ }
|
|
|
|
+ for (Map<String, Object> type : deviceStatusList) {
|
|
|
|
+ String dwtype = String.valueOf(type.get("deviceType"));
|
|
|
|
+ type.put("deviceType", dwtype);
|
|
|
|
+ switch (dwtype) {
|
|
|
|
+ case "火系统":
|
|
|
|
+ // 1火系统
|
|
|
|
+ Long countHj = (spHj2017Service.countDevice(requestBody)!= null)? spHj2017Service.countDevice(requestBody) : 0L;
|
|
|
|
+ type.put("alarmDeviceSum", countHj);
|
|
|
|
+ break;
|
|
|
|
+ case "水系统":
|
|
|
|
+ // 2水系统
|
|
|
|
+ Long countSj = (spSj2017Service.countDevice(requestBody) != null) ? spSj2017Service.countDevice(requestBody) : 0L;
|
|
|
|
+ type.put("alarmDeviceSum", countSj);
|
|
|
|
+ case "液位":
|
|
|
|
+ // 5液位
|
|
|
|
+ Long countSjYw = (spSj2017Service.countDevice(requestBody) != null) ? spSj2017Service.countDevice(requestBody) : 0L;
|
|
|
|
+ type.put("alarmDeviceSum", countSjYw);
|
|
|
|
+ break;
|
|
|
|
+ case "烟感系统":
|
|
|
|
+ // 3烟感系统
|
|
|
|
+ break;
|
|
|
|
+ case "消防栓":
|
|
|
|
+ // 4消防栓
|
|
|
|
+ break;
|
|
|
|
+ case "rtu":
|
|
|
|
+ // 6rtu
|
|
|
|
+ Long countRtu = (spRtu2017Service.countDevice(requestBody) != null) ? spRtu2017Service.countDevice(requestBody) : 0L;
|
|
|
|
+ type.put("alarmDeviceSum", countRtu);
|
|
|
|
+ break;
|
|
|
|
+ case "电气火灾":
|
|
|
|
+ // 7电气火灾
|
|
|
|
+ break;
|
|
|
|
+ case "防火门":
|
|
|
|
+ // 8防火门
|
|
|
|
+ break;
|
|
|
|
+ case "气体灭火":
|
|
|
|
+ // 9气体灭火
|
|
|
|
+ break;
|
|
|
|
+ case "人脸识别":
|
|
|
|
+ // 10人脸识别
|
|
|
|
+ break;
|
|
|
|
+ case "视频监控":
|
|
|
|
+ // 11视频监控
|
|
|
|
+ break;
|
|
|
|
+ case "井盖":
|
|
|
|
+ // 128井盖
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ // 处理未知类型
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
return deviceStatusList;
|
|
return deviceStatusList;
|
|
}
|
|
}
|
|
|
|
|