P4前置: 闭环 flowable-service projectRoleType 候选人解析 + 长尾收敛

侦察老系统语义(以代码为准):projectRoleType 在 com.dsasp.server.wf
CandidateUsersHandler 单独分派(非 organize 的 AssignmentHandlerImpl),
调客户私有 ProjectRoleUser.getUserByProjectRole(projectId, "八大员位枚举");
framework 无该实现(项目定制 OSGi 扩展点)。解析链经客户库数据模型反推 +
真实流程任务实证锁定:content 位序(1-based)即 pm_project_user.role。

实现:
- OrgDirectoryJdbc.getUsersByProjectRole 去 WARN 降级,参数化直查
  pm_project_user(pm_projectid + role IN(true 位序) + isactive=1),
  保留 ProjectRoleResolver 钩子作客户私有覆盖位;
- 顺带闭环长尾: initiatorDepartManager(view_sys_user.masterdepart 子查询
  →sys_depart.leader)、fixedDimension(view_sys_dimensiondepart 维度树
  向上回溯)、sameToTask(historyService 取前序 userTask assignee);
- CandidateController 加 GET /project-role 对账端点。

验证(8089 起本地 eip4flow + 客户库只读):5 个真实 projectRoleType 任务
REST==手工 SQL(含数据漂移空例);initiatorDepartManager/fixedDimension
真实数据对账一致;P3 position/user 回归不破;新增 7 单测(原 26→33),
全反应堆 mvn test + ArchUnit 绿。

缺口:降级类型 5 类→1 类(仅 scriptUser 26 处),覆盖率 91%→99.46%。
scriptUser 需活的 ExecutionEntity + 反序列化变量,超独立服务边界,留方案。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-06-11 15:41:57 +08:00
parent f4fef670ac
commit 3a13c50a01
7 changed files with 597 additions and 25 deletions

View File

@@ -511,9 +511,27 @@ com.dsasp.* com.eip4.*
| **现象** | §6.3 原写「将 3 个 handler 移植到 `platform-flow-gateway`」;但架构第三节裁定交付为 4 进程,`flowable-service.jar` 是独立进程、引擎在独立服务,`platform-flow-gateway` 只做客户端。handler 须随引擎落在 **`flowable-service`** 模块,非 gateway |
| **根因** | 候选人表达式由 Flowable 引擎在 `cfg.setBeans` 注册的 bean 上求值,bean 必须与引擎同进程;gateway 是 REST 客户端、无引擎,注册无意义 |
| **对策** | handler 按原包名移植进 `flowable-service`(`com.dsasp.server.wf.*`),bean 名不变经 `cfg.setBeans` 注册。**关键裁剪**:原版 handler 经 `SpringBeanOsgiServices` 取 `AssignmentHandler`/`UserFindService`/`OrganizationService`,传递闭包是整个保真层元数据/CRUD 引擎(`POJOCRUDService`/`GeneralPOJO`);独立服务**不拖入该闭包**,改为 `OrgDirectory` 窄接口 + `OrgDirectoryJdbc` 直查业务组织库 SQL(逐条对齐 framework `AssignmentHandlerImpl`/`UserFindServiceImpl`/`OrganizationServiceImpl`)。OSGi 取 bean → `WfBeanRegistry`(§3.1/§5.17 替换类策略)。详见 `flowable-service/P3流程服务实测报告.md` 第二节 |
| **覆盖面** | 实测配置类型分布 position 1949/user 1683/formSpecifiedDimension 601/depart 14/initiator 3 等占主导(~91%)已直查覆盖;scriptUser(JUEL 脚本)/initiatorDepartManager·fixedDimension(依赖 SYS_USER.MASTERDEPART 元数据虚拟列,客户库无物理列)/sameToTask(前序活动栈)/projectRoleType(项目定制扩展)依赖保真层或定制,WARN 降级,P3-4 聚合或保真层接入补齐 |
| **覆盖面(P3 基线)** | 实测配置类型分布 position 1949/user 1683/formSpecifiedDimension 601/depart 14/initiator 3 等占主导(~91%)已直查覆盖;scriptUser(JUEL 脚本)/initiatorDepartManager·fixedDimension(依赖 SYS_USER.MASTERDEPART 元数据虚拟列,客户库无物理列)/sameToTask(前序活动栈)/projectRoleType(项目定制扩展)当时 WARN 降级 |
| **覆盖面(P4 闭环后,2026-06-11 更新)** | 缺口表见下;**降级类型从 5 类收敛到 1 类,候选人覆盖率 91%→99.46%**,唯一剩余降级为 scriptUser(26 处,0.54%)。详见 `flowable-service/P4前置-projectRoleType闭环报告.md` |
| **影响范围** | P3 模块落点(flowable-service 而非 gateway);gateway 聚合实现是 P3-4 客户端任务 |
#### 6.5.1 候选人配置类型缺口表(P4 前置闭环后,2026-06-11)
| 类型 | 频次 | 占比 | 状态 | 解析链落点 |
|------|-----:|-----:|------|-----------|
| position | 1949 | 40.2% | ✅ P3 | `sys_positionuser` where positionid IN(...) |
| user | 1683 | 34.7% | ✅ P3 | content 即 userid,直返 |
| formSpecifiedDimension | 601 | 12.4% | ✅ P3 | 部门→岗位类别岗位→人员,部门内无则回退公司 |
| **projectRoleType** | 528 | 10.9% | ✅ **P4 闭环** | `pm_project_user` where pm_projectid=? and role IN(八大员 true 位序) and isactive=1;位序 1-based↔role 编号;客户私有 `ProjectRoleUser` 注入时优先委托 |
| **scriptUser** | **26** | **0.54%** | ⛔ **唯一剩余降级** | JUEL 脚本 `${var}`,需活的 ExecutionEntity + 反序列化变量(实测 serializable 15/null 14/string 7),超独立服务边界,WARN 降级;方案见 P4 报告 §5.1 |
| **initiatorDepartManager** | 24 | 0.50% | ✅ **P4 闭环** | `getMainDepart`(MASTERDEPART 经 `view_sys_user.masterdepart` 子查询:positionuser.ismaster=1→position.parentdepartid)→ `sys_depart.leader` |
| depart | 14 | 0.29% | ✅ P3 | 部门→岗位→人员 |
| **fixedDimension** | 12 | 0.25% | ✅ **P4 闭环** | content=维度,岗位类别...;经 `view_sys_dimensiondepart`(parentdepartids 祖先链)本部门命中或向上回溯 |
| **sameToTask** | 5 | 0.10% | ✅ **P4 闭环** | `historyService` 取流程实例下已结束 userTask 按结束时间倒序第一条 assignee(content 为指定活动 id),对齐 `ProcessCoreServiceImpl.getSpecialActivityProcessor` |
| initiator | 3 | 0.06% | ✅ P3 | 发起人本人(流程变量 WFINITIATORUSERID) |
> 总计 4845 处:覆盖 4819(99.46%),剩余降级 26(scriptUser,0.54%)。
### 6.6 Flowable 独立服务 Boot 自动装配两坑 [NEW 2026-06-11]
| 栏目 | 内容 |