From c1a22872f4edb9bc92a6b1f69355638ad7aa0c17 Mon Sep 17 00:00:00 2001 From: zhaoqingang <zhaoqg0118@163.com> Date: 星期一, 10 二月 2025 10:49:55 +0800 Subject: [PATCH] 测试 场景分析 bug --- models/locationAnalysis.go | 41 ++++++++++++++--------------------------- 1 files changed, 14 insertions(+), 27 deletions(-) diff --git a/models/locationAnalysis.go b/models/locationAnalysis.go index 7c2f942..7ef281e 100644 --- a/models/locationAnalysis.go +++ b/models/locationAnalysis.go @@ -224,7 +224,7 @@ person.PersonType = i.PersonType document_number_map[i.DocumentNumber] = person } - logger.Debugf("document_number_list %s last result %s", m.Task.Name, document_number_list) + //logger.Debugf("document_number_map %s last result %s", m.Task.Name, document_number_map) records, err := queryEsLocation(db.GetEsClient(), m, document_number_list) if err != nil { return err @@ -239,6 +239,7 @@ for _, record := range records { tagTypes = []string{} for _, personId := range record.DocumentNumbers { + logger.Debugf("document_number_map[personId] %s", document_number_map[personId]) tagTypes = append(tagTypes, document_number_map[personId].PersonType) lastAppearanceTime = document_number_map[personId].LastAppearanceTime } @@ -327,25 +328,6 @@ } filters = append(filters, addrParams) } - - //// 閲嶇偣浜哄憳杩囨护 - //if len(locationModel.KeyPersonType) > 0 { - // filters = append(filters, map[string]interface{}{ - // "terms": map[string]interface{}{ - // "keyPersonType": strings.Split(locationModel.KeyPersonType, ","), - // }, - // }) - //} - - // 鏃堕棿鑼冨洿 - //filters = append(filters, map[string]interface{}{ - // "range": map[string]interface{}{ - // "picDate": map[string]interface{}{ - // "gte": start.Format(time.DateTime), - // "lt": now.Format(time.DateTime), - // }, - // }, - //}) var queryTimes []map[string]interface{} for date := startTime; date.Before(nowTime); date = date.Add(24 * time.Hour) { start := time.Date(date.Year(), date.Month(), date.Day(), locationModel.StartTime, 0, 0, 0, date.Location()) @@ -354,17 +336,21 @@ queryTimes = append(queryTimes, map[string]interface{}{ "range": map[string]interface{}{ "picDate": map[string]interface{}{ - "gte": start.Format("2006-01-02 15:04:05"), - "lte": end.Format("2006-01-02 15:04:05"), + "gte": start.Format(time.DateTime), // "2006-01-02 15:04:05d" + "lte": end.Format(time.DateTime), }, }, }) + + //filters = append(filters, map[string]interface{}{ + // "range": map[string]interface{}{ + // "picDate": map[string]interface{}{ + // "gte": start.Format(time.DateTime), + // "lte": end.Format(time.DateTime), + // }, + // }, + //}) } - //var authParams = map[string]interface{}{ - // "bool": map[string]interface{}{ - // "should": queryTimes, - // }, - //} filters = append(filters, map[string]interface{}{ "bool": map[string]interface{}{ "should": queryTimes, @@ -459,6 +445,7 @@ if err := json.NewDecoder(res.Body).Decode(&result); err != nil { return nil, fmt.Errorf("error parsing response body: %s", err) } + logger.Debugf("result--------------------------------------- %s", result) // 瑙f瀽鑱氬悎缁撴灉 var records []*LocationRecord if aggs, ok := result["aggregations"].(map[string]interface{}); ok { -- Gitblit v1.8.0