TASK: library分类;

This commit is contained in:
shahaibo
2023-11-08 15:22:46 +08:00
parent 269b6fa5fb
commit 94809e149d
7 changed files with 78 additions and 35 deletions

View File

@@ -22,4 +22,7 @@ public class QueryLibraryPageDTO extends PageQueryBaseVo {
@ApiModelProperty("pictureName") @ApiModelProperty("pictureName")
private String pictureName; private String pictureName;
@ApiModelProperty("分类ID")
private Long classificationId;
} }

View File

@@ -25,4 +25,6 @@ public class QueryLibraryPageServiceDTO extends PageQueryBaseVo {
@ApiModelProperty("pictureName") @ApiModelProperty("pictureName")
private String pictureName; private String pictureName;
private Long classificationId;
} }

View File

@@ -29,4 +29,6 @@ public interface ClassificationService {
List<ClassificationVO> getClassificationVOList(List<Classification> classificationList); List<ClassificationVO> getClassificationVOList(List<Classification> classificationList);
Boolean relationLibrary(ClassificationDTO classificationDTO); Boolean relationLibrary(ClassificationDTO classificationDTO);
List<Long> getLibraryIdListByClassificationId(Long classificationId);
} }

View File

@@ -24,6 +24,7 @@ import javax.annotation.Resource;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@@ -157,6 +158,36 @@ public class ClassificationServiceImpl implements ClassificationService {
return Boolean.TRUE; return Boolean.TRUE;
} }
@Override
public List<Long> getLibraryIdListByClassificationId(Long classificationId) {
List<Long> treeClassificationIdList = getTreeClassificationIdListByClassificationId(classificationId);
QueryWrapper<ClassificationRelLibrary> qw = new QueryWrapper<>();
qw.lambda().in(ClassificationRelLibrary::getClassificationId, treeClassificationIdList);
List<ClassificationRelLibrary> classificationRelLibraryList = classificationRelLibraryMapper.selectList(qw);
Set<Long> collect = classificationRelLibraryList.stream()
.map(ClassificationRelLibrary::getLibraryId)
.collect(Collectors.toSet());
List<Long> libraryIdList = new ArrayList<>(collect);
return libraryIdList;
}
private List<Long> getTreeClassificationIdListByClassificationId(Long classificationId) {
List<Long> classificationIdList = new ArrayList<>();
classificationIdList.add(classificationId);
QueryWrapper<Classification> qw = new QueryWrapper<>();
qw.lambda().eq(Classification::getParentId, classificationId);
List<Classification> childList = classificationMapper.selectList(qw);
if (CollectionUtil.isNotEmpty(childList)) {
for (Classification child : childList) {
List<Long> childTree = getTreeClassificationIdListByClassificationId(child.getId());
if (CollectionUtil.isNotEmpty(childTree)) {
classificationIdList.addAll(childTree);
}
}
}
return classificationIdList;
}
private List<ClassificationVO> recursionClassificationVO(ClassificationVO classificationVO) { private List<ClassificationVO> recursionClassificationVO(ClassificationVO classificationVO) {
QueryWrapper<Classification> qw = new QueryWrapper<>(); QueryWrapper<Classification> qw = new QueryWrapper<>();
qw.lambda().eq(Classification::getParentId, classificationVO.getId()); qw.lambda().eq(Classification::getParentId, classificationVO.getId());

View File

@@ -199,13 +199,13 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
//调取python 接口 //调取python 接口
String generateUrl = pythonService.generatePrint(printPath); String generateUrl = pythonService.generatePrint(printPath);
if (StringUtils.isEmpty(generateUrl)) { if (StringUtils.isEmpty(generateUrl)) {
throw new BusinessException("generate.print.exception"); throw new BusinessException("generate.interface.exception");
} }
//用户信息 //用户信息
AuthPrincipalVo userInfo = UserContext.getUserHolder(); AuthPrincipalVo userInfo = UserContext.getUserHolder();
CollectionElement element = resolveData(generateUrl, generatePrintDTO.getTimeZone(), userInfo); CollectionElement element = resolveData(generateUrl, generatePrintDTO.getTimeZone(), userInfo);
if (!this.save(element)) { if (!this.save(element)) {
throw new BusinessException("generate.print.failed"); throw new BusinessException("save.collectionElement.failed");
} }
CollectionGeneratePrintVO collectionGeneratePrint = CopyUtil.copyObject(element, CollectionGeneratePrintVO.class); CollectionGeneratePrintVO collectionGeneratePrint = CopyUtil.copyObject(element, CollectionGeneratePrintVO.class);
collectionGeneratePrint.setDesignType(DesignTypeEnum.COLLECTION.getRealName()); collectionGeneratePrint.setDesignType(DesignTypeEnum.COLLECTION.getRealName());

View File

@@ -21,6 +21,7 @@ import com.ai.da.model.enums.ModelType;
import com.ai.da.model.enums.Sex; import com.ai.da.model.enums.Sex;
import com.ai.da.model.vo.*; import com.ai.da.model.vo.*;
import com.ai.da.python.vo.ModelPathObject; import com.ai.da.python.vo.ModelPathObject;
import com.ai.da.service.ClassificationService;
import com.ai.da.service.LibraryModelPointService; import com.ai.da.service.LibraryModelPointService;
import com.ai.da.service.LibraryService; import com.ai.da.service.LibraryService;
import com.ai.da.service.WorkspaceService; import com.ai.da.service.WorkspaceService;
@@ -67,6 +68,8 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
@Resource @Resource
private WorkspaceService workspaceService; private WorkspaceService workspaceService;
@Resource @Resource
private ClassificationService classificationService;
@Resource
private MinioUtil minioUtil; private MinioUtil minioUtil;
@Value("${minio.bucketName.users}") @Value("${minio.bucketName.users}")
@@ -129,6 +132,11 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
if (!StringUtils.isEmpty(query.getPictureName())) { if (!StringUtils.isEmpty(query.getPictureName())) {
queryWrapper.like("name", query.getPictureName()); queryWrapper.like("name", query.getPictureName());
} }
// 新增分类过滤
if (null != query.getClassificationId()) {
List<Long> libraryIdList = classificationService.getLibraryIdListByClassificationId(query.getClassificationId());
queryWrapper.lambda().in(Library::getId, libraryIdList);
}
queryWrapper.orderByDesc("id"); queryWrapper.orderByDesc("id");
IPage<Library> page = getBaseMapper().selectPage( IPage<Library> page = getBaseMapper().selectPage(
new Page<>(query.getPage(), query.getSize()), queryWrapper); new Page<>(query.getPage(), query.getSize()), queryWrapper);
@@ -309,7 +317,7 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
public void batchDeleteLibrary(LibraryDeleteDTO deleteDTO) { public void batchDeleteLibrary(LibraryDeleteDTO deleteDTO) {
List<Library> librarys = libraryMapper.selectBatchIds(deleteDTO.getLibraryIds()); List<Library> librarys = libraryMapper.selectBatchIds(deleteDTO.getLibraryIds());
if (CollectionUtils.isEmpty(librarys)) { if (CollectionUtils.isEmpty(librarys)) {
throw new BusinessException("librarys.not.found"); throw new BusinessException("libraryList.not.found");
} }
List<Long> femaleModelIds = librarys.stream() List<Long> femaleModelIds = librarys.stream()
.filter(o -> o.getLevel1Type().equals(LibraryLevel1TypeEnum.MODELS.getRealName()) && o.getLevel2Type().equals(Sex.FEMALE.getValue())) .filter(o -> o.getLevel1Type().equals(LibraryLevel1TypeEnum.MODELS.getRealName()) && o.getLevel2Type().equals(Sex.FEMALE.getValue()))
@@ -412,7 +420,7 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
library.setUrl(sysFile.getUrl()); library.setUrl(sysFile.getUrl());
return library; return library;
} else { } else {
throw new BusinessException("system.error"); throw new BusinessException("unknown.modelType");
} }
} }
@@ -428,7 +436,7 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
public void updateLibraryName(LibraryUpdateDTO libraryUpdateDTO) { public void updateLibraryName(LibraryUpdateDTO libraryUpdateDTO) {
List<Library> librarys = getByIds(libraryUpdateDTO.getLibraryIds()); List<Library> librarys = getByIds(libraryUpdateDTO.getLibraryIds());
if (CollectionUtils.isEmpty(librarys)) { if (CollectionUtils.isEmpty(librarys)) {
throw new BusinessException("librarys.not.found"); throw new BusinessException("libraryList.not.found");
} }
QueryWrapper<Library> queryWrapper = new QueryWrapper<>(); QueryWrapper<Library> queryWrapper = new QueryWrapper<>();
queryWrapper.in("id", libraryUpdateDTO.getLibraryIds()); queryWrapper.in("id", libraryUpdateDTO.getLibraryIds());

View File

@@ -1,28 +1,13 @@
# 业务逻辑 # 不易报异常
system.error=System error! system.error=System error!
system.busy=System busy!
userName.does.not.exist=UserName does not exist!
user.expired=User expired!
password.error=Password error!
email.error=Email error!
unknown.authentication.operation.type=Unknown authentication operation type! unknown.authentication.operation.type=Unknown authentication operation type!
failed.to.send.mail=Failed to send mail! failed.to.send.mail=Failed to send mail!
email.does.not.exist=Email does not exist!
unknown.login.type=Unknown login type! unknown.login.type=Unknown login type!
error.login.type=Error login type! error.login.type=Error login type!
the.verification.code.has.expired=The verification code has expired!
verification.code.error=Verification code error!
user.has.bound.mailbox=User has bound mailbox!
get.moodBoards.data.is.mismatch=Get moodBoards data is mismatch! get.moodBoards.data.is.mismatch=Get moodBoards data is mismatch!
get.printBoards.data.is.mismatch=Get printBoards data is mismatch! get.printBoards.data.is.mismatch=Get printBoards data is mismatch!
get.sketchBoards.data.is.mismatch=Get sketchBoards data is mismatch! get.sketchBoards.data.is.mismatch=Get sketchBoards data is mismatch!
the.number.of.PIN.top.or.bottom.or.outerwear.sketchBoard.cannot.be.more.than.8=The number of PIN top or bottom or outerwear sketchBoard cannot be more than 8!
modelPoint.not.found=ModelPoint not found! modelPoint.not.found=ModelPoint not found!
attributeRetrieval.interface.exception=AttributeRetrieval interface exception, please try again later! If still failed after trying again please contact administrator!
design.interface.exception=Design interface exception, please try again later! If still failed after trying again please contact administrator!
processMannequins.interface.exception=ProcessMannequins interface exception, please try again later! If still failed after trying again please contact administrator!
designProcess.interface.exception=DesignProcess interface exception, please try again later! If still failed after trying again please contact administrator!
generate.interface.exception=Generate interface exception, please try again later! If still failed after trying again please contact administrator!
collection.not.found=Collection not found! collection.not.found=Collection not found!
design.not.found=Design not found! design.not.found=Design not found!
designItem.not.found=DesignItem not found! designItem.not.found=DesignItem not found!
@@ -32,9 +17,6 @@ new.designItemDetails.not.found=New designItemDetails not found!
save.workspace.failed=Save workspace failed! save.workspace.failed=Save workspace failed!
save.design.failed=Save design failed! save.design.failed=Save design failed!
update.workspace.failed=Update workspace failed! update.workspace.failed=Update workspace failed!
the.workspace.lastIndex.not.found=The workspace lastIndex not found!
the.workspaceName.already.exists=The workspaceName already exists!
unable.to.delete.the.workspace.you.are.currently.using=Unable to delete the workspace you are currently using!
enumeration.class.not.found=Enumeration class not found! enumeration.class.not.found=Enumeration class not found!
history.detail.not.found=History detail not found! history.detail.not.found=History detail not found!
designItemDetails.not.found=DesignItemDetails not found! designItemDetails.not.found=DesignItemDetails not found!
@@ -43,12 +25,10 @@ unknown.parameter.level1Type=Unknown parameter level1Type!
collectionElement.not.found=collectionElement not found! collectionElement.not.found=collectionElement not found!
select1.file.does.not.exist=Select1 file does not exist! select1.file.does.not.exist=Select1 file does not exist!
select2.file.does.not.exist=Select2 file does not exist! select2.file.does.not.exist=Select2 file does not exist!
generate.print.exception=Generate print exception! save.collectionElement.failed=Save collectionElement failed!
generate.print.failed=Generate print failed!
collectionElements.not.found=CollectionElements not found! collectionElements.not.found=CollectionElements not found!
batch.save.libraryList.failed=Batch save libraryList failed! batch.save.libraryList.failed=Batch save libraryList failed!
panTones.not.found=PanTones not found! panTones.not.found=PanTones not found!
hsv.value.cannot.exceed.the.maximum.of.8=Hsv value cannot exceed the maximum of 8!
save.designItem.failed=Save designItem failed! save.designItem.failed=Save designItem failed!
unknown.type=Unknown type! unknown.type=Unknown type!
unknown.operateType=Unknown operateType! unknown.operateType=Unknown operateType!
@@ -57,7 +37,7 @@ the.id.value.is.out.of.range=The id value is out of range!
library.not.found=Library not found! library.not.found=Library not found!
wrong.clothes.type=Wrong clothes type! wrong.clothes.type=Wrong clothes type!
sysFile.not.found=SysFile not found! sysFile.not.found=SysFile not found!
librarys.not.found=Librarys not found! libraryList.not.found=LibraryList not found!
groupDetails.not.found=GroupDetails not found! groupDetails.not.found=GroupDetails not found!
history.not.found=History not found! history.not.found=History not found!
unknown.parameter.level2Type=Unknown parameter level2Type! unknown.parameter.level2Type=Unknown parameter level2Type!
@@ -72,7 +52,6 @@ save.sysFile.failed=Save sysFile failed!
save.pythonTAllInfo.failed=Save pythonTAllInfo failed! save.pythonTAllInfo.failed=Save pythonTAllInfo failed!
save.collection.failed=Save collection failed! save.collection.failed=Save collection failed!
save.designItemDetail.failed=Save designItemDetail failed! save.designItemDetail.failed=Save designItemDetail failed!
save.classification.failed=Save classification failed! save.classification.failed=Save classification failed!
update.classification.failed=Update classification failed! update.classification.failed=Update classification failed!
please.input.the.caption=Please input the caption! please.input.the.caption=Please input the caption!
@@ -80,7 +59,6 @@ please.choose.an.image=Please choose an image!
please.input.the.caption.and.choose.an.image=Please input the caption and choose an image! please.input.the.caption.and.choose.an.image=Please input the caption and choose an image!
duplicate.likes.are.not.allowed=Duplicate likes are not allowed! duplicate.likes.are.not.allowed=Duplicate likes are not allowed!
layer.information.not.found=Layer information not found! layer.information.not.found=Layer information not found!
# 前端传参校验
singleOverall.cannot.be.empty=singleOverall cannot be empty! singleOverall.cannot.be.empty=singleOverall cannot be empty!
colorBoards.cannot.be.empty=colorBoards cannot be empty! colorBoards.cannot.be.empty=colorBoards cannot be empty!
systemScale.cannot.be.empty=systemScale cannot be empty! systemScale.cannot.be.empty=systemScale cannot be empty!
@@ -140,15 +118,34 @@ regionNum.cannot.be.empty=regionNum cannot be empty!
phone.cannot.be.empty=phone cannot be empty! phone.cannot.be.empty=phone cannot be empty!
printId.cannot.be.empty=printId cannot be empty! printId.cannot.be.empty=printId cannot be empty!
path.cannot.be.empty=path cannot be empty! path.cannot.be.empty=path cannot be empty!
classificationName.cannot.be.empty=classificationName cannot be empty! classificationName.cannot.be.empty=classificationName cannot be empty!
classificationName.already.exists=ClassificationName already exists, please change it!
the.classification.you.deleted.has.associated.library=The classification you deleted has associated data, are you sure you want to delete it!
the.model.has.been.referenced.by.the.workspace=The model has been referenced by the workspace, are you sure you want to delete it!
level2Type.cannot.be.empty=level2Type cannot be empty! level2Type.cannot.be.empty=level2Type cannot be empty!
generateItem.does.not.exist=generateItem does not exist! generateItem.does.not.exist=generateItem does not exist!
level1Type.does.not.match=level1Type does not match! level1Type.does.not.match=level1Type does not match!
the.image.does.not.exist.please.reselect=the image does not exist, please reselect! the.image.does.not.exist.please.reselect=the image does not exist, please reselect!
design.item.does.not.exist=design item does not exist! design.item.does.not.exist=design item does not exist!
layers.does.not.exists=layers does not exists! layers.does.not.exists=layers does not exists!
unknown.generate.type=unknown generate type! unknown.generate.type=unknown generate type!
# 可能会报异常
system.busy=System busy!
user.expired=User expired!
user.has.bound.mailbox=User has bound mailbox!
userName.does.not.exist=UserName does not exist!
password.error=Password error!
email.error=Email error!
email.does.not.exist=Email does not exist!
the.verification.code.has.expired=The verification code has expired!
verification.code.error=Verification code error!
the.number.of.PIN.top.or.bottom.or.outerwear.sketchBoard.cannot.be.more.than.8=The number of PIN top or bottom or outerwear sketchBoard cannot be more than 8!
attributeRetrieval.interface.exception=AttributeRetrieval interface exception, please try again later! If still failed after trying again please contact administrator!
design.interface.exception=Design interface exception, please try again later! If still failed after trying again please contact administrator!
processMannequins.interface.exception=ProcessMannequins interface exception, please try again later! If still failed after trying again please contact administrator!
designProcess.interface.exception=DesignProcess interface exception, please try again later! If still failed after trying again please contact administrator!
generate.interface.exception=Generate interface exception, please try again later! If still failed after trying again please contact administrator!
the.workspace.lastIndex.not.found=The workspace lastIndex not found!
the.workspaceName.already.exists=The workspaceName already exists!
unable.to.delete.the.workspace.you.are.currently.using=Unable to delete the workspace you are currently using!
hsv.value.cannot.exceed.the.maximum.of.8=Hsv value cannot exceed the maximum of 8!
classificationName.already.exists=ClassificationName already exists, please change it!
the.classification.you.deleted.has.associated.library=The classification you deleted has associated data, are you sure you want to delete it!
the.model.has.been.referenced.by.the.workspace=The model has been referenced by the workspace, are you sure you want to delete it!