BUGFIX:系统模特上传;

This commit is contained in:
shahaibo
2023-10-04 17:02:54 +08:00
parent 9bf7bba29c
commit 1ef079a1f9

View File

@@ -62,6 +62,8 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
@Resource
private LibraryService libraryService;
@Resource
private SysFileService sysFileService;
@Resource
private GenerateService generateService;
@Resource
private LibraryModelPointService libraryModelPointService;
@@ -447,20 +449,31 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
// Assert.notNull(modelPoint, "template cannot by empty!");
// Library library = libraryService.getById(modelPoint.getLibraryId());
// Assert.notNull(library, "template library cannot by empty!");
// if (designDTO.getModelType().equals(ModelType.LIBRARY.getValue())) {
// Library byId = libraryService.getById(designDTO.getTemplateId());
// QueryWrapper<LibraryModelPoint> qw = new QueryWrapper<>();
// qw.lambda().eq(LibraryModelPoint::getModelType, ModelType.LIBRARY.getValue());
// qw.lambda().eq(LibraryModelPoint::getRelationId, byId.getId());
// LibraryModelPoint modelPoint = libraryModelPointService.getOne(qw);
// if (Objects.isNull(modelPoint)) {
// throw new BusinessException("error modelPoint get");
// }
// elementVO.setDesignLibraryModelPoint(calculateTemplatePointTemplate(modelPoint,1654,1170,byId.getUrl()));
// }
elementVO.setDesignLibraryModelPoint(calculateTemplatePointTemplate(null,null,null,null));
if (designDTO.getModelType().equals(ModelType.LIBRARY.getValue())) {
Library byId = libraryService.getById(designDTO.getTemplateId());
QueryWrapper<LibraryModelPoint> qw = new QueryWrapper<>();
qw.lambda().eq(LibraryModelPoint::getModelType, ModelType.LIBRARY.getValue());
qw.lambda().eq(LibraryModelPoint::getRelationId, byId.getId());
LibraryModelPoint modelPoint = libraryModelPointService.getOne(qw);
if (Objects.isNull(modelPoint)) {
throw new BusinessException("error modelPoint get");
}
elementVO.setDesignLibraryModelPoint(calculateTemplatePointTemplate(modelPoint,1654,1170,byId.getUrl()));
}else if (designDTO.getModelType().equals(ModelType.SYSTEM.getValue())) {
SysFileVO byId = sysFileService.getById(designDTO.getTemplateId());
QueryWrapper<LibraryModelPoint> qw = new QueryWrapper<>();
qw.lambda().eq(LibraryModelPoint::getModelType, ModelType.SYSTEM.getValue());
qw.lambda().eq(LibraryModelPoint::getRelationId, byId.getId());
LibraryModelPoint modelPoint = libraryModelPointService.getOne(qw);
if (Objects.isNull(modelPoint)) {
throw new BusinessException("error modelPoint get");
}
elementVO.setDesignLibraryModelPoint(calculateTemplatePointTemplate(modelPoint,1654,1170,byId.getUrl()));
}
}else {
throw new BusinessException("templateId or modelType can't be null");
}
elementVO.setDesignLibraryModelPoint(calculateTemplatePointTemplate(null,null,null,null));
// elementVO.setDesignLibraryModelPoint(calculateTemplatePointTemplate(null,null,null,null));
return elementVO;
}
@Override
@@ -479,21 +492,21 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
@Override
public DesignLibraryModelPointVO calculateTemplatePointTemplate(LibraryModelPoint modelPoint, Integer high, Integer width,String templateUrl){
DesignLibraryModelPointVO libraryModelPoint = new DesignLibraryModelPointVO();
LibraryModelPoint template = libraryModelPointService.getById(96L);
libraryModelPoint.setHandLeft(calculateTemplatePointOne(template.getHandLeft(),752,564));
libraryModelPoint.setHandRight(calculateTemplatePointOne(template.getHandRight(),752,564));
libraryModelPoint.setShoulderLeft(calculateTemplatePointOne(template.getShoulderLeft(),752,564));
libraryModelPoint.setShoulderRight(calculateTemplatePointOne(template.getShoulderRight(),752,564));
libraryModelPoint.setWaistbandLeft(calculateTemplatePointOne(template.getWaistbandLeft(),752,564));
libraryModelPoint.setWaistbandRight(calculateTemplatePointOne(template.getWaistbandRight(),752,564));
libraryModelPoint.setTemplateUrl("aida-mannequins/model_1693218345.2714432.png");
// libraryModelPoint.setHandLeft(calculateTemplatePointOne(modelPoint.getHandLeft(),high,width));
// libraryModelPoint.setHandRight(calculateTemplatePointOne(modelPoint.getHandRight(),high,width));
// libraryModelPoint.setShoulderLeft(calculateTemplatePointOne(modelPoint.getShoulderLeft(),high,width));
// libraryModelPoint.setShoulderRight(calculateTemplatePointOne(modelPoint.getShoulderRight(),high,width));
// libraryModelPoint.setWaistbandLeft(calculateTemplatePointOne(modelPoint.getWaistbandLeft(),high,width));
// libraryModelPoint.setWaistbandRight(calculateTemplatePointOne(modelPoint.getWaistbandRight(),high,width));
// libraryModelPoint.setTemplateUrl(templateUrl);
// LibraryModelPoint template = libraryModelPointService.getById(96L);
// libraryModelPoint.setHandLeft(calculateTemplatePointOne(template.getHandLeft(),752,564));
// libraryModelPoint.setHandRight(calculateTemplatePointOne(template.getHandRight(),752,564));
// libraryModelPoint.setShoulderLeft(calculateTemplatePointOne(template.getShoulderLeft(),752,564));
// libraryModelPoint.setShoulderRight(calculateTemplatePointOne(template.getShoulderRight(),752,564));
// libraryModelPoint.setWaistbandLeft(calculateTemplatePointOne(template.getWaistbandLeft(),752,564));
// libraryModelPoint.setWaistbandRight(calculateTemplatePointOne(template.getWaistbandRight(),752,564));
// libraryModelPoint.setTemplateUrl("aida-mannequins/model_1693218345.2714432.png");
libraryModelPoint.setHandLeft(calculateTemplatePointOne(modelPoint.getHandLeft(),high,width));
libraryModelPoint.setHandRight(calculateTemplatePointOne(modelPoint.getHandRight(),high,width));
libraryModelPoint.setShoulderLeft(calculateTemplatePointOne(modelPoint.getShoulderLeft(),high,width));
libraryModelPoint.setShoulderRight(calculateTemplatePointOne(modelPoint.getShoulderRight(),high,width));
libraryModelPoint.setWaistbandLeft(calculateTemplatePointOne(modelPoint.getWaistbandLeft(),high,width));
libraryModelPoint.setWaistbandRight(calculateTemplatePointOne(modelPoint.getWaistbandRight(),high,width));
libraryModelPoint.setTemplateUrl(templateUrl);
return libraryModelPoint;
}
private List<BigDecimal> calculateTemplatePointOne(String template,Integer high,Integer width){