TASK:AiDA design like sort

This commit is contained in:
shahaibo
2025-01-06 10:46:51 +08:00
parent 214c93923c
commit 5ea8e851d7
11 changed files with 159 additions and 11 deletions

View File

@@ -268,7 +268,8 @@ public class PythonService {
DesignPythonObject pythonObject = createDesignPythonObject(elementVO, designPictureType, systemScale, singleOverall, switchCategory, i);
// 如果当前对象与已组装的对象重复,则跳过当前组装
if (assembledObjects.contains(pythonObject)) {
DesignPythonObject designPythonObjectCopy = getCopy(pythonObject);
if (assembledObjects.contains(designPythonObjectCopy)) {
if (lastAssembledObject != null && assembledObjects.contains(lastAssembledObject)) {
// 如果当前组装与前一个组装的对象重复,且前一个组装也重复,结束组装
System.out.println("当前组装的对象与前两个组装的对象重复,结束组装。");
@@ -279,8 +280,8 @@ public class PythonService {
}
// 将当前对象添加到已组装的集合中,并记录
assembledObjects.add(pythonObject);
lastAssembledObject = pythonObject; // 更新上一次组装的对象
assembledObjects.add(designPythonObjectCopy);
lastAssembledObject = designPythonObjectCopy; // 更新上一次组装的对象
objects.add(pythonObject);
redisUtil.addProcessId(processId, i + 1);
@@ -288,6 +289,26 @@ public class PythonService {
return designPythonObjects;
}
private DesignPythonObject getCopy(DesignPythonObject pythonObject) {
DesignPythonObject designPythonObjectCopy = CopyUtil.copyObject(pythonObject, DesignPythonObject.class);
designPythonObjectCopy.setObjectSign(null);
DesignPythonBasic basic = designPythonObjectCopy.getBasic();
basic.setSave_name(null);
designPythonObjectCopy.setBasic(basic);
List<DesignPythonItem> items = designPythonObjectCopy.getItems();
List<DesignPythonItem> itemsCopy = new ArrayList<>();
for (DesignPythonItem item : items) {
item.setElementId(null);
item.setIcon(null);
item.setBusinessId(null);
item.setImage_id(null);
item.setImageId(null);
itemsCopy.add(item);
}
designPythonObjectCopy.setItems(itemsCopy);
return designPythonObjectCopy;
}
private void updateSketchNumbers(CurrentDesignPictureTypeEnum designPictureType, int[] sketchNumbers) {
switch (designPictureType) {
case PIN:
@@ -320,7 +341,9 @@ public class PythonService {
DesignPythonObject pythonObject = new DesignPythonObject();
pythonObject.setItems(coverToDesignPythonItemNew(elementVO, designPictureType, systemScale));
pythonObject.setBasic(coverToBasic(pythonObject.getItems().get(0), singleOverall, switchCategory, elementVO.getDesignLibraryModelPoint()));
pythonObject.setObjectSign(elementVO.getRequestIdList().get(i));
if (CollectionUtil.isNotEmpty(elementVO.getRequestIdList())) {
pythonObject.setObjectSign(elementVO.getRequestIdList().get(i));
}
return pythonObject;
}