Files
eip4-platform/platform-flow-gateway/pom.xml
zhengwr ac9812e0a1 P3-4: platform-flow-gateway 单体侧流程网关(Flowable REST 客户端 + 待办聚合 + 事件回写)
- FlowableClient:RestClient 调 flowable-service(eip4.flow.base-url,默认 8089);
  超时/重试(仅连接级)/熔断降级——引擎不可达 → 503 语义(非 500 堆栈),业务错 4xx/5xx 透传。
- 待办聚合(经 platform-app 暴露):GET /api/todo(JWT userId+roles 候选组)、GET /api/done、
  POST /api/task/{id}/complete、POST /api/process/start;聚合层把 Flowable 任务与业务摘要连接
  (businessKey → SYS_DATASTATUS.tablename → loadPOJO 只读标题字段;业务摘要数据源客户库只读,
  拼不到优雅降级为仅流程字段)。
- 事件回写:complete 后按老系统 ProcessCoreServiceImpl.passProcess + WfChangeStatus 语义更新
  SYS_DATASTATUS(结束→STATUS_PASS=3,未结束→STATUS_PROCESSING=2,守卫 oldstatus<status 单调递增;
  upsert UPDATE 命中或 0 行 INSERT);本地库验证,客户库只读。
- flowable-service 契约增强:Flowable 6.8.1 TaskInfo 无 getBusinessKey(),todo/done 出参由查询侧
  从实例补全 businessKey;新增 GET /api/flow/process/{id} 查实例(供办理后判定流程是否结束)。

验证(8089 连本地 eip4flow+客户库只读,8090 连本地 eip4m0,8084 未动):
- 待办聚合数=直查一致:真实用户 829cdcca /api/todo=4 == 8089 直查 count=4。
- 业务摘要拼接正确 + 优雅降级共存:命中条目拼到 SYS_USERGROUP 标题字段,同列表 3 条无映射降级为仅流程字段。
- 熔断:kill 8089 后 /api/todo 返回 503 干净 JSON,platform-app 进程存活不崩。
- 事件回写:本地构造 datastatus=1,经 8090 complete(流程结束)回写为 3;引擎侧实例确结束。
- 21 单测(客户端重试/降级、聚合拼接、回写守卫)+ 全模块 mvn test + ArchUnit 绿。

坑入手册 §6.8(TaskInfo 无 businessKey)/§6.9(503 熔断 + 回写守卫 + SYS_DATASTATUS 无主键)。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 15:12:03 +08:00

48 lines
2.8 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.eip4</groupId>
<artifactId>eip4-platform</artifactId>
<version>0.1.0-SNAPSHOT</version>
</parent>
<artifactId>platform-flow-gateway</artifactId>
<name>platform-flow-gateway</name>
<description>
P3-4 单体侧流程网关:Flowable REST 客户端 + 待办聚合 + 事件回写。
引擎在独立 flowable-service(端口 8089),本模块只做 HTTP 客户端(架构第三节)。
- FlowableClient:RestClient 调 flowable-service(基址 eip4.flow.base-url,默认 http://localhost:8089),
超时/重试/熔断降级(服务不可达 → FlowServiceUnavailableException → 503 语义,非 500 堆栈)。
- 待办聚合(经 platform-app 暴露):GET /api/todo、GET /api/done、POST /api/task/{id}/complete、
POST /api/process/start;聚合层把 Flowable 任务与业务摘要连接(businessKey → SYS_DATASTATUS.tablename
→ 引擎 loadPOJO 只读标题字段;业务摘要数据源=客户库只读;拼不到优雅降级为仅流程字段)。
- 事件回写:complete 后按老系统 ProcessCoreServiceImpl/WfChangeStatus 语义更新 SYS_DATASTATUS
(STATUS_PROCESSING=2/STATUS_PASS=3,守卫 oldstatus &lt; status 单调递增);本地库验证,客户库只读。
</description>
<dependencies>
<!-- 业务摘要经引擎 loadPOJO 只读(SYS_DATASTATUS 映射 + 业务表标题字段);回写经 JdbcTemplate -->
<dependency><groupId>com.eip4</groupId><artifactId>platform-legacy-core</artifactId></dependency>
<!-- 待办聚合从 JWT 上下文取 userId / roles(候选组待办) -->
<dependency><groupId>com.eip4</groupId><artifactId>platform-auth</artifactId></dependency>
<!-- REST 客户端(RestClient,Spring 6/Boot 3.3 内置)+ Controller 门面 -->
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency>
<!-- 回写/业务摘要走 JdbcTemplate -->
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-jdbc</artifactId></dependency>
<!-- OpenAPI 注解(与现代层口径一致) -->
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>