| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.activity.entity.Coupon; |
| | | import com.dsh.activity.entity.CouponStore; |
| | | import com.dsh.activity.entity.UserCoupon; |
| | | import com.dsh.activity.feignclient.model.CouponStuAvailableVo; |
| | | import com.dsh.activity.model.CouponListVo; |
| | | import com.dsh.activity.service.CouponStoreService; |
| | | import com.dsh.activity.service.ICouponService; |
| | | import com.dsh.activity.service.UserCouponService; |
| | | import com.dsh.activity.util.ResultUtil; |
| | |
| | | public class UserCouponController { |
| | | |
| | | @Autowired |
| | | private UserCouponService uconService; |
| | | |
| | | @Autowired |
| | | private ICouponService cService; |
| | | |
| | | @Autowired |
| | |
| | | private UserCouponService userCouponService; |
| | | |
| | | |
| | | @Autowired |
| | | private CouponStoreService csServie; |
| | | |
| | | |
| | | |
| | | |
| | | private final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM"); |
| | | |
| | | @PostMapping("/userConpon/getStuOfConpons") |
| | | public List<CouponStuAvailableVo> queryUserWithConponList(@RequestBody Integer appUserId){ |
| | | @PostMapping("/base/userConpon/getStuOfConpons") |
| | | public List<CouponStuAvailableVo> queryUserWithConponList(@RequestParam("appUserId") Integer appUserId){ |
| | | |
| | | List<CouponStuAvailableVo> availableVos = new ArrayList<>(); |
| | | |
| | | List<UserCoupon> list = uconService.list(new QueryWrapper<UserCoupon>() |
| | | List<UserCoupon> list = userCouponService.list(new QueryWrapper<UserCoupon>() |
| | | .eq("userId", appUserId) |
| | | .eq("status",1)); |
| | | if (list.size() > 0){ |
| | |
| | | @ApiImplicitParam(value = "纬度", name = "lat", dataType = "string", required = true), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<CouponListVo>> queryAvailableCouponList(@RequestBody Integer coursePackageId, @RequestBody Double price, @RequestBody String lon, @RequestBody String lat){ |
| | | public ResultUtil<List<CouponListVo>> queryAvailableCouponList(Integer coursePackageId, Double price, String lon, String lat){ |
| | | try { |
| | | Integer uid = tokenUtil.getUserIdFormRedis(); |
| | | if(null == uid){ |
| | |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping("/userCoupon/queryCouponOfStore") |
| | | public List<Integer> getCouponStoreIds(@RequestBody Integer couponId){ |
| | | try { |
| | | List<Integer> storeIds = new ArrayList<>(); |
| | | List<CouponStore> list = csServie.list(new QueryWrapper<CouponStore>() |
| | | .eq("couponId",couponId)); |
| | | if (list.size() > 0 ){ |
| | | storeIds = list.stream().map(CouponStore::getStoreId).collect(Collectors.toList()); |
| | | } |
| | | return storeIds; |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | } |