Merge remote-tracking branch 'origin/main'

This commit is contained in:
2026-03-09 11:30:40 +08:00

View File

@@ -146,8 +146,10 @@ public class SimulationParameterLibraryServiceImpl extends ServiceImpl<Simulatio
SimulationParameterLibraryCategoryObject simulationParameterLibraryCategoryObject = new SimulationParameterLibraryCategoryObject();
BeanUtils.copyProperties(req, simulationParameterLibraryCategoryObject);
boolean isApprove = true;
// 兼容未上传文件的情况自动创建空JSON文件
if (inputFile == null || inputFile.isEmpty()) {
isApprove = false;
String fileName = req.getParameterLibraryCategoryObjectName();
String emptyJsonContent = "[]";
fileToUpload = new MockMultipartFile(fileName, fileName + ".json", "application/json", emptyJsonContent.getBytes(StandardCharsets.UTF_8));
@@ -173,24 +175,27 @@ public class SimulationParameterLibraryServiceImpl extends ServiceImpl<Simulatio
simulationParameterLibraryCategoryObject.setCreatorId(ThreadLocalContext.getUserId());
simulationParameterLibraryCategoryObjectService.save(simulationParameterLibraryCategoryObject);
FileMetadataInfo fileMetadataInfo = fileMetadataInfoService.getById(fileId);
// 参数库上传json文件内容
SimulationParameterLibraryCategoryObjectResp objectResp = getSimulationParameterLibraryCategoryObjectInner(simulationParameterLibraryCategoryObject.getId());
ApprovalParamContentsModel contentsModel = new ApprovalParamContentsModel();
contentsModel.setIds(Arrays.asList(fileId));
contentsModel.setApproveAction(ApproveFileActionENUM.ADD.getCode());
contentsModel.setContents("参数库文件新增");
contentsModel.setFileInfo(fileMetadataInfo);
contentsModel.setParamData(objectResp);
contentsModel.setId(simulationParameterLibraryCategoryObject.getId());
contentsModel.setType(SimulationParameterDataTypeEnum.OBJECT.getValue());
// 发起审批
String cidFlowId = launchParamApprove(req.getTemplateId(),req.getTemplateName(), JSONObject.toJSONString(contentsModel),ApproveFileActionENUM.ADD.getCode());
if (StringUtils.isEmpty(cidFlowId)) {
return SdmResponse.failed("发起评审失败");
// 上传了文件才需要审批
if (isApprove) {
FileMetadataInfo fileMetadataInfo = fileMetadataInfoService.getById(fileId);
// 参数库上传json文件内容
SimulationParameterLibraryCategoryObjectResp objectResp = getSimulationParameterLibraryCategoryObjectInner(simulationParameterLibraryCategoryObject.getId());
ApprovalParamContentsModel contentsModel = new ApprovalParamContentsModel();
contentsModel.setIds(Arrays.asList(fileId));
contentsModel.setApproveAction(ApproveFileActionENUM.ADD.getCode());
contentsModel.setContents("参数库文件新增");
contentsModel.setFileInfo(fileMetadataInfo);
contentsModel.setParamData(objectResp);
contentsModel.setId(simulationParameterLibraryCategoryObject.getId());
contentsModel.setType(SimulationParameterDataTypeEnum.OBJECT.getValue());
// 发起审批
String cidFlowId = launchParamApprove(req.getTemplateId(),req.getTemplateName(), JSONObject.toJSONString(contentsModel),ApproveFileActionENUM.ADD.getCode());
if (StringUtils.isEmpty(cidFlowId)) {
return SdmResponse.failed("发起评审失败");
}
fileMetadataInfo.setCidFlowId(cidFlowId);
fileMetadataInfoService.updateById(fileMetadataInfo);
}
fileMetadataInfo.setCidFlowId(cidFlowId);
fileMetadataInfoService.updateById(fileMetadataInfo);
} catch (Exception e) {
log.error("仿真参数库文件上传失败", e);
return SdmResponse.failed("仿真参数库文件上传失败");