浏览代码

优惠券查询

yuhongqi 1 周之前
父节点
当前提交
b7c486e027

+ 5 - 1
fs-live-socket/src/main/java/com/fs/live/websocket/service/WebSocketServer.java

@@ -579,7 +579,11 @@ public class WebSocketServer {
                     log.error("优惠券状态已经关闭");
                     return;
                 }
-                LiveCouponIssue liveCouponIssue = liveCouponIssueService.selectLiveCouponIssueByCouponId(liveCoupon.getCouponId());
+                if (liveCoupon.getIssueId() == null) {
+                    log.error("优惠券未发布");
+                    return;
+                }
+                LiveCouponIssue liveCouponIssue = liveCouponIssueService.selectLiveCouponIssueByCouponId(liveCoupon.getIssueId());
                 LiveCouponIssueRelation relation = liveCouponMapper.selectCouponRelation(task.getLiveId(), liveCouponIssue.getId());
                 HashMap<String, Object> data = new HashMap<>();
                 data.put("liveId", task.getLiveId());

+ 1 - 0
fs-service-system/src/main/java/com/fs/live/domain/LiveCoupon.java

@@ -72,6 +72,7 @@ public class LiveCoupon extends BaseEntity
     private Long goodsId;
     private String productName;
     private String image;
+    private Long issueId;
 
     /** 单场直播可使用优惠券数量 */
     @Excel(name = "单场直播可使用优惠券数量")

+ 2 - 0
fs-service-system/src/main/java/com/fs/live/service/impl/LiveAutoTaskServiceImpl.java

@@ -155,6 +155,7 @@ public class LiveAutoTaskServiceImpl implements ILiveAutoTaskService {
             if(liveCouponIssueRelation == null) return R.error("优惠券尚未添加在直播间");
             if(ObjectUtil.isEmpty(liveCouponIssueRelation.getGoodsId())) return R.error("未绑定商品,无法制定自动化任务!");
             liveCoupon.setGoodsId(liveCouponIssueRelation.getGoodsId());
+            liveCoupon.setIssueId(liveCouponIssueRelation.getCouponIssueId());
             liveAutoTask.setContent(JSON.toJSONString(liveCoupon));
             baseMapper.insertLiveAutoTask(liveAutoTask);
         } else if (liveAutoTask.getTaskType() == 6L) {
@@ -292,6 +293,7 @@ public class LiveAutoTaskServiceImpl implements ILiveAutoTaskService {
             if(liveCouponIssueRelation == null) return R.error("优惠券尚未添加在直播间");
             if(ObjectUtil.isEmpty(liveCouponIssueRelation.getGoodsId())) return R.error("未绑定商品,无法制定自动化任务!");
             liveCoupon.setGoodsId(liveCouponIssueRelation.getGoodsId());
+            liveCoupon.setIssueId(liveCouponIssueRelation.getCouponIssueId());
             liveAutoTask.setContent(JSON.toJSONString(liveCoupon));
             baseMapper.updateLiveAutoTask(liveAutoTask);
         } else if (liveAutoTask.getTaskType() == 6L) {