From 2c0a9a5194596d05b00aa773133582fa16deb6ea Mon Sep 17 00:00:00 2001
From: yyy <1083599556@qq.com>
Date: 星期日, 17 五月 2026 17:00:21 +0800
Subject: [PATCH] 不提交

---
 xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/service/impl/XpActicityServiceImpl.java |   33 +++++++++++++++++++++++++++++----
 1 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/service/impl/XpActicityServiceImpl.java b/xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/service/impl/XpActicityServiceImpl.java
index 548274c..eb72549 100644
--- a/xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/service/impl/XpActicityServiceImpl.java
+++ b/xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/service/impl/XpActicityServiceImpl.java
@@ -155,7 +155,7 @@
         }
 
         //执行修改活动状态
-        updateStatus();
+        updateStatus(activity.getId());
     }
 
     @Override
@@ -199,6 +199,31 @@
                 .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);
     }
 
 
@@ -410,9 +435,9 @@
             }
             //指定用户
             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);
@@ -443,7 +468,7 @@
                                 }
 
                                 xpAppUserCoupon.setCouponId(acticityCoupon.getCouponId());
-                                xpAppUserCoupon.setAppUserId(userId);
+                                xpAppUserCoupon.setAppUserId(userId.longValue());
                                 xpAppUserCoupon.setStatus(1);
                                 xpAppUserCoupon.setActivityId(xpActivity.getId());
                                 xpAppUserCoupon.setCouponName(xpCoupon.getCouponName());

--
Gitblit v1.7.1