auto(27632decbddc): session end @ 2026-08-01T18:58:21 (+3f)
This commit is contained in:
1 parent
066d2cc3b5
commit
0a6df00e13
3 files changed
+40
-3
No files matched your search
@@ -36,5 +36,26 @@
|
||||
<artifactId>lombok</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- 单元测试: JUnit 5.
|
||||
版本 5.12.2 与 spring-boot 3.5.14 (jnpf-dependencies 管理的 spring-boot.version)
|
||||
所对齐的 junit-bom 一致; 因 jnpf-dependencies 未把 junit 纳入 dependencyManagement,
|
||||
这里显式声明版本. 仅 test scope, 不影响运行时依赖树. -->
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter</artifactId>
|
||||
<version>5.12.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- surefire 3.x 才带 JUnitPlatformProvider; maven 默认的 2.12.4 只认 JUnit3,
|
||||
会静默跑出 "Tests run: 0". 与 ssw-common-biz 保持同一版本. -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.2.5</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -64,8 +64,16 @@ public class FlowGraph {
|
||||
JSONObject edge = edgeArray.getJSONObject(i);
|
||||
String source = edge.getString("sourceStepId");
|
||||
String target = edge.getString("targetStepId");
|
||||
if (!graph.steps.containsKey(source) || !graph.steps.containsKey(target)) {
|
||||
continue;
|
||||
// 悬空边(引用了画布上不存在的节点)属于数据损坏,必须显式暴露。
|
||||
// 静默丢弃会让"节点被删掉但连线残留"的画布看起来是合法的,
|
||||
// 运行期才以更难定位的形式炸开。
|
||||
if (!graph.steps.containsKey(source)) {
|
||||
throw new IllegalArgumentException(
|
||||
"连线引用了不存在的起始节点: " + source + "(edgeId=" + edge.getString("edgeId") + ")");
|
||||
}
|
||||
if (!graph.steps.containsKey(target)) {
|
||||
throw new IllegalArgumentException(
|
||||
"连线引用了不存在的目标节点: " + target + "(edgeId=" + edge.getString("edgeId") + ")");
|
||||
}
|
||||
graph.edges.add(edge);
|
||||
graph.outgoing.get(source).add(target);
|
||||
|
||||
+9
-1
@@ -61,7 +61,15 @@ public class FlowServiceImpl extends SswflowServiceImpl<FlowMapper, FlowEntity>
|
||||
errors.add("流程不存在");
|
||||
return errors;
|
||||
}
|
||||
FlowGraph graph = FlowGraph.parse(flow.getSteps(), flow.getEdges());
|
||||
FlowGraph graph;
|
||||
try {
|
||||
graph = FlowGraph.parse(flow.getSteps(), flow.getEdges());
|
||||
} catch (IllegalArgumentException e) {
|
||||
// 画布结构损坏(如悬空边):转成用户可读的校验错误,
|
||||
// validate 的契约是返回错误列表而不是抛异常。
|
||||
errors.add(e.getMessage());
|
||||
return errors;
|
||||
}
|
||||
if (graph.isEmpty()) {
|
||||
errors.add("画布为空,请先拖入算子");
|
||||
return errors;
|
||||
|
||||
Reference in new issue
Block a user