TASK:AiDA模块化
This commit is contained in:
@@ -2,9 +2,12 @@ package com.ai.da.controller;
|
||||
|
||||
import com.ai.da.common.response.PageBaseResponse;
|
||||
import com.ai.da.common.response.Response;
|
||||
import com.ai.da.mapper.primary.entity.LibraryModelPoint;
|
||||
import com.ai.da.model.dto.MannequinDTO;
|
||||
import com.ai.da.model.dto.ModuleSaveDTO;
|
||||
import com.ai.da.model.dto.ProjectDTO;
|
||||
import com.ai.da.model.dto.ProjectQueryDTO;
|
||||
import com.ai.da.model.enums.MannequinType;
|
||||
import com.ai.da.model.vo.*;
|
||||
import com.ai.da.service.UserLikeGroupService;
|
||||
import com.ai.da.service.WorkspaceService;
|
||||
@@ -80,4 +83,11 @@ public class ProjectController {
|
||||
// public Response saveOrUpdateProject(@Valid @RequestBody ProjectDTO projectDTO) {
|
||||
// return Response.success(workspaceService.saveOrUpdateProject(projectDTO));
|
||||
// }
|
||||
|
||||
@PostMapping("/getMannequinDetail")
|
||||
@ApiOperationSupport(order = 7)
|
||||
@ApiOperation(value = "获取模特详情", notes = "传入mannequinId")
|
||||
public Response<LibraryModelPoint> getMannequinDetail(@Valid @RequestBody MannequinDTO mannequinDTO) {
|
||||
return Response.success(userLikeGroupService.getMannequinDetail(mannequinDTO));
|
||||
}
|
||||
}
|
||||
|
||||
13
src/main/java/com/ai/da/model/dto/MannequinDTO.java
Normal file
13
src/main/java/com/ai/da/model/dto/MannequinDTO.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package com.ai.da.model.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class MannequinDTO {
|
||||
private Long id;
|
||||
private String type;
|
||||
}
|
||||
@@ -21,7 +21,6 @@ public class ModuleSaveDTO {
|
||||
@ApiModelProperty("印花板图片 数组")
|
||||
private List<DesignCollectionPrintElementDTO> printBoard;
|
||||
|
||||
@NotEmpty(message = "colorBoards.cannot.be.empty")
|
||||
@ApiModelProperty("颜色板RGB值 数组")
|
||||
private List<CollectionColorDTO> colorBoard;
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.exceptions.ExceptionUtil;
|
||||
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.*;
|
||||
import com.ai.da.common.utils.*;
|
||||
import com.ai.da.mapper.primary.CollocationMapper;
|
||||
@@ -46,7 +47,9 @@ import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -272,11 +275,6 @@ public class PythonService {
|
||||
boolean isDuplicate = assembledObjects.contains(designPythonObjectCopy);
|
||||
|
||||
if (isDuplicate) {
|
||||
// if (lastAssembledObject != null && assembledObjects.contains(lastAssembledObject)) {
|
||||
// // 如果当前组装与前一个组装的对象重复,且前一个组装也重复,结束组装
|
||||
// System.out.println("当前组装的对象与前两个组装的对象重复,结束组装。");
|
||||
// break;
|
||||
// }
|
||||
elementVO.setHasUseMd5List(beforeAssemblyHasUseMd5List);
|
||||
i --;
|
||||
|
||||
@@ -296,7 +294,6 @@ public class PythonService {
|
||||
|
||||
// 将当前对象添加到已组装的集合中,并记录
|
||||
assembledObjects.add(designPythonObjectCopy);
|
||||
// lastAssembledObject = designPythonObjectCopy; // 更新上一次组装的对象
|
||||
|
||||
objects.add(pythonObject);
|
||||
redisUtil.addProcessId(processId, i + 1);
|
||||
@@ -613,9 +610,10 @@ public class PythonService {
|
||||
if (elementVO.getSingleOverall().equals(SingleOverallEnum.OVERALL.getRealName())) {
|
||||
List<String> otherSketchCategoryList = getOtherSketchCategoryList(elementVO.getModelSex(), designPythonItem);
|
||||
if (!otherSketchCategoryList.isEmpty()) {
|
||||
JSONObject attributeRecognition = getAttributeRecognition(designPythonItem.getPath(), designPythonItem.getType(), elementVO.getModelSex());
|
||||
// JSONObject attributeRecognition = getAttributeRecognition(designPythonItem.getPath(), designPythonItem.getType(), elementVO.getModelSex());
|
||||
for (String styleCategory : otherSketchCategoryList) {
|
||||
DesignPythonItem otherSketch = processAttributeRecognition(attributeRecognition, elementVO, designPictureType, styleCategory, systemScale);
|
||||
// DesignPythonItem otherSketch = processAttributeRecognition(attributeRecognition, elementVO, designPictureType, styleCategory, systemScale);
|
||||
DesignPythonItem otherSketch = processAttributeRecognition(null, elementVO, designPictureType, styleCategory, systemScale);
|
||||
itemList.add(otherSketch);
|
||||
}
|
||||
}
|
||||
@@ -654,29 +652,69 @@ public class PythonService {
|
||||
return processNoPinOrSysFileAttributeRecognitionWithPool(collectNoPin, attributeRecognition, elementVO, styleCategory, systemScale);
|
||||
}
|
||||
|
||||
// 生成两位小数随机数(线程安全)
|
||||
private BigDecimal generateRandomValue() {
|
||||
// 使用ThreadLocalRandom提高并发性能
|
||||
double random = ThreadLocalRandom.current().nextDouble(0.0, 1.0 + 1e-4);
|
||||
|
||||
return new BigDecimal(random)
|
||||
.setScale(2, RoundingMode.HALF_UP)
|
||||
.min(BigDecimal.ONE); // 确保不超过1.00
|
||||
}
|
||||
|
||||
private DesignPythonItem processNoPinOrSysFileAttributeRecognitionWithPool(List<CollectionElement> collectionElements, JSONObject attributeRecognition, ValidateElementVO elementVO, String styleCategory, BigDecimal systemScale) {
|
||||
int poolNum = 20;
|
||||
if (CollectionUtil.isNotEmpty(collectionElements)) {
|
||||
int collectionNoPinSize = collectionElements.size();
|
||||
if (systemScale.compareTo(BigDecimal.ZERO) == 0) {
|
||||
BigDecimal randomValue = generateRandomValue();
|
||||
boolean useSystem = randomValue.compareTo(systemScale) <= 0;
|
||||
|
||||
if (useSystem) {
|
||||
// 获取系统推荐sketch
|
||||
String categoryParam = elementVO.getModelSex().toLowerCase() + "_" + styleCategory.toLowerCase();
|
||||
List<String> recommentdUrlList = getSystemSketchByCategory(categoryParam);
|
||||
if (!CollectionUtils.isEmpty(recommentdUrlList)) {
|
||||
String recommendSystemSketch = recommentdUrlList.get(0);
|
||||
return coverSystemSketchUrlToDesignPythonItem(recommendSystemSketch, styleCategory, elementVO);
|
||||
}else {
|
||||
throw new BusinessException("Failed to obtain system sketch recommendation.");
|
||||
}
|
||||
}else {
|
||||
if (CollectionUtil.isNotEmpty(collectionElements)) {
|
||||
int collectionNoPinSize = collectionElements.size();
|
||||
int randomNum = RandomsUtil.randomSysFile(collectionNoPinSize);
|
||||
return coverSketchToDesignPythonItem(null, collectionElements.get(randomNum), elementVO);
|
||||
} else if (systemScale.compareTo(BigDecimal.ONE) != 0) {
|
||||
BigDecimal collectNoPinSize = BigDecimal.valueOf(collectionNoPinSize);
|
||||
poolNum = collectNoPinSize.divide(systemScale, 0, RoundingMode.DOWN).intValue();
|
||||
List<CollectionElement> list = getSystemSketchPool(attributeRecognition, styleCategory, elementVO.getModelSex(), poolNum, elementVO.getStyle());
|
||||
collectionElements.addAll(list);
|
||||
int randomNum = RandomsUtil.randomSysFile(collectionElements.size());
|
||||
if (randomNum < collectionNoPinSize) {
|
||||
return coverSketchToDesignPythonItem(collectionElements.get(randomNum).getId(), collectionElements.get(randomNum), elementVO);
|
||||
} else {
|
||||
return coverSketchToDesignPythonItem(null, collectionElements.get(randomNum), elementVO);
|
||||
return coverSketchToDesignPythonItem(collectionElements.get(randomNum).getId(), collectionElements.get(randomNum), elementVO);
|
||||
}else {
|
||||
String categoryParam = elementVO.getModelSex().toLowerCase() + "_" + styleCategory.toLowerCase();
|
||||
List<String> recommentdUrlList = getSystemSketchByCategory(categoryParam);
|
||||
if (!CollectionUtils.isEmpty(recommentdUrlList)) {
|
||||
String recommendSystemSketch = recommentdUrlList.get(0);
|
||||
return coverSystemSketchUrlToDesignPythonItem(recommendSystemSketch, styleCategory, elementVO);
|
||||
}else {
|
||||
throw new BusinessException("Failed to obtain system sketch recommendation.");
|
||||
}
|
||||
}
|
||||
}
|
||||
List<CollectionElement> list = getSystemSketchPool(attributeRecognition, styleCategory, elementVO.getModelSex(), poolNum, elementVO.getStyle());
|
||||
int randomNum = RandomsUtil.randomSysFile(list.size());
|
||||
return coverSketchToDesignPythonItem(null, list.get(randomNum), elementVO);
|
||||
|
||||
// int poolNum = 20;
|
||||
// if (CollectionUtil.isNotEmpty(collectionElements)) {
|
||||
// int collectionNoPinSize = collectionElements.size();
|
||||
// if (systemScale.compareTo(BigDecimal.ZERO) == 0) {
|
||||
// int randomNum = RandomsUtil.randomSysFile(collectionNoPinSize);
|
||||
// return coverSketchToDesignPythonItem(null, collectionElements.get(randomNum), elementVO);
|
||||
// } else if (systemScale.compareTo(BigDecimal.ONE) != 0) {
|
||||
// BigDecimal collectNoPinSize = BigDecimal.valueOf(collectionNoPinSize);
|
||||
// poolNum = collectNoPinSize.divide(systemScale, 0, RoundingMode.DOWN).intValue();
|
||||
// List<CollectionElement> list = getSystemSketchPool(attributeRecognition, styleCategory, elementVO.getModelSex(), poolNum, elementVO.getStyle());
|
||||
// collectionElements.addAll(list);
|
||||
// int randomNum = RandomsUtil.randomSysFile(collectionElements.size());
|
||||
// if (randomNum < collectionNoPinSize) {
|
||||
// return coverSketchToDesignPythonItem(collectionElements.get(randomNum).getId(), collectionElements.get(randomNum), elementVO);
|
||||
// } else {
|
||||
// return coverSketchToDesignPythonItem(null, collectionElements.get(randomNum), elementVO);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// List<CollectionElement> list = getSystemSketchPool(attributeRecognition, styleCategory, elementVO.getModelSex(), poolNum, elementVO.getStyle());
|
||||
// int randomNum = RandomsUtil.randomSysFile(list.size());
|
||||
// return coverSketchToDesignPythonItem(null, list.get(randomNum), elementVO);
|
||||
}
|
||||
|
||||
private List<CollectionElement> getFilteredCollectionElements(List<CollectionElement> elements, int hasPin, String styleCategory) {
|
||||
@@ -998,8 +1036,18 @@ public class PythonService {
|
||||
if (CollectionUtil.isNotEmpty(sketchBoardPins)) {
|
||||
Integer randomNum = RandomsUtil.randomSysFile(sketchBoardPins.size());
|
||||
CollectionElement element = sketchBoardPins.get(randomNum);
|
||||
JSONObject attributeRecognition = getAttributeRecognitionBySameCategory(element, validateElementVO.getModelSex());
|
||||
return processAttributeRecognitionBySameCategory(attributeRecognition, validateElementVO, element.getLevel2Type());
|
||||
// 获取随机pin sketch的category
|
||||
String category = element.getLevel2Type();
|
||||
String categoryParam = validateElementVO.getModelSex().toLowerCase() + "_" + category.toLowerCase();
|
||||
List<String> recommentdUrlList = getSystemSketchByCategory(categoryParam);
|
||||
if (!CollectionUtils.isEmpty(recommentdUrlList)) {
|
||||
String recommendSystemSketch = recommentdUrlList.get(0);
|
||||
return coverSystemSketchUrlToDesignPythonItem(recommendSystemSketch, category, validateElementVO);
|
||||
}else {
|
||||
throw new BusinessException("Failed to obtain system sketch recommendation.");
|
||||
}
|
||||
// JSONObject attributeRecognition = getAttributeRecognitionBySameCategory(element, validateElementVO.getModelSex());
|
||||
// return processAttributeRecognitionBySameCategory(attributeRecognition, validateElementVO, element.getLevel2Type());
|
||||
}
|
||||
QueryWrapper<Dressing> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(Dressing::getApparel, validateElementVO.getModelSex());
|
||||
@@ -1012,10 +1060,20 @@ public class PythonService {
|
||||
}
|
||||
Integer randomNum = RandomsUtil.randomSysFile(dressings.size());
|
||||
String category = dressings.get(randomNum).getStyleCategory();
|
||||
String tableName = getTableName(validateElementVO.getModelSex(), category);
|
||||
AttributeRetrieval attributeRetrieval = attributeRetrievalMapper.getSystemRandom(tableName, validateElementVO.getStyle());
|
||||
CollectionElement collectionElement = toCollectionElement(attributeRetrieval, category, validateElementVO.getModelSex());
|
||||
return coverSketchToDesignPythonItem(null, collectionElement, validateElementVO);
|
||||
|
||||
String categoryParam = validateElementVO.getModelSex().toLowerCase() + "_" + category.toLowerCase();
|
||||
List<String> recommentdUrlList = getSystemSketchByCategory(categoryParam);
|
||||
if (!CollectionUtils.isEmpty(recommentdUrlList)) {
|
||||
String recommendSystemSketch = recommentdUrlList.get(0);
|
||||
return coverSystemSketchUrlToDesignPythonItem(recommendSystemSketch, category, validateElementVO);
|
||||
}else {
|
||||
throw new BusinessException("Failed to obtain system sketch recommendation.");
|
||||
}
|
||||
|
||||
// String tableName = getTableName(validateElementVO.getModelSex(), category);
|
||||
// AttributeRetrieval attributeRetrieval = attributeRetrievalMapper.getSystemRandom(tableName, validateElementVO.getStyle());
|
||||
// CollectionElement collectionElement = toCollectionElement(attributeRetrieval, category, validateElementVO.getModelSex());
|
||||
// return coverSketchToDesignPythonItem(null, collectionElement, validateElementVO);
|
||||
}
|
||||
Random random = new Random();
|
||||
int randomNumber = random.nextInt(noPinCollectionData.size());
|
||||
@@ -1037,8 +1095,18 @@ public class PythonService {
|
||||
if (CollectionUtil.isNotEmpty(sketchBoardCollectionElements)) {
|
||||
Integer randomNum = RandomsUtil.randomSysFile(sketchBoardCollectionElements.size());
|
||||
CollectionElement element = sketchBoardCollectionElements.get(randomNum);
|
||||
JSONObject attributeRecognition = getAttributeRecognitionBySameCategory(element, validateElementVO.getModelSex());
|
||||
return processAttributeRecognitionBySameCategory(attributeRecognition, validateElementVO, element.getLevel2Type());
|
||||
String category = element.getLevel2Type();
|
||||
|
||||
String categoryParam = validateElementVO.getModelSex().toLowerCase() + "_" + category.toLowerCase();
|
||||
List<String> recommentdUrlList = getSystemSketchByCategory(categoryParam);
|
||||
if (!CollectionUtils.isEmpty(recommentdUrlList)) {
|
||||
String recommendSystemSketch = recommentdUrlList.get(0);
|
||||
return coverSystemSketchUrlToDesignPythonItem(recommendSystemSketch, category, validateElementVO);
|
||||
}else {
|
||||
throw new BusinessException("Failed to obtain system sketch recommendation.");
|
||||
}
|
||||
// JSONObject attributeRecognition = getAttributeRecognitionBySameCategory(element, validateElementVO.getModelSex());
|
||||
// return processAttributeRecognitionBySameCategory(attributeRecognition, validateElementVO, element.getLevel2Type());
|
||||
}
|
||||
}
|
||||
QueryWrapper<Dressing> qw = new QueryWrapper<>();
|
||||
@@ -1052,11 +1120,20 @@ public class PythonService {
|
||||
}
|
||||
Integer randomNum = RandomsUtil.randomSysFile(dressings.size());
|
||||
String category = dressings.get(randomNum).getStyleCategory();
|
||||
String tableName = getTableName(validateElementVO.getModelSex(), category);
|
||||
|
||||
AttributeRetrieval attributeRetrieval = attributeRetrievalMapper.getSystemRandom(tableName, validateElementVO.getStyle());
|
||||
CollectionElement collectionElement = toCollectionElement(attributeRetrieval, category, validateElementVO.getModelSex());
|
||||
return coverSketchToDesignPythonItem(null, collectionElement, validateElementVO);
|
||||
String categoryParam = validateElementVO.getModelSex().toLowerCase() + "_" + category.toLowerCase();
|
||||
List<String> recommentdUrlList = getSystemSketchByCategory(categoryParam);
|
||||
if (!CollectionUtils.isEmpty(recommentdUrlList)) {
|
||||
String recommendSystemSketch = recommentdUrlList.get(0);
|
||||
return coverSystemSketchUrlToDesignPythonItem(recommendSystemSketch, category, validateElementVO);
|
||||
}else {
|
||||
throw new BusinessException("Failed to obtain system sketch recommendation.");
|
||||
}
|
||||
// String tableName = getTableName(validateElementVO.getModelSex(), category);
|
||||
//
|
||||
// AttributeRetrieval attributeRetrieval = attributeRetrievalMapper.getSystemRandom(tableName, validateElementVO.getStyle());
|
||||
// CollectionElement collectionElement = toCollectionElement(attributeRetrieval, category, validateElementVO.getModelSex());
|
||||
// return coverSketchToDesignPythonItem(null, collectionElement, validateElementVO);
|
||||
}
|
||||
|
||||
private String getTableName(String modelSex, String category) {
|
||||
@@ -2048,6 +2125,35 @@ public class PythonService {
|
||||
return designPythonItemBlouse;
|
||||
}
|
||||
|
||||
private DesignPythonItem coverSystemSketchUrlToDesignPythonItem(String url, String category, ValidateElementVO elementVO) {
|
||||
DesignPythonItem designPythonItemBlouse = new DesignPythonItem();
|
||||
// if (Objects.nonNull(elementId)) {
|
||||
// designPythonItemBlouse.setElementId(null);
|
||||
// designPythonItemBlouse.setBusinessId(null);
|
||||
// }
|
||||
designPythonItemBlouse.setType(category);
|
||||
designPythonItemBlouse.setPath(url);
|
||||
//所有的icon都是none
|
||||
designPythonItemBlouse.setIcon("none");
|
||||
CollectionColorDTO randomColor = getRandomColor(elementVO.getColorBoards());
|
||||
designPythonItemBlouse.setColor(randomColor.getRgbValue());
|
||||
designPythonItemBlouse.setGradient(randomColor.getGradientMinioUrl());
|
||||
designPythonItemBlouse.setGradientString(randomColor.getGradientString());
|
||||
if (!elementVO.getDesignPythonItemPrint().getPath().equals("none")
|
||||
&& elementVO.getDesignPrintPictureTypeLayoutList().contains(category)) {
|
||||
DesignPythonItemPrint designPythonItemPrint = CopyUtil.copyObject(elementVO.getDesignPythonItemPrint(), DesignPythonItemPrint.class);
|
||||
// designPythonItemPrint.setIfSingle(false);
|
||||
designPythonItemPrint.setPrint_path_list(Collections.singletonList(designPythonItemPrint.getPath()));
|
||||
designPythonItemBlouse.setPrint(new PrintToPython(designPythonItemPrint));
|
||||
} else {
|
||||
DesignPythonItemPrint designPythonItemPrint = new DesignPythonItemPrint();
|
||||
// designPythonItemPrint.setIfSingle(false);
|
||||
designPythonItemPrint.setPrint_path_list(new ArrayList<>());
|
||||
designPythonItemBlouse.setPrint(new PrintToPython(designPythonItemPrint));
|
||||
}
|
||||
return designPythonItemBlouse;
|
||||
}
|
||||
|
||||
private List<CollectionElement> residuePinData(List<CollectionElement> pinData, List<Long> existPinDataIds, List<String> hasUseMd5List) {
|
||||
if (CollectionUtils.isEmpty(pinData)) {
|
||||
return null;
|
||||
@@ -3799,4 +3905,65 @@ public class PythonService {
|
||||
throw new BusinessException("design.interface.exception");
|
||||
}
|
||||
|
||||
public List<String> getSystemSketchByCategory(String category) {
|
||||
AuthPrincipalVo userHolder = UserContext.getUserHolder();
|
||||
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.connectTimeout(30, TimeUnit.SECONDS)
|
||||
.readTimeout(60, TimeUnit.SECONDS)
|
||||
.writeTimeout(60, TimeUnit.SECONDS)
|
||||
.build();
|
||||
|
||||
// 构建动态路径参数(保留两位小数)
|
||||
// String url = String.format("%s:%s/recommend/%d/%s/1",
|
||||
// accessPythonIp,
|
||||
// accessPythonPort,
|
||||
// userHolder.getId(),
|
||||
// category);
|
||||
String url = String.format("%s:%s/recommend/%d/%s/1",
|
||||
"127.0.0.1",
|
||||
"8000",
|
||||
userHolder.getId(),
|
||||
category);
|
||||
|
||||
log.info("Recommendation request URL: {}", url);
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url(url)
|
||||
.get()
|
||||
.addHeader("Authorization", "Basic YWlkbGFiOjEyMw==")
|
||||
.build();
|
||||
|
||||
try (Response response = client.newCall(request).execute()) {
|
||||
log.info("Response status: {}", response.code());
|
||||
|
||||
if (!response.isSuccessful()) {
|
||||
String errorBody = response.body() != null ?
|
||||
response.body().string() : "empty response";
|
||||
log.error("Request failed with code: {}, body: {}",
|
||||
response.code(), errorBody);
|
||||
throw new BusinessException("Recommendation service unavailable");
|
||||
}
|
||||
|
||||
// 解析图片路径数组
|
||||
String responseBody = response.body().string();
|
||||
List<String> imagePaths = JSON.parseArray(responseBody, String.class);
|
||||
|
||||
if (imagePaths == null || imagePaths.isEmpty()) {
|
||||
log.warn("Empty recommendation result for {}", category);
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
log.info("Received {} recommended images", imagePaths.size());
|
||||
return imagePaths;
|
||||
|
||||
} catch (IOException e) {
|
||||
log.error("Network error: {}", ExceptionUtil.getRootCauseMessage(e));
|
||||
throw new BusinessException("Failed to get recommendations: " + e.getMessage());
|
||||
} catch (JSONException e) {
|
||||
log.error("Response parsing error: {}", ExceptionUtil.getMessage(e));
|
||||
throw new BusinessException("Invalid service response format");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
package com.ai.da.service;
|
||||
|
||||
import com.ai.da.common.response.PageBaseResponse;
|
||||
import com.ai.da.mapper.primary.entity.CanvasElementUpload;
|
||||
import com.ai.da.mapper.primary.entity.ToProductImageResult;
|
||||
import com.ai.da.mapper.primary.entity.TrialOrder;
|
||||
import com.ai.da.mapper.primary.entity.UserLikeGroup;
|
||||
import com.ai.da.mapper.primary.entity.*;
|
||||
import com.ai.da.model.dto.*;
|
||||
import com.ai.da.model.vo.*;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
@@ -80,4 +77,6 @@ public interface UserLikeGroupService extends IService<UserLikeGroup> {
|
||||
ModuleChooseVO getModuleContent(ProjectDTO projectDTO);
|
||||
|
||||
ModuleChooseVO saveModuleContent(ModuleSaveDTO moduleSaveDTO);
|
||||
|
||||
LibraryModelPoint getMannequinDetail(MannequinDTO mannequinDTO);
|
||||
}
|
||||
|
||||
@@ -296,14 +296,14 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
|
||||
private String designOrRedesignOperateNew(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());
|
||||
}
|
||||
// if (CollectionUtil.isNotEmpty(designDTO.getSketchBoards())) {
|
||||
// //编辑sketchBoard
|
||||
// collectionElementService.editSketchBoardsElement(elementVO, designDTO.getSketchBoards());
|
||||
// }
|
||||
// if (CollectionUtil.isNotEmpty(designDTO.getPrintBoards())) {
|
||||
// //编辑printBoard
|
||||
// collectionElementService.editPrintBoardsElement(elementVO, designDTO.getPrintBoards());
|
||||
// }
|
||||
//保存collection
|
||||
Long collectionId;
|
||||
if (null == collectionIdParam) {
|
||||
@@ -317,11 +317,11 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
//批量关联element 到 collection
|
||||
collectionElementService.relationCollection(elementIds, collectionId);
|
||||
//library转化为collection(生成)
|
||||
saveCollectionElemntsByLibrarys(elementVO, collectionId);
|
||||
// saveCollectionElemntsByLibrarys(elementVO, collectionId);
|
||||
//generate转化为collection(生成)
|
||||
saveCollectionElemntsByGenerates(elementVO, collectionId);
|
||||
// saveCollectionElemntsByGenerates(elementVO, collectionId);
|
||||
//保存颜色版
|
||||
collectionElementService.saveColorBoard(designDTO.getColorBoards(), collectionId, designDTO.getTimeZone());
|
||||
// collectionElementService.saveColorBoard(designDTO.getColorBoards(), collectionId, designDTO.getTimeZone());
|
||||
//保存design
|
||||
Long designId = saveOne(designDTO, collectionId, userInfo.getId());
|
||||
//计算library
|
||||
@@ -1052,15 +1052,15 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
DesignCollectionDTO designCollectionDTO = CopyUtil.copyObject(reDesignDTO, DesignCollectionDTO.class);
|
||||
ValidateElementVO elementVO = collectionElementService.validateElement(designCollectionDTO);
|
||||
//计算并删除对应的未关联的element
|
||||
List<Long> longs = calculateNoRelationElement(reDesignDTO.getCollectionId(), elementVO.getUsedElementIds());
|
||||
if (!CollectionUtils.isEmpty(longs)) {
|
||||
collectionElementService.batchDelete(longs);
|
||||
}
|
||||
Design oldDesign = selectByCollectionId(reDesignDTO.getCollectionId());
|
||||
//删除老的关联的design
|
||||
deleteByCollectionId(reDesignDTO.getCollectionId());
|
||||
// designItemService.deleteByCollectionId(reDesignDTO.getCollectionId());
|
||||
designItemDetailService.deleteByDesignId(oldDesign.getId());
|
||||
// List<Long> longs = calculateNoRelationElement(reDesignDTO.getCollectionId(), elementVO.getUsedElementIds());
|
||||
// if (!CollectionUtils.isEmpty(longs)) {
|
||||
// collectionElementService.batchDelete(longs);
|
||||
// }
|
||||
// Design oldDesign = selectByCollectionId(reDesignDTO.getCollectionId());
|
||||
// //删除老的关联的design
|
||||
// deleteByCollectionId(reDesignDTO.getCollectionId());
|
||||
//// designItemService.deleteByCollectionId(reDesignDTO.getCollectionId());
|
||||
// designItemDetailService.deleteByDesignId(oldDesign.getId());
|
||||
//redesign
|
||||
return designOrRedesignOperateNew(CopyUtil.copyObject(
|
||||
reDesignDTO, DesignCollectionDTO.class), userInfo, reDesignDTO.getCollectionId(), elementVO);
|
||||
|
||||
@@ -107,6 +107,8 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
private ProjectMapper projectMapper;
|
||||
@Resource
|
||||
private PortfolioService portfolioService;
|
||||
@Resource
|
||||
private LibraryModelPointMapper libraryModelPointMapper;
|
||||
|
||||
@Override
|
||||
public void deleteUserGroup(Long userGroupId) {
|
||||
@@ -1175,7 +1177,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
queryWrapper.in("id", projectIdList);
|
||||
}
|
||||
}
|
||||
queryWrapper.orderByDesc("update_date");
|
||||
queryWrapper.orderByDesc("update_time");
|
||||
IPage<Project> page = projectMapper.selectPage(
|
||||
new Page<>(query.getPage(), query.getSize()), queryWrapper);
|
||||
if (CollectionUtils.isEmpty(page.getRecords())) {
|
||||
@@ -1551,7 +1553,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
collectionElementMapper.deleteBatchIds(old);
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isEmpty(moduleSaveDTO.getPrintBoard())){
|
||||
if (!CollectionUtils.isEmpty(moduleSaveDTO.getPrintBoard())){
|
||||
List<DesignCollectionPrintElementDTO> printBoards = moduleSaveDTO.getPrintBoard();
|
||||
QueryWrapper<CollectionElement> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(CollectionElement::getProjectId, projectId);
|
||||
@@ -1605,7 +1607,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
}
|
||||
collectionElementMapper.deleteBatchIds(old);
|
||||
}
|
||||
if (CollectionUtils.isEmpty(moduleSaveDTO.getColorBoard())){
|
||||
if (!CollectionUtils.isEmpty(moduleSaveDTO.getColorBoard())){
|
||||
List<CollectionColorDTO> colorBoards = moduleSaveDTO.getColorBoard();
|
||||
QueryWrapper<CollectionElement> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(CollectionElement::getProjectId, projectId);
|
||||
@@ -1632,7 +1634,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
}
|
||||
collectionElementMapper.deleteBatchIds(old);
|
||||
}
|
||||
if (CollectionUtils.isEmpty(moduleSaveDTO.getSketchBoard())){
|
||||
if (!CollectionUtils.isEmpty(moduleSaveDTO.getSketchBoard())){
|
||||
QueryWrapper<CollectionElement> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(CollectionElement::getProjectId, projectId);
|
||||
qw.lambda().eq(CollectionElement::getLevel1Type, CollectionLevel1TypeEnum.SKETCH_BOARD.getRealName());
|
||||
@@ -1688,4 +1690,16 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LibraryModelPoint getMannequinDetail(MannequinDTO mannequinDTO) {
|
||||
QueryWrapper<LibraryModelPoint> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(LibraryModelPoint::getRelationId, mannequinDTO.getId());
|
||||
qw.lambda().eq(LibraryModelPoint::getModelType, mannequinDTO.getType());
|
||||
List<LibraryModelPoint> libraryModelPoints = libraryModelPointMapper.selectList(qw);
|
||||
if (CollectionUtil.isEmpty(libraryModelPoints)) {
|
||||
throw new BusinessException("No model doting information available.");
|
||||
}
|
||||
return libraryModelPoints.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user