@steedos-labs/plugin-workflow 3.0.97 → 3.0.98
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/main/default/client/flow2_render.client.js +1 -1
- package/main/default/manager/uuflow_manager.js +36 -0
- package/main/default/routes/api_workflow_instance_return.router.js +15 -0
- package/main/default/routes/api_workflow_instance_terminate.router.js +13 -0
- package/main/default/routes/api_workflow_retrieve.router.js +13 -0
- package/package.json +1 -1
|
@@ -1995,6 +1995,14 @@ UUFlowManager.handleSkipProcessed = async function (instance_id, flow, maxDepth
|
|
|
1995
1995
|
}
|
|
1996
1996
|
}
|
|
1997
1997
|
|
|
1998
|
+
// current_step_name 的变更必须经由 objectql 写入,以触发 instances 的 afterUpdate
|
|
1999
|
+
// (uuflowManager.triggerRecordInstanceQueue),否则滑步到结束不会生成 instance_record_queue 台账同步记录。
|
|
2000
|
+
const nextStepNameForQueue = otherSetObj1.current_step_name;
|
|
2001
|
+
const stepNameChangedForQueue = nextStepNameForQueue !== undefined && nextStepNameForQueue !== instance.current_step_name;
|
|
2002
|
+
if (stepNameChangedForQueue) {
|
|
2003
|
+
delete otherSetObj1.current_step_name;
|
|
2004
|
+
}
|
|
2005
|
+
|
|
1998
2006
|
if (Object.keys(traceSetObj1).length > 0) {
|
|
1999
2007
|
await instancesCollection.updateOne(
|
|
2000
2008
|
{ _id: instance_id },
|
|
@@ -2015,6 +2023,10 @@ UUFlowManager.handleSkipProcessed = async function (instance_id, flow, maxDepth
|
|
|
2015
2023
|
}
|
|
2016
2024
|
);
|
|
2017
2025
|
|
|
2026
|
+
if (stepNameChangedForQueue) {
|
|
2027
|
+
await getObject('instances').update(instance_id, { current_step_name: nextStepNameForQueue });
|
|
2028
|
+
}
|
|
2029
|
+
|
|
2018
2030
|
// Update instance tasks for skipped approves
|
|
2019
2031
|
for (const approve of shouldSkipApproves) {
|
|
2020
2032
|
await update_instance_tasks(instance_id, lastTrace._id, approve._id);
|
|
@@ -2139,6 +2151,14 @@ UUFlowManager.handleSkipProcessed = async function (instance_id, flow, maxDepth
|
|
|
2139
2151
|
}
|
|
2140
2152
|
}
|
|
2141
2153
|
|
|
2154
|
+
// current_step_name 的变更必须经由 objectql 写入,以触发 instances 的 afterUpdate
|
|
2155
|
+
// (uuflowManager.triggerRecordInstanceQueue),否则滑步到下一步不会生成 instance_record_queue 台账同步记录。
|
|
2156
|
+
const nextStepNameForQueue = otherSetObj2.current_step_name;
|
|
2157
|
+
const stepNameChangedForQueue = nextStepNameForQueue !== undefined && nextStepNameForQueue !== instance.current_step_name;
|
|
2158
|
+
if (stepNameChangedForQueue) {
|
|
2159
|
+
delete otherSetObj2.current_step_name;
|
|
2160
|
+
}
|
|
2161
|
+
|
|
2142
2162
|
if (Object.keys(traceSetObj2).length > 0) {
|
|
2143
2163
|
await instancesCollection.updateOne(
|
|
2144
2164
|
{ _id: instance_id },
|
|
@@ -2159,6 +2179,10 @@ UUFlowManager.handleSkipProcessed = async function (instance_id, flow, maxDepth
|
|
|
2159
2179
|
}
|
|
2160
2180
|
);
|
|
2161
2181
|
|
|
2182
|
+
if (stepNameChangedForQueue) {
|
|
2183
|
+
await getObject('instances').update(instance_id, { current_step_name: nextStepNameForQueue });
|
|
2184
|
+
}
|
|
2185
|
+
|
|
2162
2186
|
// Update instance tasks for skipped approves
|
|
2163
2187
|
for (const approve of shouldSkipApproves) {
|
|
2164
2188
|
await update_instance_tasks(instance_id, lastTrace._id, approve._id);
|
|
@@ -5022,6 +5046,14 @@ UUFlowManager.relocate = async function (instance_from_client, current_user_info
|
|
|
5022
5046
|
setObj.traces = traces;
|
|
5023
5047
|
|
|
5024
5048
|
// Update instance
|
|
5049
|
+
// current_step_name 的变更必须经由 objectql 写入,以触发 instances 的 afterUpdate
|
|
5050
|
+
// (uuflowManager.triggerRecordInstanceQueue),否则移交不会生成 instance_record_queue 台账同步记录。
|
|
5051
|
+
const nextStepNameForQueue = setObj.current_step_name;
|
|
5052
|
+
const stepNameChangedForQueue = nextStepNameForQueue !== undefined && nextStepNameForQueue !== instance.current_step_name;
|
|
5053
|
+
if (stepNameChangedForQueue) {
|
|
5054
|
+
delete setObj.current_step_name;
|
|
5055
|
+
}
|
|
5056
|
+
|
|
5025
5057
|
const updateOperation = setObj.state === 'completed'
|
|
5026
5058
|
? { $set: setObj }
|
|
5027
5059
|
: { $set: setObj, $unset: { finish_date: 1 } };
|
|
@@ -5031,6 +5063,10 @@ UUFlowManager.relocate = async function (instance_from_client, current_user_info
|
|
|
5031
5063
|
updateOperation
|
|
5032
5064
|
);
|
|
5033
5065
|
|
|
5066
|
+
if (stepNameChangedForQueue) {
|
|
5067
|
+
await getObject('instances').update(instance_id, { current_step_name: nextStepNameForQueue });
|
|
5068
|
+
}
|
|
5069
|
+
|
|
5034
5070
|
if (result.modifiedCount > 0) {
|
|
5035
5071
|
// Update instance tasks
|
|
5036
5072
|
await remove_many_instance_tasks(finishedApproveIds);
|
|
@@ -16,6 +16,7 @@ const {
|
|
|
16
16
|
} = require('../manager/instance_tasks_manager')
|
|
17
17
|
const UUFlowManager = require('../manager/uuflow_manager');
|
|
18
18
|
const { getCollection, _makeNewID } = require('../utils/collection');
|
|
19
|
+
const { getObject } = require('@steedos/objectql');
|
|
19
20
|
|
|
20
21
|
router.post('/api/workflow/v2/instance/return', requireAuthentication, async function (req, res) {
|
|
21
22
|
try {
|
|
@@ -157,6 +158,15 @@ router.post('/api/workflow/v2/instance/return', requireAuthentication, async fun
|
|
|
157
158
|
setObj.modified_by = current_user;
|
|
158
159
|
setObj.values = ins.values;
|
|
159
160
|
setObj.current_step_name = pre_trace.name;
|
|
161
|
+
|
|
162
|
+
// current_step_name 的变更必须经由 objectql 写入,以触发 instances 的 afterUpdate
|
|
163
|
+
// (uuflowManager.triggerRecordInstanceQueue),否则退回不会生成 instance_record_queue 台账同步记录。
|
|
164
|
+
const nextStepNameForQueue = setObj.current_step_name;
|
|
165
|
+
const stepNameChangedForQueue = nextStepNameForQueue !== undefined && nextStepNameForQueue !== ins.current_step_name;
|
|
166
|
+
if (stepNameChangedForQueue) {
|
|
167
|
+
delete setObj.current_step_name;
|
|
168
|
+
}
|
|
169
|
+
|
|
160
170
|
r = await instancesCollection.updateOne({
|
|
161
171
|
_id: instance_id,
|
|
162
172
|
'traces._id': last_trace._id
|
|
@@ -181,6 +191,11 @@ router.post('/api/workflow/v2/instance/return', requireAuthentication, async fun
|
|
|
181
191
|
{ $set: { processed_user_ids: [ins.applicant] } }
|
|
182
192
|
);
|
|
183
193
|
|
|
194
|
+
// 台账同步:经 objectql 重新写入 current_step_name,触发 afterUpdate 生成同步记录
|
|
195
|
+
if (stepNameChangedForQueue) {
|
|
196
|
+
await getObject('instances').update(instance_id, { current_step_name: nextStepNameForQueue });
|
|
197
|
+
}
|
|
198
|
+
|
|
184
199
|
if (r && b) {
|
|
185
200
|
await pushManager.send_message_to_specifyUser("current_user", current_user);
|
|
186
201
|
instance = await UUFlowManager.getInstance(instance_id);
|
|
@@ -16,6 +16,7 @@ const PermissionManager = require('../manager/permission_manager');
|
|
|
16
16
|
const UUFlowManager = require('../manager/uuflow_manager');
|
|
17
17
|
const pushManager = require('../manager/push_manager');
|
|
18
18
|
const { _makeNewID, getCollection } = require('../utils/collection');
|
|
19
|
+
const { getObject } = require('@steedos/objectql');
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* Terminate a workflow instance
|
|
@@ -168,11 +169,23 @@ router.post("/api/workflow/v2/instance/terminate", requireAuthentication, async
|
|
|
168
169
|
// Update instance
|
|
169
170
|
const instancesCollection = await getCollection('instances');
|
|
170
171
|
|
|
172
|
+
// current_step_name 的变更必须经由 objectql 写入,以触发 instances 的 afterUpdate
|
|
173
|
+
// (uuflowManager.triggerRecordInstanceQueue),否则取消申请不会生成 instance_record_queue 台账同步记录。
|
|
174
|
+
const nextStepNameForQueue = setObj.current_step_name;
|
|
175
|
+
const stepNameChangedForQueue = nextStepNameForQueue !== undefined && nextStepNameForQueue !== instance.current_step_name;
|
|
176
|
+
if (stepNameChangedForQueue) {
|
|
177
|
+
delete setObj.current_step_name;
|
|
178
|
+
}
|
|
179
|
+
|
|
171
180
|
const result = await instancesCollection.updateOne(
|
|
172
181
|
{ _id: instance_id },
|
|
173
182
|
{ $set: setObj }
|
|
174
183
|
);
|
|
175
184
|
|
|
185
|
+
if (stepNameChangedForQueue) {
|
|
186
|
+
await getObject('instances').update(instance_id, { current_step_name: nextStepNameForQueue });
|
|
187
|
+
}
|
|
188
|
+
|
|
176
189
|
if (result.modifiedCount > 0) {
|
|
177
190
|
// Remove instance tasks
|
|
178
191
|
await remove_many_instance_tasks(finishedApproveIds);
|
|
@@ -19,6 +19,7 @@ const {
|
|
|
19
19
|
const UUFlowManager = require('../manager/uuflow_manager');
|
|
20
20
|
const pushManager = require('../manager/push_manager');
|
|
21
21
|
const { getCollection, _makeNewID } = require('../utils/collection');
|
|
22
|
+
const { getObject } = require('@steedos/objectql');
|
|
22
23
|
/**
|
|
23
24
|
@api {post} /api/workflow/retrieve 取回
|
|
24
25
|
@apiVersion 0.0.0
|
|
@@ -252,12 +253,24 @@ router.post('/api/workflow/retrieve', requireAuthentication, async function (req
|
|
|
252
253
|
setObj.current_step_name = previous_trace_name;
|
|
253
254
|
setObj.current_step_auto_submit = await UUFlowManager.getCurrentStepAutoSubmit(flow.timeout_auto_submit, previous_step.lines);
|
|
254
255
|
|
|
256
|
+
// current_step_name 的变更必须经由 objectql 写入,以触发 instances 的 afterUpdate
|
|
257
|
+
// (uuflowManager.triggerRecordInstanceQueue),否则取回不会生成 instance_record_queue 台账同步记录。
|
|
258
|
+
const nextStepNameForQueue = setObj.current_step_name;
|
|
259
|
+
const stepNameChangedForQueue = nextStepNameForQueue !== undefined && nextStepNameForQueue !== instance.current_step_name;
|
|
260
|
+
if (stepNameChangedForQueue) {
|
|
261
|
+
delete setObj.current_step_name;
|
|
262
|
+
}
|
|
263
|
+
|
|
255
264
|
r = await instancesCollection.updateOne({
|
|
256
265
|
_id: instance_id,
|
|
257
266
|
}, {
|
|
258
267
|
$set: setObj,
|
|
259
268
|
});
|
|
260
269
|
|
|
270
|
+
if (stepNameChangedForQueue) {
|
|
271
|
+
await getObject('instances').update(instance_id, { current_step_name: nextStepNameForQueue });
|
|
272
|
+
}
|
|
273
|
+
|
|
261
274
|
// 更新被取回的approve
|
|
262
275
|
await update_many_instance_tasks(instance_id, last_trace_id, finishedApproveIds)
|
|
263
276
|
// 插入取回操作的approve
|