| | |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/userCoupon/queryUserCouponById1") |
| | | public UserCoupon queryUserCouponById1(@RequestBody Long id){ |
| | | try { |
| | | UserCoupon userCoupon = userCouponService.getOne(new LambdaQueryWrapper<UserCoupon>().eq(UserCoupon::getId,id)); |
| | | return userCoupon; |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | } |
| | | @Autowired |
| | | private ICouponService couponService; |
| | | |
| | | @PostMapping("/userCoupon/edit") |
| | | public void edit(@RequestBody UserCoupon userCoupon) { |
| | | userCoupon.setUserId(null); |
| | | userCouponService.updateById(userCoupon); |
| | | |
| | | } |
| | | |
| | | @PostMapping("/userCoupon/sendUserCoupon") |
| | | public void sendUserCoupon(@RequestBody SendCouponReq sendCouponReq){ |
| | | try { |
| | | String couponIds = sendCouponReq.getCouponIds(); |
| | | for (String s : couponIds.split(",")) { |
| | | Coupon coupon = couponService.getById(s); |
| | | if (new Date().before(coupon.getStartTime())&&new Date().after(coupon.getEndTime())){ |
| | | continue; |
| | | } |
| | | //查询该优惠卷的数量够不够 |
| | | List<Integer> queryIds = new ArrayList<>(); |
| | | queryIds.add(coupon.getId()); |