feat:任务执行流程用户输入参数

This commit is contained in:
2025-12-01 14:16:10 +08:00
parent 3c157d4b76
commit eadb722c7c
5 changed files with 53 additions and 14 deletions

View File

@@ -8,15 +8,15 @@ public class SpdmNodeParamReq {
@Schema(description = "节点uuid")
private String nodeUuid;
@Schema(description = "算例uuid")
private String runId;
@Schema(description = "上传脚本文件id")
private String scriptFileId;
@Schema(description = "用户输入的正则表达式参数")
private String regExp;
}

View File

@@ -920,10 +920,11 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
@Transactional(rollbackFor = Exception.class)
public SdmResponse startProcessInstance(SpdmTaskRunReq req) {
SimulationRun simulationRun = this.lambdaQuery().eq(SimulationRun::getUuid, req.getRunId()).one();
// 启动流程实例 多次执行会生成多个流程实例id更新算例run表
// 启动流程实例 多次执行会生成多个流程实例id更新算例run表、同时更新flowable流程参数的流程实例id
SdmResponse<ProcessInstanceResp> sdmResponse = flowableFeignClient.startByProcessDefinitionId(simulationRun.getProcessDefinitionId(), null);
if (sdmResponse.getData() != null) {
this.lambdaUpdate().set(SimulationRun::getFlowInstanceId, sdmResponse.getData().getProcessInstanceId()).eq(SimulationRun::getUuid, req.getRunId()).update();
flowableFeignClient.updateNodeParamProcessInstanceId(simulationRun.getProcessDefinitionId(), sdmResponse.getData().getProcessInstanceId());
} else {
return SdmResponse.failed("流程实例启动失败");
}
@@ -932,14 +933,35 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
@Override
public SdmResponse saveNodeParams(SpdmNodeParamReq req) {
FlowNodeDto flowNodeReq = new FlowNodeDto();
flowNodeReq.setUuid(req.getNodeUuid());
SdmResponse<FlowNodeDto> sdmResponse = flowFeignClient.querySimulationFlowNode(flowNodeReq);
if (sdmResponse.getData() != null) {
// ProcessDefinitionDTO definitionDTO = JSON.parseObject(sdmResponse.getData().get(), ProcessDefinitionDTO.class);
FlowNodeDto flowNodeDto = sdmResponse.getData();
SimulationRun simulationRun = this.lambdaQuery().eq(SimulationRun::getUuid, req.getRunId()).one();
SdmResponse<FlowTemplateResp> flowTemplateResp = flowFeignClient.queryFlowTemplateInfo(simulationRun.getFlowTemplate());
if (flowTemplateResp.getData() != null) {
ProcessDefinitionDTO definitionDTO = JSON.parseObject(flowTemplateResp.getData().getTemplateContent(), ProcessDefinitionDTO.class);
FlowNodeDto flowNodeReq = new FlowNodeDto();
flowNodeReq.setUuid(req.getNodeUuid());
SdmResponse<FlowNodeDto> sdmResponse = flowFeignClient.querySimulationFlowNode(flowNodeReq);
if (sdmResponse.getData() != null) {
FlowNodeDto flowNodeDto = sdmResponse.getData();
definitionDTO.getFlowElements().stream().filter(i -> StringUtils.equals(i.getId(), flowNodeDto.getNodeId())).findFirst().ifPresent(i -> {
if (i.getExtensionElements() != null && i.getExtensionElements().getExecuteConfig() != null) {
Map<String, Object> params = new HashMap<>();
if ("HPC".equals(i.getExtensionElements().getExecuteConfig().getExecuteType())) {
// 计算节点 输出文件夹id 保存到用户输入参数
params.put("outputDirId", flowNodeDto.getOutputDirId());
} else if ("exportWordScript".equals(i.getExtensionElements().getExecuteConfig().getExecuteType())) {
// 脚本节点
// 处理脚本上传到当前节点文件夹下,获得 脚本文件id
// 脚本文件id 保存到用户输入参数
params.put("scriptFileId", req.getScriptFileId());
// 正则表达式 保存到用户输入参数
params.put("regExp", req.getRegExp());
// 脚本输出文件夹id 保存到用户输入参数
params.put("outputDirId", flowNodeDto.getOutputDirId());
}
flowableFeignClient.saveParamsByDefinitionId(simulationRun.getProcessDefinitionId(), flowNodeDto.getNodeId(), params);
}
});
}
}
return null;