zhaoqingang
2025-02-10 daea03db1077af9ac322699106a930e57689fd9b
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
@@ -285,8 +285,8 @@
func queryEsLocation(esClient *elasticsearch.Client, locationModel *LocationModel, documentNumbers []string) ([]*LocationRecord, error) {
   var buf bytes.Buffer
   //nowTime := time.Now()
   //startTime := nowTime.Add(-time.Duration(locationModel.Duration) * 24 * time.Hour)
   nowTime := time.Now()
   startTime := nowTime.Add(-time.Duration(locationModel.Duration) * 24 * time.Hour)
   // 构建过滤条件
   var filters []map[string]interface{}
@@ -328,34 +328,34 @@
      filters = append(filters, addrParams)
   }
   //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())
   //   end := time.Date(date.Year(), date.Month(), date.Day(), locationModel.EndTime, 0, 0, 0, date.Location())
   //
   //   //queryTimes = append(queryTimes, map[string]interface{}{
   //   //   "range": map[string]interface{}{
   //   //      "picDate": map[string]interface{}{
   //   //         "gte": start.Format(time.DateTime), // "2006-01-02 15:04:05d"
   //   //         "lte": end.Format(time.DateTime),
   //   //      },
   //   //   },
   //   //})
   //
   //   filters = append(filters, 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())
      end := time.Date(date.Year(), date.Month(), date.Day(), locationModel.EndTime, 0, 0, 0, date.Location())
      //queryTimes = append(queryTimes, map[string]interface{}{
   //      "range": map[string]interface{}{
   //         "picDate": map[string]interface{}{
   //            "gte": start.Format(time.DateTime),
      //         "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),
            },
         },
      })
   }
   //filters = append(filters, map[string]interface{}{
   //   "bool": map[string]interface{}{
   //      "filter": queryTimes,
   //   },
   //})
   logger.Debugf("filters--------------------------------------- %s", filters)
   //logger.Debugf("filters--------------------------------------- %s", filters)
   query := map[string]interface{}{
      "query": map[string]interface{}{
         "bool": map[string]interface{}{