From 68d28995b83d61466de47d52032f6f5c7bf916b1 Mon Sep 17 00:00:00 2001 From: shahaibo <1023316923@qq.com> Date: Fri, 27 Oct 2023 17:02:04 +0800 Subject: [PATCH] =?UTF-8?q?TASK:=20=E5=85=A8=E5=B1=80=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E4=BC=98=E5=8C=96;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ai/da/model/dto/AccountAddDTO.java | 8 ++--- .../com/ai/da/model/dto/ChatFlushDTO.java | 4 +-- .../ai/da/model/dto/CollectionColorDTO.java | 2 +- .../java/com/ai/da/python/PythonService.java | 4 +-- .../ai/da/service/impl/DesignServiceImpl.java | 34 +++++++++++++++++-- 5 files changed, 41 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/ai/da/model/dto/AccountAddDTO.java b/src/main/java/com/ai/da/model/dto/AccountAddDTO.java index d81ec689..82f08e87 100644 --- a/src/main/java/com/ai/da/model/dto/AccountAddDTO.java +++ b/src/main/java/com/ai/da/model/dto/AccountAddDTO.java @@ -11,19 +11,19 @@ import javax.validation.constraints.NotNull; @ApiModel("AccountAdd") public class AccountAddDTO { - @NotBlank(message = "email cannot be empty!") + @NotBlank(message = "email.cannot.be.empty") @ApiModelProperty("email") private String email; - @NotBlank(message = "userName cannot be empty!") + @NotBlank(message = "userName.cannot.be.empty") @ApiModelProperty("userName") private String userName; - @NotBlank(message = "validStartTime cannot be empty!") + @NotBlank(message = "validStartTime.cannot.be.empty") @ApiModelProperty("Start time of account validity ") private String validStartTime; - @NotBlank(message = "validEndTime cannot be empty!") + @NotBlank(message = "validEndTime.cannot.be.empty") @ApiModelProperty("End time of account validity ") private String validEndTime; diff --git a/src/main/java/com/ai/da/model/dto/ChatFlushDTO.java b/src/main/java/com/ai/da/model/dto/ChatFlushDTO.java index 8f331480..c3ac9679 100644 --- a/src/main/java/com/ai/da/model/dto/ChatFlushDTO.java +++ b/src/main/java/com/ai/da/model/dto/ChatFlushDTO.java @@ -16,11 +16,11 @@ import javax.validation.constraints.NotNull; @Data public class ChatFlushDTO { - @NotNull(message = "userId cannot be empty!") + @NotNull(message = "user_id.cannot.be.empty") @ApiModelProperty("用户id") private String user_id; - @NotBlank(message = "sessionId cannot be empty!") + @NotBlank(message = "session_id.cannot.be.empty") @ApiModelProperty("会话ID") private String session_id; diff --git a/src/main/java/com/ai/da/model/dto/CollectionColorDTO.java b/src/main/java/com/ai/da/model/dto/CollectionColorDTO.java index 4ac1794a..f569182f 100644 --- a/src/main/java/com/ai/da/model/dto/CollectionColorDTO.java +++ b/src/main/java/com/ai/da/model/dto/CollectionColorDTO.java @@ -21,7 +21,7 @@ public class CollectionColorDTO { @ApiModelProperty("tcx值") private String tcx; - @NotBlank(message = "rgb value cannot be empty") + @NotBlank(message = "rgbValue.cannot.be.empty") @ApiModelProperty("潘通RGB值") private String rgbValue; diff --git a/src/main/java/com/ai/da/python/PythonService.java b/src/main/java/com/ai/da/python/PythonService.java index 7ed2ebd3..00b195a4 100644 --- a/src/main/java/com/ai/da/python/PythonService.java +++ b/src/main/java/com/ai/da/python/PythonService.java @@ -1924,7 +1924,7 @@ public class PythonService { public JSONObject designNew(DesignPythonObjects designPythonObjects) { // todo 限流校验 - AccessLimitUtils.validate("design",5); +// AccessLimitUtils.validate("design",5); OkHttpClient client = new OkHttpClient().newBuilder() .connectTimeout(30, TimeUnit.SECONDS) .pingInterval(5, TimeUnit.SECONDS)//websocket轮训间隔(单位:秒) @@ -1953,7 +1953,7 @@ public class PythonService { throw new BusinessException("design.interface.exception"); } //去除限流 - AccessLimitUtils.validateOut("design"); +// AccessLimitUtils.validateOut("design"); if (response.isSuccessful()) { try { if (Objects.nonNull(response.body())) { diff --git a/src/main/java/com/ai/da/service/impl/DesignServiceImpl.java b/src/main/java/com/ai/da/service/impl/DesignServiceImpl.java index 83943419..22f5ebb8 100644 --- a/src/main/java/com/ai/da/service/impl/DesignServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/DesignServiceImpl.java @@ -301,7 +301,8 @@ public class DesignServiceImpl extends ServiceImpl impleme DesignPythonObjects pythonObjects = pythonService.covertDesignParam(designDTO.getSystemScale(), designDTO.getSingleOverall(), designDTO.getSwitchCategory(), elementVO, designDTO.getProcessId()); // pythonObjects增加image_id关联 - relationImageId(pythonObjects); + List imageIds = relationImageIds(pythonObjects); + System.out.println(imageIds); //design JSONObject responseJSONObject = pythonService.designNew(pythonObjects); //生成library @@ -341,6 +342,36 @@ public class DesignServiceImpl extends ServiceImpl impleme ); } + public List relationImageIds(DesignPythonObjects pythonObjects) { + List imageIds = new ArrayList<>(); + if (Objects.isNull(pythonObjects)) { + return imageIds; + } + pythonObjects.getObjects().forEach( + o -> { + for (DesignPythonItem item : o.getItems()) { + List list = new ArrayList<>(); + list.add(1L); + list.add(1L); + item.setOffset(list); + item.setResize_scale(1f); + String path = item.getPath(); + if (StringUtils.isEmpty(path)) { + String bodyPath = item.getBody_path(); + Long imageId = pythonTAllInfoService.getImageIdByPath(bodyPath); + imageIds.add(imageId); + item.setImage_id(imageId); + } else { + Long imageId = pythonTAllInfoService.getImageIdByPath(path); + imageIds.add(imageId); + item.setImage_id(imageId); + } + } + } + ); + return imageIds; + } + private void handleCollectionElementRelation(Long collectionId, Boolean isEdit, List elementIds) { if (CollectionUtils.isEmpty(elementIds) || collectionId == null) { return; @@ -594,7 +625,6 @@ public class DesignServiceImpl extends ServiceImpl impleme } @Override - @Transactional public DesignCollectionVO reDesignCollection(ReDesignCollectionDTO reDesignDTO) { //校验collection Collection collection = collectionService.getById(reDesignDTO.getCollectionId());