BUGFIX:二创变原创

This commit is contained in:
shahaibo
2024-08-15 16:37:24 +08:00
parent 7b27b1362d
commit 47dc2bfc6e
2 changed files with 21 additions and 14 deletions

View File

@@ -813,9 +813,9 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
// return new DesignLikeVO();
// }
List<CollectionElement> 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<DesignItemDetail> 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<DesignMapper, Design> impleme
if (CollectionUtils.isEmpty(hasCollections)) {
return null;
}
List<Long> oldIds = oldElements.stream().map(CollectionElement::getId).collect(Collectors.toList());
List<Long> elementIds = hasCollections.stream().map(DesignItemDetail::getCollectionElementId).collect(Collectors.toList());
if (CollectionUtils.isEmpty(oldElements)) {
return elementIds;
}
List<Long> oldIds = oldElements.stream().map(CollectionElement::getId).collect(Collectors.toList());
//本次新增collection个数
List<Long> adds = elementIds.stream().filter(id -> !oldIds.contains(id)).collect(Collectors.toList());
if (CollectionUtils.isEmpty(adds)) {
@@ -934,7 +937,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
List<UserLikeVO> userLikeVOS = userLikeService.getGroupDetail(userLike.getUserLikeGroupId());
if (CollectionUtils.isEmpty(userLikeVOS)) {
//group 下面没有元素时候 直接删除
userLikeGroupService.removeById(userLike.getUserLikeGroupId());
// userLikeGroupService.removeById(userLike.getUserLikeGroupId());
}
return Boolean.TRUE;
}