This commit is contained in:
Lemon
2025-04-11 15:00:19 +08:00
5 changed files with 71 additions and 10 deletions

View File

@@ -818,4 +818,21 @@ public class TempController extends BaseController {
}
return response;
}
/**
* 重试分账接口
* http://localhost:8080/temp/retryOrderSplit
*/
@PostMapping("/retryOrderSplit")
public RestApiResponse<?> retryOrderSplit(@RequestBody QueryOrderDTO dto) {
RestApiResponse<?> response;
try {
tempService.retrySplittingMethod(dto.getOrderCode());
response = new RestApiResponse<>();
} catch (Exception e) {
logger.error("重试分账接口error,", e);
response = new RestApiResponse<>(e);
}
return response;
}
}

View File

@@ -998,5 +998,41 @@ public class TempService {
programLogic.settleOrder(data, orderBasicInfo);
}
}
/**
* 重试分账逻辑
* 用于订单金额都已经计算好, 但是没有分账, 用来重新执行分账
*/
public void retrySplittingMethod(String orderCode) {
if (StringUtils.isBlank(orderCode)) {
return;
}
// 查询数据
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
if (orderBasicInfo == null) {
return;
}
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode);
if (orderDetail == null) {
return;
}
// 组装请求dto 组装after参数
AfterSettleOrderDTO afterSettleOrderDTO = AfterSettleOrderDTO.builder()
.orderCode(orderBasicInfo.getOrderCode())
.merchantId(orderBasicInfo.getMerchantId())
.stationId(orderBasicInfo.getStationId())
.orderPayAmount(orderBasicInfo.getPayAmount()) // 支付金额
.orderConsumeAmount(orderBasicInfo.getOrderAmount()) // 消费金额
.orderSettleAmount(orderBasicInfo.getSettleAmount()) // 结算金额
.orderElectricityAmount(orderDetail.getTotalElectricityAmount()) // 电费金额
.orderElectricityDiscountAmount(orderDetail.getDiscountElectricityAmount()) // 电费折扣金额
.orderServiceAmount(orderDetail.getTotalServiceAmount()) // 服务费金额
.orderServiceDiscountAmount(orderDetail.getDiscountServiceAmount()) // 服务费折扣金额
.orderRefundAmount(orderBasicInfo.getRefundAmount()) // 退款金额
.build();
logger.info("retrySplittingMethod, afterSettleOrderDTO:{}", JSON.toJSONString(afterSettleOrderDTO));
orderBasicInfoService.splittingMethod(afterSettleOrderDTO);
}
}

View File

@@ -1,7 +1,9 @@
002212024102416494410695447094223949824
002212024102419522510695493069857738752
002212024102423461110695551898497138688
002212024102508132610695679550910730240
002212024102508310310695683984625319936
002212024102508502610695688864317952000
002212024102513440210695762749414916096
002212025020412234910732706124918857728
002212025021320221410736088013681041408
002212025021418121210736417676767436800
002212025021710584010737395738021330944
002212025021915430610738192095246381056
002212025021917253410738217882149285888
002212025022414130110739981362939670528
002212025022712121610741038139879292928
002212025022814322610741435803697991680