feat:任务执行流程
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.sdm.project.controller;
|
||||
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.req.capability.FlowNodeDto;
|
||||
import com.sdm.common.entity.req.data.CreateDirReq;
|
||||
import com.sdm.common.entity.req.data.KnowledgeCallBackReq;
|
||||
import com.sdm.common.entity.req.data.QueryDirReq;
|
||||
@@ -194,4 +195,12 @@ public class SimulationRunController {
|
||||
return runService.saveNodeParams(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务执行 查询流程节点列表
|
||||
*/
|
||||
@PostMapping("/listFlowNodes")
|
||||
public SdmResponse<List<FlowNodeDto>> listFlowNodes(@RequestBody SpdmTaskRunReq req) {
|
||||
return runService.listFlowNodes(req);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -93,36 +93,6 @@ public class SimulationRun implements Serializable {
|
||||
@TableField("englishName")
|
||||
private Long englishName;
|
||||
|
||||
@TableField("tag1")
|
||||
private String tag1;
|
||||
|
||||
@TableField("tag2")
|
||||
private String tag2;
|
||||
|
||||
@TableField("tag3")
|
||||
private String tag3;
|
||||
|
||||
@TableField("tag4")
|
||||
private String tag4;
|
||||
|
||||
@TableField("tag5")
|
||||
private String tag5;
|
||||
|
||||
@TableField("tag6")
|
||||
private String tag6;
|
||||
|
||||
@TableField("tag7")
|
||||
private String tag7;
|
||||
|
||||
@TableField("tag8")
|
||||
private String tag8;
|
||||
|
||||
@TableField("tag9")
|
||||
private String tag9;
|
||||
|
||||
@TableField("tag10")
|
||||
private String tag10;
|
||||
|
||||
@Schema(description= "创建者ID")
|
||||
@TableField("creator")
|
||||
private Long creator;
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.sdm.project.model.req;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class SpdmNodeParamReq {
|
||||
|
||||
@@ -12,11 +14,14 @@ public class SpdmNodeParamReq {
|
||||
@Schema(description = "算例uuid")
|
||||
private String runId;
|
||||
|
||||
@Schema(description = "上传脚本文件id")
|
||||
private String scriptFileId;
|
||||
@Schema(description = "用户输入的参数")
|
||||
private Map<String, Object> inputParams;
|
||||
|
||||
@Schema(description = "用户输入的正则表达式参数")
|
||||
private String regExp;
|
||||
// @Schema(description = "上传脚本文件id")
|
||||
// private String scriptFileId;
|
||||
//
|
||||
// @Schema(description = "用户输入的正则表达式参数")
|
||||
// private String regExp;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.sdm.project.service;
|
||||
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.req.capability.FlowNodeDto;
|
||||
import com.sdm.common.entity.req.data.CreateDirReq;
|
||||
import com.sdm.common.entity.req.data.KnowledgeCallBackReq;
|
||||
import com.sdm.common.entity.req.data.QueryDirReq;
|
||||
@@ -61,4 +62,6 @@ public interface ISimulationRunService extends IService<SimulationRun> {
|
||||
SdmResponse startProcessInstance(SpdmTaskRunReq req);
|
||||
|
||||
SdmResponse saveNodeParams(SpdmNodeParamReq req);
|
||||
|
||||
SdmResponse<List<FlowNodeDto>> listFlowNodes(SpdmTaskRunReq req);
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.sdm.common.common.ThreadLocalContext;
|
||||
import com.sdm.common.entity.enums.DirTypeEnum;
|
||||
import com.sdm.common.entity.enums.NodeTypeEnum;
|
||||
import com.sdm.common.entity.flowable.dto.FlowElementDTO;
|
||||
import com.sdm.common.entity.flowable.dto.NodeStructureInfo;
|
||||
import com.sdm.common.entity.flowable.dto.ProcessDefinitionDTO;
|
||||
import com.sdm.common.entity.req.capability.FlowNodeDto;
|
||||
import com.sdm.common.entity.req.data.*;
|
||||
@@ -21,6 +22,7 @@ import com.sdm.common.entity.resp.PageDataResp;
|
||||
import com.sdm.common.entity.resp.capability.FlowTemplateResp;
|
||||
import com.sdm.common.entity.resp.data.BatchAddFileInfoResp;
|
||||
import com.sdm.common.entity.resp.data.FileMetadataInfoResp;
|
||||
import com.sdm.common.entity.resp.flowable.ProcessInstanceDetailResponse;
|
||||
import com.sdm.common.entity.resp.flowable.ProcessInstanceResp;
|
||||
import com.sdm.common.entity.resp.system.CIDUserResp;
|
||||
import com.sdm.common.feign.impl.capability.SimulationFlowFeignClientImpl;
|
||||
@@ -565,6 +567,9 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
|
||||
List<FlowNodeDto> flowNodeDtoList = new ArrayList<>();
|
||||
ProcessDefinitionDTO definitionDTO = JSON.parseObject(flowTemplateResp.getData().getTemplateContent(), ProcessDefinitionDTO.class);
|
||||
for (FlowElementDTO flowElement : definitionDTO.getFlowElements()) {
|
||||
if (flowElement.getName() == null) {
|
||||
continue;
|
||||
}
|
||||
FlowNodeDto flowNodeDto = new FlowNodeDto();
|
||||
flowNodeDto.setUuid(generateUuid("flow_node_"));
|
||||
flowNodeDto.setNodeName(flowElement.getName());
|
||||
@@ -952,9 +957,8 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
|
||||
// 脚本节点
|
||||
// 处理脚本上传到当前节点文件夹下,获得 脚本文件id
|
||||
// 脚本文件id 保存到用户输入参数
|
||||
params.put("scriptFileId", req.getScriptFileId());
|
||||
// 正则表达式 保存到用户输入参数
|
||||
params.put("regExp", req.getRegExp());
|
||||
params.putAll(req.getInputParams());
|
||||
// 脚本输出文件夹id 保存到用户输入参数
|
||||
params.put("outputDirId", flowNodeDto.getOutputDirId());
|
||||
}
|
||||
@@ -967,6 +971,41 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse<List<FlowNodeDto>> listFlowNodes(SpdmTaskRunReq req) {
|
||||
FlowNodeDto nodeReq = new FlowNodeDto();
|
||||
nodeReq.setRunId(req.getRunId());
|
||||
SdmResponse<List<FlowNodeDto>> sdmResponse = flowFeignClient.listSimulationFlowNode(nodeReq);
|
||||
if (sdmResponse.getData() != null) {
|
||||
List<FlowNodeDto> flowNodeDtoList = sdmResponse.getData();
|
||||
SimulationRun simulationRun = this.lambdaQuery().eq(SimulationRun::getUuid, req.getRunId()).one();
|
||||
if (simulationRun.getFlowInstanceId() != null) {
|
||||
SdmResponse<ProcessInstanceDetailResponse> response = flowableFeignClient.getProcessAndNodeDetailByInstanceId(simulationRun.getFlowInstanceId());
|
||||
if (response.getData() != null && CollectionUtils.isNotEmpty(response.getData().getNodes())) {
|
||||
for (FlowNodeDto flowNodeDto : flowNodeDtoList) {
|
||||
response.getData().getNodes().stream().filter(i -> StringUtils.equals(i.getId(), flowNodeDto.getNodeId())).findFirst().ifPresent(i -> {
|
||||
flowNodeDto.setNodeStatus(i.getStatus());
|
||||
});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
flowNodeDtoList.forEach(node -> {
|
||||
node.setNodeStatus("pending");
|
||||
});
|
||||
}
|
||||
List<NodeStructureInfo> nodeStructureInfoList = flowableFeignClient.listNodesByProcessDefinitionId(simulationRun.getProcessDefinitionId()).getData();
|
||||
if (CollectionUtils.isNotEmpty(nodeStructureInfoList)) {
|
||||
for (FlowNodeDto flowNodeDto : flowNodeDtoList) {
|
||||
nodeStructureInfoList.stream().filter(i -> StringUtils.equals(i.getId(), flowNodeDto.getNodeId())).findFirst().ifPresent(i -> {
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
return SdmResponse.success(flowNodeDtoList);
|
||||
}
|
||||
return SdmResponse.success(new ArrayList<>());
|
||||
}
|
||||
|
||||
public static void deleteFolder(File folder) {
|
||||
if (folder.isDirectory()) {
|
||||
File[] files = folder.listFiles();
|
||||
|
||||
Reference in New Issue
Block a user