|
|
@ -65,21 +65,22 @@ module.exports = function (app, opts,ctx) { |
|
|
|
).toPromise() |
|
|
|
const procinstIds = [...new Set(formRes.map(e => e.procinstId))]; |
|
|
|
console.log('formRes1',procinstIds) |
|
|
|
// 获取流程实例变量
|
|
|
|
// 获取流程实例变量
|
|
|
|
if(formRes && formRes.length > 0){ |
|
|
|
let procinstsVariables = await request.post(encodeURI(opts.camundarest.host+'/'+opts.camundarest.root+`/engine-rest/history/variable-instance`)) |
|
|
|
.auth(username, password) |
|
|
|
.set('Content-Type', 'application/json') |
|
|
|
.send({processInstanceIdIn: procinstIds}) |
|
|
|
console.log('formRes2',procinstsVariables) |
|
|
|
for (let f of formRes) { |
|
|
|
if(procinstsVariables.body&&procinstsVariables.body.length){ |
|
|
|
for (let f of formRes) { |
|
|
|
const parseData = parseProcessData({ |
|
|
|
formSchema: JSON.parse(f.formSchema), |
|
|
|
formData: JSON.parse(f.formData) |
|
|
|
}) |
|
|
|
const res=await models.Workorder.create({ |
|
|
|
projectId:parseData.pomsProjectId.value || null, |
|
|
|
formname:procinstsVariables.body.find(item=>item.id===f.procinstId).name||null, |
|
|
|
formname:procinstsVariables.body.find(t => t.name == 'fsEmisBusinessName') ? procinstsVariables.body.find(t => t.name == 'fsEmisBusinessName').value : '', |
|
|
|
state: f.state||null, |
|
|
|
endTime:f.endTime||null, |
|
|
|
startTime:f.createTime||null |
|
|
@ -88,6 +89,10 @@ module.exports = function (app, opts,ctx) { |
|
|
|
console.log('工单数据抽取结束') |
|
|
|
|
|
|
|
} |
|
|
|
}else{ |
|
|
|
console.log('未查询到数据') |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
}catch(error){ |
|
|
|