feat : swagger 字段描述
This commit is contained in:
@@ -1,19 +1,26 @@
|
|||||||
package com.metis.domain.bo;
|
package com.metis.domain.bo;
|
||||||
|
|
||||||
import com.metis.enums.YesOrNoEnum;
|
import com.metis.enums.YesOrNoEnum;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@Schema(description = "应用")
|
||||||
public class AppBO {
|
public class AppBO {
|
||||||
|
|
||||||
|
@Schema(description = "应用id")
|
||||||
private Long appId;
|
private Long appId;
|
||||||
|
|
||||||
|
@Schema(description = "应用名称")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "应用描述")
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
|
@Schema(description = "画布")
|
||||||
private GraphBO graph;
|
private GraphBO graph;
|
||||||
|
|
||||||
|
@Schema(description = "是否默认使用")
|
||||||
private YesOrNoEnum defaultUse;
|
private YesOrNoEnum defaultUse;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.metis.domain.bo;
|
package com.metis.domain.bo;
|
||||||
|
|
||||||
import com.metis.domain.entity.base.Graph;
|
import com.metis.domain.entity.base.Graph;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
@@ -11,24 +12,32 @@ import lombok.Data;
|
|||||||
@Builder
|
@Builder
|
||||||
public final class BuildApp {
|
public final class BuildApp {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用id
|
||||||
|
*/
|
||||||
|
@Schema(description = "应用id")
|
||||||
private Long appId;
|
private Long appId;
|
||||||
/**
|
/**
|
||||||
* 用户id
|
* 用户id
|
||||||
*/
|
*/
|
||||||
|
@Schema(description = "用户id")
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 名字
|
* 名字
|
||||||
*/
|
*/
|
||||||
@NotBlank(message = "流程名称不能为空")
|
@NotBlank(message = "流程名称不能为空")
|
||||||
|
@Schema(description = "流程名称")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@NotNull(message = "流程模型不能为空")
|
|
||||||
@Valid
|
@Valid
|
||||||
|
@NotNull(message = "流程模型不能为空")
|
||||||
|
@Schema(description = "流程模型")
|
||||||
private Graph graph;
|
private Graph graph;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 描述
|
* 描述
|
||||||
*/
|
*/
|
||||||
|
@Schema(description = "流程描述")
|
||||||
private String description;
|
private String description;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.metis.domain.bo;
|
package com.metis.domain.bo;
|
||||||
|
|
||||||
import com.metis.domain.entity.base.Graph;
|
import com.metis.domain.entity.base.Graph;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
@@ -13,20 +14,24 @@ public class CreateApp {
|
|||||||
/**
|
/**
|
||||||
* 用户id
|
* 用户id
|
||||||
*/
|
*/
|
||||||
|
@Schema(description = "用户id")
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 名字
|
* 名字
|
||||||
*/
|
*/
|
||||||
@NotBlank(message = "流程名称不能为空")
|
@NotBlank(message = "流程名称不能为空")
|
||||||
|
@Schema(description = "流程名称")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@NotNull(message = "流程模型不能为空")
|
@NotNull(message = "流程模型不能为空")
|
||||||
@Valid
|
@Valid
|
||||||
|
@Schema(description = "流程模型")
|
||||||
private Graph graph;
|
private Graph graph;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 描述
|
* 描述
|
||||||
*/
|
*/
|
||||||
|
@Schema(description = "流程描述")
|
||||||
private String description;
|
private String description;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.metis.domain.bo;
|
package com.metis.domain.bo;
|
||||||
|
|
||||||
import com.metis.enums.EdgeType;
|
import com.metis.enums.EdgeType;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@@ -50,17 +51,56 @@ public class EdgeBO {
|
|||||||
/**
|
/**
|
||||||
* 边是否动画true/false
|
* 边是否动画true/false
|
||||||
*/
|
*/
|
||||||
|
@Schema(description = "边是否动画true/false")
|
||||||
private Boolean animated;
|
private Boolean animated;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 开始标志
|
* 开始标志
|
||||||
*/
|
*/
|
||||||
|
@Schema(description = "开始标志")
|
||||||
private String markerStart;
|
private String markerStart;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 结束标记
|
* 结束标记
|
||||||
*/
|
*/
|
||||||
|
@Schema(description = "结束标记")
|
||||||
private String markerEnd;
|
private String markerEnd;
|
||||||
|
/**
|
||||||
|
* 边是否可选中true,false
|
||||||
|
*/
|
||||||
|
@Schema(description = "边是否可选中true,false")
|
||||||
|
private Boolean selectable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 边是否可更新true,false(更改它们的源/目标位置。)
|
||||||
|
*/
|
||||||
|
@Schema(description = "边是否可更新true,false(更改它们的源/目标位置。)")
|
||||||
|
private Boolean updatable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 边是否可以删除true,false
|
||||||
|
*/
|
||||||
|
@Schema(description = "边是否可以删除true,false")
|
||||||
|
private Boolean deletable;
|
||||||
|
/**
|
||||||
|
* 源位置x坐标
|
||||||
|
*/
|
||||||
|
@Schema(description = "源位置x坐标")
|
||||||
|
private Float sourceX;
|
||||||
|
/**
|
||||||
|
* 源位置y坐标
|
||||||
|
*/
|
||||||
|
@Schema(description = "源位置y坐标")
|
||||||
|
private Float sourceY;
|
||||||
|
/**
|
||||||
|
* 目标位置x坐标
|
||||||
|
*/
|
||||||
|
@Schema(description = "目标位置x坐标")
|
||||||
|
private Float targetX;
|
||||||
|
/**
|
||||||
|
* 目标位置y坐标
|
||||||
|
*/
|
||||||
|
@Schema(description = "目标位置y坐标")
|
||||||
|
private Float targetY;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.metis.domain.bo;
|
package com.metis.domain.bo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -7,6 +8,7 @@ import lombok.Data;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@Schema(description = "画布")
|
||||||
public class GraphBO {
|
public class GraphBO {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -14,6 +16,7 @@ public class GraphBO {
|
|||||||
*/
|
*/
|
||||||
@Valid
|
@Valid
|
||||||
@NotEmpty(message = "连线不能为空")
|
@NotEmpty(message = "连线不能为空")
|
||||||
|
@Schema(description = "连线")
|
||||||
private List<EdgeBO> edges;
|
private List<EdgeBO> edges;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -21,22 +24,26 @@ public class GraphBO {
|
|||||||
*/
|
*/
|
||||||
@Valid
|
@Valid
|
||||||
@NotEmpty(message = "节点不能为空")
|
@NotEmpty(message = "节点不能为空")
|
||||||
|
@Schema(description = "节点")
|
||||||
private List<NodeBO> nodes;
|
private List<NodeBO> nodes;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 位置
|
* 位置
|
||||||
*/
|
*/
|
||||||
|
@Schema(description = "位置")
|
||||||
private List<Double> position;
|
private List<Double> position;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 变焦
|
* 变焦
|
||||||
*/
|
*/
|
||||||
|
@Schema(description = "变焦")
|
||||||
private Double zoom;
|
private Double zoom;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 视窗
|
* 视窗
|
||||||
*/
|
*/
|
||||||
|
@Schema(description = "视窗")
|
||||||
private ViewportBo viewport;
|
private ViewportBo viewport;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.metis.domain.bo;
|
|||||||
|
|
||||||
import com.metis.enums.HandleType;
|
import com.metis.enums.HandleType;
|
||||||
import com.metis.enums.PositionType;
|
import com.metis.enums.PositionType;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@@ -14,23 +15,27 @@ public class HandleBO {
|
|||||||
* 句柄id
|
* 句柄id
|
||||||
*/
|
*/
|
||||||
@NotNull(message = "句柄id不能为空")
|
@NotNull(message = "句柄id不能为空")
|
||||||
|
@Schema(description = "句柄id")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 句柄类型
|
* 句柄类型
|
||||||
*/
|
*/
|
||||||
@NotNull(message = "句柄类型不能为空")
|
@NotNull(message = "句柄类型不能为空")
|
||||||
|
@Schema(description = "句柄类型")
|
||||||
private HandleType type;
|
private HandleType type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 句柄位置
|
* 句柄位置
|
||||||
*/
|
*/
|
||||||
@NotNull(message = "句柄位置不能为空")
|
@NotNull(message = "句柄位置不能为空")
|
||||||
|
@Schema(description = "句柄位置")
|
||||||
private PositionType position;
|
private PositionType position;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否可以连接
|
* 是否可以连接
|
||||||
*/
|
*/
|
||||||
@NotNull(message = "是否可以连接不能为空")
|
@NotNull(message = "是否可以连接不能为空")
|
||||||
|
@Schema(description = "是否可以连接")
|
||||||
private Boolean connectable;
|
private Boolean connectable;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.metis.domain.bo;
|
package com.metis.domain.bo;
|
||||||
|
|
||||||
import com.metis.enums.NodeType;
|
import com.metis.enums.NodeType;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -12,17 +13,20 @@ public class NodeBO {
|
|||||||
* id
|
* id
|
||||||
*/
|
*/
|
||||||
@NotNull(message = "节点id不能为空")
|
@NotNull(message = "节点id不能为空")
|
||||||
|
@Schema(description = "节点id")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 类型
|
* 类型
|
||||||
*/
|
*/
|
||||||
@NotNull(message = "节点类型不能为空")
|
@NotNull(message = "节点类型不能为空")
|
||||||
|
@Schema(description = "节点类型")
|
||||||
private NodeType type;
|
private NodeType type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义类型
|
* 自定义类型
|
||||||
*/
|
*/
|
||||||
|
@Schema(description = "自定义类型")
|
||||||
private String customType;
|
private String customType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -30,6 +34,7 @@ public class NodeBO {
|
|||||||
*/
|
*/
|
||||||
@Valid
|
@Valid
|
||||||
@NotNull(message = "节点位置不能为空")
|
@NotNull(message = "节点位置不能为空")
|
||||||
|
@Schema(description = "节点位置")
|
||||||
private PositionBO position;
|
private PositionBO position;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -37,23 +42,25 @@ public class NodeBO {
|
|||||||
*/
|
*/
|
||||||
@Valid
|
@Valid
|
||||||
@NotNull(message = "节点业务数据不能为空")
|
@NotNull(message = "节点业务数据不能为空")
|
||||||
|
@Schema(description = "节点业务数据")
|
||||||
private NodeDataBO data;
|
private NodeDataBO data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 宽度
|
* 宽度
|
||||||
*/
|
*/
|
||||||
// @NotNull(message = "节点宽度不能为空")
|
@Schema(description = "节点宽度")
|
||||||
private Integer width;
|
private Integer width;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 高度
|
* 高度
|
||||||
*/
|
*/
|
||||||
// @NotNull(message = "节点高度不能为空")
|
@Schema(description = "节点高度")
|
||||||
private Integer height;
|
private Integer height;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 节点是否选中
|
* 节点是否选中
|
||||||
*/
|
*/
|
||||||
|
@Schema(description = "节点是否选中")
|
||||||
private Boolean selected;
|
private Boolean selected;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,11 @@ public class NodeDataBO {
|
|||||||
*/
|
*/
|
||||||
private String icon;
|
private String icon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 工具栏位置
|
* 工具栏位置
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,19 +1,23 @@
|
|||||||
package com.metis.domain.bo;
|
package com.metis.domain.bo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@Schema(description = "节点位置")
|
||||||
public class PositionBO {
|
public class PositionBO {
|
||||||
/**
|
/**
|
||||||
* x坐标
|
* x坐标
|
||||||
*/
|
*/
|
||||||
@NotNull(message = "x坐标不能为空")
|
@NotNull(message = "x坐标不能为空")
|
||||||
|
@Schema(description = "x坐标")
|
||||||
private Double x;
|
private Double x;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* y坐标
|
* y坐标
|
||||||
*/
|
*/
|
||||||
|
@Schema(description = "y坐标")
|
||||||
@NotNull(message = "y坐标不能为空")
|
@NotNull(message = "y坐标不能为空")
|
||||||
private Double y;
|
private Double y;
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.metis.domain.bo;
|
|||||||
|
|
||||||
import com.metis.enums.YesOrNoEnum;
|
import com.metis.enums.YesOrNoEnum;
|
||||||
import com.metis.domain.entity.base.Graph;
|
import com.metis.domain.entity.base.Graph;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
@@ -15,22 +16,30 @@ public class UpdateApp {
|
|||||||
/**
|
/**
|
||||||
* id
|
* id
|
||||||
*/
|
*/
|
||||||
|
@Schema(description = "id")
|
||||||
private Long appId;
|
private Long appId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 名字
|
* 名字
|
||||||
*/
|
*/
|
||||||
@NotBlank(message = "流程名称不能为空")
|
@NotBlank(message = "流程名称不能为空")
|
||||||
|
@Schema(description = "名字")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@NotNull(message = "流程模型不能为空")
|
@NotNull(message = "流程模型不能为空")
|
||||||
@Valid
|
@Valid
|
||||||
|
@Schema(description = "流程模型")
|
||||||
private Graph graph;
|
private Graph graph;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 描述
|
* 描述
|
||||||
*/
|
*/
|
||||||
|
@Schema(description = "描述")
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否默认使用
|
||||||
|
*/
|
||||||
|
@Schema(description = "是否默认使用")
|
||||||
private YesOrNoEnum defaultUse;
|
private YesOrNoEnum defaultUse;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,18 @@
|
|||||||
package com.metis.domain.bo;
|
package com.metis.domain.bo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@Schema(description = "视窗")
|
||||||
public class ViewportBo {
|
public class ViewportBo {
|
||||||
|
|
||||||
|
@Schema(description = "x坐标")
|
||||||
private Double x;
|
private Double x;
|
||||||
|
|
||||||
|
@Schema(description = "y坐标")
|
||||||
private Double y;
|
private Double y;
|
||||||
|
|
||||||
|
@Schema(description = "变焦")
|
||||||
private Double zoom;
|
private Double zoom;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.metis.domain.context;
|
package com.metis.domain.context;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.metis.runner.FlowRunningContext;
|
import com.metis.runner.FlowRunningContext;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
@@ -13,6 +15,8 @@ import java.util.Set;
|
|||||||
@Builder
|
@Builder
|
||||||
public class RunningContext {
|
public class RunningContext {
|
||||||
|
|
||||||
|
private final static String SYS_PREFIX = "sys.";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统数据
|
* 系统数据
|
||||||
*/
|
*/
|
||||||
@@ -44,11 +48,39 @@ public class RunningContext {
|
|||||||
this.nodeRunningContext.put(nodeId, nodeRunningContext);
|
this.nodeRunningContext.put(nodeId, nodeRunningContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取运行上下文
|
||||||
|
*
|
||||||
|
* @param nodeId 节点id
|
||||||
|
* @return {@link JSONObject }
|
||||||
|
*/
|
||||||
public JSONObject getRunningContext(Long nodeId) {
|
public JSONObject getRunningContext(Long nodeId) {
|
||||||
return this.nodeRunningContext.get(nodeId);
|
return this.nodeRunningContext.get(nodeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得价值 不满足条件, 则返回null, 需要业务自行判断
|
||||||
|
*
|
||||||
|
* @param nodeId 节点id
|
||||||
|
* @param key 关键
|
||||||
|
* @return {@link Object }
|
||||||
|
*/
|
||||||
|
public Object getValue(Long nodeId, String key) {
|
||||||
|
if (ObjectUtil.isNull(nodeId)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (StrUtil.isBlank(key)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
JSONObject runningContext = getRunningContext(nodeId);
|
||||||
|
if (ObjectUtil.isNull(runningContext)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return runningContext.get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构建上下文
|
* 构建上下文
|
||||||
*
|
*
|
||||||
@@ -64,5 +96,4 @@ public class RunningContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,4 +48,5 @@ public class SysContext {
|
|||||||
* 实例id
|
* 实例id
|
||||||
*/
|
*/
|
||||||
private Long instanceId;
|
private Long instanceId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,17 +13,17 @@ public class Edge {
|
|||||||
@NotNull(message = "唯一标识符不能为空")
|
@NotNull(message = "唯一标识符不能为空")
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
/**
|
|
||||||
* 标签
|
|
||||||
*/
|
|
||||||
private String label;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 节点类型
|
* 节点类型
|
||||||
*/
|
*/
|
||||||
@NotNull(message = "线类型不能为空")
|
@NotNull(message = "线类型不能为空")
|
||||||
private EdgeType type;
|
private EdgeType type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标签
|
||||||
|
*/
|
||||||
|
private String label;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 源节点ID,对应节点id
|
* 源节点ID,对应节点id
|
||||||
*/
|
*/
|
||||||
@@ -62,5 +62,36 @@ public class Edge {
|
|||||||
*/
|
*/
|
||||||
private String markerEnd;
|
private String markerEnd;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 边是否可选中true,false
|
||||||
|
*/
|
||||||
|
private Boolean selectable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 边是否可更新true,false(更改它们的源/目标位置。)
|
||||||
|
*/
|
||||||
|
private Boolean updatable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 边是否可以删除true,false
|
||||||
|
*/
|
||||||
|
private Boolean deletable;
|
||||||
|
/**
|
||||||
|
* 源位置x坐标
|
||||||
|
*/
|
||||||
|
private Float sourceX;
|
||||||
|
/**
|
||||||
|
* 源位置y坐标
|
||||||
|
*/
|
||||||
|
private Float sourceY;
|
||||||
|
/**
|
||||||
|
* 目标位置x坐标
|
||||||
|
*/
|
||||||
|
private Float targetX;
|
||||||
|
/**
|
||||||
|
* 目标位置y坐标
|
||||||
|
*/
|
||||||
|
private Float targetY;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,11 @@ public class NodeData {
|
|||||||
*/
|
*/
|
||||||
private String icon;
|
private String icon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 工具栏位置
|
* 工具栏位置
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -67,4 +67,41 @@ public class EdgeVo {
|
|||||||
@Schema(description = "结束标记")
|
@Schema(description = "结束标记")
|
||||||
private String markerEnd;
|
private String markerEnd;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 边是否可选中true,false
|
||||||
|
*/
|
||||||
|
@Schema(description = "边是否可选中true,false")
|
||||||
|
private Boolean selectable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 边是否可更新true,false(更改它们的源/目标位置。)
|
||||||
|
*/
|
||||||
|
@Schema(description = "边是否可更新true,false(更改它们的源/目标位置。)")
|
||||||
|
private Boolean updatable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 边是否可以删除true,false
|
||||||
|
*/
|
||||||
|
@Schema(description = "边是否可以删除true,false")
|
||||||
|
private Boolean deletable;
|
||||||
|
/**
|
||||||
|
* 源位置x坐标
|
||||||
|
*/
|
||||||
|
@Schema(description = "源位置x坐标")
|
||||||
|
private Float sourceX;
|
||||||
|
/**
|
||||||
|
* 源位置y坐标
|
||||||
|
*/
|
||||||
|
@Schema(description = "源位置y坐标")
|
||||||
|
private Float sourceY;
|
||||||
|
/**
|
||||||
|
* 目标位置x坐标
|
||||||
|
*/
|
||||||
|
@Schema(description = "目标位置x坐标")
|
||||||
|
private Float targetX;
|
||||||
|
/**
|
||||||
|
* 目标位置y坐标
|
||||||
|
*/
|
||||||
|
@Schema(description = "目标位置y坐标")
|
||||||
|
private Float targetY;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import java.util.List;
|
|||||||
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@Schema(description = "画布")
|
||||||
public class GraphVo {
|
public class GraphVo {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -23,6 +23,12 @@ public class NodeDataVo {
|
|||||||
@Schema(description = "图标")
|
@Schema(description = "图标")
|
||||||
private String icon;
|
private String icon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
@Schema(description = "描述")
|
||||||
|
private String description;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 工具栏位置
|
* 工具栏位置
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@Schema(description = "节点")
|
||||||
public class NodeVo {
|
public class NodeVo {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.metis.domain.context.RunningContext;
|
import com.metis.domain.context.RunningContext;
|
||||||
import com.metis.domain.context.RunningResult;
|
import com.metis.domain.context.RunningResult;
|
||||||
|
import com.metis.domain.context.SysContext;
|
||||||
import com.metis.domain.entity.base.Edge;
|
import com.metis.domain.entity.base.Edge;
|
||||||
import com.metis.domain.entity.base.Node;
|
import com.metis.domain.entity.base.Node;
|
||||||
import com.metis.domain.entity.base.NodeVariable;
|
import com.metis.domain.entity.base.NodeVariable;
|
||||||
@@ -37,6 +38,10 @@ public class StartNodeRunner implements NodeRunner<StartNodeConfig> {
|
|||||||
// 获取用户自定义参数
|
// 获取用户自定义参数
|
||||||
JSONObject custom = context.getCustom();
|
JSONObject custom = context.getCustom();
|
||||||
JSONObject contextNodeValue = new JSONObject();
|
JSONObject contextNodeValue = new JSONObject();
|
||||||
|
// 获取到系统上下文, 并将系统上下文放入到start的运行结果中, 用于后续调用
|
||||||
|
JSONObject sysContext = getSysContext(context);
|
||||||
|
contextNodeValue.putAll(sysContext);
|
||||||
|
|
||||||
for (NodeVariable variable : variables) {
|
for (NodeVariable variable : variables) {
|
||||||
Object value = variable.getValue(custom);
|
Object value = variable.getValue(custom);
|
||||||
contextNodeValue.put(variable.getVariable(), value);
|
contextNodeValue.put(variable.getVariable(), value);
|
||||||
@@ -44,6 +49,27 @@ public class StartNodeRunner implements NodeRunner<StartNodeConfig> {
|
|||||||
return RunningResult.buildResult(contextNodeValue);
|
return RunningResult.buildResult(contextNodeValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取系统上下文
|
||||||
|
*
|
||||||
|
* @param context 上下文
|
||||||
|
* @return {@link JSONObject }
|
||||||
|
*/
|
||||||
|
private JSONObject getSysContext(RunningContext context) {
|
||||||
|
JSONObject sys = new JSONObject();
|
||||||
|
// 系统参数全部以sys.开头
|
||||||
|
SysContext sysContext = context.getSys();
|
||||||
|
sys.put("sys.userId", sysContext.getUserId());
|
||||||
|
sys.put("sys.appId", sysContext.getAppId());
|
||||||
|
sys.put("sys.workflowId", sysContext.getWorkflowId());
|
||||||
|
sys.put("sys.instanceId", sysContext.getInstanceId());
|
||||||
|
sys.put("sys.conversationId", sysContext.getConversationId());
|
||||||
|
sys.put("sys.dialogueCount", sysContext.getDialogueCount());
|
||||||
|
sys.put("sys.files", sysContext.getFiles());
|
||||||
|
sys.put("sys.query", sysContext.getQuery());
|
||||||
|
return sys;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NodeType getType() {
|
public NodeType getType() {
|
||||||
|
|||||||
Reference in New Issue
Block a user