|
@@ -4899,10 +4899,25 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
if (ObjectUtils.isNull(goodsTwo)){
|
|
if (ObjectUtils.isNull(goodsTwo)){
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
- List<Long> goodsIds = iCourseHandoutsService.getGoodsIds(goodsTwo.getHandoutsId(),tenantId);
|
|
|
|
- if (goodsIds.stream().allMatch(x -> x.equals(goodsTwo.getGoodsId()))){
|
|
|
|
- //删除讲义
|
|
|
|
- iCourseHandoutsService.removeHandouts(goodsTwo.getHandoutsId(),tenantId);
|
|
|
|
|
|
+ Set<Long> goodsIds = new HashSet<>();
|
|
|
|
+ goodsIds.add(goodsTwo.getGoodsId());
|
|
|
|
+// if (goodsIds.stream().allMatch(x -> x.equals(goodsTwo.getGoodsId()))){
|
|
|
|
+// //删除讲义
|
|
|
|
+// iCourseHandoutsService.removeHandouts(goodsTwo.getHandoutsId(),tenantId);
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+ //如果存在先删除掉之前的讲义
|
|
|
|
+ List<CourseHandouts> handoutsList = iCourseHandoutsService.getHandoutsListByTenant(handouts.getEncoder(),handouts.getHandoutsName(),tenantId);
|
|
|
|
+
|
|
|
|
+ if (CollectionUtils.isNotEmpty(handoutsList)){
|
|
|
|
+ handoutsList.forEach(item -> {
|
|
|
|
+ List<Long> goodsIdsTwo = iCourseHandoutsService.getGoodsIds(item.getHandoutsId(), tenantId);
|
|
|
|
+ if (CollectionUtils.isNotEmpty(goodsIdsTwo)){
|
|
|
|
+ goodsIds.addAll(goodsIdsTwo);
|
|
|
|
+ }
|
|
|
|
+ iCourseHandoutsService.removeHandouts(item.getHandoutsId(),tenantId);
|
|
|
|
+ });
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
//新增
|
|
//新增
|
|
@@ -4939,7 +4954,9 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
handleCourseFile(courseFileList,newId,tenantId);
|
|
handleCourseFile(courseFileList,newId,tenantId);
|
|
}
|
|
}
|
|
|
|
|
|
- updateHandoutsId(goodsTwo.getGoodsId(),tenantId,newId);
|
|
|
|
|
|
+ goodsIds.forEach(goodsId -> {
|
|
|
|
+ updateHandoutsId(goodsId,tenantId,newId);
|
|
|
|
+ });
|
|
}
|
|
}
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|