diff --git a/api/app/lib/schedule/workOrder.js b/api/app/lib/schedule/workOrder.js index 1b27edf..f835fcd 100644 --- a/api/app/lib/schedule/workOrder.js +++ b/api/app/lib/schedule/workOrder.js @@ -3,7 +3,8 @@ const schedule = require('node-schedule'); const moment = require('moment') let isDev = true -module.exports = function (app, opts) { +module.exports = function (app, opts,ctx) { + const workOrder = app.fs.scheduleInit( { interval: '0 * * * *',//一小时执行一次 @@ -14,6 +15,8 @@ module.exports = function (app, opts) { try{ //前一次执行时间 console.log('工单数据抽取开始') + const username = "admin" + const password = "fs-workflow" let lastExecutionTime = null; const { parseProcessData } = app.fs.utils const startTime = moment() @@ -63,9 +66,10 @@ module.exports = function (app, opts) { console.log('formRes1',procinstIds) // 获取流程实例变量 if(formRes && formRes.length > 0){ - let procinstsVariables = await ctx.app.camunda.request.post(encodeURI(`/engine-rest/history/variable-instance`), { - processInstanceIdIn: procinstIds - }) + let procinstsVariables = await request.post(encodeURI(opts.camWorkflow.host+'/'+opts.camWorkflow.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) { const parseData = parseProcessData({