浏览代码

1、调整领取核销卷没有核销码问题

yys 4 天之前
父节点
当前提交
a22ace3add
共有 1 个文件被更改,包括 12 次插入0 次删除
  1. 12 0
      fs-service/src/main/java/com/fs/live/service/impl/LiveCouponUserServiceImpl.java

+ 12 - 0
fs-service/src/main/java/com/fs/live/service/impl/LiveCouponUserServiceImpl.java

@@ -3,6 +3,7 @@ package com.fs.live.service.impl;
 import java.util.Collections;
 import java.util.List;
 import com.fs.common.utils.DateUtils;
+import com.fs.common.utils.StringUtils;
 import com.fs.live.param.CouponPO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -57,9 +58,20 @@ public class LiveCouponUserServiceImpl implements ILiveCouponUserService
     public int insertLiveCouponUser(LiveCouponUser liveCouponUser)
     {
         liveCouponUser.setCreateTime(DateUtils.getNowDate());
+        // 所有发放入口统一保证核销码落库(完课/观看奖励等历史路径曾漏写)
+        if (StringUtils.isEmpty(liveCouponUser.getVerifyCode())) {
+            liveCouponUser.setVerifyCode(generateVerifyCode());
+        }
         return liveCouponUserMapper.insertLiveCouponUser(liveCouponUser);
     }
 
+    /**
+     * 生成优惠券核销码(前缀 LC + 时间戳 + 随机数)。
+     */
+    private String generateVerifyCode() {
+        return "LC" + System.currentTimeMillis() + (int) (Math.random() * 1000);
+    }
+
     /**
      * 修改优惠券发放记录
      *