|
|
@@ -7,7 +7,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.xunmei.common.core.constant.CacheConstants;
|
|
|
-import com.xunmei.common.core.domain.R;
|
|
|
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.IotDvrDiskLog;
|
|
|
@@ -23,7 +22,6 @@ import com.xunmei.mediator.api.video.service.IotDvrDiskLogService;
|
|
|
import com.xunmei.mediator.api.video.service.IotDvrDiskService;
|
|
|
import com.xunmei.mediator.util.CheckDataUtil;
|
|
|
import com.xunmei.mediator.util.RedisCheckRepeatDataUtil;
|
|
|
-import com.xunmei.system.api.domain.iot.IotDeviceInfo;
|
|
|
import com.xunmei.system.api.domain.north.NorthError;
|
|
|
import com.xunmei.system.api.dto.DataPageDto;
|
|
|
import com.xunmei.system.api.dto.DvrDiskPageDto;
|
|
|
@@ -37,6 +35,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.math.RoundingMode;
|
|
|
import java.time.Duration;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.*;
|
|
|
@@ -76,7 +76,7 @@ public class IotDvrDiskServiceImpl extends ServiceImpl<IotDvrDiskMapper, IotDvrD
|
|
|
final List<Map> mapList = JSON.parseArray(detailInfo, Map.class);
|
|
|
List<IotDvrDisk> diskArrayList = new ArrayList<>();
|
|
|
for (Map map : mapList) {
|
|
|
- final Integer index = (Integer) map.get("diskSerialNum");
|
|
|
+ final String index = (String) map.get("diskSerialNum");
|
|
|
if (ObjectUtil.isNull(index)) {
|
|
|
continue;
|
|
|
}
|
|
|
@@ -88,14 +88,14 @@ public class IotDvrDiskServiceImpl extends ServiceImpl<IotDvrDiskMapper, IotDvrD
|
|
|
final IotDvrDisk iotDvrDisk = first.get();
|
|
|
iotDvrDisk.setState((Integer) map.get("state"));
|
|
|
iotDvrDisk.setDiskName((String) map.get("name"));
|
|
|
- Integer totalBytes = (Integer) map.get("totalBytes");
|
|
|
+ Long totalBytes = (Long) map.get("totalBytes");
|
|
|
Integer availableBytes = (Integer) map.get("availableBytes");
|
|
|
Integer originState = (Integer) map.get("originState");
|
|
|
//Integer freeBytes = (Integer) map.get("freeBytes");
|
|
|
|
|
|
iotDvrDisk.setOriginState(originState);
|
|
|
- iotDvrDisk.setAvailable(availableBytes/1024/1024);
|
|
|
- iotDvrDisk.setTotal(totalBytes/1024/1024);
|
|
|
+ iotDvrDisk.setAvailable(new BigDecimal(availableBytes).divide(BigDecimal.valueOf(1024 * 1024), 2, RoundingMode.HALF_UP).intValue());
|
|
|
+ iotDvrDisk.setTotal(new BigDecimal(totalBytes).divide(BigDecimal.valueOf(1024 * 1024), 2, RoundingMode.HALF_UP).intValue());
|
|
|
iotDvrDisk.setStateUpdateTime(videoRecorderHardDiskDetection.getCheckTime());
|
|
|
iotDvrDisk.setUpdateTime(LocalDateTime.now());
|
|
|
diskArrayList.add(iotDvrDisk);
|