|
@@ -1789,6 +1789,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
public boolean goodsCopyOne(GoodsBatchCopyTenantBo bo){
|
|
|
|
|
|
log.info("一建商品复制开始:"+ DateUtils.getTime());
|
|
@@ -4882,6 +4883,71 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
return baseMapper.queryGoodsByIdTenant(goodsId,tenantId);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public boolean goodsHandoutsCopyAddTenant(GoodsHandoutsCopyTenantBo bo) {
|
|
|
+ CourseHandouts handouts = iCourseHandoutsService.getById(bo.getHandoutsId());
|
|
|
+ if (ObjectUtils.isNull(handouts)){
|
|
|
+ throw new CustomException("讲义不存在,请检查!");
|
|
|
+ }
|
|
|
+ List<SysGoodsCopyRecord> array = new ArrayList<>();
|
|
|
+
|
|
|
+ Long oldId = handouts.getHandoutsId();
|
|
|
+ Goods goods = getById(bo.getGoodsId());
|
|
|
+ for (Long tenantId : bo.getTenantId()) {
|
|
|
+ //讲义复制
|
|
|
+ Goods goodsTwo = baseMapper.getGoodsByTenantTwo(goods.getGoodsName(), goods.getCode(), tenantId);
|
|
|
+ if (ObjectUtils.isNull(goodsTwo)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ List<Long> goodsIds = iCourseHandoutsService.getGoodsIds(goodsTwo.getHandoutsId(),tenantId);
|
|
|
+ if (goodsIds.stream().allMatch(x -> x.equals(goodsTwo.getGoodsId()))){
|
|
|
+ //删除讲义
|
|
|
+ iCourseHandoutsService.removeHandouts(goodsTwo.getHandoutsId(),tenantId);
|
|
|
+ }
|
|
|
+
|
|
|
+ //新增
|
|
|
+ handouts.setHandoutsId(null);
|
|
|
+ handouts.setTenantId(tenantId);
|
|
|
+ iCourseHandoutsService.save(handouts);
|
|
|
+ Long newId = handouts.getHandoutsId();
|
|
|
+
|
|
|
+ //业务层次
|
|
|
+ List<CourseHandoutsBusiness> list = iCourseHandoutsBusinessService
|
|
|
+ .list(new LambdaQueryWrapper<CourseHandoutsBusiness>()
|
|
|
+ .eq(CourseHandoutsBusiness::getHandoutsId, oldId));
|
|
|
+ if (CollectionUtils.isNotEmpty(list)){
|
|
|
+ List<CourseHandoutsBusiness> collect = list.stream().map(business -> {
|
|
|
+ business.setId(null);
|
|
|
+ business.setTenantId(tenantId);
|
|
|
+ //项目
|
|
|
+ business.setEducationId(getNewEducationTypeId(business.getEducationId(), tenantId,array));
|
|
|
+ //业务
|
|
|
+ business.setBusinessId(getNewBusinessId(business.getBusinessId(), tenantId,array));
|
|
|
+ //科目
|
|
|
+ business.setSubjectId(getNewSubjectId(business.getSubjectId(), tenantId,array));
|
|
|
+ //讲义
|
|
|
+ business.setHandoutsId(newId);
|
|
|
+ return business;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ iCourseHandoutsBusinessService.saveBatch(collect);
|
|
|
+ }
|
|
|
+
|
|
|
+ //讲义文件
|
|
|
+ List<CourseFile> courseFileList = iCourseFileService.list(new LambdaQueryWrapper<CourseFile>().eq(CourseFile::getHandoutsId, oldId).eq(CourseFile::getStatus, 1));
|
|
|
+ if (CollectionUtils.isNotEmpty(courseFileList)){
|
|
|
+ //重新添加讲义文件
|
|
|
+ handleCourseFile(courseFileList,newId,tenantId);
|
|
|
+ }
|
|
|
+
|
|
|
+ updateHandoutsId(goodsTwo.getGoodsId(),tenantId,newId);
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void updateHandoutsId(Long goodsId, Long tenantId, Long handoutsId) {
|
|
|
+ baseMapper.updateHandoutsId(goodsId,tenantId,handoutsId);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public boolean updateGoodsRepair(UpdateGoodsRepairBo bo) {
|