fix:公差分析库也需要走审批
This commit is contained in:
@@ -107,4 +107,46 @@ public enum DirTypeEnum {
|
|||||||
public static final List<DirTypeEnum> getInitSpmdDir() {
|
public static final List<DirTypeEnum> getInitSpmdDir() {
|
||||||
return INIT_SPMD_DIR;
|
return INIT_SPMD_DIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 需要走审批流程的目录类型列表
|
||||||
|
* 目前包括:知识库、公差分析库
|
||||||
|
*/
|
||||||
|
private static final List<DirTypeEnum> APPROVAL_REQUIRED_DIRS = List.of(
|
||||||
|
DirTypeEnum.KNOWLEDGE_BASE_DIR,
|
||||||
|
DirTypeEnum.TOLERANCE_ANALYSIS_DIR
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取需要走审批流程的目录类型列表
|
||||||
|
* @return 需要审批的目录类型列表
|
||||||
|
*/
|
||||||
|
public static List<DirTypeEnum> getApprovalRequiredDirs() {
|
||||||
|
return APPROVAL_REQUIRED_DIRS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断指定目录类型是否需要走审批流程
|
||||||
|
* @param dirType 目录类型值
|
||||||
|
* @return true-需要审批,false-不需要审批
|
||||||
|
*/
|
||||||
|
public static boolean isApprovalRequired(Integer dirType) {
|
||||||
|
if (dirType == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return APPROVAL_REQUIRED_DIRS.stream()
|
||||||
|
.anyMatch(dir -> dir.getValue() == dirType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断指定目录类型枚举是否需要走审批流程
|
||||||
|
* @param dirTypeEnum 目录类型枚举
|
||||||
|
* @return true-需要审批,false-不需要审批
|
||||||
|
*/
|
||||||
|
public static boolean isApprovalRequired(DirTypeEnum dirTypeEnum) {
|
||||||
|
if (dirTypeEnum == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return APPROVAL_REQUIRED_DIRS.contains(dirTypeEnum);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -548,9 +548,9 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
|||||||
.eq(FileMetadataInfo::getParentId, rootDirId)
|
.eq(FileMetadataInfo::getParentId, rootDirId)
|
||||||
.exists();
|
.exists();
|
||||||
|
|
||||||
// 3. 知识库且非空目录:走审批流程,审批通过后由 DeleteApproveStrategy 移入回收站
|
// 3. 需要审批的目录类型且非空:走审批流程,审批通过后由 DeleteApproveStrategy 移入回收站
|
||||||
boolean isKnowledgeDir = Objects.equals(DirTypeEnum.KNOWLEDGE_BASE_DIR.getValue(), dirType);
|
boolean requiresApproval = DirTypeEnum.isApprovalRequired(dirType);
|
||||||
if (isKnowledgeDir && hasChildren) {
|
if (requiresApproval && hasChildren) {
|
||||||
Set<Long> allFileIds = new HashSet<>();
|
Set<Long> allFileIds = new HashSet<>();
|
||||||
Set<Long> allDirIds = new HashSet<>();
|
Set<Long> allDirIds = new HashSet<>();
|
||||||
collectRecursiveIds(rootDirId, allFileIds, allDirIds);
|
collectRecursiveIds(rootDirId, allFileIds, allDirIds);
|
||||||
@@ -705,8 +705,8 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
|||||||
.eq(FileMetadataInfo::getDataType, DataTypeEnum.DIRECTORY.getValue())
|
.eq(FileMetadataInfo::getDataType, DataTypeEnum.DIRECTORY.getValue())
|
||||||
.one();
|
.one();
|
||||||
|
|
||||||
// 知识库文件:走审批流程,审批通过后由 DeleteApproveStrategy 移入回收站
|
// 需要审批的目录类型下的文件:走审批流程,审批通过后由 DeleteApproveStrategy 移入回收站
|
||||||
if (dirMetadataInfo != null && Objects.equals(DirTypeEnum.KNOWLEDGE_BASE_DIR.getValue(), dirMetadataInfo.getDirType())) {
|
if (dirMetadataInfo != null && DirTypeEnum.isApprovalRequired(dirMetadataInfo.getDirType())) {
|
||||||
return launchKnowledgeBaseDeletionApproval(
|
return launchKnowledgeBaseDeletionApproval(
|
||||||
List.of(deleteFileMetadataInfo),
|
List.of(deleteFileMetadataInfo),
|
||||||
Set.of(delFileId),
|
Set.of(delFileId),
|
||||||
@@ -787,8 +787,8 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
|||||||
queryBigFileReq.setFileSuffix(queryBigFileReq.getFileSuffix().toLowerCase());
|
queryBigFileReq.setFileSuffix(queryBigFileReq.getFileSuffix().toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Objects.equals(DirTypeEnum.KNOWLEDGE_BASE_DIR.getValue(), dirType)) {
|
if (DirTypeEnum.isApprovalRequired(dirType)) {
|
||||||
// 知识库文件:排除新增在审批的文件
|
// 需要审批的目录类型:排除新增在审批的文件
|
||||||
queryBigFileReq.setApproveTypeList(fileDatdList);
|
queryBigFileReq.setApproveTypeList(fileDatdList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1881,7 +1881,7 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
|||||||
fileInfo.setTemplateId(req.getTemplateId());
|
fileInfo.setTemplateId(req.getTemplateId());
|
||||||
fileInfo.setTemplateName(req.getTemplateName());
|
fileInfo.setTemplateName(req.getTemplateName());
|
||||||
|
|
||||||
boolean isknowledge = Objects.equals(DirTypeEnum.KNOWLEDGE_BASE_DIR.getValue(), dirMetadataInfo.getDirType());
|
boolean isknowledge = DirTypeEnum.isApprovalRequired(dirMetadataInfo.getDirType());
|
||||||
if (isknowledge) {
|
if (isknowledge) {
|
||||||
fileInfo.setApprovalStatus(ApprovalFileDataStatusEnum.PENDING.getKey());
|
fileInfo.setApprovalStatus(ApprovalFileDataStatusEnum.PENDING.getKey());
|
||||||
fileInfo.setApproveType(ApproveFileDataTypeEnum.UPLOAD_REVIEWING.getCode());
|
fileInfo.setApproveType(ApproveFileDataTypeEnum.UPLOAD_REVIEWING.getCode());
|
||||||
@@ -2185,7 +2185,7 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void triggerKnowledgeApproveIfNeeded(UploadFilesReq req, FileMetadataInfo fileInfo, FileMetadataInfo dirMetadataInfo) {
|
private void triggerKnowledgeApproveIfNeeded(UploadFilesReq req, FileMetadataInfo fileInfo, FileMetadataInfo dirMetadataInfo) {
|
||||||
if (!Objects.equals(DirTypeEnum.KNOWLEDGE_BASE_DIR.getValue(), dirMetadataInfo.getDirType())) {
|
if (!DirTypeEnum.isApprovalRequired(dirMetadataInfo.getDirType())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FileApproveRequestBuilder uploadFileApproveRequestBuilder = FileApproveRequestBuilder.builder()
|
FileApproveRequestBuilder uploadFileApproveRequestBuilder = FileApproveRequestBuilder.builder()
|
||||||
@@ -2343,8 +2343,8 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
|||||||
Long versionNo = fileMetadataInfo.getVersionNo();
|
Long versionNo = fileMetadataInfo.getVersionNo();
|
||||||
// 修改待审批的元数据主键id
|
// 修改待审批的元数据主键id
|
||||||
if (ObjectUtils.isEmpty(req.getFile())) {
|
if (ObjectUtils.isEmpty(req.getFile())) {
|
||||||
// 知识库,增加审批的逻辑,先将原始数据改成待审核状态
|
// 需要审批的目录类型,增加审批的逻辑,先将原始数据改成待审核状态
|
||||||
if(dirMetadataInfo!=null&&Objects.equals(DirTypeEnum.KNOWLEDGE_BASE_DIR.getValue(), dirMetadataInfo.getDirType())){
|
if(dirMetadataInfo!=null && DirTypeEnum.isApprovalRequired(dirMetadataInfo.getDirType())){
|
||||||
FileMetadataInfo tempFileMetadataInfo = new FileMetadataInfo();
|
FileMetadataInfo tempFileMetadataInfo = new FileMetadataInfo();
|
||||||
BeanUtils.copyProperties(fileMetadataInfo, tempFileMetadataInfo);
|
BeanUtils.copyProperties(fileMetadataInfo, tempFileMetadataInfo);
|
||||||
// 不需要上传minio新文件,只更新文件元数据
|
// 不需要上传minio新文件,只更新文件元数据
|
||||||
@@ -2530,9 +2530,9 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
|||||||
// 创建默认权限记录
|
// 创建默认权限记录
|
||||||
createFilePermission(newFileInfo.getId());
|
createFilePermission(newFileInfo.getId());
|
||||||
|
|
||||||
// 知识库创建审批流
|
// 需要审批的目录类型创建审批流
|
||||||
boolean isKnowledge = dirMetadataInfo != null && Objects.equals(DirTypeEnum.KNOWLEDGE_BASE_DIR.getValue(), dirMetadataInfo.getDirType());
|
boolean isKnowledge = dirMetadataInfo != null && DirTypeEnum.isApprovalRequired(dirMetadataInfo.getDirType());
|
||||||
// 知识库修改
|
// 需要审批的目录类型修改
|
||||||
if(isKnowledge){
|
if(isKnowledge){
|
||||||
// 新增的一条暂时不展示
|
// 新增的一条暂时不展示
|
||||||
newFileInfo.setIsLatest(false);
|
newFileInfo.setIsLatest(false);
|
||||||
@@ -3362,8 +3362,7 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
|||||||
.eq(FileMetadataInfo::getId, parentId)
|
.eq(FileMetadataInfo::getId, parentId)
|
||||||
.eq(FileMetadataInfo::getDataType, DataTypeEnum.DIRECTORY.getValue())
|
.eq(FileMetadataInfo::getDataType, DataTypeEnum.DIRECTORY.getValue())
|
||||||
.one();
|
.one();
|
||||||
boolean isKnowledge = dirMetadataInfo != null &&
|
boolean isKnowledge = dirMetadataInfo != null && DirTypeEnum.isApprovalRequired(dirMetadataInfo.getDirType());
|
||||||
Objects.equals(DirTypeEnum.KNOWLEDGE_BASE_DIR.getValue(), dirMetadataInfo.getDirType());
|
|
||||||
|
|
||||||
if (isKnowledge) {
|
if (isKnowledge) {
|
||||||
// 构建审批内容
|
// 构建审批内容
|
||||||
|
|||||||
Reference in New Issue
Block a user