TASK:workspace、design模块代码;
This commit is contained in:
@@ -15,7 +15,8 @@ public enum DesignTypeEnum {
|
|||||||
/**
|
/**
|
||||||
* Library
|
* Library
|
||||||
*/
|
*/
|
||||||
LIBRARY("Library");
|
LIBRARY("Library"),
|
||||||
|
GENERATE("Generate");
|
||||||
|
|
||||||
private String realName;
|
private String realName;
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,10 @@ package com.ai.da.controller;
|
|||||||
import com.ai.da.common.response.Response;
|
import com.ai.da.common.response.Response;
|
||||||
import com.ai.da.common.utils.MinioUtil;
|
import com.ai.da.common.utils.MinioUtil;
|
||||||
import com.ai.da.mapper.entity.Workspace;
|
import com.ai.da.mapper.entity.Workspace;
|
||||||
|
import com.ai.da.model.dto.ModelsDotDTO;
|
||||||
import com.ai.da.model.dto.WorkspaceDTO;
|
import com.ai.da.model.dto.WorkspaceDTO;
|
||||||
import com.ai.da.model.enums.BizJson;
|
import com.ai.da.model.enums.BizJson;
|
||||||
|
import com.ai.da.model.vo.ModelsVO;
|
||||||
import com.ai.da.model.vo.WorkspaceVO;
|
import com.ai.da.model.vo.WorkspaceVO;
|
||||||
import com.ai.da.service.WorkspaceService;
|
import com.ai.da.service.WorkspaceService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
@@ -38,29 +40,6 @@ public class WorkspaceController {
|
|||||||
@Resource
|
@Resource
|
||||||
private WorkspaceService workspaceService;
|
private WorkspaceService workspaceService;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private MinioUtil minIoUtil;
|
|
||||||
|
|
||||||
@Value("${minio.endpoint}")
|
|
||||||
public String address;
|
|
||||||
|
|
||||||
@Value("${minio.bucketName}")
|
|
||||||
public String bucketName;
|
|
||||||
|
|
||||||
@PostMapping("/upload")
|
|
||||||
public Object upload(MultipartFile file) {
|
|
||||||
|
|
||||||
List<String> upload = minIoUtil.upload(new MultipartFile[]{file});
|
|
||||||
|
|
||||||
return address+"/"+bucketName+"/"+upload.get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/getUrl")
|
|
||||||
public Object getUrl() {
|
|
||||||
|
|
||||||
return minIoUtil.getPresignedUrl("test", "R-C_1694066189047.png", 5);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 详情
|
* 详情
|
||||||
*/
|
*/
|
||||||
@@ -112,5 +91,13 @@ public class WorkspaceController {
|
|||||||
return Response.success(bizJsonList);
|
return Response.success(bizJsonList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getMannequins")
|
||||||
|
@ApiOperationSupport(order = 6)
|
||||||
|
@ApiOperation(value = "获取模特")
|
||||||
|
public Response<List<ModelsVO>> getMannequins() {
|
||||||
|
List<ModelsVO> modelsVO = workspaceService.getMannequins();
|
||||||
|
return Response.success(modelsVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,8 @@ public class CollectionElement implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Long collectionId;
|
private Long collectionId;
|
||||||
|
|
||||||
|
private String type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 一级类型
|
* 一级类型
|
||||||
*/
|
*/
|
||||||
|
|||||||
13
src/main/java/com/ai/da/model/vo/ModelVO.java
Normal file
13
src/main/java/com/ai/da/model/vo/ModelVO.java
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package com.ai.da.model.vo;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class ModelVO {
|
||||||
|
private Long id;
|
||||||
|
private String url;
|
||||||
|
}
|
||||||
14
src/main/java/com/ai/da/model/vo/ModelsVO.java
Normal file
14
src/main/java/com/ai/da/model/vo/ModelsVO.java
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
package com.ai.da.model.vo;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class ModelsVO {
|
||||||
|
|
||||||
|
private List<ModelVO> modelList;
|
||||||
|
private String type;
|
||||||
|
}
|
||||||
@@ -28,6 +28,8 @@ public class ValidateElementVO {
|
|||||||
List<Long> usedElementIds = Lists.newArrayList();
|
List<Long> usedElementIds = Lists.newArrayList();
|
||||||
//用于存储library 生成collection
|
//用于存储library 生成collection
|
||||||
List<CollectionElement> libraryCollectionElements = Lists.newArrayList();
|
List<CollectionElement> libraryCollectionElements = Lists.newArrayList();
|
||||||
|
//用于存储generate 生成collection
|
||||||
|
List<CollectionElement> generateCollectionElements = Lists.newArrayList();
|
||||||
//存储template打点数据
|
//存储template打点数据
|
||||||
DesignLibraryModelPointVO designLibraryModelPoint =null;
|
DesignLibraryModelPointVO designLibraryModelPoint =null;
|
||||||
//存储本次design已经使用的上衣和下衣的的MD5list 去重用
|
//存储本次design已经使用的上衣和下衣的的MD5list 去重用
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1,12 +1,15 @@
|
|||||||
package com.ai.da.service;
|
package com.ai.da.service;
|
||||||
|
|
||||||
|
import com.ai.da.mapper.entity.Design;
|
||||||
|
import com.ai.da.mapper.entity.Generate;
|
||||||
import com.ai.da.model.dto.GenerateLikeDTO;
|
import com.ai.da.model.dto.GenerateLikeDTO;
|
||||||
import com.ai.da.model.dto.GenerateThroughImageTextDTO;
|
import com.ai.da.model.dto.GenerateThroughImageTextDTO;
|
||||||
import com.ai.da.model.vo.GenerateCaptionVO;
|
import com.ai.da.model.vo.GenerateCaptionVO;
|
||||||
import com.ai.da.model.vo.GenerateCollectionVO;
|
import com.ai.da.model.vo.GenerateCollectionVO;
|
||||||
import com.ai.da.model.vo.GenerateLikeVO;
|
import com.ai.da.model.vo.GenerateLikeVO;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
public interface GenerateService {
|
public interface GenerateService extends IService<Generate> {
|
||||||
|
|
||||||
GenerateCaptionVO generateCaption(Long sketchElementId);
|
GenerateCaptionVO generateCaption(Long sketchElementId);
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ package com.ai.da.service;
|
|||||||
import com.ai.da.mapper.entity.Workspace;
|
import com.ai.da.mapper.entity.Workspace;
|
||||||
import com.ai.da.model.dto.WorkspaceDTO;
|
import com.ai.da.model.dto.WorkspaceDTO;
|
||||||
import com.ai.da.model.enums.BizJson;
|
import com.ai.da.model.enums.BizJson;
|
||||||
|
import com.ai.da.model.vo.ModelsVO;
|
||||||
import com.ai.da.model.vo.WorkspaceVO;
|
import com.ai.da.model.vo.WorkspaceVO;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
@@ -35,4 +36,6 @@ public interface WorkspaceService extends IService<Workspace> {
|
|||||||
List<BizJson> getEnumValues(String enumName);
|
List<BizJson> getEnumValues(String enumName);
|
||||||
|
|
||||||
Workspace getByIdNew(Long id);
|
Workspace getByIdNew(Long id);
|
||||||
|
|
||||||
|
List<ModelsVO> getMannequins();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,6 +64,8 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
|||||||
@Resource
|
@Resource
|
||||||
private LibraryService libraryService;
|
private LibraryService libraryService;
|
||||||
@Resource
|
@Resource
|
||||||
|
private GenerateService generateService;
|
||||||
|
@Resource
|
||||||
private LibraryModelPointService libraryModelPointService;
|
private LibraryModelPointService libraryModelPointService;
|
||||||
@Resource
|
@Resource
|
||||||
private TCollectionElementRelationService tCollectionElementRelationService;
|
private TCollectionElementRelationService tCollectionElementRelationService;
|
||||||
@@ -231,6 +233,7 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
|||||||
|
|
||||||
List<Long> usedElementIds = elementVO.getUsedElementIds();
|
List<Long> usedElementIds = elementVO.getUsedElementIds();
|
||||||
List<CollectionElement> libraryCollectionElements = elementVO.getLibraryCollectionElements();
|
List<CollectionElement> libraryCollectionElements = elementVO.getLibraryCollectionElements();
|
||||||
|
List<CollectionElement> generateCollectionElements = elementVO.getGenerateCollectionElements();
|
||||||
//校验moodboard
|
//校验moodboard
|
||||||
if (CollectionUtil.isNotEmpty(designDTO.getMoodBoards())) {
|
if (CollectionUtil.isNotEmpty(designDTO.getMoodBoards())) {
|
||||||
//校验designType
|
//校验designType
|
||||||
@@ -258,6 +261,17 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
|||||||
libraryCollectionElements.addAll(covertLibrarysToCollections(librarys,null));
|
libraryCollectionElements.addAll(covertLibrarysToCollections(librarys,null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// generate
|
||||||
|
List<Long> generateIds = designDTO.getMoodBoards().stream()
|
||||||
|
.filter(o -> o.getDesignType().equals((DesignTypeEnum.GENERATE.getRealName())))
|
||||||
|
.map(DesignCollectionElementDTO::getId)
|
||||||
|
.collect((Collectors.toList()));
|
||||||
|
if(CollectionUtil.isNotEmpty(generateIds)) {
|
||||||
|
List<Generate> generateList = generateService.listByIds(generateIds);
|
||||||
|
if(CollectionUtil.isNotEmpty(generateList)){
|
||||||
|
generateCollectionElements.addAll(covertGeneratesToCollections(generateList,null));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (CollectionUtil.isNotEmpty(designDTO.getPrintBoards())) {
|
if (CollectionUtil.isNotEmpty(designDTO.getPrintBoards())) {
|
||||||
//校验designType
|
//校验designType
|
||||||
@@ -289,6 +303,20 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
|||||||
libraryCollectionElements.addAll(covertLibrarysToPrintCollections(librarys,idToMap));
|
libraryCollectionElements.addAll(covertLibrarysToPrintCollections(librarys,idToMap));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// generate
|
||||||
|
List<Long> generateIds = designDTO.getPrintBoards().stream()
|
||||||
|
.filter(o -> o.getDesignType().equals((DesignTypeEnum.GENERATE.getRealName())))
|
||||||
|
.map(DesignCollectionPrintElementDTO::getId)
|
||||||
|
.collect((Collectors.toList()));
|
||||||
|
if(CollectionUtil.isNotEmpty(generateIds)) {
|
||||||
|
List<Generate> generateList = generateService.listByIds(generateIds);
|
||||||
|
if(CollectionUtil.isNotEmpty(generateList)){
|
||||||
|
Map<Long,DesignCollectionPrintElementDTO> idToMap = designDTO.getPrintBoards()
|
||||||
|
.stream()
|
||||||
|
.collect(Collectors.toMap(DesignCollectionPrintElementDTO::getId,v ->v));
|
||||||
|
generateCollectionElements.addAll(covertGeneratesToPrintCollections(generateList,idToMap));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (CollectionUtil.isNotEmpty(designDTO.getSketchBoards())) {
|
if (CollectionUtil.isNotEmpty(designDTO.getSketchBoards())) {
|
||||||
//校验PIN是否满足 上衣或者下衣必须不超过8
|
//校验PIN是否满足 上衣或者下衣必须不超过8
|
||||||
@@ -335,6 +363,20 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
|||||||
libraryCollectionElements.addAll(covertLibrarysToCollections(librarys,idToMap));
|
libraryCollectionElements.addAll(covertLibrarysToCollections(librarys,idToMap));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// generate
|
||||||
|
List<Long> generateIds = designDTO.getSketchBoards().stream()
|
||||||
|
.filter(o -> o.getDesignType().equals((DesignTypeEnum.GENERATE.getRealName())))
|
||||||
|
.map(CollectionSketchDTO::getSketchBoardId)
|
||||||
|
.collect((Collectors.toList()));
|
||||||
|
if(CollectionUtil.isNotEmpty(generateIds)) {
|
||||||
|
List<Generate> generateList = generateService.listByIds(generateIds);
|
||||||
|
if(CollectionUtil.isNotEmpty(generateList)){
|
||||||
|
Map<Long,CollectionSketchDTO> idToMap = designDTO.getSketchBoards()
|
||||||
|
.stream()
|
||||||
|
.collect(Collectors.toMap(CollectionSketchDTO::getSketchBoardId,v ->v));
|
||||||
|
generateCollectionElements.addAll(covertGeneratesToCollections(generateList,idToMap));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//校验marketingSketch
|
//校验marketingSketch
|
||||||
// 2023.12版本去掉了这个入参
|
// 2023.12版本去掉了这个入参
|
||||||
@@ -411,11 +453,30 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<CollectionElement> covertGeneratesToCollections(List<Generate> generates, Map<Long,CollectionSketchDTO> idToMap){
|
||||||
|
return CopyUtil.copyList(generates,CollectionElement.class,(o,d) ->{
|
||||||
|
if(null != idToMap){
|
||||||
|
CollectionSketchDTO sketchDTO = idToMap.get(o.getId());
|
||||||
|
d.setLevel2Type(sketchDTO.getLevel2Type());
|
||||||
|
d.setHasPin(sketchDTO.getIsPin());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private List<CollectionElement> covertLibrarysToPrintCollections(List<Library> libraries, Map<Long,DesignCollectionPrintElementDTO> idToMap){
|
private List<CollectionElement> covertLibrarysToPrintCollections(List<Library> libraries, Map<Long,DesignCollectionPrintElementDTO> idToMap){
|
||||||
return CopyUtil.copyList(libraries,CollectionElement.class,(o,d) ->{
|
return CopyUtil.copyList(libraries,CollectionElement.class,(o,d) ->{
|
||||||
if(null != idToMap){
|
if(null != idToMap){
|
||||||
DesignCollectionPrintElementDTO sketchDTO = idToMap.get(o.getId());
|
DesignCollectionPrintElementDTO printDTO = idToMap.get(o.getId());
|
||||||
d.setHasPin(sketchDTO.getIsPin());
|
d.setHasPin(printDTO.getIsPin());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<CollectionElement> covertGeneratesToPrintCollections(List<Generate> generates, Map<Long,DesignCollectionPrintElementDTO> idToMap){
|
||||||
|
return CopyUtil.copyList(generates,CollectionElement.class,(o,d) ->{
|
||||||
|
if(null != idToMap){
|
||||||
|
DesignCollectionPrintElementDTO printDTO = idToMap.get(o.getId());
|
||||||
|
d.setHasPin(printDTO.getIsPin());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
|||||||
private PanToneService panToneService;
|
private PanToneService panToneService;
|
||||||
@Resource
|
@Resource
|
||||||
private MinioUtil minioUtil;
|
private MinioUtil minioUtil;
|
||||||
@Value("${minio.bucketName}")
|
@Value("${minio.bucketName.results}")
|
||||||
private String bucketName;
|
private String bucketName;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.ai.da.common.config.FileProperties;
|
|||||||
import com.ai.da.common.config.exception.BusinessException;
|
import com.ai.da.common.config.exception.BusinessException;
|
||||||
import com.ai.da.common.context.UserContext;
|
import com.ai.da.common.context.UserContext;
|
||||||
import com.ai.da.common.enums.CollectionLevel1TypeEnum;
|
import com.ai.da.common.enums.CollectionLevel1TypeEnum;
|
||||||
|
import com.ai.da.common.enums.DesignTypeEnum;
|
||||||
import com.ai.da.common.enums.SysFileLevel2TypeEnum;
|
import com.ai.da.common.enums.SysFileLevel2TypeEnum;
|
||||||
import com.ai.da.common.utils.*;
|
import com.ai.da.common.utils.*;
|
||||||
import com.ai.da.mapper.DesignMapper;
|
import com.ai.da.mapper.DesignMapper;
|
||||||
@@ -83,7 +84,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
private PythonTAllInfoService pythonTAllInfoService;
|
private PythonTAllInfoService pythonTAllInfoService;
|
||||||
@Value("${minio.endpoint}")
|
@Value("${minio.endpoint}")
|
||||||
private String endpoint;
|
private String endpoint;
|
||||||
@Value("${minio.bucketName}")
|
@Value("${minio.bucketName.results}")
|
||||||
private String bucketName;
|
private String bucketName;
|
||||||
|
|
||||||
// @Transactional
|
// @Transactional
|
||||||
@@ -95,6 +96,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
//design
|
//design
|
||||||
return designOrRedesignOperateNew(designDTO, userInfo, null, elementVO);
|
return designOrRedesignOperateNew(designDTO, userInfo, null, elementVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void calculateLibraryAndSysFile(DesignCollectionDTO designDTO, ValidateElementVO elementVO, AuthPrincipalVo userInfo) {
|
private void calculateLibraryAndSysFile(DesignCollectionDTO designDTO, ValidateElementVO elementVO, AuthPrincipalVo userInfo) {
|
||||||
//查询用户 sketch library
|
//查询用户 sketch library
|
||||||
List<LibraryVo> libraryVos;
|
List<LibraryVo> libraryVos;
|
||||||
@@ -120,6 +122,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
//校验比列
|
//校验比列
|
||||||
validateRatio(designDTO, libraryVos);
|
validateRatio(designDTO, libraryVos);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateRatio(DesignCollectionDTO designDTO, List<LibraryVo> libraryVos) {
|
private void validateRatio(DesignCollectionDTO designDTO, List<LibraryVo> libraryVos) {
|
||||||
//校验系统比列,先去掉 考虑到程序已经进入比较后面了,该校验不重要,且会产生脏数据
|
//校验系统比列,先去掉 考虑到程序已经进入比较后面了,该校验不重要,且会产生脏数据
|
||||||
// BigDecimal bigDecimal = designDTO.getSystemScale();
|
// BigDecimal bigDecimal = designDTO.getSystemScale();
|
||||||
@@ -130,6 +133,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
// throw new BusinessException("No sketch, please increase the system rate");
|
// throw new BusinessException("No sketch, please increase the system rate");
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveCollectionElemntsByLibrarys(ValidateElementVO elementVO, Long collectionId) {
|
private void saveCollectionElemntsByLibrarys(ValidateElementVO elementVO, Long collectionId) {
|
||||||
if (CollectionUtils.isEmpty(elementVO.getLibraryCollectionElements())) {
|
if (CollectionUtils.isEmpty(elementVO.getLibraryCollectionElements())) {
|
||||||
return;
|
return;
|
||||||
@@ -142,6 +146,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
element.setHasPin((byte) 0);
|
element.setHasPin((byte) 0);
|
||||||
}
|
}
|
||||||
element.setId(null);
|
element.setId(null);
|
||||||
|
// element.setType(DesignTypeEnum.LIBRARY.getRealName());
|
||||||
});
|
});
|
||||||
List<CollectionElement> saveElements = elementVO.getLibraryCollectionElements();
|
List<CollectionElement> saveElements = elementVO.getLibraryCollectionElements();
|
||||||
collectionElementService.saveBatch(saveElements);
|
collectionElementService.saveBatch(saveElements);
|
||||||
@@ -160,7 +165,55 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
if (!CollectionUtils.isEmpty(newPrintboard)) {
|
if (!CollectionUtils.isEmpty(newPrintboard)) {
|
||||||
elementVO.getPrintBoardElements().addAll(newPrintboard);
|
elementVO.getPrintBoardElements().addAll(newPrintboard);
|
||||||
}
|
}
|
||||||
|
//mood
|
||||||
|
List<CollectionElement> newMoodboard = saveElements.stream()
|
||||||
|
.filter(f -> f.getLevel1Type().equals(CollectionLevel1TypeEnum.MOOD_BOARD.getRealName()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
if (!CollectionUtils.isEmpty(newMoodboard)) {
|
||||||
|
elementVO.getMoodBoardElements().addAll(newMoodboard);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void saveCollectionElemntsByGenerates(ValidateElementVO elementVO, Long collectionId) {
|
||||||
|
if (CollectionUtils.isEmpty(elementVO.getGenerateCollectionElements())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
elementVO.getGenerateCollectionElements()
|
||||||
|
.forEach(element -> {
|
||||||
|
element.setCollectionId(collectionId);
|
||||||
|
Byte hasPin = element.getHasPin();
|
||||||
|
if (Objects.isNull(hasPin)) {
|
||||||
|
element.setHasPin((byte) 0);
|
||||||
|
}
|
||||||
|
element.setId(null);
|
||||||
|
// element.setType(DesignTypeEnum.GENERATE.getRealName());
|
||||||
|
});
|
||||||
|
List<CollectionElement> saveElements = elementVO.getGenerateCollectionElements();
|
||||||
|
collectionElementService.saveBatch(saveElements);
|
||||||
|
elementVO.getUsedElementIds().addAll(saveElements.stream().map(CollectionElement::getId).collect(Collectors.toList()));
|
||||||
|
//sketch
|
||||||
|
List<CollectionElement> newSketchAboard = saveElements.stream()
|
||||||
|
.filter(f -> f.getLevel1Type().equals(CollectionLevel1TypeEnum.SKETCH_BOARD.getRealName()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
if (!CollectionUtils.isEmpty(newSketchAboard)) {
|
||||||
|
elementVO.getSketchBoardElements().addAll(newSketchAboard);
|
||||||
|
}
|
||||||
|
//print
|
||||||
|
List<CollectionElement> newPrintboard = saveElements.stream()
|
||||||
|
.filter(f -> f.getLevel1Type().equals(CollectionLevel1TypeEnum.PRINT_BOARD.getRealName()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
if (!CollectionUtils.isEmpty(newPrintboard)) {
|
||||||
|
elementVO.getPrintBoardElements().addAll(newPrintboard);
|
||||||
|
}
|
||||||
|
//mood
|
||||||
|
List<CollectionElement> newMoodboard = saveElements.stream()
|
||||||
|
.filter(f -> f.getLevel1Type().equals(CollectionLevel1TypeEnum.MOOD_BOARD.getRealName()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
if (!CollectionUtils.isEmpty(newMoodboard)) {
|
||||||
|
elementVO.getMoodBoardElements().addAll(newMoodboard);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private DesignCollectionVO designOrRedesignOperate(DesignCollectionDTO designDTO, AuthPrincipalVo userInfo,
|
private DesignCollectionVO designOrRedesignOperate(DesignCollectionDTO designDTO, AuthPrincipalVo userInfo,
|
||||||
Long collectionIdParam, ValidateElementVO elementVO) {
|
Long collectionIdParam, ValidateElementVO elementVO) {
|
||||||
if (CollectionUtil.isNotEmpty(designDTO.getSketchBoards())) {
|
if (CollectionUtil.isNotEmpty(designDTO.getSketchBoards())) {
|
||||||
@@ -222,6 +275,8 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
collectionElementService.relationCollection(elementIds, collectionId);
|
collectionElementService.relationCollection(elementIds, collectionId);
|
||||||
//library转化为collection(生成)
|
//library转化为collection(生成)
|
||||||
saveCollectionElemntsByLibrarys(elementVO, collectionId);
|
saveCollectionElemntsByLibrarys(elementVO, collectionId);
|
||||||
|
//generate转化为collection(生成)
|
||||||
|
saveCollectionElemntsByGenerates(elementVO, collectionId);
|
||||||
//保存颜色版
|
//保存颜色版
|
||||||
List<CollectionElementVO> colorElementList = collectionElementService.saveColorBoard(designDTO.getColorBoards(), collectionId, designDTO.getTimeZone());
|
List<CollectionElementVO> colorElementList = collectionElementService.saveColorBoard(designDTO.getColorBoards(), collectionId, designDTO.getTimeZone());
|
||||||
//保存design
|
//保存design
|
||||||
@@ -260,10 +315,10 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
if (StringUtils.isEmpty(path)) {
|
if (StringUtils.isEmpty(path)) {
|
||||||
String bodyPath = item.getBody_path();
|
String bodyPath = item.getBody_path();
|
||||||
Long imageId = pythonTAllInfoService.getImageIdByPath(bodyPath);
|
Long imageId = pythonTAllInfoService.getImageIdByPath(bodyPath);
|
||||||
item.setImageId(imageId);
|
item.setImage_id(imageId);
|
||||||
} else {
|
} else {
|
||||||
Long imageId = pythonTAllInfoService.getImageIdByPath(path);
|
Long imageId = pythonTAllInfoService.getImageIdByPath(path);
|
||||||
item.setImageId(imageId);
|
item.setImage_id(imageId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -287,6 +342,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
.build()
|
.build()
|
||||||
).collect(Collectors.toList()));
|
).collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateLibrary(ValidateElementVO elementVO, String timeZone) {
|
private void generateLibrary(ValidateElementVO elementVO, String timeZone) {
|
||||||
List<CollectionElement> elements = Lists.newArrayList();
|
List<CollectionElement> elements = Lists.newArrayList();
|
||||||
if (!CollectionUtils.isEmpty(elementVO.getMoodBoardElements())) {
|
if (!CollectionUtils.isEmpty(elementVO.getMoodBoardElements())) {
|
||||||
@@ -303,6 +359,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
}
|
}
|
||||||
collectionElementService.saveLibraryByCollectionElement(elements, timeZone);
|
collectionElementService.saveLibraryByCollectionElement(elements, timeZone);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BigDecimal countDesignProcess() {
|
public BigDecimal countDesignProcess() {
|
||||||
AuthPrincipalVo userInfo = UserContext.getUserHolder();
|
AuthPrincipalVo userInfo = UserContext.getUserHolder();
|
||||||
@@ -337,12 +394,14 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
|
|
||||||
private void setDesignProcess(Long userId, DesignPythonObjects pythonObjects) {
|
private void setDesignProcess(Long userId, DesignPythonObjects pythonObjects) {
|
||||||
List<String> saveNames = pythonObjects.getObjects().stream().map(object -> {
|
List<String> saveNames = pythonObjects.getObjects().stream().map(object -> {
|
||||||
return object.getBasic().getSave_name();}).collect(Collectors.toList());
|
return object.getBasic().getSave_name();
|
||||||
|
}).collect(Collectors.toList());
|
||||||
LocalCacheUtils.setDesignProcessCache(userId, saveNames);
|
LocalCacheUtils.setDesignProcessCache(userId, saveNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private MinioUtil minIoUtil;
|
private MinioUtil minIoUtil;
|
||||||
|
|
||||||
private DesignCollectionVO savePythonDesignItemAndDetail(DesignPythonObjects pythonObjects
|
private DesignCollectionVO savePythonDesignItemAndDetail(DesignPythonObjects pythonObjects
|
||||||
, Long designId, Long collectionId, AuthPrincipalVo userInfo, String timeZone, JSONObject responseJSONObject) {
|
, Long designId, Long collectionId, AuthPrincipalVo userInfo, String timeZone, JSONObject responseJSONObject) {
|
||||||
DesignCollectionVO response = new DesignCollectionVO();
|
DesignCollectionVO response = new DesignCollectionVO();
|
||||||
@@ -420,7 +479,11 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
designCollectionItemVO.setDesignItemId(designItemId);
|
designCollectionItemVO.setDesignItemId(designItemId);
|
||||||
designCollectionItemVO.setDesignItemUrl(designItem.getDesignUrl());
|
designCollectionItemVO.setDesignItemUrl(designItem.getDesignUrl());
|
||||||
designCollectionItemVO.setDesignOutfitId(designPythonOutfit.getId());
|
designCollectionItemVO.setDesignOutfitId(designPythonOutfit.getId());
|
||||||
designCollectionItemVO.setDesignOutfitUrl(minIoUtil.getPresignedUrl(bucketName, designPythonOutfit.getDesignUrl(), 5));
|
String designUrl = designPythonOutfit.getDesignUrl();
|
||||||
|
if (!StringUtils.isEmpty(designUrl) && designUrl.contains("/")) {
|
||||||
|
int firstIndex = designUrl.indexOf("/");
|
||||||
|
designCollectionItemVO.setDesignOutfitUrl(minIoUtil.getPresignedUrl(designUrl.substring(0,firstIndex), designUrl.substring(firstIndex+1), 5));
|
||||||
|
}
|
||||||
//response
|
//response
|
||||||
designCollectionItems.add(designCollectionItemVO);
|
designCollectionItems.add(designCollectionItemVO);
|
||||||
|
|
||||||
@@ -498,6 +561,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
});
|
});
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Long> getElementId(ValidateElementVO elementVO) {
|
private List<Long> getElementId(ValidateElementVO elementVO) {
|
||||||
List<Long> elementIds = Lists.newArrayList();
|
List<Long> elementIds = Lists.newArrayList();
|
||||||
// collection type
|
// collection type
|
||||||
@@ -541,6 +605,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
return designOrRedesignOperate(CopyUtil.copyObject(
|
return designOrRedesignOperate(CopyUtil.copyObject(
|
||||||
reDesignDTO, DesignCollectionDTO.class), userInfo, reDesignDTO.getCollectionId(), elementVO);
|
reDesignDTO, DesignCollectionDTO.class), userInfo, reDesignDTO.getCollectionId(), elementVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Long> calculateNoRelationElement(Long collectionId, List<Long> usedElementIds) {
|
private List<Long> calculateNoRelationElement(Long collectionId, List<Long> usedElementIds) {
|
||||||
List<CollectionElement> collectionElements = collectionElementService.getByCollectionId(collectionId);
|
List<CollectionElement> collectionElements = collectionElementService.getByCollectionId(collectionId);
|
||||||
if (CollectionUtils.isEmpty(collectionElements)) {
|
if (CollectionUtils.isEmpty(collectionElements)) {
|
||||||
@@ -565,6 +630,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
}
|
}
|
||||||
return new DesignCollectionVO(designId, design.getCollectionId(), coverDesignItemToVO(designItems));
|
return new DesignCollectionVO(designId, design.getCollectionId(), coverDesignItemToVO(designItems));
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<DesignCollectionItemVO> coverDesignItemToVO(List<DesignItem> designItems) {
|
private List<DesignCollectionItemVO> coverDesignItemToVO(List<DesignItem> designItems) {
|
||||||
List<DesignCollectionItemVO> response = Lists.newArrayList();
|
List<DesignCollectionItemVO> response = Lists.newArrayList();
|
||||||
designItems.forEach(designItem -> {
|
designItems.forEach(designItem -> {
|
||||||
@@ -643,6 +709,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
});
|
});
|
||||||
return adds;
|
return adds;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int calculateGroupNum(List<CollectionElement> thisElement, List<Long> adds) {
|
private int calculateGroupNum(List<CollectionElement> thisElement, List<Long> adds) {
|
||||||
int num = 0;
|
int num = 0;
|
||||||
List<Long> groupOldIds = thisElement.stream().map(CollectionElement::getId).collect(Collectors.toList());
|
List<Long> groupOldIds = thisElement.stream().map(CollectionElement::getId).collect(Collectors.toList());
|
||||||
@@ -653,6 +720,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
}
|
}
|
||||||
return num + thisElement.size();
|
return num + thisElement.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
private UserLike resolveUserLike(Long userGroupId, Long designId, Long designItemId, String designUrl, String timeZone) {
|
private UserLike resolveUserLike(Long userGroupId, Long designId, Long designItemId, String designUrl, String timeZone) {
|
||||||
UserLike userLike = new UserLike();
|
UserLike userLike = new UserLike();
|
||||||
userLike.setCreateDate(DateUtil.getByTimeZone(timeZone));
|
userLike.setCreateDate(DateUtil.getByTimeZone(timeZone));
|
||||||
@@ -760,6 +828,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
}));
|
}));
|
||||||
return editDesignItemLayer(flag, designPythonOutfit, designItem.getDesignUrl(), editResponseColor(designItemDetails, response));
|
return editDesignItemLayer(flag, designPythonOutfit, designItem.getDesignUrl(), editResponseColor(designItemDetails, response));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String converTypeToLevel1(String type) {
|
private String converTypeToLevel1(String type) {
|
||||||
if (StringUtils.isEmpty(type)) {
|
if (StringUtils.isEmpty(type)) {
|
||||||
return null;
|
return null;
|
||||||
@@ -779,6 +848,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
queryWrapper.eq("collection_id", collectionId);
|
queryWrapper.eq("collection_id", collectionId);
|
||||||
return designMapper.selectOne(queryWrapper);
|
return designMapper.selectOne(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int deleteByCollectionId(Long collectionId) {
|
private int deleteByCollectionId(Long collectionId) {
|
||||||
QueryWrapper<Design> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<Design> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.eq("collection_id", collectionId);
|
queryWrapper.eq("collection_id", collectionId);
|
||||||
|
|||||||
@@ -5,26 +5,22 @@ import com.ai.da.common.config.exception.BusinessException;
|
|||||||
import com.ai.da.common.context.UserContext;
|
import com.ai.da.common.context.UserContext;
|
||||||
import com.ai.da.common.enums.*;
|
import com.ai.da.common.enums.*;
|
||||||
import com.ai.da.common.response.PageBaseResponse;
|
import com.ai.da.common.response.PageBaseResponse;
|
||||||
import com.ai.da.common.response.Response;
|
|
||||||
import com.ai.da.common.utils.CopyUtil;
|
import com.ai.da.common.utils.CopyUtil;
|
||||||
import com.ai.da.common.utils.DateUtil;
|
import com.ai.da.common.utils.DateUtil;
|
||||||
import com.ai.da.common.utils.FileUtil;
|
import com.ai.da.common.utils.MinioUtil;
|
||||||
import com.ai.da.mapper.CollectionElementMapper;
|
|
||||||
import com.ai.da.mapper.LibraryMapper;
|
import com.ai.da.mapper.LibraryMapper;
|
||||||
import com.ai.da.mapper.UserLikeMapper;
|
|
||||||
import com.ai.da.mapper.entity.*;
|
import com.ai.da.mapper.entity.*;
|
||||||
import com.ai.da.model.dto.*;
|
import com.ai.da.model.dto.*;
|
||||||
import com.ai.da.model.vo.*;
|
import com.ai.da.model.vo.*;
|
||||||
import com.ai.da.service.LibraryModelPointService;
|
import com.ai.da.service.LibraryModelPointService;
|
||||||
import com.ai.da.service.LibraryService;
|
import com.ai.da.service.LibraryService;
|
||||||
import com.ai.da.service.UserLikeService;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
@@ -50,6 +46,12 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
|||||||
private FileProperties fileProperties;
|
private FileProperties fileProperties;
|
||||||
@Resource
|
@Resource
|
||||||
private LibraryModelPointService libraryModelPointService;
|
private LibraryModelPointService libraryModelPointService;
|
||||||
|
@Resource
|
||||||
|
private MinioUtil minioUtil;
|
||||||
|
@Value("minio.bucketName.mannequins")
|
||||||
|
private String mannequins;
|
||||||
|
@Value("minio.bucketName.users")
|
||||||
|
private String users;
|
||||||
|
|
||||||
private static List<String> top = Arrays.asList(CollectionLevel2TypeEnum.DRESS.getRealName(),
|
private static List<String> top = Arrays.asList(CollectionLevel2TypeEnum.DRESS.getRealName(),
|
||||||
CollectionLevel2TypeEnum.OUTWEAR.getRealName(),CollectionLevel2TypeEnum.BLOUSE.getRealName());
|
CollectionLevel2TypeEnum.OUTWEAR.getRealName(),CollectionLevel2TypeEnum.BLOUSE.getRealName());
|
||||||
@@ -143,39 +145,49 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
|||||||
Assert.isTrue(!( level1TypeEnum.equals(LibraryLevel1TypeEnum.SKETCH_BOARD)
|
Assert.isTrue(!( level1TypeEnum.equals(LibraryLevel1TypeEnum.SKETCH_BOARD)
|
||||||
&& StringUtils.isEmpty(libraryUploadDTO.getLevel2Type()) ),"level2Type cannot be empty!");
|
&& StringUtils.isEmpty(libraryUploadDTO.getLevel2Type()) ),"level2Type cannot be empty!");
|
||||||
String path = calculateFileUrl(level1TypeEnum, userInfo.getId());
|
String path = calculateFileUrl(level1TypeEnum, userInfo.getId());
|
||||||
File file = FileUtil.upload(libraryUploadDTO.getFile(), path);
|
String bucketName = null;
|
||||||
|
switch (level1TypeEnum) {
|
||||||
|
case MODELS:
|
||||||
|
bucketName = mannequins;
|
||||||
|
break;
|
||||||
|
case MOOD_BOARD:
|
||||||
|
case PRINT_BOARD:
|
||||||
|
case SKETCH_BOARD:
|
||||||
|
bucketName = users;
|
||||||
|
break;
|
||||||
|
case MARKETING_SKETCH:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new BusinessException("unknown level1_type");
|
||||||
|
}
|
||||||
|
String filePath = minioUtil.upload(bucketName, path, libraryUploadDTO.getFile());
|
||||||
//保存element元素
|
//保存element元素
|
||||||
Library library = resolveData(libraryUploadDTO, userInfo, file);
|
Library library = resolveData(libraryUploadDTO, userInfo, filePath, bucketName);
|
||||||
saveOne(library);
|
|
||||||
return CopyUtil.copyObject(library,LibraryUpdateVo.class);
|
return CopyUtil.copyObject(library,LibraryUpdateVo.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Library resolveData(LibraryUploadDTO uploadDTO, AuthPrincipalVo userInfo, File file) {
|
private Library resolveData(LibraryUploadDTO uploadDTO, AuthPrincipalVo userInfo, String filePath, String bucketName) {
|
||||||
Library library = CopyUtil.copyObject(uploadDTO, Library.class);
|
Library library = CopyUtil.copyObject(uploadDTO, Library.class);
|
||||||
library.setAccountId(userInfo.getId());
|
library.setAccountId(userInfo.getId());
|
||||||
String pictureName = file.getName();
|
|
||||||
//获取图片后缀
|
|
||||||
String suffix = pictureName.substring(pictureName.lastIndexOf("."));
|
|
||||||
//获取图片前缀
|
|
||||||
String prefix = pictureName.substring(0,pictureName.lastIndexOf("."));
|
|
||||||
library.setName(DateUtil.dateToStr(new Date(),DateUtil.YYYY_MM_DD));
|
library.setName(DateUtil.dateToStr(new Date(),DateUtil.YYYY_MM_DD));
|
||||||
library.setUrl(file.getAbsolutePath());
|
library.setUrl(bucketName + File.separator + filePath);
|
||||||
//按时区计算
|
//按时区计算
|
||||||
library.setCreateDate(DateUtil.getByTimeZone(uploadDTO.getTimeZone()));
|
library.setCreateDate(DateUtil.getByTimeZone(uploadDTO.getTimeZone()));
|
||||||
String linuxDomain = fileProperties.getLinuxDomain();
|
// String linuxDomain = fileProperties.getLinuxDomain();
|
||||||
if (!StringUtils.isEmpty(linuxDomain)) {
|
// if (!StringUtils.isEmpty(linuxDomain)) {
|
||||||
//linux 系统
|
// //linux 系统
|
||||||
String oldPath = fileProperties.getSys().getPath();
|
// String oldPath = fileProperties.getSys().getPath();
|
||||||
library.setUrl(file.getAbsolutePath().replace(oldPath, linuxDomain));
|
// library.setUrl(file.getAbsolutePath().replace(oldPath, linuxDomain));
|
||||||
}
|
// }
|
||||||
|
libraryMapper.insert(library);
|
||||||
return library;
|
return library;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String calculateFileUrl(LibraryLevel1TypeEnum level1TypeEnum, Long userId) {
|
private String calculateFileUrl(LibraryLevel1TypeEnum level1TypeEnum, Long userId) {
|
||||||
String rootPath = fileProperties.getSys().getPath();
|
// String rootPath = fileProperties.getSys().getPath();
|
||||||
String day = DateUtil.dateToStr(new Date(), DateUtil.YYYYMM);
|
String day = DateUtil.dateToStr(new Date(), DateUtil.YYYYMM);
|
||||||
return rootPath + day + File.separator + "userFile" + File.separator + "library"
|
return day + File.separator + "userFile" + File.separator + "library"
|
||||||
+ File.separator + level1TypeEnum.getRealName() + File.separator + userId + File.separator+UUID.randomUUID().toString();
|
+ File.separator + level1TypeEnum.getRealName() + File.separator + userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import java.util.Objects;
|
|||||||
@Service
|
@Service
|
||||||
public class TDesignPythonOutfitDetailServiceImpl extends ServiceImpl<TDesignPythonOutfitDetailMapper, TDesignPythonOutfitDetail> implements ITDesignPythonOutfitDetailService {
|
public class TDesignPythonOutfitDetailServiceImpl extends ServiceImpl<TDesignPythonOutfitDetailMapper, TDesignPythonOutfitDetail> implements ITDesignPythonOutfitDetailService {
|
||||||
|
|
||||||
@Value("${minio.bucketName2}")
|
@Value("${minio.bucketName.clothing}")
|
||||||
private String bucketName2;
|
private String bucketName2;
|
||||||
@Resource
|
@Resource
|
||||||
private MinioUtil minIoUtil;
|
private MinioUtil minIoUtil;
|
||||||
|
|||||||
@@ -2,9 +2,15 @@ package com.ai.da.service.impl;
|
|||||||
|
|
||||||
import com.ai.da.common.config.exception.BusinessException;
|
import com.ai.da.common.config.exception.BusinessException;
|
||||||
import com.ai.da.common.context.UserContext;
|
import com.ai.da.common.context.UserContext;
|
||||||
|
import com.ai.da.common.enums.LibraryLevel1TypeEnum;
|
||||||
|
import com.ai.da.common.enums.SysFileLevel1TypeEnum;
|
||||||
|
import com.ai.da.common.enums.SysFileLevel2TypeEnum;
|
||||||
import com.ai.da.common.response.PageBaseResponse;
|
import com.ai.da.common.response.PageBaseResponse;
|
||||||
|
import com.ai.da.mapper.LibraryMapper;
|
||||||
|
import com.ai.da.mapper.SysFileMapper;
|
||||||
import com.ai.da.mapper.WorkspaceMapper;
|
import com.ai.da.mapper.WorkspaceMapper;
|
||||||
import com.ai.da.mapper.entity.Account;
|
import com.ai.da.mapper.entity.Library;
|
||||||
|
import com.ai.da.mapper.entity.SysFile;
|
||||||
import com.ai.da.mapper.entity.Workspace;
|
import com.ai.da.mapper.entity.Workspace;
|
||||||
import com.ai.da.model.dto.WorkspaceDTO;
|
import com.ai.da.model.dto.WorkspaceDTO;
|
||||||
import com.ai.da.model.enums.BizJson;
|
import com.ai.da.model.enums.BizJson;
|
||||||
@@ -12,21 +18,20 @@ import com.ai.da.model.enums.IEnumDisplay;
|
|||||||
import com.ai.da.model.enums.Position;
|
import com.ai.da.model.enums.Position;
|
||||||
import com.ai.da.model.enums.Sex;
|
import com.ai.da.model.enums.Sex;
|
||||||
import com.ai.da.model.vo.AuthPrincipalVo;
|
import com.ai.da.model.vo.AuthPrincipalVo;
|
||||||
|
import com.ai.da.model.vo.ModelVO;
|
||||||
|
import com.ai.da.model.vo.ModelsVO;
|
||||||
import com.ai.da.model.vo.WorkspaceVO;
|
import com.ai.da.model.vo.WorkspaceVO;
|
||||||
|
import com.ai.da.service.LibraryService;
|
||||||
|
import com.ai.da.service.SysFileService;
|
||||||
import com.ai.da.service.WorkspaceService;
|
import com.ai.da.service.WorkspaceService;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import org.springframework.security.core.Authentication;
|
|
||||||
import org.springframework.security.core.context.SecurityContextHolder;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
@@ -42,6 +47,12 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
|||||||
@Resource
|
@Resource
|
||||||
private WorkspaceMapper workspaceMapper;
|
private WorkspaceMapper workspaceMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private LibraryMapper libraryMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SysFileMapper sysFileMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<WorkspaceVO> selectWorkspacePage(IPage<WorkspaceVO> page, WorkspaceVO workspace) {
|
public IPage<WorkspaceVO> selectWorkspacePage(IPage<WorkspaceVO> page, WorkspaceVO workspace) {
|
||||||
return page.setRecords(baseMapper.selectWorkspacePage(page, workspace));
|
return page.setRecords(baseMapper.selectWorkspacePage(page, workspace));
|
||||||
@@ -134,6 +145,45 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
|||||||
return newIsLastIndex;
|
return newIsLastIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ModelsVO> getMannequins() {
|
||||||
|
AuthPrincipalVo userInfo = UserContext.getUserHolder();
|
||||||
|
List<ModelsVO> result = new ArrayList<>();
|
||||||
|
QueryWrapper<Library> libraryQueryWrapper = new QueryWrapper<>();
|
||||||
|
libraryQueryWrapper.lambda().eq(Library::getAccountId, userInfo.getId());
|
||||||
|
libraryQueryWrapper.lambda().eq(Library::getLevel1Type, LibraryLevel1TypeEnum.MODELS.getRealName());
|
||||||
|
List<Library> libraries = libraryMapper.selectList(libraryQueryWrapper);
|
||||||
|
if (!CollectionUtils.isEmpty(libraries)) {
|
||||||
|
List<ModelVO> modelVOList = new ArrayList<>();
|
||||||
|
for (Library library : libraries) {
|
||||||
|
ModelVO modelVO = new ModelVO();
|
||||||
|
modelVO.setId(library.getId());
|
||||||
|
modelVO.setUrl(library.getUrl());
|
||||||
|
}
|
||||||
|
ModelsVO vo = new ModelsVO();
|
||||||
|
vo.setModelList(modelVOList);
|
||||||
|
vo.setType("Library");
|
||||||
|
result.add(vo);
|
||||||
|
}
|
||||||
|
QueryWrapper<SysFile> sysFileQueryWrapper = new QueryWrapper<>();
|
||||||
|
sysFileQueryWrapper.lambda().eq(SysFile::getLevel1Type, SysFileLevel1TypeEnum.ACCESSORIES.getRealName());
|
||||||
|
sysFileQueryWrapper.lambda().eq(SysFile::getLevel2Type, SysFileLevel2TypeEnum.BODY.getRealName());
|
||||||
|
List<SysFile> sysFileList = sysFileMapper.selectList(sysFileQueryWrapper);
|
||||||
|
if (!CollectionUtils.isEmpty(sysFileList)) {
|
||||||
|
List<ModelVO> modelVOList = new ArrayList<>();
|
||||||
|
for (SysFile sysFile : sysFileList) {
|
||||||
|
ModelVO modelVO = new ModelVO();
|
||||||
|
modelVO.setId(sysFile.getId());
|
||||||
|
modelVO.setUrl(sysFile.getUrl());
|
||||||
|
}
|
||||||
|
ModelsVO vo = new ModelsVO();
|
||||||
|
vo.setModelList(modelVOList);
|
||||||
|
vo.setType("System");
|
||||||
|
result.add(vo);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
private List<BizJson> getEnumValues(Class clazz) {
|
private List<BizJson> getEnumValues(Class clazz) {
|
||||||
List<BizJson> kvs = new ArrayList<BizJson>();
|
List<BizJson> kvs = new ArrayList<BizJson>();
|
||||||
IEnumDisplay[] items = (IEnumDisplay[]) clazz.getEnumConstants();
|
IEnumDisplay[] items = (IEnumDisplay[]) clazz.getEnumConstants();
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
server.port=5566
|
server.port=5567
|
||||||
|
|
||||||
#datasource
|
#datasource
|
||||||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||||
spring.datasource.url=jdbc:mysql://18.167.251.121:3306/aida?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
|
spring.datasource.url=jdbc:mysql://18.167.251.121:33006/aida?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
|
||||||
spring.datasource.username=root
|
spring.datasource.username=root
|
||||||
spring.datasource.password=QWa998345
|
spring.datasource.password=root
|
||||||
|
#spring.datasource.password=QWa998345
|
||||||
|
|
||||||
#security
|
#security
|
||||||
spring.security.jwtSecret=JWTSECRET
|
spring.security.jwtSecret=JWTSECRET
|
||||||
@@ -14,7 +15,7 @@ spring.security.jwtTokenPrefix=Bearer-
|
|||||||
spring.security.jwtExpiration=8640000000
|
spring.security.jwtExpiration=8640000000
|
||||||
#spring security权限设置 认证了token还要认证权限 不然报错Full authentication is required to access this resource
|
#spring security权限设置 认证了token还要认证权限 不然报错Full authentication is required to access this resource
|
||||||
spring.security.ignorePaths=/,/favicon.ico,/doc.html,/webjars/**,/swagger-resources,/v2/api-docs,\
|
spring.security.ignorePaths=/,/favicon.ico,/doc.html,/webjars/**,/swagger-resources,/v2/api-docs,\
|
||||||
/api/account/**,/api/element/**,/api/python/**,/api/design/**,/api/history/**,/api/library/**,/api/third/party/**
|
/api/account/**,/api/element/**,/api/python/**,/api/design/**,/api/history/**,/api/library/**,/api/third/party/**,/api/workspace/**
|
||||||
spring.security.authApi=/auth/login
|
spring.security.authApi=/auth/login
|
||||||
|
|
||||||
|
|
||||||
@@ -24,6 +25,9 @@ rsa.private_key=MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEA0vfvyTdGJkdbHkB8
|
|||||||
mybatis-plus.global-config.banner=false
|
mybatis-plus.global-config.banner=false
|
||||||
mybatis-plus.mapper-locations=classpath:mapper/*Mapper.xml
|
mybatis-plus.mapper-locations=classpath:mapper/*Mapper.xml
|
||||||
#mybatis-plus.configuration.log-impl= org.apache.ibatis.logging.stdout.StdOutImpl
|
#mybatis-plus.configuration.log-impl= org.apache.ibatis.logging.stdout.StdOutImpl
|
||||||
|
mybatis-plus.global-config.db-config.logic-delete-field=isDeleted
|
||||||
|
mybatis-plus.global-config.db-config.logic-delete-value=1
|
||||||
|
mybatis-plus.global-config.db-config.logic-not-delete-value=0
|
||||||
|
|
||||||
spring.mvc.pathmatch.matching-strategy=ant_path_matcher
|
spring.mvc.pathmatch.matching-strategy=ant_path_matcher
|
||||||
|
|
||||||
@@ -36,3 +40,14 @@ spring.servlet.multipart.max-file-size = 5MB
|
|||||||
spring.servlet.multipart.max-request-size= 5MB
|
spring.servlet.multipart.max-request-size= 5MB
|
||||||
#访问python服务的ip(对应环境)
|
#访问python服务的ip(对应环境)
|
||||||
access.python.ip=http://43.198.80.117
|
access.python.ip=http://43.198.80.117
|
||||||
|
#access.python.ip=http://18.167.251.121
|
||||||
|
#access.python.ip=http://18.167.251.121:9991/
|
||||||
|
|
||||||
|
minio.endpoint=http://18.167.251.121:9000
|
||||||
|
minio.accessKey=minioadmin
|
||||||
|
minio.secretKey=minioadmin
|
||||||
|
minio.bucketName.clothing=aida-clothing
|
||||||
|
minio.bucketName.mannequins=aida-mannequins
|
||||||
|
minio.bucketName.results=aida-results
|
||||||
|
minio.bucketName.sysImage=aida-sys-image
|
||||||
|
minio.bucketName.users=aida-users
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#<23><><EFBFBD><EFBFBD>application-test<73>ļ<EFBFBD>(<28><><EFBFBD>Ի<EFBFBD><D4BB><EFBFBD>)
|
#<23><><EFBFBD><EFBFBD>application-test<73>ļ<EFBFBD>(<28><><EFBFBD>Ի<EFBFBD><D4BB><EFBFBD>)
|
||||||
spring.profiles.active=test
|
spring.profiles.active=prod
|
||||||
|
|
||||||
#<23><><EFBFBD><EFBFBD>application-prod<6F>ļ<EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
#<23><><EFBFBD><EFBFBD>application-prod<6F>ļ<EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||||
#spring.profiles.active=prod
|
#spring.profiles.active=prod
|
||||||
|
|||||||
Reference in New Issue
Block a user