无关风月
10 小时以前 b1fb83530b7105e4aa73e4101727dea945eb01c2
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")