diff --git a/smart-switch-service/src/main/java/com/ruoyi/iot/constants/ReceiveConstants.java b/smart-switch-service/src/main/java/com/ruoyi/iot/constants/ReceiveConstants.java index 6b556ccc..0e2ad21c 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/iot/constants/ReceiveConstants.java +++ b/smart-switch-service/src/main/java/com/ruoyi/iot/constants/ReceiveConstants.java @@ -32,4 +32,7 @@ public class ReceiveConstants { // 数据点ID:CSQ public static final String DS_CSQ = "CSQ"; + + // 数据点ID:VER 版本号 + public static final String DS_VER = "VER"; } diff --git a/smart-switch-service/src/main/java/com/ruoyi/iot/domain/IotDeviceInfo.java b/smart-switch-service/src/main/java/com/ruoyi/iot/domain/IotDeviceInfo.java index 966c2b0b..c44f2477 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/iot/domain/IotDeviceInfo.java +++ b/smart-switch-service/src/main/java/com/ruoyi/iot/domain/IotDeviceInfo.java @@ -29,6 +29,7 @@ public class IotDeviceInfo { private BigDecimal time; // 剩余时间(秒) private String model; // 型号 private String wifi; // WIFI + private String version; // 版本号 public static IotDeviceInfo newDefaultInstance() { return IotDeviceInfo.builder() @@ -41,6 +42,7 @@ public class IotDeviceInfo { .set(DeviceOutageWay.IMMEDIATE.getValue()) .time(BigDecimal.ZERO) .model(null) + .version(null) .build(); } 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 c28da10e..e438cd55 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 @@ -94,6 +94,9 @@ public class IotConverterImpl implements IotConverter { case ReceiveConstants.DS_SSID: device.setWifi(value); break; + case ReceiveConstants.DS_VER: + device.setVersion(value); + break; default: break; } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/device/domain/Device.java b/smart-switch-service/src/main/java/com/ruoyi/ss/device/domain/Device.java index ee0a776b..ea95aaff 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/device/domain/Device.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/device/domain/Device.java @@ -242,4 +242,8 @@ public class Device extends BaseEntity @ApiModelProperty("月费") @Min(value = 0, message = "月费不允许小于0") private BigDecimal monthFee; + + @Excel(name = "设备版本号") + @ApiModelProperty("设备版本号") + private String version; } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/device/domain/DeviceQuery.java b/smart-switch-service/src/main/java/com/ruoyi/ss/device/domain/DeviceQuery.java index b01112ed..cb7ce843 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/device/domain/DeviceQuery.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/device/domain/DeviceQuery.java @@ -82,4 +82,7 @@ public class DeviceQuery extends Device { @ApiModelProperty("代理名称") private String agentName; + + @ApiModelProperty("设备版本号") + private String version; } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/device/mapper/DeviceMapper.xml b/smart-switch-service/src/main/java/com/ruoyi/ss/device/mapper/DeviceMapper.xml index 733d9cce..6f408462 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/device/mapper/DeviceMapper.xml +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/device/mapper/DeviceMapper.xml @@ -42,7 +42,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and sd.lock_user_id = #{lockUserId} and agent_id = #{agentId} and sua.user_name like concat('%', #{agentName}, '%') - and service_mode = #{serviceMode} + and sd.service_mode = #{serviceMode} + and sd.version like concat('%', #{version}, '%') and (sd.rent_time is null or sd.rent_time <= now()) @@ -152,6 +153,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" sd.service_mode, sd.month_fee, sd.last_recover_time, + sd.version, sm.model_name as model, sm.picture as picture, sm.tags as model_tags, @@ -354,6 +356,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" last_recover_time, online_status1, online_status2, + version, #{storeId}, @@ -405,6 +408,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{lastRecoverTime}, #{onlineStatus1}, #{onlineStatus2}, + #{version}, @@ -477,6 +481,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" last_recover_time = #{lastRecoverTime}, online_status1 = #{onlineStatus1}, online_status2 = #{onlineStatus2}, + version = #{version}, where device_id = #{deviceId} 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 0eaa4624..672b58a3 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 @@ -1009,6 +1009,7 @@ public class DeviceServiceImpl implements DeviceService device.setRealTimePower(deviceInfo.getP()); device.setVoltage(deviceInfo.getV()); device.setElectricity(deviceInfo.getA()); + device.setVersion(deviceInfo.getVersion()); // 总用电量 if (deviceInfo.getW() != null) { diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillServiceImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillServiceImpl.java index d866993d..1a8ef528 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillServiceImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillServiceImpl.java @@ -1124,9 +1124,9 @@ public class TransactionBillServiceImpl implements TransactionBillService, After if (withDevice) { if (SuitFeeType.TIMING_COUNT.getType().equals(order.getSuitFeeType())) { - deviceService.resetEle(device, true); + deviceService.resetEle(device, false); } else if(SuitFeeType.TIMING_TIME.getType().equals(order.getSuitFeeType())){ - deviceService.resetTime(device, true); + deviceService.resetTime(device, false); } iotService.close(device); } @@ -1233,9 +1233,9 @@ public class TransactionBillServiceImpl implements TransactionBillService, After // 尝试设备清零时长、电量 if (withDevice) { if (SuitFeeType.TIME.getType().equals(order.getSuitFeeType())) { - deviceService.resetTime(device, true); + deviceService.resetTime(device, false); } else if (SuitFeeType.COUNT.getType().equals(order.getSuitFeeType())) { - deviceService.resetEle(device, true); + deviceService.resetEle(device, false); } }