From dcd4ce584c369b775b01de2978066a5248a071fc Mon Sep 17 00:00:00 2001 From: xupei <1779019091@qq.com> Date: Thu, 21 Sep 2023 13:44:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=B0=E8=8A=B1=E5=9D=90=E6=A0=87=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ai/da/model/vo/DesignItemClothesDetailVO.java | 3 +++ src/main/java/com/ai/da/python/PythonService.java | 9 ++++----- .../com/ai/da/service/impl/DesignItemServiceImpl.java | 11 +++++++---- .../com/ai/da/service/impl/DesignServiceImpl.java | 1 - 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/ai/da/model/vo/DesignItemClothesDetailVO.java b/src/main/java/com/ai/da/model/vo/DesignItemClothesDetailVO.java index dbf978a6..77debdd3 100644 --- a/src/main/java/com/ai/da/model/vo/DesignItemClothesDetailVO.java +++ b/src/main/java/com/ai/da/model/vo/DesignItemClothesDetailVO.java @@ -11,6 +11,9 @@ import java.util.List; @ApiModel("designItem detail clothes 响应") public class DesignItemClothesDetailVO { + /** + * designItemDetail对应的businessId + */ @ApiModelProperty("对应的上游id") private Long id; diff --git a/src/main/java/com/ai/da/python/PythonService.java b/src/main/java/com/ai/da/python/PythonService.java index 197eeeda..b78d278c 100644 --- a/src/main/java/com/ai/da/python/PythonService.java +++ b/src/main/java/com/ai/da/python/PythonService.java @@ -1390,11 +1390,10 @@ public class PythonService { List angle = new ArrayList<>(printObject.getPrints().size()); // 设置印花的位置、大小、旋转角度 - // todo 空指针 List 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 setGenerateImageList(JSONObject jsonObject){ List 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; diff --git a/src/main/java/com/ai/da/service/impl/DesignItemServiceImpl.java b/src/main/java/com/ai/da/service/impl/DesignItemServiceImpl.java index cae9f2e3..f8584d1e 100644 --- a/src/main/java/com/ai/da/service/impl/DesignItemServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/DesignItemServiceImpl.java @@ -316,7 +316,7 @@ public class DesignItemServiceImpl extends ServiceImpl 不存数据库 submit -> 存数据库 List 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 impleme List 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()));