From 446d588f6983d2f9e7bb18546a961fa4c14c99a0 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期二, 19 五月 2026 03:58:31 +0800
Subject: [PATCH] 合并代码

---
 xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/service/impl/XpActicityServiceImpl.java |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 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 eb72549..8850942 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
@@ -17,6 +17,7 @@
 import com.xiaopeng.common.core.web.page.PageInfo;
 import com.xiaopeng.operation.mapper.XpActicityMapper;
 import com.xiaopeng.operation.service.*;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -38,6 +39,7 @@
  * @author mitao
  * @since 2026-02-03
  */
+@Slf4j
 @Service
 public class XpActicityServiceImpl extends ServiceImpl<XpActicityMapper, XpActivity> implements IXpActicityService {
 
@@ -265,6 +267,7 @@
      * @param xpActicityStrategy
      */
     public void pushCoupon(XpActivity xpActivity, XpActicityStrategy xpActicityStrategy){
+        log.info("发放优惠券:{}", JSON.toJSONString(xpActivity));
         List<XpActicityCoupon> acticityCoupons = xpActicityCouponService.list(new QueryWrapper<XpActicityCoupon>().eq("acticity_strategy_id", xpActicityStrategy.getId()));
         List<XpCoupon> xpCoupons = xpCouponService.listByIds(acticityCoupons.stream().map(XpActicityCoupon::getCouponId).collect(Collectors.toList()));
         //总发放数量
@@ -276,6 +279,7 @@
             Integer userType = xpActicityUser.getUserType();
             //全部白名单用户
             if(1 == userType){
+                log.info("全部白名单用户发送");
                 List<XpWhitelist> list3 = xpWhitelistService.list(new QueryWrapper<XpWhitelist>().eq("is_deleted", 0).eq("status", 1));
                 List<XpAppUserCoupon> xpAppUserCoupons = new ArrayList<>();
                 for (XpWhitelist xpWhitelist : list3) {
@@ -351,6 +355,8 @@
                     AppUserCouponSaveBatchVo vo = new AppUserCouponSaveBatchVo();
                     vo.setXpAppUserCoupons(xpAppUserCoupons);
                     xpAppUserCouponClient.saveBatch(vo);
+
+                    log.info("全部白名单用户发送 {}", JSON.toJSONString(xpAppUserCoupons));
                 }
                 if(null == distributionsTotal){
                     continue;
@@ -362,6 +368,7 @@
             //老用户
             if(2 == userType || 3 == userType || 4 == userType){
                 List<Long> longList = xpOrderClient.getUserTypeIdList(userType).getData();
+                log.info("特定用户群体发送 {}", JSON.toJSONString(longList));
                 List<XpAppUserCoupon> xpAppUserCoupons = new ArrayList<>();
                 for (Long userId : longList) {
                     UcUserInfo baseUserByUid = userResourcesClient.getBaseUserByUid(userId.toString());
@@ -436,9 +443,13 @@
             //指定用户
             if(5 == userType){
                 List<Integer> userList = xpActicityUser.getUserList();
+                log.info("指定用户发送 {}", JSON.toJSONString(userList));
                 List<XpAppUserCoupon> xpAppUserCoupons = new ArrayList<>();
                 for (Integer userId : userList) {
-                    UcUserInfo baseUserByUid = userResourcesClient.getBaseUserByUid(userId.toString());
+                    XpWhitelist xpWhitelist = xpWhitelistService.getById(userId);
+                    if(null == xpWhitelist){
+                        continue;
+                    }
                     for (XpActicityCoupon acticityCoupon : acticityCoupons) {
                         XpCoupon xpCoupon = xpCoupons.stream().filter(s -> s.getId().equals(acticityCoupon.getCouponId())).findFirst().orElse(null);
                         if(null != xpCoupon){
@@ -468,14 +479,14 @@
                                 }
 
                                 xpAppUserCoupon.setCouponId(acticityCoupon.getCouponId());
-                                xpAppUserCoupon.setAppUserId(userId.longValue());
+                                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(baseUserByUid.getMobile());
+                                xpAppUserCoupon.setPhone(xpWhitelist.getAccount());
                                 xpAppUserCoupon.setTimeJson(JSON.toJSONString(xpActicityStrategy.getUsagePeriod()));
                                 xpAppUserCoupons.add(xpAppUserCoupon);
                                 if(null == distributionsTotal){

--
Gitblit v1.7.1