xiaoyi
10 天以前 fae95228037f0c1304c1917ae5fff452f2160c5a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
-- ============================================================
-- 电力数转第十六阶段:BPM 审批流程定义部署(直插 Flowable + yudao 流程定义信息)
-- 覆盖 4 个已建功能但缺流程定义的审批:
--   refund_approve(209 退费) / cancellation_approve(210 销户)
--   performance_appraise_approve(211 绩效) / compensation_approve(212 赔付)
-- 模板 = purchase_request_approve:3(有 3 个运行实例,被实际跑通):
--   发起人节点(提交)→ 审批人节点(USER 策略,审批人=超级管理员 id=1)→ 结束
-- 注意:直插后需【重启后端】Flowable 引擎才会加载这些流程定义
-- ============================================================
 
-- 1. act_re_deployment(部署记录)
INSERT INTO `act_re_deployment` (`ID_`, `NAME_`, `CATEGORY_`, `TENANT_ID_`, `DEPLOY_TIME_`) VALUES
('refund-deploy-20260820', 'refund_approve.bpmn', 'refund_approve', '', NOW(3)),
('cancellation-deploy-20260820', 'cancellation_approve.bpmn', 'cancellation_approve', '', NOW(3)),
('performance-deploy-20260820', 'performance_appraise_approve.bpmn', 'performance_appraise_approve', '', NOW(3)),
('compensation-deploy-20260820', 'compensation_approve.bpmn', 'compensation_approve', '', NOW(3));
 
-- 2. act_ge_bytearray(BPMN 文件内容,refund 完整内联,其余由它派生)
INSERT INTO `act_ge_bytearray` (`ID_`, `REV_`, `NAME_`, `DEPLOYMENT_ID_`, `BYTES_`, `GENERATED_`) VALUES
('refund-byte-20260820', 1, 'refund_approve.bpmn', 'refund-deploy-20260820', '<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:flowable="http://flowable.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.omg.org/spec/BPMN/20100524/MODEL">
  <process id="refund_approve" name="退费审批" isExecutable="true">
    <startEvent id="StartEvent" name="开始"></startEvent>
    <userTask id="StartUserNode" name="发起人">
      <extensionElements>
        <flowable:approveType xmlns:flowable="http://flowable.org/bpmn"><![CDATA[1]]></flowable:approveType>
        <flowable:candidateStrategy xmlns:flowable="http://flowable.org/bpmn"><![CDATA[36]]></flowable:candidateStrategy>
        <flowable:buttonsSetting xmlns:flowable="http://flowable.org/bpmn" displayName="提交" enable="true" id="1"></flowable:buttonsSetting>
        <flowable:buttonsSetting xmlns:flowable="http://flowable.org/bpmn" displayName="拒绝" enable="false" id="2"></flowable:buttonsSetting>
        <flowable:buttonsSetting xmlns:flowable="http://flowable.org/bpmn" displayName="转办" enable="false" id="3"></flowable:buttonsSetting>
        <flowable:buttonsSetting xmlns:flowable="http://flowable.org/bpmn" displayName="委派" enable="false" id="4"></flowable:buttonsSetting>
        <flowable:buttonsSetting xmlns:flowable="http://flowable.org/bpmn" displayName="加签" enable="false" id="5"></flowable:buttonsSetting>
        <flowable:buttonsSetting xmlns:flowable="http://flowable.org/bpmn" displayName="退回" enable="false" id="6"></flowable:buttonsSetting>
        <flowable:assignStartUserHandlerType xmlns:flowable="http://flowable.org/bpmn"><![CDATA[2]]></flowable:assignStartUserHandlerType>
      </extensionElements>
    </userTask>
    <userTask id="Activity_refund_approve" name="退费审批">
      <extensionElements>
        <flowable:approveType xmlns:flowable="http://flowable.org/bpmn"><![CDATA[1]]></flowable:approveType>
        <flowable:candidateStrategy xmlns:flowable="http://flowable.org/bpmn"><![CDATA[30]]></flowable:candidateStrategy>
        <flowable:candidateParam xmlns:flowable="http://flowable.org/bpmn"><![CDATA[1]]></flowable:candidateParam>
        <flowable:buttonsSetting xmlns:flowable="http://flowable.org/bpmn" displayName="通过" enable="true" id="1"></flowable:buttonsSetting>
        <flowable:buttonsSetting xmlns:flowable="http://flowable.org/bpmn" displayName="拒绝" enable="true" id="2"></flowable:buttonsSetting>
        <flowable:buttonsSetting xmlns:flowable="http://flowable.org/bpmn" displayName="转办" enable="true" id="3"></flowable:buttonsSetting>
        <flowable:buttonsSetting xmlns:flowable="http://flowable.org/bpmn" displayName="委派" enable="true" id="4"></flowable:buttonsSetting>
        <flowable:buttonsSetting xmlns:flowable="http://flowable.org/bpmn" displayName="加签" enable="true" id="5"></flowable:buttonsSetting>
        <flowable:buttonsSetting xmlns:flowable="http://flowable.org/bpmn" displayName="退回" enable="true" id="6"></flowable:buttonsSetting>
        <flowable:approveMethod xmlns:flowable="http://flowable.org/bpmn"><![CDATA[4]]></flowable:approveMethod>
        <flowable:rejectHandlerType xmlns:flowable="http://flowable.org/bpmn"><![CDATA[1]]></flowable:rejectHandlerType>
        <flowable:assignStartUserHandlerType xmlns:flowable="http://flowable.org/bpmn"><![CDATA[1]]></flowable:assignStartUserHandlerType>
        <flowable:assignEmptyHandlerType xmlns:flowable="http://flowable.org/bpmn"><![CDATA[1]]></flowable:assignEmptyHandlerType>
        <flowable:signEnable xmlns:flowable="http://flowable.org/bpmn"><![CDATA[false]]></flowable:signEnable>
        <flowable:reasonRequire xmlns:flowable="http://flowable.org/bpmn"><![CDATA[false]]></flowable:reasonRequire>
        <flowable:nodeType xmlns:flowable="http://flowable.org/bpmn"><![CDATA[11]]></flowable:nodeType>
      </extensionElements>
      <multiInstanceLoopCharacteristics isSequential="true" flowable:collection="${coll_userList}">
        <loopCardinality>1</loopCardinality>
        <completionCondition>${ nrOfCompletedInstances &gt;= nrOfInstances }</completionCondition>
      </multiInstanceLoopCharacteristics>
    </userTask>
    <endEvent id="EndEvent" name="结束"></endEvent>
    <sequenceFlow id="sf1" sourceRef="StartEvent" targetRef="StartUserNode"></sequenceFlow>
    <sequenceFlow id="sf2" sourceRef="StartUserNode" targetRef="Activity_refund_approve"></sequenceFlow>
    <sequenceFlow id="sf3" sourceRef="Activity_refund_approve" targetRef="EndEvent"></sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_refund_approve">
    <bpmndi:BPMNPlane bpmnElement="refund_approve" id="BPMNPlane_refund_approve">
      <bpmndi:BPMNShape bpmnElement="StartUserNode" id="BPMNShape_StartUserNode"><omgdc:Bounds height="60.0" width="100.0" x="80.0" y="0.0"></omgdc:Bounds></bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="Activity_refund_approve" id="BPMNShape_Activity_refund_approve"><omgdc:Bounds height="60.0" width="100.0" x="230.0" y="0.0"></omgdc:Bounds></bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="StartEvent" id="BPMNShape_StartEvent"><omgdc:Bounds height="30.0" width="30.0" x="0.0" y="15.0"></omgdc:Bounds></bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="EndEvent" id="BPMNShape_EndEvent"><omgdc:Bounds height="30.0" width="30.0" x="380.0" y="15.0"></omgdc:Bounds></bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="sf1" id="BPMNEdge_sf1"><omgdi:waypoint x="30.0" y="30.0"></omgdi:waypoint><omgdi:waypoint x="80.0" y="30.0"></omgdi:waypoint></bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sf2" id="BPMNEdge_sf2"><omgdi:waypoint x="180.0" y="30.0"></omgdi:waypoint><omgdi:waypoint x="230.0" y="30.0"></omgdi:waypoint></bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sf3" id="BPMNEdge_sf3"><omgdi:waypoint x="330.0" y="30.0"></omgdi:waypoint><omgdi:waypoint x="380.0" y="30.0"></omgdi:waypoint></bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>', 0);
 
-- 其余 3 个流程 BPMN 由 refund_approve 派生(仅替换 process id/name)
INSERT INTO `act_ge_bytearray` (`ID_`, `REV_`, `NAME_`, `DEPLOYMENT_ID_`, `BYTES_`, `GENERATED_`)
SELECT 'cancellation-byte-20260820', 1, 'cancellation_approve.bpmn', 'cancellation-deploy-20260820',
       REPLACE(REPLACE(BYTES_, 'refund_approve', 'cancellation_approve'), '退费审批', '销户审批'), 0
FROM act_ge_bytearray WHERE ID_ = 'refund-byte-20260820';
 
INSERT INTO `act_ge_bytearray` (`ID_`, `REV_`, `NAME_`, `DEPLOYMENT_ID_`, `BYTES_`, `GENERATED_`)
SELECT 'performance-byte-20260820', 1, 'performance_appraise_approve.bpmn', 'performance-deploy-20260820',
       REPLACE(REPLACE(BYTES_, 'refund_approve', 'performance_appraise_approve'), '退费审批', '绩效考核审批'), 0
FROM act_ge_bytearray WHERE ID_ = 'refund-byte-20260820';
 
INSERT INTO `act_ge_bytearray` (`ID_`, `REV_`, `NAME_`, `DEPLOYMENT_ID_`, `BYTES_`, `GENERATED_`)
SELECT 'compensation-byte-20260820', 1, 'compensation_approve.bpmn', 'compensation-deploy-20260820',
       REPLACE(REPLACE(BYTES_, 'refund_approve', 'compensation_approve'), '退费审批', '赔付审批'), 0
FROM act_ge_bytearray WHERE ID_ = 'refund-byte-20260820';
 
-- 3. act_re_procdef(流程定义,SUSPENSION_STATE_=1 激活)
INSERT INTO `act_re_procdef` (`ID_`, `REV_`, `CATEGORY_`, `NAME_`, `KEY_`, `VERSION_`, `DEPLOYMENT_ID_`, `RESOURCE_NAME_`, `DGRM_RESOURCE_NAME_`, `HAS_START_FORM_KEY_`, `SUSPENSION_STATE_`, `TENANT_ID_`, `DERIVED_VERSION_`) VALUES
('refund_approve:1:refund-proc-20260820', 1, 'refund_approve', '退费审批', 'refund_approve', 1, 'refund-deploy-20260820', 'refund_approve.bpmn', NULL, 0, 1, '', 0),
('cancellation_approve:1:cancellation-proc-20260820', 1, 'cancellation_approve', '销户审批', 'cancellation_approve', 1, 'cancellation-deploy-20260820', 'cancellation_approve.bpmn', NULL, 0, 1, '', 0),
('performance_appraise_approve:1:performance-proc-20260820', 1, 'performance_appraise_approve', '绩效考核审批', 'performance_appraise_approve', 1, 'performance-deploy-20260820', 'performance_appraise_approve.bpmn', NULL, 0, 1, '', 0),
('compensation_approve:1:compensation-proc-20260820', 1, 'compensation_approve', '赔付审批', 'compensation_approve', 1, 'compensation-deploy-20260820', 'compensation_approve.bpmn', NULL, 0, 1, '', 0);
 
-- 4. bpm_process_definition_info(yudao 侧流程定义信息:可见 + 分类 + 默认表单)
INSERT INTO `bpm_process_definition_info` (`id`, `process_definition_id`, `model_id`, `model_type`, `category`, `icon`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `simple_model`, `visible`, `sort`, `start_user_ids`, `start_dept_ids`, `manager_user_ids`, `allow_cancel_running_process`, `allow_withdraw_task`, `process_id_rule`, `auto_approval_type`, `title_setting`, `summary_setting`, `process_before_trigger_setting`, `process_after_trigger_setting`, `task_before_trigger_setting`, `task_after_trigger_setting`, `print_template_setting`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES
(21, 'refund_approve:1:refund-proc-20260820', 'refund-model-20260820', 20, 'refund_approve', NULL, '', 10, 1, NULL, NULL, '', '', NULL, 1, 1781000000000, '', '', '', 1, 0, '{"infix":"","enable":false,"length":5,"prefix":"","postfix":""}', 0, '{"title":"","enable":false}', '{"enable":false,"summary":[]}', NULL, NULL, NULL, NULL, '{"enable":false,"template":""}', '1', NOW(), '1', NOW(), 0),
(22, 'cancellation_approve:1:cancellation-proc-20260820', 'cancellation-model-20260820', 20, 'cancellation_approve', NULL, '', 10, 1, NULL, NULL, '', '', NULL, 1, 1782000000000, '', '', '', 1, 0, '{"infix":"","enable":false,"length":5,"prefix":"","postfix":""}', 0, '{"title":"","enable":false}', '{"enable":false,"summary":[]}', NULL, NULL, NULL, NULL, '{"enable":false,"template":""}', '1', NOW(), '1', NOW(), 0),
(23, 'performance_appraise_approve:1:performance-proc-20260820', 'performance-model-20260820', 20, 'performance_appraise_approve', NULL, '', 10, 1, NULL, NULL, '', '', NULL, 1, 1783000000000, '', '', '', 1, 0, '{"infix":"","enable":false,"length":5,"prefix":"","postfix":""}', 0, '{"title":"","enable":false}', '{"enable":false,"summary":[]}', NULL, NULL, NULL, NULL, '{"enable":false,"template":""}', '1', NOW(), '1', NOW(), 0),
(24, 'compensation_approve:1:compensation-proc-20260820', 'compensation-model-20260820', 20, 'compensation_approve', NULL, '', 10, 1, NULL, NULL, '', '', NULL, 1, 1784000000000, '', '', '', 1, 0, '{"infix":"","enable":false,"length":5,"prefix":"","postfix":""}', 0, '{"title":"","enable":false}', '{"enable":false,"summary":[]}', NULL, NULL, NULL, NULL, '{"enable":false,"template":""}', '1', NOW(), '1', NOW(), 0);
 
-- ==================== 执行完成提示 ====================
SELECT '电力数转第十六阶段(4 个 BPM 审批流程部署)SQL 执行完成!请重启后端加载流程定义。' AS result;