TASK: 全局异常优化;
This commit is contained in:
@@ -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