Merge remote-tracking branch 'origin/dev_shb' into develop
# Conflicts: # src/main/java/com/ai/da/service/impl/DesignServiceImpl.java # src/main/java/com/ai/da/service/impl/LibraryServiceImpl.java
This commit is contained in:
@@ -15,7 +15,8 @@ public enum DesignTypeEnum {
|
||||
/**
|
||||
* Library
|
||||
*/
|
||||
LIBRARY("Library");
|
||||
LIBRARY("Library"),
|
||||
GENERATE("Generate");
|
||||
|
||||
private String realName;
|
||||
|
||||
|
||||
@@ -3,8 +3,10 @@ package com.ai.da.controller;
|
||||
import com.ai.da.common.response.Response;
|
||||
import com.ai.da.common.utils.MinioUtil;
|
||||
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.enums.BizJson;
|
||||
import com.ai.da.model.vo.ModelsVO;
|
||||
import com.ai.da.model.vo.WorkspaceVO;
|
||||
import com.ai.da.service.WorkspaceService;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -38,29 +40,6 @@ public class WorkspaceController {
|
||||
@Resource
|
||||
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);
|
||||
}
|
||||
|
||||
@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 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();
|
||||
//用于存储library 生成collection
|
||||
List<CollectionElement> libraryCollectionElements = Lists.newArrayList();
|
||||
//用于存储generate 生成collection
|
||||
List<CollectionElement> generateCollectionElements = Lists.newArrayList();
|
||||
//存储template打点数据
|
||||
DesignLibraryModelPointVO designLibraryModelPoint =null;
|
||||
//存储本次design已经使用的上衣和下衣的的MD5list 去重用
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,12 +1,15 @@
|
||||
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.GenerateThroughImageTextDTO;
|
||||
import com.ai.da.model.vo.GenerateCaptionVO;
|
||||
import com.ai.da.model.vo.GenerateCollectionVO;
|
||||
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);
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ package com.ai.da.service;
|
||||
import com.ai.da.mapper.entity.Workspace;
|
||||
import com.ai.da.model.dto.WorkspaceDTO;
|
||||
import com.ai.da.model.enums.BizJson;
|
||||
import com.ai.da.model.vo.ModelsVO;
|
||||
import com.ai.da.model.vo.WorkspaceVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
@@ -35,4 +36,6 @@ public interface WorkspaceService extends IService<Workspace> {
|
||||
List<BizJson> getEnumValues(String enumName);
|
||||
|
||||
Workspace getByIdNew(Long id);
|
||||
|
||||
List<ModelsVO> getMannequins();
|
||||
}
|
||||
|
||||
@@ -64,6 +64,8 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
@Resource
|
||||
private LibraryService libraryService;
|
||||
@Resource
|
||||
private GenerateService generateService;
|
||||
@Resource
|
||||
private LibraryModelPointService libraryModelPointService;
|
||||
@Resource
|
||||
private TCollectionElementRelationService tCollectionElementRelationService;
|
||||
@@ -231,6 +233,7 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
|
||||
List<Long> usedElementIds = elementVO.getUsedElementIds();
|
||||
List<CollectionElement> libraryCollectionElements = elementVO.getLibraryCollectionElements();
|
||||
List<CollectionElement> generateCollectionElements = elementVO.getGenerateCollectionElements();
|
||||
//校验moodboard
|
||||
if (CollectionUtil.isNotEmpty(designDTO.getMoodBoards())) {
|
||||
//校验designType
|
||||
@@ -258,6 +261,17 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
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())) {
|
||||
//校验designType
|
||||
@@ -289,6 +303,20 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
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())) {
|
||||
//校验PIN是否满足 上衣或者下衣必须不超过8
|
||||
@@ -335,6 +363,20 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
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
|
||||
// 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){
|
||||
return CopyUtil.copyList(libraries,CollectionElement.class,(o,d) ->{
|
||||
if(null != idToMap){
|
||||
DesignCollectionPrintElementDTO sketchDTO = idToMap.get(o.getId());
|
||||
d.setHasPin(sketchDTO.getIsPin());
|
||||
DesignCollectionPrintElementDTO printDTO = idToMap.get(o.getId());
|
||||
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;
|
||||
@Resource
|
||||
private MinioUtil minioUtil;
|
||||
@Value("${minio.bucketName}")
|
||||
@Value("${minio.bucketName.results}")
|
||||
private String bucketName;
|
||||
|
||||
@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.context.UserContext;
|
||||
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.utils.*;
|
||||
import com.ai.da.mapper.DesignMapper;
|
||||
@@ -83,44 +84,46 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
private PythonTAllInfoService pythonTAllInfoService;
|
||||
@Value("${minio.endpoint}")
|
||||
private String endpoint;
|
||||
@Value("${minio.bucketName}")
|
||||
@Value("${minio.bucketName.results}")
|
||||
private String bucketName;
|
||||
|
||||
// @Transactional
|
||||
// @Transactional
|
||||
@Override
|
||||
public DesignCollectionVO designCollection(DesignCollectionDTO designDTO) {
|
||||
AuthPrincipalVo userInfo = UserContext.getUserHolder();
|
||||
//校验collection element
|
||||
ValidateElementVO elementVO =collectionElementService.validateElement(designDTO);
|
||||
ValidateElementVO elementVO = collectionElementService.validateElement(designDTO);
|
||||
//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
|
||||
List<LibraryVo> libraryVos ;
|
||||
if(CollectionUtil.isNotEmpty(designDTO.getSketchBoards())){
|
||||
List<LibraryVo> libraryVos;
|
||||
if (CollectionUtil.isNotEmpty(designDTO.getSketchBoards())) {
|
||||
List<String> sketchUrlList = elementVO.getSketchBoardElements()
|
||||
.stream()
|
||||
.map(CollectionElement::getUrl)
|
||||
.collect(Collectors.toList());
|
||||
DesignAttributeRetrievalDTO designAttributeRetrievalDTO =
|
||||
pythonService.generateAttributeRetrieval(sketchUrlList,userInfo.getId());
|
||||
if(CollectionUtils.isEmpty(designAttributeRetrievalDTO.getLibraryUrls())){
|
||||
pythonService.generateAttributeRetrieval(sketchUrlList, userInfo.getId());
|
||||
if (CollectionUtils.isEmpty(designAttributeRetrievalDTO.getLibraryUrls())) {
|
||||
libraryVos = null;
|
||||
}else{
|
||||
libraryVos =libraryService.getByUrlList(designAttributeRetrievalDTO.getLibraryUrls(),userInfo.getId());
|
||||
} else {
|
||||
libraryVos = libraryService.getByUrlList(designAttributeRetrievalDTO.getLibraryUrls(), userInfo.getId());
|
||||
}
|
||||
List<SysFileVO> sysFileVOS =sysFileService.getByUrlList(designAttributeRetrievalDTO.getSysFileUrlS());
|
||||
List<SysFileVO> sysFileVOS = sysFileService.getByUrlList(designAttributeRetrievalDTO.getSysFileUrlS());
|
||||
elementVO.setSysFileVo(sysFileVOS);
|
||||
}else{
|
||||
libraryVos =libraryService.selectByAccountIdAnd1TypeList(userInfo.getId(),
|
||||
} else {
|
||||
libraryVos = libraryService.selectByAccountIdAnd1TypeList(userInfo.getId(),
|
||||
Collections.singletonList(CollectionLevel1TypeEnum.SKETCH_BOARD.getRealName()));
|
||||
}
|
||||
elementVO.setLibraryVos(libraryVos);
|
||||
//校验比列
|
||||
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();
|
||||
// //池子是包括三部分 = 本次用户上传的sketch + library的sketch +系统的sketch,systemScale计算的是 library和sysFile的比列
|
||||
@@ -130,127 +133,179 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
// throw new BusinessException("No sketch, please increase the system rate");
|
||||
// }
|
||||
}
|
||||
private void saveCollectionElemntsByLibrarys(ValidateElementVO elementVO,Long collectionId){
|
||||
if(CollectionUtils.isEmpty(elementVO.getLibraryCollectionElements())){
|
||||
|
||||
private void saveCollectionElemntsByLibrarys(ValidateElementVO elementVO, Long collectionId) {
|
||||
if (CollectionUtils.isEmpty(elementVO.getLibraryCollectionElements())) {
|
||||
return;
|
||||
}
|
||||
elementVO.getLibraryCollectionElements()
|
||||
.forEach(element ->{
|
||||
.forEach(element -> {
|
||||
element.setCollectionId(collectionId);
|
||||
Byte hasPin = element.getHasPin();
|
||||
if(Objects.isNull(hasPin)){
|
||||
if (Objects.isNull(hasPin)) {
|
||||
element.setHasPin((byte) 0);
|
||||
}
|
||||
element.setId(null);
|
||||
// element.setType(DesignTypeEnum.LIBRARY.getRealName());
|
||||
});
|
||||
List<CollectionElement> saveElements = elementVO.getLibraryCollectionElements();
|
||||
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()))
|
||||
List<CollectionElement> newSketchAboard = saveElements.stream()
|
||||
.filter(f -> f.getLevel1Type().equals(CollectionLevel1TypeEnum.SKETCH_BOARD.getRealName()))
|
||||
.collect(Collectors.toList());
|
||||
if(!CollectionUtils.isEmpty(newSketchAboard)){
|
||||
if (!CollectionUtils.isEmpty(newSketchAboard)) {
|
||||
elementVO.getSketchBoardElements().addAll(newSketchAboard);
|
||||
}
|
||||
//print
|
||||
List<CollectionElement> newPrintboard =saveElements.stream()
|
||||
.filter(f->f.getLevel1Type().equals(CollectionLevel1TypeEnum.PRINT_BOARD.getRealName()))
|
||||
List<CollectionElement> newPrintboard = saveElements.stream()
|
||||
.filter(f -> f.getLevel1Type().equals(CollectionLevel1TypeEnum.PRINT_BOARD.getRealName()))
|
||||
.collect(Collectors.toList());
|
||||
if(!CollectionUtils.isEmpty(newPrintboard)){
|
||||
if (!CollectionUtils.isEmpty(newPrintboard)) {
|
||||
elementVO.getPrintBoardElements().addAll(newPrintboard);
|
||||
}
|
||||
}
|
||||
private DesignCollectionVO designOrRedesignOperate(DesignCollectionDTO designDTO,AuthPrincipalVo userInfo,
|
||||
Long collectionIdParam,ValidateElementVO elementVO){
|
||||
if(CollectionUtil.isNotEmpty(designDTO.getSketchBoards())){
|
||||
//编辑sketchBoard
|
||||
collectionElementService.editSketchBoardsElement(elementVO,designDTO.getSketchBoards());
|
||||
//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);
|
||||
}
|
||||
if(CollectionUtil.isNotEmpty(designDTO.getPrintBoards())){
|
||||
}
|
||||
|
||||
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,
|
||||
Long collectionIdParam, ValidateElementVO elementVO) {
|
||||
if (CollectionUtil.isNotEmpty(designDTO.getSketchBoards())) {
|
||||
//编辑sketchBoard
|
||||
collectionElementService.editSketchBoardsElement(elementVO, designDTO.getSketchBoards());
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(designDTO.getPrintBoards())) {
|
||||
//编辑printBoard
|
||||
collectionElementService.editPrintBoardsElement(elementVO,designDTO.getPrintBoards());
|
||||
collectionElementService.editPrintBoardsElement(elementVO, designDTO.getPrintBoards());
|
||||
}
|
||||
//保存collection
|
||||
Long collectionId = (null == collectionIdParam) ?
|
||||
collectionService.saveCollection(userInfo.getId(),designDTO.getTimeZone(),designDTO.getMoodTemplateId()) : collectionIdParam;
|
||||
collectionService.saveCollection(userInfo.getId(), designDTO.getTimeZone(), designDTO.getMoodTemplateId()) : collectionIdParam;
|
||||
List<Long> elementIds = getElementId(elementVO);
|
||||
//批量关联element 到 collection
|
||||
collectionElementService.relationCollection(elementIds,collectionId);
|
||||
collectionElementService.relationCollection(elementIds, collectionId);
|
||||
//library转化为collection(生成)
|
||||
saveCollectionElemntsByLibrarys(elementVO,collectionId);
|
||||
saveCollectionElemntsByLibrarys(elementVO, collectionId);
|
||||
//保存颜色版
|
||||
List<CollectionElementVO> colorElementList = collectionElementService.saveColorBoard(designDTO.getColorBoards(),collectionId,designDTO.getTimeZone());
|
||||
List<CollectionElementVO> colorElementList = collectionElementService.saveColorBoard(designDTO.getColorBoards(), collectionId, designDTO.getTimeZone());
|
||||
//保存design
|
||||
Long designId = saveOne(designDTO,collectionId,userInfo.getId());
|
||||
Long designId = saveOne(designDTO, collectionId, userInfo.getId());
|
||||
//计算library
|
||||
calculateLibraryAndSysFile(designDTO,elementVO,userInfo);
|
||||
calculateLibraryAndSysFile(designDTO, elementVO, userInfo);
|
||||
//组装design入参
|
||||
DesignPythonObjects pythonObjects = pythonService.covertDesignParam(designDTO.getSystemScale(),
|
||||
designDTO.getSingleOverall(),designDTO.getSwitchCategory(),elementVO);
|
||||
designDTO.getSingleOverall(), designDTO.getSwitchCategory(), elementVO);
|
||||
//缓存保存的文件 方便后面处理进度问题
|
||||
setDesignProcess(userInfo.getId(),pythonObjects);
|
||||
setDesignProcess(userInfo.getId(), pythonObjects);
|
||||
//design
|
||||
pythonService.design(pythonObjects);
|
||||
//生成library
|
||||
generateLibrary(elementVO,designDTO.getTimeZone());
|
||||
generateLibrary(elementVO, designDTO.getTimeZone());
|
||||
//处理关联关系,修复element覆盖得情况
|
||||
List<CollectionElement> reLationelements =collectionElementService.getByOnlyCollectionId(collectionId);
|
||||
List<Long> reLationelementIds = reLationelements.stream().map(CollectionElement::getId).collect(Collectors.toList());
|
||||
handleCollectionElementRelation(collectionId,(null == collectionIdParam) ? false :true,reLationelementIds);
|
||||
List<CollectionElement> reLationelements = collectionElementService.getByOnlyCollectionId(collectionId);
|
||||
List<Long> reLationelementIds = reLationelements.stream().map(CollectionElement::getId).collect(Collectors.toList());
|
||||
handleCollectionElementRelation(collectionId, (null == collectionIdParam) ? false : true, reLationelementIds);
|
||||
//保存python返回信息
|
||||
// return savePythonDesignItemAndDetail(pythonObjects,designId,collectionId,userInfo,designDTO.getTimeZone(),responseJSONObject);
|
||||
//保存designItem 和detail
|
||||
return saveDesignItemAndDetail(pythonObjects,designId,collectionId,userInfo,designDTO.getTimeZone());
|
||||
return saveDesignItemAndDetail(pythonObjects, designId, collectionId, userInfo, designDTO.getTimeZone());
|
||||
}
|
||||
|
||||
private DesignCollectionVO designOrRedesignOperateNew(DesignCollectionDTO designDTO,AuthPrincipalVo userInfo,
|
||||
Long collectionIdParam,ValidateElementVO elementVO){
|
||||
if(CollectionUtil.isNotEmpty(designDTO.getSketchBoards())){
|
||||
private DesignCollectionVO designOrRedesignOperateNew(DesignCollectionDTO designDTO, AuthPrincipalVo userInfo,
|
||||
Long collectionIdParam, ValidateElementVO elementVO) {
|
||||
if (CollectionUtil.isNotEmpty(designDTO.getSketchBoards())) {
|
||||
//编辑sketchBoard
|
||||
collectionElementService.editSketchBoardsElement(elementVO,designDTO.getSketchBoards());
|
||||
collectionElementService.editSketchBoardsElement(elementVO, designDTO.getSketchBoards());
|
||||
}
|
||||
if(CollectionUtil.isNotEmpty(designDTO.getPrintBoards())){
|
||||
if (CollectionUtil.isNotEmpty(designDTO.getPrintBoards())) {
|
||||
//编辑printBoard
|
||||
collectionElementService.editPrintBoardsElement(elementVO,designDTO.getPrintBoards());
|
||||
collectionElementService.editPrintBoardsElement(elementVO, designDTO.getPrintBoards());
|
||||
}
|
||||
//保存collection
|
||||
Long collectionId = (null == collectionIdParam) ?
|
||||
collectionService.saveCollection(userInfo.getId(),designDTO.getTimeZone(),designDTO.getMoodTemplateId()) : collectionIdParam;
|
||||
collectionService.saveCollection(userInfo.getId(), designDTO.getTimeZone(), designDTO.getMoodTemplateId()) : collectionIdParam;
|
||||
List<Long> elementIds = getElementId(elementVO);
|
||||
//批量关联element 到 collection
|
||||
collectionElementService.relationCollection(elementIds,collectionId);
|
||||
collectionElementService.relationCollection(elementIds, collectionId);
|
||||
//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
|
||||
Long designId = saveOne(designDTO,collectionId,userInfo.getId());
|
||||
Long designId = saveOne(designDTO, collectionId, userInfo.getId());
|
||||
//计算library
|
||||
calculateLibraryAndSysFile(designDTO,elementVO,userInfo);
|
||||
calculateLibraryAndSysFile(designDTO, elementVO, userInfo);
|
||||
//组装design入参
|
||||
DesignPythonObjects pythonObjects = pythonService.covertDesignParam(designDTO.getSystemScale(),
|
||||
designDTO.getSingleOverall(),designDTO.getSwitchCategory(),elementVO);
|
||||
designDTO.getSingleOverall(), designDTO.getSwitchCategory(), elementVO);
|
||||
//缓存保存的文件 方便后面处理进度问题
|
||||
setDesignProcess(userInfo.getId(),pythonObjects);
|
||||
setDesignProcess(userInfo.getId(), pythonObjects);
|
||||
// pythonObjects增加image_id关联
|
||||
relationImageId(pythonObjects);
|
||||
//design
|
||||
JSONObject responseJSONObject = pythonService.designNew(pythonObjects);
|
||||
//生成library
|
||||
generateLibrary(elementVO,designDTO.getTimeZone());
|
||||
generateLibrary(elementVO, designDTO.getTimeZone());
|
||||
//处理关联关系,修复element覆盖得情况
|
||||
List<CollectionElement> reLationelements =collectionElementService.getByOnlyCollectionId(collectionId);
|
||||
List<Long> reLationelementIds = reLationelements.stream().map(CollectionElement::getId).collect(Collectors.toList());
|
||||
handleCollectionElementRelation(collectionId,(null == collectionIdParam) ? false :true,reLationelementIds);
|
||||
List<CollectionElement> reLationelements = collectionElementService.getByOnlyCollectionId(collectionId);
|
||||
List<Long> reLationelementIds = reLationelements.stream().map(CollectionElement::getId).collect(Collectors.toList());
|
||||
handleCollectionElementRelation(collectionId, (null == collectionIdParam) ? false : true, reLationelementIds);
|
||||
//保存python返回信息
|
||||
return savePythonDesignItemAndDetail(pythonObjects,designId,collectionId,userInfo,designDTO.getTimeZone(),responseJSONObject);
|
||||
return savePythonDesignItemAndDetail(pythonObjects, designId, collectionId, userInfo, designDTO.getTimeZone(), responseJSONObject);
|
||||
//保存designItem 和detail
|
||||
// return saveDesignItemAndDetail(pythonObjects,designId,collectionId,userInfo,designDTO.getTimeZone());
|
||||
}
|
||||
|
||||
private void relationImageId(DesignPythonObjects pythonObjects) {
|
||||
if(Objects.isNull(pythonObjects)) {
|
||||
if (Objects.isNull(pythonObjects)) {
|
||||
return;
|
||||
}
|
||||
pythonObjects.getObjects().forEach(
|
||||
@@ -260,58 +315,60 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
if (StringUtils.isEmpty(path)) {
|
||||
String bodyPath = item.getBody_path();
|
||||
Long imageId = pythonTAllInfoService.getImageIdByPath(bodyPath);
|
||||
item.setImageId(imageId);
|
||||
}else {
|
||||
item.setImage_id(imageId);
|
||||
} else {
|
||||
Long imageId = pythonTAllInfoService.getImageIdByPath(path);
|
||||
item.setImageId(imageId);
|
||||
item.setImage_id(imageId);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private void handleCollectionElementRelation(Long collectionId ,Boolean isEdit,List<Long> elementIds ){
|
||||
if (CollectionUtils.isEmpty(elementIds) || collectionId == null){
|
||||
private void handleCollectionElementRelation(Long collectionId, Boolean isEdit, List<Long> elementIds) {
|
||||
if (CollectionUtils.isEmpty(elementIds) || collectionId == null) {
|
||||
return;
|
||||
}
|
||||
if(isEdit){
|
||||
if (isEdit) {
|
||||
//删除
|
||||
tCollectionElementRelationService.deleteByCollectionId(collectionId);
|
||||
}
|
||||
//新增
|
||||
tCollectionElementRelationService.saveBatch(elementIds.stream().map(elementId ->
|
||||
TCollectionElementRelation.builder()
|
||||
.collectionId(collectionId)
|
||||
.elementId(elementId)
|
||||
.createDate(new Date())
|
||||
.build()
|
||||
TCollectionElementRelation.builder()
|
||||
.collectionId(collectionId)
|
||||
.elementId(elementId)
|
||||
.createDate(new Date())
|
||||
.build()
|
||||
).collect(Collectors.toList()));
|
||||
}
|
||||
private void generateLibrary(ValidateElementVO elementVO,String timeZone){
|
||||
|
||||
private void generateLibrary(ValidateElementVO elementVO, String timeZone) {
|
||||
List<CollectionElement> elements = Lists.newArrayList();
|
||||
if(!CollectionUtils.isEmpty(elementVO.getMoodBoardElements())){
|
||||
if (!CollectionUtils.isEmpty(elementVO.getMoodBoardElements())) {
|
||||
elements.addAll(elementVO.getMoodBoardElements());
|
||||
}
|
||||
if(!CollectionUtils.isEmpty(elementVO.getPrintBoardElements())){
|
||||
if (!CollectionUtils.isEmpty(elementVO.getPrintBoardElements())) {
|
||||
elements.addAll(elementVO.getPrintBoardElements());
|
||||
}
|
||||
if(!CollectionUtils.isEmpty(elementVO.getSketchBoardElements())){
|
||||
if (!CollectionUtils.isEmpty(elementVO.getSketchBoardElements())) {
|
||||
elements.addAll(elementVO.getSketchBoardElements());
|
||||
}
|
||||
if(!CollectionUtils.isEmpty(elementVO.getMarketingSketchElements())){
|
||||
if (!CollectionUtils.isEmpty(elementVO.getMarketingSketchElements())) {
|
||||
elements.addAll(elementVO.getMarketingSketchElements());
|
||||
}
|
||||
collectionElementService.saveLibraryByCollectionElement(elements,timeZone);
|
||||
collectionElementService.saveLibraryByCollectionElement(elements, timeZone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal countDesignProcess(){
|
||||
public BigDecimal countDesignProcess() {
|
||||
AuthPrincipalVo userInfo = UserContext.getUserHolder();
|
||||
List<String> saveNames = LocalCacheUtils.getDesignProcessCache(userInfo.getId());
|
||||
if (CollectionUtils.isEmpty(saveNames)){
|
||||
if (CollectionUtils.isEmpty(saveNames)) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
int totalProcess =0;
|
||||
log.info("design 统计进度###totalProcess1{}",totalProcess);
|
||||
int totalProcess = 0;
|
||||
log.info("design 统计进度###totalProcess1{}", totalProcess);
|
||||
//转成本地文件先
|
||||
for (String saveName : saveNames) {
|
||||
String localFileUrl = saveName;
|
||||
@@ -319,32 +376,34 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
if (!StringUtils.isEmpty(linuxDomain)) {
|
||||
//linux 系统
|
||||
String oldPath = fileProperties.getSys().getPath();
|
||||
localFileUrl = saveName.replace(linuxDomain,oldPath);
|
||||
localFileUrl = saveName.replace(linuxDomain, oldPath);
|
||||
}
|
||||
File file = new File(localFileUrl);
|
||||
if(file.exists()){
|
||||
if (file.exists()) {
|
||||
totalProcess++;
|
||||
log.info("design 统计进度++###totalProcess+++{}",totalProcess);
|
||||
log.info("design 统计进度++###totalProcess+++{}", totalProcess);
|
||||
}
|
||||
}
|
||||
log.info("design 统计进度###totalProcess2{}",totalProcess);
|
||||
BigDecimal result = BigDecimal.valueOf(totalProcess).divide(BigDecimal.valueOf(8)).setScale(3,BigDecimal.ROUND_HALF_UP);
|
||||
if (result.compareTo(BigDecimal.ONE) == 0){
|
||||
log.info("design 统计进度###totalProcess2{}", totalProcess);
|
||||
BigDecimal result = BigDecimal.valueOf(totalProcess).divide(BigDecimal.valueOf(8)).setScale(3, BigDecimal.ROUND_HALF_UP);
|
||||
if (result.compareTo(BigDecimal.ONE) == 0) {
|
||||
LocalCacheUtils.delDesignProcessCache(userInfo.getId());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void setDesignProcess(Long userId,DesignPythonObjects pythonObjects){
|
||||
List<String> saveNames = pythonObjects.getObjects().stream().map(object ->{
|
||||
return object.getBasic().getSave_name();}).collect(Collectors.toList());
|
||||
LocalCacheUtils.setDesignProcessCache(userId,saveNames);
|
||||
private void setDesignProcess(Long userId, DesignPythonObjects pythonObjects) {
|
||||
List<String> saveNames = pythonObjects.getObjects().stream().map(object -> {
|
||||
return object.getBasic().getSave_name();
|
||||
}).collect(Collectors.toList());
|
||||
LocalCacheUtils.setDesignProcessCache(userId, saveNames);
|
||||
}
|
||||
|
||||
@Resource
|
||||
private MinioUtil minIoUtil;
|
||||
|
||||
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();
|
||||
response.setDesignId(designId);
|
||||
response.setCollectionId(collectionId);
|
||||
@@ -363,7 +422,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
designItem.setCreateDate(DateUtil.getByTimeZone(timeZone));
|
||||
//生成的八张图片
|
||||
designItem.setDesignUrl(item.getBasic().getSave_name());
|
||||
designItem.setHasLike((byte)0);
|
||||
designItem.setHasLike((byte) 0);
|
||||
//生成designItem
|
||||
Long designItemId = designItemService.saveOne(designItem);
|
||||
// python design返回入库及封装
|
||||
@@ -391,7 +450,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
for (int i2 = 0; i2 < position.size(); i2++) {
|
||||
if (i2 != position.size() - 1) {
|
||||
builder.append(position.getInteger(i2)).append(",");
|
||||
}else {
|
||||
} else {
|
||||
builder.append(position.getInteger(i2));
|
||||
}
|
||||
}
|
||||
@@ -403,7 +462,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
for (int i2 = 0; i2 < imageSize.size(); i2++) {
|
||||
if (i2 != imageSize.size() - 1) {
|
||||
builder.append(imageSize.getInteger(i2)).append(",");
|
||||
}else {
|
||||
} else {
|
||||
builder.append(imageSize.getInteger(i2));
|
||||
}
|
||||
}
|
||||
@@ -420,29 +479,33 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
designCollectionItemVO.setDesignItemId(designItemId);
|
||||
designCollectionItemVO.setDesignItemUrl(designItem.getDesignUrl());
|
||||
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
|
||||
designCollectionItems.add(designCollectionItemVO);
|
||||
|
||||
List<DesignItemDetail> designItemDetails = Lists.newArrayList();
|
||||
item.getItems().forEach(detail ->{
|
||||
if(null == detail){
|
||||
item.getItems().forEach(detail -> {
|
||||
if (null == detail) {
|
||||
return;
|
||||
}
|
||||
DesignItemDetail designItemDetail = CopyUtil.copyObject(detail,DesignItemDetail.class);
|
||||
DesignItemDetail designItemDetail = CopyUtil.copyObject(detail, DesignItemDetail.class);
|
||||
designItemDetail.setAccountId(userInfo.getId());
|
||||
designItemDetail.setDesignId(designId);
|
||||
designItemDetail.setDesignItemId(designItemId);
|
||||
designItemDetail.setCollectionElementId(detail.getElementId());
|
||||
designItemDetail.setCreateDate(DateUtil.getByTimeZone(timeZone));
|
||||
if(SysFileLevel2TypeEnum.BODY.getRealName().equals(detail.getType())){
|
||||
if (SysFileLevel2TypeEnum.BODY.getRealName().equals(detail.getType())) {
|
||||
designItemDetail.setPath(detail.getBody_path());
|
||||
//BODY不关联businessId
|
||||
designItemDetail.setBusinessId(0L);
|
||||
}
|
||||
designItemDetail.setIconPath(detail.getIcon());
|
||||
DesignPythonItemPrint printObject = detail.getPrint();
|
||||
designItemDetail.setPrintPath(Objects.isNull(printObject)? "" :printObject.getPath());
|
||||
designItemDetail.setPrintPath(Objects.isNull(printObject) ? "" : printObject.getPath());
|
||||
designItemDetails.add(designItemDetail);
|
||||
});
|
||||
designItemDetailService.saveBatch(designItemDetails);
|
||||
@@ -452,14 +515,14 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
}
|
||||
|
||||
private DesignCollectionVO saveDesignItemAndDetail(DesignPythonObjects pythonObjects
|
||||
,Long designId,Long collectionId,AuthPrincipalVo userInfo,String timeZone){
|
||||
, Long designId, Long collectionId, AuthPrincipalVo userInfo, String timeZone) {
|
||||
DesignCollectionVO response = new DesignCollectionVO();
|
||||
response.setDesignId(designId);
|
||||
response.setCollectionId(collectionId);
|
||||
List<DesignCollectionItemVO> designCollectionItems = Lists.newArrayList();
|
||||
response.setDesignCollectionItems(designCollectionItems);
|
||||
|
||||
pythonObjects.getObjects().forEach(item ->{
|
||||
pythonObjects.getObjects().forEach(item -> {
|
||||
DesignItem designItem = new DesignItem();
|
||||
designItem.setAccountId(userInfo.getId());
|
||||
designItem.setCollectionId(collectionId);
|
||||
@@ -467,47 +530,48 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
designItem.setCreateDate(DateUtil.getByTimeZone(timeZone));
|
||||
//生成的八张图片
|
||||
designItem.setDesignUrl(item.getBasic().getSave_name());
|
||||
designItem.setHasLike((byte)0);
|
||||
designItem.setHasLike((byte) 0);
|
||||
//生成designItem
|
||||
Long designItemId = designItemService.saveOne(designItem);
|
||||
//response
|
||||
designCollectionItems.add(new DesignCollectionItemVO(designItemId,designItem.getDesignUrl(), null, null));
|
||||
designCollectionItems.add(new DesignCollectionItemVO(designItemId, designItem.getDesignUrl(), null, null));
|
||||
|
||||
List<DesignItemDetail> designItemDetails = Lists.newArrayList();
|
||||
item.getItems().forEach(detail ->{
|
||||
if(null == detail){
|
||||
item.getItems().forEach(detail -> {
|
||||
if (null == detail) {
|
||||
return;
|
||||
}
|
||||
DesignItemDetail designItemDetail = CopyUtil.copyObject(detail,DesignItemDetail.class);
|
||||
DesignItemDetail designItemDetail = CopyUtil.copyObject(detail, DesignItemDetail.class);
|
||||
designItemDetail.setAccountId(userInfo.getId());
|
||||
designItemDetail.setDesignId(designId);
|
||||
designItemDetail.setDesignItemId(designItemId);
|
||||
designItemDetail.setCollectionElementId(detail.getElementId());
|
||||
designItemDetail.setCreateDate(DateUtil.getByTimeZone(timeZone));
|
||||
if(SysFileLevel2TypeEnum.BODY.getRealName().equals(detail.getType())){
|
||||
if (SysFileLevel2TypeEnum.BODY.getRealName().equals(detail.getType())) {
|
||||
designItemDetail.setPath(detail.getBody_path());
|
||||
//BODY不关联businessId
|
||||
designItemDetail.setBusinessId(0L);
|
||||
}
|
||||
designItemDetail.setIconPath(detail.getIcon());
|
||||
DesignPythonItemPrint printObject = detail.getPrint();
|
||||
designItemDetail.setPrintPath(Objects.isNull(printObject)? "" :printObject.getPath());
|
||||
designItemDetail.setPrintPath(Objects.isNull(printObject) ? "" : printObject.getPath());
|
||||
designItemDetails.add(designItemDetail);
|
||||
});
|
||||
designItemDetailService.saveBatch(designItemDetails);
|
||||
});
|
||||
return response;
|
||||
}
|
||||
private List<Long> getElementId(ValidateElementVO elementVO){
|
||||
|
||||
private List<Long> getElementId(ValidateElementVO elementVO) {
|
||||
List<Long> elementIds = Lists.newArrayList();
|
||||
// collection type
|
||||
if(CollectionUtil.isNotEmpty(elementVO.getSketchBoardElements())){
|
||||
if (CollectionUtil.isNotEmpty(elementVO.getSketchBoardElements())) {
|
||||
elementIds.addAll(elementVO.getSketchBoardElements().stream().map(CollectionElement::getId).collect(Collectors.toList()));
|
||||
}
|
||||
if(CollectionUtil.isNotEmpty(elementVO.getMoodBoardElements())){
|
||||
if (CollectionUtil.isNotEmpty(elementVO.getMoodBoardElements())) {
|
||||
elementIds.addAll(elementVO.getMoodBoardElements().stream().map(CollectionElement::getId).collect(Collectors.toList()));
|
||||
}
|
||||
if(CollectionUtil.isNotEmpty(elementVO.getPrintBoardElements())){
|
||||
if (CollectionUtil.isNotEmpty(elementVO.getPrintBoardElements())) {
|
||||
elementIds.addAll(elementVO.getPrintBoardElements().stream().map(CollectionElement::getId).collect(Collectors.toList()));
|
||||
}
|
||||
// if(CollectionUtil.isNotEmpty(elementVO.getMarketingSketchElements())){
|
||||
@@ -520,18 +584,18 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
public DesignCollectionVO reDesignCollection(ReDesignCollectionDTO reDesignDTO) {
|
||||
//校验collection
|
||||
Collection collection = collectionService.findById(reDesignDTO.getCollectionId());
|
||||
Assert.notNull(collection,"Collection does not exist!");
|
||||
Assert.notNull(collection, "Collection does not exist!");
|
||||
AuthPrincipalVo userInfo = UserContext.getUserHolder();
|
||||
//查询用户 sketch library
|
||||
List<LibraryVo> libraryVos =libraryService.selectByAccountIdAnd1TypeList(userInfo.getId(),
|
||||
List<LibraryVo> libraryVos = libraryService.selectByAccountIdAnd1TypeList(userInfo.getId(),
|
||||
Arrays.asList(CollectionLevel1TypeEnum.PRINT_BOARD.getRealName(),
|
||||
CollectionLevel1TypeEnum.SKETCH_BOARD.getRealName()));
|
||||
//校验collection element
|
||||
ValidateElementVO elementVO =collectionElementService.validateElement(
|
||||
CopyUtil.copyObject(reDesignDTO,DesignCollectionDTO.class));
|
||||
ValidateElementVO elementVO = collectionElementService.validateElement(
|
||||
CopyUtil.copyObject(reDesignDTO, DesignCollectionDTO.class));
|
||||
//计算并删除对应的未关联的element
|
||||
collectionElementService.batchDelete(
|
||||
calculateNoRelationElement(reDesignDTO.getCollectionId(),elementVO.getUsedElementIds()));
|
||||
calculateNoRelationElement(reDesignDTO.getCollectionId(), elementVO.getUsedElementIds()));
|
||||
Design oldDesign = selectByCollectionId(reDesignDTO.getCollectionId());
|
||||
//删除老的关联的design
|
||||
deleteByCollectionId(reDesignDTO.getCollectionId());
|
||||
@@ -539,18 +603,19 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
designItemDetailService.deleteByDesignId(oldDesign.getId());
|
||||
//redesign
|
||||
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);
|
||||
if(CollectionUtils.isEmpty(collectionElements)){
|
||||
if (CollectionUtils.isEmpty(collectionElements)) {
|
||||
throw new BusinessException("get collection elements cannot be empty");
|
||||
}
|
||||
if(CollectionUtils.isEmpty(usedElementIds)){
|
||||
if (CollectionUtils.isEmpty(usedElementIds)) {
|
||||
return collectionElements.stream().map(CollectionElement::getId).collect(Collectors.toList());
|
||||
}
|
||||
return collectionElements.stream()
|
||||
.filter(filter ->!usedElementIds.contains(filter.getId()))
|
||||
.filter(filter -> !usedElementIds.contains(filter.getId()))
|
||||
.map(CollectionElement::getId)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
@@ -558,17 +623,18 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
@Override
|
||||
public DesignCollectionVO designItemList(Long designId) {
|
||||
Design design = getById(designId);
|
||||
Assert.notNull(design,"design does not exist!");
|
||||
Assert.notNull(design, "design does not exist!");
|
||||
List<DesignItem> designItems = designItemService.getByDesignId(designId);
|
||||
if(CollectionUtils.isEmpty(designItems)){
|
||||
return new DesignCollectionVO(designId,design.getCollectionId(),null);
|
||||
if (CollectionUtils.isEmpty(designItems)) {
|
||||
return new DesignCollectionVO(designId, design.getCollectionId(), null);
|
||||
}
|
||||
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();
|
||||
designItems.forEach(designItem -> {
|
||||
response.add(new DesignCollectionItemVO(designItem.getId(),designItem.getDesignUrl(), null, null));
|
||||
response.add(new DesignCollectionItemVO(designItem.getId(), designItem.getDesignUrl(), null, null));
|
||||
});
|
||||
return response;
|
||||
}
|
||||
@@ -579,81 +645,83 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
Long groupDetailId = null;
|
||||
AuthPrincipalVo userInfo = UserContext.getUserHolder();
|
||||
DesignItem designItem = designItemService.getById(designLikeDTO.getDesignItemId());
|
||||
Assert.notNull(designItem,"designItem does not exist!");
|
||||
if(Objects.nonNull(designLikeDTO.getUserGroupId())){
|
||||
Assert.notNull(designItem, "designItem does not exist!");
|
||||
if (Objects.nonNull(designLikeDTO.getUserGroupId())) {
|
||||
userGroupId = designLikeDTO.getUserGroupId();
|
||||
|
||||
UserLikeGroup userLikeGroup = userLikeGroupService.getById(designLikeDTO.getUserGroupId());
|
||||
Assert.notNull(userLikeGroup,"History does not exist!");
|
||||
Assert.notNull(userLikeGroup, "History does not exist!");
|
||||
// if(designItem.getCollectionId().equals(userLikeGroup.getCollectionId())){
|
||||
// //相同collection直接跳过 不需要往element加元素
|
||||
// return new DesignLikeVO();
|
||||
// }
|
||||
List<CollectionElement> oldElements = collectionElementService.getByCollectionId(userLikeGroup.getCollectionId());
|
||||
Assert.notEmpty(oldElements,"old elements does not exist!");
|
||||
Assert.notEmpty(oldElements, "old elements does not exist!");
|
||||
List<DesignItemDetail> designItemDetails = designItemDetailService.selectByDesignItemId(designLikeDTO.getDesignItemId());
|
||||
Assert.notEmpty(designItemDetails,"new designItemDetails does not exist!");
|
||||
Assert.notEmpty(designItemDetails, "new designItemDetails does not exist!");
|
||||
//判断老的element合并到新的是否满足 数量不超过15
|
||||
List<Long> newElementIds = validateMergeElement(oldElements,designItemDetails);
|
||||
List<Long> newElementIds = validateMergeElement(oldElements, designItemDetails);
|
||||
//合并,关联新的element到collection
|
||||
collectionElementService.relationCollection(newElementIds,userLikeGroup.getCollectionId());
|
||||
collectionElementService.relationCollection(newElementIds, userLikeGroup.getCollectionId());
|
||||
//处理关联关系,修复element覆盖得情况
|
||||
handleCollectionElementRelation(userLikeGroup.getCollectionId(),false,newElementIds);
|
||||
handleCollectionElementRelation(userLikeGroup.getCollectionId(), false, newElementIds);
|
||||
UserLike userLike = resolveUserLike(designLikeDTO.getUserGroupId(), designItem.getDesignId(),
|
||||
designLikeDTO.getDesignItemId(),designItem.getDesignUrl(),designLikeDTO.getTimeZone());
|
||||
designLikeDTO.getDesignItemId(), designItem.getDesignUrl(), designLikeDTO.getTimeZone());
|
||||
userLikeService.save(userLike);
|
||||
groupDetailId = userLike.getId();
|
||||
}else{
|
||||
} else {
|
||||
//第一次like
|
||||
userGroupId = userLikeGroupService.insertUserGroup(userInfo.getId(),designItem.getCollectionId(),designLikeDTO.getTimeZone());
|
||||
UserLike userLike =resolveUserLike(userGroupId,
|
||||
designItem.getDesignId(),designLikeDTO.getDesignItemId(),designItem.getDesignUrl(),designLikeDTO.getTimeZone());
|
||||
userGroupId = userLikeGroupService.insertUserGroup(userInfo.getId(), designItem.getCollectionId(), designLikeDTO.getTimeZone());
|
||||
UserLike userLike = resolveUserLike(userGroupId,
|
||||
designItem.getDesignId(), designLikeDTO.getDesignItemId(), designItem.getDesignUrl(), designLikeDTO.getTimeZone());
|
||||
userLikeService.save(userLike);
|
||||
groupDetailId = userLike.getId();
|
||||
}
|
||||
//修改designItem为like状态
|
||||
designItemService.updateLikeStatus(designLikeDTO.getDesignItemId(),(byte)1);
|
||||
return new DesignLikeVO(userGroupId,groupDetailId);
|
||||
designItemService.updateLikeStatus(designLikeDTO.getDesignItemId(), (byte) 1);
|
||||
return new DesignLikeVO(userGroupId, groupDetailId);
|
||||
}
|
||||
|
||||
private List<Long> validateMergeElement(List<CollectionElement> oldElements,List<DesignItemDetail> designItemDetails){
|
||||
private List<Long> validateMergeElement(List<CollectionElement> oldElements, List<DesignItemDetail> designItemDetails) {
|
||||
List<DesignItemDetail> hasCollections = designItemDetails.stream()
|
||||
.filter(f->Objects.nonNull(f.getCollectionElementId()))
|
||||
.filter(f -> Objects.nonNull(f.getCollectionElementId()))
|
||||
.collect(Collectors.toList());
|
||||
if(CollectionUtils.isEmpty(hasCollections)){
|
||||
if (CollectionUtils.isEmpty(hasCollections)) {
|
||||
return null;
|
||||
}
|
||||
List<Long> oldIds = oldElements.stream().map(CollectionElement::getId).collect(Collectors.toList());
|
||||
List<Long> elementIds = hasCollections.stream().map(DesignItemDetail::getCollectionElementId).collect(Collectors.toList());
|
||||
//本次新增collection个数
|
||||
List<Long> adds = elementIds.stream().filter(id ->!oldIds.contains(id)).collect(Collectors.toList());
|
||||
if(CollectionUtils.isEmpty(adds)){
|
||||
List<Long> adds = elementIds.stream().filter(id -> !oldIds.contains(id)).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(adds)) {
|
||||
return null;
|
||||
}
|
||||
//校验15次
|
||||
Map<String,List<CollectionElement>> group = oldElements.stream()
|
||||
Map<String, List<CollectionElement>> group = oldElements.stream()
|
||||
.collect(Collectors.groupingBy(CollectionElement::getLevel1Type));
|
||||
|
||||
group.forEach((k,v) ->{
|
||||
group.forEach((k, v) -> {
|
||||
List<CollectionElement> thisElement = group.get(k);
|
||||
int groupNum = calculateGroupNum(thisElement,adds);
|
||||
if(groupNum >15){
|
||||
throw new BusinessException("The size of element type" +k+ "exceeds 15");
|
||||
int groupNum = calculateGroupNum(thisElement, adds);
|
||||
if (groupNum > 15) {
|
||||
throw new BusinessException("The size of element type" + k + "exceeds 15");
|
||||
}
|
||||
});
|
||||
return adds;
|
||||
}
|
||||
private int calculateGroupNum(List<CollectionElement> thisElement,List<Long> adds){
|
||||
|
||||
private int calculateGroupNum(List<CollectionElement> thisElement, List<Long> adds) {
|
||||
int num = 0;
|
||||
List<Long> groupOldIds = thisElement.stream().map(CollectionElement::getId).collect(Collectors.toList());
|
||||
for (Long add : adds) {
|
||||
if(groupOldIds.contains(add)){
|
||||
num ++ ;
|
||||
if (groupOldIds.contains(add)) {
|
||||
num++;
|
||||
}
|
||||
}
|
||||
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.setCreateDate(DateUtil.getByTimeZone(timeZone));
|
||||
userLike.setDesignId(designId);
|
||||
@@ -667,21 +735,21 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
public Boolean dislike(DisDesignLikeDTO disDesignLikeDTO) {
|
||||
AuthPrincipalVo userInfo = UserContext.getUserHolder();
|
||||
UserLike userLike = userLikeService.getById(disDesignLikeDTO.getGroupDetailId());
|
||||
Assert.notNull(userLike,"History detail does not exist!");
|
||||
Assert.notNull(userLike, "History detail does not exist!");
|
||||
Design design = getById(disDesignLikeDTO.getDesignId());
|
||||
Assert.notNull(design,"design does not exist!");
|
||||
if(!userLike.getDesignId().equals(disDesignLikeDTO.getDesignId())){
|
||||
Assert.notNull(design, "design does not exist!");
|
||||
if (!userLike.getDesignId().equals(disDesignLikeDTO.getDesignId())) {
|
||||
//不是相同的design不会合并
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
//修改designItem为dislike状态
|
||||
designItemService.updateLikeStatus(userLike.getDesignItemId(),(byte)0);
|
||||
designItemService.updateLikeStatus(userLike.getDesignItemId(), (byte) 0);
|
||||
//删除关联的collection,先不做
|
||||
|
||||
//删除对应的history
|
||||
userLikeService.removeById(disDesignLikeDTO.getGroupDetailId());
|
||||
List<UserLikeVO> userLikeVOS = userLikeService.getGroupDetail(userLike.getUserLikeGroupId());
|
||||
if(CollectionUtils.isEmpty(userLikeVOS)){
|
||||
if (CollectionUtils.isEmpty(userLikeVOS)) {
|
||||
//group 下面没有元素时候 直接删除
|
||||
userLikeGroupService.removeById(userLike.getUserLikeGroupId());
|
||||
}
|
||||
@@ -691,41 +759,41 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
@Override
|
||||
public String generateHighDesign(GenerateHighDesignDTO generateHighDesignDTO) {
|
||||
DesignItem designItem = designItemService.getById(generateHighDesignDTO.getDesignItemId());
|
||||
Assert.notNull(designItem,"design item does not exist!");
|
||||
Assert.notNull(designItem, "design item does not exist!");
|
||||
String highUrl = pythonService.generateHighDesign(designItem.getDesignUrl());
|
||||
//存储
|
||||
designItemService.updateDesignHighUrl(designItem.getId(),highUrl,generateHighDesignDTO.getTimeZone());
|
||||
return highUrl ;
|
||||
designItemService.updateDesignHighUrl(designItem.getId(), highUrl, generateHighDesignDTO.getTimeZone());
|
||||
return highUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean deleteHighDesign(GenerateHighDesignDTO generateHighDesignDTO) {
|
||||
DesignItem designItem = designItemService.getById(generateHighDesignDTO.getDesignItemId());
|
||||
Assert.notNull(designItem,"design item does not exist!");
|
||||
if(StringUtils.isEmpty(designItem.getHighDesignUrl())){
|
||||
Assert.notNull(designItem, "design item does not exist!");
|
||||
if (StringUtils.isEmpty(designItem.getHighDesignUrl())) {
|
||||
//并发情况 ,不提示 直接返回
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
//存储
|
||||
designItemService.updateDesignHighUrl(designItem.getId(),"",generateHighDesignDTO.getTimeZone());
|
||||
designItemService.updateDesignHighUrl(designItem.getId(), "", generateHighDesignDTO.getTimeZone());
|
||||
FileUtil.delete(designItem.getHighDesignUrl());
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DesignItemDetailVO detail(Long designPythonOutfitId,Long designItemId) {
|
||||
public DesignItemDetailVO detail(Long designPythonOutfitId, Long designItemId) {
|
||||
DesignItem designItem = designItemService.getById(designItemId);
|
||||
Assert.notNull(designItem,"design item does not exist!");
|
||||
Assert.notNull(designItem, "design item does not exist!");
|
||||
Design design = getById(designItem.getDesignId());
|
||||
Assert.notNull(design,"design does not exist!");
|
||||
Assert.notNull(design, "design does not exist!");
|
||||
List<DesignItemDetail> designItemDetails = designItemDetailService.selectByDesignItemId(designItemId);
|
||||
Assert.notEmpty(designItemDetails,"designItemDetails does not exist!");
|
||||
Assert.notEmpty(designItemDetails, "designItemDetails does not exist!");
|
||||
// 添加判断designPythonOutfitId是否存在
|
||||
TDesignPythonOutfit designPythonOutfit = new TDesignPythonOutfit();
|
||||
Boolean flag = Boolean.FALSE;
|
||||
if (Objects.nonNull(designPythonOutfitId)){
|
||||
if (Objects.nonNull(designPythonOutfitId)) {
|
||||
designPythonOutfit = designPythonOutfitService.getById(designPythonOutfitId);
|
||||
Assert.notNull(designPythonOutfit,"designPythonOutfit does not exist!");
|
||||
Assert.notNull(designPythonOutfit, "designPythonOutfit does not exist!");
|
||||
flag = Boolean.TRUE;
|
||||
}
|
||||
|
||||
@@ -738,23 +806,23 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
List<DesignItemDetail> filterDetail = designItemDetails.stream()
|
||||
.filter(f -> OUTWEAR_DRESS_BLOUSE.contains(f.getType()) || SKIRT_TROUSERS.contains(f.getType()))
|
||||
.collect(Collectors.toList());
|
||||
response.setClothes(CopyUtil.copyList(filterDetail,DesignItemClothesDetailVO.class,(o,d)->{
|
||||
response.setClothes(CopyUtil.copyList(filterDetail, DesignItemClothesDetailVO.class, (o, d) -> {
|
||||
d.setId(o.getBusinessId());
|
||||
d.setLevel1Type(converTypeToLevel1(o.getType()));
|
||||
String printJson = o.getPrintJson();
|
||||
if(StringUtils.isEmpty(printJson)){
|
||||
if (StringUtils.isEmpty(printJson)) {
|
||||
d.setPrintObject(new DesignPythonItemPrint(o.getPrintPath(),
|
||||
CollectionLevel1TypeEnum.PRINT_BOARD.getRealName(),0.3f,Boolean.FALSE));
|
||||
}else{
|
||||
d.setPrintObject(JSON.parseObject(printJson,DesignPythonItemPrint.class));
|
||||
CollectionLevel1TypeEnum.PRINT_BOARD.getRealName(), 0.3f, Boolean.FALSE));
|
||||
} else {
|
||||
d.setPrintObject(JSON.parseObject(printJson, DesignPythonItemPrint.class));
|
||||
}
|
||||
}));
|
||||
//single 和 Models(模特)时候 系统元素为空
|
||||
List<DesignItemDetail> filterDetail2 =designItemDetails.stream()
|
||||
List<DesignItemDetail> filterDetail2 = designItemDetails.stream()
|
||||
// .filter(f -> SYS_HAIRSTYLE_SHOES.contains(f.getType()) )
|
||||
.filter(f -> SYS_HAIRSTYLE_SHOES_BODY.contains(f.getType()) )
|
||||
.collect(Collectors.toList());
|
||||
response.setOthers(CopyUtil.copyList(filterDetail2,DesignItemOthersDetailVO.class,(o,d)->{
|
||||
.filter(f -> SYS_HAIRSTYLE_SHOES_BODY.contains(f.getType()))
|
||||
.collect(Collectors.toList());
|
||||
response.setOthers(CopyUtil.copyList(filterDetail2, DesignItemOthersDetailVO.class, (o, d) -> {
|
||||
d.setId(o.getBusinessId());
|
||||
d.setPrintObject(new DesignPythonItemPrint());
|
||||
}));
|
||||
@@ -762,15 +830,16 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
minIoUtil.splitThenGetPreviewUrl(designItem.getDesignUrl(),480),
|
||||
editResponseColor(designItemDetails,response));
|
||||
}
|
||||
private String converTypeToLevel1(String type){
|
||||
if(StringUtils.isEmpty(type)){
|
||||
|
||||
private String converTypeToLevel1(String type) {
|
||||
if (StringUtils.isEmpty(type)) {
|
||||
return null;
|
||||
}
|
||||
SysFileLevel2TypeEnum sysFileLevel2TypeEnum = SysFileLevel2TypeEnum.realNameOf(type);
|
||||
if(Objects.isNull(sysFileLevel2TypeEnum)){
|
||||
if (Objects.isNull(sysFileLevel2TypeEnum)) {
|
||||
return null;
|
||||
}
|
||||
if(OUTWEAR_DRESS_BLOUSE.contains(type) || SKIRT_TROUSERS.contains(type) ){
|
||||
if (OUTWEAR_DRESS_BLOUSE.contains(type) || SKIRT_TROUSERS.contains(type)) {
|
||||
return CollectionLevel1TypeEnum.SKETCH_BOARD.getRealName();
|
||||
}
|
||||
return null;
|
||||
@@ -781,16 +850,17 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
queryWrapper.eq("collection_id", collectionId);
|
||||
return designMapper.selectOne(queryWrapper);
|
||||
}
|
||||
|
||||
private int deleteByCollectionId(Long collectionId) {
|
||||
QueryWrapper<Design> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("collection_id", collectionId);
|
||||
Design design = new Design();
|
||||
design.setCollectionId(0L);
|
||||
return designMapper.update(design,queryWrapper);
|
||||
return designMapper.update(design, queryWrapper);
|
||||
}
|
||||
|
||||
private Long saveOne(DesignCollectionDTO designDTO,Long collectionId,Long accountId) {
|
||||
Design design = CopyUtil.copyObject(designDTO,Design.class);
|
||||
private Long saveOne(DesignCollectionDTO designDTO, Long collectionId, Long accountId) {
|
||||
Design design = CopyUtil.copyObject(designDTO, Design.class);
|
||||
design.setCreateDate(DateUtil.getByTimeZone(designDTO.getTimeZone()));
|
||||
design.setCollectionId(collectionId);
|
||||
design.setAccountId(accountId);
|
||||
@@ -800,7 +870,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
return design.getId();
|
||||
}
|
||||
|
||||
private DesignItemDetailVO editResponseColor(List<DesignItemDetail> designItemDetails,DesignItemDetailVO designItemDetailVO){
|
||||
private DesignItemDetailVO editResponseColor(List<DesignItemDetail> designItemDetails, DesignItemDetailVO designItemDetailVO) {
|
||||
/*designItemDetails.forEach(d -> {
|
||||
if (!StringUtil.isNullOrEmpty(d.getColor())){
|
||||
PantoneVO pantoneByRgb = panToneService.getPantoneByRgb(d.getColor());
|
||||
@@ -823,8 +893,8 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
|
||||
HashMap<Long, String> businessIdColor = new HashMap<>();
|
||||
designItemDetails.forEach(designItemDetail -> {
|
||||
if (!StringUtil.isNullOrEmpty(designItemDetail.getColor())){
|
||||
businessIdColor.put(designItemDetail.getBusinessId(),designItemDetail.getColor());
|
||||
if (!StringUtil.isNullOrEmpty(designItemDetail.getColor())) {
|
||||
businessIdColor.put(designItemDetail.getBusinessId(), designItemDetail.getColor());
|
||||
}
|
||||
});
|
||||
|
||||
@@ -844,13 +914,13 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
}
|
||||
|
||||
|
||||
private DesignItemDetailVO editDesignItemLayer(Boolean flag,TDesignPythonOutfit designPythonOutfit,String designItemUrl,DesignItemDetailVO designItemDetailVO){
|
||||
private DesignItemDetailVO editDesignItemLayer(Boolean flag, TDesignPythonOutfit designPythonOutfit, String designItemUrl, DesignItemDetailVO designItemDetailVO) {
|
||||
ArrayList<DesignPythonOutfitVO> detailsVO = new ArrayList<>();
|
||||
|
||||
if (flag){
|
||||
if (flag) {
|
||||
// 1、判断designPythonOutfitId查出的图层信息是否为空(不允许为空,系统内部错误)
|
||||
List<TDesignPythonOutfitDetail> details = designPythonOutfitDetailService.getDetailByDesignPythonOutfitId(designPythonOutfit.getId());
|
||||
Assert.notEmpty(details,"Some errors occurred, please restart the design");
|
||||
Assert.notEmpty(details, "Some errors occurred, please restart the design");
|
||||
details.forEach(detail -> {
|
||||
detailsVO.add(designPythonOutfitDetailService.convertToDesignPythonOutfitVO(detail));
|
||||
});
|
||||
@@ -875,9 +945,10 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
detail.getImageCategory().equals(type)).collect(Collectors.toList());
|
||||
o.setLayersObject(outfitVOS);
|
||||
});
|
||||
}else{
|
||||
} else {
|
||||
designItemDetailVO.setDesignItemUrl(designItemUrl);
|
||||
}
|
||||
|
||||
return designItemDetailVO;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.common.base.Function;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
@@ -48,6 +49,10 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
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(),
|
||||
CollectionLevel2TypeEnum.OUTWEAR.getRealName(),CollectionLevel2TypeEnum.BLOUSE.getRealName());
|
||||
@@ -144,39 +149,49 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
Assert.isTrue(!( level1TypeEnum.equals(LibraryLevel1TypeEnum.SKETCH_BOARD)
|
||||
&& StringUtils.isEmpty(libraryUploadDTO.getLevel2Type()) ),"level2Type cannot be empty!");
|
||||
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元素
|
||||
Library library = resolveData(libraryUploadDTO, userInfo, file);
|
||||
saveOne(library);
|
||||
Library library = resolveData(libraryUploadDTO, userInfo, filePath, bucketName);
|
||||
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.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.setUrl(file.getAbsolutePath());
|
||||
library.setUrl(bucketName + File.separator + filePath);
|
||||
//按时区计算
|
||||
library.setCreateDate(DateUtil.getByTimeZone(uploadDTO.getTimeZone()));
|
||||
String linuxDomain = fileProperties.getLinuxDomain();
|
||||
if (!StringUtils.isEmpty(linuxDomain)) {
|
||||
//linux 系统
|
||||
String oldPath = fileProperties.getSys().getPath();
|
||||
library.setUrl(file.getAbsolutePath().replace(oldPath, linuxDomain));
|
||||
}
|
||||
// String linuxDomain = fileProperties.getLinuxDomain();
|
||||
// if (!StringUtils.isEmpty(linuxDomain)) {
|
||||
// //linux 系统
|
||||
// String oldPath = fileProperties.getSys().getPath();
|
||||
// library.setUrl(file.getAbsolutePath().replace(oldPath, linuxDomain));
|
||||
// }
|
||||
libraryMapper.insert(library);
|
||||
return library;
|
||||
}
|
||||
|
||||
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);
|
||||
return rootPath + day + File.separator + "userFile" + File.separator + "library"
|
||||
+ File.separator + level1TypeEnum.getRealName() + File.separator + userId + File.separator+UUID.randomUUID().toString();
|
||||
return day + File.separator + "userFile" + File.separator + "library"
|
||||
+ File.separator + level1TypeEnum.getRealName() + File.separator + userId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -28,7 +28,7 @@ import java.util.Objects;
|
||||
@Service
|
||||
public class TDesignPythonOutfitDetailServiceImpl extends ServiceImpl<TDesignPythonOutfitDetailMapper, TDesignPythonOutfitDetail> implements ITDesignPythonOutfitDetailService {
|
||||
|
||||
@Value("${minio.bucketName2}")
|
||||
@Value("${minio.bucketName.clothing}")
|
||||
private String bucketName2;
|
||||
@Value("${minio.bucketName3}")
|
||||
private String bucketName3;
|
||||
|
||||
@@ -2,9 +2,15 @@ package com.ai.da.service.impl;
|
||||
|
||||
import com.ai.da.common.config.exception.BusinessException;
|
||||
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.mapper.LibraryMapper;
|
||||
import com.ai.da.mapper.SysFileMapper;
|
||||
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.model.dto.WorkspaceDTO;
|
||||
import com.ai.da.model.enums.BizJson;
|
||||
@@ -12,26 +18,25 @@ import com.ai.da.model.enums.IEnumDisplay;
|
||||
import com.ai.da.model.enums.Position;
|
||||
import com.ai.da.model.enums.Sex;
|
||||
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.service.LibraryService;
|
||||
import com.ai.da.service.SysFileService;
|
||||
import com.ai.da.service.WorkspaceService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
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.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 服务实现类
|
||||
* 服务实现类
|
||||
*
|
||||
* @author SHAHAIBO
|
||||
* @since 2023-08-01
|
||||
@@ -39,108 +44,153 @@ import java.util.List;
|
||||
@Service
|
||||
public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace> implements WorkspaceService {
|
||||
|
||||
@Resource
|
||||
private WorkspaceMapper workspaceMapper;
|
||||
@Resource
|
||||
private WorkspaceMapper workspaceMapper;
|
||||
|
||||
@Override
|
||||
public IPage<WorkspaceVO> selectWorkspacePage(IPage<WorkspaceVO> page, WorkspaceVO workspace) {
|
||||
return page.setRecords(baseMapper.selectWorkspacePage(page, workspace));
|
||||
}
|
||||
@Resource
|
||||
private LibraryMapper libraryMapper;
|
||||
|
||||
@Override
|
||||
public boolean saveOrUpdate(Workspace workspace) {
|
||||
AuthPrincipalVo userInfo = UserContext.getUserHolder();
|
||||
workspace.setUserName(userInfo.getUsername());
|
||||
workspace.setIsLastIndex(0);
|
||||
if (null == workspace.getId()) {
|
||||
int insert = workspaceMapper.insert(workspace);
|
||||
if (insert <= 0) {
|
||||
throw new BusinessException("insert workspace failed");
|
||||
}
|
||||
return true;
|
||||
}else {
|
||||
int update = workspaceMapper.updateById(workspace);
|
||||
if (update <= 0) {
|
||||
throw new BusinessException("update workspace failed");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@Resource
|
||||
private SysFileMapper sysFileMapper;
|
||||
|
||||
private final static String WORKSPACE_NAME = "默认workspace名称";
|
||||
private final static Integer SYSTEM_DESIGNER_PERCENTAGE = 30;
|
||||
@Override
|
||||
public IPage<WorkspaceVO> selectWorkspacePage(IPage<WorkspaceVO> page, WorkspaceVO workspace) {
|
||||
return page.setRecords(baseMapper.selectWorkspacePage(page, workspace));
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorkspaceVO getPage(WorkspaceDTO query) {
|
||||
WorkspaceVO vo = new WorkspaceVO();
|
||||
String userName = UserContext.getUserHolder().getUsername();
|
||||
QueryWrapper<Workspace> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(Workspace::getUserName, userName);
|
||||
IPage<Workspace> page = workspaceMapper.selectPage(new Page<>(query.getPage(), query.getSize()), qw);
|
||||
if (page.getTotal() == 0L) {
|
||||
// 给用户新建默认workspace
|
||||
Workspace workspace = new Workspace();
|
||||
workspace.setWorkSpaceName(WORKSPACE_NAME);
|
||||
workspace.setSex(Sex.MALE.getValue());
|
||||
workspace.setSystemDesignerPercentage(SYSTEM_DESIGNER_PERCENTAGE);
|
||||
workspace.setPosition(Position.OVERALL.getValue());
|
||||
workspace.setUserName(userName);
|
||||
workspace.setIsLastIndex(1);
|
||||
int insert = workspaceMapper.insert(workspace);
|
||||
if (insert <= 0) {
|
||||
throw new BusinessException("save workspace failed");
|
||||
}
|
||||
page = workspaceMapper.selectPage(new Page<>(query.getPage(), query.getSize()), qw);
|
||||
vo.setPage(PageBaseResponse.success(page));
|
||||
vo.setId(workspace.getId());
|
||||
return vo;
|
||||
}
|
||||
vo.setPage(PageBaseResponse.success(page));
|
||||
QueryWrapper<Workspace> qwIsLastIndex = new QueryWrapper<>();
|
||||
qwIsLastIndex.lambda().eq(Workspace::getUserName, userName);
|
||||
qwIsLastIndex.lambda().eq(Workspace::getIsLastIndex, 1);
|
||||
qwIsLastIndex.last("limit 1");
|
||||
List<Workspace> workspaces = workspaceMapper.selectList(qwIsLastIndex);
|
||||
if (CollectionUtils.isEmpty(workspaces)) {
|
||||
throw new BusinessException("用户工作空间未查询到最后使用标识");
|
||||
}
|
||||
vo.setId(workspaces.get(0).getId());
|
||||
return vo;
|
||||
}
|
||||
@Override
|
||||
public boolean saveOrUpdate(Workspace workspace) {
|
||||
AuthPrincipalVo userInfo = UserContext.getUserHolder();
|
||||
workspace.setUserName(userInfo.getUsername());
|
||||
workspace.setIsLastIndex(0);
|
||||
if (null == workspace.getId()) {
|
||||
int insert = workspaceMapper.insert(workspace);
|
||||
if (insert <= 0) {
|
||||
throw new BusinessException("insert workspace failed");
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
int update = workspaceMapper.updateById(workspace);
|
||||
if (update <= 0) {
|
||||
throw new BusinessException("update workspace failed");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BizJson> getEnumValues(String className) {
|
||||
Class clazz;
|
||||
try {
|
||||
clazz = Class.forName(IEnumDisplay.class.getPackage().getName() + "." + className);
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(className + "-枚举类型未找到");
|
||||
}
|
||||
return getEnumValues(clazz);
|
||||
}
|
||||
private final static String WORKSPACE_NAME = "默认workspace名称";
|
||||
private final static Integer SYSTEM_DESIGNER_PERCENTAGE = 30;
|
||||
|
||||
@Override
|
||||
public Workspace getByIdNew(Long id) {
|
||||
String userName = UserContext.getUserHolder().getUsername();
|
||||
QueryWrapper<Workspace> qwOld = new QueryWrapper<>();
|
||||
qwOld.lambda().eq(Workspace::getUserName, userName);
|
||||
qwOld.lambda().eq(Workspace::getIsLastIndex, 1);
|
||||
Workspace oldIsLastIndex = workspaceMapper.selectOne(qwOld);
|
||||
oldIsLastIndex.setIsLastIndex(0);
|
||||
workspaceMapper.updateById(oldIsLastIndex);
|
||||
Workspace newIsLastIndex= workspaceMapper.selectById(id);
|
||||
newIsLastIndex.setIsLastIndex(1);
|
||||
workspaceMapper.updateById(newIsLastIndex);
|
||||
return newIsLastIndex;
|
||||
}
|
||||
@Override
|
||||
public WorkspaceVO getPage(WorkspaceDTO query) {
|
||||
WorkspaceVO vo = new WorkspaceVO();
|
||||
String userName = UserContext.getUserHolder().getUsername();
|
||||
QueryWrapper<Workspace> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(Workspace::getUserName, userName);
|
||||
IPage<Workspace> page = workspaceMapper.selectPage(new Page<>(query.getPage(), query.getSize()), qw);
|
||||
if (page.getTotal() == 0L) {
|
||||
// 给用户新建默认workspace
|
||||
Workspace workspace = new Workspace();
|
||||
workspace.setWorkSpaceName(WORKSPACE_NAME);
|
||||
workspace.setSex(Sex.MALE.getValue());
|
||||
workspace.setSystemDesignerPercentage(SYSTEM_DESIGNER_PERCENTAGE);
|
||||
workspace.setPosition(Position.OVERALL.getValue());
|
||||
workspace.setUserName(userName);
|
||||
workspace.setIsLastIndex(1);
|
||||
int insert = workspaceMapper.insert(workspace);
|
||||
if (insert <= 0) {
|
||||
throw new BusinessException("save workspace failed");
|
||||
}
|
||||
page = workspaceMapper.selectPage(new Page<>(query.getPage(), query.getSize()), qw);
|
||||
vo.setPage(PageBaseResponse.success(page));
|
||||
vo.setId(workspace.getId());
|
||||
return vo;
|
||||
}
|
||||
vo.setPage(PageBaseResponse.success(page));
|
||||
QueryWrapper<Workspace> qwIsLastIndex = new QueryWrapper<>();
|
||||
qwIsLastIndex.lambda().eq(Workspace::getUserName, userName);
|
||||
qwIsLastIndex.lambda().eq(Workspace::getIsLastIndex, 1);
|
||||
qwIsLastIndex.last("limit 1");
|
||||
List<Workspace> workspaces = workspaceMapper.selectList(qwIsLastIndex);
|
||||
if (CollectionUtils.isEmpty(workspaces)) {
|
||||
throw new BusinessException("用户工作空间未查询到最后使用标识");
|
||||
}
|
||||
vo.setId(workspaces.get(0).getId());
|
||||
return vo;
|
||||
}
|
||||
|
||||
private List<BizJson> getEnumValues(Class clazz) {
|
||||
List<BizJson> kvs = new ArrayList<BizJson>();
|
||||
IEnumDisplay[] items = (IEnumDisplay[]) clazz.getEnumConstants();
|
||||
for (IEnumDisplay item : items) {
|
||||
kvs.add(new BizJson(item.getValue(), item.name(), null));
|
||||
}
|
||||
return kvs;
|
||||
}
|
||||
@Override
|
||||
public List<BizJson> getEnumValues(String className) {
|
||||
Class clazz;
|
||||
try {
|
||||
clazz = Class.forName(IEnumDisplay.class.getPackage().getName() + "." + className);
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(className + "-枚举类型未找到");
|
||||
}
|
||||
return getEnumValues(clazz);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Workspace getByIdNew(Long id) {
|
||||
String userName = UserContext.getUserHolder().getUsername();
|
||||
QueryWrapper<Workspace> qwOld = new QueryWrapper<>();
|
||||
qwOld.lambda().eq(Workspace::getUserName, userName);
|
||||
qwOld.lambda().eq(Workspace::getIsLastIndex, 1);
|
||||
Workspace oldIsLastIndex = workspaceMapper.selectOne(qwOld);
|
||||
oldIsLastIndex.setIsLastIndex(0);
|
||||
workspaceMapper.updateById(oldIsLastIndex);
|
||||
Workspace newIsLastIndex = workspaceMapper.selectById(id);
|
||||
newIsLastIndex.setIsLastIndex(1);
|
||||
workspaceMapper.updateById(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) {
|
||||
List<BizJson> kvs = new ArrayList<BizJson>();
|
||||
IEnumDisplay[] items = (IEnumDisplay[]) clazz.getEnumConstants();
|
||||
for (IEnumDisplay item : items) {
|
||||
kvs.add(new BizJson(item.getValue(), item.name(), null));
|
||||
}
|
||||
return kvs;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
server.port=5566
|
||||
server.port=5567
|
||||
|
||||
#datasource
|
||||
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.password=QWa998345
|
||||
spring.datasource.password=root
|
||||
#spring.datasource.password=QWa998345
|
||||
|
||||
#security
|
||||
spring.security.jwtSecret=JWTSECRET
|
||||
@@ -14,7 +15,7 @@ spring.security.jwtTokenPrefix=Bearer-
|
||||
spring.security.jwtExpiration=8640000000
|
||||
#spring security权限设置 认证了token还要认证权限 不然报错Full authentication is required to access this resource
|
||||
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
|
||||
|
||||
|
||||
@@ -24,6 +25,9 @@ rsa.private_key=MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEA0vfvyTdGJkdbHkB8
|
||||
mybatis-plus.global-config.banner=false
|
||||
mybatis-plus.mapper-locations=classpath:mapper/*Mapper.xml
|
||||
#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
|
||||
|
||||
@@ -36,3 +40,14 @@ spring.servlet.multipart.max-file-size = 5MB
|
||||
spring.servlet.multipart.max-request-size= 5MB
|
||||
#访问python服务的ip(对应环境)
|
||||
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>)
|
||||
spring.profiles.active=test
|
||||
spring.profiles.active=prod
|
||||
|
||||
#<23><><EFBFBD><EFBFBD>application-prod<6F>ļ<EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
#spring.profiles.active=prod
|
||||
|
||||
Reference in New Issue
Block a user