| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.dsh.activity.entity.*; |
| | | import com.dsh.activity.feignclient.account.AppUserClient; |
| | | import com.dsh.activity.feignclient.account.StudentClient; |
| | |
| | | import com.dsh.activity.model.CouponListVo; |
| | | import com.dsh.activity.model.GrantCoupon; |
| | | import com.dsh.activity.model.SendCouponReq; |
| | | import com.dsh.activity.service.CouponStoreService; |
| | | import com.dsh.activity.service.ICouponService; |
| | | import com.dsh.activity.service.UserCouponService; |
| | | import com.dsh.activity.service.VipDetailService; |
| | | import com.dsh.activity.service.*; |
| | | import com.dsh.activity.util.DateUtil; |
| | | import com.dsh.activity.util.ResultUtil; |
| | | import com.dsh.activity.util.TokenUtil; |
| | |
| | | |
| | | @Autowired |
| | | private UserCouponService userCouponService; |
| | | @Autowired |
| | | private UserPointsMerchandiseService userPointsMerchandiseService; |
| | | |
| | | |
| | | @Autowired |
| | | private CouponStoreService csServie; |
| | |
| | | if (null == uid) { |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | if(!StringUtils.hasLength(lon)){ |
| | | return ResultUtil.success(new ArrayList<>()); |
| | | } |
| | | if (lon.equals("0.0")){ |
| | | return ResultUtil.success(new ArrayList<>()); |
| | | |
| | | } |
| | | List<CouponListVo> listVos = userCouponService.querySiteCouponList(uid, siteId, price, lon, lat); |
| | | return ResultUtil.success(listVos); |
| | | } catch (Exception e) { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据id修改门票使用状态 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @GetMapping("/userCoupon/changeTicketStatus/{id}/{storeId}/{siteId}") |
| | | public void changeTicketStatus(@PathVariable("id") String id,@PathVariable("storeId") Integer storeId,@PathVariable("siteId") Integer siteId){ |
| | | System.err.println("数据id"+id); |
| | | if (id.length()<=11){ |
| | | // 购买会员赠送的门票 |
| | | System.err.println("会员赠送门票"); |
| | | VipDetail vipDetail = vipDetailService.getById(Integer.valueOf(id)); |
| | | System.err.println("会员权益门票数据"+ vipDetail); |
| | | if (vipDetail!=null){ |
| | | System.err.println("修改使用状态"); |
| | | vipDetail.setStatus(2); |
| | | vipDetail.setUseStoreId(storeId); |
| | | vipDetail.setUseSiteId(siteId); |
| | | vipDetailService.updateById(vipDetail); |
| | | }else{ |
| | | System.err.println("未查询到会员权益门票数据"+ id); |
| | | } |
| | | }else{ |
| | | // 积分商城门票 |
| | | System.err.println("积分商城门票id"); |
| | | UserPointsMerchandise userPointsMerchandise = userPointsMerchandiseService.getById(id); |
| | | System.err.println("积分商城门票数据"+ userPointsMerchandise); |
| | | if (userPointsMerchandise!=null){ |
| | | System.err.println("修改使用状态"); |
| | | userPointsMerchandise.setUserId(null); |
| | | userPointsMerchandise.setVerificationTime(new Date()); |
| | | userPointsMerchandise.setVerifiStoreId(storeId); |
| | | userPointsMerchandise.setStatus(2); |
| | | userPointsMerchandiseService.updateById(userPointsMerchandise); |
| | | }else{ |
| | | System.err.println("未查询到积分商城门票数据"+ id); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/userCoupon/queryUserCouponById1") |
| | | public UserCoupon queryUserCouponById1(@RequestBody Long id) { |
| | |
| | | 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); |
| | | } |
| | |
| | | @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); |
| | | if (vipDetail.getType()==1){ |
| | | // 将优惠券修改为过期 |
| | | UserCoupon userCoupon = userCouponService.getById(vipDetail.getUserCouponId()); |
| | | userCoupon.setUserId(null); |
| | | userCoupon.setStatus(3); |
| | | userCouponService.updateById(userCoupon); |
| | | } |
| | | } |
| | | vipDetailService.updateBatchById(list); |
| | | } |
| | | // 开通会员后 赠送优惠券和门票 |
| | | @ResponseBody |
| | | @PostMapping("/userCoupon/grantCoupon") |