From 301f58bc62c051242a9af70aff09ed088fae4bfe Mon Sep 17 00:00:00 2001 From: xupei Date: Tue, 15 Jul 2025 18:11:12 +0800 Subject: [PATCH] =?UTF-8?q?TASK:=20=E6=8B=BC=E8=B4=B4=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E7=94=A8=E6=88=B7=E4=B8=8A=E4=BC=A0=E7=9A=84?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E5=B9=B6=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ai/da/controller/ElementController.java | 11 ++++++++- .../model/dto/CollectionElementUploadDTO.java | 6 +++++ .../da/model/vo/SketchReconstructionVO.java | 6 ++++- .../da/service/CollectionElementService.java | 1 + .../impl/CollectionElementServiceImpl.java | 24 +++++++++++++++++-- .../da/service/impl/GenerateServiceImpl.java | 10 ++++++++ 6 files changed, 54 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/ai/da/controller/ElementController.java b/src/main/java/com/ai/da/controller/ElementController.java index 32e1c23a..4e524dac 100644 --- a/src/main/java/com/ai/da/controller/ElementController.java +++ b/src/main/java/com/ai/da/controller/ElementController.java @@ -53,13 +53,15 @@ public class ElementController { @ApiParam("一级类型 Moodboard Printboard Sketchboard MarketingSketch Colorboard") @RequestParam(value = "level1Type") String level1Type, @RequestParam(name = "gender", required = false) String gender, + @RequestParam(name = "level2Type", required = false) String level2Type, + @RequestParam(name = "projectId", required = false) Long projectId, @ApiParam("本地时区,比如 'Asia/Tokyo' 东京时间 , 'Asia/Shanghai' 北京时间 由js本地获取") @RequestParam(value = "timeZone") String timeZone) { if (null == file || StringUtils.isEmpty(file.getOriginalFilename())) { throw new BusinessException("file.cannot.be.empty"); } return Response.success(collectionElementService.upload( - new CollectionElementUploadDTO(file, level1Type, gender, timeZone, MD5Utils.encryptFile(file)))); + new CollectionElementUploadDTO(file, projectId, level1Type, level2Type, gender, timeZone, MD5Utils.encryptFile(file)))); } @ApiOperation(value = "element文件删除") @@ -131,4 +133,11 @@ public class ElementController { return Response.success(collectionElementService.selectedImageSeg(nonEmptyFiles, id, type, sourceType)); } + @ApiOperation(value = "更新element level2type") + @GetMapping("/updateElementLevel2Type") + public Response updateLibraryLevel2Type(@RequestParam(value = "elementId") Long elementId, @RequestParam(value = "level2Type") String level2Type) { + collectionElementService.updateElementLevel2Type(elementId, level2Type); + return Response.success("success"); + } + } diff --git a/src/main/java/com/ai/da/model/dto/CollectionElementUploadDTO.java b/src/main/java/com/ai/da/model/dto/CollectionElementUploadDTO.java index 3e0b6bb3..69208225 100644 --- a/src/main/java/com/ai/da/model/dto/CollectionElementUploadDTO.java +++ b/src/main/java/com/ai/da/model/dto/CollectionElementUploadDTO.java @@ -19,9 +19,15 @@ public class CollectionElementUploadDTO { @NotNull(message = "file.cannot.be.empty") private MultipartFile file; + @ApiModelProperty("项目id") + private Long projectId; + @ApiModelProperty("一级类型") private String level1Type; + @ApiModelProperty("二级类型") + private String level2Type; + @ApiModelProperty("性别") private String gender; diff --git a/src/main/java/com/ai/da/model/vo/SketchReconstructionVO.java b/src/main/java/com/ai/da/model/vo/SketchReconstructionVO.java index 9493e05f..c7fcf900 100644 --- a/src/main/java/com/ai/da/model/vo/SketchReconstructionVO.java +++ b/src/main/java/com/ai/da/model/vo/SketchReconstructionVO.java @@ -1,8 +1,10 @@ package com.ai.da.model.vo; -import com.alibaba.fastjson.JSONObject; +import com.ai.da.mapper.primary.entity.CollectionElement; import lombok.Data; +import java.util.List; + @Data public class SketchReconstructionVO { @@ -14,4 +16,6 @@ public class SketchReconstructionVO { private String categoryValue; + private List uploadImages; + } diff --git a/src/main/java/com/ai/da/service/CollectionElementService.java b/src/main/java/com/ai/da/service/CollectionElementService.java index 2e45351c..fe218ca8 100644 --- a/src/main/java/com/ai/da/service/CollectionElementService.java +++ b/src/main/java/com/ai/da/service/CollectionElementService.java @@ -141,4 +141,5 @@ public interface CollectionElementService extends IService { List selectedImageSeg(List files, Long id, String type, String sourceType); + void updateElementLevel2Type(Long elementId, String level2Type); } diff --git a/src/main/java/com/ai/da/service/impl/CollectionElementServiceImpl.java b/src/main/java/com/ai/da/service/impl/CollectionElementServiceImpl.java index 6082b90c..a110f897 100644 --- a/src/main/java/com/ai/da/service/impl/CollectionElementServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/CollectionElementServiceImpl.java @@ -13,6 +13,7 @@ import com.ai.da.mapper.primary.GenerateDetailMapper; import com.ai.da.mapper.primary.entity.*; import com.ai.da.model.dto.*; import com.ai.da.model.enums.ModelType; +import com.ai.da.model.enums.Module; import com.ai.da.model.enums.Sex; import com.ai.da.model.vo.*; import com.ai.da.python.PythonService; @@ -96,10 +97,15 @@ public class CollectionElementServiceImpl extends ServiceImpl i String messageFromResource = BusinessException.getMessageFromResource(clothCategory.toUpperCase()); vo.setCategory(clothCategory); vo.setCategoryValue(messageFromResource); + + List collectionElements = collectionElementService.getByProjectId(projectId); + if (!collectionElements.isEmpty()){ + collectionElements.forEach(item -> { + item.setUrl(StringUtil.isNullOrEmpty(item.getUrl()) ? null : minioUtil.getPreSignedUrl(item.getUrl(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME)); + }); + vo.setUploadImages(collectionElements); + }else { + vo.setUploadImages(new ArrayList<>()); + } } return vo; }