Repository navigation
feat: 运行中流程实例强制同步最新流程设计 (#281) - #282
Merged
Merged
Conversation
- 新增 FlowForceSyncService:按选中实例把运行时快照引用换绑为最新设计对应的快照, 未选中实例保持原快照,历史快照内容不被改写; - 新增 WorkflowStructureVerifier:逐实例校验节点集合/类型/父子层级/同层顺序, 并校验旧按钮动作必须保留(允许新增),表单字段不校验; - 新增 FlowTodoMigrateService:合并待办按实例拆组并重算合并计数与代表记录, 避免跨实例待办在换绑后错配; - 新增 POST /api/cmd/record/forceSync 与 GET /api/query/record/running; - 新增 FlowRecordForceSyncEvent,按 processId 分区投递。 Closes #281
GET /api/query/record/running 的 current 参数改为1起始(默认1), 控制器内转换为 Spring PageRequest 的0起始页码,避免前端分页组件选第一页时跳过数据。 Refs #281
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
Closes #281
流程实例启动后以启动时的
WorkflowRuntime快照执行,设计侧后续修改不会影响运行实例。本 PR 增加「运行中实例强制同步最新流程设计」能力:只把选中的运行实例换绑到最新设计对应的快照,未选中的实例保持原快照。实现要点
(workId, updatedTime)复用WorkflowService#getOrCreateWorkflowRuntime生成/复用快照,只改写选中实例的FlowRecord.workRuntimeId。WorkflowStructureVerifier):逐实例以各自旧快照为基准,比对节点集合、节点类型、父子层级(blocks)、同层顺序(order);旧快照中已有的按钮动作必须保留且类型不变,允许新增动作;表单字段不做校验。任一实例不一致则整批拒绝并返回差异明细。FlowTodoMigrateService):todoKey = 合并依据 + workRuntimeId + nodeId且不含 processId,同快照下多实例待办会合并成一行;换绑前按FlowTodoMerge.recordId精确摘除本实例记录、重算margeCount与代表记录,换绑后按新键重建待办组。flowState = RUNNING)实例;实例内记录快照不一致时拒绝。FlowRecordForceSyncEvent(eventKey = processId),每个被同步实例一条。新增接口
GET /api/query/record/running?workCode=&title=¤t=&pageSize=POST /api/cmd/record/forceSync{ "workCode": "...", "processIds": ["..."] },返回{ workflowRuntimeId, workVersion, syncedProcessIds, skippedProcessIds }测试
新增
WorkflowStructureVerifierTest(7 例)与FlowForceSyncServiceTest(7 例),覆盖:验证结果:
./mvnw test在 framework 398 例通过;flow-engine-starter中SpringFlowEventPublisherIntegrationTest的 2 个用例在dev基线上同样失败(异步事件投递时序问题,与本 PR 无关),其余全部通过。兼容性
FlowRecordQueryService新增方法findRunningInstancePage,两个实现(starter-query、mock)已同步;外部若有自定义实现需补齐该方法。后续
前端入口(设计页「强制同步」按钮 + 实例选择弹窗)在
codingapi/flow-frontend单独提交 PR,本 PR 不更新子模块指针。