debug:设备归零后,电量未归零
This commit is contained in:
parent
66565eda94
commit
02be2303ca
|
@ -473,7 +473,7 @@ public class DeviceServiceImpl implements DeviceService
|
||||||
|
|
||||||
Integer result = transactionTemplate.execute(status -> {
|
Integer result = transactionTemplate.execute(status -> {
|
||||||
// 更新剩余电量
|
// 更新剩余电量
|
||||||
int update = this.resetUpdateDbEle(device.getDeviceId());
|
int update = this.resetUpdateDbEle(device.getDeviceId(), device.getTotalElectriQuantity());
|
||||||
ServiceUtil.assertion(update != 1, "更新剩余电量失败");
|
ServiceUtil.assertion(update != 1, "更新剩余电量失败");
|
||||||
|
|
||||||
// 直接设置电量为0
|
// 直接设置电量为0
|
||||||
|
@ -518,10 +518,11 @@ public class DeviceServiceImpl implements DeviceService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int resetUpdateDbEle(Long deviceId) {
|
private int resetUpdateDbEle(Long deviceId, BigDecimal expireEle) {
|
||||||
Device data = new Device();
|
Device data = new Device();
|
||||||
data.setDeviceId(deviceId);
|
data.setDeviceId(deviceId);
|
||||||
data.setSurplusEle(BigDecimal.ZERO);
|
data.setSurplusEle(BigDecimal.ZERO);
|
||||||
|
data.setExpireEle(expireEle);
|
||||||
return deviceMapper.updateSmDevice(data);
|
return deviceMapper.updateSmDevice(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -529,6 +530,7 @@ public class DeviceServiceImpl implements DeviceService
|
||||||
public int resetEle(Long deviceId, boolean required) {
|
public int resetEle(Long deviceId, boolean required) {
|
||||||
// 获取设备信息
|
// 获取设备信息
|
||||||
DeviceVO device = selectById(deviceId);
|
DeviceVO device = selectById(deviceId);
|
||||||
|
this.pullDeviceInfo(device);
|
||||||
return resetEle(device, required);
|
return resetEle(device, required);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -570,9 +572,9 @@ public class DeviceServiceImpl implements DeviceService
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// 拉取设备信息
|
// 拉取设备信息
|
||||||
pullDeviceInfo(deviceId);
|
|
||||||
|
|
||||||
DeviceVO device = selectById(deviceId);
|
DeviceVO device = selectById(deviceId);
|
||||||
|
pullDeviceInfo(device);
|
||||||
ServiceUtil.assertion(device == null, "设备不存在");
|
ServiceUtil.assertion(device == null, "设备不存在");
|
||||||
|
|
||||||
// 尝试关闭该设备未结束的所有订单
|
// 尝试关闭该设备未结束的所有订单
|
||||||
|
@ -1259,12 +1261,10 @@ public class DeviceServiceImpl implements DeviceService
|
||||||
// 修改设备信息
|
// 修改设备信息
|
||||||
int timeUpdate = this.resetUpdateDbTime(deviceId);
|
int timeUpdate = this.resetUpdateDbTime(deviceId);
|
||||||
ServiceUtil.assertion(timeUpdate != 1, "修改设备时间失败");
|
ServiceUtil.assertion(timeUpdate != 1, "修改设备时间失败");
|
||||||
int eleUpdate = this.resetUpdateDbEle(deviceId);
|
int eleUpdate = this.resetUpdateDbEle(deviceId, device.getTotalElectriQuantity());
|
||||||
ServiceUtil.assertion(eleUpdate != 1, "修改设备电量失败");
|
ServiceUtil.assertion(eleUpdate != 1, "修改设备电量失败");
|
||||||
|
|
||||||
// 发送命令
|
// 发送命令
|
||||||
// int reset = iotService.setTimeAndEle(device, 0L, BigDecimal.ZERO);
|
|
||||||
// ServiceUtil.assertion(reset != 1, "归零失败");
|
|
||||||
CommandResponse res1 = iotService.setTime(device, 0L);
|
CommandResponse res1 = iotService.setTime(device, 0L);
|
||||||
ServiceUtil.assertion(!res1.isSuccess(), "设备时长归零失败:" + res1.getMsg());
|
ServiceUtil.assertion(!res1.isSuccess(), "设备时长归零失败:" + res1.getMsg());
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -195,8 +195,9 @@ public class TransactionBillConverterImpl implements TransactionBillConverter {
|
||||||
bo.setOrder(order);
|
bo.setOrder(order);
|
||||||
bo.setTotalEle(dto.getTotalEle());
|
bo.setTotalEle(dto.getTotalEle());
|
||||||
if (order != null) {
|
if (order != null) {
|
||||||
deviceService.pullDeviceInfo(order.getDeviceId());
|
DeviceVO device = deviceService.selectById(order.getDeviceId());
|
||||||
bo.setDevice(deviceService.selectById(order.getDeviceId()));
|
deviceService.pullDeviceInfo(device);
|
||||||
|
bo.setDevice(device);
|
||||||
}
|
}
|
||||||
return bo;
|
return bo;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user