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<UserLikeVO> 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<Long, List<UserLikeVO>> 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<UserLikeVO> 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<UserLikeVO> 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());

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;
}