|
@@ -21,6 +21,7 @@ const (
|
|
|
sortprice_str = `{"key":"<10万","from":0.0000000000001,"to":100000},{"key":"10万-50万","from":100000,"to":500000},{"key":"50万-100万","from":500000,"to":1000000},{"key":"100万-500万","from":1000000,"to":5000000},{"key":"500万-1000万","from":5000000,"to":10000000},{"key":"1000万-1亿","from":10000000,"to":100000000},{"key":"≥1亿","from":100000000}`
|
|
|
aggs_all_c_m = `"project_count": {"filter": {}},"project_amount": {"sum": {"field": "sortprice"}}`
|
|
|
query_id = `{"query": {"bool": {"must": [{"term": {"entidlist": "%s"}}]}},"size": 1}`
|
|
|
+ query_idto = `{"query": {"bool": {"must": [{"terms": {"qyxy.id": [%s]}}],"should": []}},"from": 0,"size": 36}`
|
|
|
)
|
|
|
|
|
|
type AreaCTop struct {
|
|
@@ -163,6 +164,7 @@ type AreaCTop struct {
|
|
|
} `json:"buyerclass_count_top3"`
|
|
|
}
|
|
|
|
|
|
+//企业id查企业名
|
|
|
func IdToWinner(id string) (entname string) {
|
|
|
finalSql := fmt.Sprintf(query_id, id)
|
|
|
hits := elastic.Get("projectset", "projectset", finalSql)
|
|
@@ -185,6 +187,29 @@ func IdToWinner(id string) (entname string) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+//企业id查企业名 传入数组
|
|
|
+func IDToName(ids []string) (iMap map[string]interface{}) {
|
|
|
+ var idss []string
|
|
|
+ iMap = map[string]interface{}{}
|
|
|
+ for _, v := range ids {
|
|
|
+ vs := `"` + v + `"`
|
|
|
+ idss = append(idss, vs)
|
|
|
+ }
|
|
|
+ d := strings.Join(idss, ",")
|
|
|
+ finalSql := fmt.Sprintf(query_idto, d)
|
|
|
+ hits := elastic.Get("qyxy", "qyxy", finalSql)
|
|
|
+ source := *hits
|
|
|
+ for _, vv := range source {
|
|
|
+ for _, vi := range ids {
|
|
|
+ if vv["_id"] != nil && vi == vv["_id"] {
|
|
|
+ iMap[util.ObjToString(vv["_id"])] = vv["company_name"]
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
func (mae *MarketAnalysisEntity) AllData() (rMap map[string]interface{}, err error) {
|
|
|
rMap = map[string]interface{}{}
|
|
|
var aggs []string
|