|
|
@@ -9,6 +9,7 @@ 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;
|
|
|
@@ -319,13 +320,13 @@ public class IotBoardServiceImpl implements IotBoardService {
|
|
|
for (Map<String, String> map : deviceNums) {
|
|
|
String aLong = map.get(MAP_VALUE);
|
|
|
int res = Integer.parseInt(aLong);
|
|
|
- if (CategoryDataEnum.IOT_DETECTION_DEVICE.getId().equals(map.get(CATEGORY_ID))) {
|
|
|
+ if (CategoryDataEnum.IOT_DETECTION_DEVICE.getId().toString().equals(map.get(CATEGORY_ID))) {
|
|
|
deviceOverview.setEdgeComputingHosts(res);
|
|
|
}
|
|
|
- if (CategoryDataEnum.ALARM_HOST_DEVICE.getId().equals(map.get(CATEGORY_ID))) {
|
|
|
+ if (CategoryDataEnum.ALARM_HOST_DEVICE.getId().toString().equals(map.get(CATEGORY_ID))) {
|
|
|
deviceOverview.setAlarmControllers(res);
|
|
|
}
|
|
|
- if (CategoryDataEnum.MONITOR_HOST_DEVICE.getId().equals(map.get(CATEGORY_ID))) {
|
|
|
+ if (CategoryDataEnum.MONITOR_HOST_DEVICE.getId().toString().equals(map.get(CATEGORY_ID))) {
|
|
|
deviceOverview.setHardDiskRecorders(res);
|
|
|
}
|
|
|
}
|
|
|
@@ -372,9 +373,9 @@ public class IotBoardServiceImpl implements IotBoardService {
|
|
|
//录像文件自检
|
|
|
this.selectVideoCheckSelf(orgVO, now, totalData, channelDataOffsetDay);
|
|
|
|
|
|
-
|
|
|
+ final Date startTime = DateUtil.beginOfDay(DateUtil.offsetDay(now, -channelDataOffsetDay));
|
|
|
//录像天数存储
|
|
|
- List<Map<String, String>> videoCheckMap = iotBoardMapper.selectVideoDaysStorage(orgPath, new Date());
|
|
|
+ List<Map<String, String>> videoCheckMap = iotBoardMapper.selectVideoDaysStorage(orgPath,startTime);
|
|
|
HashMap<Integer, Integer> hashMap = new LinkedHashMap<>();
|
|
|
IotBoardTotalData.RecordingStorage storage = new IotBoardTotalData.RecordingStorage();
|
|
|
if (!videoCheckMap.isEmpty()) {
|
|
|
@@ -388,7 +389,7 @@ public class IotBoardServiceImpl implements IotBoardService {
|
|
|
storage.setHashmap(hashMap);
|
|
|
totalData.setRecordingStorage(storage);
|
|
|
|
|
|
- IotBoardTotalData.VideoDiagnostic videoDiagnostic = videoDiagnosisService.selectVideoDiagnostic(orgPath, now, channelDataOffsetDay);
|
|
|
+ IotBoardTotalData.VideoDiagnostic videoDiagnostic = videoDiagnosisService.selectVideoDiagnostic(orgPath, startTime);
|
|
|
totalData.setVideoDiagnostic(videoDiagnostic);
|
|
|
|
|
|
totalData.setAirConditionerInfo(new IotBoardTotalData.AirConditionerInfo());
|
|
|
@@ -404,7 +405,7 @@ public class IotBoardServiceImpl implements IotBoardService {
|
|
|
//获取查询时间范围的最小值
|
|
|
DateTime offsetDay = DateUtil.offsetDay(now, -channelDataOffsetDay);
|
|
|
//查询历史上报的录像完整性数据
|
|
|
- List<MediatorVideoIntegrityCheckLog> videoIntegrityCheckLogs = iotBoardMapper.selectVideoCheckSelf(org.getPath(), DateUtil.format(offsetDay, "yyyy-MM-dd"), DateUtil.format(now, "yyyy-MM-dd"));
|
|
|
+ List<MediatorVideoIntegrityCheckLog> videoIntegrityCheckLogs = iotBoardMapper.selectVideoCheckSelf(org.getPath(), DateUtil.format(offsetDay, "yyyy-MM-dd"));
|
|
|
if (ObjectUtil.isEmpty(videoIntegrityCheckLogs)) {
|
|
|
videoInspection.setLostRate("-");
|
|
|
} else {
|
|
|
@@ -435,56 +436,11 @@ public class IotBoardServiceImpl implements IotBoardService {
|
|
|
}
|
|
|
//硬盘异常率
|
|
|
//获取硬盘数量
|
|
|
- int diskNum = iotDvrDiskMapper.selectDiskCount(org.getPath());
|
|
|
- //获取历史上报的硬盘数据
|
|
|
- List<IotDvrHardDiskDetectionLog> logList = dvrHardDiskDetectionLogMapper.selectData(org.getPath(), DateUtil.format(offsetDay, "yyyy-MM-dd"), DateUtil.format(now, "yyyy-MM-dd"));
|
|
|
-
|
|
|
- if (ObjectUtil.isEmpty(logList)) {
|
|
|
+ final List<IotDvrDisk> dvrDiskList = iotDvrDiskMapper.selectDiskCount(org.getPath());
|
|
|
+ if (ObjectUtil.isEmpty(dvrDiskList)) {
|
|
|
videoInspection.setHardDiskExceptionRate("-");
|
|
|
}
|
|
|
-
|
|
|
- int diskTotal = diskNum * channelDataOffsetDay;
|
|
|
- //硬盘正常数量
|
|
|
- int diskExitTotal = 0;
|
|
|
- //把硬盘检测数据根据主机code分组
|
|
|
- Map<String, List<IotDvrHardDiskDetectionLog>> diskListmap = logList.stream().collect(Collectors.groupingBy(IotDvrHardDiskDetectionLog::getEquipmentCode));
|
|
|
- for (Map.Entry<String, List<IotDvrHardDiskDetectionLog>> listEntry : diskListmap.entrySet()) {
|
|
|
-
|
|
|
- //拿到每个主机下上报的硬盘检测数据
|
|
|
- List<IotDvrHardDiskDetectionLog> detectionLogs = listEntry.getValue();
|
|
|
-
|
|
|
- //循环每一天
|
|
|
- for (DateTime time : timeList) {
|
|
|
-
|
|
|
- //判断当天是否上报
|
|
|
- Optional<IotDvrHardDiskDetectionLog> first = detectionLogs.stream().filter(r -> DateUtils.isSameDay(time, DateUtils.toDate(r.getCreateTime()))).findFirst();
|
|
|
- if (!first.isPresent()) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- IotDvrHardDiskDetectionLog detectionLog = first.get();
|
|
|
- String detailInfo = detectionLog.getDetailInfo();
|
|
|
- if (ObjectUtil.isEmpty(detailInfo)) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- //获取上报数据详情
|
|
|
- List<Map> maps = JSON.parseArray(detailInfo, Map.class);
|
|
|
-
|
|
|
- //统计上报数据中正常的硬盘数量
|
|
|
- long count = maps.stream().filter(d -> ObjectUtil.equal(d.get("state").toString(), "0")).count();
|
|
|
- //硬盘正常数量累加
|
|
|
- diskExitTotal += (int) count;
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (diskTotal == 0) {
|
|
|
- videoInspection.setHardDiskExceptionRate("-");
|
|
|
- } else {
|
|
|
- //用计算分母减去正常硬盘数量=异常硬盘数; 用异常硬盘数/计算分母得到异常率
|
|
|
- videoInspection.setHardDiskExceptionRate(String.format("%.2f", ((diskTotal - diskExitTotal) * 100.0 / diskTotal)) + "%");
|
|
|
- }
|
|
|
-
|
|
|
+ final long count1 = dvrDiskList.stream().filter(d -> ObjectUtil.equal(d.getState(), 0)).count();
|
|
|
+ videoInspection.setHardDiskExceptionRate(String.format("%.2f", ((dvrDiskList.size() - count1) * 100.0 / dvrDiskList.size())) + "%");
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|