TASK: sketches裁剪;

This commit is contained in:
shahaibo
2023-11-23 15:27:01 +08:00
parent e18a4f78c4
commit 3e3aaa54c4
5 changed files with 57 additions and 5 deletions

View File

@@ -90,4 +90,6 @@ public interface DesignService extends IService<Design> {
Integer designProcess(String processId);
void relationImageId(DesignPythonObjects objects);
Boolean sketchesBoundingBox(SketchesBoundingBoxDTO sketchesBoundingBoxDTO);
}

View File

@@ -287,11 +287,11 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
List<Library> libraryList = CopyUtil.copyList(elements, Library.class, (o, d) -> {
if (d.getLevel1Type().equals(LibraryLevel1TypeEnum.SKETCH_BOARD.getRealName())) {
d.setLevel3Type(modelSex);
try {
// try {
libraryService.processSketchBoards(d.getUrl(), d.getLevel2Type());
}catch (Exception e) {
// TODO:暂不处理
}
// }catch (Exception e) {
// // TODO:暂不处理
// }
}
d.setCreateDate(DateUtil.getByTimeZone(timeZone));
d.setName(name);
@@ -783,7 +783,7 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
private boolean saveOne(CollectionElement collectionElement) {
if (collectionElementMapper.insert(collectionElement) <= 0) {
throw new BusinessException("save failed!");
throw new BusinessException("save.collectionElement.failed");
}
return Boolean.TRUE;
}

View File

@@ -6,10 +6,12 @@ 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.SingleOverallEnum;
import com.ai.da.common.enums.SysFileLevel2TypeEnum;
import com.ai.da.common.utils.*;
import com.ai.da.mapper.DesignMapper;
import com.ai.da.mapper.GenerateDetailMapper;
import com.ai.da.mapper.TDesignPythonOutfitMapper;
import com.ai.da.mapper.entity.*;
import com.ai.da.mapper.entity.Collection;
@@ -66,6 +68,8 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
@Resource
private LibraryService libraryService;
@Resource
private GenerateDetailMapper generateDetailMapper;
@Resource
private DesignItemService designItemService;
@Resource
private DesignItemDetailService designItemDetailService;
@@ -343,6 +347,26 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
);
}
@Override
public Boolean sketchesBoundingBox(SketchesBoundingBoxDTO sketchesBoundingBoxDTO) {
List<CollectionSketchDTO> sketchBoards = sketchesBoundingBoxDTO.getSketchBoards();
List<CollectionSketchDTO> collect = sketchBoards.stream()
.filter(o -> !o.getDesignType().equals(DesignTypeEnum.LIBRARY.getRealName()))
.collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(collect)) {
for (CollectionSketchDTO collectionSketchDTO : collect) {
if (collectionSketchDTO.getDesignType().equals(DesignTypeEnum.COLLECTION.getRealName())) {
CollectionElement byId = collectionElementService.getById(collectionSketchDTO.getSketchBoardId());
libraryService.processSketchBoards(byId.getUrl(), collectionSketchDTO.getLevel2Type());
}else if (collectionSketchDTO.getDesignType().equals(DesignTypeEnum.GENERATE.getRealName())) {
GenerateDetail generateDetail = generateDetailMapper.selectById(collectionSketchDTO.getSketchBoardId());
libraryService.processSketchBoards(generateDetail.getUrl(), collectionSketchDTO.getLevel2Type());
}
}
}
return Boolean.TRUE;
}
public List<Long> relationImageIds(DesignPythonObjects pythonObjects) {
List<Long> imageIds = new ArrayList<>();
if (Objects.isNull(pythonObjects)) {