From 26532a64c306167bf0df32a29f048f83a2466417 Mon Sep 17 00:00:00 2001
From: zhengwr
Date: Thu, 2 Jul 2026 13:04:58 +0800
Subject: [PATCH 1/2] =?UTF-8?q?docs(plan):=20=E7=BA=A2=E7=BA=BF=E8=A1=A5?=
=?UTF-8?q?=E2=80=94=E2=80=94=E5=90=88main=E5=89=8D=E5=85=A8reactor?=
=?UTF-8?q?=E7=9C=9F=E7=BB=BF(ArchUnit=E5=9C=A8platform-app)+=E6=8E=A7?=
=?UTF-8?q?=E5=88=B6=E5=99=A8SQL=E6=94=B6=E5=8F=A3Service?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Co-Authored-By: Claude Fable 5
---
docs/plans/2026-07-02-在线流程Modeler-实施计划.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/plans/2026-07-02-在线流程Modeler-实施计划.md b/docs/plans/2026-07-02-在线流程Modeler-实施计划.md
index 4c12460..6276ae4 100644
--- a/docs/plans/2026-07-02-在线流程Modeler-实施计划.md
+++ b/docs/plans/2026-07-02-在线流程Modeler-实施计划.md
@@ -368,4 +368,4 @@ commit:`test(modeler): 流程Modeler live e2e(改存量/新建/走查 3 场景
## 红线提醒(执行中不可越)
-**生产 8089 不对外**(T1.6 评审:门在网关的前提=flowable-service 网络隔离,阶段 3 部署门验收清单显式检查,deploy/nginx/compose 不得暴露 8089);flowable `databaseSchemaUpdate=false` 不动(act_re_model 已存在无需 DDL;审计表走 Flyway V4 是平台表非引擎表);保真层 `com.dsasp.*` 不改(BasePropertiesConverter 只读对齐,不重构);XML 解析一律钉 JDK 解析器(xerces 击穿前科);JDK 21;部署门只落网关(flowable-service 裸 8089 无安全栈);每 task TDD、每阶段对抗自查后才合 main。
+**每阶段合 main 前必须全 reactor `mvn clean install` 真绿**(模块级 `mvn -pl` 跑不到 platform-app 的 ArchitectureRulesTest,阶段2 wftemplates 给 @RestController 注 JdbcTemplate 触棘轮就是模块级漏过、全 reactor 才 catch;且判绿看 `BUILD SUCCESS` 字样,勿信 `| tail` 后的 `$?`=tail 退出码);控制器新增 SQL 一律收口 Service(ArchUnit 棘轮禁 @RestController 直用 JdbcTemplate);**生产 8089 不对外**(T1.6 评审:门在网关的前提=flowable-service 网络隔离,阶段 3 部署门验收清单显式检查,deploy/nginx/compose 不得暴露 8089);flowable `databaseSchemaUpdate=false` 不动(act_re_model 已存在无需 DDL;审计表走 Flyway V4 是平台表非引擎表);保真层 `com.dsasp.*` 不改(BasePropertiesConverter 只读对齐,不重构);XML 解析一律钉 JDK 解析器(xerces 击穿前科);JDK 21;部署门只落网关(flowable-service 裸 8089 无安全栈);每 task TDD、每阶段对抗自查后才合 main。
From 647f06836f4414f83301e216d92f8d9467a0d852 Mon Sep 17 00:00:00 2001
From: zhengwr
Date: Thu, 2 Jul 2026 13:13:32 +0800
Subject: [PATCH 2/2] =?UTF-8?q?fix(gateway):=20wftemplates=20SQL=20?=
=?UTF-8?q?=E6=94=B6=E5=8F=A3=20WfTemplatePickerService(=E4=BF=AE=20ArchUn?=
=?UTF-8?q?it=20=E6=8E=A7=E5=88=B6=E5=99=A8JdbcTemplate=E6=A3=98=E8=BD=AE)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
T2.2 给 ProcessModelerController(@RestController)直注 JdbcTemplate 触发 platform-app
ArchitectureRulesTest 棘轮「控制器不得新增直用 JdbcTemplate」(该测试在 platform-app 扫全模块,
模块级 mvn -pl 跑不到故 T2.2 时未暴露,main 全 reactor 失败)。按规则本意收口(不加白名单):
- 新建 platform-flow-gateway aggregate/WfTemplatePickerService(@Service):wftemplates 的 JdbcTemplate
查询(view_wftemplate_id + entityid→sys_entity.name LEFT JOIN + trim CHAR 补白 + isactive=1 +
读库异常降级)整体搬入,暴露 listTemplates() 返 {templates} / 降级 {templates:[],degraded:true}。
Service 用 JdbcTemplate 不违规,规则只禁 @RestController。
- ProcessModelerController 去掉 JdbcTemplate 字段/构造参 + SQL/RowMapper 常量,改注入 WfTemplatePickerService,
wftemplates 端点只保留超管门 + 透传。
测试:新建 WfTemplatePickerServiceTest(2:trim补白+回退id+正常不带degraded / 读库异常降级带degraded);
ProcessModelerControllerTest 的 wftemplates 三例(直查 JdbcTemplate)收敛为两例(超管透传 service 结果 /
非超管 403 不调 service),jdbcTemplate mock 换 WfTemplatePickerService mock。
验证(全 reactor,ArchitectureRulesTest 真跑):JAVA_HOME=...openjdk@21 mvn clean install -q → 退出码 0;
ArchitectureRulesTest 6/6 绿(JdbcTemplate 棘轮通过)、WfTemplatePickerServiceTest 2、ProcessModelerControllerTest 22、
FlowableClientTest 20,全 reactor 零失败报告。
Co-Authored-By: Claude Fable 5
---
.../aggregate/WfTemplatePickerService.java | 80 +++++++++++++++++++
.../web/ProcessModelerController.java | 67 +++-------------
.../ProcessModelerControllerTest.java | 54 +++----------
.../WfTemplatePickerServiceTest.java | 65 +++++++++++++++
4 files changed, 167 insertions(+), 99 deletions(-)
create mode 100644 platform-flow-gateway/src/main/java/com/eip4/platform/flowgateway/aggregate/WfTemplatePickerService.java
create mode 100644 platform-flow-gateway/src/test/java/com/eip4/platform/flowgateway/WfTemplatePickerServiceTest.java
diff --git a/platform-flow-gateway/src/main/java/com/eip4/platform/flowgateway/aggregate/WfTemplatePickerService.java b/platform-flow-gateway/src/main/java/com/eip4/platform/flowgateway/aggregate/WfTemplatePickerService.java
new file mode 100644
index 0000000..26419bd
--- /dev/null
+++ b/platform-flow-gateway/src/main/java/com/eip4/platform/flowgateway/aggregate/WfTemplatePickerService.java
@@ -0,0 +1,80 @@
+package com.eip4.platform.flowgateway.aggregate;
+
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.jdbc.core.RowMapper;
+import org.springframework.stereotype.Service;
+
+/**
+ * wftemplate 选择器数据源:为在线流程 Modeler 的办理人/会签 formKey 下拉提供 {@code {id,name}} 列表。
+ *
+ * 为何是 Service 而非控制器直查:{@code @RestController} 直持 {@link JdbcTemplate} 拼 SQL 会让
+ * 现代层退化成第二个「SQL 散落层」(架构棘轮 {@code 控制器不得新增直用JdbcTemplate} 禁止新增此类),
+ * 故 SQL 收口到本 Service,控制器只保留超管门 + 透传。
+ *
+ * 名称来源实证(information_schema):{@code view_wftemplate}(1016 行已迁移)无独立名称列
+ * (仅 {@code view_wftemplate_id CHAR + xml + isactive + 审计列}),{@code
+ */
+@Service
+public class WfTemplatePickerService {
+
+ private static final Logger log = LoggerFactory.getLogger(WfTemplatePickerService.class);
+
+ /** 选择器 SQL:view_wftemplate_id + entityid→sys_entity.name(LEFT JOIN + 正则抽 entityid),isactive=1,名称升序。 */
+ static final String WFTEMPLATES_SQL =
+ "SELECT t.view_wftemplate_id AS id, se.name AS name "
+ + "FROM view_wftemplate t "
+ + "LEFT JOIN sys_entity se "
+ + " ON se.sys_entity_id = substring(CAST(t.xml AS text) FROM 'entityid=\"([0-9a-fA-F-]+)\"') "
+ + "WHERE t.isactive = 1 "
+ + "ORDER BY se.name NULLS LAST, t.view_wftemplate_id";
+
+ /** 单行 → {@code {id(trim 补白),name(实体名,空则回退 id)}}。 */
+ static final RowMapper