|
|
|
|
|
|
|
// const schedule = require('node-schedule');
|
|
|
|
// const moment = require('moment')
|
|
|
|
|
|
|
|
// module.exports = function (app, opts) {
|
|
|
|
// const updateAttendance = app.fs.scheduleInit(
|
|
|
|
// {
|
|
|
|
// interval: '34 21 4 * * *',
|
|
|
|
// // interval: '34 */15 * * * *',
|
|
|
|
// immediate: true,
|
|
|
|
// proRun: true,
|
|
|
|
// },
|
|
|
|
// async()=>{
|
|
|
|
// try{
|
|
|
|
// const startTime = moment()
|
|
|
|
// const { models } = app.fs.dc
|
|
|
|
// const { clickHouse } = app.fs
|
|
|
|
// const { database: camWorkflow } = clickHouse.camWorkflow.opts.config
|
|
|
|
// //工单数据
|
|
|
|
// let workOrderNeedData = {
|
|
|
|
// projectName: {
|
|
|
|
// keyWord: ['项目名称'],
|
|
|
|
// require: true,
|
|
|
|
// },
|
|
|
|
// applyTime: {
|
|
|
|
// keyWord: ['申请时间'],
|
|
|
|
// require: true,
|
|
|
|
// },
|
|
|
|
// completionTime: {
|
|
|
|
// keyWord: ['处理完成时间'],
|
|
|
|
// require: true,
|
|
|
|
// },
|
|
|
|
// state:{
|
|
|
|
// keyWord:[''],
|
|
|
|
// require: true,
|
|
|
|
// },
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
// const attendanceRes = await clickHouse.pepEmis.query(
|
|
|
|
// `
|
|
|
|
// SELECT
|
|
|
|
// story.id AS historyId,
|
|
|
|
// story.apply_user AS pepUserId,
|
|
|
|
// story.form_data AS formData,
|
|
|
|
// story.submit_form_data AS submitFormData,
|
|
|
|
// fform.form_schema AS formSchema,
|
|
|
|
// fprocess.name AS processName,
|
|
|
|
// procin.state_ AS state,
|
|
|
|
// fform.id AS formId,
|
|
|
|
// fversion.id AS versionId,
|
|
|
|
// fgroup.name AS groupName
|
|
|
|
// FROM
|
|
|
|
// workflow_process_history AS story
|
|
|
|
// INNER JOIN workflow_process_version AS fversion
|
|
|
|
// ON fversion.id = story.version_id
|
|
|
|
// INNER JOIN workflow_process_form AS fform
|
|
|
|
// ON fform.id = fversion.form_id
|
|
|
|
// INNER JOIN workflow_process AS fprocess
|
|
|
|
// ON fprocess.id = fform.process_id
|
|
|
|
// INNER JOIN workflow_group AS fgroup
|
|
|
|
// ON fgroup.id = fprocess.group_id
|
|
|
|
// AND fgroup.name = ''
|
|
|
|
// INNER JOIN ${camWorkflow}.act_hi_procinst AS procin
|
|
|
|
// ON procin.id_ = story.procinst_id`
|
|
|
|
// +` ${existOvertimeCount || existVacateCount ?`WHERE story.create_at > '2023-03-16 00:00:00'`: ''}`
|
|
|
|
// ).toPromise()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// }catch(error){
|
|
|
|
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// );
|
|
|
|
// return {
|
|
|
|
// updateAttendance,
|
|
|
|
// }
|
|
|
|
// }
|