From 6be97b4461303a4390d136dd5313bc202218aaad Mon Sep 17 00:00:00 2001 From: like Date: Wed, 26 Jul 2023 10:25:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=88=91=E7=9A=84=E9=A2=84=E8=AD=A6?= =?UTF-8?q?=E5=B7=A5=E5=8D=95=EF=BC=8C=E5=9B=9E=E6=98=BE=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=EF=BC=9A=E5=86=85=E9=83=A8=E5=AD=97=E6=AE=B5=E5=AF=B9=E5=A4=96?= =?UTF-8?q?=E8=A6=86=E7=9B=96=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controller/work_order_manage.go | 9 +++++++++ src/service/alert.go | 4 +--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/controller/work_order_manage.go b/src/controller/work_order_manage.go index df57112..ec1eacd 100644 --- a/src/controller/work_order_manage.go +++ b/src/controller/work_order_manage.go @@ -259,6 +259,15 @@ func WorkOrderListAlert(c *gin.Context) { } svc := service.AlertSvc{User: user} data, err := svc.List(req) + // 回显使用:内部字段对外覆盖处理 + // disposed_list[].is_disposed --映射--> is_disposed + for i := 0; i < len(data.List); i++ { + for j := 0; j < len(data.List[i].DisposedList); j++ { + if data.List[i].DisposedList[j].DisposalUser == user.SystemAccount { + data.List[i].IsDisposed = 1 + } + } + } if err != nil { SendJsonResponse(c, resp.FAIL.WithError(err), nil) return diff --git a/src/service/alert.go b/src/service/alert.go index 9518bac..5665d6a 100644 --- a/src/service/alert.go +++ b/src/service/alert.go @@ -456,7 +456,7 @@ func (a *AlertSvc) DocSearch(req request.ListAlert) (resp response.AlertList, er for _, hit := range sources.Hits.Hits { resp.List = append(resp.List, hit.Source) } - resp.TotalCount = int64(len(resp.List)) + resp.TotalCount = int64(sources.Hits.Total.Value) return } @@ -838,12 +838,10 @@ func (a *AlertSvc) GetDataByAlertRulesIdAndRiskLevel(alertRulesId string, riskLe func (a *AlertSvc) List(req request.ListAlert) (resp response.AlertList, err error) { resp, err = a.DocSearch(req) - resp.TotalCount = int64(len(resp.List)) return } func (a *AlertSvc) DisposeAlert(req request.DisposeAlert) (err error) { - // TODO 我的预警工单处置 var ( sources response.OpenSearchSource now = jsontime.Now() -- 2.26.0