增加生成后端服务代码。
This commit is contained in:
parent
0a229ef244
commit
197439a381
@ -1,8 +1,6 @@
|
||||
package com.qqchen.deploy.backend.workflow.dto.definition.workflow;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.qqchen.deploy.backend.workflow.enums.NodeTypeEnums;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
@ -31,6 +29,6 @@ public class WorkflowDefinitionGraphNode {
|
||||
|
||||
private Map<String, Object> inputMapping;
|
||||
|
||||
private List<OutputField> outputs;
|
||||
private List<WorkflowDefinitionGraphOutputField> outputs;
|
||||
|
||||
}
|
||||
|
||||
@ -9,25 +9,21 @@ import java.util.List;
|
||||
* 节点输出字段定义
|
||||
*/
|
||||
@Data
|
||||
public class OutputField {
|
||||
|
||||
public class WorkflowDefinitionGraphOutputField {
|
||||
|
||||
private String name;
|
||||
|
||||
|
||||
private String title;
|
||||
|
||||
|
||||
private String type;
|
||||
|
||||
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 枚举值列表
|
||||
* 注意:前端使用 "enum"(JSON关键字),Java中使用 enums 避免与 enum 关键字冲突
|
||||
*/
|
||||
|
||||
@JsonProperty("enum")
|
||||
private List<String> enums;
|
||||
|
||||
|
||||
private Object example;
|
||||
|
||||
|
||||
private Boolean required;
|
||||
}
|
||||
|
||||
@ -31,9 +31,6 @@ public enum NodeTypeEnums {
|
||||
START_EVENT(
|
||||
"START_EVENT", // 节点类型编码
|
||||
"开始节点", // 节点显示名称
|
||||
null,
|
||||
StartNodePanelVariables.class,
|
||||
NodeUiVariables.class,
|
||||
BpmnNodeTypeEnums.START_EVENT,
|
||||
NodeCategoryEnums.EVENT,
|
||||
"工作流开始"
|
||||
@ -49,9 +46,6 @@ public enum NodeTypeEnums {
|
||||
END_EVENT(
|
||||
"END_EVENT",
|
||||
"结束节点",
|
||||
null,
|
||||
EndNodePanelVariables.class,
|
||||
NodeUiVariables.class,
|
||||
BpmnNodeTypeEnums.END_EVENT,
|
||||
NodeCategoryEnums.EVENT,
|
||||
"工作流结束"
|
||||
@ -59,19 +53,13 @@ public enum NodeTypeEnums {
|
||||
JENKINS_BUILD(
|
||||
"JENKINS_BUILD",
|
||||
"Jenkins构建",
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
BpmnNodeTypeEnums.USER_TASK,
|
||||
BpmnNodeTypeEnums.SERVICE_TASK,
|
||||
NodeCategoryEnums.TASK,
|
||||
"工作流结束"
|
||||
"Jenkins构建任务"
|
||||
),
|
||||
SCRIPT_NODE(
|
||||
"SCRIPT_NODE",
|
||||
"脚本任务",
|
||||
ScriptNodeLocalVariables.class,
|
||||
ScriptNodePanelVariables.class,
|
||||
NodeUiVariables.class,
|
||||
BpmnNodeTypeEnums.SERVICE_TASK,
|
||||
NodeCategoryEnums.TASK,
|
||||
"脚本执行任务"
|
||||
@ -79,9 +67,6 @@ public enum NodeTypeEnums {
|
||||
DEPLOY_NODE(
|
||||
"DEPLOY_NODE",
|
||||
"构建任务",
|
||||
DeployNodeLocalVariables.class,
|
||||
DeployNodePanelVariables.class,
|
||||
NodeUiVariables.class,
|
||||
BpmnNodeTypeEnums.SERVICE_TASK,
|
||||
NodeCategoryEnums.TASK,
|
||||
"构建任务"
|
||||
@ -89,9 +74,6 @@ public enum NodeTypeEnums {
|
||||
GATEWAY_NODE(
|
||||
"GATEWAY_NODE",
|
||||
"网关节点",
|
||||
null,
|
||||
GatewayNodePanelVariables.class,
|
||||
NodeUiVariables.class,
|
||||
BpmnNodeTypeEnums.EXCLUSIVE_GATEWAY,
|
||||
NodeCategoryEnums.GATEWAY,
|
||||
"条件分支控制"
|
||||
@ -99,9 +81,6 @@ public enum NodeTypeEnums {
|
||||
NOTIFICATION(
|
||||
"NOTIFICATION",
|
||||
"通知节点",
|
||||
NotificationNodeLocalVariables.class,
|
||||
NotificationNodePanelVariables.class,
|
||||
NodeUiVariables.class,
|
||||
BpmnNodeTypeEnums.SERVICE_TASK,
|
||||
NodeCategoryEnums.TASK,
|
||||
"通知节点"
|
||||
@ -109,9 +88,6 @@ public enum NodeTypeEnums {
|
||||
APPROVAL_NODE(
|
||||
"APPROVAL_NODE",
|
||||
"审批节点",
|
||||
null,
|
||||
null,
|
||||
NodeUiVariables.class,
|
||||
BpmnNodeTypeEnums.USER_TASK,
|
||||
NodeCategoryEnums.TASK,
|
||||
"审批任务"
|
||||
@ -255,14 +231,6 @@ public enum NodeTypeEnums {
|
||||
|
||||
private final String name; // 节点显示名称
|
||||
|
||||
private final Class<?> localVariables;
|
||||
|
||||
private final Class<?> panelVariables;
|
||||
|
||||
// private final Class<?> formVariables;
|
||||
|
||||
private final Class<?> uiVariables;
|
||||
|
||||
private final BpmnNodeTypeEnums bpmnType; // 对应的BPMN类型
|
||||
|
||||
private final NodeCategoryEnums category; //分类
|
||||
@ -272,20 +240,12 @@ public enum NodeTypeEnums {
|
||||
NodeTypeEnums(
|
||||
String code,
|
||||
String name,
|
||||
Class<?> localVariables,
|
||||
Class<?> panelVariables,
|
||||
// Class<?> formVariables,
|
||||
Class<?> uiVariables,
|
||||
BpmnNodeTypeEnums bpmnType,
|
||||
NodeCategoryEnums category,
|
||||
String description
|
||||
) {
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
this.localVariables = localVariables;
|
||||
this.panelVariables = panelVariables;
|
||||
// this.formVariables = formVariables;
|
||||
this.uiVariables = uiVariables;
|
||||
this.bpmnType = bpmnType;
|
||||
this.category = category;
|
||||
this.description = description;
|
||||
|
||||
@ -325,7 +325,7 @@ public class WorkflowDefinitionServiceImpl extends BaseServiceImpl<WorkflowDefin
|
||||
WorkflowDefinition definition = workflowDefinitionRepository.findById(workflowDefinitionId)
|
||||
.orElseThrow(() -> new RuntimeException("Workflow definition not found: " + workflowDefinitionId));
|
||||
WorkflowDefinitionGraph graph = definition.getGraph();
|
||||
// definition.setBpmnXml(bpmnConverter.convertToXml(graph, definition.getKey()));
|
||||
definition.setBpmnXml(bpmnConverter.convertToXml(graph, definition.getKey()));
|
||||
Deployment deployment = this.deployWorkflow(definition);
|
||||
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().deploymentId(deployment.getId()).singleResult();
|
||||
definition.setStatus(WorkflowDefinitionStatusEnums.PUBLISHED);
|
||||
|
||||
@ -99,24 +99,6 @@ public class WorkflowNodeDefinitionServiceImpl extends BaseServiceImpl<WorkflowN
|
||||
definedDTO.setNodeName(nodeType.getName());
|
||||
definedDTO.setCategory(nodeType.getCategory());
|
||||
definedDTO.setNodeType(nodeType);
|
||||
Class<?> panelVariables = nodeType.getPanelVariables();
|
||||
if (panelVariables != null) {
|
||||
definedDTO.setPanelVariablesSchema(generateSchema(panelVariables));
|
||||
}
|
||||
Class<?> localVariables = nodeType.getLocalVariables();
|
||||
if (localVariables != null) {
|
||||
definedDTO.setLocalVariablesSchema(generateSchema(localVariables));
|
||||
}
|
||||
// Class<?> formVariables = nodeType.getFormVariables();
|
||||
// if (formVariables != null) {
|
||||
// definedDTO.setFormVariablesSchema(generateSchema(formVariables));
|
||||
// }
|
||||
|
||||
Class<?> uiVariables = nodeType.getUiVariables();
|
||||
if (uiVariables != null) {
|
||||
definedDTO.setUiVariables(generateSchema(uiVariables));
|
||||
}
|
||||
|
||||
result.add(definedDTO);
|
||||
} catch (Exception e) {
|
||||
log.error("Error processing node type: " + nodeType, e);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user