TASK: collection sort;

This commit is contained in:
shahaibo
2025-06-17 09:41:19 +08:00
parent 9d022ae13e
commit 88d8b75298
2 changed files with 93 additions and 79 deletions

View File

@@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
@ApiModel("用户分组详情-响应")
public class UserLikeVO implements AllCollectionVO{
@@ -29,4 +31,6 @@ public class UserLikeVO implements AllCollectionVO{
private String relationType;
private String collectionType;
private String resultType;
private List<AllCollectionVO> childList;
}

View File

@@ -1630,6 +1630,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
DesignModuleChooseVO vo = new DesignModuleChooseVO();
QueryWrapper<CollectionSort> userLikeSortQueryWrapper = new QueryWrapper<>();
userLikeSortQueryWrapper.lambda().eq(CollectionSort::getProjectId, projectDTO.getId());
userLikeSortQueryWrapper.lambda().isNull(CollectionSort::getParentId);
userLikeSortQueryWrapper.lambda().orderByAsc(CollectionSort::getSort);
List<CollectionSort> userLikeSortList = collectionSortMapper.selectList(userLikeSortQueryWrapper);
@@ -1637,87 +1638,96 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
moduleChooseVO.setDesign(vo);
}else {
List<AllCollectionVO> list = new ArrayList<>();
for (CollectionSort userLikeSort : userLikeSortList) {
if (userLikeSort.getRelationType().equals(CollectionType.DESIGN.getValue())) {
UserLike userLike = userLikeMapper.selectById(userLikeSort.getRelationId());
UserLikeVO o = CopyUtil.copyObject(userLike, UserLikeVO.class);
TDesignPythonOutfit tDesignPythonOutfit1 = designPythonOutfitMapper.selectById(o.getDesignOutfitId());
o.setUrl(tDesignPythonOutfit1.getDesignUrl());
if (o.getUrl().contains("/")) {
int index = o.getUrl().lastIndexOf("/");
o.setPictureName(o.getUrl().substring(index + 1));
}
o.setDesignOutfitUrl(minioUtil.getPreSignedUrl(o.getUrl(), 24 * 60));
QueryWrapper<TDesignPythonOutfit> qw = new QueryWrapper<>();
qw.lambda().eq(TDesignPythonOutfit::getDesignItemId, o.getDesignItemId());
List<TDesignPythonOutfit> tDesignPythonOutfits = designPythonOutfitMapper.selectList(qw);
if (CollectionUtil.isNotEmpty(tDesignPythonOutfits)) {
TDesignPythonOutfit tDesignPythonOutfit = tDesignPythonOutfits.get(0);
o.setDesignOutfitId(tDesignPythonOutfit.getId());
}
o.setSort(userLikeSort.getSort());
o.setUserLikeSortId(userLikeSort.getId());
o.setRelationType(userLikeSort.getRelationType());
o.setCollectionType(CollectionType.DESIGN.getValue());
o.setResultType(CollectionType.DESIGN.getValue());
list.add(o);
} else if (userLikeSort.getRelationType().equals(CollectionType.TO_PRODUCT_IMAGE.getValue())) {
ToProductImageResult toProductImageResult = toProductImageResultMapper.selectById(userLikeSort.getRelationId());
toProductImageResult.setUrl(minioUtil.getPreSignedUrl(toProductImageResult.getUrl(), 24 * 60));
ToProductImageResultVO toProductImageResultVO = CopyUtil.copyObject(toProductImageResult, ToProductImageResultVO.class);
if (toProductImageResultVO.getElementType().equals("ProductElement")) {
ToProductElement toProductElement = toProductElementMapper.selectById(toProductImageResultVO.getElementId());
toProductImageResultVO.setSourceUrl(minioUtil.getPreSignedUrl(toProductElement.getUrl(), 24 * 60));
}else if ((toProductImageResultVO.getElementType().equals("DesignOutfit"))) {
TDesignPythonOutfit tDesignPythonOutfit = designPythonOutfitMapper.selectById(toProductImageResultVO.getElementId());
toProductImageResultVO.setSourceUrl(minioUtil.getPreSignedUrl(tDesignPythonOutfit.getDesignUrl(), 24 * 60));
}else {
ToProductImageResult toProductImageResult1 = toProductImageResultMapper.selectById(toProductImageResultVO.getElementId());
toProductImageResultVO.setSourceUrl(minioUtil.getPreSignedUrl(toProductImageResult1.getUrl(), 24 * 60));
}
toProductImageResultVO.setCollectionType(CollectionType.TO_PRODUCT_IMAGE.getValue());
toProductImageResultVO.setSort(userLikeSort.getSort());
toProductImageResultVO.setUserLikeSortId(userLikeSort.getId());
toProductImageResultVO.setRelationType(userLikeSort.getRelationType());
list.add(toProductImageResultVO);
} else if (userLikeSort.getRelationType().equals(CollectionType.RELIGHT.getValue())) {
ToProductImageResult toProductImageResult = toProductImageResultMapper.selectById(userLikeSort.getRelationId());
toProductImageResult.setUrl(minioUtil.getPreSignedUrl(toProductImageResult.getUrl(), 24 * 60));
ToProductImageResultVO toProductImageResultVO = CopyUtil.copyObject(toProductImageResult, ToProductImageResultVO.class);
if (toProductImageResultVO.getElementType().equals("ProductElement")) {
ToProductElement toProductElement = toProductElementMapper.selectById(toProductImageResultVO.getElementId());
toProductImageResultVO.setSourceUrl(minioUtil.getPreSignedUrl(toProductElement.getUrl(), 24 * 60));
}else if ((toProductImageResultVO.getElementType().equals("DesignOutfit"))) {
TDesignPythonOutfit tDesignPythonOutfit = designPythonOutfitMapper.selectById(toProductImageResultVO.getElementId());
toProductImageResultVO.setSourceUrl(minioUtil.getPreSignedUrl(tDesignPythonOutfit.getDesignUrl(), 24 * 60));
}else {
ToProductImageResult toProductImageResult1 = toProductImageResultMapper.selectById(toProductImageResultVO.getElementId());
toProductImageResultVO.setSourceUrl(minioUtil.getPreSignedUrl(toProductImageResult1.getUrl(), 24 * 60));
}
toProductImageResultVO.setCollectionType(CollectionType.RELIGHT.getValue());
toProductImageResultVO.setSort(userLikeSort.getSort());
toProductImageResultVO.setUserLikeSortId(userLikeSort.getId());
toProductImageResultVO.setRelationType(userLikeSort.getRelationType());
list.add(toProductImageResultVO);
} else if (userLikeSort.getRelationType().equals(CollectionType.POSE_TRANSFORM.getValue())) {
PoseTransformation item = poseTransformationMapper.selectById(userLikeSort.getRelationId());
PoseTransformationVO poseTransformationVO = new PoseTransformationVO();
poseTransformationVO.setId(item.getId());
poseTransformationVO.setProductImage(minioUtil.getPreSignedUrl(item.getProductImage(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
poseTransformationVO.setGifUrl(minioUtil.getPreSignedUrl(item.getGifUrl(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
poseTransformationVO.setVideoUrl(minioUtil.getPreSignedUrl(item.getVideoUrl(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
poseTransformationVO.setFirstFrameUrl(minioUtil.getPreSignedUrl(item.getFirstFrameUrl(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
poseTransformationVO.setIsLiked(item.getIsLiked());
poseTransformationVO.setCollectionType(CollectionType.POSE_TRANSFORM.getValue());
poseTransformationVO.setSort(userLikeSort.getSort());
poseTransformationVO.setUserLikeSortId(userLikeSort.getId());
poseTransformationVO.setRelationType(userLikeSort.getRelationType());
poseTransformationVO.setResultType(CollectionType.POSE_TRANSFORM.getValue());
list.add(poseTransformationVO);
for (CollectionSort collectionSort : userLikeSortList) {
UserLike userLike = userLikeMapper.selectById(collectionSort.getRelationId());
UserLikeVO o = CopyUtil.copyObject(userLike, UserLikeVO.class);
TDesignPythonOutfit tDesignPythonOutfit1 = designPythonOutfitMapper.selectById(o.getDesignOutfitId());
o.setUrl(tDesignPythonOutfit1.getDesignUrl());
if (o.getUrl().contains("/")) {
int index = o.getUrl().lastIndexOf("/");
o.setPictureName(o.getUrl().substring(index + 1));
}
o.setDesignOutfitUrl(minioUtil.getPreSignedUrl(o.getUrl(), 24 * 60));
QueryWrapper<TDesignPythonOutfit> qw = new QueryWrapper<>();
qw.lambda().eq(TDesignPythonOutfit::getDesignItemId, o.getDesignItemId());
List<TDesignPythonOutfit> tDesignPythonOutfits = designPythonOutfitMapper.selectList(qw);
if (CollectionUtil.isNotEmpty(tDesignPythonOutfits)) {
TDesignPythonOutfit tDesignPythonOutfit = tDesignPythonOutfits.get(0);
o.setDesignOutfitId(tDesignPythonOutfit.getId());
}
o.setSort(collectionSort.getSort());
o.setUserLikeSortId(collectionSort.getId());
o.setRelationType(collectionSort.getRelationType());
o.setCollectionType(CollectionType.DESIGN.getValue());
o.setResultType(CollectionType.DESIGN.getValue());
QueryWrapper<CollectionSort> childCollectionQw = new QueryWrapper<>();
childCollectionQw.lambda().eq(CollectionSort::getParentId, collectionSort.getId());
childCollectionQw.lambda().orderByAsc(CollectionSort::getSort);
List<CollectionSort> childSortList = collectionSortMapper.selectList(userLikeSortQueryWrapper);
List<AllCollectionVO> childList = new ArrayList<>();
for (CollectionSort userLikeSort : childSortList) {
if (userLikeSort.getRelationType().equals(CollectionType.TO_PRODUCT_IMAGE.getValue())) {
ToProductImageResult toProductImageResult = toProductImageResultMapper.selectById(userLikeSort.getRelationId());
toProductImageResult.setUrl(minioUtil.getPreSignedUrl(toProductImageResult.getUrl(), 24 * 60));
ToProductImageResultVO toProductImageResultVO = CopyUtil.copyObject(toProductImageResult, ToProductImageResultVO.class);
if (toProductImageResultVO.getElementType().equals("ProductElement")) {
ToProductElement toProductElement = toProductElementMapper.selectById(toProductImageResultVO.getElementId());
toProductImageResultVO.setSourceUrl(minioUtil.getPreSignedUrl(toProductElement.getUrl(), 24 * 60));
}else if ((toProductImageResultVO.getElementType().equals("DesignOutfit"))) {
TDesignPythonOutfit tDesignPythonOutfit = designPythonOutfitMapper.selectById(toProductImageResultVO.getElementId());
toProductImageResultVO.setSourceUrl(minioUtil.getPreSignedUrl(tDesignPythonOutfit.getDesignUrl(), 24 * 60));
}else {
ToProductImageResult toProductImageResult1 = toProductImageResultMapper.selectById(toProductImageResultVO.getElementId());
toProductImageResultVO.setSourceUrl(minioUtil.getPreSignedUrl(toProductImageResult1.getUrl(), 24 * 60));
}
toProductImageResultVO.setCollectionType(CollectionType.TO_PRODUCT_IMAGE.getValue());
toProductImageResultVO.setSort(userLikeSort.getSort());
toProductImageResultVO.setUserLikeSortId(userLikeSort.getId());
toProductImageResultVO.setRelationType(userLikeSort.getRelationType());
childList.add(toProductImageResultVO);
} else if (userLikeSort.getRelationType().equals(CollectionType.RELIGHT.getValue())) {
ToProductImageResult toProductImageResult = toProductImageResultMapper.selectById(userLikeSort.getRelationId());
toProductImageResult.setUrl(minioUtil.getPreSignedUrl(toProductImageResult.getUrl(), 24 * 60));
ToProductImageResultVO toProductImageResultVO = CopyUtil.copyObject(toProductImageResult, ToProductImageResultVO.class);
if (toProductImageResultVO.getElementType().equals("ProductElement")) {
ToProductElement toProductElement = toProductElementMapper.selectById(toProductImageResultVO.getElementId());
toProductImageResultVO.setSourceUrl(minioUtil.getPreSignedUrl(toProductElement.getUrl(), 24 * 60));
}else if ((toProductImageResultVO.getElementType().equals("DesignOutfit"))) {
TDesignPythonOutfit tDesignPythonOutfit = designPythonOutfitMapper.selectById(toProductImageResultVO.getElementId());
toProductImageResultVO.setSourceUrl(minioUtil.getPreSignedUrl(tDesignPythonOutfit.getDesignUrl(), 24 * 60));
}else {
ToProductImageResult toProductImageResult1 = toProductImageResultMapper.selectById(toProductImageResultVO.getElementId());
toProductImageResultVO.setSourceUrl(minioUtil.getPreSignedUrl(toProductImageResult1.getUrl(), 24 * 60));
}
toProductImageResultVO.setCollectionType(CollectionType.RELIGHT.getValue());
toProductImageResultVO.setSort(userLikeSort.getSort());
toProductImageResultVO.setUserLikeSortId(userLikeSort.getId());
toProductImageResultVO.setRelationType(userLikeSort.getRelationType());
childList.add(toProductImageResultVO);
} else if (userLikeSort.getRelationType().equals(CollectionType.POSE_TRANSFORM.getValue())) {
PoseTransformation item = poseTransformationMapper.selectById(userLikeSort.getRelationId());
PoseTransformationVO poseTransformationVO = new PoseTransformationVO();
poseTransformationVO.setId(item.getId());
poseTransformationVO.setProductImage(minioUtil.getPreSignedUrl(item.getProductImage(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
poseTransformationVO.setGifUrl(minioUtil.getPreSignedUrl(item.getGifUrl(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
poseTransformationVO.setVideoUrl(minioUtil.getPreSignedUrl(item.getVideoUrl(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
poseTransformationVO.setFirstFrameUrl(minioUtil.getPreSignedUrl(item.getFirstFrameUrl(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
poseTransformationVO.setIsLiked(item.getIsLiked());
poseTransformationVO.setCollectionType(CollectionType.POSE_TRANSFORM.getValue());
poseTransformationVO.setSort(userLikeSort.getSort());
poseTransformationVO.setUserLikeSortId(userLikeSort.getId());
poseTransformationVO.setRelationType(userLikeSort.getRelationType());
poseTransformationVO.setResultType(CollectionType.POSE_TRANSFORM.getValue());
childList.add(poseTransformationVO);
}
}
o.setChildList(childList);
list.add(o);
}
vo.setUserLikeDetails(list);
}