Browse Source

feat:fix bugs

dev
zhaobing’ 1 year ago
parent
commit
486d206b61
  1. 11
      api/app/lib/schedule/workOrder.js

11
api/app/lib/schedule/workOrder.js

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

Loading…
Cancel
Save