fix: refund bug

This commit is contained in:
hucs
2025-05-12 11:22:26 +08:00
parent 3d0a8493c5
commit e60929bf57

View File

@@ -3,6 +3,8 @@ package com.starry.admin.modules.order.controller;
import com.starry.admin.common.exception.CustomException; import com.starry.admin.common.exception.CustomException;
import com.starry.admin.modules.clerk.module.entity.PlayClerkUserInfoEntity; import com.starry.admin.modules.clerk.module.entity.PlayClerkUserInfoEntity;
import com.starry.admin.modules.clerk.service.IPlayClerkUserInfoService; import com.starry.admin.modules.clerk.service.IPlayClerkUserInfoService;
import com.starry.admin.modules.custom.module.entity.PlayCustomUserInfoEntity;
import com.starry.admin.modules.custom.service.IPlayCustomUserInfoService;
import com.starry.admin.modules.order.module.entity.PlayOrderInfoEntity; import com.starry.admin.modules.order.module.entity.PlayOrderInfoEntity;
import com.starry.admin.modules.order.module.vo.*; import com.starry.admin.modules.order.module.vo.*;
import com.starry.admin.modules.order.service.IPlayOrderInfoService; import com.starry.admin.modules.order.service.IPlayOrderInfoService;
@@ -45,6 +47,8 @@ public class PlayOrderInfoController {
@Resource @Resource
private IPlayOrderRefundInfoService playOrderRefundInfoService; private IPlayOrderRefundInfoService playOrderRefundInfoService;
@Resource
private IPlayCustomUserInfoService customUserInfoService;
/** /**
@@ -86,6 +90,9 @@ public class PlayOrderInfoController {
// 记录退款信息 // 记录退款信息
String refundType = orderInfo.getFinalAmount().compareTo(vo.getRefundAmount()) == 0 ? "0" : "1"; String refundType = orderInfo.getFinalAmount().compareTo(vo.getRefundAmount()) == 0 ? "0" : "1";
PlayCustomUserInfoEntity customUserInfo = customUserInfoService.getById(orderInfo.getPurchaserBy());
customUserInfoService.updateAccountBalanceById(customUserInfo.getId(), customUserInfo.getAccountBalance(), customUserInfo.getAccountBalance().add(orderInfo.getOrderMoney()), "3", "订单退款", orderInfo.getOrderMoney(), BigDecimal.ZERO, vo.getOrderId());
playOrderRefundInfoService.add(orderInfo.getId(), orderInfo.getPurchaserBy(), orderInfo.getAcceptBy(), orderInfo.getPayMethod(), refundType, vo.getRefundAmount(), vo.getRefundReason(), "2", SecurityUtils.getUserId(), "0", "0"); playOrderRefundInfoService.add(orderInfo.getId(), orderInfo.getPurchaserBy(), orderInfo.getAcceptBy(), orderInfo.getPayMethod(), refundType, vo.getRefundAmount(), vo.getRefundReason(), "2", SecurityUtils.getUserId(), "0", "0");
return R.ok("退款成功"); return R.ok("退款成功");
} }