feat:任务执行流程
This commit is contained in:
@@ -129,4 +129,9 @@ public class FlowController implements ISimulationFlowFeignClient {
|
||||
return simulationFlowNodeService.listSimulationFlowNode(req);
|
||||
}
|
||||
|
||||
@PostMapping("/node/querySimulationFlowNode")
|
||||
public SdmResponse<FlowNodeDto> querySimulationFlowNode(@RequestBody FlowNodeDto req) {
|
||||
return simulationFlowNodeService.querySimulationFlowNode(req);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ public interface FlowMapper {
|
||||
@Insert("INSERT INTO simulation_flow_template(uuid,templateName,templateVersion,templateContent,viewContent,parentUuid,templateStatus,templateType,approveType,comment,templateCode,tenantId,createName,creator) VALUES(#{template.uuid},#{template.templateName},#{template.templateVersion},#{template.templateContent},#{template.viewContent},#{template.parentUuid},#{template.templateStatus},#{template.templateType},#{template.approveType},#{template.comment},#{template.templateCode},#{template.tenantId},#{template.createName},#{template.creator})")
|
||||
int addFlowTemplate(@Param("template") SimulationFlowTemplate template);
|
||||
|
||||
@Update("UPDATE simulation_flow_template SET templateContent=#{template.templateContent},viewContent=#{template.viewContent},approveType=#{template.approveType},templateType=#{template.templateType},templateStatus=#{template.templateStatus},comment=#{template.comment},approveFlowId=#{template.approveFlowId} WHERE uuid=#{template.uuid}")
|
||||
@Update("UPDATE simulation_flow_template SET templateContent=#{template.templateContent},viewContent=#{template.viewContent},approveType=#{template.approveType},templateType=#{template.templateType},templateStatus=#{template.templateStatus},comment=#{template.comment},approveFlowId=#{template.approveFlowId},processDefinitionId=#{template.processDefinitionId} WHERE uuid=#{template.uuid}")
|
||||
int updateFlowTemplate(@Param("template") SimulationFlowTemplate template);
|
||||
|
||||
@Delete("DELETE FROM simulation_flow_template WHERE uuid=#{uuid}")
|
||||
|
||||
@@ -32,18 +32,10 @@ public class SimulationFlowNode {
|
||||
@ApiModelProperty(value = "流程节点名称")
|
||||
private String nodeName;
|
||||
|
||||
@TableField("flowInstanceId")
|
||||
@ApiModelProperty(value = "所属流程实例ID(流程引擎)")
|
||||
private String flowInstanceId;
|
||||
|
||||
@TableField("nodeId")
|
||||
@ApiModelProperty(value = "流程引擎中的nodeId")
|
||||
private String nodeId;
|
||||
|
||||
@TableField("templateId")
|
||||
@ApiModelProperty(value = "所属流程模版ID")
|
||||
private String templateId;
|
||||
|
||||
@TableField("runId")
|
||||
@ApiModelProperty(value = "所属算例ID")
|
||||
private String runId;
|
||||
|
||||
@@ -15,6 +15,9 @@ public class SimulationFlowTemplate extends BaseEntity {
|
||||
@Schema(description = "流程模版唯一ID")
|
||||
public String uuid;
|
||||
|
||||
@Schema(description = "flowable流程完成部署后的流程定义id")
|
||||
public String processDefinitionId;
|
||||
|
||||
@Schema(description = "流程模版名称")
|
||||
public String templateName;
|
||||
|
||||
|
||||
@@ -84,5 +84,5 @@ public interface IFlowService {
|
||||
* 处理评审结果
|
||||
* @param req
|
||||
*/
|
||||
public SdmResponse handleApproveResult(LaunchApproveReq req);
|
||||
SdmResponse handleApproveResult(LaunchApproveReq req);
|
||||
}
|
||||
|
||||
@@ -16,4 +16,6 @@ public interface ISimulationFlowNodeService extends IService<SimulationFlowNode>
|
||||
|
||||
SdmResponse<List<FlowNodeDto>> listSimulationFlowNode(@RequestBody FlowNodeDto req);
|
||||
|
||||
SdmResponse<FlowNodeDto> querySimulationFlowNode(@RequestBody FlowNodeDto req);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.sdm.capability.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.sdm.capability.dao.FlowMapper;
|
||||
import com.sdm.capability.model.entity.SimulationFlowTemplate;
|
||||
@@ -8,8 +9,12 @@ import com.sdm.capability.service.IFlowService;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.common.ThreadLocalContext;
|
||||
import com.sdm.common.entity.bo.DataPageInfo;
|
||||
import com.sdm.common.entity.constants.NumberConstants;
|
||||
import com.sdm.common.entity.flowable.dto.ProcessDefinitionDTO;
|
||||
import com.sdm.common.entity.req.system.LaunchApproveReq;
|
||||
import com.sdm.common.entity.resp.capability.FlowTemplateResp;
|
||||
import com.sdm.common.entity.resp.flowable.DeployFlowableResp;
|
||||
import com.sdm.common.feign.impl.flowable.FlowableClientFeignClientImpl;
|
||||
import com.sdm.common.feign.impl.system.ApproveFeignClientImpl;
|
||||
import com.sdm.common.service.BaseService;
|
||||
import com.sdm.common.utils.Tools;
|
||||
@@ -33,6 +38,9 @@ public class FlowServiceImpl extends BaseService implements IFlowService {
|
||||
@Autowired
|
||||
private ApproveFeignClientImpl approveFeignClient;
|
||||
|
||||
@Autowired
|
||||
private FlowableClientFeignClientImpl flowableClientFeignClient;
|
||||
|
||||
@Override
|
||||
public SdmResponse createFlowTemplateDraft(SimulationFlowTemplate flowTemplate)
|
||||
{
|
||||
@@ -393,6 +401,14 @@ public class FlowServiceImpl extends BaseService implements IFlowService {
|
||||
SimulationFlowTemplate flowTemplate = getFlowTemplateInfoByUuid(flowTemplateUuid);
|
||||
if(flowTemplate != null)
|
||||
{
|
||||
// 审批通过 部署流程 保存部署流程部署id和流程定义id
|
||||
if (NumberConstants.TWO == approveStatus) {
|
||||
ProcessDefinitionDTO definitionDTO = JSON.parseObject(flowTemplate.getTemplateContent(), ProcessDefinitionDTO.class);
|
||||
SdmResponse<DeployFlowableResp> sdmResponse = flowableClientFeignClient.deploy(definitionDTO);
|
||||
if (sdmResponse.getData() != null) {
|
||||
flowTemplate.processDefinitionId = sdmResponse.getData().getProcessDefinitionId();
|
||||
}
|
||||
}
|
||||
flowTemplate.approveType = approveStatus;
|
||||
flowMapper.updateFlowTemplate(flowTemplate);
|
||||
}
|
||||
|
||||
@@ -41,9 +41,6 @@ public class ISimulationFlowNodeServiceImpl extends ServiceImpl<SimulationFlowNo
|
||||
public SdmResponse batchUpdateSimulationFlowNode(FlowNodeDto req) {
|
||||
if (StringUtils.isNotEmpty(req.getRunId())) {
|
||||
List<SimulationFlowNode> entityList = this.lambdaQuery().eq(SimulationFlowNode::getRunId, req.getRunId()).list();
|
||||
entityList.forEach(entity -> {
|
||||
entity.setFlowInstanceId(req.getFlowInstanceId());
|
||||
});
|
||||
this.updateBatchById(entityList);
|
||||
}
|
||||
return SdmResponse.success();
|
||||
@@ -55,9 +52,6 @@ public class ISimulationFlowNodeServiceImpl extends ServiceImpl<SimulationFlowNo
|
||||
if (StringUtils.isNotBlank(req.getRunId())) {
|
||||
queryWrapper.eq(SimulationFlowNode::getRunId, req.getRunId());
|
||||
}
|
||||
if (StringUtils.isNotBlank(req.getFlowInstanceId())) {
|
||||
queryWrapper.eq(SimulationFlowNode::getFlowInstanceId, req.getFlowInstanceId());
|
||||
}
|
||||
List<SimulationFlowNode> flowNodeList = this.baseMapper.selectList(queryWrapper);
|
||||
List<FlowNodeDto> dtoList = flowNodeList.stream().map(entity -> {
|
||||
FlowNodeDto dto = new FlowNodeDto();
|
||||
@@ -66,4 +60,14 @@ public class ISimulationFlowNodeServiceImpl extends ServiceImpl<SimulationFlowNo
|
||||
}).toList();
|
||||
return SdmResponse.success(dtoList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse<FlowNodeDto> querySimulationFlowNode(FlowNodeDto req) {
|
||||
SimulationFlowNode simulationFlowNode = this.lambdaQuery().eq(SimulationFlowNode::getUuid, req.getUuid()).one();
|
||||
FlowNodeDto dto = new FlowNodeDto();
|
||||
if (simulationFlowNode != null) {
|
||||
BeanUtils.copyProperties(simulationFlowNode, dto);
|
||||
}
|
||||
return SdmResponse.success(dto);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user