This commit is contained in:
磷叶 2025-01-08 15:11:14 +08:00
parent 285a844fe8
commit feeb63fed0
3 changed files with 8 additions and 7 deletions

View File

@ -7,12 +7,14 @@ import com.ruoyi.iot.domain.CurrentDatastream;
import com.ruoyi.iot.domain.CurrentDeviceData;
import com.ruoyi.iot.domain.IotDeviceInfo;
import com.ruoyi.iot.service.IotConverter;
import com.ruoyi.ss.device.domain.enums.DeviceOutageWay;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
/**
* @author wjh
@ -83,8 +85,7 @@ public class IotConverterImpl implements IotConverter {
device.setM(NumberUtils.nonNullDecimal(value).divide(new BigDecimal(1000), 2, RoundingMode.HALF_UP));
break;
case ReceiveConstants.DS_SET:
DeviceOutageWay deviceOutageWay = DeviceOutageWay.parse(value);
device.setSet(deviceOutageWay.getValue());
device.setSet(value);
break;
case ReceiveConstants.DS_TIME:
device.setTime(NumberUtils.nonNullDecimal(value));

View File

@ -6,7 +6,7 @@ import lombok.Getter;
import java.util.Objects;
/**
* 断电方式
* 开关SET
* @author wjh
* 2024/3/22
*/
@ -26,7 +26,7 @@ public enum DeviceOutageWay {
return obj;
}
}
throw new RuntimeException("不存在值为" + value + "的断电方式");
return null;
}
}

View File

@ -1351,7 +1351,7 @@ public class DeviceServiceImpl implements DeviceService
// 一般情况下物联网设备的值会大于或等于当前数据库的值
// 恢复时长数据库时长大于0时且当前设备时长小于数据库时长
long deviceSeconds = device.getRemainTime() == null ? 0 : device.getRemainTime().longValue();
if (deviceSeconds > 0 && device.getSurplusSecondsDb() > deviceSeconds) {
if (device.getSurplusSecondsDb() > 0 && device.getSurplusSecondsDb() > deviceSeconds) {
this.syncTime(device.getDeviceId(), LocalDateTime.now(), "设备监控-同步时长");
}