| | |
| | | private XpAppUserCouponClient appUserCouponClient; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取所有白名单手机号 |
| | | * |
| | | * @return |
| | | */ |
| | | @PostMapping("/logan/inner/acticity/findListToIds") |
| | | @ApiOperation(value = "获取活动信息ids", tags = {"管理后台-获取活动信息ids"}) |
| | | public R<List<String>> findListToIds(@RequestParam String acticityName){ |
| | | if(acticityName == null){ |
| | | public R<List<String>> findListToIds(@RequestParam String acticityName) { |
| | | if (acticityName == null) { |
| | | return R.ok(); |
| | | } |
| | | return R.ok(service.findListToIds(acticityName)); |
| | |
| | | |
| | | /** |
| | | * 是否第一次进入某活动 |
| | | * |
| | | * @return 活动信息,id 和 img |
| | | */ |
| | | @GetMapping("/api/v1/mini-program/acticity/firstEnter") |
| | | @ApiOperation(value = "获取是否第一次推送活动", tags = {"小程序-首页活动"}) |
| | | @XpClientCheck(checkToken = false, checkOtpToken = true) |
| | | public R<XpActivity> firstEnter(HttpServletRequest request){ |
| | | public R<XpActivity> firstEnter(HttpServletRequest request) { |
| | | String uid = request.getHeader("XP-Uid"); |
| | | ValueOperations<String, String> ops = redisTemplate.opsForValue(); |
| | | XpActivity activity = service.activiting(Long.valueOf(uid)); |
| | | if (activity !=null) { |
| | | if (activity != null) { |
| | | List<XpAppUserCoupon> couponList = appUserCouponClient.getXpAppUserCoupon(activity.getId()).getData(); |
| | | Set<Long> longSet = couponList.stream().map(XpAppUserCoupon::getCouponId).collect(Collectors.toSet()); |
| | | if(longSet.isEmpty()){ |
| | | if (longSet.isEmpty()) { |
| | | return R.ok(); |
| | | } |
| | | List<XpCoupon> xpCoupons1 = xpCouponService.listByIds(longSet); |
| | |
| | | couponVos.add(vo); |
| | | } |
| | | Duration duration = Duration.between(LocalDateTime.now(), activity.getEndTime()); |
| | | Boolean isFirst = ops.setIfAbsent(CacheConstants.firstEnterActivity(String.valueOf(activity.getId()), uid),"1", duration); |
| | | Boolean isFirst = ops.setIfAbsent(CacheConstants.firstEnterActivity(String.valueOf(activity.getId()), uid), "1", duration); |
| | | activity.setIsFirst(isFirst); |
| | | activity.setCoupons(couponVos); |
| | | } |
| | |
| | | |
| | | /** |
| | | * 是否第一次进入某活动 |
| | | * |
| | | * @return 活动信息,id 和 img |
| | | */ |
| | | @GetMapping("/api/v1/mini-program/acticity/getFloatActicity") |
| | | @ApiOperation(value = "获取首页活动悬浮图标数据", tags = {"小程序-首页活动"}) |
| | | @XpClientCheck(checkToken = false, checkOtpToken = true) |
| | | public R<XpActivity> getFloatActicity(HttpServletRequest request){ |
| | | public R<XpActivity> getFloatActicity(HttpServletRequest request) { |
| | | String uid = request.getHeader("XP-Uid"); |
| | | XpActivity activity = service.getFloatActicity(Long.valueOf(uid)); |
| | | return R.ok(activity); |
| | | } |
| | | |
| | | |
| | | |
| | | @Resource |
| | |
| | | IXpActivityNoticeService noticeService; |
| | | |
| | | @PostMapping("/v1/api/appUserCoupon/pageList") |
| | | @ApiOperation(value = "活动列表",tags = {"管理后台-活动管理"},response = XpActivity.class) |
| | | @ApiOperation(value = "活动列表", tags = {"管理后台-活动管理"}, response = XpActivity.class) |
| | | public R<PageInfo<XpActivityDto>> pageList(@RequestBody XpActivityPageListQuery query) { |
| | | PageInfo<XpActivityDto> pageList = service.pageList(query); |
| | | for (XpActivityDto dto : pageList.getRecords()) { |
| | |
| | | |
| | | |
| | | @PostMapping("/v1/api/appUserCoupon/add") |
| | | @ApiOperation(value = "添加活动",tags = {"管理后台-活动管理"},response = XpCoupon.class) |
| | | public R<?> add(@RequestBody XpActivityDto dto){ |
| | | @ApiOperation(value = "添加活动", tags = {"管理后台-活动管理"}, response = XpCoupon.class) |
| | | public R<?> add(@RequestBody XpActivityDto dto) { |
| | | service.save(dto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/v1/api/appUserCoupon/{op}") |
| | | @ApiOperation(value = "修改活动状态,release,pause,resume,stop,del",tags = {"管理后台-活动管理"},response = XpCoupon.class) |
| | | public R<XpActivity> updateById(@PathVariable String op,@RequestParam Long id){ |
| | | @ApiOperation(value = "修改活动状态,release,pause,resume,stop,del", tags = {"管理后台-活动管理"}, response = XpCoupon.class) |
| | | public R<XpActivity> updateById(@PathVariable String op, @RequestParam Long id) { |
| | | |
| | | XpActivity activity = service.getById(id); |
| | | switch (op){ |
| | | switch (op) { |
| | | case "release": |
| | | activity.setStatus(2); |
| | | break; |
| | |
| | | throw new UnsupportedOperationException("Unsupported" + op); |
| | | } |
| | | service.updateById(activity); |
| | | log.info("修改活动状态:{}",activity); |
| | | log.info("修改活动状态:{}", activity); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @GetMapping("/v1/api/appUserCoupon/detail") |
| | | @ApiOperation(value = "活动详情",tags = {"管理后台-活动管理"},response = XpCoupon.class) |
| | | public R<XpActivityDto> queryById(@RequestParam Long id){ |
| | | |
| | | @ApiOperation(value = "活动详情", tags = {"管理后台-活动管理"}, response = XpCoupon.class) |
| | | public R<XpActivityDto> queryById(@RequestParam Long id) { |
| | | return R.ok(service.detail(id)); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据活动id和优惠券id获取活动策略 |
| | | * |
| | | * @param activityId |
| | | * @param couponId |
| | | * @return |
| | | */ |
| | | @PostMapping("/logan/inner/acticity/getXpActicityStrategy") |
| | | public R<XpActicityStrategy> getXpActicityStrategy(@RequestParam("activityId") Long activityId, @RequestParam("couponId") Long couponId){ |
| | | public R<XpActicityStrategy> getXpActicityStrategy(@RequestParam("activityId") Long activityId, @RequestParam("couponId") Long couponId) { |
| | | XpActicityCoupon one = xpActicityCouponService.lambdaQuery().eq(XpActicityCoupon::getActivityId, activityId).eq(XpActicityCoupon::getCouponId, couponId).one(); |
| | | if(one == null){ |
| | | if (one == null) { |
| | | return R.ok(); |
| | | } |
| | | return R.ok(xpActicityStrategyService.getById(one.getActicityStrategyId())); |