| | |
| | | |
| | | @PostMapping("/inner/appUserCoupon/getUserCoupon") |
| | | public R<UserCouponVo> getUserCoupon(@RequestBody GetUserCouponDto dto) { |
| | | String phone ="18888888888"; |
| | | if(dto.getUserId()>1){ |
| | | UserResourcesDto baseUserByUid = userResourcesClient.getBaseUserByUid(dto.getUserId().toString()); |
| | | if(baseUserByUid!=null){ |
| | | Object data = baseUserByUid.getData(); |
| | | phone = JSONObject.parseObject(data.toString()).getString("mobile"); |
| | | } |
| | | } |
| | | // String phone ="18888888888"; |
| | | // if(dto.getUserId()>1){ |
| | | // UserResourcesDto baseUserByUid = userResourcesClient.getBaseUserByUid(dto.getUserId().toString()); |
| | | // if(baseUserByUid!=null){ |
| | | // Object data = baseUserByUid.getData(); |
| | | // phone = JSONObject.parseObject(data.toString()).getString("mobile"); |
| | | // } |
| | | // } |
| | | |
| | | |
| | | UserCouponVo userCouponVo = new UserCouponVo(); |
| | | // 获取用户所有优惠券 |
| | | List<XpAppUserCoupon> couponList = xpAppUserCouponService.list(new LambdaQueryWrapper<XpAppUserCoupon>().eq(XpAppUserCoupon::getStatus, 1).eq(XpAppUserCoupon::getPhone,phone).apply("FIND_IN_SET({0}, open_city_id)", dto.getOpenCityId()) ); |
| | | List<XpAppUserCoupon> couponList = xpAppUserCouponService.list(new LambdaQueryWrapper<XpAppUserCoupon>().eq(XpAppUserCoupon::getStatus, 1).eq(XpAppUserCoupon::getAppUserId,dto.getUserId()).apply("FIND_IN_SET({0}, open_city_id)", dto.getOpenCityId()) ); |
| | | if(couponList.isEmpty()){ |
| | | return R.ok(userCouponVo); |
| | | } |
| | |
| | | public R<XpAppUserCouponVo> list(@RequestBody XpUserCouponListQuery query, HttpServletRequest request) { |
| | | // uid已通过拦截器otp校验,可以直接使用 |
| | | String uid = request.getHeader("XP-Uid"); |
| | | String phone ="18888888888"; |
| | | UserResourcesDto baseUserByUid = userResourcesClient.getBaseUserByUid(uid); |
| | | if(baseUserByUid!=null){ |
| | | Object data = baseUserByUid.getData(); |
| | | phone = JSONObject.parseObject(data.toString()).getString("mobile"); |
| | | } |
| | | // String phone ="18888888888"; |
| | | // UserResourcesDto baseUserByUid = userResourcesClient.getBaseUserByUid(uid); |
| | | // if(baseUserByUid!=null){ |
| | | // Object data = baseUserByUid.getData(); |
| | | // phone = JSONObject.parseObject(data.toString()).getString("mobile"); |
| | | // } |
| | | |
| | | XpAppUserCouponVo vo = xpAppUserCouponService.userCouponList(query, phone); |
| | | XpAppUserCouponVo vo = xpAppUserCouponService.userCouponList(query, uid); |
| | | return R.ok(vo); |
| | | } |
| | | |
| | |
| | | public R<XpAppUserCouponListVo> detail(@PathVariable("couponId") Long couponId, HttpServletRequest request) { |
| | | // uid已通过拦截器otp校验,可以直接使用 |
| | | String uid = request.getHeader("XP-Uid"); |
| | | String phone ="18888888888"; |
| | | UserResourcesDto baseUserByUid = userResourcesClient.getBaseUserByUid(uid); |
| | | if(baseUserByUid!=null){ |
| | | Object data = baseUserByUid.getData(); |
| | | phone = JSONObject.parseObject(data.toString()).getString("mobile"); |
| | | } |
| | | // String phone ="18888888888"; |
| | | // UserResourcesDto baseUserByUid = userResourcesClient.getBaseUserByUid(uid); |
| | | // if(baseUserByUid!=null){ |
| | | // Object data = baseUserByUid.getData(); |
| | | // phone = JSONObject.parseObject(data.toString()).getString("mobile"); |
| | | // } |
| | | XpAppUserCoupon coupon = xpAppUserCouponService.getById(couponId); |
| | | if(phone.equals(coupon.getPhone())){ |
| | | if(uid.equals(coupon.getAppUserId().toString())){ |
| | | XpAppUserCouponListVo vo = new XpAppUserCouponListVo(); |
| | | vo.setCouponId(coupon.getId().toString()); |
| | | vo.setTitle(coupon.getCouponName()); |
| | |
| | | public R<XpAppUserCouponTotalVo> total(HttpServletRequest request) { |
| | | // uid已通过拦截器otp校验,可以直接使用 |
| | | String uid = request.getHeader("XP-Uid"); |
| | | String phone ="18888888888"; |
| | | UserResourcesDto baseUserByUid = userResourcesClient.getBaseUserByUid(uid); |
| | | if(baseUserByUid!=null){ |
| | | Object data = baseUserByUid.getData(); |
| | | phone = JSONObject.parseObject(data.toString()).getString("mobile"); |
| | | } |
| | | XpAppUserCouponTotalVo vo = xpAppUserCouponService.userCouponTotal(phone); |
| | | // String phone ="18888888888"; |
| | | // UserResourcesDto baseUserByUid = userResourcesClient.getBaseUserByUid(uid); |
| | | // if(baseUserByUid!=null){ |
| | | // Object data = baseUserByUid.getData(); |
| | | // phone = JSONObject.parseObject(data.toString()).getString("mobile"); |
| | | // } |
| | | XpAppUserCouponTotalVo vo = xpAppUserCouponService.userCouponTotal(uid); |
| | | return R.ok(vo); |
| | | } |
| | | |
| | |
| | | @PostMapping("/api/v1/appUserCoupon/send") |
| | | @ApiOperation(value = "发放优惠券", tags = {"管理后台-发放优惠券"}) |
| | | public R<String> send(@RequestBody SendCouponDto dto) { |
| | | return xpAppUserCouponService.send(dto); |
| | | xpAppUserCouponService.send(dto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |