diff --git a/api/app/lib/controllers/project/group.js b/api/app/lib/controllers/project/group.js index 41ccfb0..62f1fc9 100644 --- a/api/app/lib/controllers/project/group.js +++ b/api/app/lib/controllers/project/group.js @@ -165,13 +165,13 @@ async function groupStatistic (ctx) { 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` + WHERE procin.end_time_ is null + AND procin.state_='ACTIVE' + AND fprocess.name = '运维中台售后问题处理工单'` ).toPromise() // 获取全部的 poms 项目id 并构建关系 let pomsProjectIds = new Set() @@ -289,11 +289,11 @@ async function groupStatistic (ctx) { for(let i of pg.pomsProjectIds){ if(formRes && formRes.length > 0){ for (let f of formRes) { - const parseData = parseProcessData({ + const parseData = f.formSchema&&parseProcessData({ formSchema: JSON.parse(f.formSchema), formData: JSON.parse(f.formData) }) - if(parseData.pomsProjectId.value===i){ + if(parseData&&parseData.pomsProjectId.value===i){ activeOrderCount+=1 } } @@ -435,6 +435,73 @@ async function groupStatisticOnline (ctx) { // 查在线率 const strucOnlineClient = ctx.app.fs.esclient.strucOnline + // let arr = [1,2,3,4,5,6,7] + // let onlineRes={ + // hits: { + // hits: [] + // } + // } + // if(strucIdArr.length){ + // for(let i = 0;i h._source.structure == struc.id) + // // .sort((a, b) => { + // // return a._source.collect_time - b._source.collect_time + // // }) + // .map(s => { + // return { + // ...s._source, + // rate: s._source.online / s._source.total * 100 + // } + // }) + // let curOffline = maxOfflineTimeRes.find((o) => o.structure == struc.id) + // struc.online = curOnline + // struc.offline = curOffline || {} + // } + // 查在线率 const onlineRes = strucIdArr.length ? await strucOnlineClient.search({