debug:归零时,修改订单状态失败

This commit is contained in:
墨大叔 2024-09-18 09:33:05 +08:00
parent a18692a66b
commit 156e36c26d
2 changed files with 32 additions and 32 deletions

View File

@ -519,25 +519,25 @@ public class DeviceServiceImpl implements DeviceService
DeviceVO device = selectSmDeviceByDeviceId(deviceId);
ServiceUtil.assertion(device == null, "设备不存在");
Integer result = transactionTemplate.execute(status -> {
// 关闭该设备未结束的所有订单
TransactionBillQuery query = new TransactionBillQuery();
query.setStatusList(TransactionBillStatus.canClose());
query.setDeviceId(device.getDeviceId());
query.setIsFinished(false); // 未结束的订单都会被关闭
query.setSuitFeeTypes(SuitFeeType.rechargeCountList());
List<TransactionBillVO> billList = transactionBillService.selectSmTransactionBillList(query);
// 尝试关闭该设备未结束的所有订单
TransactionBillQuery query = new TransactionBillQuery();
query.setStatusList(TransactionBillStatus.canClose());
query.setDeviceId(device.getDeviceId());
query.setIsFinished(false); // 未结束的订单都会被关闭
query.setSuitFeeTypes(SuitFeeType.rechargeCountList());
List<TransactionBillVO> billList = transactionBillService.selectSmTransactionBillList(query);
try {
int closeCount = transactionBillService.batchCloseBillByDevice(billList, false, device);
ServiceUtil.assertion(closeCount != billList.size(), "关闭订单失败");
ServiceUtil.assertion(closeCount != billList.size(), "关闭订单失败:closeCount =" + closeCount);
} catch (Exception e) {
log.error("关闭订单失败:{}" , e.getMessage());
}
// 发送命令
int reset = this.resetEle(device, true);
ServiceUtil.assertion(reset != 1, "设备电量归零失败");
// 发送命令
int reset = this.resetEle(device, true);
ServiceUtil.assertion(reset != 1, "设备电量归零失败");
return reset;
});
return result == null ? 0 : result;
return reset;
}
@ -856,23 +856,23 @@ public class DeviceServiceImpl implements DeviceService
ServiceUtil.assertion(device == null || device.getDeleted(), "设备不存在");
ServiceUtil.assertion(!UserUtil.hasFrontUser(device.getUserId()), "您不是该设备的商户,无法进行该操作");
transactionTemplate.execute(status -> {
// 关闭该设备未结束的所有订单
TransactionBillQuery query = new TransactionBillQuery();
query.setStatusList(TransactionBillStatus.canClose());
query.setDeviceId(device.getDeviceId());
query.setIsFinished(false); // 未结束的订单都会被关闭
query.setSuitFeeTypes(SuitFeeType.rechargeTimeList());
List<TransactionBillVO> billList = transactionBillService.selectSmTransactionBillList(query);
// 尝试关闭该设备未结束的所有订单
TransactionBillQuery query = new TransactionBillQuery();
query.setStatusList(TransactionBillStatus.canClose());
query.setDeviceId(device.getDeviceId());
query.setIsFinished(false); // 未结束的订单都会被关闭
query.setSuitFeeTypes(SuitFeeType.rechargeTimeList());
List<TransactionBillVO> billList = transactionBillService.selectSmTransactionBillList(query);
try {
int closeCount = transactionBillService.batchCloseBillByDevice(billList, false, device);
ServiceUtil.assertion(closeCount != billList.size(), "关闭订单失败");
ServiceUtil.assertion(closeCount != billList.size(), "关闭订单失败:closeCount =" + closeCount);
} catch (Exception e) {
log.error("关闭订单失败: {}", e.getMessage());
}
// 发送命令
int reset = this.resetTime(device, true);
ServiceUtil.assertion(reset != 1, "归零失败");
return reset;
});
// 发送命令
int reset = this.resetTime(device, true);
ServiceUtil.assertion(reset != 1, "归零失败");
return true;
}

View File

@ -1537,7 +1537,7 @@ public class TransactionBillServiceImpl implements TransactionBillService, After
for (TransactionBillVO bill : billList) {
bo.setOrder(bill);
int end = this.endUse(bo, withDevice);
ServiceUtil.assertion(end != 1, "关闭订单失败");
ServiceUtil.assertion(end != 1, "关闭订单失败:" + bill.getBillNo());
sum += end;
}