Selaa lähdekoodia

空指针逻辑修复

yuhongqi 1 kuukausi sitten
vanhempi
commit
5116151636

+ 1 - 4
fs-service-system/src/main/java/com/fs/live/service/impl/LiveServiceImpl.java

@@ -708,7 +708,6 @@ public class LiveServiceImpl implements ILiveService
         liveDataService.insertLiveData(liveData);
         // 优惠券
         List<LiveCouponIssueRelation> liveCouponIssueRelations = liveCouponIssueMapper.selectRelationByLiveId(existLiveId);
-        Map<Long, LiveCouponIssueRelation> collect = liveCouponIssueRelations.stream().collect(Collectors.toMap(LiveCouponIssueRelation::getGoodsId, Function.identity(), (existing, replacement) -> existing));
         // 直播视频
         List<LiveVideo> liveVideos = liveVideoService.selectLiveVideosByLiveId(existLiveId);
         if (!liveVideos.isEmpty()) {
@@ -822,9 +821,7 @@ public class LiveServiceImpl implements ILiveService
                 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()));
-                }
+                liveCouponIssueRelations.stream().filter(relation -> liveGoods.getGoodsId().equals(relation.getGoodsId())).findFirst().ifPresent(liveCouponIssueRelation -> liveCouponIssueRelation.setGoodsId(liveGoodsEntity.getGoodsId()));
                 LiveAutoTask liveAutoTask = goodsTaskList.stream().filter(item -> parseIdFromContent(item.getContent(), "goodsId").equals(liveGoods.getGoodsId())).findFirst().orElse(null);
                 if(liveAutoTask == null) continue;
                 liveGoods.setGoodsId(liveGoodsEntity.getGoodsId());