| | |
| | | } |
| | | |
| | | //执行修改活动状态 |
| | | updateStatus(); |
| | | updateStatus(activity.getId()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | .eq("enable_float_window", 1).in(!actitctiyIds.isEmpty(), "id", actitctiyIds) |
| | | .last(" and now() between start_time and end_time order by float_window_priority desc limit 1")); |
| | | return one; |
| | | } |
| | | |
| | | |
| | | public void updateStatus(Long activityId) { |
| | | XpActivity xpActivity = xpActicityService.getById(activityId); |
| | | Integer status = xpActivity.getStatus(); |
| | | //即将开始的活动推送socket给前端用户 |
| | | if(1 == status && LocalDateTime.now().isBefore(xpActivity.getStartTime())){ |
| | | |
| | | } |
| | | |
| | | //即将结束的活动推送给前端用户 |
| | | |
| | | //生效的活动修改状态和发放一次优惠券 |
| | | if(1 == status && LocalDateTime.now().isAfter(xpActivity.getStartTime()) && LocalDateTime.now().isBefore(xpActivity.getEndTime())){ |
| | | xpActivity.setStatus(2); |
| | | //发放优惠券-发放一次的优惠券 |
| | | List<XpActicityStrategy> list1 = xpActicityStrategyService.list(new QueryWrapper<XpActicityStrategy>().eq("actitcity_id", xpActivity.getId()) |
| | | .eq("distribution_rules", 2)); |
| | | for (XpActicityStrategy xpActicityStrategy : list1) { |
| | | pushCoupon(xpActivity, xpActicityStrategy); |
| | | } |
| | | |
| | | } |
| | | xpActicityService.updateById(xpActivity); |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | //指定用户 |
| | | if(5 == userType){ |
| | | List<Long> userList = xpActicityUser.getUserList(); |
| | | List<Integer> userList = xpActicityUser.getUserList(); |
| | | List<XpAppUserCoupon> xpAppUserCoupons = new ArrayList<>(); |
| | | for (Long userId : userList) { |
| | | for (Integer userId : userList) { |
| | | UcUserInfo baseUserByUid = userResourcesClient.getBaseUserByUid(userId.toString()); |
| | | for (XpActicityCoupon acticityCoupon : acticityCoupons) { |
| | | XpCoupon xpCoupon = xpCoupons.stream().filter(s -> s.getId().equals(acticityCoupon.getCouponId())).findFirst().orElse(null); |
| | |
| | | } |
| | | |
| | | xpAppUserCoupon.setCouponId(acticityCoupon.getCouponId()); |
| | | xpAppUserCoupon.setAppUserId(userId); |
| | | xpAppUserCoupon.setAppUserId(userId.longValue()); |
| | | xpAppUserCoupon.setStatus(1); |
| | | xpAppUserCoupon.setActivityId(xpActivity.getId()); |
| | | xpAppUserCoupon.setCouponName(xpCoupon.getCouponName()); |