TASK: 全局异常优化;
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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())) {
|
||||
|
||||
@@ -301,7 +301,8 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
DesignPythonObjects pythonObjects = pythonService.covertDesignParam(designDTO.getSystemScale(),
|
||||
designDTO.getSingleOverall(), designDTO.getSwitchCategory(), elementVO, designDTO.getProcessId());
|
||||
// pythonObjects增加image_id关联
|
||||
relationImageId(pythonObjects);
|
||||
List<Long> imageIds = relationImageIds(pythonObjects);
|
||||
System.out.println(imageIds);
|
||||
//design
|
||||
JSONObject responseJSONObject = pythonService.designNew(pythonObjects);
|
||||
//生成library
|
||||
@@ -341,6 +342,36 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
);
|
||||
}
|
||||
|
||||
public List<Long> relationImageIds(DesignPythonObjects pythonObjects) {
|
||||
List<Long> imageIds = new ArrayList<>();
|
||||
if (Objects.isNull(pythonObjects)) {
|
||||
return imageIds;
|
||||
}
|
||||
pythonObjects.getObjects().forEach(
|
||||
o -> {
|
||||
for (DesignPythonItem item : o.getItems()) {
|
||||
List<Long> 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<Long> elementIds) {
|
||||
if (CollectionUtils.isEmpty(elementIds) || collectionId == null) {
|
||||
return;
|
||||
@@ -594,7 +625,6 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public DesignCollectionVO reDesignCollection(ReDesignCollectionDTO reDesignDTO) {
|
||||
//校验collection
|
||||
Collection collection = collectionService.getById(reDesignDTO.getCollectionId());
|
||||
|
||||
Reference in New Issue
Block a user