From 37de7d927613068a2fa29fa67d60d39c4784ff3d Mon Sep 17 00:00:00 2001 From: shahaibo <1023316923@qq.com> Date: Fri, 24 May 2024 15:18:01 +0800 Subject: [PATCH] BUGFIX:design; --- .../com/ai/da/service/impl/DesignServiceImpl.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/ai/da/service/impl/DesignServiceImpl.java b/src/main/java/com/ai/da/service/impl/DesignServiceImpl.java index f5fe6222..05365f52 100644 --- a/src/main/java/com/ai/da/service/impl/DesignServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/DesignServiceImpl.java @@ -300,7 +300,7 @@ public class DesignServiceImpl extends ServiceImpl impleme //generate转化为collection(生成) saveCollectionElemntsByGenerates(elementVO, collectionId); //保存颜色版 - List 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 impleme DesignCollectionDTO designCollectionDTO = CopyUtil.copyObject(reDesignDTO, DesignCollectionDTO.class); ValidateElementVO elementVO = collectionElementService.validateElement(designCollectionDTO); //计算并删除对应的未关联的element - collectionElementService.batchDelete( - calculateNoRelationElement(reDesignDTO.getCollectionId(), elementVO.getUsedElementIds())); + List 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 impleme private List calculateNoRelationElement(Long collectionId, List usedElementIds) { List 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());