|
|
@@ -9,10 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.xunmei.common.core.constant.CacheConstants;
|
|
|
-import com.xunmei.common.core.domain.iot.domain.IotAlarmDefenceArea;
|
|
|
-import com.xunmei.common.core.domain.iot.domain.IotDevice;
|
|
|
-import com.xunmei.common.core.domain.iot.domain.IotDvrDisk;
|
|
|
-import com.xunmei.common.core.domain.iot.domain.IotDvrHardDiskDetection;
|
|
|
+import com.xunmei.common.core.domain.iot.domain.*;
|
|
|
import com.xunmei.common.core.enums.CategoryDataEnum;
|
|
|
import com.xunmei.common.core.utils.IDHelper;
|
|
|
import com.xunmei.common.redis.utils.RedisUtils;
|
|
|
@@ -29,6 +26,7 @@ import com.xunmei.system.api.enums.DataType;
|
|
|
import com.xunmei.system.api.util.LogUtils;
|
|
|
import com.xunmei.system.api.vo.SysOrgVO;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
@@ -58,6 +56,8 @@ public class IotDvrDiskServiceImpl extends ServiceImpl<IotDvrDiskMapper, IotDvrD
|
|
|
private NorthErrorService northErrorService;
|
|
|
@Autowired
|
|
|
private IIotDeviceService iotDeviceService;
|
|
|
+ @Autowired
|
|
|
+ private IotDvrDiskLogService diskLogService;
|
|
|
|
|
|
|
|
|
@Override
|
|
|
@@ -74,13 +74,15 @@ public class IotDvrDiskServiceImpl extends ServiceImpl<IotDvrDiskMapper, IotDvrD
|
|
|
continue;
|
|
|
}
|
|
|
final Optional<IotDvrDisk> first = list.stream().filter(disk -> ObjectUtil.equal(disk.getDiskIndex(), String.valueOf(index))).findFirst();
|
|
|
- if (first.isPresent()) {
|
|
|
- final IotDvrDisk iotDvrDisk = first.get();
|
|
|
- iotDvrDisk.setState((Integer) map.get("state"));
|
|
|
- iotDvrDisk.setStateUpdateTime(videoRecorderHardDiskDetection.getCheckTime());
|
|
|
- iotDvrDisk.setUpdateTime(LocalDateTime.now());
|
|
|
- diskArrayList.add(iotDvrDisk);
|
|
|
+ if (!first.isPresent()) {
|
|
|
+ LogUtils.STATUS_INFO_DISKS.error("硬盘检测上报消息处理磁盘状态时未找到对应磁盘,主机code:{},磁盘号:{}",equipmentCode,index);
|
|
|
+ continue;
|
|
|
}
|
|
|
+ final IotDvrDisk iotDvrDisk = first.get();
|
|
|
+ iotDvrDisk.setState((Integer) map.get("state"));
|
|
|
+ iotDvrDisk.setStateUpdateTime(videoRecorderHardDiskDetection.getCheckTime());
|
|
|
+ iotDvrDisk.setUpdateTime(LocalDateTime.now());
|
|
|
+ diskArrayList.add(iotDvrDisk);
|
|
|
}
|
|
|
updateBatchById(diskArrayList);
|
|
|
}
|
|
|
@@ -119,6 +121,13 @@ public class IotDvrDiskServiceImpl extends ServiceImpl<IotDvrDiskMapper, IotDvrD
|
|
|
wrapper.in(IotDvrDisk::getOrgId, orgIdLIst);
|
|
|
this.remove(wrapper);
|
|
|
this.saveOrUpdateBatch(dvrdisks);
|
|
|
+ for (IotDvrDisk dvrdisk : dvrdisks) {
|
|
|
+ final IotDvrDiskLog diskLog = new IotDvrDiskLog();
|
|
|
+ BeanUtils.copyProperties(dvrdisk, diskLog, "id");
|
|
|
+ diskLog.setIotDvrDiskId(dvrdisk.getId());
|
|
|
+ diskLogService.save(diskLog);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|