debug:电量变化记录错误

This commit is contained in:
磷叶 2024-10-17 10:31:45 +08:00
parent f7fa804b07
commit 2f03f23288

View File

@ -1222,31 +1222,31 @@ public class TransactionBillServiceImpl implements TransactionBillService, After
ServiceUtil.assertion(refund != 1, "申请退款失败");
}, 0, TimeUnit.SECONDS);
}
}
// 清零设备
try {
transactionTemplate.execute(status -> {
// 记录设备关闭状态成功
int update = this.updateCloseStatus(order.getBillId(), RechargeCloseStatus.SUCCESS, "成功");
ServiceUtil.assertion(update != 1, "更新设备关闭状态失败");
// 清零设备
try {
transactionTemplate.execute(status -> {
// 记录设备关闭状态成功
int update = this.updateCloseStatus(order.getBillId(), RechargeCloseStatus.SUCCESS, "成功");
ServiceUtil.assertion(update != 1, "更新设备关闭状态失败");
// 尝试设备清零时长电量
if (withDevice) {
if (SuitFeeType.TIME.getType().equals(order.getSuitFeeType())) {
deviceService.resetTime(device, true);
} else if (SuitFeeType.COUNT.getType().equals(order.getSuitFeeType())) {
deviceService.resetEle(device, true);
// 尝试设备清零时长电量
if (withDevice) {
if (SuitFeeType.TIME.getType().equals(order.getSuitFeeType())) {
deviceService.resetTime(device, true);
} else if (SuitFeeType.COUNT.getType().equals(order.getSuitFeeType())) {
deviceService.resetEle(device, true);
}
}
}
return update;
});
} catch (Exception e) {
log.warn("设备归零失败: {}", e.getMessage());
// 记录设备关闭状态
this.updateCloseStatus(order.getBillId(), RechargeCloseStatus.FAIL, e.getMessage());
return EndUseVO.toResult(result, false, e.getMessage());
return update;
});
} catch (Exception e) {
log.warn("设备归零失败: {}", e.getMessage());
// 记录设备关闭状态
this.updateCloseStatus(order.getBillId(), RechargeCloseStatus.FAIL, e.getMessage());
return EndUseVO.toResult(result, false, e.getMessage());
}
}
return EndUseVO.toResult(result, true, null);