diff --git a/src/main/java/com/ai/da/seller/DesignUrlsDTO.java b/src/main/java/com/ai/da/seller/DesignUrlsDTO.java index 2ac17a03..988498af 100644 --- a/src/main/java/com/ai/da/seller/DesignUrlsDTO.java +++ b/src/main/java/com/ai/da/seller/DesignUrlsDTO.java @@ -28,4 +28,10 @@ public class DesignUrlsDTO { */ @Schema(description = "DesignItemDetail的path列表") private List clothes; + + /** + * 姿势转换视频信息列表 + */ + @Schema(description = "姿势转换视频信息列表") + private List videos; } diff --git a/src/main/java/com/ai/da/seller/PoseTransformationVideoDTO.java b/src/main/java/com/ai/da/seller/PoseTransformationVideoDTO.java new file mode 100644 index 00000000..3e14b8e9 --- /dev/null +++ b/src/main/java/com/ai/da/seller/PoseTransformationVideoDTO.java @@ -0,0 +1,24 @@ +package com.ai.da.seller; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * 姿势转换视频信息DTO + */ +@Data +@Schema(description = "姿势转换视频信息数据传输对象") +public class PoseTransformationVideoDTO { + + /** + * GIF第一帧截图URL + */ + @Schema(description = "GIF第一帧截图URL") + private String firstFrameUrl; + + /** + * GIF视频URL + */ + @Schema(description = "GIF视频URL") + private String gifUrl; +} diff --git a/src/main/java/com/ai/da/service/impl/UserLikeGroupServiceImpl.java b/src/main/java/com/ai/da/service/impl/UserLikeGroupServiceImpl.java index 347baafa..beb9253e 100644 --- a/src/main/java/com/ai/da/service/impl/UserLikeGroupServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/UserLikeGroupServiceImpl.java @@ -24,6 +24,7 @@ import com.ai.da.model.vo.*; import com.ai.da.python.PythonService; import com.ai.da.service.*; import com.ai.da.seller.DesignUrlsDTO; +import com.ai.da.seller.PoseTransformationVideoDTO; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; @@ -77,32 +78,35 @@ import static com.ai.da.common.enums.LayersPriorityEnum.BODY; public class UserLikeGroupServiceImpl extends ServiceImpl implements UserLikeGroupService { /** - * 根据CollectionSort ID获取TO_PRODUCT_IMAGE类型的URL列表 + * 根据CollectionSort ID查询子记录,将TO_PRODUCT_IMAGE类型的URL和姿势转换视频信息写入DesignUrlsDTO * @param collectionSortId CollectionSort ID - * @return TO_PRODUCT_IMAGE类型的URL列表 + * @param designUrlsDTO DesignUrlsDTO,用于收集图片URL和视频信息 */ - private List getToProductImageUrlsByCollectionSortId(Long collectionSortId) { - List toProductImageUrls = new ArrayList<>(); - + private void getToProductImageUrlsByCollectionSortId(Long collectionSortId, DesignUrlsDTO designUrlsDTO) { // 查询子记录中的TO_PRODUCT_IMAGE类型 QueryWrapper childCollectionQw = new QueryWrapper<>(); childCollectionQw.lambda().eq(CollectionSort::getParentId, collectionSortId); - childCollectionQw.lambda().in(CollectionSort::getRelationType, CollectionType.TO_PRODUCT_IMAGE.getValue(), CollectionType.RELIGHT.getValue()); + childCollectionQw.lambda().in(CollectionSort::getRelationType, CollectionType.TO_PRODUCT_IMAGE.getValue(), CollectionType.RELIGHT.getValue(), CollectionType.POSE_TRANSFORM.getValue()); childCollectionQw.lambda().orderByAsc(CollectionSort::getSort); List childSortList = collectionSortMapper.selectList(childCollectionQw); for (CollectionSort userLikeSort : childSortList) { if (userLikeSort.getRelationType().equals(CollectionType.POSE_TRANSFORM.getValue())){ - - } - ToProductImageResult toProductImageResult = toProductImageResultMapper.selectById(userLikeSort.getRelationId()); - if (toProductImageResult != null && !isGenerateTaskFailed(toProductImageResult.getStatus(), toProductImageResult.getCreateTime())) { - String url = toProductImageResult.getUrl(); - toProductImageUrls.add(minioUtil.processMinioResource(url, CommonConstant.MINIO_IMAGE_EXPIRE_TIME)); + PoseTransformation poseTransformation = poseTransformationMapper.selectById(userLikeSort.getRelationId()); + if (poseTransformation != null) { + PoseTransformationVideoDTO videoDTO = new PoseTransformationVideoDTO(); + videoDTO.setFirstFrameUrl(minioUtil.processMinioResource(poseTransformation.getFirstFrameUrl(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME)); + videoDTO.setGifUrl(minioUtil.processMinioResource(poseTransformation.getGifUrl(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME)); + designUrlsDTO.getVideos().add(videoDTO); + } + }else { + ToProductImageResult toProductImageResult = toProductImageResultMapper.selectById(userLikeSort.getRelationId()); + if (toProductImageResult != null && !isGenerateTaskFailed(toProductImageResult.getStatus(), toProductImageResult.getCreateTime())) { + String url = toProductImageResult.getUrl(); + designUrlsDTO.getToProductImageUrls().add(minioUtil.processMinioResource(url, CommonConstant.MINIO_IMAGE_EXPIRE_TIME)); + } } } - - return toProductImageUrls; } /** @@ -113,8 +117,9 @@ public class UserLikeGroupServiceImpl extends ServiceImpl toProductImageUrls = new ArrayList<>(); - List designItemDetailPaths = new ArrayList<>(); + designUrlsDTO.setVideos(new ArrayList<>()); + designUrlsDTO.setToProductImageUrls(new ArrayList<>()); + designUrlsDTO.setClothes(new ArrayList<>()); // 根据designItemId查询UserLike QueryWrapper userLikeQueryWrapper = new QueryWrapper<>(); @@ -130,7 +135,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl