From ae8ea7e524eb48e521ad62aa0eca228c3e1f0857 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?zhaobing=E2=80=99?= Date: Wed, 11 Oct 2023 10:28:29 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E6=B5=81=E8=BD=AC=E5=B7=A5=E5=8D=95+?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E7=9A=84=E4=B8=80=E7=BA=A7=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E7=9A=84=E5=90=8D=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/project/group.js | 56 ++++++++++++++++++- .../src/sections/firmwareUpgrade/nav-item.jsx | 2 +- .../src/sections/firmwareUpgrade/routes.js | 2 +- 3 files changed, 56 insertions(+), 4 deletions(-) diff --git a/api/app/lib/controllers/project/group.js b/api/app/lib/controllers/project/group.js index 478888f..47155be 100644 --- a/api/app/lib/controllers/project/group.js +++ b/api/app/lib/controllers/project/group.js @@ -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 }) } diff --git a/web/client/src/sections/firmwareUpgrade/nav-item.jsx b/web/client/src/sections/firmwareUpgrade/nav-item.jsx index 5d2f255..f0b2919 100644 --- a/web/client/src/sections/firmwareUpgrade/nav-item.jsx +++ b/web/client/src/sections/firmwareUpgrade/nav-item.jsx @@ -11,7 +11,7 @@ export function getNavItem (user, dispatch) { items: [ { itemKey: 'firmwareUpgrade', - text: '固件库', + text: '固件升级', icon: , to: '/device/firmwareUpgrade/FirmwareLibrary', items: [{ itemKey:'FirmwareLibrary',to:'/device/firmwareUpgrade/FirmwareLibrary',text:'固件库'}, diff --git a/web/client/src/sections/firmwareUpgrade/routes.js b/web/client/src/sections/firmwareUpgrade/routes.js index 6cd6ae8..ee091a7 100644 --- a/web/client/src/sections/firmwareUpgrade/routes.js +++ b/web/client/src/sections/firmwareUpgrade/routes.js @@ -11,7 +11,7 @@ export default [{ { path: '/firmwareUpgrade', key: 'firmwareUpgrade', - breadcrumb: '固件库', + breadcrumb: '固件升级', childRoutes: [{ path: '/FirmwareLibrary', key: 'firmwareLibrary',