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/entity/UserCoupon.java                                  |    3 
 cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TVipPaymentController.java |    3 
 cloud-server-activity/src/main/java/com/dsh/activity/controller/CouponController.java                        |   19 ++++++
 cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TVipController.java        |   10 +++
 cloud-server-account/src/main/java/com/dsh/account/controller/FinanceController.java                         |    5 +
 cloud-server-activity/src/main/java/com/dsh/activity/controller/HuiminRecordController.java                  |    7 ++
 cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java                 |    2 
 cloud-server-course/src/main/java/com/dsh/course/util/PayMoneyUtil.java                                      |    3 
 cloud-server-other/src/main/java/com/dsh/other/feignclient/activity/model/UserCoupon.java                    |    4 +
 cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TCouponController.java     |   21 ++++++
 cloud-server-activity/src/main/java/com/dsh/activity/controller/UserCouponController.java                    |   38 +++++++++++-
 cloud-server-activity/src/main/resources/mapper/UserCouponMapper.xml                                         |    2 
 cloud-server-management/src/main/java/com/dsh/course/feignClient/activity/CouponClient.java                  |    5 +
 cloud-server-account/src/main/java/com/dsh/account/feignclient/activity/UserConponClient.java                |    3 
 cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TVipDetailController.java  |    2 
 cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackageServiceImpl.java                 |    6 +-
 16 files changed, 117 insertions(+), 16 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 0b173ea..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;
 
 
     /**
@@ -109,6 +112,8 @@
         appUserService.updateById(appUser);
         vipPayment.setPayStatus(3);
         vipPaymentService.updateById(vipPayment);
+        // 将未使用的门票优惠券设置为已过期
+        userConponClient.setStatusVipDetail(vipPayment.getId());
         return "200";
     }
 
diff --git a/cloud-server-account/src/main/java/com/dsh/account/feignclient/activity/UserConponClient.java b/cloud-server-account/src/main/java/com/dsh/account/feignclient/activity/UserConponClient.java
index 6bc4e53..311115d 100644
--- a/cloud-server-account/src/main/java/com/dsh/account/feignclient/activity/UserConponClient.java
+++ b/cloud-server-account/src/main/java/com/dsh/account/feignclient/activity/UserConponClient.java
@@ -47,5 +47,6 @@
 
     @PostMapping("/userCoupon/grantCoupon")
     void grantCoupon(@RequestBody GrantCoupon grantCoupon);
-
+    @GetMapping("/userCoupon/setStatusVipDetail/{id}")
+    void setStatusVipDetail(@PathVariable("id") Integer id);
 }
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 edef607..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
@@ -955,6 +955,25 @@
             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);
         }
 
diff --git a/cloud-server-activity/src/main/java/com/dsh/activity/controller/HuiminRecordController.java b/cloud-server-activity/src/main/java/com/dsh/activity/controller/HuiminRecordController.java
index 3ca3a2e..0121b0c 100644
--- a/cloud-server-activity/src/main/java/com/dsh/activity/controller/HuiminRecordController.java
+++ b/cloud-server-activity/src/main/java/com/dsh/activity/controller/HuiminRecordController.java
@@ -73,7 +73,11 @@
                 List<Store> stores = storeClient.queryStoreByIds(Arrays.asList(sid));
                 if (!stores.isEmpty()){
                     Store store = stores.get(0);
-                    vipDetailServiceById.setOperatorId(store.getOperatorId());
+                    if(store.getOperatorId()==null){
+                        vipDetailServiceById.setOperatorId(0);
+                    }else{
+                        vipDetailServiceById.setOperatorId(store.getOperatorId());
+                    }
                 }
             }
             // 根据场地id查询运营商id
@@ -81,6 +85,7 @@
             vipDetailServiceById.setUseStoreId(sid);
             vipDetailServiceById.setStatus(2);
             vipDetailServiceById.setStartTime(new Date());
+            vipDetailServiceById.setUseTime(new Date());
             // 获取今天的晚上23:59:59
             // 获取今天的晚上23:59:59
             SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
diff --git a/cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java b/cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java
index 231fef5..862fae9 100644
--- a/cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java
+++ b/cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java
@@ -1110,7 +1110,7 @@
         PointDetailsVo detailsVo = new PointDetailsVo();
 
         if (speMercharsId.toString().contains("-1")){
-            // 会员门票
+            // 会员优惠券
             VipDetail vipDetail = vipDetailService.getById(Math.abs(speMercharsId));
             if (vipDetail.getType()==1){
                 Coupon coupon = iCouponService.getById(vipDetail.getCouponId());
diff --git a/cloud-server-activity/src/main/java/com/dsh/activity/controller/UserCouponController.java b/cloud-server-activity/src/main/java/com/dsh/activity/controller/UserCouponController.java
index bbfc1cb..59ed6a1 100644
--- a/cloud-server-activity/src/main/java/com/dsh/activity/controller/UserCouponController.java
+++ b/cloud-server-activity/src/main/java/com/dsh/activity/controller/UserCouponController.java
@@ -213,15 +213,21 @@
     public void updateUserCouponStatus(@PathVariable("id") Long id,@PathVariable("storeId") Integer storeId,@PathVariable("siteId") Integer siteId) {
 
             UserCoupon userCoupon = userCouponService.getOne(new LambdaQueryWrapper<UserCoupon>().eq(UserCoupon::getId, id));
+        userCoupon.setUserId(null);
         userCoupon.setStatus(2);
+        userCouponService.updateById(userCoupon);
         if (userCoupon.getIsVipGrant()!=null && userCoupon.getIsVipGrant()==1){
             VipDetail vipDetailServiceById = vipDetailService.getById(userCoupon.getVipDetailId());
             vipDetailServiceById.setStatus(2);
-            List<Store> stores = storeClient.queryStoreByIds(Collections.singletonList(vipDetailServiceById.getUseStoreId()));
+            List<Store> stores = storeClient.queryStoreByIds(Collections.singletonList(storeId));
             Store store = stores.get(0);
             vipDetailServiceById.setUseSiteId(siteId);
             vipDetailServiceById.setUseStoreId(storeId);
-            vipDetailServiceById.setOperatorId(store.getOperatorId());
+            if (store.getOperatorId()==0){
+                vipDetailServiceById.setOperatorId(0);
+            }else{
+                vipDetailServiceById.setOperatorId(store.getOperatorId());
+            }
             vipDetailServiceById.setUseTime(new Date());
             vipDetailService.updateById(vipDetailServiceById);
         }
@@ -302,8 +308,27 @@
     @PostMapping("/userCoupon/updateUserCoupon")
     public void updateUserCoupon(@RequestBody UserCoupon userCoupon) {
         try {
+
             userCoupon.setUserId(null);
+
             userCouponService.updateById(userCoupon);
+            UserCoupon byId = userCouponService.getById(userCoupon.getId());
+            if (byId.getIsVipGrant()!=null && byId.getIsVipGrant()==1){
+                VipDetail vipDetailServiceById = vipDetailService.getById(byId.getVipDetailId());
+                vipDetailServiceById.setStatus(2);
+                vipDetailServiceById.setUseSiteId(byId.getSiteId());
+                List<Store> stores = storeClient.queryStoreByIds(Collections.singletonList(vipDetailServiceById.getUseStoreId()));
+                Store store = stores.get(0);
+                vipDetailServiceById.setUseStoreId(store.getId());
+                vipDetailServiceById.setStatus(2);
+                vipDetailServiceById.setUseTime(new Date());
+                if (store.getOperatorId()==null|| store.getOperatorId()==0){
+                    vipDetailServiceById.setOperatorId(0);
+                }else{
+                    vipDetailServiceById.setOperatorId(store.getOperatorId());
+                }
+                vipDetailService.updateById(vipDetailServiceById);
+            }
         } catch (Exception e) {
             e.printStackTrace();
         }
@@ -345,7 +370,14 @@
     public Integer queryCounts1(@RequestBody List<Integer> queryIds) {
         return userCouponService.count(new QueryWrapper<UserCoupon>().eq("couponId", queryIds.get(0)).eq("userId", queryIds.get(1)));
     }
-
+    @GetMapping("/userCoupon/setStatusVipDetail/{id}")
+    void setStatusVipDetail(@PathVariable("id") Integer id){
+        List<VipDetail> list = vipDetailService.lambdaQuery().eq(VipDetail::getVipPaymentId, id).list();
+        for (VipDetail vipDetail : list) {
+            vipDetail.setStatus(3);
+        }
+        vipDetailService.updateBatchById(list);
+    }
     // 开通会员后 赠送优惠券和门票
     @ResponseBody
     @PostMapping("/userCoupon/grantCoupon")
diff --git a/cloud-server-activity/src/main/java/com/dsh/activity/entity/UserCoupon.java b/cloud-server-activity/src/main/java/com/dsh/activity/entity/UserCoupon.java
index c77b6b8..d05dab1 100644
--- a/cloud-server-activity/src/main/java/com/dsh/activity/entity/UserCoupon.java
+++ b/cloud-server-activity/src/main/java/com/dsh/activity/entity/UserCoupon.java
@@ -76,7 +76,8 @@
      */
     @TableField("vipDetailId")
     private Integer vipDetailId;
-
+    @TableField(exist = false)
+    private Integer siteId;
 
     @Override
     protected Serializable pkVal() {
diff --git a/cloud-server-activity/src/main/resources/mapper/UserCouponMapper.xml b/cloud-server-activity/src/main/resources/mapper/UserCouponMapper.xml
index 90b4a32..cb2df28 100644
--- a/cloud-server-activity/src/main/resources/mapper/UserCouponMapper.xml
+++ b/cloud-server-activity/src/main/resources/mapper/UserCouponMapper.xml
@@ -13,7 +13,7 @@
         DATE_FORMAT(b.endTime, '%Y-%m-%d') as endTime
         from t_user_coupon a
         left join t_coupon b on (a.couponId = b.id)
-        where a.`status` = 1 and b.type != 3 and (now() between b.startTime and b.endTime) and a.userId = #{uid} and
+        where a.`status` = 1 and b.type != 3 and b.type!=4 and (now() between b.startTime and b.endTime) and a.userId = #{uid} and
               (
             b.useScope = 1 or (b.useScope = 2 and b.id IN (SELECT couponId FROM t_coupon_city  where provinceCode = #{provinceCode} and cityCode = #{cityCode}) )
                            or (b.useScope = 3 and b.id in (select couponId from t_coupon_store where storeId = #{storeId})))
diff --git a/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackageServiceImpl.java b/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackageServiceImpl.java
index 0dd44be..2e2077e 100644
--- a/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackageServiceImpl.java
+++ b/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackageServiceImpl.java
@@ -949,7 +949,7 @@
         Store store = storeClient.queryStoreById(storeId);
 
         if (store.getOperatorId()==null || store.getOperatorId()==0){
-            ResultUtil weixinpay = payMoneyUtil.weixinpay("报名运动营", "", code, coursePackagePaymentConfig.getId().toString(),
+            ResultUtil weixinpay = payMoneyUtil.weixinpay("报名运动营", "", code, paymentPrice.toString(),
                     "/base/course/weChatPaymentCourseCallback", "APP", "");
             return weixinpay;
         }else{
@@ -1285,8 +1285,8 @@
         Long userCouponId = coursePackageOrder1.getUserCouponId();
 
         userCouponClient.updateUserCouponStatus(userCouponId,coursePackage.getStoreId(),coursePackage.getSiteId());
-        CoursePackagePaymentConfig coursePackagePaymentConfig = coursePackagePaymentConfigService.getById(attach);
-        addCoursePackageOrderStudent(coursePackageOrder1.getId(), coursePackagePaymentConfig);
+//        CoursePackagePaymentConfig coursePackagePaymentConfig = coursePackagePaymentConfigService.getById(attach);
+//        addCoursePackageOrderStudent(coursePackageOrder1.getId(), coursePackagePaymentConfig);
         TCoursePackage byId = coursePackageService.getById(coursePackageOrder1.getCoursePackageId());
         Store store = storeClient.queryStoreById(byId.getStoreId());
 //        moneyOut(trade_no,trade_no,code);
diff --git a/cloud-server-course/src/main/java/com/dsh/course/util/PayMoneyUtil.java b/cloud-server-course/src/main/java/com/dsh/course/util/PayMoneyUtil.java
index 231a522..126e402 100644
--- a/cloud-server-course/src/main/java/com/dsh/course/util/PayMoneyUtil.java
+++ b/cloud-server-course/src/main/java/com/dsh/course/util/PayMoneyUtil.java
@@ -63,7 +63,8 @@
 
     private String key = "6f5e0c2dcabfa9c27b5da5836a362fef";//微信商户号
 
-    private String callbackPath = "https://online.daowepark.com:443/course";//支付回调网关地址
+//    private String callbackPath = "https://online.daowepark.com:443/course";//支付回调网关地址
+private String callbackPath = "http://221.182.45.100:1234/course";//支付回调网关地址
 
     private String app_cert_path = "C:/cert/alipay/user/app_cert_path.crt";//应用公钥证书路径
 
diff --git a/cloud-server-management/src/main/java/com/dsh/course/feignClient/activity/CouponClient.java b/cloud-server-management/src/main/java/com/dsh/course/feignClient/activity/CouponClient.java
index 3abbdf8..dae5b1d 100644
--- a/cloud-server-management/src/main/java/com/dsh/course/feignClient/activity/CouponClient.java
+++ b/cloud-server-management/src/main/java/com/dsh/course/feignClient/activity/CouponClient.java
@@ -9,6 +9,8 @@
 import com.dsh.guns.modular.system.model.vo.VipDetailVO;
 import com.dsh.guns.modular.system.model.vo.VipPaymentListVO;
 import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 
@@ -64,6 +66,9 @@
 
     @PostMapping("/base/coupon/updateType")
     void updateType(Long id);
+    @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);
     @PostMapping("/base/pointMerchars/goodsList")
     List<PointsMerchandise> goodsList();
     @PostMapping("/base/coupon/vipDetail")
diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TCouponController.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TCouponController.java
index 8c99b48..4370fa7 100644
--- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TCouponController.java
+++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TCouponController.java
@@ -12,6 +12,7 @@
 import com.dsh.course.feignClient.account.model.TAppUser;
 import com.dsh.course.feignClient.activity.CouponClient;
 import com.dsh.course.feignClient.activity.model.*;
+import com.dsh.course.feignClient.other.model.Site;
 import com.dsh.guns.config.UserExt;
 import com.dsh.guns.core.base.tips.SuccessTip;
 import com.dsh.guns.core.common.constant.factory.PageFactory;
@@ -65,6 +66,8 @@
     private TOperatorService operatorService;
     @Autowired
     private TOperatorCityService operatorCityService;
+    @Autowired
+    private ITSiteService siteService;
 
     /**
      * 跳转到优惠券管理首页
@@ -186,7 +189,23 @@
     @RequestMapping("/updateType")
     @ResponseBody
     public Object updateType(Long id) {
-        client.updateType(id);
+        if (UserExt.getUser().getObjectType()==1){
+            client.updateType(id);
+        }
+        if (UserExt.getUser().getObjectType()!=1){
+            if (UserExt.getUser().getObjectType()==2){
+                TStore tStore = storeService.getById(UserExt.getUser().getObjectId());
+                client.updateTypeOther(id,tStore.getOperatorId()==null?0:tStore.getOperatorId(),
+                        tStore.getId(),0);
+            }
+            if (UserExt.getUser().getObjectType()==3){
+                TSite site = siteService.getById(UserExt.getUser().getObjectId());
+                TStore tStore = storeService.getById(site.getStoreId());
+                client.updateTypeOther(id,tStore.getOperatorId()==null?0:tStore.getOperatorId(),
+                        tStore.getId(),site.getId());
+            }
+        }
+
         return new SuccessTip<>();
     }
 
diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TVipController.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TVipController.java
index 2d5658f..fb66680 100644
--- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TVipController.java
+++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TVipController.java
@@ -128,6 +128,11 @@
                 model.addAttribute("couponList", new ArrayList<Coupon>());
             }
         }
+            else{
+                model.addAttribute("ticketList", new ArrayList<Coupon>());
+
+            }
+
         if (vip.getTicketJson() != null && !vip.getTicketJson().isEmpty()){
             String ticketJson = vip.getTicketJson();
             // 转化为jsonArray
@@ -144,7 +149,12 @@
                 ticketDetailVOS.add(ticketDetailVO);
             }
             model.addAttribute("ticketList", ticketDetailVOS);
+
+        }else{
+            model.addAttribute("ticketList", new ArrayList<TicketDetailVO>());
+
         }
+
         return PREFIX + "vip_edit.html";
     }
 
diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TVipDetailController.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TVipDetailController.java
index 9e54a94..b93091d 100644
--- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TVipDetailController.java
+++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TVipDetailController.java
@@ -144,7 +144,7 @@
             TAppUser appUser = tAppUsers.stream().filter(e -> e.getId().equals(re.getAppUserId())).findFirst().orElse(null);
             if (appUser!=null){
                 re.setAppUserName(appUser.getName());
-                re.setAppUserPhone(appUser.getName());
+                re.setAppUserPhone(appUser.getPhone());
             }
         }
         return res;
diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TVipPaymentController.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TVipPaymentController.java
index ee54dfc..ce5aa13 100644
--- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TVipPaymentController.java
+++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TVipPaymentController.java
@@ -173,14 +173,13 @@
             }
             if (re.getOperatorId()!=null){
                 if (re.getOperatorId()==0){
-                    re.setOperatorName("总平台");
+                    re.setOperatorName("平台");
                 }else{
                     TOperator operator = operatorList.stream().filter(e -> e.getId().equals(re.getOperatorId())).findFirst().orElse(null);
                     if (operator!=null){
                         re.setOperatorName(operator.getName());
                     }
                 }
-
             }
         }
         return res;
diff --git a/cloud-server-other/src/main/java/com/dsh/other/feignclient/activity/model/UserCoupon.java b/cloud-server-other/src/main/java/com/dsh/other/feignclient/activity/model/UserCoupon.java
index 221fefa..afeb681 100644
--- a/cloud-server-other/src/main/java/com/dsh/other/feignclient/activity/model/UserCoupon.java
+++ b/cloud-server-other/src/main/java/com/dsh/other/feignclient/activity/model/UserCoupon.java
@@ -29,6 +29,10 @@
      */
     private Integer verificationUserId;
     /**
+     * 核销人员id
+     */
+    private Integer siteId;
+    /**
      * 核销时间
      */
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")

--
Gitblit v1.7.1