Prechádzať zdrojové kódy

删除抽奖配置;复制直播间优化

yuhongqi 1 deň pred
rodič
commit
2b493cc7ef

+ 4 - 4
fs-admin/src/main/java/com/fs/live/controller/LiveLotteryConfController.java

@@ -112,10 +112,10 @@ public class LiveLotteryConfController extends BaseController
     }
 
 //    @PreAuthorize("@ss.hasPermi('live:liveLotteryConf:remove')")
-    @DeleteMapping("/{id}")
-    public void delete(@PathVariable Long id) {
-        liveLotteryConfService.delete(id);
-    }
+//    @DeleteMapping("/{id}")
+//    public void delete(@PathVariable Long id) {
+//        liveLotteryConfService.delete(id);
+//    }
 
     /**
      * 发起抽奖

+ 4 - 4
fs-company/src/main/java/com/fs/company/controller/live/LiveLotteryConfController.java

@@ -113,10 +113,10 @@ public class LiveLotteryConfController extends BaseController
     }
 
 //    @PreAuthorize("@ss.hasPermi('live:liveLotteryConf:remove')")
-    @DeleteMapping("/{id}")
-    public void delete(@PathVariable Long id) {
-        liveLotteryConfService.delete(id);
-    }
+//    @DeleteMapping("/{id}")
+//    public void delete(@PathVariable Long id) {
+//        liveLotteryConfService.delete(id);
+//    }
 
     /**
      * 发起抽奖

+ 20 - 13
fs-service-system/src/main/java/com/fs/live/service/impl/LiveServiceImpl.java

@@ -723,7 +723,12 @@ public class LiveServiceImpl implements ILiveService
         // 运营自动化
         List<LiveAutoTask> liveAutoTasksList = liveAutoTaskService.selectLiveAutoTaskByLiveId(existLiveId);
         List<LiveAutoTask> barrageTask = liveAutoTasksList.stream().filter(liveAutoTask -> liveAutoTask.getTaskType() == 3L).collect(Collectors.toList());
-        List<LiveAutoTask> goodsTask = liveAutoTasksList.stream().filter(liveAutoTask -> liveAutoTask.getTaskType() == 1L).collect(Collectors.toList());
+        Map<Long, LiveAutoTask> goodsMap = liveAutoTasksList.stream()
+                .filter(liveAutoTask -> liveAutoTask.getTaskType() == 1L)
+                .collect(Collectors.toMap(liveAutoTask -> {
+                            return parseIdFromContent(liveAutoTask.getContent(),"goodsId");
+                        }, liveAutoTask -> liveAutoTask, (existing, replacement) -> replacement
+                ));
         Map<Long, LiveAutoTask> redMap = liveAutoTasksList.stream()
                 .filter(liveAutoTask -> liveAutoTask.getTaskType() == 2L)
                 .collect(Collectors.toMap(liveAutoTask -> {
@@ -736,18 +741,6 @@ public class LiveServiceImpl implements ILiveService
                     return parseIdFromContent(liveAutoTask.getContent(),"lotteryId");
                         }, liveAutoTask -> liveAutoTask, (existing, replacement) -> replacement
                 ));
-        if (!goodsTask.isEmpty()) {
-            LiveAutoTask liveAutoTaskEntity = new LiveAutoTask();
-            for (LiveAutoTask liveAutoTask : goodsTask) {
-                BeanUtils.copyBeanProp(liveAutoTaskEntity, liveAutoTask);
-                liveAutoTaskEntity.setId(null);
-                liveAutoTaskEntity.setLiveId(newLiveId);
-                liveAutoTaskEntity.setCreateTime(now);
-                liveAutoTaskEntity.setUpdateTime(now);
-                liveAutoTaskEntity.setFinishStatus(0L);
-                liveAutoTaskService.copyInsertLiveAutoTask(liveAutoTaskEntity,liveEntity);
-            }
-        }
         if (!barrageTask.isEmpty()) {
             LiveAutoTask liveAutoTaskEntity = new LiveAutoTask();
             for (LiveAutoTask liveAutoTask : barrageTask) {
@@ -831,9 +824,23 @@ public class LiveServiceImpl implements ILiveService
                 liveGoodsEntity.setCompanyId(live.getCompanyId());
                 liveGoodsEntity.setCompanyUserId(live.getCompanyUserId());
                 liveGoodsService.insertLiveGoods(liveGoodsEntity);
+                // 优惠券
                 if (collect.containsKey(liveGoods.getGoodsId())) {
                     liveCouponIssueRelations.stream().filter(relation -> relation.getGoodsId().equals(liveGoods.getGoodsId())).findFirst().ifPresent(liveCouponIssueRelation -> liveCouponIssueRelation.setGoodsId(liveGoodsEntity.getGoodsId()));
                 }
+                // 直播商品task
+                if (goodsMap.containsKey(liveGoods.getGoodsId())) {
+                    LiveAutoTask liveAutoTaskEntity = new LiveAutoTask();
+                    LiveAutoTask liveAutoTask = goodsMap.get(liveGoods.getGoodsId());
+                    BeanUtils.copyBeanProp(liveAutoTaskEntity, liveAutoTask);
+                    liveAutoTaskEntity.setId(null);
+                    liveAutoTaskEntity.setLiveId(newLiveId);
+                    liveAutoTaskEntity.setCreateTime(now);
+                    liveAutoTaskEntity.setUpdateTime(now);
+                    liveAutoTaskEntity.setFinishStatus(0L);
+                    liveAutoTaskEntity.setContent(JSON.toJSONString(liveGoodsEntity));
+                    liveAutoTaskService.copyInsertLiveAutoTask(liveAutoTaskEntity,liveEntity);
+                }
             }
         }
         for (LiveCouponIssueRelation liveCouponIssueRelation : liveCouponIssueRelations) {