From b1fb83530b7105e4aa73e4101727dea945eb01c2 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期五, 29 八月 2025 21:48:15 +0800
Subject: [PATCH] bug修改

---
 cloud-server-account/src/main/java/com/dsh/account/controller/FinanceController.java |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/cloud-server-account/src/main/java/com/dsh/account/controller/FinanceController.java b/cloud-server-account/src/main/java/com/dsh/account/controller/FinanceController.java
index 32da855..bf0e37a 100644
--- a/cloud-server-account/src/main/java/com/dsh/account/controller/FinanceController.java
+++ b/cloud-server-account/src/main/java/com/dsh/account/controller/FinanceController.java
@@ -6,6 +6,7 @@
 import com.dsh.account.entity.RechargeRecords;
 import com.dsh.account.entity.TAppUser;
 import com.dsh.account.entity.VipPayment;
+import com.dsh.account.feignclient.activity.UserConponClient;
 import com.dsh.account.model.IncomeQuery;
 import com.dsh.account.model.dto.VipPaymentDto;
 import com.dsh.account.model.dto.VipRefundDto;
@@ -38,6 +39,8 @@
     private IVipPaymentService vipPaymentService;
     @Autowired
     private TAppUserService appUserService;
+    @Autowired
+    private UserConponClient userConponClient;
 
 
     /**
@@ -105,9 +108,12 @@
         if (parse.before(new Date())){
             appUser.setIsVip(0);
         }
+        vipPayment.setRemark(vipRefundDto.getRemark());
         appUserService.updateById(appUser);
-        vipPayment.setState(3);
+        vipPayment.setPayStatus(3);
         vipPaymentService.updateById(vipPayment);
+        // 将未使用的门票优惠券设置为已过期
+        userConponClient.setStatusVipDetail(vipPayment.getId());
         return "200";
     }
 
@@ -117,16 +123,24 @@
         List<VipPaymentListVO> vipPaymentListVOS = new ArrayList<>();
 
         List<Integer> payStatus = new ArrayList<>();
-        payStatus.add(2);
         LambdaQueryWrapper<VipPayment> vipPaymentLambdaQueryWrapper = new LambdaQueryWrapper<>();
         vipPaymentLambdaQueryWrapper.in(vipPaymentDto.getUserIds()!=null&&!vipPaymentDto.getUserIds().isEmpty(),VipPayment::getAppUserId, vipPaymentDto.getUserIds());
         vipPaymentLambdaQueryWrapper.in(vipPaymentDto.getVipIds()!=null&&!vipPaymentDto.getVipIds().isEmpty(),VipPayment::getVipId, vipPaymentDto.getVipIds());
-        vipPaymentLambdaQueryWrapper.in(VipPayment::getPayStatus,payStatus);
         vipPaymentLambdaQueryWrapper.ge(StringUtils.hasLength(vipPaymentDto.getStartTime()), VipPayment::getInsertTime, vipPaymentDto.getStartTime());
         vipPaymentLambdaQueryWrapper.le(StringUtils.hasLength(vipPaymentDto.getEndTime()), VipPayment::getInsertTime, vipPaymentDto.getEndTime());
+        if (vipPaymentDto.getIsRefund()==null){
+            payStatus.add(3);
+            payStatus.add(2);
+        }
         if (vipPaymentDto.getIsRefund()!=null&&vipPaymentDto.getIsRefund()==1){
             payStatus.add(3);
         }
+        if (vipPaymentDto.getIsRefund()!=null&&vipPaymentDto.getIsRefund()==2){
+            payStatus.add(2);
+        }
+        vipPaymentLambdaQueryWrapper.in(VipPayment::getPayStatus,payStatus);
+
+        vipPaymentLambdaQueryWrapper.orderByDesc(VipPayment::getInsertTime);
         List<VipPayment> list = vipPaymentService.list(vipPaymentLambdaQueryWrapper);
         // 使用 Stream + 手动拷贝提升性能和可读性(或使用 MapStruct)
         vipPaymentListVOS = list.stream().map(vipDetail -> {

--
Gitblit v1.7.1