| | |
| | | package service |
| | | |
| | | import ( |
| | | "basic.com/valib/logger.git" |
| | | "encoding/json" |
| | | "fmt" |
| | | "strconv" |
| | | "webserver/cache" |
| | | "webserver/extend/config" |
| | | "webserver/extend/esutil" |
| | | "webserver/models" |
| | |
| | | |
| | | // 地库人员数据 为 比对做准备 |
| | | func QueryDbPersonsForCompare(reqBody models.EsSearch) map[string]interface{} { |
| | | url := "http://" + config.EsInfo.Masterip + ":" + config.EsInfo.Httpport + |
| | | localConf, err2 := cache.GetServerInfo() |
| | | if err2 !=nil || localConf.AlarmIp == "" || localConf.ServerId == "" { |
| | | logger.Debug("localConfig is wrong!!!") |
| | | return nil |
| | | } |
| | | url := "http://" + localConf.AlarmIp + ":" + strconv.Itoa(int(localConf.AlarmPort)) + |
| | | "/" + config.EsInfo.EsIndex.Dbtablepersons.IndexName + "/_search" |
| | | tableIds := make([]string, 20) |
| | | if reqBody.DataBases != nil { |
| | | tableIds = reqBody.DataBases |
| | | } |
| | | startDate := "";endDate := "" |
| | | startDate := "" |
| | | endDate := "" |
| | | if reqBody.SearchTime != nil && len(reqBody.SearchTime) >= 2 { |
| | | dates := reqBody.SearchTime |
| | | startDate = dates[0];endDate = dates[1] // 起始结束时间 |
| | | startDate = dates[0] |
| | | endDate = dates[1] // 起始结束时间 |
| | | } |
| | | contentValue := reqBody.InputValue //输入框内容 |
| | | /*page := 1 ;if reqBody["page"] != nil { page = int(reqBody["page"].(float64)) } // 页码 |
| | |
| | | syncTerm += ",{\"terms\":{\"tableId\":" + string(bytes) + "}}" // 底库人员 |
| | | } |
| | | if startDate != "" && endDate != "" { |
| | | syncTerm += ",{\"range\":{\"create_time\":{\"from\":\"" + startDate + "\"," + |
| | | syncTerm += ",{\"range\":{\"createTime\":{\"from\":\"" + startDate + "\"," + |
| | | "\"to\":\"" + endDate + "\",\"include_lower\":true,\"include_upper\":true,\"boost\":1}}}" // 底库人员 |
| | | } |
| | | if contentValue != "" { |
| | |
| | | "\"fields\":[\"personName\",\"sex\",\"idcard\",\"phoneNum\",\"reserved\"],\"boost\":1}}]" |
| | | } |
| | | params := "{\"query\":{\"bool\":{\"filter\":[" + |
| | | "{\"term\":{\"del_flag\":\"0\"}}" + syncTerm + "]" + contentParam + "}},\"from\":0,\"size\":10000,\"sort\":{\"uuid\":{\"order\":\"desc\"}}}" |
| | | "{\"term\":{\"isDelete\":\"0\"}}" + syncTerm + "]" + contentParam + "}},\"from\":0,\"size\":10000,\"sort\":{\"uuid\":{\"order\":\"desc\"}}}" |
| | | fmt.Print("查询全部底库人员 请求url:%s;\n 请求参数params:%s", url, params) |
| | | data := esutil.GetEsDataReq(url, params, true) |
| | | return data |
| | | } |
| | | |
| | | |