|
@ -3,7 +3,8 @@ const schedule = require('node-schedule'); |
|
|
const moment = require('moment') |
|
|
const moment = require('moment') |
|
|
let isDev = true |
|
|
let isDev = true |
|
|
|
|
|
|
|
|
module.exports = function (app, opts) { |
|
|
module.exports = function (app, opts,ctx) { |
|
|
|
|
|
|
|
|
const workOrder = app.fs.scheduleInit( |
|
|
const workOrder = app.fs.scheduleInit( |
|
|
{ |
|
|
{ |
|
|
interval: '0 * * * *',//一小时执行一次
|
|
|
interval: '0 * * * *',//一小时执行一次
|
|
@ -14,6 +15,8 @@ module.exports = function (app, opts) { |
|
|
try{ |
|
|
try{ |
|
|
//前一次执行时间
|
|
|
//前一次执行时间
|
|
|
console.log('工单数据抽取开始') |
|
|
console.log('工单数据抽取开始') |
|
|
|
|
|
const username = "admin" |
|
|
|
|
|
const password = "fs-workflow" |
|
|
let lastExecutionTime = null; |
|
|
let lastExecutionTime = null; |
|
|
const { parseProcessData } = app.fs.utils |
|
|
const { parseProcessData } = app.fs.utils |
|
|
const startTime = moment() |
|
|
const startTime = moment() |
|
@ -63,9 +66,10 @@ module.exports = function (app, opts) { |
|
|
console.log('formRes1',procinstIds) |
|
|
console.log('formRes1',procinstIds) |
|
|
// 获取流程实例变量
|
|
|
// 获取流程实例变量
|
|
|
if(formRes && formRes.length > 0){ |
|
|
if(formRes && formRes.length > 0){ |
|
|
let procinstsVariables = await ctx.app.camunda.request.post(encodeURI(`/engine-rest/history/variable-instance`), { |
|
|
let procinstsVariables = await request.post(encodeURI(opts.camWorkflow.host+'/'+opts.camWorkflow.root+`/engine-rest/history/variable-instance`)) |
|
|
processInstanceIdIn: procinstIds |
|
|
.auth(username, password) |
|
|
}) |
|
|
.set('Content-Type', 'application/json') |
|
|
|
|
|
.send({processInstanceIdIn: procinstIds}) |
|
|
console.log('formRes2',procinstsVariables) |
|
|
console.log('formRes2',procinstsVariables) |
|
|
for (let f of formRes) { |
|
|
for (let f of formRes) { |
|
|
const parseData = parseProcessData({ |
|
|
const parseData = parseProcessData({ |
|
|