| | |
| | | @ApiImplicitParam(name = "id", value = "优惠券id", required = true, dataType = "String", paramType = "path") |
| | | }) |
| | | public R<CouponInfoVo> getCouponInfo(@PathVariable("couponId") String couponId) { |
| | | MemberCoupon memberCoupon = memberCouponService.getById(couponId); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Coupon coupon = couponService.getById(couponId); |
| | | Coupon coupon = couponService.getById(memberCoupon.getCouponId()); |
| | | CouponInfoVo vo = new CouponInfoVo(); |
| | | vo.setId(coupon.getCouponId()); |
| | | vo.setName(coupon.getCouponName()); |
| | |
| | | vo.setDiscountMoney(coupon.getDiscountMoney()); |
| | | vo.setValidType(coupon.getValidTimeType()); |
| | | vo.setValidDays(coupon.getValidDay()); |
| | | vo.setValidStartTime(sdf.format(coupon.getValidStartTime())); |
| | | vo.setValidEndTime(sdf.format(coupon.getValidEndTime())); |
| | | if (2 != coupon.getValidTimeType()) { |
| | | vo.setValidStartTime(sdf.format(coupon.getValidStartTime())); |
| | | vo.setValidEndTime(sdf.format(coupon.getValidEndTime())); |
| | | } |
| | | vo.setPropagandaPoster(coupon.getPropagandaPoster()); |
| | | vo.setUseGoods(""); |
| | | //构建特定商品数据 |
| | |
| | | } |
| | | vo.setLaveNum(coupon.getSendLimitFlag()); |
| | | vo.setReceiveNum(coupon.getSendLimitNumber()); |
| | | int count = memberCouponService.count(new QueryWrapper<MemberCoupon>().eq("coupon_id", couponId).eq("del_flag", 0)); |
| | | int count = memberCouponService.count(new QueryWrapper<MemberCoupon>().eq("coupon_id", memberCoupon.getCouponId()).eq("del_flag", 0)); |
| | | vo.setLaveNum(coupon.getSendLimitNumber() - count); |
| | | MemberCoupon one = memberCouponService.getOne(new QueryWrapper<MemberCoupon>().eq("coupon_id", couponId).eq("user_id", SecurityUtils.getUserId())); |
| | | if (one != null) { |
| | | vo.setStatus(one.getCouponStatus()); |
| | | } |
| | | vo.setStatus(memberCoupon.getCouponStatus()); |
| | | return R.ok(vo); |
| | | } |
| | | |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "优惠券id", required = true, dataType = "String", paramType = "path") |
| | | }) |
| | | public R<Boolean> shareCoupon(@PathVariable("couponId") String couponId) { |
| | | public R<String> shareCoupon(@PathVariable("couponId") String couponId) { |
| | | //检测是否可以抽奖 |
| | | List<TLotteryEvent> data = lotteryEventClient.getLotteryEventList(3).getData(); |
| | | if (data.size() > 0) { |
| | | return R.ok(true); |
| | | return R.ok(data.get(0).getId()); |
| | | } |
| | | return R.ok(false); |
| | | return R.ok(); |
| | | } |
| | | } |