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