From 2bae6527dd36e5706e28212a9e655eed567e40de Mon Sep 17 00:00:00 2001 From: zhaoxiangchun <1422928955@qq.com> Date: Wed, 3 Mar 2021 17:48:32 +0800 Subject: [PATCH] feat(mcclient,itsm): modify itsm mcclient rpc func MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1.统计返回技术支持工单信息 --- .../mod_itsm_historic_process_instances.go | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/pkg/mcclient/modules/mod_itsm_historic_process_instances.go b/pkg/mcclient/modules/mod_itsm_historic_process_instances.go index 100ccf9933..0a9f02062b 100644 --- a/pkg/mcclient/modules/mod_itsm_historic_process_instances.go +++ b/pkg/mcclient/modules/mod_itsm_historic_process_instances.go @@ -46,9 +46,27 @@ func (this *HiProcInstManager) GetStatistics(s *mcclient.ClientSession, params j nrHiProcInst := hiProcInstObj.Total nrProcTask := procTaskObj.Total + hiProcInstCusPath := fmt.Sprintf("%s&process_definition_key=customer-service", hiProcInstPath) + procTaskCusPath := fmt.Sprintf("%s&process_definition_key=customer-service", procTaskPath) + + hiProcInstCusObj, err := modulebase.List(this.ResourceManager, s, hiProcInstCusPath, "historic-process-instances") + if err != nil { + return nil, err + } + + procTaskCusObj, err := modulebase.List(this.ResourceManager, s, procTaskCusPath, "process-tasks") + if err != nil { + return nil, err + } + + hiProcInstCusTotal := hiProcInstCusObj.Total + procTaskCusTotal := procTaskCusObj.Total + rst := jsonutils.NewDict() - rst.Add(jsonutils.NewInt(int64(nrHiProcInst)), "nr-historic-process-instance") - rst.Add(jsonutils.NewInt(int64(nrProcTask)), "nr-process-task") + rst.Add(jsonutils.NewInt(int64(nrHiProcInst-hiProcInstCusTotal)), "nr-historic-process-instance") + rst.Add(jsonutils.NewInt(int64(nrProcTask-procTaskCusTotal)), "nr-process-task") + rst.Add(jsonutils.NewInt(int64(hiProcInstCusTotal)), "nr-historic-process-instance-cus") + rst.Add(jsonutils.NewInt(int64(procTaskCusTotal)), "nr-process-task-cus") return rst, nil }