|
|
@@ -152,6 +152,7 @@ public class DeviceService {
|
|
|
}
|
|
|
List<Long> devicesId = list.stream().map(DeviceVo::getId).toList();
|
|
|
List<Map<String, Long>> alarmData = alarmMapper.selectByDevicesId(devicesId);
|
|
|
+ List<Map<String, Object>> dataError = alarmMapper.selectDataByDevicesId(devicesId);
|
|
|
|
|
|
Map<String, SystemDict> deviceType = commonService.getDictList(null, new HashMap<>() {{
|
|
|
put("code", DictEnum.DEVICE_TYPE.getCodeType());
|
|
|
@@ -165,16 +166,27 @@ public class DeviceService {
|
|
|
|
|
|
for (DeviceVo vo : list) {
|
|
|
vo.setStatusText(DeviceEnum.getName(vo.getStatus()));
|
|
|
+ vo.setDeviceErrorCount(0L);
|
|
|
+ vo.setDataErrorCount(0L);
|
|
|
if (!CollectionUtils.isEmpty(alarmData)) {
|
|
|
for (int i = 0; i < alarmData.size(); i++) {
|
|
|
Map<String, Long> map = alarmData.get(i);
|
|
|
if (map.get("device_id").toString().equals(vo.getId().toString())) {
|
|
|
- vo.setDataErrorCount(map.get("count"));
|
|
|
- vo.setDeviceErrorCount(map.get("count"));
|
|
|
+ //vo.setDataErrorCount(map.get("count"));
|
|
|
+ String count = map.get("count").toString();
|
|
|
+ vo.setDeviceErrorCount(Long.parseLong(count));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!CollectionUtils.isEmpty(dataError)) {
|
|
|
+ for (int i = 0; i < dataError.size(); i++) {
|
|
|
+ Map<String, Object> map = dataError.get(i);
|
|
|
+ if (map.get("device_id").toString().equals(vo.getId().toString())) {
|
|
|
+ String count = map.get("count").toString();
|
|
|
+
|
|
|
+ vo.setDataErrorCount(Long.parseLong(count));
|
|
|
+ //vo.setDeviceErrorCount(map.get("count"));
|
|
|
}
|
|
|
- /*if(map.get("pid").toString().equals(vo.getId().toString()) && map.get("type").toString().equals(AlarmTypeEnum.ALARM_TWO.getCode())){
|
|
|
- vo.setDeviceErrorCount(map.get("count"));
|
|
|
- }*/
|
|
|
}
|
|
|
}
|
|
|
if(Objects.nonNull(vo.getDeviceType())){
|