diff --git a/smart-switch-service/src/main/java/com/ruoyi/iot/service/impl/IotConverterImpl.java b/smart-switch-service/src/main/java/com/ruoyi/iot/service/impl/IotConverterImpl.java index bf9d04ab..bcc2a0c6 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/iot/service/impl/IotConverterImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/iot/service/impl/IotConverterImpl.java @@ -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)); diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/device/domain/enums/DeviceOutageWay.java b/smart-switch-service/src/main/java/com/ruoyi/ss/device/domain/enums/DeviceOutageWay.java index 60c0501c..2721b8b4 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/device/domain/enums/DeviceOutageWay.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/device/domain/enums/DeviceOutageWay.java @@ -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; } } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceServiceImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceServiceImpl.java index adb8bb80..37252add 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceServiceImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceServiceImpl.java @@ -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(), "设备监控-同步时长"); }