印花坐标修改

This commit is contained in:
xupei
2023-09-21 13:44:39 +08:00
parent e1b3c20131
commit dcd4ce584c
4 changed files with 14 additions and 10 deletions

View File

@@ -11,6 +11,9 @@ import java.util.List;
@ApiModel("designItem detail clothes 响应")
public class DesignItemClothesDetailVO {
/**
* designItemDetail对应的businessId
*/
@ApiModelProperty("对应的上游id")
private Long id;

View File

@@ -1390,11 +1390,10 @@ public class PythonService {
List<Float> angle = new ArrayList<>(printObject.getPrints().size());
// 设置印花的位置、大小、旋转角度
// todo 空指针
List<DesignSinglePrint> prints = printObject.getPrints();
prints.forEach(p -> {
p.getLocation().set(0,p.getLocation().get(0) * fileVO.getWidth());
p.getLocation().set(1,p.getLocation().get(1) * fileVO.getHigh());
p.getLocation().set(0,p.getLocation().get(0));
p.getLocation().set(1,p.getLocation().get(1));
Integer priority = p.getPriority();
location.add(priority - 1, p.getLocation());
scale.add(priority - 1,p.getScale());
@@ -1719,10 +1718,10 @@ public class PythonService {
private static List<String> setGenerateImageList(JSONObject jsonObject){
List<String> imageUrlList = JSONObject.parseArray(jsonObject.get("list").toString(),String.class);
if (imageUrlList.size() == 0){
if (imageUrlList.isEmpty()){
log.error("PythonService##generateSketchOrPrint异常###{}","diffusion response list is null");
// todo 如果这里返回为空,是判断出错还是返回给前端空
throw new BusinessException("Some errors occurred, please try again later");
throw new BusinessException("The data returned on the python side is empty");
}
return imageUrlList;

View File

@@ -316,7 +316,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
designItemDetail.setPrintJson(JSON.toJSONString(printObject));
designItemDetails.add(designItemDetail);
});
// todo businessId
// todo businessId来源
designItemDetailService.saveBatch(designItemDetails);
// 覆盖designPythonOutfit表中的模特全身图
@@ -376,6 +376,8 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
Assert.notNull(designItem,"design item does not exists!");
Design design = designService.getById(designItem.getDesignId());
Assert.notNull(design,"design does not exists!");
TDesignPythonOutfit designPythonOutfit = designPythonOutfitService.getByDesignItemId(designSingleIncludeLayersDTO.getDesignItemId());
Assert.notNull(designItem,"design item detail layers does not exists!");
DesignLibraryModelPointVO designLibraryModelPointVO = null;
// 设置模特
if (Objects.nonNull(design.getTemplateId())){
@@ -386,13 +388,16 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
designLibraryModelPointVO = collectionElementService.calculateTemplatePoint(modelPoint,library.getHigh(),library.getWidth(),library.getUrl());
}
// 组装入参
DesignPythonObjects objects =pythonService.covertDesignSingleParam(
designSingleIncludeLayersDTO,design.getSingleOverall(),design.getSwitchCategory(),designLibraryModelPointVO);
JSONObject jsonObject = pythonService.designNew(objects);
// preview -> 不存数据库 submit -> 存数据库
List<TDesignPythonOutfitDetail> tDesignPythonOutfitDetails;
JSONObject data = jsonObject.getJSONObject("data");
// todo 空指针
if (data == null) {
throw new BusinessException("python response data is null");
}
JSONObject outfit = data.getJSONObject("0");
if (!designSingleIncludeLayersDTO.getIsPreview()){
// 更新及保存图层信息
@@ -409,8 +414,6 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
detailsVO.add(designPythonOutfitDetailService.convertToDesignPythonOutfitVO(detail));
});
TDesignPythonOutfit designPythonOutfit = designPythonOutfitService.getByDesignItemId(designSingleIncludeLayersDTO.getDesignItemId());
// todo designPythonOutFit 空指针
return assembleDesignSingleResponse(designItem.getId(),minioUtil.splitThenGetPreviewUrl(designPythonOutfit.getDesignUrl(),480),
designSingleIncludeLayersDTO.getDesignSingleItemDTOList(),detailsVO);
}

View File

@@ -808,7 +808,6 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
List<DesignItemDetail> filterDetail = designItemDetails.stream()
.filter(f -> OUTWEAR_DRESS_BLOUSE.contains(f.getType()) || SKIRT_TROUSERS.contains(f.getType()))
.collect(Collectors.toList());
// todo 填充图层需要筛选已经被删除的图层
response.setClothes(CopyUtil.copyList(filterDetail,DesignItemClothesDetailVO.class,(o,d)->{
d.setId(o.getBusinessId());
d.setLevel1Type(converTypeToLevel1(o.getType()));