TASK: 全局异常优化;
This commit is contained in:
@@ -27,7 +27,7 @@ public class AccessLimitUtils {
|
||||
Integer useCount = LocalCacheUtils.getAidaInterfaceCurrentLimitingCache(interfaceName);
|
||||
if (useCount > count) {
|
||||
//系统繁忙
|
||||
throw new BusinessException("system busy !");
|
||||
throw new BusinessException("system.busy");
|
||||
} else {
|
||||
useCount++;
|
||||
LocalCacheUtils.setAidaInterfaceCurrentLimitingCache(interfaceName, useCount);
|
||||
|
||||
@@ -175,7 +175,7 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
|
||||
return url.openStream();
|
||||
} catch (IOException ioException) {
|
||||
log.error("获取文件尺寸异常###{}###path##{}", ExceptionUtil.stacktraceToString(ioException), path);
|
||||
throw new BusinessException("get file is failed!");
|
||||
throw new BusinessException("get.file.failed");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -236,7 +236,7 @@ public class MinioUtil {
|
||||
|
||||
public InputStream download(String path) throws MinioException, IOException {
|
||||
if (!path.contains("/")) {
|
||||
throw new BusinessException("The path is error!");
|
||||
throw new BusinessException("the.path.is.error");
|
||||
}
|
||||
int index = path.indexOf("/");
|
||||
String bucketName = path.substring(0, index);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.ai.da.controller;
|
||||
|
||||
import com.ai.da.common.config.exception.BusinessException;
|
||||
import com.ai.da.common.response.Response;
|
||||
import com.ai.da.common.utils.FileUtil;
|
||||
import com.ai.da.common.utils.MD5Utils;
|
||||
@@ -53,7 +54,9 @@ public class ElementController {
|
||||
@RequestParam(value = "level1Type") String level1Type,
|
||||
@ApiParam("本地时区,比如 'Asia/Tokyo' 东京时间 , 'Asia/Shanghai' 北京时间 由js本地获取")
|
||||
@RequestParam(value = "timeZone") String timeZone) {
|
||||
Assert.isTrue(!StringUtils.isEmpty(file.getOriginalFilename()), "Please select a file!");
|
||||
if (null == file || StringUtils.isEmpty(file.getOriginalFilename())) {
|
||||
throw new BusinessException("file.cannot.be.empty");
|
||||
}
|
||||
return Response.success(collectionElementService.upload(
|
||||
new CollectionElementUploadDTO(file, level1Type, timeZone, MD5Utils.encryptFile(file))));
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@@ -78,15 +79,17 @@ public class LibraryController {
|
||||
@RequestParam(value = "modelType") String modelType,
|
||||
@RequestParam(value = "sex") String sex,
|
||||
@RequestParam(value = "checkMd5") Integer checkMd5) {
|
||||
Assert.isTrue(!StringUtils.isEmpty(file.getOriginalFilename()), "Please select a file!");
|
||||
if (null == file || StringUtils.isEmpty(file.getOriginalFilename())) {
|
||||
throw new BusinessException("file.cannot.be.empty");
|
||||
}
|
||||
Integer high = null;
|
||||
Integer width = null;
|
||||
if (level1Type.equals(LibraryLevel1TypeEnum.MODELS.getRealName())) {
|
||||
if (StringUtils.isEmpty(modelType)) {
|
||||
throw new BusinessException("modelType can't be null");
|
||||
throw new BusinessException("modelType.cannot.be.empty");
|
||||
}
|
||||
if (modelType.equals(ModelType.SYSTEM.getValue()) && StringUtils.isEmpty(sex)) {
|
||||
throw new BusinessException("sex can't be null");
|
||||
throw new BusinessException("modelSex.cannot.be.empty");
|
||||
}
|
||||
FileVO fileVO = FileUtil.getFileSize(file);
|
||||
high = fileVO.getHigh();
|
||||
@@ -121,7 +124,9 @@ public class LibraryController {
|
||||
@PostMapping("/batchDeleteLibrary")
|
||||
public Response<Boolean> batchDeleteLibrary(@Valid @RequestBody LibraryDeleteDTO deleteDTO) {
|
||||
List<Library> librarys = libraryService.getByIds(deleteDTO.getLibraryIds());
|
||||
Assert.notEmpty(librarys, "librarys does not exist!");
|
||||
if (CollectionUtils.isEmpty(librarys)) {
|
||||
throw new BusinessException("librarys.not.found");
|
||||
}
|
||||
libraryService.removeBatchByIds(deleteDTO.getLibraryIds());
|
||||
for (Library library : librarys) {
|
||||
if (library.getUrl().startsWith(sysImage)) {
|
||||
@@ -138,7 +143,9 @@ public class LibraryController {
|
||||
public Response<String> modelsDot(@ApiParam("file") @RequestPart(value = "file", required = false) MultipartFile file,
|
||||
@ApiParam("models对象") @RequestPart("models") ModelsDotDTO modelsDotDTO) {
|
||||
if (Objects.nonNull(file)) {
|
||||
Assert.isTrue(!StringUtils.isEmpty(file.getOriginalFilename()), "Please select a file!");
|
||||
if (StringUtils.isEmpty(file.getOriginalFilename())) {
|
||||
throw new BusinessException("file.cannot.be.empty");
|
||||
}
|
||||
AuthPrincipalVo userInfo = UserContext.getUserHolder();
|
||||
//需要宽高和地址参数design
|
||||
FileVO fileVO = FileUtil.getFileSize(file);
|
||||
@@ -150,12 +157,20 @@ public class LibraryController {
|
||||
String minioPath = libraryService.processMannequins(uploadPath);
|
||||
modelsDotDTO.setTemplateUrl(minioPath);
|
||||
} else {
|
||||
Assert.notNull(modelsDotDTO.getLibraryId(), "libraryId cannot be empty!");
|
||||
Assert.notNull(modelsDotDTO.getTemplateId(), "templateId cannot be empty!");
|
||||
if (null == modelsDotDTO.getLibraryId()) {
|
||||
throw new BusinessException("libraryId.cannot.be.empty");
|
||||
}
|
||||
if (null == modelsDotDTO.getTemplateId()) {
|
||||
throw new BusinessException("templateId.cannot.be.empty");
|
||||
}
|
||||
LibraryModelPoint modelPoint = libraryModelPointService.getById(modelsDotDTO.getTemplateId());
|
||||
Assert.notNull(modelPoint, "template does not exist!");
|
||||
if (Objects.isNull(modelPoint)) {
|
||||
throw new BusinessException("modelPoint.not.found");
|
||||
}
|
||||
Library library = libraryService.getById(modelsDotDTO.getLibraryId());
|
||||
Assert.notNull(library, "library does not exist!");
|
||||
if (Objects.isNull(library)) {
|
||||
throw new BusinessException("library.not.found");
|
||||
}
|
||||
modelsDotDTO.setHigh(library.getHigh());
|
||||
modelsDotDTO.setWidth(library.getWidth());
|
||||
modelsDotDTO.setTemplateUrl(library.getUrl());
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.ai.da.controller;
|
||||
|
||||
import com.ai.da.common.config.exception.BusinessException;
|
||||
import com.ai.da.common.context.UserContext;
|
||||
import com.ai.da.common.response.PageBaseResponse;
|
||||
import com.ai.da.common.response.PageResponse;
|
||||
@@ -75,7 +76,9 @@ public class SavedCollectionController {
|
||||
}
|
||||
List<Long> groupIds = page.getRecords().stream().map(UserLikeGroup::getId).collect(Collectors.toList());
|
||||
List<UserLikeVO> groupDetails = userLikeService.getGroupDetails(groupIds);
|
||||
Assert.notEmpty(groupDetails, "History detail does not exist!");
|
||||
if (CollectionUtils.isEmpty(groupDetails)) {
|
||||
throw new BusinessException("groupDetails.not.found");
|
||||
}
|
||||
Map<Long, List<UserLikeVO>> groupDetailMap = groupDetails.stream()
|
||||
.collect(Collectors.groupingBy(UserLikeVO::getUserLikeGroupId));
|
||||
|
||||
|
||||
@@ -19,15 +19,15 @@ import javax.validation.constraints.NotNull;
|
||||
@ApiModel("chatRobot 对话")
|
||||
public class ChatSendDTO {
|
||||
|
||||
@NotNull(message = "userId cannot be empty!")
|
||||
@NotNull(message = "userId.cannot.be.empty")
|
||||
@ApiModelProperty("用户id")
|
||||
private Long user_id;
|
||||
|
||||
@NotBlank(message = "sessionId cannot be empty!")
|
||||
@NotBlank(message = "sessionId.cannot.be.empty")
|
||||
@ApiModelProperty("会话ID")
|
||||
private String session_id;
|
||||
|
||||
@NotBlank(message = "Please input the message !")
|
||||
@NotBlank(message = "message.cannot.be.empty")
|
||||
@ApiModelProperty("消息")
|
||||
private String message;
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.util.Date;
|
||||
@AllArgsConstructor
|
||||
public class CollectionElementUploadDTO {
|
||||
|
||||
@NotNull(message = "文件不能为空!")
|
||||
@NotNull(message = "file.cannot.be.empty")
|
||||
private MultipartFile file;
|
||||
|
||||
@ApiModelProperty("一级类型")
|
||||
|
||||
@@ -11,15 +11,15 @@ import javax.validation.constraints.NotNull;
|
||||
@ApiModel("生成印花")
|
||||
public class CollectionGeneratePrintDTO {
|
||||
|
||||
@NotNull(message = "file select2Id cannot be empty!")
|
||||
@NotNull(message = "select1Id.cannot.be.empty")
|
||||
@ApiModelProperty("选择的第一个print文件id")
|
||||
private Long select1Id;
|
||||
|
||||
@NotNull(message = "file select2Id cannot be empty!")
|
||||
@NotNull(message = "select2Id.cannot.be.empty")
|
||||
@ApiModelProperty("选择的第一个print文件id")
|
||||
private Long select2Id;
|
||||
|
||||
@NotBlank(message = "timeZone cannot be empty!")
|
||||
@NotBlank(message = "timeZone.cannot.be.empty")
|
||||
@ApiModelProperty("本地时区,比如 'Asia/Tokyo' 东京时间 , 'Asia/Shanghai' 北京时间 由js本地获取")
|
||||
private String timeZone;
|
||||
}
|
||||
|
||||
@@ -15,10 +15,10 @@ public class CollectionSavePrintDTO {
|
||||
|
||||
@ApiModelProperty("生成的印花绝对路径")
|
||||
@Size(max = 15, message = "Save up to 15 prints at a time!")
|
||||
@NotEmpty(message = "printId cannot be empty!")
|
||||
@NotEmpty(message = "printId.cannot.be.empty")
|
||||
private List<String> printId;
|
||||
|
||||
@NotBlank(message = "timeZone cannot be empty!")
|
||||
@NotBlank(message = "timeZone.cannot.be.empty")
|
||||
@ApiModelProperty("本地时区,比如 'Asia/Tokyo' 东京时间 , 'Asia/Shanghai' 北京时间 由js本地获取")
|
||||
private String timeZone;
|
||||
|
||||
|
||||
@@ -14,15 +14,15 @@ public class CollectionSketchDTO {
|
||||
@ApiModelProperty("sketchBoardId 元素id")
|
||||
private Long sketchBoardId;
|
||||
|
||||
@NotNull(message = "isPin cannot be empty")
|
||||
@NotNull(message = "isPin.cannot.be.empty")
|
||||
@ApiModelProperty("是否pin 1 pin 0 不pin")
|
||||
private Byte isPin;
|
||||
|
||||
@NotBlank(message = "level2Type cannot be empty")
|
||||
@NotBlank(message = "level2Type.cannot.be.empty")
|
||||
@ApiModelProperty("二级类型 Outwear Dress Blouse Skirt Trousers")
|
||||
private String level2Type;
|
||||
|
||||
@NotBlank(message = "designType cannot be empty")
|
||||
@NotBlank(message = "designType.cannot.be.empty")
|
||||
@ApiModelProperty("design类型 用户design生成时候区别library和collection")
|
||||
private String designType;
|
||||
|
||||
|
||||
@@ -12,14 +12,14 @@ import java.util.List;
|
||||
public class DesignSingleDTO {
|
||||
|
||||
@ApiModelProperty("designItemId")
|
||||
@NotNull(message = "designItemId cannot be empty!")
|
||||
@NotNull(message = "designItemId.cannot.be.empty")
|
||||
private Long designItemId;
|
||||
|
||||
@ApiModelProperty("priority 数组,列表中包含服饰的顺序,越右边的表示越外层的衣服 例如[\"Outwear\", \"Dress\"]表示outwear在dress里面")
|
||||
@NotEmpty(message = "priority cannot be empty!")
|
||||
@NotEmpty(message = "priority.cannot.be.empty")
|
||||
private List<String> priority;
|
||||
|
||||
@NotEmpty(message = "clothes cannot be empty!")
|
||||
@NotEmpty(message = "clothes.cannot.be.empty")
|
||||
@ApiModelProperty("clothes 元素")
|
||||
private List<DesignSingleItemDTO> clothes;
|
||||
|
||||
@@ -31,7 +31,7 @@ public class DesignSingleDTO {
|
||||
@ApiModelProperty("preview -> true submit -> false")
|
||||
private Boolean isPreview;
|
||||
|
||||
@NotBlank(message = "timeZone cannot be empty!")
|
||||
@NotBlank(message = "timeZone.cannot.be.empty")
|
||||
@ApiModelProperty("本地时区,比如 'Asia/Tokyo' 东京时间 , 'Asia/Shanghai' 北京时间 由js本地获取")
|
||||
private String timeZone;
|
||||
|
||||
|
||||
@@ -11,20 +11,20 @@ import java.util.List;
|
||||
public class DesignSingleIncludeLayersDTO {
|
||||
|
||||
@ApiModelProperty("designItemId")
|
||||
@NotNull(message = "designItemId cannot be empty!")
|
||||
@NotNull(message = "designItemId.cannot.be.empty")
|
||||
private Long designItemId;
|
||||
|
||||
private List<DesignSingleItemDTO> designSingleItemDTOList;
|
||||
|
||||
@NotNull(message = "isPreview cannot be null")
|
||||
@NotNull(message = "isPreview.cannot.be.empty")
|
||||
@ApiModelProperty("preview -> true submit -> false")
|
||||
private Boolean isPreview;
|
||||
|
||||
@NotNull(message = "processId cannot be null")
|
||||
@NotNull(message = "processId.cannot.be.empty")
|
||||
@ApiModelProperty("进度")
|
||||
private String processId;
|
||||
|
||||
@NotBlank(message = "timeZone cannot be empty!")
|
||||
@NotBlank(message = "timeZone.cannot.be.empty")
|
||||
@ApiModelProperty("本地时区,比如 'Asia/Tokyo' 东京时间 , 'Asia/Shanghai' 北京时间 由js本地获取")
|
||||
private String timeZone;
|
||||
}
|
||||
|
||||
@@ -9,18 +9,18 @@ import java.util.List;
|
||||
@Data
|
||||
public class DesignSingleItemDTO {
|
||||
|
||||
@NotBlank(message = "id cannot be empty!")
|
||||
@NotBlank(message = "id.cannot.be.empty")
|
||||
@ApiModelProperty("切换图片对应的id")
|
||||
private Long id;
|
||||
|
||||
@NotBlank(message = "type cannot be empty!")
|
||||
@NotBlank(message = "type.cannot.be.empty")
|
||||
@ApiModelProperty("生成item实际对应的类型 有:outwear,dress,blouse,skirt,trousers Shoes Hairstyle Earring")
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty("对应的图片的minIO路径")
|
||||
private String path;
|
||||
|
||||
@NotBlank(message = "color cannot be empty!")
|
||||
@NotBlank(message = "color.cannot.be.empty")
|
||||
@ApiModelProperty("颜色 存 RGB值 中间空格分隔 比如 \"58 58 169\"")
|
||||
private String color;
|
||||
|
||||
|
||||
@@ -11,11 +11,11 @@ import javax.validation.constraints.NotNull;
|
||||
@ApiModel("生成高级design 入参")
|
||||
public class GenerateHighDesignDTO {
|
||||
|
||||
@NotNull(message = "designItem id cannot be empty!")
|
||||
@NotNull(message = "designItemId.cannot.be.empty")
|
||||
@ApiModelProperty("design的designItemId")
|
||||
private Long designItemId;
|
||||
|
||||
@NotBlank(message = "timeZone cannot be empty!")
|
||||
@NotBlank(message = "timeZone.cannot.be.empty")
|
||||
@ApiModelProperty("本地时区,比如 'Asia/Tokyo' 东京时间 , 'Asia/Shanghai' 北京时间 由js本地获取")
|
||||
private String timeZone;
|
||||
}
|
||||
|
||||
@@ -11,18 +11,18 @@ import javax.validation.constraints.NotNull;
|
||||
@ApiModel("Generate like入参")
|
||||
public class GenerateLikeDTO {
|
||||
|
||||
@NotNull(message = "generateDetail id cannot be empty!")
|
||||
@NotNull(message = "generateDetailId.cannot.be.empty")
|
||||
@ApiModelProperty("generateDetailId")
|
||||
private Long generateDetailId;
|
||||
|
||||
@NotBlank(message = "level1Type cannot be empty!")
|
||||
@NotBlank(message = "level1Type.cannot.be.empty")
|
||||
@ApiModelProperty("一级类型 Sketchboard Printboard")
|
||||
private String level1Type;
|
||||
|
||||
@ApiModelProperty("当一级类型为Sketchboard时,二级类型 Outwear Dress Blouse Skirt Trousers")
|
||||
private String level2Type;
|
||||
|
||||
@NotBlank(message = "timeZone cannot be empty!")
|
||||
@NotBlank(message = "timeZone.cannot.be.empty")
|
||||
@ApiModelProperty("本地时区,比如 'Asia/Tokyo' 东京时间 , 'Asia/Shanghai' 北京时间 由js本地获取")
|
||||
private String timeZone;
|
||||
}
|
||||
|
||||
@@ -9,13 +9,13 @@ import javax.validation.constraints.NotNull;
|
||||
@Data
|
||||
@ApiModel("根据rgb数组批量获取潘通rgb")
|
||||
public class GetRgbByHsvBatchDTO {
|
||||
@NotNull(message = "r cannot be empty!")
|
||||
@NotNull(message = "h.cannot.be.empty")
|
||||
@ApiModelProperty("h值")
|
||||
private Integer h;
|
||||
@NotNull(message = "g cannot be empty!")
|
||||
@NotNull(message = "s.cannot.be.empty")
|
||||
@ApiModelProperty("s值")
|
||||
private Integer s;
|
||||
@NotNull(message = "b cannot be empty!")
|
||||
@NotNull(message = "v.cannot.be.empty")
|
||||
@ApiModelProperty("v值")
|
||||
private Integer v;
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import javax.validation.constraints.NotNull;
|
||||
@ApiModel("History删除")
|
||||
public class HistoryDeleteDTO {
|
||||
|
||||
@NotNull(message = "userGroupId cannot be empty!")
|
||||
@NotNull(message = "userGroupId.cannot.be.empty")
|
||||
@ApiModelProperty("history 分组id")
|
||||
private Long userGroupId;
|
||||
|
||||
|
||||
@@ -13,15 +13,15 @@ import javax.validation.constraints.NotNull;
|
||||
@ApiModel("History编辑")
|
||||
public class HistoryUpdateDTO {
|
||||
|
||||
@NotNull(message = "userGroupId cannot be empty!")
|
||||
@NotNull(message = "userGroupId.cannot.be.empty")
|
||||
@ApiModelProperty("history 分组id")
|
||||
private Long userGroupId;
|
||||
|
||||
@NotBlank(message = "userGroupName cannot be empty!")
|
||||
@NotBlank(message = "userGroupName.cannot.be.empty")
|
||||
@ApiModelProperty("history 分组名称")
|
||||
private String userGroupName;
|
||||
|
||||
@NotBlank(message = "timeZone cannot be empty!")
|
||||
@NotBlank(message = "timeZone.cannot.be.empty")
|
||||
@ApiModelProperty("本地时区,比如 'Asia/Tokyo' 东京时间 , 'Asia/Shanghai' 北京时间 由js本地获取")
|
||||
private String timeZone;
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ public class LibraryModelPointDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@NotNull(message = "libraryId cannot be empty!")
|
||||
@NotNull(message = "libraryId.cannot.be.empty")
|
||||
@ApiModelProperty("libraryId")
|
||||
private Long libraryId;
|
||||
|
||||
@@ -32,31 +32,31 @@ public class LibraryModelPointDTO implements Serializable {
|
||||
@ApiModelProperty("templateId")
|
||||
private Long templateId;
|
||||
|
||||
@NotEmpty(message = "shoulderLeft cannot be empty!")
|
||||
@NotEmpty(message = "shoulderLeft.cannot.be.empty")
|
||||
@ApiModelProperty("左肩 数组传类似 [0.2, 0.2]")
|
||||
private List<BigDecimal> shoulderLeft;
|
||||
|
||||
@NotEmpty(message = "shoulderRight cannot be empty!")
|
||||
@NotEmpty(message = "shoulderRight.cannot.be.empty")
|
||||
@ApiModelProperty("右肩 数组传类似 [0.2, 0.2]")
|
||||
private List<BigDecimal> shoulderRight;
|
||||
|
||||
@NotEmpty(message = "waistbandLeft cannot be empty!")
|
||||
@NotEmpty(message = "waistbandLeft.cannot.be.empty")
|
||||
@ApiModelProperty("左腰 数组传类似 [0.2, 0.2]")
|
||||
private List<BigDecimal> waistbandLeft;
|
||||
|
||||
@NotEmpty(message = "waistbandRight cannot be empty!")
|
||||
@NotEmpty(message = "waistbandRight.cannot.be.empty")
|
||||
@ApiModelProperty("右腰 数组传类似 [0.2, 0.2]")
|
||||
private List<BigDecimal> waistbandRight;
|
||||
|
||||
@NotEmpty(message = "handLeft cannot be empty!")
|
||||
@NotEmpty(message = "handLeft.cannot.be.empty")
|
||||
@ApiModelProperty("左手 数组传类似 [0.2, 0.2]")
|
||||
private List<BigDecimal> handLeft;
|
||||
|
||||
@NotEmpty(message = "handRight cannot be empty!")
|
||||
@NotEmpty(message = "handRight.cannot.be.empty")
|
||||
@ApiModelProperty("右手 数组传类似 [0.2, 0.2]")
|
||||
private List<BigDecimal> handRight;
|
||||
|
||||
@NotBlank(message = "timeZone cannot be empty!")
|
||||
@NotBlank(message = "timeZone.cannot.be.empty")
|
||||
@ApiModelProperty("本地时区,比如 'Asia/Tokyo' 东京时间 , 'Asia/Shanghai' 北京时间 由js本地获取")
|
||||
private String timeZone;
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import javax.validation.constraints.NotNull;
|
||||
@AllArgsConstructor
|
||||
public class LibraryUploadDTO {
|
||||
|
||||
@NotNull(message = "文件不能为空!")
|
||||
@NotNull(message = "file.cannot.be.empty")
|
||||
private MultipartFile file;
|
||||
|
||||
@ApiModelProperty("一级类型")
|
||||
|
||||
@@ -30,31 +30,31 @@ public class ModelsDotDTO implements Serializable {
|
||||
@ApiModelProperty("templateId 编辑时预览用")
|
||||
private Long templateId;
|
||||
|
||||
@NotEmpty(message = "shoulderLeft cannot be empty!")
|
||||
@NotEmpty(message = "shoulderLeft.cannot.be.empty")
|
||||
@ApiModelProperty("左肩 数组传类似 [0.2, 0.2]")
|
||||
private List<BigDecimal> shoulderLeft;
|
||||
|
||||
@NotEmpty(message = "shoulderRight cannot be empty!")
|
||||
@NotEmpty(message = "shoulderRight.cannot.be.empty")
|
||||
@ApiModelProperty("右肩 数组传类似 [0.2, 0.2]")
|
||||
private List<BigDecimal> shoulderRight;
|
||||
|
||||
@NotEmpty(message = "waistbandLeft cannot be empty!")
|
||||
@NotEmpty(message = "waistbandLeft.cannot.be.empty")
|
||||
@ApiModelProperty("左腰 数组传类似 [0.2, 0.2]")
|
||||
private List<BigDecimal> waistbandLeft;
|
||||
|
||||
@NotEmpty(message = "waistbandRight cannot be empty!")
|
||||
@NotEmpty(message = "waistbandRight.cannot.be.empty")
|
||||
@ApiModelProperty("右腰 数组传类似 [0.2, 0.2]")
|
||||
private List<BigDecimal> waistbandRight;
|
||||
|
||||
@NotEmpty(message = "handLeft cannot be empty!")
|
||||
@NotEmpty(message = "handLeft.cannot.be.empty")
|
||||
@ApiModelProperty("左手 数组传类似 [0.2, 0.2]")
|
||||
private List<BigDecimal> handLeft;
|
||||
|
||||
@NotEmpty(message = "handRight cannot be empty!")
|
||||
@NotEmpty(message = "handRight.cannot.be.empty")
|
||||
@ApiModelProperty("右手 数组传类似 [0.2, 0.2]")
|
||||
private List<BigDecimal> handRight;
|
||||
|
||||
@NotBlank(message = "timeZone cannot be empty!")
|
||||
@NotBlank(message = "timeZone.cannot.be.empty")
|
||||
@ApiModelProperty("本地时区,比如 'Asia/Tokyo' 东京时间 , 'Asia/Shanghai' 北京时间 由js本地获取")
|
||||
private String timeZone;
|
||||
/**
|
||||
|
||||
@@ -10,15 +10,15 @@ import javax.validation.constraints.NotBlank;
|
||||
@ApiModel("短信发送")
|
||||
public class NoteSendDTO {
|
||||
|
||||
@NotBlank(message = " 手机[区域/国家]号不能为空!")
|
||||
@NotBlank(message = "regionNum.cannot.be.empty")
|
||||
@ApiModelProperty("[区域/国家]号 示例如 852 香港 不支持中国")
|
||||
private String regionNum;
|
||||
|
||||
@NotBlank(message = "手机号不能为空!")
|
||||
@NotBlank(message = "phone.cannot.be.empty")
|
||||
@ApiModelProperty("手机号")
|
||||
private String phone;
|
||||
|
||||
@NotBlank(message = "操作类型不能为空!")
|
||||
@NotBlank(message = "operationType.cannot.be.empty")
|
||||
@ApiModelProperty("操作类型 LOGIN 登入 FORGET_PWD 忘记密码")
|
||||
private String operationType;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import javax.validation.constraints.NotBlank;
|
||||
@ApiModel("Library分页查询")
|
||||
public class QueryLibraryPageDTO extends PageQueryBaseVo {
|
||||
|
||||
@NotBlank(message = "level1Type cannot be empty!")
|
||||
@NotBlank(message = "level1Type.cannot.be.empty")
|
||||
@ApiModelProperty("一级类型")
|
||||
private String level1Type;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import javax.validation.constraints.NotBlank;
|
||||
@ApiModel("LibraryTop分页查询")
|
||||
public class QueryLibraryTopPageDTO extends PageQueryBaseVo {
|
||||
|
||||
@NotBlank(message = "type cannot be empty!")
|
||||
@NotBlank(message = "type.cannot.be.empty")
|
||||
@ApiModelProperty("类型 Top , Bottom ,Print ")
|
||||
private String type;
|
||||
|
||||
|
||||
@@ -89,13 +89,10 @@ public class PythonService {
|
||||
response = client.newCall(request).execute();
|
||||
} catch (IOException ioException) {
|
||||
log.error("PythonService##generatePrint异常###{}", ExceptionUtil.getThrowableList(ioException));
|
||||
throw new BusinessException("generate.interface.exception");
|
||||
}
|
||||
//去除限流
|
||||
AccessLimitUtils.validateOut("generatePrint");
|
||||
if (Objects.isNull(response)) {
|
||||
log.error("PythonService##generatePrint异常###{}", "response or body is empty!");
|
||||
throw new BusinessException("generate print exception!");
|
||||
}
|
||||
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(response));
|
||||
Boolean result = jsonObject.getBoolean("successful");
|
||||
if (result) {
|
||||
@@ -103,7 +100,7 @@ public class PythonService {
|
||||
}
|
||||
log.info("生成印花失败###{}", jsonObject);
|
||||
//生成失败
|
||||
throw new BusinessException("generate print exception!");
|
||||
throw new BusinessException("generate.interface.exception");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -84,8 +84,9 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
//用户信息
|
||||
AuthPrincipalVo userInfo = UserContext.getUserHolder();
|
||||
CollectionLevel1TypeEnum level1TypeEnum = CollectionLevel1TypeEnum.uploadOf(uploadDTO.getLevel1Type());
|
||||
Assert.notNull(level1TypeEnum, "unknown parameter level1Type!");
|
||||
|
||||
if (Objects.isNull(level1TypeEnum)) {
|
||||
throw new BusinessException("unknown.parameter.level1Type");
|
||||
}
|
||||
String objectName = userInfo.getId() + "/" + level1TypeEnum.getRealName();
|
||||
String path = minioUtil.upload(collectionElement, objectName, uploadDTO.getFile());
|
||||
|
||||
@@ -155,11 +156,14 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
@Override
|
||||
public void delete(Long id) {
|
||||
CollectionElement collectionElement = selectById(id);
|
||||
Assert.notNull(collectionElement, "file does not exist!");
|
||||
collectionElementMapper.deleteById(id);
|
||||
if (!FileUtil.delete(collectionElement.getUrl())) {
|
||||
throw new BusinessException("file deletion failed! ");
|
||||
if (Objects.isNull(collectionElement)) {
|
||||
throw new BusinessException("collectionElement.not.found");
|
||||
}
|
||||
minioUtil.deleteObject(collectionElement.getUrl());
|
||||
collectionElementMapper.deleteById(id);
|
||||
// if (!FileUtil.delete(collectionElement.getUrl())) {
|
||||
// throw new BusinessException("file deletion failed! ");
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -181,7 +185,9 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
CollectionElement element1 = selectById(generatePrintDTO.getSelect1Id());
|
||||
if (Objects.isNull(element1)) {
|
||||
Library library1 = libraryService.getById(generatePrintDTO.getSelect1Id());
|
||||
Assert.notNull(library1, "select1 file does not exist!");
|
||||
if (Objects.isNull(library1)) {
|
||||
throw new BusinessException("select1.file.does.not.exist");
|
||||
}
|
||||
url1 = library1.getUrl();
|
||||
} else {
|
||||
url1 = element1.getUrl();
|
||||
@@ -189,7 +195,9 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
CollectionElement element2 = selectById(generatePrintDTO.getSelect2Id());
|
||||
if (Objects.isNull(element2)) {
|
||||
Library library2 = libraryService.getById(generatePrintDTO.getSelect2Id());
|
||||
Assert.notNull(library2, "select2 file does not exist!");
|
||||
if (Objects.isNull(library2)) {
|
||||
throw new BusinessException("select2.file.does.not.exist");
|
||||
}
|
||||
url2 = library2.getUrl();
|
||||
} else {
|
||||
url2 = element2.getUrl();
|
||||
@@ -197,12 +205,14 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
List<String> printPath = Arrays.asList(url1, url2);
|
||||
//调取python 接口
|
||||
String generateUrl = pythonService.generatePrint(printPath);
|
||||
Assert.isTrue(!StringUtils.isEmpty(generateUrl), "generate print exception!");
|
||||
if (StringUtils.isEmpty(generateUrl)) {
|
||||
throw new BusinessException("generate.print.exception");
|
||||
}
|
||||
//用户信息
|
||||
AuthPrincipalVo userInfo = UserContext.getUserHolder();
|
||||
CollectionElement element = resolveData(generateUrl, generatePrintDTO.getTimeZone(), userInfo);
|
||||
if (!this.save(element)) {
|
||||
throw new BusinessException("generate print failed !");
|
||||
throw new BusinessException("generate.print.failed");
|
||||
}
|
||||
CollectionGeneratePrintVO collectionGeneratePrint = CopyUtil.copyObject(element, CollectionGeneratePrintVO.class);
|
||||
collectionGeneratePrint.setDesignType(DesignTypeEnum.COLLECTION.getRealName());
|
||||
@@ -213,7 +223,9 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
public Boolean savePrint(CollectionSavePrintDTO savePrintDTO) {
|
||||
//用户信息
|
||||
List<CollectionElement> elements = listByIds(savePrintDTO.getPrintId());
|
||||
Assert.notEmpty(elements, "print file does not exist!");
|
||||
if (CollectionUtils.isEmpty(elements)) {
|
||||
throw new BusinessException("collectionElements.not.found");
|
||||
}
|
||||
return saveLibraryByCollectionElement(elements, savePrintDTO.getTimeZone());
|
||||
}
|
||||
|
||||
@@ -241,7 +253,7 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
d.setId(null);
|
||||
});
|
||||
if (!libraryService.saveBatch(libraryList)) {
|
||||
throw new BusinessException("Batch saving failed !");
|
||||
throw new BusinessException("batch.save.libraryList.failed");
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
@@ -273,7 +285,7 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
d.setId(null);
|
||||
});
|
||||
if (!libraryService.saveBatch(libraryList)) {
|
||||
throw new BusinessException("Batch saving failed !");
|
||||
throw new BusinessException("batch.save.libraryList.failed");
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
@@ -350,8 +362,9 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
if (!CollectionUtils.isEmpty(printBoardIds)) {
|
||||
//校验printboard
|
||||
List<CollectionElement> printBoardElements = collectionElementMapper.selectBatchIds(printBoardIds);
|
||||
Assert.isTrue(CollectionUtil.isNotEmpty(printBoardElements)
|
||||
&& printBoardElements.size() == printBoardIds.size(), "get.printBoards.data.is.mismatch");
|
||||
if (CollectionUtil.isEmpty(printBoardElements) || printBoardElements.size() != printBoardIds.size()) {
|
||||
throw new BusinessException("get.printBoards.data.is.mismatch");
|
||||
}
|
||||
elementVO.setPrintBoardElements(printBoardElements);
|
||||
usedElementIds.addAll(printBoardIds);
|
||||
}
|
||||
@@ -426,8 +439,9 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
if (!CollectionUtils.isEmpty(sketchBoardIds)) {
|
||||
//校验sketchBoard
|
||||
List<CollectionElement> sketchBoardElements = collectionElementMapper.selectBatchIds(sketchBoardIds);
|
||||
Assert.isTrue(CollectionUtil.isNotEmpty(sketchBoardElements)
|
||||
&& sketchBoardElements.size() == sketchBoardIds.size(), "get.sketchBoards.data.is.mismatch");
|
||||
if (CollectionUtil.isEmpty(sketchBoardElements) || sketchBoardElements.size() != sketchBoardIds.size()) {
|
||||
throw new BusinessException("get.sketchBoards.data.is.mismatch");
|
||||
}
|
||||
elementVO.setSketchBoardElements(sketchBoardElements);
|
||||
usedElementIds.addAll(sketchBoardIds);
|
||||
}
|
||||
@@ -652,7 +666,7 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
AuthPrincipalVo userInfo = UserContext.getUserHolder();
|
||||
List<CollectionElement> colorElements = resolveColorData(colorBoards, userInfo, collectionId, timeZone);
|
||||
if (!this.saveBatch(colorElements)) {
|
||||
throw new BusinessException("Batch saving color board failed !");
|
||||
throw new BusinessException("batch.save.colorElements.failed");
|
||||
}
|
||||
return CopyUtil.copyList(colorElements, CollectionElementVO.class);
|
||||
}
|
||||
@@ -691,8 +705,6 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
private List<CollectionElement> resolveColorData(List<CollectionColorDTO> colorBoards, AuthPrincipalVo userInfo, Long collectionId, String timeZone) {
|
||||
List<CollectionElement> elements = Lists.newArrayList();
|
||||
colorBoards.forEach(color -> {
|
||||
Assert.isTrue(!StringUtils.isEmpty(color), "The elements of the saved color cannot be empty!");
|
||||
|
||||
CollectionElement element = new CollectionElement();
|
||||
element.setAccountId(userInfo.getId());
|
||||
element.setCollectionId(collectionId);
|
||||
|
||||
@@ -24,6 +24,7 @@ import io.netty.util.internal.StringUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
@@ -55,7 +56,7 @@ public class CollectionServiceImpl extends ServiceImpl<CollectionMapper, Collect
|
||||
collection.setCreateDate(DateUtil.getByTimeZone(timeZone));
|
||||
collection.setMoodTemplateId(moodTemplateId);
|
||||
if (collectionMapper.insert(collection) <= 0) {
|
||||
throw new BusinessException("save collection failed!");
|
||||
throw new BusinessException("save.collection.failed");
|
||||
}
|
||||
return collection.getId();
|
||||
}
|
||||
@@ -69,9 +70,13 @@ public class CollectionServiceImpl extends ServiceImpl<CollectionMapper, Collect
|
||||
public UserLikeCollectionVO chooseCollection(Long id) {
|
||||
UserLikeCollectionVO response = new UserLikeCollectionVO();
|
||||
Collection collection = getById(id);
|
||||
Assert.notNull(collection, "collection does not exist!");
|
||||
if (Objects.isNull(collection)) {
|
||||
throw new BusinessException("collection.not.found");
|
||||
}
|
||||
List<CollectionElement> collectionElements = collectionElementService.getByCollectionId(id);
|
||||
Assert.notEmpty(collectionElements, "collection element does not exist!");
|
||||
if (CollectionUtils.isEmpty(collectionElements)) {
|
||||
throw new BusinessException("collectionElements.not.found");
|
||||
}
|
||||
response.setCollectionId(id);
|
||||
response.setMoodTemplateId(collection.getMoodTemplateId());
|
||||
if (collection.getMoodTemplateId() != null) {
|
||||
@@ -86,7 +91,9 @@ public class CollectionServiceImpl extends ServiceImpl<CollectionMapper, Collect
|
||||
.collect(Collectors.groupingBy(CollectionElement::getLevel1Type));
|
||||
maps.forEach((k, v) -> {
|
||||
CollectionLevel1TypeEnum level1TypeEnum = CollectionLevel1TypeEnum.uploadOf(k);
|
||||
Assert.notNull(level1TypeEnum, "unknown level1TypeEnum!");
|
||||
if (Objects.isNull(level1TypeEnum)) {
|
||||
throw new BusinessException("unknown.level1TypeEnum");
|
||||
}
|
||||
switch (level1TypeEnum) {
|
||||
case MOOD_BOARD:
|
||||
response.setMoodBoards(CopyUtil.copyList(v, CollectionElementVO.class, (o, d) -> {
|
||||
|
||||
@@ -72,7 +72,7 @@ public class DesignItemDetailServiceImpl extends ServiceImpl<DesignItemDetailMap
|
||||
|
||||
private boolean saveOne(DesignItemDetail collectionElement) {
|
||||
if (designItemDetailMapper.insert(collectionElement) <= 0) {
|
||||
throw new BusinessException("save failed!");
|
||||
throw new BusinessException("save.designItemDetail.failed");
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
@Override
|
||||
public Long saveOne(DesignItem designItem) {
|
||||
if (designItemMapper.insertDesignItem(designItem) <= 0) {
|
||||
throw new BusinessException("save designItem failed!");
|
||||
throw new BusinessException("save.designItem.failed");
|
||||
}
|
||||
return designItem.getId();
|
||||
}
|
||||
@@ -121,18 +121,20 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
public GetNextSysElementVO getNextSysElement(Long id, String level2Type, String operateType) {
|
||||
//校验
|
||||
if (!DesignPythonItem.SYS_HAIRSTYLE_SHOES_BODY.contains(level2Type)) {
|
||||
throw new BusinessException("unknown type! ");
|
||||
throw new BusinessException("unknown.type");
|
||||
}
|
||||
List<String> operateTypes = Arrays.asList("PREV", "NEXT");
|
||||
if (!operateTypes.contains(operateType)) {
|
||||
throw new BusinessException("unknown operateType! ");
|
||||
throw new BusinessException("unknown.operateType");
|
||||
}
|
||||
if (null == id) {
|
||||
throw new BusinessException("id.cannot.be.empty");
|
||||
}
|
||||
Assert.notNull(id, "id cannot be empty!");
|
||||
Long maxId = sysFileService.getMaxIdByLevel2Type(level2Type, null);
|
||||
Long minId = sysFileService.getMinIdByLevel2Type(level2Type, null);
|
||||
|
||||
if (id > maxId || id < minId) {
|
||||
throw new BusinessException("The id value is out of range!");
|
||||
throw new BusinessException("the.id.value.is.out.of.range");
|
||||
}
|
||||
Long idValue = null;
|
||||
if ("PREV".equals(operateType)) {
|
||||
@@ -157,16 +159,24 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
public DesignCollectionItemVO designSingle(DesignSingleDTO designSingleDTO) {
|
||||
AuthPrincipalVo userInfo = UserContext.getUserHolder();
|
||||
DesignItem designItem = selectById(designSingleDTO.getDesignItemId());
|
||||
Assert.notNull(designItem, "design item does not exists!");
|
||||
if (Objects.isNull(designItem)) {
|
||||
throw new BusinessException("designItem.not.found");
|
||||
}
|
||||
Design design = designService.getById(designItem.getDesignId());
|
||||
Assert.notNull(design, "design does not exists!");
|
||||
if (Objects.isNull(design)) {
|
||||
throw new BusinessException("design.not.found");
|
||||
}
|
||||
DesignLibraryModelPointVO designLibraryModelPointVO = null;
|
||||
if (Objects.nonNull(design.getTemplateId())) {
|
||||
LibraryModelPoint modelPoint = libraryModelPointService.getById(design.getTemplateId());
|
||||
Assert.notNull(modelPoint, "template does not exists!");
|
||||
if (Objects.isNull(modelPoint)) {
|
||||
throw new BusinessException("modelPoint.not.found");
|
||||
}
|
||||
Library library = libraryService.getById(modelPoint.getRelationId());
|
||||
// ??和上面重复
|
||||
Assert.notNull(modelPoint, "template does not exists!");
|
||||
if (Objects.isNull(library)) {
|
||||
throw new BusinessException("library.not.found");
|
||||
}
|
||||
designLibraryModelPointVO = collectionElementService.calculateTemplatePoint(modelPoint, library.getHigh(), library.getWidth(), library.getUrl());
|
||||
}
|
||||
|
||||
@@ -199,15 +209,23 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
@Override
|
||||
public String printDot(DesignSingleDTO designSingleDTO) {
|
||||
DesignItem designItem = selectById(designSingleDTO.getDesignItemId());
|
||||
Assert.notNull(designItem, "design item does not exists!");
|
||||
if (Objects.isNull(designItem)) {
|
||||
throw new BusinessException("designItem.not.found");
|
||||
}
|
||||
Design design = designService.getById(designItem.getDesignId());
|
||||
Assert.notNull(design, "design does not exists!");
|
||||
if (Objects.isNull(design)) {
|
||||
throw new BusinessException("design.not.found");
|
||||
}
|
||||
DesignLibraryModelPointVO designLibraryModelPointVO = null;
|
||||
if (Objects.nonNull(design.getTemplateId())) {
|
||||
LibraryModelPoint modelPoint = libraryModelPointService.getById(design.getTemplateId());
|
||||
Assert.notNull(modelPoint, "template does not exists!");
|
||||
if (Objects.isNull(modelPoint)) {
|
||||
throw new BusinessException("modelPoint.not.found");
|
||||
}
|
||||
Library library = libraryService.getById(modelPoint.getRelationId());
|
||||
Assert.notNull(modelPoint, "template does not exists!");
|
||||
if (Objects.isNull(library)) {
|
||||
throw new BusinessException("library.not.found");
|
||||
}
|
||||
designLibraryModelPointVO = collectionElementService.calculateTemplatePoint(modelPoint, library.getHigh(), library.getWidth(), library.getUrl());
|
||||
}
|
||||
Set<String> newTypes = designSingleDTO.getClothes().stream().map(DesignSingleItemDTO::getType).collect(Collectors.toSet());
|
||||
@@ -223,11 +241,11 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
private void validateCategory(Set<String> newTypes, String singleOverall, String switchCategory) {
|
||||
if (SingleOverallEnum.SINGLE.getRealName().equals(singleOverall)) {
|
||||
if (newTypes.size() > 1) {
|
||||
throw new BusinessException("Wrong clothes type !");
|
||||
throw new BusinessException("wrong.clothes.type");
|
||||
}
|
||||
//一个的时候
|
||||
if (!switchCategory.equals(CollectionUtil.newArrayList(newTypes).get(0))) {
|
||||
throw new BusinessException("Wrong clothes type !");
|
||||
throw new BusinessException("wrong.clothes.type");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -385,9 +403,13 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
public DesignSingleVO designSingleIncludeLayers(DesignSingleIncludeLayersDTO designSingleIncludeLayersDTO) {
|
||||
AuthPrincipalVo userInfo = UserContext.getUserHolder();
|
||||
DesignItem designItem = selectById(designSingleIncludeLayersDTO.getDesignItemId());
|
||||
Assert.notNull(designItem, "design item does not exists!");
|
||||
if (Objects.isNull(designItem)) {
|
||||
throw new BusinessException("designItem.not.found");
|
||||
}
|
||||
Design design = designService.getById(designItem.getDesignId());
|
||||
Assert.notNull(design, "design does not exists!");
|
||||
if (Objects.isNull(design)) {
|
||||
throw new BusinessException("design.not.found");
|
||||
}
|
||||
|
||||
DesignLibraryModelPointVO designLibraryModelPointVO = null;
|
||||
// 设置模特
|
||||
@@ -401,19 +423,26 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
Integer width;
|
||||
if (design.getModelType().equals(ModelType.SYSTEM.getValue())) {
|
||||
SysFileVO sysFile = sysFileService.getById(design.getTemplateId());
|
||||
Assert.notNull(sysFile, "model does not exists!");
|
||||
if (Objects.isNull(sysFile)) {
|
||||
throw new BusinessException("sysFile.not.found");
|
||||
}
|
||||
modelUrl = sysFile.getUrl();
|
||||
high = 1050;
|
||||
width = 500;
|
||||
} else {
|
||||
Library libFile = libraryService.getById(design.getTemplateId());
|
||||
Assert.notNull(libFile, "model does not exists!");
|
||||
if (Objects.isNull(libFile)) {
|
||||
throw new BusinessException("sysFile.not.found");
|
||||
}
|
||||
modelUrl = libFile.getUrl();
|
||||
high = libFile.getHigh();
|
||||
width = libFile.getWidth();
|
||||
}
|
||||
LibraryModelPoint modelPoint = libraryModelPointService.getByRelationId(design.getTemplateId(), design.getModelType());
|
||||
Assert.notNull(modelPoint, "The model has not been tagged");
|
||||
if (Objects.isNull(modelPoint)) {
|
||||
throw new BusinessException("modelPoint.not.found");
|
||||
}
|
||||
// Assert.notNull(modelPoint, "The model has not been tagged");
|
||||
|
||||
designLibraryModelPointVO = collectionElementService.calculateTemplatePoint(modelPoint, high, width, modelUrl);
|
||||
}
|
||||
|
||||
@@ -458,7 +458,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
response.setDesignCollectionItems(designCollectionItems);
|
||||
JSONObject data = responseJSONObject.getJSONObject("data");
|
||||
if (data == null) {
|
||||
throw new BusinessException("python response data is null");
|
||||
throw new BusinessException("design.interface.exception");
|
||||
}
|
||||
for (int i = 0; i < pythonObjects.getObjects().size(); i++) {
|
||||
DesignPythonObject item = pythonObjects.getObjects().get(i);
|
||||
@@ -486,7 +486,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
if (!StringUtils.isEmpty(synthesisUrl)) {
|
||||
designPythonOutfit.setDesignUrl(synthesisUrl);
|
||||
} else {
|
||||
throw new BusinessException("design python response synthesis_url is null");
|
||||
throw new BusinessException("design.interface.exception");
|
||||
}
|
||||
designPythonOutfitService.save(designPythonOutfit);
|
||||
JSONArray layers = outfit.getJSONArray("layers");
|
||||
@@ -629,7 +629,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
//校验collection
|
||||
Collection collection = collectionService.getById(reDesignDTO.getCollectionId());
|
||||
if (Objects.isNull(collection)) {
|
||||
throw new BusinessException("collection.not.find");
|
||||
throw new BusinessException("collection.not.found");
|
||||
}
|
||||
AuthPrincipalVo userInfo = UserContext.getUserHolder();
|
||||
//查询用户 sketch library
|
||||
@@ -670,7 +670,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
public DesignCollectionVO designItemList(Long designId) {
|
||||
Design design = baseMapper.selectById(designId);
|
||||
if (Objects.isNull(design)) {
|
||||
throw new BusinessException("design.not.find");
|
||||
throw new BusinessException("design.not.found");
|
||||
}
|
||||
List<DesignItem> designItems = designItemService.getByDesignId(designId);
|
||||
if (CollectionUtils.isEmpty(designItems)) {
|
||||
@@ -695,14 +695,14 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
AuthPrincipalVo userInfo = UserContext.getUserHolder();
|
||||
DesignItem designItem = designItemService.getById(designLikeDTO.getDesignItemId());
|
||||
if (Objects.isNull(designItem)) {
|
||||
throw new BusinessException("designItem.not.find");
|
||||
throw new BusinessException("designItem.not.found");
|
||||
}
|
||||
String pictureName = null;
|
||||
UserLike userLike;
|
||||
if (Objects.nonNull(userGroupId)) {
|
||||
UserLikeGroup userLikeGroup = userLikeGroupService.getById(userGroupId);
|
||||
if (Objects.isNull(userLikeGroup)) {
|
||||
throw new BusinessException("userLikeGroup.not.find");
|
||||
throw new BusinessException("userLikeGroup.not.found");
|
||||
}
|
||||
// if(designItem.getCollectionId().equals(userLikeGroup.getCollectionId())){
|
||||
// //相同collection直接跳过 不需要往element加元素
|
||||
@@ -710,11 +710,11 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
// }
|
||||
List<CollectionElement> oldElements = collectionElementService.getByCollectionId(userLikeGroup.getCollectionId());
|
||||
if (CollectionUtil.isEmpty(oldElements)) {
|
||||
throw new BusinessException("old.elements.not.find");
|
||||
throw new BusinessException("old.elements.not.found");
|
||||
}
|
||||
List<DesignItemDetail> designItemDetails = designItemDetailService.selectByDesignItemId(designLikeDTO.getDesignItemId());
|
||||
if (CollectionUtil.isEmpty(designItemDetails)) {
|
||||
throw new BusinessException("new.designItemDetails.not.find");
|
||||
throw new BusinessException("new.designItemDetails.not.found");
|
||||
}
|
||||
//判断老的element合并到新的是否满足 数量不超过15
|
||||
List<Long> newElementIds = validateMergeElement(oldElements, designItemDetails);
|
||||
@@ -810,9 +810,13 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
public Boolean dislike(DisDesignLikeDTO disDesignLikeDTO) {
|
||||
AuthPrincipalVo userInfo = UserContext.getUserHolder();
|
||||
UserLike userLike = userLikeService.getById(disDesignLikeDTO.getGroupDetailId());
|
||||
Assert.notNull(userLike, "History detail does not exist!");
|
||||
if (Objects.isNull(userLike)) {
|
||||
throw new BusinessException("history.detail.not.found");
|
||||
}
|
||||
Design design = getById(disDesignLikeDTO.getDesignId());
|
||||
Assert.notNull(design, "design does not exist!");
|
||||
if (Objects.isNull(design)) {
|
||||
throw new BusinessException("design.detail.not.found");
|
||||
}
|
||||
if (!userLike.getDesignId().equals(disDesignLikeDTO.getDesignId())) {
|
||||
//不是相同的design不会合并
|
||||
return Boolean.TRUE;
|
||||
@@ -858,17 +862,25 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
@Override
|
||||
public DesignItemDetailVO detail(Long designPythonOutfitId, Long designItemId) {
|
||||
DesignItem designItem = designItemService.getById(designItemId);
|
||||
Assert.notNull(designItem, "design item does not exist!");
|
||||
if (Objects.isNull(designItem)) {
|
||||
throw new BusinessException("designItem.not.found");
|
||||
}
|
||||
Design design = getById(designItem.getDesignId());
|
||||
Assert.notNull(design, "design does not exist!");
|
||||
if (Objects.isNull(design)) {
|
||||
throw new BusinessException("design.not.found");
|
||||
}
|
||||
List<DesignItemDetail> designItemDetails = designItemDetailService.selectByDesignItemId(designItemId);
|
||||
Assert.notEmpty(designItemDetails, "designItemDetails does not exist!");
|
||||
if (CollectionUtil.isEmpty(designItemDetails)) {
|
||||
throw new BusinessException("designItemDetails.not.found");
|
||||
}
|
||||
// 添加判断designPythonOutfitId是否存在
|
||||
TDesignPythonOutfit designPythonOutfit = new TDesignPythonOutfit();
|
||||
Boolean flag = Boolean.FALSE;
|
||||
if (Objects.nonNull(designPythonOutfitId)) {
|
||||
designPythonOutfit = designPythonOutfitService.getById(designPythonOutfitId);
|
||||
Assert.notNull(designPythonOutfit, "designPythonOutfit does not exist!");
|
||||
if (Objects.isNull(designPythonOutfit)) {
|
||||
throw new BusinessException("designPythonOutfit.not.found");
|
||||
}
|
||||
flag = Boolean.TRUE;
|
||||
}
|
||||
|
||||
@@ -998,7 +1010,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
design.setCollectionId(collectionId);
|
||||
design.setAccountId(accountId);
|
||||
if (designMapper.insert(design) <= 0) {
|
||||
throw new BusinessException("save design failed!");
|
||||
throw new BusinessException("save.design.failed");
|
||||
}
|
||||
return design.getId();
|
||||
}
|
||||
|
||||
@@ -71,7 +71,9 @@ public class LibraryModelPointServiceImpl extends ServiceImpl<LibraryModelPointM
|
||||
} else {
|
||||
//编辑
|
||||
LibraryModelPoint modelPoint = getById(libraryModelPointDTO.getTemplateId());
|
||||
Assert.notNull(modelPoint, "Template does not exist!");
|
||||
if (Objects.isNull(modelPoint)) {
|
||||
throw new BusinessException("modelPoint.not.found");
|
||||
}
|
||||
modelPoint = resolvePoint(libraryModelPointDTO);
|
||||
modelPoint.setUpdateDate(DateUtil.getByTimeZone(libraryModelPointDTO.getTimeZone()));
|
||||
modelPoint.setId(libraryModelPointDTO.getTemplateId());
|
||||
@@ -122,15 +124,15 @@ public class LibraryModelPointServiceImpl extends ServiceImpl<LibraryModelPointM
|
||||
JSONObject jsonObject = pythonService.designNew(objects);
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
if (data == null) {
|
||||
throw new BusinessException("python design response is null");
|
||||
throw new BusinessException("design.interface.exception");
|
||||
}
|
||||
JSONObject jsonObject1 = data.getJSONObject("0");
|
||||
if (jsonObject1 == null) {
|
||||
throw new BusinessException("python design response is null");
|
||||
throw new BusinessException("design.interface.exception");
|
||||
}
|
||||
String synthesisUrl = jsonObject1.getString("synthesis_url");
|
||||
if (StringUtils.isEmpty(synthesisUrl)) {
|
||||
throw new BusinessException("python design response synthesis_url is null");
|
||||
throw new BusinessException("design.interface.exception");
|
||||
}
|
||||
return synthesisUrl;
|
||||
}
|
||||
@@ -143,7 +145,7 @@ public class LibraryModelPointServiceImpl extends ServiceImpl<LibraryModelPointM
|
||||
queryWrapper.lambda().last("limit 1");
|
||||
List<LibraryModelPoint> libraryModelPoints = baseMapper.selectList(queryWrapper);
|
||||
if (CollectionUtil.isEmpty(libraryModelPoints)) {
|
||||
throw new BusinessException("modelPoint.not.find");
|
||||
throw new BusinessException("modelPoint.not.found");
|
||||
}
|
||||
return libraryModelPoints.get(0);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.ai.da.python.vo.ModelPathObject;
|
||||
import com.ai.da.service.LibraryModelPointService;
|
||||
import com.ai.da.service.LibraryService;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONException;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@@ -89,7 +90,9 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
|
||||
if (!StringUtils.isEmpty(query.getLevel1Type())) {
|
||||
LibraryLevel1TypeEnum level1TypeEnum = LibraryLevel1TypeEnum.uploadOf(query.getLevel1Type());
|
||||
Assert.notNull(level1TypeEnum, "unknown level1Type " + query.getLevel1Type());
|
||||
if (Objects.isNull(level1TypeEnum)) {
|
||||
throw new BusinessException("unknown.parameter.level1Type");
|
||||
}
|
||||
queryWrapper.eq("level1_type", query.getLevel1Type());
|
||||
}
|
||||
if (!StringUtils.isEmpty(query.getModelSex()) && query.getLevel1Type().equals(LibraryLevel1TypeEnum.SKETCH_BOARD.getRealName())) {
|
||||
@@ -97,7 +100,9 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
}
|
||||
if (!StringUtils.isEmpty(query.getLevel2Type())) {
|
||||
CollectionLevel2TypeEnum level2TypeEnum = CollectionLevel2TypeEnum.of(query.getLevel2Type());
|
||||
Assert.notNull(level2TypeEnum, "unknown level2Type " + query.getLevel2Type());
|
||||
if (Objects.isNull(level2TypeEnum)) {
|
||||
throw new BusinessException("unknown.parameter.level2Type");
|
||||
}
|
||||
queryWrapper.eq("level2_type", query.getLevel2Type());
|
||||
}
|
||||
if (!StringUtils.isEmpty(query.getType())) {
|
||||
@@ -156,13 +161,18 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
//用户信息
|
||||
AuthPrincipalVo userInfo = UserContext.getUserHolder();
|
||||
LibraryLevel1TypeEnum level1TypeEnum = LibraryLevel1TypeEnum.uploadOf(libraryUploadDTO.getLevel1Type());
|
||||
Assert.notNull(level1TypeEnum, "unknown parameter level1Type!");
|
||||
if (Objects.isNull(level1TypeEnum)) {
|
||||
throw new BusinessException("unknown.parameter.level1Type");
|
||||
}
|
||||
if (!StringUtils.isEmpty(libraryUploadDTO.getLevel2Type())) {
|
||||
CollectionLevel2TypeEnum level2TypeEnum = CollectionLevel2TypeEnum.of(libraryUploadDTO.getLevel2Type());
|
||||
Assert.notNull(level2TypeEnum, "unknown parameter level2Type!");
|
||||
if (Objects.isNull(level2TypeEnum)) {
|
||||
throw new BusinessException("unknown.parameter.level2Type");
|
||||
}
|
||||
}
|
||||
if (!StringUtils.isEmpty(libraryUploadDTO.getLevel2Type()) || level1TypeEnum.equals(LibraryLevel1TypeEnum.SKETCH_BOARD)) {
|
||||
throw new BusinessException("level2Type.cannot.be.empty");
|
||||
}
|
||||
Assert.isTrue(!(level1TypeEnum.equals(LibraryLevel1TypeEnum.SKETCH_BOARD)
|
||||
&& StringUtils.isEmpty(libraryUploadDTO.getLevel2Type())), "level2Type cannot be empty!");
|
||||
String path = calculateFileUrl(level1TypeEnum, libraryUploadDTO.getLevel2Type(), libraryUploadDTO.getModelSex(), userInfo.getId());
|
||||
String bucketName = null;
|
||||
switch (level1TypeEnum) {
|
||||
@@ -173,9 +183,10 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
bucketName = users;
|
||||
break;
|
||||
case MARKETING_SKETCH:
|
||||
throw new BusinessException("MARKETING_SKETCH type have been removed");
|
||||
// 走不到
|
||||
throw new BusinessException("MARKETING_SKETCH.type.have.been.removed");
|
||||
default:
|
||||
throw new BusinessException("unknown level1_type");
|
||||
throw new BusinessException("unknown.level1TypeEnum");
|
||||
}
|
||||
//保存element元素
|
||||
if (!StringUtils.isEmpty(libraryUploadDTO.getModelType())) {
|
||||
@@ -200,7 +211,7 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
libraryUpdateVo.setCheckMd5(Boolean.TRUE);
|
||||
return libraryUpdateVo;
|
||||
} else {
|
||||
throw new BusinessException("unknown modelType");
|
||||
throw new BusinessException("unknown.modelType");
|
||||
}
|
||||
} else {
|
||||
String filePath = minioUtil.upload(bucketName, path, libraryUploadDTO.getFile());
|
||||
@@ -241,25 +252,26 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
response = client.newCall(request).execute();
|
||||
} catch (IOException ioException) {
|
||||
log.error("PythonService##processMannequins异常###{}", ExceptionUtil.getThrowableList(ioException));
|
||||
throw new BusinessException("processMannequins.interface.exception");
|
||||
}
|
||||
//去除限流
|
||||
// AccessLimitUtils.validateOut("design");
|
||||
if (Objects.isNull(response)) {
|
||||
log.error("PythonService##processMannequins异常###{}", "response or body is empty!");
|
||||
throw new BusinessException("system error!");
|
||||
}
|
||||
if (response.isSuccessful()) {
|
||||
try {
|
||||
if (Objects.isNull(response.body())) {
|
||||
throw new BusinessException("processMannequins.interface.exception");
|
||||
}
|
||||
String responseBody = response.body().string();
|
||||
JSONObject responseObject = JSON.parseObject(responseBody);
|
||||
String newMinioPath = responseObject.getString("data");
|
||||
return newMinioPath;
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (IOException | JSONException e) {
|
||||
log.error(e.getMessage());
|
||||
throw new BusinessException("processMannequins.interface.exception");
|
||||
}
|
||||
}
|
||||
//生成失败
|
||||
throw new BusinessException("generate design exception!");
|
||||
throw new BusinessException("processMannequins.interface.exception");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -315,7 +327,7 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
library.setUrl(sysFile.getUrl());
|
||||
return library;
|
||||
} else {
|
||||
throw new BusinessException("system error!");
|
||||
throw new BusinessException("system.error");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -330,7 +342,9 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
@Override
|
||||
public void updateLibraryName(LibraryUpdateDTO libraryUpdateDTO) {
|
||||
List<Library> librarys = getByIds(libraryUpdateDTO.getLibraryIds());
|
||||
Assert.notEmpty(librarys, "Librarys does not exist!");
|
||||
if (CollectionUtils.isEmpty(librarys)) {
|
||||
throw new BusinessException("librarys.not.found");
|
||||
}
|
||||
QueryWrapper<Library> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.in("id", libraryUpdateDTO.getLibraryIds());
|
||||
Library library1 = new Library();
|
||||
@@ -385,7 +399,7 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
|
||||
private boolean saveOne(Library library) {
|
||||
if (libraryMapper.insert(library) <= 0) {
|
||||
throw new BusinessException("save failed!");
|
||||
throw new BusinessException("save.library.failed");
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class PanToneServiceImpl extends ServiceImpl<PanToneMapper, PanTone> impl
|
||||
queryWrapper.eq("pantone_index", colorLookupTable.getColorIndex());
|
||||
PanTone panTone = panToneMapper.selectOne(queryWrapper);
|
||||
if (Objects.isNull(panTone)) {
|
||||
throw new BusinessException("Pantone value does not exist !");
|
||||
throw new BusinessException("pantone.not.found");
|
||||
}
|
||||
return coverPanToneToVo(panTone);
|
||||
}
|
||||
@@ -56,7 +56,7 @@ public class PanToneServiceImpl extends ServiceImpl<PanToneMapper, PanTone> impl
|
||||
queryWrapper.eq("tcx", txc);
|
||||
List<PanTone> panTones = panToneMapper.selectList(queryWrapper);
|
||||
if (CollectionUtil.isEmpty(panTones)) {
|
||||
throw new BusinessException("Pantone value does not exist !");
|
||||
throw new BusinessException("panTones.not.found");
|
||||
}
|
||||
return coverPanToneToVo(panTones.get(0));
|
||||
}
|
||||
@@ -140,7 +140,7 @@ public class PanToneServiceImpl extends ServiceImpl<PanToneMapper, PanTone> impl
|
||||
@Override
|
||||
public List<PantoneVO> getRgbByHsvBatch(List<GetRgbByHsvBatchDTO> hsvBatch) {
|
||||
if (hsvBatch.size() > 8) {
|
||||
throw new BusinessException("hsv value cannot exceed the maximum of 8");
|
||||
throw new BusinessException("hsv.value.cannot.exceed.the.maximum.of.8");
|
||||
}
|
||||
List<Integer> colorValues = Lists.newArrayList();
|
||||
Map<Integer, GetRgbByHsvBatchDTO> valueToHsv = Maps.newHashMap();
|
||||
@@ -183,7 +183,7 @@ public class PanToneServiceImpl extends ServiceImpl<PanToneMapper, PanTone> impl
|
||||
, Map<Integer, Integer> indexToValue, Map<Integer, GetRgbByHsvBatchDTO> valueToHsv,
|
||||
List<GetRgbByHsvBatchDTO> hsvBatch) {
|
||||
if (CollectionUtil.isEmpty(panTones)) {
|
||||
throw new BusinessException("Pantone value does not exist !");
|
||||
throw new BusinessException("panTones.not.found");
|
||||
}
|
||||
List<PantoneVO> templateResposne = CopyUtil.copyList(panTones, PantoneVO.class, (o, d) -> {
|
||||
d.setId(o.getPantoneIndex());
|
||||
|
||||
@@ -31,7 +31,7 @@ public class PythonTAllInfoServiceImpl extends ServiceImpl<PythonTAllInfoMapper,
|
||||
@Override
|
||||
public Long getImageIdByPath(String path) {
|
||||
if (StringUtils.isEmpty(path)) {
|
||||
throw new BusinessException("path不能为空");
|
||||
throw new BusinessException("path.cannot.be.empty");
|
||||
}
|
||||
QueryWrapper<PythonTAllInfo> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(PythonTAllInfo::getImagePath, path);
|
||||
@@ -44,7 +44,7 @@ public class PythonTAllInfoServiceImpl extends ServiceImpl<PythonTAllInfoMapper,
|
||||
pythonTAllInfo.setImagePath(path);
|
||||
int insert = pythonTAllInfoMapper.insert(pythonTAllInfo);
|
||||
if (insert != 1) {
|
||||
throw new BusinessException("插入失败");
|
||||
throw new BusinessException("save.pythonTAllInfo.failed");
|
||||
}
|
||||
return pythonTAllInfo.getId();
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ public class SysFileServiceImpl extends ServiceImpl<SysFileMapper, SysFile> impl
|
||||
sysFile.setMd5(MD5Utils.encryptFile(inputStream));
|
||||
} catch (IOException ioException) {
|
||||
log.info("initSysFile 文件异常###{}", ExceptionUtil.getThrowableList(ioException));
|
||||
throw new BusinessException("initSysFile ioException");
|
||||
throw new BusinessException("initSysFile.ioException");
|
||||
}
|
||||
String linuxDomain = fileProperties.getLinuxDomain();
|
||||
if (!StringUtils.isEmpty(linuxDomain)) {
|
||||
@@ -249,7 +249,7 @@ public class SysFileServiceImpl extends ServiceImpl<SysFileMapper, SysFile> impl
|
||||
|
||||
private boolean saveMany(List<SysFile> sysFiles) {
|
||||
if (!this.saveBatch(sysFiles)) {
|
||||
throw new BusinessException("save system file failed!");
|
||||
throw new BusinessException("save.sysFile.failed");
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.ai.da.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.ai.da.common.config.exception.BusinessException;
|
||||
import com.ai.da.common.context.UserContext;
|
||||
import com.ai.da.common.utils.CopyUtil;
|
||||
import com.ai.da.common.utils.DateUtil;
|
||||
@@ -24,6 +25,7 @@ import org.springframework.util.Assert;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.TimeZone;
|
||||
|
||||
/**
|
||||
@@ -53,14 +55,18 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
@Override
|
||||
public void deleteUserGroup(Long userGroupId) {
|
||||
UserLikeGroup group = getById(userGroupId);
|
||||
Assert.notNull(group, "History does not exist!");
|
||||
if (Objects.isNull(group)) {
|
||||
throw new BusinessException("history.not.found");
|
||||
}
|
||||
userLikeGroupMapper.deleteById(userGroupId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HistoryUpdateVO updateUserGroupName(Long userGroupId, String userGroupName, String timeZone) {
|
||||
UserLikeGroup group = getById(userGroupId);
|
||||
Assert.notNull(group, "History does not exist!");
|
||||
if (Objects.isNull(group)) {
|
||||
throw new BusinessException("history.not.found");
|
||||
}
|
||||
QueryWrapper<UserLikeGroup> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("id", userGroupId);
|
||||
UserLikeGroup userLikeGroup = new UserLikeGroup();
|
||||
@@ -104,7 +110,9 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
@Override
|
||||
public UserLikeChooseVO choose(Long userGroupId) {
|
||||
UserLikeGroup group = getById(userGroupId);
|
||||
Assert.notNull(group, "History does not exist!");
|
||||
if (Objects.isNull(group)) {
|
||||
throw new BusinessException("history.not.found");
|
||||
}
|
||||
List<UserLikeVO> userLikeVOS = userLikeService.getGroupDetail(userGroupId);
|
||||
userLikeVOS.forEach(o -> {
|
||||
TDesignPythonOutfit tDesignPythonOutfit1 = designPythonOutfitMapper.selectById(o.getDesignOutfitId());
|
||||
|
||||
@@ -34,6 +34,7 @@ import org.apache.commons.fileupload.FileItemFactory;
|
||||
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@@ -115,13 +116,13 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
workspace.setSystemDesignerPercentage(SYSTEM_DESIGNER_PERCENTAGE);
|
||||
int insert = workspaceMapper.insert(workspace);
|
||||
if (insert <= 0) {
|
||||
throw new BusinessException("insert workspace failed");
|
||||
throw new BusinessException("save.workspace.failed");
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
int update = workspaceMapper.updateById(workspace);
|
||||
if (update <= 0) {
|
||||
throw new BusinessException("update workspace failed");
|
||||
throw new BusinessException("update.workspace.failed");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -134,7 +135,7 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
qw.lambda().eq(Workspace::getUserName, userName);
|
||||
List<Workspace> workspaces = baseMapper.selectList(qw);
|
||||
if (!CollectionUtils.isEmpty(workspaces)) {
|
||||
throw new BusinessException("The workspace name already exists!");
|
||||
throw new BusinessException("the.workspaceName.already.exists");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,7 +173,7 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
workspace.setIsLastIndex(1);
|
||||
int insert = workspaceMapper.insert(workspace);
|
||||
if (insert <= 0) {
|
||||
throw new BusinessException("save workspace failed");
|
||||
throw new BusinessException("save.workspace.failed");
|
||||
}
|
||||
page = workspaceMapper.selectPage(new Page<>(query.getPage(), query.getSize()), qw);
|
||||
IPage<WorkspaceVO> convert = page.convert(
|
||||
@@ -226,7 +227,7 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
qwIsLastIndex.last("limit 1");
|
||||
List<Workspace> workspaces = workspaceMapper.selectList(qwIsLastIndex);
|
||||
if (CollectionUtils.isEmpty(workspaces)) {
|
||||
throw new BusinessException("用户工作空间未查询到最后使用标识");
|
||||
throw new BusinessException("the.workspace.lastIndex.not.found");
|
||||
}
|
||||
vo.setId(workspaces.get(0).getId());
|
||||
return vo;
|
||||
@@ -238,7 +239,8 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
try {
|
||||
clazz = Class.forName(IEnumDisplay.class.getPackage().getName() + "." + className);
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(className + "-枚举类型未找到");
|
||||
log.error(e.getMessage());
|
||||
throw new BusinessException("enumeration.class.not.found");
|
||||
}
|
||||
return getEnumValues(clazz);
|
||||
}
|
||||
@@ -472,7 +474,7 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
qw.lambda().eq(Workspace::getIsLastIndex, 1);
|
||||
List<Workspace> workspaces = workspaceMapper.selectList(qw);
|
||||
if (!CollectionUtils.isEmpty(workspaces)) {
|
||||
throw new BusinessException("Unable to delete the workspace you last used");
|
||||
throw new BusinessException("unable.to.delete.the.workspace.you.are.currently.using");
|
||||
}
|
||||
workspaceMapper.deleteBatchIds(deleteIds);
|
||||
return deleteIds;
|
||||
|
||||
Reference in New Issue
Block a user