TASK:根据designItemId获取模特图
This commit is contained in:
@@ -76,4 +76,10 @@ public class DesignController {
|
|||||||
return Response.success(designService.sketchesBoundingBox(sketchesBoundingBoxDTO));
|
return Response.success(designService.sketchesBoundingBox(sketchesBoundingBoxDTO));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "通过designItemId获取模特图")
|
||||||
|
@PostMapping("/getModel")
|
||||||
|
public Response<List<String>> getModel(@RequestBody List<Long> designItemIdList){
|
||||||
|
return Response.success(designService.getModel(designItemIdList));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,4 +53,5 @@ public interface DesignItemService extends IService<DesignItem> {
|
|||||||
|
|
||||||
ComposeLayersVO editLayersPositionAndScale(EditLayersPositionAndScaleVO positionAndScaleVO) throws IOException;
|
ComposeLayersVO editLayersPositionAndScale(EditLayersPositionAndScaleVO positionAndScaleVO) throws IOException;
|
||||||
|
|
||||||
|
List<DesignItem> selectDesignIdById(List<Long> designItemIdList);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,4 +94,6 @@ public interface DesignService extends IService<Design> {
|
|||||||
void relationImageId(DesignPythonObjects objects);
|
void relationImageId(DesignPythonObjects objects);
|
||||||
|
|
||||||
List<CollectionSketchVO> sketchesBoundingBox(SketchesBoundingBoxDTO sketchesBoundingBoxDTO);
|
List<CollectionSketchVO> sketchesBoundingBox(SketchesBoundingBoxDTO sketchesBoundingBoxDTO);
|
||||||
|
|
||||||
|
List<String> getModel(List<Long> designItemIdList);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,4 +58,6 @@ public interface SysFileService extends IService<SysFile> {
|
|||||||
* @param urlList
|
* @param urlList
|
||||||
*/
|
*/
|
||||||
List<SysFileVO> getByUrlList(List<String> urlList);
|
List<SysFileVO> getByUrlList(List<String> urlList);
|
||||||
|
|
||||||
|
List<SysFile> getByIds(List<Long> ids);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -667,4 +667,12 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
|||||||
});
|
});
|
||||||
return composeLayerPythonItem;
|
return composeLayerPythonItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DesignItem> selectDesignIdById(List<Long> designItemIdList){
|
||||||
|
QueryWrapper<DesignItem> queryWrapper = new QueryWrapper<>();
|
||||||
|
|
||||||
|
queryWrapper.in("id",designItemIdList);
|
||||||
|
return designItemMapper.selectList(queryWrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1205,4 +1205,41 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
return designSinglePrintDTO;
|
return designSinglePrintDTO;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getModel(List<Long> designItemIdList){
|
||||||
|
ArrayList<String> models = new ArrayList<>();
|
||||||
|
List<DesignItem> designIdById = designItemService.selectDesignIdById(designItemIdList);
|
||||||
|
if (CollectionUtil.isEmpty(designIdById)){
|
||||||
|
log.info("according to the designItemIdList cannot find the designIdList");
|
||||||
|
throw new BusinessException("design.not.found");
|
||||||
|
}
|
||||||
|
List<Long> designIdList = designIdById.stream().map(DesignItem::getDesignId).collect(Collectors.toList());
|
||||||
|
List<Design> designs = selectList(designIdList);
|
||||||
|
if (CollectionUtil.isEmpty(designIdList)){
|
||||||
|
log.info("according to the designIdList cannot find the design");
|
||||||
|
throw new BusinessException("design.not.found");
|
||||||
|
}
|
||||||
|
List<Long> modelFromLibIds = designs.stream().filter(design -> design.getModelType().equals("Library")).map(Design::getTemplateId).collect(Collectors.toList());
|
||||||
|
if (!CollectionUtil.isEmpty(modelFromLibIds)){
|
||||||
|
models.addAll(libraryService.getByIds(modelFromLibIds).stream()
|
||||||
|
.map(d -> minioUtil.getPresignedUrl(d.getUrl(), 24 * 60))
|
||||||
|
.collect(Collectors.toList()));
|
||||||
|
}
|
||||||
|
List<Long> modelFromSysIds = designs.stream().filter(design -> design.getModelType().equals("System")).map(Design::getTemplateId).collect(Collectors.toList());
|
||||||
|
if (!CollectionUtil.isEmpty(modelFromSysIds)){
|
||||||
|
models.addAll(sysFileService.getByIds(modelFromSysIds).stream()
|
||||||
|
.map(d -> minioUtil.getPresignedUrl(d.getUrl(), 24 * 60))
|
||||||
|
.collect(Collectors.toList()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return models;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Design> selectList(List<Long> designIdList){
|
||||||
|
QueryWrapper<Design> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.in("id",designIdList);
|
||||||
|
|
||||||
|
return designMapper.selectList(queryWrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -260,4 +260,11 @@ public class SysFileServiceImpl extends ServiceImpl<SysFileMapper, SysFile> impl
|
|||||||
queryWrapper.in("url", urlList);
|
queryWrapper.in("url", urlList);
|
||||||
return CopyUtil.copyList(sysFileMapper.selectList(queryWrapper), SysFileVO.class);
|
return CopyUtil.copyList(sysFileMapper.selectList(queryWrapper), SysFileVO.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SysFile> getByIds(List<Long> ids) {
|
||||||
|
QueryWrapper<SysFile> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.in("id", ids);
|
||||||
|
return sysFileMapper.selectList(queryWrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user