退款 现金退款 会员退款

This commit is contained in:
wangw 2025-02-25 17:39:17 +08:00
parent dc8bf6ed33
commit 7a9742cad9
2 changed files with 23 additions and 3 deletions

View File

@ -46,6 +46,10 @@ public class OrderInfoRefundDTO implements Serializable {
* 如果自定义退款金额 则金额不进行校验 直接退款
*/
private boolean modify;
/**
* 是否是现金退款
*/
private boolean cash;
private String refundReason;

View File

@ -465,9 +465,25 @@ public class PayServiceImpl implements PayService {
if (orderInfo.getRefundAmount().compareTo(orderInfo.getPayAmount()) < 0) {
throw new ValidateException("退单失败,可退金额不足");
}
//退款 param.getRefundAmount()
refundOrder(orderInfo.getShopId(), orderInfo.getId(), orderInfo.getPayOrderId(),
refPayOrderNo, param.getRefundReason(), param.getRefundAmount());
//非现金退款
if(!param.isCash()){
if(orderInfo.getPayType().equals(PayEnums.VIP_PAY.getValue())){
ShopUser shopUser = shopUserService.getShopUserInfo(orderInfo.getShopId(), orderInfo.getUserId());
//会员支付 退钱
ShopUserMoneyEditDTO shopUserMoneyEditDTO = ShopUserMoneyEditDTO.builder()
.id(shopUser.getId())
.money(param.getRefundAmount())
.type(1)
.relationId(orderInfo.getId())
.bizEnum(ShopUserFlowBizEnum.ORDER_REFUND)
.build();
shopUserService.updateMoney(orderInfo.getShopId(),shopUserMoneyEditDTO);
}else {
//退款 param.getRefundAmount()
refundOrder(orderInfo.getShopId(), orderInfo.getId(), orderInfo.getPayOrderId(),
refPayOrderNo, param.getRefundReason(), param.getRefundAmount());
}
}
} else {
if (refundAmountTotal.compareTo(param.getRefundAmount()) != 0) {
throw new ValidateException("退单失败,退款金额不正确");