wangzhijun 1 неделя назад
Родитель
Сommit
1748fa483c

+ 4 - 0
nightFragrance-massage/src/main/java/com/ylx/lottery/domain/LotteryCountLog.java

@@ -3,6 +3,7 @@ package com.ylx.lottery.domain;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.ylx.common.annotation.Excel;
 import com.ylx.common.core.domain.BaseEntity;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
@@ -49,4 +50,7 @@ public class LotteryCountLog extends BaseEntity {
     @Excel(name = "是否弹窗抽奖(0 .没有 1.有)")
     private Integer isLottery;
 
+    @ApiModelProperty("本地活动链接url")
+    private String activityUrl;
+
 }

+ 3 - 0
nightFragrance-massage/src/main/java/com/ylx/lottery/domain/vo/IsLotteryVO.java

@@ -16,4 +16,7 @@ public class IsLotteryVO implements Serializable {
     @ApiModelProperty("本地活动表ID")
     private String activityId;
 
+    @ApiModelProperty("本地活动url")
+    private String activityUrl;
+
 }

+ 3 - 0
nightFragrance-massage/src/main/java/com/ylx/lottery/domain/vo/LocalActivityTableVO.java

@@ -27,4 +27,7 @@ public class LocalActivityTableVO implements Serializable {
     @ApiModelProperty(value = "每日最大抽奖次数")
     private String qutLotteryMax;
 
+    @ApiModelProperty(value = "活动链接")
+    private String activityUrl;
+
 }

+ 3 - 0
nightFragrance-massage/src/main/java/com/ylx/lottery/domain/vo/LotteryActivityVO.java

@@ -31,6 +31,9 @@ public class LotteryActivityVO implements Serializable {
     @ApiModelProperty(value = "消费奖励 消费满几元的几次抽奖机会")
     private Integer consumeAmountLottery;
 
+    @ApiModelProperty("本地活动链接url")
+    private String activityUrl;
+
     @ApiModelProperty(value = "商品")
     private List<LotteryActivityRulesProductVO> lotteryActivityRulesProducts;
 

+ 1 - 0
nightFragrance-massage/src/main/java/com/ylx/lottery/service/impl/LotteryCountLogServiceImpl.java

@@ -67,6 +67,7 @@ public class LotteryCountLogServiceImpl extends ServiceImpl<LotteryCountLogMappe
 
         vo.setIsLottery(1);
         vo.setActivityId(lotteryCountLog.getLocalActivityTableId());
+        vo.setActivityUrl(lotteryCountLog.getActivityUrl());
 
         // 5. 如果有记录,批量更新状态为“已弹窗”
         if (CollUtil.isNotEmpty(lotteryCountLogs)) {

+ 6 - 3
nightFragrance-massage/src/main/java/com/ylx/massage/service/impl/ProductOrderInfoServiceImpl.java

@@ -896,6 +896,8 @@ public class ProductOrderInfoServiceImpl extends ServiceImpl<ProductOrderInfoMap
 
             String activityId = activity.getId();
 
+            String activityUrl = activity.getActivityUrl();
+
             // 用户获取的最大抽奖次数
             Integer productUserMaxNum = activity.getProductUserMaxNum();
 
@@ -924,7 +926,7 @@ public class ProductOrderInfoServiceImpl extends ServiceImpl<ProductOrderInfoMap
 
                             if (actualLotteryNumToGrant > 0) {
                                 // 发放计算后的数量
-                                saveLotteryLog(user, activityId, actualLotteryNumToGrant, 2);
+                                saveLotteryLog(user, activityId, activityUrl, actualLotteryNumToGrant, 2);
                             }
                             break;
                         }
@@ -978,7 +980,7 @@ public class ProductOrderInfoServiceImpl extends ServiceImpl<ProductOrderInfoMap
                     int actualLotteryNumToGrant = calculateActualGrant(hasLimit, userLotteryCount, requestedLotteryNum, productUserMaxNum);
 
                     if (actualLotteryNumToGrant > 0) {
-                        saveLotteryLog(user, activityId, actualLotteryNumToGrant, 3);
+                        saveLotteryLog(user, activityId, activityUrl, actualLotteryNumToGrant, 3);
                     }
                 }
             }
@@ -1008,7 +1010,7 @@ public class ProductOrderInfoServiceImpl extends ServiceImpl<ProductOrderInfoMap
     /**
      * 统一保存抽奖次数日志
      */
-    private void saveLotteryLog(TWxUser user, String activityId, Integer lotteryNum, Integer activityType) {
+    private void saveLotteryLog(TWxUser user, String activityId, String activityUrl, Integer lotteryNum, Integer activityType) {
         LotteryCountLog log = new LotteryCountLog();
         log.setOpenId(user.getcOpenid());
         log.setUserId(user.getId());
@@ -1021,6 +1023,7 @@ public class ProductOrderInfoServiceImpl extends ServiceImpl<ProductOrderInfoMap
         log.setStatus(0); // 未同步
         log.setIsLottery(0);
         log.setType(2);
+        log.setActivityUrl(activityUrl);
         lotteryCountLogService.save(log);
     }
 

+ 4 - 0
nightFragrance-massage/src/main/java/com/ylx/massage/service/impl/TCommentUserServiceImpl.java

@@ -155,9 +155,12 @@ public class TCommentUserServiceImpl extends ServiceImpl<TCommentUserMapper, TCo
                 continue;
             }
 
+            String activityUrl = activity.getActivityUrl();
+
             // 类型=4 → 评价有礼
             for (LocalActivityTableVO table : localTables) {
                 if (ObjectUtil.equals(table.getType(), "4")) {
+                    table.setActivityUrl(activityUrl);
                     saveLotteryLog(wxLoginUser, table, 1);
                 }
             }
@@ -180,6 +183,7 @@ public class TCommentUserServiceImpl extends ServiceImpl<TCommentUserMapper, TCo
         log.setStatus(0); // 未同步
         log.setIsLottery(0);
         log.setType(3);
+        log.setActivityUrl(table.getActivityUrl());
         lotteryCountLogService.save(log);
     }
 

+ 10 - 6
nightFragrance-massage/src/main/java/com/ylx/massage/service/impl/TOrderServiceImpl.java

@@ -1476,6 +1476,8 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
 
             String activityId = activity.getId();
 
+            String activityUrl = activity.getActivityUrl();
+
             // 用户获取的最大抽奖次数
             Integer productUserMaxNum = activity.getProductUserMaxNum();
 
@@ -1504,7 +1506,7 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
 
                             if (actualLotteryNumToGrant > 0) {
                                 // 发放计算后的数量
-                                saveLotteryLog(user, activityId, actualLotteryNumToGrant, 2);
+                                saveLotteryLog(user, activityId, activityUrl, actualLotteryNumToGrant, 2);
                             }
                             break;
                         }
@@ -1558,7 +1560,7 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
                     int actualLotteryNumToGrant = calculateActualGrant(hasLimit, userLotteryCount, requestedLotteryNum, productUserMaxNum);
 
                     if (actualLotteryNumToGrant > 0) {
-                        saveLotteryLog(user, activityId, actualLotteryNumToGrant, 3);
+                        saveLotteryLog(user, activityId, activityUrl, actualLotteryNumToGrant, 3);
                     }
                 }
             }
@@ -1588,7 +1590,7 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
     /**
      * 统一保存抽奖次数日志
      */
-    private void saveLotteryLog(TWxUser user, String activityId, Integer lotteryNum, Integer activityType) {
+    private void saveLotteryLog(TWxUser user, String activityId, String activityUrl, Integer lotteryNum, Integer activityType) {
         LotteryCountLog log = new LotteryCountLog();
         log.setOpenId(user.getcOpenid());
         log.setUserId(user.getId());
@@ -1601,15 +1603,17 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
         log.setStatus(0); // 未同步
         log.setIsLottery(0);
         log.setType(1);
+        log.setActivityUrl(activityUrl);
         lotteryCountLogService.save(log);
     }
 
     /**
      * 根据已有次数、请求发放次数和最大次数限制,计算实际可发放的次数
-     * @param hasLimit 是否有限制
-     * @param currentCount 当前已获得次数
+     *
+     * @param hasLimit       是否有限制
+     * @param currentCount   当前已获得次数
      * @param requestedCount 请求发放次数
-     * @param maxCount 最大次数限制
+     * @param maxCount       最大次数限制
      * @return 实际可发放次数
      */
     private int calculateActualGrant(boolean hasLimit, Integer currentCount, Integer requestedCount, Integer maxCount) {