|
|
@@ -5,14 +5,13 @@ import cn.hutool.core.date.DateField;
|
|
|
import cn.hutool.core.date.DateTime;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
-import com.alibaba.fastjson2.JSON;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.xunmei.common.core.constant.CacheConstants;
|
|
|
import com.xunmei.common.core.constant.SecurityConstants;
|
|
|
import com.xunmei.common.core.domain.iot.domain.IotDvrDisk;
|
|
|
-import com.xunmei.common.core.domain.iot.domain.IotDvrHardDiskDetectionLog;
|
|
|
import com.xunmei.common.core.domain.iot.domain.IotSensor;
|
|
|
import com.xunmei.common.core.domain.mediator.domain.IotAlarmData;
|
|
|
+import com.xunmei.common.core.domain.video.MediatorVideoDaysCheck;
|
|
|
import com.xunmei.common.core.domain.video.MediatorVideoIntegrityCheckLog;
|
|
|
import com.xunmei.common.core.enums.CategoryDataEnum;
|
|
|
import com.xunmei.common.core.enums.iot.SensorType;
|
|
|
@@ -24,7 +23,7 @@ import com.xunmei.common.security.utils.SecurityUtils;
|
|
|
import com.xunmei.iot.mapper.IotBoardMapper;
|
|
|
import com.xunmei.iot.mapper.IotDvrChannelMapper;
|
|
|
import com.xunmei.iot.mapper.IotDvrDiskMapper;
|
|
|
-import com.xunmei.iot.mapper.IotDvrHardDiskDetectionLogMapper;
|
|
|
+import com.xunmei.iot.mapper.VideoDaysCheckMapper;
|
|
|
import com.xunmei.iot.service.IIotCommonSensorService;
|
|
|
import com.xunmei.iot.service.IotAlarmDataService;
|
|
|
import com.xunmei.iot.service.IotBoardService;
|
|
|
@@ -74,7 +73,7 @@ public class IotBoardServiceImpl implements IotBoardService {
|
|
|
IotAlarmDataService alarmDataService;
|
|
|
|
|
|
@Resource
|
|
|
- IotDvrHardDiskDetectionLogMapper dvrHardDiskDetectionLogMapper;
|
|
|
+ VideoDaysCheckMapper videoDaysCheckMapper;
|
|
|
@Resource
|
|
|
IotDvrDiskMapper iotDvrDiskMapper;
|
|
|
|
|
|
@@ -342,6 +341,24 @@ public class IotBoardServiceImpl implements IotBoardService {
|
|
|
}
|
|
|
}
|
|
|
totalData.setDeviceOverview(deviceOverview);
|
|
|
+ this.sensorData(MAP_VALUE, DEVICE_TYPE, orgPath, totalData);
|
|
|
+ //录像文件自检
|
|
|
+ this.selectVideoCheckSelf(orgVO, now, totalData, channelDataOffsetDay);
|
|
|
+
|
|
|
+ final Date startTime = DateUtil.beginOfDay(DateUtil.offsetDay(now, -channelDataOffsetDay));
|
|
|
+ //录像天数存储
|
|
|
+ this.selectVideoDaysStorage(orgPath, startTime, totalData);
|
|
|
+
|
|
|
+ IotBoardTotalData.VideoDiagnostic videoDiagnostic = videoDiagnosisService.selectVideoDiagnostic(orgPath, startTime);
|
|
|
+ totalData.setVideoDiagnostic(videoDiagnostic);
|
|
|
+
|
|
|
+ totalData.setAirConditionerInfo(new IotBoardTotalData.AirConditionerInfo());
|
|
|
+ totalData.setUpsInfo(new IotBoardTotalData.UpsInfo());
|
|
|
+
|
|
|
+ return totalData;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void sensorData(String MAP_VALUE, String DEVICE_TYPE, String orgPath, IotBoardTotalData totalData) {
|
|
|
//物联设备最近90天的告警数据
|
|
|
List<Map<String, String>> alarmCountMap = alarmDataService.selectAlarmCount(orgPath);
|
|
|
//计算alarmCountMap 所有nums的总和
|
|
|
@@ -370,32 +387,26 @@ public class IotBoardServiceImpl implements IotBoardService {
|
|
|
sensorDataList.add(sensorData);
|
|
|
}
|
|
|
totalData.setSensorDetails(sensorDataList);
|
|
|
- //录像文件自检
|
|
|
- this.selectVideoCheckSelf(orgVO, now, totalData, channelDataOffsetDay);
|
|
|
+ }
|
|
|
|
|
|
- final Date startTime = DateUtil.beginOfDay(DateUtil.offsetDay(now, -channelDataOffsetDay));
|
|
|
- //录像天数存储
|
|
|
- List<Map<String, String>> videoCheckMap = iotBoardMapper.selectVideoDaysStorage(orgPath,startTime);
|
|
|
- HashMap<Integer, Integer> hashMap = new LinkedHashMap<>();
|
|
|
- IotBoardTotalData.RecordingStorage storage = new IotBoardTotalData.RecordingStorage();
|
|
|
- if (!videoCheckMap.isEmpty()) {
|
|
|
- for (Map<String, String> map : videoCheckMap) {
|
|
|
- hashMap.put(Integer.parseInt(map.get("planDays")), Integer.parseInt(map.get(MAP_VALUE)));
|
|
|
- }
|
|
|
- String string = videoCheckMap.get(0).get("time");
|
|
|
- storage.setUpdateTime(DateUtil.parseDateTime(string));
|
|
|
+ private void selectVideoDaysStorage(String orgPath, Date startTime, IotBoardTotalData totalData) {
|
|
|
+ List<MediatorVideoDaysCheck> daysCheckList = videoDaysCheckMapper.selectDataList(orgPath, startTime);
|
|
|
+ IotBoardTotalData.RecordingStorage recordingStorage = new IotBoardTotalData.RecordingStorage();
|
|
|
+ totalData.setRecordingStorage(recordingStorage);
|
|
|
+ if (ObjectUtil.isEmpty(daysCheckList)) {
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
- storage.setHashmap(hashMap);
|
|
|
- totalData.setRecordingStorage(storage);
|
|
|
+ final Optional<MediatorVideoDaysCheck> optional = daysCheckList.stream().max(Comparator.comparing(MediatorVideoDaysCheck::getUpdateTime));
|
|
|
+ optional.ifPresent(daysCheck -> recordingStorage.setUpdateTime(daysCheck.getUpdateTime()));
|
|
|
+ final List<Integer> list = daysCheckList.stream().map(MediatorVideoDaysCheck::getRealDays).collect(Collectors.toList());
|
|
|
+ final long count = list.stream().filter(d -> 30 <= d && d < 90).count();
|
|
|
+ final long count1 = list.stream().filter(d -> 90 <= d).count();
|
|
|
|
|
|
- IotBoardTotalData.VideoDiagnostic videoDiagnostic = videoDiagnosisService.selectVideoDiagnostic(orgPath, startTime);
|
|
|
- totalData.setVideoDiagnostic(videoDiagnostic);
|
|
|
-
|
|
|
- totalData.setAirConditionerInfo(new IotBoardTotalData.AirConditionerInfo());
|
|
|
- totalData.setUpsInfo(new IotBoardTotalData.UpsInfo());
|
|
|
-
|
|
|
- return totalData;
|
|
|
+ Map<Integer, Integer> map = new HashMap<>();
|
|
|
+ map.put(30, (int) count);
|
|
|
+ map.put(90, (int) count1);
|
|
|
+ recordingStorage.setHashmap(map);
|
|
|
}
|
|
|
|
|
|
private void selectVideoCheckSelf(SysOrgVO org, Date now, IotBoardTotalData totalData, Integer channelDataOffsetDay) {
|