From 5f19a83ae742feef53e239b08d6232e9bd433f97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?zhaobing=E2=80=99?= Date: Fri, 22 Sep 2023 10:27:17 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/schedule/workOrder.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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({