|
@@ -157,6 +157,8 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
private ICourseHandoutsService iCourseHandoutsService;
|
|
|
@Autowired
|
|
|
private ICourseHandoutsBusinessService iCourseHandoutsBusinessService;
|
|
|
+ @Autowired
|
|
|
+ private ICourseFileService iCourseFileService;
|
|
|
|
|
|
@Autowired
|
|
|
private ICourseEducationTierService iCourseEducationTierService;
|
|
@@ -1518,10 +1520,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
if (ObjectUtil.isNotNull(courseHandouts)){
|
|
|
Long oid = courseHandouts.getHandoutsId();
|
|
|
Long newId = getNewIdByTenant(oid, GoodsCopyEnum.COURSE_HANDOUTS.getType(),newTenantId);
|
|
|
-// CourseHandouts newCourseHandouts = iCourseHandoutsService.getHandoutsByTenant(courseHandouts.getEncoder(),newTenantId);
|
|
|
- if (ObjectUtil.isNotNull(newId)){
|
|
|
- goods.setHandoutsId(newId);
|
|
|
- }else {
|
|
|
+ if (ObjectUtil.isNull(newId)){
|
|
|
//讲义业务层次
|
|
|
List<CourseHandoutsBusiness> handoutsBusinessList = iCourseHandoutsBusinessService
|
|
|
.list(new LambdaQueryWrapper<CourseHandoutsBusiness>()
|
|
@@ -1529,6 +1528,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
courseHandouts.setHandoutsId(null);
|
|
|
courseHandouts.setTenantId(newTenantId);
|
|
|
iCourseHandoutsService.save(courseHandouts);
|
|
|
+ newId = courseHandouts.getHandoutsId();
|
|
|
addSysGoodsRecord(oid,courseHandouts.getHandoutsId(),GoodsCopyEnum.COURSE_HANDOUTS.getType(),newTenantId,recordList);
|
|
|
goods.setHandoutsId(courseHandouts.getHandoutsId());
|
|
|
if (CollectionUtils.isNotEmpty(handoutsBusinessList)){
|
|
@@ -1548,6 +1548,14 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
iCourseHandoutsBusinessService.saveBatch(collect);
|
|
|
}
|
|
|
}
|
|
|
+ goods.setHandoutsId(newId);
|
|
|
+ //讲义文件
|
|
|
+ iCourseFileService.deleteByTenant(newId,newTenantId);
|
|
|
+ List<CourseFile> courseFileList = iCourseFileService.list(new LambdaQueryWrapper<CourseFile>().eq(CourseFile::getHandoutsId, oid).eq(CourseFile::getStatus, 1));
|
|
|
+ if (CollectionUtils.isNotEmpty(courseFileList)){
|
|
|
+ //重新添加讲义文件
|
|
|
+ handleCourseFile(courseFileList,newId,newTenantId);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1751,6 +1759,36 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ private void handleCourseFile(List<CourseFile> courseFileList, Long newId, Long newTenantId) {
|
|
|
+ //父级
|
|
|
+ List<CourseFile> collect = courseFileList.stream().filter(x -> ObjectUtils.isNull(x.getParentId()) || x.getParentId() == 0).collect(Collectors.toList());
|
|
|
+ List<CourseFile> collect1 = courseFileList.stream().filter(x -> ObjectUtils.isNotNull(x.getParentId()) && x.getParentId() != 0).collect(Collectors.toList());
|
|
|
+ for (CourseFile item : collect) {
|
|
|
+ item.setOldId(item.getFileId());
|
|
|
+ item.setFileId(null);
|
|
|
+ item.setHandoutsId(newId);
|
|
|
+ item.setTenantId(newTenantId);
|
|
|
+ iCourseFileService.save(item);
|
|
|
+ recursionHandle(item,collect1,newId,newTenantId);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void recursionHandle(CourseFile file, List<CourseFile> courseFiles, Long newId, Long newTenantId) {
|
|
|
+ List<CourseFile> collect = courseFiles.stream().filter(x -> x.getParentId().equals(file.getOldId())).collect(Collectors.toList());
|
|
|
+ if (CollectionUtils.isNotEmpty(collect)){
|
|
|
+ for (CourseFile courseFile : collect) {
|
|
|
+ courseFile.setOldId(courseFile.getFileId());
|
|
|
+ courseFile.setFileId(null);
|
|
|
+ courseFile.setHandoutsId(newId);
|
|
|
+ courseFile.setTenantId(newTenantId);
|
|
|
+ courseFile.setParentId(file.getFileId());
|
|
|
+ iCourseFileService.save(courseFile);
|
|
|
+ recursionHandle(courseFile,courseFiles,newId,newTenantId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public boolean goodsCopyOne(GoodsBatchCopyTenantBo bo){
|
|
|
|
|
|
log.info("一建商品复制开始:"+ DateUtils.getTime());
|