20260927215912

This commit is contained in:
oneao committed 2026-09-27 21:59:13 +08:00
1 parent 27e49e2e45
commit f22e67fc85
294 files changed
+29247 -3576

No files matched your search

+38 -34
View File
@@ -8,7 +8,7 @@
- 7 种节点类型全用到:start / user_task / cc_task / exclusive_gateway
/ parallel_gateway / service_task / end(§4.4)
- 6 种审批方式全用到:single / any / all / serial / n_of_m / percentage(§6.4)
- 条件分支 + 默认出口(§6.5)、并行分支与汇合、抄送节点(§9.9)
- 条件分支(两条显式条件左右分开、再汇合到中间,合起来覆盖全部取值)、并行分支与汇合、抄送节点(§9.9)
- 8 种审批人解析类型中的 5 种:dept_manager / position / org_role / user(§6.6)
- 节点扩展配置:requiredCount(n_of_m)、requiredRatio(percentage)、
formPolicy(只读/必填字段)、dueHours、allowClaim、commentRequired
@@ -20,17 +20,14 @@
3. 只写 wf_definition / wf_version / wf_node / wf_edge / wf_actor_rule;
不写 wf_binding(绑哪个模块是实施决定),也不写任何运行表。
流程走向:
流程走向(两条条件分支都是左右分开、再汇合到中间):
开始 → 部门负责人审批(或签) → 金额判断
├─ 金额 > 10000 → 总经理审批(单人) ┐
└─ 默认出口 ─────────────────────┴→ 财务复核(会签) → 并行分支
├→ 法务串行会签(串行)
├→ 抄送财务总监(抄送,自动完成)
└→ 风控按比例通过(比例 0.6)
↓ 并行汇合
是否超阈值 → 董事长审批(N 人通过,2 人)
├─ 金额 >= 50000 ┘
└─ 默认出口 → 归档 → 结束
├─ 金额 > 10000 → 总经理审批(单人) ┐
└─ 金额 <= 10000 → 财务复核(会签) ┴→ 并行分支
├→ 法务串行会签(串行) ┐
├→ 抄送财务总监(抄送) ├→ 并行汇合 → 是否超阈值
└→ 风控按比例通过(0.6)┘ ├─ 金额 >= 50000 → 董事长审批(N 人通过,2 人) ┐
└─ 金额 < 50000 → 归档 ────────────────────┴→ 结束
============================================================================ */
SET NOCOUNT ON;
@@ -38,7 +35,7 @@ SET NOCOUNT ON;
declare @def varchar(50) = 'expense_approval';
declare @ver varchar(50) = 'expense_approval_v1';
declare @by varchar(50) = 'g3soft';
declare @now datetime2 = sysdatetime();
declare @now datetime2 = sysutcdatetime();
/* ----------------------------------------------------------------------------
1. 清理(脚本可重复执行):只动本流程自己的行
@@ -64,6 +61,8 @@ delete from dbo.wf_definition where b_id = @def;
b_canvas_json 只放界面布局(节点坐标),不参与执行(§6.2)。
格式与设计器 domain 层约定一致:{ schemaVersion, nodes: { <nodeKey>: {x,y} } }
坐标是纵向(TB)排布:主干在 x=520 的中线上,两个条件分支的两条支线分别落在中线
左右(x=240 / x=800),到汇合节点再回到中线。
---------------------------------------------------------------------------- */
insert into dbo.wf_definition (b_id, b_name, b_i18n, b_canuse, b_bz,
@@ -79,20 +78,20 @@ values (@ver, @def, 1, 'published', 1,
N'{
"schemaVersion": 1,
"nodes": {
"start": { "x": 120, "y": 320 },
"dept_manager": { "x": 320, "y": 320 },
"amount_gateway": { "x": 520, "y": 320 },
"gm_approve": { "x": 720, "y": 180 },
"finance_review": { "x": 920, "y": 320 },
"parallel_split": { "x": 1120, "y": 320 },
"legal_countersign": { "x": 1320, "y": 160 },
"cc_cfo": { "x": 1320, "y": 320 },
"risk_review": { "x": 1320, "y": 480 },
"parallel_join": { "x": 1520, "y": 320 },
"big_amount_gateway":{ "x": 1720, "y": 320 },
"chairman_approve": { "x": 1920, "y": 180 },
"archive": { "x": 2120, "y": 320 },
"end": { "x": 2320, "y": 320 }
"start": { "x": 520, "y": 60 },
"dept_manager": { "x": 520, "y": 170 },
"amount_gateway": { "x": 520, "y": 280 },
"gm_approve": { "x": 240, "y": 400 },
"finance_review": { "x": 800, "y": 400 },
"parallel_split": { "x": 520, "y": 520 },
"legal_countersign": { "x": 200, "y": 640 },
"cc_cfo": { "x": 520, "y": 640 },
"risk_review": { "x": 840, "y": 640 },
"parallel_join": { "x": 520, "y": 760 },
"big_amount_gateway":{ "x": 520, "y": 870 },
"chairman_approve": { "x": 240, "y": 990 },
"archive": { "x": 800, "y": 990 },
"end": { "x": 520, "y": 1110 }
}
}',
'mock-checksum-expense_approval_v1', @by, @now, N'模拟数据:已发布版本',
@@ -181,7 +180,8 @@ values
/* ----------------------------------------------------------------------------
4. 连线(17 条)
b_condition_json 为 null 表示默认出口;条件分支节点必须至少有一条(§6.5)。
b_condition_json 为 null 表示无条件的兜底分支。本样本两条条件分支都写成显式条件,
两条合起来覆盖全部取值,不依赖兜底(§6.5)。
b_priority 小的先判断。
---------------------------------------------------------------------------- */
@@ -191,11 +191,13 @@ values
('e_exp_01', @ver, 'start', 'dept_manager', null, null, 10, 1, null),
('e_exp_02', @ver, 'dept_manager', 'amount_gateway', null, null, 10, 1, null),
-- 金额判断:> 10000 走总经理,否则直接进财务复核(默认出口)
-- 金额判断:> 10000 走总经理,<= 10000 走财务复核。两条都是显式条件,合起来覆盖全部金额
('e_exp_03', @ver, 'amount_gateway', 'gm_approve', N'金额大于 1 万',
N'{"field":"b_amount","operator":"gt","value":10000}', 10, 1, null),
('e_exp_04', @ver, 'amount_gateway', 'finance_review', N'默认出口', null, 20, 1, N'金额不大于 10000'),
('e_exp_05', @ver, 'gm_approve', 'finance_review', null, null, 10, 1, null),
('e_exp_04', @ver, 'amount_gateway', 'finance_review', N'金额不大于 1 万',
N'{"field":"b_amount","operator":"le","value":10000}', 20, 1, null),
-- 总经理审批 → 并行分支:与「财务复核」并列,两条支线在并行分支汇合
('e_exp_05', @ver, 'gm_approve', 'parallel_split', null, null, 10, 1, null),
('e_exp_06', @ver, 'finance_review', 'parallel_split', null, null, 10, 1, null),
-- 并行分支:三条出线同时激活
@@ -209,12 +211,14 @@ values
('e_exp_12', @ver, 'risk_review', 'parallel_join', null, null, 10, 1, null),
('e_exp_13', @ver, 'parallel_join', 'big_amount_gateway',null, null, 10, 1, null),
-- 是否超阈值:>= 50000 要董事长,否则直接归档(默认出口)
-- 是否超阈值:>= 50000 走董事长审批,< 50000 走归档。两条都是显式条件,合起来覆盖全部金额
('e_exp_14', @ver, 'big_amount_gateway','chairman_approve', N'金额大于等于 5 万',
N'{"field":"b_amount","operator":"ge","value":50000}', 10, 1, null),
('e_exp_15', @ver, 'big_amount_gateway','archive', N'默认出口', null, 20, 1, N'金额小于 50000'),
('e_exp_16', @ver, 'chairman_approve', 'archive', null, null, 10, 1, null),
('e_exp_17', @ver, 'archive', 'end', null, null, 10, 1, null);
('e_exp_15', @ver, 'big_amount_gateway','archive', N'金额小于 5 万',
N'{"field":"b_amount","operator":"lt","value":50000}', 20, 1, null),
-- 董事长审批 → 结束:与「归档」并列,两条支线在结束汇合
('e_exp_16', @ver, 'chairman_approve', 'end', null, null, 10, 1, null),
('e_exp_17', @ver, 'archive', 'end', null, null, 10, 1, null);
/* ----------------------------------------------------------------------------
5. 审批人 / 抄送人规则