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/UserCouponController.java | 70 ++++++++++++++++++++++++++++++++--- 1 files changed, 64 insertions(+), 6 deletions(-) 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 4f062f7..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 @@ -11,6 +11,9 @@ import com.dsh.activity.feignclient.account.model.AppUser; import com.dsh.activity.feignclient.model.CouponStuAvailableVo; import com.dsh.activity.feignclient.model.QueryUserCouponByIdAndUserId; +import com.dsh.activity.feignclient.other.SiteClient; +import com.dsh.activity.feignclient.other.StoreClient; +import com.dsh.activity.feignclient.other.model.Store; import com.dsh.activity.model.CouponListVo; import com.dsh.activity.model.GrantCoupon; import com.dsh.activity.model.SendCouponReq; @@ -31,10 +34,7 @@ import javax.annotation.Resource; import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; @Api @@ -62,6 +62,10 @@ private StudentClient studentClient; @Autowired private VipDetailService vipDetailService; + @Autowired + private StoreClient storeClient; + @Autowired + private SiteClient siteClient; @@ -204,6 +208,31 @@ } } + @ResponseBody + @PostMapping("/userCoupon/updateUserCouponStatus/{id}/{storeId}/{siteId}") + 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(storeId)); + Store store = stores.get(0); + vipDetailServiceById.setUseSiteId(siteId); + vipDetailServiceById.setUseStoreId(storeId); + if (store.getOperatorId()==0){ + vipDetailServiceById.setOperatorId(0); + }else{ + vipDetailServiceById.setOperatorId(store.getOperatorId()); + } + vipDetailServiceById.setUseTime(new Date()); + vipDetailService.updateById(vipDetailServiceById); + } + } + @Autowired private ICouponService couponService; @@ -279,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(); } @@ -322,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") @@ -359,6 +414,9 @@ vipDetail.setCouponId(Integer.valueOf(id)); vipDetail.setUserCouponId(userCoupon.getId()); vipDetailService.save(vipDetail); + userCoupon.setVipDetailId(vipDetail.getId()); + userCoupon.setUserId(null); + userCouponService.updateById(userCoupon); } } } @@ -387,7 +445,7 @@ vipDetail.setAppUserId(grantCoupon.getUserId()); vipDetail.setStatus(1); vipDetail.setInsertTime(new Date()); - vipDetail.setVipId(grantCoupon.getVipPaymentId()); + vipDetail.setVipId(grantCoupon.getVipId()); vipDetail.setType(2); vipDetail.setVipPaymentId(grantCoupon.getVipPaymentId()); vipDetailService.save(vipDetail); -- Gitblit v1.7.1