From 4a9ca8e24317da12e3dd07d93128a5d74c8103b8 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期四, 30 四月 2026 21:20:12 +0800
Subject: [PATCH] 修改bug

---
 xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/utils/task/ActivityTask.java |  177 ----------------------------------------------------------
 1 files changed, 1 insertions(+), 176 deletions(-)

diff --git a/xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/utils/task/ActivityTask.java b/xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/utils/task/ActivityTask.java
index 2b52750..dcfab1b 100644
--- a/xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/utils/task/ActivityTask.java
+++ b/xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/utils/task/ActivityTask.java
@@ -56,182 +56,7 @@
 
     @Scheduled(cron = "0 0/1 * * * *")
     public void taskOrder1() {
-        List<XpActivity> list = xpActicityService.list(new QueryWrapper<XpActivity>().in("status", Arrays.asList(1, 2)).eq("is_deleted", 0));
-        for (XpActivity xpActivity : list) {
-            Integer status = xpActivity.getStatus();
-            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) {
-                    List<XpActicityCoupon> acticityCoupons = xpActicityCouponService.list(new QueryWrapper<XpActicityCoupon>().eq("actitcity_strategy_id", xpActicityStrategy.getId()));
-                    List<XpCoupon> xpCoupons = xpCouponService.listByIds(acticityCoupons.stream().map(XpActicityCoupon::getCouponId).collect(Collectors.toList()));
-
-                    List<XpActicityUser> list2 = xpActicityUserService.list(new QueryWrapper<XpActicityUser>().eq("actitcity_stratege_id", xpActicityStrategy.getId()));
-                    for (XpActicityUser xpActicityUser : list2) {
-                        Integer userType = xpActicityUser.getUserType();
-                        //全部白名单用户
-                        if(1 == userType){
-                            List<XpWhitelist> list3 = xpWhitelistService.list(new QueryWrapper<XpWhitelist>().eq("is_deleted", 0).eq("status", 1));
-                            List<XpAppUserCoupon> xpAppUserCoupons = new ArrayList<>();
-                            for (XpWhitelist xpWhitelist : list3) {
-                                for (XpActicityCoupon acticityCoupon : acticityCoupons) {
-                                    XpCoupon xpCoupon = xpCoupons.stream().filter(s -> s.getId().equals(acticityCoupon.getCouponId())).findFirst().orElse(null);
-                                    if(null != xpCoupon){
-                                        XpAppUserCoupon xpAppUserCoupon = new XpAppUserCoupon();
-                                        xpAppUserCoupon.setFullMoney(xpCoupon.getConditionalAmount());
-                                        xpAppUserCoupon.setMoney(xpCoupon.getAmount());
-
-                                        Integer expireRules = xpActicityStrategy.getExpireRules();
-                                        //次日0点失效
-                                        if(1 == expireRules){
-                                            LocalDateTime now = LocalDateTime.now();
-                                            LocalDateTime localDateTime = now.plusDays(1);
-                                            LocalDateTime localDateTime1 = localDateTime.withHour(0).withMinute(0).withSecond(0);
-                                            xpAppUserCoupon.setExpirationTime(localDateTime1);
-                                        }
-                                        //指定有效天数
-                                        if(2 == expireRules){
-                                            LocalDateTime now = LocalDateTime.now();
-                                            xpAppUserCoupon.setExpirationTime(now.plusDays(xpActicityStrategy.getExpireDays()));
-                                        }
-                                        //指定日期失效
-                                        if(3 == expireRules){
-                                            String format = xpActicityStrategy.getExpireDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
-                                            LocalDateTime localDateTime = LocalDateTime.parse(format + " 23:59:59", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
-                                            xpAppUserCoupon.setExpirationTime(localDateTime);
-                                        }
-
-                                        xpAppUserCoupon.setCouponId(acticityCoupon.getCouponId());
-                                        xpAppUserCoupon.setAppUserId(xpWhitelist.getAppUserId());
-                                        xpAppUserCoupon.setStatus(1);
-                                        xpAppUserCoupon.setActivityId(xpActivity.getId());
-                                        xpAppUserCoupon.setCouponName(xpCoupon.getCouponName());
-                                        xpAppUserCoupon.setDeleted(false);
-                                        xpAppUserCoupon.setCreateTime(LocalDateTime.now());
-                                        xpAppUserCoupon.setUpdateTime(LocalDateTime.now());
-                                        xpAppUserCoupon.setPhone(xpWhitelist.getAccount());
-                                        xpAppUserCoupon.setTimeJson(JSON.toJSONString(xpActicityStrategy.getUsagePeriod()));
-                                        xpAppUserCoupons.add(xpAppUserCoupon);
-                                    }
-                                }
-                            }
-                            if(!xpAppUserCoupons.isEmpty()){
-                                xpAppUserCouponClient.saveBatch(xpAppUserCoupons);
-                            }
-                        }
-                        //老用户
-                        if(2 == userType || 3 == userType || 4 == userType){
-                            List<Long> longList = xpOrderClient.getUserTypeIdList(userType).getData();
-                            List<XpAppUserCoupon> xpAppUserCoupons = new ArrayList<>();
-                            for (Long userId : longList) {
-                                UcUserInfo baseUserByUid = userResourcesClient.getBaseUserByUid(userId.toString());
-                                for (XpActicityCoupon acticityCoupon : acticityCoupons) {
-                                    XpCoupon xpCoupon = xpCoupons.stream().filter(s -> s.getId().equals(acticityCoupon.getCouponId())).findFirst().orElse(null);
-                                    if(null != xpCoupon){
-                                        XpAppUserCoupon xpAppUserCoupon = new XpAppUserCoupon();
-                                        xpAppUserCoupon.setFullMoney(xpCoupon.getConditionalAmount());
-                                        xpAppUserCoupon.setMoney(xpCoupon.getAmount());
-
-                                        Integer expireRules = xpActicityStrategy.getExpireRules();
-                                        //次日0点失效
-                                        if(1 == expireRules){
-                                            LocalDateTime now = LocalDateTime.now();
-                                            LocalDateTime localDateTime = now.plusDays(1);
-                                            LocalDateTime localDateTime1 = localDateTime.withHour(0).withMinute(0).withSecond(0);
-                                            xpAppUserCoupon.setExpirationTime(localDateTime1);
-                                        }
-                                        //指定有效天数
-                                        if(2 == expireRules){
-                                            LocalDateTime now = LocalDateTime.now();
-                                            xpAppUserCoupon.setExpirationTime(now.plusDays(xpActicityStrategy.getExpireDays()));
-                                        }
-                                        //指定日期失效
-                                        if(3 == expireRules){
-                                            String format = xpActicityStrategy.getExpireDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
-                                            LocalDateTime localDateTime = LocalDateTime.parse(format + " 23:59:59", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
-                                            xpAppUserCoupon.setExpirationTime(localDateTime);
-                                        }
-
-                                        xpAppUserCoupon.setCouponId(acticityCoupon.getCouponId());
-                                        xpAppUserCoupon.setAppUserId(userId);
-                                        xpAppUserCoupon.setStatus(1);
-                                        xpAppUserCoupon.setActivityId(xpActivity.getId());
-                                        xpAppUserCoupon.setCouponName(xpCoupon.getCouponName());
-                                        xpAppUserCoupon.setDeleted(false);
-                                        xpAppUserCoupon.setCreateTime(LocalDateTime.now());
-                                        xpAppUserCoupon.setUpdateTime(LocalDateTime.now());
-                                        xpAppUserCoupon.setPhone(baseUserByUid.getMobile());
-                                        xpAppUserCoupon.setTimeJson(JSON.toJSONString(xpActicityStrategy.getUsagePeriod()));
-                                        xpAppUserCoupons.add(xpAppUserCoupon);
-                                    }
-                                }
-                            }
-                            if(!xpAppUserCoupons.isEmpty()){
-                                xpAppUserCouponClient.saveBatch(xpAppUserCoupons);
-                            }
-                        }
-                        //指定用户
-                        if(5 == userType){
-                            List<Long> userList = xpActicityUser.getUserList();
-                            List<XpAppUserCoupon> xpAppUserCoupons = new ArrayList<>();
-                            for (Long 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);
-                                    if(null != xpCoupon){
-                                        XpAppUserCoupon xpAppUserCoupon = new XpAppUserCoupon();
-                                        xpAppUserCoupon.setFullMoney(xpCoupon.getConditionalAmount());
-                                        xpAppUserCoupon.setMoney(xpCoupon.getAmount());
-
-                                        Integer expireRules = xpActicityStrategy.getExpireRules();
-                                        //次日0点失效
-                                        if(1 == expireRules){
-                                            LocalDateTime now = LocalDateTime.now();
-                                            LocalDateTime localDateTime = now.plusDays(1);
-                                            LocalDateTime localDateTime1 = localDateTime.withHour(0).withMinute(0).withSecond(0);
-                                            xpAppUserCoupon.setExpirationTime(localDateTime1);
-                                        }
-                                        //指定有效天数
-                                        if(2 == expireRules){
-                                            LocalDateTime now = LocalDateTime.now();
-                                            xpAppUserCoupon.setExpirationTime(now.plusDays(xpActicityStrategy.getExpireDays()));
-                                        }
-                                        //指定日期失效
-                                        if(3 == expireRules){
-                                            String format = xpActicityStrategy.getExpireDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
-                                            LocalDateTime localDateTime = LocalDateTime.parse(format + " 23:59:59", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
-                                            xpAppUserCoupon.setExpirationTime(localDateTime);
-                                        }
-
-                                        xpAppUserCoupon.setCouponId(acticityCoupon.getCouponId());
-                                        xpAppUserCoupon.setAppUserId(userId);
-                                        xpAppUserCoupon.setStatus(1);
-                                        xpAppUserCoupon.setActivityId(xpActivity.getId());
-                                        xpAppUserCoupon.setCouponName(xpCoupon.getCouponName());
-                                        xpAppUserCoupon.setDeleted(false);
-                                        xpAppUserCoupon.setCreateTime(LocalDateTime.now());
-                                        xpAppUserCoupon.setUpdateTime(LocalDateTime.now());
-                                        xpAppUserCoupon.setPhone(baseUserByUid.getMobile());
-                                        xpAppUserCoupon.setTimeJson(JSON.toJSONString(xpActicityStrategy.getUsagePeriod()));
-                                        xpAppUserCoupons.add(xpAppUserCoupon);
-                                    }
-                                }
-                            }
-                            if(!xpAppUserCoupons.isEmpty()){
-                                xpAppUserCouponClient.saveBatch(xpAppUserCoupons);
-                            }
-                        }
-                    }
-
-                }
-
-            }else if(2 == status & LocalDateTime.now().isAfter(xpActivity.getEndTime())){
-                xpActivity.setStatus(3);
-            }
-            xpActicityService.updateById(xpActivity);
-        }
+        xpActicityService.updateStatus();
     }
 
 

--
Gitblit v1.7.1