|
|
@ -131,8 +131,10 @@ async function groupStatistic (ctx) { |
|
|
|
const { userId } = ctx.fs.api |
|
|
|
const { pomsU } = ctx.query |
|
|
|
const { clickHouse } = ctx.app.fs |
|
|
|
const { parseProcessData } = app.fs.utils |
|
|
|
const { utils: { judgeSuper, anxinStrucIdRange } } = ctx.app.fs |
|
|
|
const sequelize = ctx.fs.dc.orm |
|
|
|
const { database: camWorkflow } = clickHouse.camWorkflow.opts.config |
|
|
|
|
|
|
|
let userId_ = pomsU || userId |
|
|
|
const progectGroupList = await models.ProjectGroup.findAll({ |
|
|
@ -140,7 +142,38 @@ async function groupStatistic (ctx) { |
|
|
|
pomsUserId: userId_ |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
// 获取在途的运维中台售后问题处理工单数据
|
|
|
|
const formRes = await clickHouse.pepEmis.query( |
|
|
|
`SELECT
|
|
|
|
story.id AS historyId, |
|
|
|
story.procinst_id as procinstId, |
|
|
|
story.apply_user AS pepUserId, |
|
|
|
story.form_data AS formData, |
|
|
|
story.submit_form_data AS submitFormData, |
|
|
|
story.create_at as createTime, |
|
|
|
fform.form_schema AS formSchema, |
|
|
|
fprocess.name AS processName, |
|
|
|
procin.state_ AS state, |
|
|
|
procin.end_time_ as endTime, |
|
|
|
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 |
|
|
|
AND fprocess.name = '运维中台售后问题处理工单' |
|
|
|
INNER JOIN workflow_group AS fgroup |
|
|
|
ON fgroup.id = fprocess.group_id |
|
|
|
INNER JOIN ${camWorkflow}.act_hi_procinst AS procin |
|
|
|
ON procin.id_ = story.procinst_id |
|
|
|
AND procin.state_='ACTIVE' |
|
|
|
WHERE procin.end_time_ is null` |
|
|
|
).toPromise() |
|
|
|
// 获取全部的 poms 项目id 并构建关系
|
|
|
|
let pomsProjectIds = new Set() |
|
|
|
for (let group of progectGroupList) { |
|
|
@ -252,7 +285,25 @@ async function groupStatistic (ctx) { |
|
|
|
let maxOffLineTime = 0 |
|
|
|
let todayAlarms = 0 |
|
|
|
let pepmCustomerLevels = [] |
|
|
|
let activeOrderCount=0//流转工单数量(未完成的)
|
|
|
|
if(pg.pomsProjectIds&&pg.pomsProjectIds.length){ |
|
|
|
for(let i of pg.pomsProjectIds){ |
|
|
|
if(formRes && formRes.length > 0){ |
|
|
|
for (let f of formRes) { |
|
|
|
console.log('formRes',f) |
|
|
|
const parseData = parseProcessData({ |
|
|
|
formSchema: JSON.parse(f.formSchema), |
|
|
|
formData: JSON.parse(f.formData) |
|
|
|
}) |
|
|
|
console.log('parseData',parseData) |
|
|
|
if(parseData.pomsProjectId.value===i){ |
|
|
|
activeOrderCount+=1 |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
// groupProjectRes 是poms项目信息
|
|
|
|
let anxinProjectCount = groupProjectRes.reduce((count, gp) => { |
|
|
|
if (pg.pomsProjectIds.some(id => gp.id == id)) { |
|
|
@ -294,7 +345,8 @@ async function groupStatistic (ctx) { |
|
|
|
todayAlarms, |
|
|
|
maxOffLineTime, |
|
|
|
anxinProjectCount, |
|
|
|
level: pepmCustomerLevels.length ? pepmCustomerLevels[0] : null |
|
|
|
level: pepmCustomerLevels.length ? pepmCustomerLevels[0] : null, |
|
|
|
activeOrderCount |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|