This commit is contained in:
2023-09-21 15:22:08 +08:00
parent 3166a72ab7
commit fc68a73ca7

View File

@@ -1104,67 +1104,6 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
}
}
/**
* 余额支付的订单退款
*/
// private void balancePaymentOrderRefund(OrderBasicInfo orderBasicInfo) {
// // 订单编号
// String orderCode = orderBasicInfo.getOrderCode();
// // 订单消费金额
// BigDecimal orderAmount = orderBasicInfo.getOrderAmount();
// // 查支付记录
// List<OrderPayRecord> payRecordList = orderPayRecordService.getOrderPayRecordList(orderCode);
// // 更新订单支付记录
// List<OrderPayRecord> updatePayRecordList = Lists.newArrayList();
//
// Map<String, OrderPayRecord> payRecordMap = payRecordList.stream()
// .collect(Collectors.toMap(OrderPayRecord::getPayMode, Function.identity(), (k1, k2) -> k1));
// // 取出本金支付金额,赠送支付金额
// BigDecimal principalPay = null;
// BigDecimal giftPay = null;
//
// OrderPayRecord principalPayRecord = payRecordMap.get(Constants.ONE);
// if (principalPayRecord != null) {
// principalPay = principalPayRecord.getPayAmount();
// }
//
// OrderPayRecord giftPayRecord = payRecordMap.get(Constants.TWO);
// if (giftPayRecord != null) {
// giftPay = giftPayRecord.getPayAmount();
// }
//
// Map<String, BigDecimal> returnAmountMap = calculateReturnAmount(principalPay, giftPay, orderAmount);
// logger.info("结算订单:{}, 剩余金额退回余额, 订单消费金额:{}, 本金支付金额:{}, 赠送支付金额:{}, 退回金额map:{}",
// orderCode, orderAmount, principalPay, giftPay, JSONObject.toJSONString(returnAmountMap));
// // 更新会员钱包
// BigDecimal returnPrincipal = returnAmountMap.get("returnPrincipal");
// if (returnPrincipal != null && principalPayRecord != null) {
// principalPayRecord.setRefundAmount(returnPrincipal);
// updatePayRecordList.add(principalPayRecord);
// }
// BigDecimal returnGift = returnAmountMap.get("returnGift");
// if (returnGift != null && giftPayRecord != null) {
// giftPayRecord.setRefundAmount(returnGift);
// updatePayRecordList.add(giftPayRecord);
// // 支付的赠送金额-退回的赠送金额 = 实际使用赠送金额消费的部分
// // virtualAmount = giftPay.subtract(returnGift);
// }
// UpdateMemberBalanceDTO updateMemberBalanceDTO = UpdateMemberBalanceDTO.builder()
// .memberId(orderBasicInfo.getMemberId())
// .type(MemberWalletEnum.TYPE_IN.getValue()) // 进账
// .subType(MemberWalletEnum.SUBTYPE_ORDER_SETTLEMENT_REFUND.getValue()) // 订单结算退款
// .updatePrincipalBalance(returnPrincipal)
// .updateGiftBalance(returnGift)
// .relatedOrderCode(orderCode)
// .build();
// memberBasicInfoService.updateMemberBalance(updateMemberBalanceDTO);
//
// // 更新order_pay_record
// if (CollectionUtils.isNotEmpty(updatePayRecordList)) {
// orderPayRecordService.updateBatch(updatePayRecordList);
// }
// }
@Transactional(rollbackFor = Exception.class)
public void balancePaymentOrderRefundV2(OrderBasicInfo orderBasicInfo) {
// 订单编号