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-activity/src/main/java/com/dsh/activity/controller/CouponController.java |   34 ++++++++++++++++++++++++++++++++--
 1 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/cloud-server-activity/src/main/java/com/dsh/activity/controller/CouponController.java b/cloud-server-activity/src/main/java/com/dsh/activity/controller/CouponController.java
index e894f41..f1ae239 100644
--- a/cloud-server-activity/src/main/java/com/dsh/activity/controller/CouponController.java
+++ b/cloud-server-activity/src/main/java/com/dsh/activity/controller/CouponController.java
@@ -125,12 +125,15 @@
                 .le(StringUtils.hasLength(vipDetailDto.getUseEndTime()), VipDetail::getUseTime, vipDetailDto.getUseEndTime())
                 .eq(vipDetailDto.getOperatorId() != null, VipDetail::getOperatorId, vipDetailDto.getOperatorId())
                 .eq(vipDetailDto.getType() != null, VipDetail::getType, vipDetailDto.getType())
-                .eq(vipDetailDto.getStatus() != null, VipDetail::getStatus, vipDetailDto.getStatus()).list();
+                .eq(vipDetailDto.getStatus() != null, VipDetail::getStatus, vipDetailDto.getStatus())
+                .orderByDesc(VipDetail::getInsertTime)
+                .list();
+
 
         // 使用 Stream + 手动拷贝提升性能和可读性(或使用 MapStruct)
         vipDetailVOS = list.stream().map(vipDetail -> {
             VipDetailVO vo = new VipDetailVO();
-            BeanUtils.copyProperties(vo, vipDetail); // 注意参数顺序是否正确
+            BeanUtils.copyProperties(vipDetail, vo); // 注意参数顺序是否正确
             return vo;
         }).collect(Collectors.toList());
         List<Coupon> coupons = couponService.list();
@@ -947,5 +950,32 @@
     @PostMapping("/base/coupon/updateType")
     public void updateType(@RequestBody Long id) {
         couponService.updateType(id);
+        UserCoupon userCoupon = userCouponService.getById(id);
+        if (userCoupon.getIsVipGrant()!=null&& userCoupon.getIsVipGrant()==1){
+            VipDetail vipDetailServiceById = vipDetailService.getById(userCoupon.getVipDetailId());
+            vipDetailServiceById.setUseTime(new Date());
+            vipDetailServiceById.setStatus(2);
+            vipDetailServiceById.setOperatorId(0);
+            vipDetailService.updateById(vipDetailServiceById);
+        }
+
+    }
+    @GetMapping("/base/coupon/updateTypeOther/{id}/{operatorId}/{storeId}/{siteId}")
+    void updateTypeOther(@PathVariable("id")Long id,@PathVariable("operatorId")Integer operatorId,
+                         @PathVariable("storeId")Integer storeId,@PathVariable("siteId")Integer siteId){
+        couponService.updateType(id);
+        UserCoupon userCoupon = userCouponService.getById(id);
+        if (userCoupon.getIsVipGrant()!=null&& userCoupon.getIsVipGrant()==1){
+            VipDetail vipDetailServiceById = vipDetailService.getById(userCoupon.getVipDetailId());
+            vipDetailServiceById.setUseTime(new Date());
+            vipDetailServiceById.setStatus(2);
+            vipDetailServiceById.setOperatorId(operatorId);
+            vipDetailServiceById.setUseStoreId(storeId);
+            if (siteId!=0){
+                vipDetailServiceById.setUseSiteId(siteId);
+            }
+            vipDetailService.updateById(vipDetailServiceById);
+        }
+
     }
 }

--
Gitblit v1.7.1