| | |
| | | } |
| | | //请求头 |
| | | localConf, err2 := cache.GetServerInfo() |
| | | if err2 !=nil || localConf.AlarmIp == "" || localConf.ServerId == "" { |
| | | if err2 != nil || localConf.AlarmIp == "" || localConf.ServerId == "" { |
| | | logger.Debug("localConfig is wrong!!!") |
| | | util.ResponseFormat(c,code.ComError,"es config err") |
| | | util.ResponseFormat(c, code.ComError, "es config err") |
| | | return |
| | | } |
| | | url := "http://" + localConf.AlarmIp + ":" + strconv.Itoa(int(localConf.AlarmPort)) + |
| | |
| | | linkTagInfoAnalyServerFilterStr + |
| | | "{\"range\":{\"linkTagInfo.picDate\":{\"gte\":\"now+8h-15s\",\"lt\":\"now+8h\"}}}" + |
| | | "]}}" + |
| | | "]}}," + |
| | | "],\"minimum_should_match\":1}}," + |
| | | "\"sort\":[{\"picDate\":{\"order\":\"desc\"}}]," + |
| | | "\"size\":\"1000\"," + |
| | | "\"_source\":{\"includes\":[],\"excludes\":[\"*.feature\"]}}" |
| | |
| | | util.ResponseFormat(c, code.CompareResultGone, m) |
| | | } |
| | | |
| | | |
| | | func sourceCompare(sources []interface{}, isEsSource bool, campareByte []byte, threshold float32) []interface{} { |
| | | var filterName = "feature" |
| | | if isEsSource { |
| | |
| | | type Hosts struct { |
| | | NewIp string `json:newIp` |
| | | OldIp string `json:oldIp` |
| | | } |
| | | |
| | | func forwardCommand() { |
| | | |
| | | } |
| | | |
| | | //func AddEsCluster(hosts []string) (string){ |
| | |
| | | |
| | | var arg models.EsSearch |
| | | err := c.BindJSON(&arg) |
| | | if err !=nil || arg.Page <=0 && arg.Size<=0 { |
| | | util.ResponseFormat(c,code.RequestParamError,"参数有误") |
| | | if err != nil || arg.Page <= 0 && arg.Size <= 0 { |
| | | util.ResponseFormat(c, code.RequestParamError, "参数有误") |
| | | return |
| | | } |
| | | data := findEsData(&arg) |
| | |
| | | |
| | | //判断数据ID |
| | | idStr := "" |
| | | linkTagInfoIdStr :="" |
| | | linkTagInfoIdStr := "" |
| | | //personId := searchBody.Id |
| | | id := []string{} |
| | | if id != nil && len(id) > 0 { |
| | |
| | | //使用es底层机制处理分页 |
| | | //请求头 |
| | | localConf, err2 := cache.GetServerInfo() |
| | | if err2 !=nil || localConf.AlarmIp == "" || localConf.ServerId == "" { |
| | | if err2 != nil || localConf.AlarmIp == "" || localConf.ServerId == "" { |
| | | logger.Debug("localConfig is wrong!!!") |
| | | return nil |
| | | } |
| | |
| | | isCollectStr + |
| | | esTableIdStr + |
| | | analyServerFilterStr + |
| | | "{\"range\":{\"picDate\":{\"from\":\"" + gteDate + "\",\"to\":\"" + lteDate + "\",\"include_lower\":true,\"include_upper\":true,\"boost\":1}}}"+ |
| | | "{\"range\":{\"picDate\":{\"from\":\"" + gteDate + "\",\"to\":\"" + lteDate + "\",\"include_lower\":true,\"include_upper\":true,\"boost\":1}}}" + |
| | | "]}}," + |
| | | "{\"bool\":{\"filter\":[" + |
| | | linkTagInfoCameraIdStr + |
| | |
| | | linkTagInfoIsCollectStr + |
| | | linkTagInfoEsTableIdStr + |
| | | linkTagInfoAnalyServerFilterStr + |
| | | "{\"range\":{\"linkTagInfo.picDate\":{\"from\":\"" + gteDate + "\",\"to\":\"" + lteDate + "\",\"include_lower\":true,\"include_upper\":true,\"boost\":1}}}"+ |
| | | "{\"range\":{\"linkTagInfo.picDate\":{\"from\":\"" + gteDate + "\",\"to\":\"" + lteDate + "\",\"include_lower\":true,\"include_upper\":true,\"boost\":1}}}" + |
| | | "]}}" + |
| | | "]}}," + |
| | | "],\"minimum_should_match\":1}}," + |
| | | "\"sort\":[{\"_score\":{\"order\":\"desc\"}},{\"picDate\":{\"order\":\"desc\"}}]," + |
| | | "\"_source\":{\"includes\":[],\"excludes\":[\"*.feature\"]}" + |
| | | "}" |
| | | logger.Debug("findEsData.param:",prama) |
| | | logger.Debug("findEsData.param:", prama) |
| | | //数据解析 |
| | | tokenRes := esutil.GetEsDataReq(url, prama, true) |
| | | //fmt.Println(tokenRes) |
| | |
| | | if masterInfo["linkTagInfo"] != nil { |
| | | linkTagInfo := masterInfo["linkTagInfo"].([]interface{}) |
| | | delete(masterInfo, "linkTagInfo") |
| | | if len(linkTagInfo) >0 { |
| | | if len(linkTagInfo) > 0 { |
| | | slaveList := make([]interface{}, 0) |
| | | slaveList = append(slaveList, masterInfo) |
| | | slaveList = append(slaveList, linkTagInfo...) |
| | |
| | | } |
| | | } |
| | | } else { |
| | | if _,ok := masterInfo["linkTagInfo"];ok { |
| | | if _, ok := masterInfo["linkTagInfo"]; ok { |
| | | delete(masterInfo, "linkTagInfo") |
| | | } |
| | | sources["list"] = []interface{}{ |
| | |
| | | c.BindJSON(&searchBody) |
| | | index := config.EsInfo.EsIndex.AiOcean.IndexName |
| | | localConf, err2 := cache.GetServerInfo() |
| | | if err2 !=nil || localConf.AlarmIp == "" || localConf.ServerId == "" { |
| | | if err2 != nil || localConf.AlarmIp == "" || localConf.ServerId == "" { |
| | | logger.Debug("localConfig is wrong!!!") |
| | | util.ResponseFormat(c,code.ComError,"localConf wrong") |
| | | util.ResponseFormat(c, code.ComError, "localConf wrong") |
| | | return |
| | | } |
| | | url := "http://" + localConf.AlarmIp + ":" + strconv.Itoa(int(localConf.AlarmPort)) + |
| | | "/" + index + "/_search" |
| | | cameraIdStr := "" |
| | | linkTagInfoCameraIdStr := "" |
| | | if searchBody.TreeNodes !=nil { |
| | | if searchBody.TreeNodes != nil { |
| | | cameraId := searchBody.TreeNodes |
| | | if cameraId != nil && len(cameraId) > 0 { |
| | | esCameraId := strings.Replace(strings.Trim(fmt.Sprint(cameraId), "[]"), " ", "\",\"", -1) |
| | |
| | | linkTagInfoCameraIdStr + |
| | | linkTagInfoAnalyServerFilterStr + |
| | | "]}}" + |
| | | "]}}," + |
| | | "],\"minimum_should_match\":1}}," + |
| | | "\"size\":\"20\",\"sort\":[{\"picDate\":{\"order\":\"desc\"}}]," + |
| | | "\"_source\":{\"includes\":[],\"excludes\":[\"*.feature\"]}" + |
| | | "}" |
| | |
| | | |
| | | type InitForMonitorArg struct { |
| | | TreeNodes []string `json:"treeNodes"` |
| | | Tasks []string `json:"tasks"` |
| | | Tasks []string `json:"tasks"` |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | |
| | | } |
| | | //请求头 |
| | | localConf, err2 := cache.GetServerInfo() |
| | | if err2 !=nil || localConf.AlarmIp == "" || localConf.ServerId == "" { |
| | | if err2 != nil || localConf.AlarmIp == "" || localConf.ServerId == "" { |
| | | logger.Debug("localConfig is wrong!!!") |
| | | util.ResponseFormat(c,code.ComError,"localConf wrong") |
| | | util.ResponseFormat(c, code.ComError, "localConf wrong") |
| | | return |
| | | } |
| | | url := "http://" + localConf.AlarmIp + ":" + strconv.Itoa(int(localConf.AlarmPort)) + |
| | |
| | | linkTagInfoCameraIdStr + |
| | | linkTagInfoAnalyServerFilterStr + |
| | | "]}}" + |
| | | "]}}," + |
| | | "],\"minimum_should_match\":1}}," + |
| | | "\"sort\":[{\"picDate\":{\"order\":\"desc\"}}]," + |
| | | "\"size\":\"20\"," + |
| | | "\"_source\":{\"includes\":[],\"excludes\":[\"*.feature\"]}}" |
| | |
| | | } |
| | | //请求头 |
| | | localConf, err2 := cache.GetServerInfo() |
| | | if err2 !=nil || localConf.AlarmIp == "" || localConf.ServerId == "" { |
| | | if err2 != nil || localConf.AlarmIp == "" || localConf.ServerId == "" { |
| | | logger.Debug("localConfig is wrong!!!") |
| | | util.ResponseFormat(c,code.ComError,"localConf wrong") |
| | | util.ResponseFormat(c, code.ComError, "localConf wrong") |
| | | return |
| | | } |
| | | url := "http://" + localConf.AlarmIp + ":" + strconv.Itoa(int(localConf.AlarmPort)) + |
| | |
| | | linkTagInfoAnalyServerFilterStr + |
| | | "{\"range\":{\"linkTagInfo.picDate\":{\"gte\":\"now+8h-15s\",\"lt\":\"now+8h\"}}}" + |
| | | "]}}" + |
| | | "]}}," + |
| | | "],\"minimum_should_match\":1}}," + |
| | | "\"sort\":[{\"picDate\":{\"order\":\"desc\"}}]," + |
| | | "\"size\":\"1000\"," + |
| | | "\"_source\":{\"includes\":[],\"excludes\":[\"*.feature\"]}}" |
| | | logger.Debug("monitor param:",prama) |
| | | logger.Debug("monitor url:",url) |
| | | logger.Debug("monitor param:", prama) |
| | | logger.Debug("monitor url:", url) |
| | | tokenRes := esutil.GetEsDataReq(url, prama, true) |
| | | /* for _, value := range tokenRes["datalist"].([]interface{}) { |
| | | if value.(map[string]interface{})["personId"] != nil { |