seller产品图处加入视频

This commit is contained in:
litianxiang
2026-05-06 13:30:21 +08:00
parent f2bce066b6
commit 4c169ef67e
3 changed files with 53 additions and 20 deletions

View File

@@ -28,4 +28,10 @@ public class DesignUrlsDTO {
*/
@Schema(description = "DesignItemDetail的path列表")
private List<String> clothes;
/**
* 姿势转换视频信息列表
*/
@Schema(description = "姿势转换视频信息列表")
private List<PoseTransformationVideoDTO> videos;
}

View File

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

View File

@@ -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<UserLikeGroupMapper, UserLikeGroup> 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<String> getToProductImageUrlsByCollectionSortId(Long collectionSortId) {
List<String> toProductImageUrls = new ArrayList<>();
private void getToProductImageUrlsByCollectionSortId(Long collectionSortId, DesignUrlsDTO designUrlsDTO) {
// 查询子记录中的TO_PRODUCT_IMAGE类型
QueryWrapper<CollectionSort> 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<CollectionSort> 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<UserLikeGroupMapper, U
public DesignUrlsDTO getToProductImageUrlsByDesignItemId(Long designItemId) {
DesignUrlsDTO designUrlsDTO = new DesignUrlsDTO();
designUrlsDTO.setDesignItemId(designItemId);
List<String> toProductImageUrls = new ArrayList<>();
List<String> designItemDetailPaths = new ArrayList<>();
designUrlsDTO.setVideos(new ArrayList<>());
designUrlsDTO.setToProductImageUrls(new ArrayList<>());
designUrlsDTO.setClothes(new ArrayList<>());
// 根据designItemId查询UserLike
QueryWrapper<UserLike> userLikeQueryWrapper = new QueryWrapper<>();
@@ -130,7 +135,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
if (collectionSort != null) {
// 获取TO_PRODUCT_IMAGE类型的URL列表
toProductImageUrls = getToProductImageUrlsByCollectionSortId(collectionSort.getId());
getToProductImageUrlsByCollectionSortId(collectionSort.getId(), designUrlsDTO);
}
}
@@ -146,12 +151,10 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
throw new BusinessException("unknown.authentication.operation.type");
}
if (designItemDetail.getPath() != null) {
designItemDetailPaths.add(minioUtil.processMinioResource(designItemDetail.getPath(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
designUrlsDTO.getClothes().add(minioUtil.processMinioResource(designItemDetail.getPath(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
}
}
designUrlsDTO.setToProductImageUrls(toProductImageUrls);
designUrlsDTO.setClothes(designItemDetailPaths);
return designUrlsDTO;
}