fix:参数库审批拒绝流程
This commit is contained in:
@@ -66,4 +66,6 @@ public interface ISimulationParameterLibraryService extends IService<SimulationP
|
||||
// 获取仿真参数库分类参数对象
|
||||
SdmResponse<SimulationParameterLibraryCategoryObjectResp> getSimulationParameterLibraryCategoryObject(Long ObjectId);
|
||||
|
||||
SdmResponse recoverParamFileStatus(SimulationParamLibraryReq req);
|
||||
|
||||
}
|
||||
|
||||
@@ -1768,6 +1768,13 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
updateParameterReq.setApprove(false);
|
||||
simulationParameterLibraryService.updateSimulationParameterValues(updateParameterReq);
|
||||
}
|
||||
// 审批不通过 还原文件状态
|
||||
if (NumberConstants.THREE == approveStatus) {
|
||||
SimulationParamLibraryReq libraryReq = new SimulationParamLibraryReq();
|
||||
libraryReq.setType(type);
|
||||
libraryReq.setId(id);
|
||||
simulationParameterLibraryService.recoverParamFileStatus(libraryReq);
|
||||
}
|
||||
} else if (ApproveFileDataTypeEnum.DELETE_REVIEWING.getCode() == approveAction) {
|
||||
// 审批通过 执行删除 审批不通过 不处理
|
||||
if (NumberConstants.TWO == approveStatus) {
|
||||
@@ -1777,6 +1784,13 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
libraryReq.setApprove(false);
|
||||
simulationParameterLibraryService.deleteSimulationParameter(libraryReq);
|
||||
}
|
||||
// 审批不通过 还原文件状态
|
||||
if (NumberConstants.THREE == approveStatus) {
|
||||
SimulationParamLibraryReq libraryReq = new SimulationParamLibraryReq();
|
||||
libraryReq.setType(type);
|
||||
libraryReq.setId(id);
|
||||
simulationParameterLibraryService.recoverParamFileStatus(libraryReq);
|
||||
}
|
||||
}
|
||||
return SdmResponse.success();
|
||||
}
|
||||
|
||||
@@ -344,26 +344,26 @@ public class SimulationParameterLibraryServiceImpl extends ServiceImpl<Simulatio
|
||||
simulationParameterLibraryCategoryObjectService.removeById(req.getId());
|
||||
}
|
||||
} else if (req.getType() == SimulationParameterDataTypeEnum.CATEGORY.getValue()) {
|
||||
List<SimulationParameterLibraryCategoryObject> objectList = simulationParameterLibraryCategoryObjectService.lambdaQuery().eq(SimulationParameterLibraryCategoryObject::getParameterLibraryCategoryId, req.getId()).list();
|
||||
SdmResponse checkResult = checkApprove(objectList);
|
||||
if (!checkResult.isSuccess()) {
|
||||
return checkResult;
|
||||
}
|
||||
if (req.isApprove()) {
|
||||
SdmResponse response = deleteApprove(req);
|
||||
List<SimulationParameterLibraryCategoryObject> objectList = simulationParameterLibraryCategoryObjectService.lambdaQuery().eq(SimulationParameterLibraryCategoryObject::getParameterLibraryCategoryId, req.getId()).list();
|
||||
SdmResponse checkResult = checkApprove(objectList);
|
||||
if (!checkResult.isSuccess()) {
|
||||
return checkResult;
|
||||
}
|
||||
SdmResponse response = deleteApprove(req, objectList);
|
||||
return response;
|
||||
} else {
|
||||
simulationParameterLibraryCategoryService.removeById(req.getId());
|
||||
simulationParameterLibraryCategoryObjectService.lambdaUpdate().eq(SimulationParameterLibraryCategoryObject::getParameterLibraryCategoryId, req.getId()).remove();
|
||||
}
|
||||
} else if (req.getType() == SimulationParameterDataTypeEnum.LIBRARY.getValue()) {
|
||||
List<SimulationParameterLibraryCategoryObject> objectList = simulationParameterLibraryCategoryObjectService.lambdaQuery().eq(SimulationParameterLibraryCategoryObject::getParameterLibraryId, req.getId()).list();
|
||||
SdmResponse checkResult = checkApprove(objectList);
|
||||
if (!checkResult.isSuccess()) {
|
||||
return checkResult;
|
||||
}
|
||||
if (req.isApprove()) {
|
||||
SdmResponse response = deleteApprove(req);
|
||||
List<SimulationParameterLibraryCategoryObject> objectList = simulationParameterLibraryCategoryObjectService.lambdaQuery().eq(SimulationParameterLibraryCategoryObject::getParameterLibraryId, req.getId()).list();
|
||||
SdmResponse checkResult = checkApprove(objectList);
|
||||
if (!checkResult.isSuccess()) {
|
||||
return checkResult;
|
||||
}
|
||||
SdmResponse response = deleteApprove(req, objectList);
|
||||
return response;
|
||||
} else {
|
||||
this.removeById(req.getId());
|
||||
@@ -385,7 +385,7 @@ public class SimulationParameterLibraryServiceImpl extends ServiceImpl<Simulatio
|
||||
return SdmResponse.success();
|
||||
}
|
||||
|
||||
private SdmResponse deleteApprove(SimulationParamLibraryReq req) {
|
||||
private SdmResponse deleteApprove(SimulationParamLibraryReq req, List<SimulationParameterLibraryCategoryObject> objectList) {
|
||||
ApprovalParamContentsModel contentsModel = new ApprovalParamContentsModel();
|
||||
contentsModel.setApproveAction(ApproveFileActionENUM.DELETE.getCode());
|
||||
contentsModel.setContents("参数库文件删除");
|
||||
@@ -396,6 +396,15 @@ public class SimulationParameterLibraryServiceImpl extends ServiceImpl<Simulatio
|
||||
if (StringUtils.isEmpty(cidFlowId)) {
|
||||
return SdmResponse.failed("发起评审失败");
|
||||
}
|
||||
List<Long> fileIds = objectList.stream().map(SimulationParameterLibraryCategoryObject::getFileId).filter(ObjectUtils::isNotEmpty).toList();
|
||||
if (!CollectionUtils.isEmpty(fileIds)) {
|
||||
List<FileMetadataInfo> fileMetadataInfoList = fileMetadataInfoService.listByIds(fileIds);
|
||||
fileMetadataInfoList.forEach(i -> {
|
||||
i.setApprovalStatus(ApprovalFileDataStatusEnum.PENDING.getKey());
|
||||
i.setApproveType(ApproveFileDataTypeEnum.DELETE_REVIEWING.getCode());
|
||||
});
|
||||
fileMetadataInfoService.updateBatchById(fileMetadataInfoList);
|
||||
}
|
||||
return SdmResponse.success(cidFlowId);
|
||||
}
|
||||
|
||||
@@ -403,6 +412,9 @@ public class SimulationParameterLibraryServiceImpl extends ServiceImpl<Simulatio
|
||||
// 发起审批 审批通过后才能删除
|
||||
SimulationParameterLibraryCategoryObject object = simulationParameterLibraryCategoryObjectService.getById(req.getId());
|
||||
FileMetadataInfo deleteFileMetadataInfo = fileMetadataInfoService.getById(object.getFileId());
|
||||
if (ApprovalFileDataStatusEnum.PENDING.getKey().equals(deleteFileMetadataInfo.getApprovalStatus())) {
|
||||
return SdmResponse.failed("文件有在进行中的审批,无法删除");
|
||||
}
|
||||
// 参数库上传json文件内容
|
||||
SimulationParameterLibraryCategoryObjectResp objectResp = getSimulationParameterLibraryCategoryObjectInner(req.getId());
|
||||
ApprovalParamContentsModel contentsModel = new ApprovalParamContentsModel();
|
||||
@@ -459,6 +471,28 @@ public class SimulationParameterLibraryServiceImpl extends ServiceImpl<Simulatio
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse recoverParamFileStatus(SimulationParamLibraryReq req) {
|
||||
List<SimulationParameterLibraryCategoryObject> objectList = new ArrayList<>();
|
||||
if (req.getType() == SimulationParameterDataTypeEnum.LIBRARY.getValue()) {
|
||||
objectList = simulationParameterLibraryCategoryObjectService.lambdaQuery().eq(SimulationParameterLibraryCategoryObject::getParameterLibraryId, req.getId()).list();
|
||||
} else if (req.getType() == SimulationParameterDataTypeEnum.CATEGORY.getValue()) {
|
||||
objectList = simulationParameterLibraryCategoryObjectService.lambdaQuery().eq(SimulationParameterLibraryCategoryObject::getParameterLibraryCategoryId, req.getId()).list();
|
||||
} else {
|
||||
objectList = simulationParameterLibraryCategoryObjectService.lambdaQuery().eq(SimulationParameterLibraryCategoryObject::getId, req.getId()).list();
|
||||
}
|
||||
List<Long> fileIds = objectList.stream().map(SimulationParameterLibraryCategoryObject::getFileId).filter(ObjectUtils::isNotEmpty).toList();
|
||||
if (!CollectionUtils.isEmpty(fileIds)) {
|
||||
List<FileMetadataInfo> fileMetadataInfoList = fileMetadataInfoService.listByIds(fileIds);
|
||||
fileMetadataInfoList.forEach(i -> {
|
||||
i.setApprovalStatus(ApprovalFileDataStatusEnum.REJECTED.getKey());
|
||||
i.setApproveType(ApproveFileDataTypeEnum.COMPLETED.getCode());
|
||||
});
|
||||
fileMetadataInfoService.updateBatchById(fileMetadataInfoList);
|
||||
}
|
||||
return SdmResponse.success();
|
||||
}
|
||||
|
||||
private SimulationParameterLibraryCategoryObjectResp getSimulationParameterLibraryCategoryObjectInner(Long ObjectId) {
|
||||
SimulationParameterLibraryCategoryObject simulationParameterLibraryCategoryObject = simulationParameterLibraryCategoryObjectService.getById(ObjectId);
|
||||
SimulationParameterLibraryCategoryObjectResp resp = new SimulationParameterLibraryCategoryObjectResp();
|
||||
@@ -611,6 +645,7 @@ public class SimulationParameterLibraryServiceImpl extends ServiceImpl<Simulatio
|
||||
contentsModel.setFileInfo(fileMetadataInfo);
|
||||
contentsModel.setParamData(objectResp);
|
||||
contentsModel.setType(SimulationParameterDataTypeEnum.OBJECT.getValue());
|
||||
contentsModel.setId(object.getId());
|
||||
contentsModel.setUpdateParameterReq(req);
|
||||
|
||||
// 发起审批
|
||||
|
||||
Reference in New Issue
Block a user