From 971b2034ee3ef79f7a29af4d12d199046195fe3f Mon Sep 17 00:00:00 2001 From: shahaibo <1023316923@qq.com> Date: Tue, 18 Mar 2025 13:43:59 +0800 Subject: [PATCH] =?UTF-8?q?TASK:AiDA=E6=A8=A1=E5=9D=97=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ai/da/controller/ProjectController.java | 10 + .../com/ai/da/model/dto/MannequinDTO.java | 13 + .../com/ai/da/model/dto/ModuleSaveDTO.java | 1 - .../java/com/ai/da/python/PythonService.java | 243 +++++++++++++++--- .../ai/da/service/UserLikeGroupService.java | 7 +- .../ai/da/service/impl/DesignServiceImpl.java | 40 +-- .../impl/UserLikeGroupServiceImpl.java | 22 +- 7 files changed, 269 insertions(+), 67 deletions(-) create mode 100644 src/main/java/com/ai/da/model/dto/MannequinDTO.java diff --git a/src/main/java/com/ai/da/controller/ProjectController.java b/src/main/java/com/ai/da/controller/ProjectController.java index b99183b8..63e49032 100644 --- a/src/main/java/com/ai/da/controller/ProjectController.java +++ b/src/main/java/com/ai/da/controller/ProjectController.java @@ -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 getMannequinDetail(@Valid @RequestBody MannequinDTO mannequinDTO) { + return Response.success(userLikeGroupService.getMannequinDetail(mannequinDTO)); + } } diff --git a/src/main/java/com/ai/da/model/dto/MannequinDTO.java b/src/main/java/com/ai/da/model/dto/MannequinDTO.java new file mode 100644 index 00000000..26f48205 --- /dev/null +++ b/src/main/java/com/ai/da/model/dto/MannequinDTO.java @@ -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; +} diff --git a/src/main/java/com/ai/da/model/dto/ModuleSaveDTO.java b/src/main/java/com/ai/da/model/dto/ModuleSaveDTO.java index cf6acb6b..5152a754 100644 --- a/src/main/java/com/ai/da/model/dto/ModuleSaveDTO.java +++ b/src/main/java/com/ai/da/model/dto/ModuleSaveDTO.java @@ -21,7 +21,6 @@ public class ModuleSaveDTO { @ApiModelProperty("印花板图片 数组") private List printBoard; - @NotEmpty(message = "colorBoards.cannot.be.empty") @ApiModelProperty("颜色板RGB值 数组") private List colorBoard; diff --git a/src/main/java/com/ai/da/python/PythonService.java b/src/main/java/com/ai/da/python/PythonService.java index b843d70c..56833031 100644 --- a/src/main/java/com/ai/da/python/PythonService.java +++ b/src/main/java/com/ai/da/python/PythonService.java @@ -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 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 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 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 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 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 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 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 list = getSystemSketchPool(attributeRecognition, styleCategory, elementVO.getModelSex(), poolNum, elementVO.getStyle()); +// int randomNum = RandomsUtil.randomSysFile(list.size()); +// return coverSketchToDesignPythonItem(null, list.get(randomNum), elementVO); } private List getFilteredCollectionElements(List 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 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 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 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 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 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 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 residuePinData(List pinData, List existPinDataIds, List hasUseMd5List) { if (CollectionUtils.isEmpty(pinData)) { return null; @@ -3799,4 +3905,65 @@ public class PythonService { throw new BusinessException("design.interface.exception"); } + public List 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 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"); + } + } + } diff --git a/src/main/java/com/ai/da/service/UserLikeGroupService.java b/src/main/java/com/ai/da/service/UserLikeGroupService.java index eacc34b3..613db52c 100644 --- a/src/main/java/com/ai/da/service/UserLikeGroupService.java +++ b/src/main/java/com/ai/da/service/UserLikeGroupService.java @@ -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 { ModuleChooseVO getModuleContent(ProjectDTO projectDTO); ModuleChooseVO saveModuleContent(ModuleSaveDTO moduleSaveDTO); + + LibraryModelPoint getMannequinDetail(MannequinDTO mannequinDTO); } diff --git a/src/main/java/com/ai/da/service/impl/DesignServiceImpl.java b/src/main/java/com/ai/da/service/impl/DesignServiceImpl.java index 5c4831a3..8a9291e3 100644 --- a/src/main/java/com/ai/da/service/impl/DesignServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/DesignServiceImpl.java @@ -296,14 +296,14 @@ public class DesignServiceImpl extends ServiceImpl 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 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 impleme DesignCollectionDTO designCollectionDTO = CopyUtil.copyObject(reDesignDTO, DesignCollectionDTO.class); ValidateElementVO elementVO = collectionElementService.validateElement(designCollectionDTO); //计算并删除对应的未关联的element - List 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 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); diff --git a/src/main/java/com/ai/da/service/impl/UserLikeGroupServiceImpl.java b/src/main/java/com/ai/da/service/impl/UserLikeGroupServiceImpl.java index 9ddea282..a6567ef0 100644 --- a/src/main/java/com/ai/da/service/impl/UserLikeGroupServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/UserLikeGroupServiceImpl.java @@ -107,6 +107,8 @@ public class UserLikeGroupServiceImpl extends ServiceImpl page = projectMapper.selectPage( new Page<>(query.getPage(), query.getSize()), queryWrapper); if (CollectionUtils.isEmpty(page.getRecords())) { @@ -1551,7 +1553,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl printBoards = moduleSaveDTO.getPrintBoard(); QueryWrapper qw = new QueryWrapper<>(); qw.lambda().eq(CollectionElement::getProjectId, projectId); @@ -1605,7 +1607,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl colorBoards = moduleSaveDTO.getColorBoard(); QueryWrapper qw = new QueryWrapper<>(); qw.lambda().eq(CollectionElement::getProjectId, projectId); @@ -1632,7 +1634,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl 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 qw = new QueryWrapper<>(); + qw.lambda().eq(LibraryModelPoint::getRelationId, mannequinDTO.getId()); + qw.lambda().eq(LibraryModelPoint::getModelType, mannequinDTO.getType()); + List libraryModelPoints = libraryModelPointMapper.selectList(qw); + if (CollectionUtil.isEmpty(libraryModelPoints)) { + throw new BusinessException("No model doting information available."); + } + return libraryModelPoints.get(0); + } }