Commit 6be97b44 authored by 李科's avatar 李科

fix: 我的预警工单,回显使用:内部字段对外覆盖处理

parent 15d68474
...@@ -259,6 +259,15 @@ func WorkOrderListAlert(c *gin.Context) { ...@@ -259,6 +259,15 @@ func WorkOrderListAlert(c *gin.Context) {
} }
svc := service.AlertSvc{User: user} svc := service.AlertSvc{User: user}
data, err := svc.List(req) 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 { if err != nil {
SendJsonResponse(c, resp.FAIL.WithError(err), nil) SendJsonResponse(c, resp.FAIL.WithError(err), nil)
return return
......
...@@ -456,7 +456,7 @@ func (a *AlertSvc) DocSearch(req request.ListAlert) (resp response.AlertList, er ...@@ -456,7 +456,7 @@ func (a *AlertSvc) DocSearch(req request.ListAlert) (resp response.AlertList, er
for _, hit := range sources.Hits.Hits { for _, hit := range sources.Hits.Hits {
resp.List = append(resp.List, hit.Source) resp.List = append(resp.List, hit.Source)
} }
resp.TotalCount = int64(len(resp.List)) resp.TotalCount = int64(sources.Hits.Total.Value)
return return
} }
...@@ -838,12 +838,10 @@ func (a *AlertSvc) GetDataByAlertRulesIdAndRiskLevel(alertRulesId string, riskLe ...@@ -838,12 +838,10 @@ func (a *AlertSvc) GetDataByAlertRulesIdAndRiskLevel(alertRulesId string, riskLe
func (a *AlertSvc) List(req request.ListAlert) (resp response.AlertList, err error) { func (a *AlertSvc) List(req request.ListAlert) (resp response.AlertList, err error) {
resp, err = a.DocSearch(req) resp, err = a.DocSearch(req)
resp.TotalCount = int64(len(resp.List))
return return
} }
func (a *AlertSvc) DisposeAlert(req request.DisposeAlert) (err error) { func (a *AlertSvc) DisposeAlert(req request.DisposeAlert) (err error) {
// TODO 我的预警工单处置
var ( var (
sources response.OpenSearchSource sources response.OpenSearchSource
now = jsontime.Now() now = jsontime.Now()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment