Browse Source

feat:定时任务修改

dev
zhaobing’ 1 year ago
parent
commit
5f19a83ae7
  1. 12
      api/app/lib/schedule/workOrder.js

12
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({

Loading…
Cancel
Save