TASK: 全局异常优化;

This commit is contained in:
shahaibo
2023-10-27 17:02:04 +08:00
parent 31eb3773f6
commit 68d28995b8
5 changed files with 41 additions and 11 deletions

View File

@@ -301,7 +301,8 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
DesignPythonObjects pythonObjects = pythonService.covertDesignParam(designDTO.getSystemScale(),
designDTO.getSingleOverall(), designDTO.getSwitchCategory(), elementVO, designDTO.getProcessId());
// pythonObjects增加image_id关联
relationImageId(pythonObjects);
List<Long> imageIds = relationImageIds(pythonObjects);
System.out.println(imageIds);
//design
JSONObject responseJSONObject = pythonService.designNew(pythonObjects);
//生成library
@@ -341,6 +342,36 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
);
}
public List<Long> relationImageIds(DesignPythonObjects pythonObjects) {
List<Long> imageIds = new ArrayList<>();
if (Objects.isNull(pythonObjects)) {
return imageIds;
}
pythonObjects.getObjects().forEach(
o -> {
for (DesignPythonItem item : o.getItems()) {
List<Long> list = new ArrayList<>();
list.add(1L);
list.add(1L);
item.setOffset(list);
item.setResize_scale(1f);
String path = item.getPath();
if (StringUtils.isEmpty(path)) {
String bodyPath = item.getBody_path();
Long imageId = pythonTAllInfoService.getImageIdByPath(bodyPath);
imageIds.add(imageId);
item.setImage_id(imageId);
} else {
Long imageId = pythonTAllInfoService.getImageIdByPath(path);
imageIds.add(imageId);
item.setImage_id(imageId);
}
}
}
);
return imageIds;
}
private void handleCollectionElementRelation(Long collectionId, Boolean isEdit, List<Long> elementIds) {
if (CollectionUtils.isEmpty(elementIds) || collectionId == null) {
return;
@@ -594,7 +625,6 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
}
@Override
@Transactional
public DesignCollectionVO reDesignCollection(ReDesignCollectionDTO reDesignDTO) {
//校验collection
Collection collection = collectionService.getById(reDesignDTO.getCollectionId());