|
|
@@ -90,6 +90,8 @@ public class WxPayServiceImpl implements WxPayService {
|
|
|
private final StationAccountService stationAccountService;
|
|
|
private final SplitRecordService splitRecordService;
|
|
|
|
|
|
+ private final WashOrderService washOrderService;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 微信支付专用,支持自动签名验签解密等
|
|
|
@@ -101,7 +103,7 @@ public class WxPayServiceImpl implements WxPayService {
|
|
|
PayLogService payLogService, AccountService accountService,
|
|
|
RefundLogService refundLogService,
|
|
|
ActivityService activityService, UserRechargeRightsService userRechargeRightsService,
|
|
|
- RechargeConfigService rechargeConfigService, StationAccountService stationAccountService, SplitRecordService splitRecordService) {
|
|
|
+ RechargeConfigService rechargeConfigService, StationAccountService stationAccountService, SplitRecordService splitRecordService, WashOrderService washOrderService) {
|
|
|
this.conf = conf;
|
|
|
this.walletDetailService = walletDetailService;
|
|
|
this.payLogService = payLogService;
|
|
|
@@ -112,6 +114,7 @@ public class WxPayServiceImpl implements WxPayService {
|
|
|
this.rechargeConfigService = rechargeConfigService;
|
|
|
this.stationAccountService = stationAccountService;
|
|
|
this.splitRecordService = splitRecordService;
|
|
|
+ this.washOrderService = washOrderService;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -388,12 +391,12 @@ public class WxPayServiceImpl implements WxPayService {
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void applyWxRefund(String reason) {
|
|
|
var userId = StpUtil.getLoginIdAsLong();
|
|
|
-// var chargeOrder = chargeOrderService.getChargingOrderByUserId(userId);
|
|
|
-// if (chargeOrder != null) {
|
|
|
-// throw new BusinessException("存在未完结的订单,请等待所有订单完结之后重试");
|
|
|
-// }
|
|
|
- // todo 洗车未完结订单校验
|
|
|
-
|
|
|
+ var washOrder = washOrderService.getOrderInProgressByUserId(userId);
|
|
|
+ // 洗车未完结订单校验
|
|
|
+ if (washOrder != null) {
|
|
|
+ throw new BusinessException("存在未完结的订单,请完成所有订单完结之后重试");
|
|
|
+ }
|
|
|
+
|
|
|
var account = accountService.getAccountByUserId(userId);
|
|
|
if (account.getBalance() <= 0) {
|
|
|
throw new BusinessException("账户余额不足,无需退款");
|