| | |
| | | //logger.Debugf("task %s last result %d", m.Task.Name, len(lastFilter)) |
| | | document_number_list = []string{} |
| | | for _, i := range keyFilter { |
| | | //logger.Debugf("keyFilter %s ------------- %s", i.Id, i.PersonType) |
| | | document_number_list = append(document_number_list, i.Id) |
| | | person := document_number_map[i.DocumentNumber] |
| | | person := document_number_map[i.Id] |
| | | person.PersonType = i.PersonType |
| | | document_number_map[i.DocumentNumber] = person |
| | | document_number_map[i.Id] = 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 |
| | |
| | | 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 |
| | | } |
| | |
| | | results = append(results, result) |
| | | } |
| | | logger.Debugf("task %s last filter result %d", m.Task.Name, len(results)) |
| | | return service.SaveTaskResults(results) |
| | | return service.SaveLocationTaskResults(results) |
| | | } |
| | | |
| | | func (m *LocationModel) KeepAlive() error { |
| | |
| | | } |
| | | 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()) |
| | |
| | | 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), |
| | | }, |
| | | }, |
| | | }) |
| | | } |
| | | //var authParams = map[string]interface{}{ |
| | | // "bool": map[string]interface{}{ |
| | | // "should": queryTimes, |
| | | // }, |
| | | //} |
| | | filters = append(filters, map[string]interface{}{ |
| | | "bool": map[string]interface{}{ |
| | | "should": queryTimes, |
| | |
| | | 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) |
| | | // 解析聚合结果 |
| | | var records []*LocationRecord |
| | | if aggs, ok := result["aggregations"].(map[string]interface{}); ok { |