diff --git a/src/main/java/com/ai/da/controller/SavedCollectionController.java b/src/main/java/com/ai/da/controller/SavedCollectionController.java index 228646dc..76addf89 100644 --- a/src/main/java/com/ai/da/controller/SavedCollectionController.java +++ b/src/main/java/com/ai/da/controller/SavedCollectionController.java @@ -104,9 +104,9 @@ public class SavedCollectionController { } List groupIds = page.getRecords().stream().map(UserLikeGroup::getId).collect(Collectors.toList()); List groupDetails = userLikeService.getGroupDetails(groupIds); - if (CollectionUtils.isEmpty(groupDetails)) { - throw new BusinessException("groupDetails.not.found"); - } +// if (CollectionUtils.isEmpty(groupDetails)) { +// throw new BusinessException("groupDetails.not.found"); +// } Map> groupDetailMap = groupDetails.stream() .collect(Collectors.groupingBy(UserLikeVO::getUserLikeGroupId)); @@ -117,13 +117,17 @@ public class SavedCollectionController { userLikeGroupVO.setUpdateDate(group.getUpdateDate().getTime()); userLikeGroupVO.setAuthor(account.getUserName()); //count 和detail - List details = groupDetailMap.get(group.getId()); - for (UserLikeVO detail : details) { - TDesignPythonOutfit tDesignPythonOutfit = designPythonOutfitMapper.selectById(detail.getDesignOutfitId()); - detail.setUrl(minioUtil.getPreSignedUrl(tDesignPythonOutfit.getDesignUrl(), 24 * 60)); + if (groupDetailMap.keySet().contains(group.getId())) { + List details = groupDetailMap.get(group.getId()); + for (UserLikeVO detail : details) { + TDesignPythonOutfit tDesignPythonOutfit = designPythonOutfitMapper.selectById(detail.getDesignOutfitId()); + detail.setUrl(minioUtil.getPreSignedUrl(tDesignPythonOutfit.getDesignUrl(), 24 * 60)); + } + userLikeGroupVO.setGroupDetails(details); + userLikeGroupVO.setSketchCount(CollectionUtils.isEmpty(details) ? 0 : details.size()); + }else { + userLikeGroupVO.setSketchCount(0); } - userLikeGroupVO.setGroupDetails(details); - userLikeGroupVO.setSketchCount(CollectionUtils.isEmpty(details) ? 0 : details.size()); if (userLikeGroupVO.getOriginal() == 0) { userLikeGroupVO.setOriginalAccountName(accountService.getById(userLikeGroupVO.getOriginalAccountId()).getUserName()); Portfolio byId = portfolioService.getByIdAll(userLikeGroupVO.getOriginalPortfolioId()); 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 7f779570..35e0220b 100644 --- a/src/main/java/com/ai/da/service/impl/DesignServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/DesignServiceImpl.java @@ -813,9 +813,9 @@ public class DesignServiceImpl extends ServiceImpl impleme // return new DesignLikeVO(); // } List oldElements = collectionElementService.getByCollectionId(userLikeGroup.getCollectionId()); - if (CollectionUtil.isEmpty(oldElements)) { - throw new BusinessException("old.elements.not.found"); - } +// if (CollectionUtil.isEmpty(oldElements)) { +// throw new BusinessException("old.elements.not.found"); +// } List designItemDetails = designItemDetailService.selectByDesignItemId(designLikeDTO.getDesignItemId()); if (CollectionUtil.isEmpty(designItemDetails)) { throw new BusinessException("new.designItemDetails.not.found"); @@ -867,8 +867,11 @@ public class DesignServiceImpl extends ServiceImpl impleme if (CollectionUtils.isEmpty(hasCollections)) { return null; } - List oldIds = oldElements.stream().map(CollectionElement::getId).collect(Collectors.toList()); List elementIds = hasCollections.stream().map(DesignItemDetail::getCollectionElementId).collect(Collectors.toList()); + if (CollectionUtils.isEmpty(oldElements)) { + return elementIds; + } + List oldIds = oldElements.stream().map(CollectionElement::getId).collect(Collectors.toList()); //本次新增collection个数 List adds = elementIds.stream().filter(id -> !oldIds.contains(id)).collect(Collectors.toList()); if (CollectionUtils.isEmpty(adds)) { @@ -934,7 +937,7 @@ public class DesignServiceImpl extends ServiceImpl impleme List userLikeVOS = userLikeService.getGroupDetail(userLike.getUserLikeGroupId()); if (CollectionUtils.isEmpty(userLikeVOS)) { //group 下面没有元素时候 直接删除 - userLikeGroupService.removeById(userLike.getUserLikeGroupId()); +// userLikeGroupService.removeById(userLike.getUserLikeGroupId()); } return Boolean.TRUE; }