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

@@ -104,9 +104,9 @@ public class SavedCollectionController {
} }
List<Long> groupIds = page.getRecords().stream().map(UserLikeGroup::getId).collect(Collectors.toList()); List<Long> groupIds = page.getRecords().stream().map(UserLikeGroup::getId).collect(Collectors.toList());
List<UserLikeVO> groupDetails = userLikeService.getGroupDetails(groupIds); List<UserLikeVO> groupDetails = userLikeService.getGroupDetails(groupIds);
if (CollectionUtils.isEmpty(groupDetails)) { // if (CollectionUtils.isEmpty(groupDetails)) {
throw new BusinessException("groupDetails.not.found"); // throw new BusinessException("groupDetails.not.found");
} // }
Map<Long, List<UserLikeVO>> groupDetailMap = groupDetails.stream() Map<Long, List<UserLikeVO>> groupDetailMap = groupDetails.stream()
.collect(Collectors.groupingBy(UserLikeVO::getUserLikeGroupId)); .collect(Collectors.groupingBy(UserLikeVO::getUserLikeGroupId));
@@ -117,6 +117,7 @@ public class SavedCollectionController {
userLikeGroupVO.setUpdateDate(group.getUpdateDate().getTime()); userLikeGroupVO.setUpdateDate(group.getUpdateDate().getTime());
userLikeGroupVO.setAuthor(account.getUserName()); userLikeGroupVO.setAuthor(account.getUserName());
//count 和detail //count 和detail
if (groupDetailMap.keySet().contains(group.getId())) {
List<UserLikeVO> details = groupDetailMap.get(group.getId()); List<UserLikeVO> details = groupDetailMap.get(group.getId());
for (UserLikeVO detail : details) { for (UserLikeVO detail : details) {
TDesignPythonOutfit tDesignPythonOutfit = designPythonOutfitMapper.selectById(detail.getDesignOutfitId()); TDesignPythonOutfit tDesignPythonOutfit = designPythonOutfitMapper.selectById(detail.getDesignOutfitId());
@@ -124,6 +125,9 @@ public class SavedCollectionController {
} }
userLikeGroupVO.setGroupDetails(details); userLikeGroupVO.setGroupDetails(details);
userLikeGroupVO.setSketchCount(CollectionUtils.isEmpty(details) ? 0 : details.size()); userLikeGroupVO.setSketchCount(CollectionUtils.isEmpty(details) ? 0 : details.size());
}else {
userLikeGroupVO.setSketchCount(0);
}
if (userLikeGroupVO.getOriginal() == 0) { if (userLikeGroupVO.getOriginal() == 0) {
userLikeGroupVO.setOriginalAccountName(accountService.getById(userLikeGroupVO.getOriginalAccountId()).getUserName()); userLikeGroupVO.setOriginalAccountName(accountService.getById(userLikeGroupVO.getOriginalAccountId()).getUserName());
Portfolio byId = portfolioService.getByIdAll(userLikeGroupVO.getOriginalPortfolioId()); Portfolio byId = portfolioService.getByIdAll(userLikeGroupVO.getOriginalPortfolioId());

View File

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