| | |
| | | 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; |
| | |
| | | |
| | | 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 |
| | |
| | | private StudentClient studentClient; |
| | | @Autowired |
| | | private VipDetailService vipDetailService; |
| | | @Autowired |
| | | private StoreClient storeClient; |
| | | @Autowired |
| | | private SiteClient siteClient; |
| | | |
| | | |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | @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; |
| | | |
| | |
| | | @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(); |
| | | } |
| | |
| | | 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") |
| | |
| | | vipDetail.setUserCouponId(userCoupon.getId()); |
| | | vipDetailService.save(vipDetail); |
| | | userCoupon.setVipDetailId(vipDetail.getId()); |
| | | userCoupon.setUserId(null); |
| | | userCouponService.updateById(userCoupon); |
| | | } |
| | | } |