Skip to content

feat: 记录办理人与办理身份,补齐已办留痕 (#306) - #307

Merged
xlorne merged 2 commits into
devfrom
feature/issue-306-handle-operator-identity
Dec 3, 2026
Merged

xlorne merged 2 commits into
devfrom
feature/issue-306-handle-operator-identity

Conversation

@xlorne

@xlorne xlorne commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

背景

Closes #306。

办结一条记录时,此前不写任何身份字段:

字段 实际语义
current_operator_* 这条待办归属谁
submit_operator_* 创建这条记录时的上游提交人
interfered_operator_* 他人代办

FlowRecord#update(flowSession, pass) 只更新表单、动作、意见、状态,没有身份赋值;FlowActionService 拿到的办理人身份只用于生成下游记录的 submitOperator。因此最后一步(无下游、当前也不产生 END 记录)办理身份彻底丢失,中间节点也只能跳一条到下游 submit_* 间接推断。

复现场景:department1 发起,审批节点以 department2 同意,库里整条链路只有 department1。

变更

领域模型

  • FlowRecord 新增 handleOperatorId / handleOperatorName / handleOperatorIdentity;
  • 新增 markHandleOperator(IFlowOperator) 与 clearHandleOperator(),后者在 newRecord() 中调用,避免记录回到未办理状态时残留办理人。

写入点(显式,不放 update() 内)

PassAction、ReturnAction、RejectAction、TransferAction、DelegateAction 办结后调用 markHandleOperator(flowSession.getCurrentOperator())。

不写入:SaveAction(暂存,pass=false)与 notifyRecord()(抄送刷新)。这两处也走 update(),若在里面隐式写入,会把暂存人、抄送接收人误记成办理人 —— 这是本次刻意不用 update() 集中处理的原因。

持久化与查询

  • FlowRecordEntity 增 3 列、FlowRecordConvertor 双向映射(identity 走 normalize/validate);
  • FlowRecordContent 暴露三个字段(from(FlowTodoRecord) 不返回,待办没有办理人语义);
  • docs/Integration/sql/0.3.0-operator-identity.sql 补列。

文档:operator-identity.md §4.1 列表补列,§4.4 留痕口径改成三字段对照表并说明 #306 之前的行为,§5 兼容性补回填说明。

兼容性

测试

新增 HandleOperatorIdentityFlowTest(3 例,USER_ONLY):

  1. 最后一步办理:current_* 保持默认身份不被改写,handleOperator* = department2;
  2. 中间节点办理:handle_* = department2,下游待办 submit_* 同为 department2;
  3. 暂存:记录仍为待办,handle_* 保持空值。

./mvnw -pl flow-engine-framework test:518 例通过(原 515 + 新增 3),0 失败 0 错误。

依赖

base 为 feature/issue-303-operator-script-resolver(#304 未合入 dev)。#304 合入后本 PR 可随之进入主线。

办结动作此前不写任何身份字段:current_* 是待办归属、submit_* 是创建该记录时的上游提交人,
最后一步办理身份因此没有落点。新增 handle_operator_id/name/identity 三元组,由办结动作显式写入。

- FlowRecord 新增 handleOperator 三元组与 markHandleOperator / clearHandleOperator
- Pass / Return / Reject / Transfer / Delegate 办结后写入;SaveAction 暂存与 notifyRecord 抄送不写
- FlowRecordEntity / FlowRecordConvertor / FlowRecordContent 补齐映射(存量数据为空)
- DDL 脚本补三列,operator-identity.md 更新留痕口径

Closes #306
查询层通过 FlowRecordContentConvertor.convert(FlowRecordEntity) 组装列表数据,
不走领域对象链路;本次只改了领域对象与实体映射,漏了该转换器,
导致已落库的办理人/办理身份在已办、全部流程列表始终返回 null,
前端只能回退到待办归属人。

- 转换器补 handleOperatorId/Name/Identity 映射(存量数据身份归一化为空串)
- 新增 FlowRecordContentConvertorTest 覆盖已办记录与存量记录两种情况
@xlorne
xlorne changed the base branch from feature/issue-303-operator-script-resolver to dev December 3, 2026 08:17
@xlorne
xlorne merged commit cb68b84 into dev Dec 3, 2026
@xlorne
xlorne deleted the feature/issue-306-handle-operator-identity branch December 3, 2026 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant