BUGFIX:design;

This commit is contained in:
shahaibo
2024-05-24 15:18:01 +08:00
parent 02b3a407a9
commit 37de7d9276

View File

@@ -300,7 +300,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
//generate转化为collection(生成)
saveCollectionElemntsByGenerates(elementVO, collectionId);
//保存颜色版
List<CollectionElementVO> colorElementList = collectionElementService.saveColorBoard(designDTO.getColorBoards(), collectionId, designDTO.getTimeZone());
collectionElementService.saveColorBoard(designDTO.getColorBoards(), collectionId, designDTO.getTimeZone());
//保存design
Long designId = saveOne(designDTO, collectionId, userInfo.getId());
//计算library
@@ -725,8 +725,10 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
DesignCollectionDTO designCollectionDTO = CopyUtil.copyObject(reDesignDTO, DesignCollectionDTO.class);
ValidateElementVO elementVO = collectionElementService.validateElement(designCollectionDTO);
//计算并删除对应的未关联的element
collectionElementService.batchDelete(
calculateNoRelationElement(reDesignDTO.getCollectionId(), elementVO.getUsedElementIds()));
List<Long> longs = calculateNoRelationElement(reDesignDTO.getCollectionId(), elementVO.getUsedElementIds());
if (!CollectionUtils.isEmpty(longs)) {
collectionElementService.batchDelete(longs);
}
Design oldDesign = selectByCollectionId(reDesignDTO.getCollectionId());
//删除老的关联的design
deleteByCollectionId(reDesignDTO.getCollectionId());
@@ -740,7 +742,8 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
private List<Long> calculateNoRelationElement(Long collectionId, List<Long> usedElementIds) {
List<CollectionElement> collectionElements = collectionElementService.getByCollectionId(collectionId);
if (CollectionUtils.isEmpty(collectionElements)) {
throw new BusinessException("get collection elements cannot be empty");
// throw new BusinessException("get collection elements cannot be empty");
return new ArrayList<>();
}
if (CollectionUtils.isEmpty(usedElementIds)) {
return collectionElements.stream().map(CollectionElement::getId).collect(Collectors.toList());