|
|
@ -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 |
|
|
|
WHERE procin.end_time_ is null |
|
|
|
AND procin.state_='ACTIVE' |
|
|
|
WHERE procin.end_time_ is null` |
|
|
|
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<arr.length;i++){
|
|
|
|
// const res=await strucOnlineClient.search({
|
|
|
|
// index: strucOnlineClient.config.index,
|
|
|
|
// type: strucOnlineClient.config.type,
|
|
|
|
// body: {
|
|
|
|
// "query": {
|
|
|
|
// "bool": {
|
|
|
|
// "filter": [
|
|
|
|
// {
|
|
|
|
// "range": {
|
|
|
|
// "collect_time": {
|
|
|
|
// "gte": `${moment().subtract(24*(i+1)+8, 'hours').format('YYYY-MM-DDTHH:mm:ss.SSS')}Z`,
|
|
|
|
// // "gte": "2023-08-24T08:00:00.000Z",
|
|
|
|
// "lt":`${moment().subtract(8+24*i, 'hours').format('YYYY-MM-DDTHH:mm:ss.SSS')}Z`
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// },
|
|
|
|
// {
|
|
|
|
// "terms": {
|
|
|
|
// "structure": strucIdArr,
|
|
|
|
// // "structure": [1, 2, 3]
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// ]
|
|
|
|
// }
|
|
|
|
// },
|
|
|
|
// "sort": [
|
|
|
|
// {
|
|
|
|
// "collect_time": {
|
|
|
|
// "order": "asc"
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// ],
|
|
|
|
// "size": 10000
|
|
|
|
// }
|
|
|
|
// })
|
|
|
|
// onlineRes.hits.hits=[...onlineRes.hits.hits,...res.hits.hits]
|
|
|
|
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// for (let struc of strucRes) {
|
|
|
|
// let curOnline =
|
|
|
|
// onlineRes.hits.hits
|
|
|
|
// .filter((h) => 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({ |
|
|
|