|
@@ -723,16 +723,16 @@ func ProjectHandle(buyerArr []string, entAccountId int64, entName, area, busines
|
|
|
returnMap := &map[string]map[string]interface{}{}
|
|
|
sql := ""
|
|
|
sqlStr := ""
|
|
|
- propertyFormStr := `,{"match":{"property_form":[`
|
|
|
+ propertyFormStr := `"should":[`
|
|
|
for k, v := range strings.Split(businessStr, ",") {
|
|
|
if k > 0 {
|
|
|
propertyFormStr += `,`
|
|
|
}
|
|
|
- propertyFormStr += `"` + v + `"`
|
|
|
+ propertyFormStr += `{"term": {"topscopeclass": "` + v + `"}}`
|
|
|
}
|
|
|
- propertyFormStr += `]}}`
|
|
|
- sql = `{"query":{"bool":{"must_not":[{"term":{"project_bidstatus":1}}],"must":[{"multi_match":{"query":"%s","type":"phrase","fields":["buyer.mbuyer"]}}%s%s]}},"aggs":{"buyer_count":{"terms":{"field":"buyer","size":500,"order":{"zbtime_count":"desc"}},"aggs":{"area_count":{"terms":{"field":"area"}},"buyer_id":{"terms":{"field":"buyer_id"}},"money_count":{"sum":{"field":"project_money"}},"zbtime_count":{"max":{"field":"zbtime"}}}}},"size":0}`
|
|
|
- sqlStr = fmt.Sprintf(sql, entName, common.If(area != "", fmt.Sprintf(`,{"term":{"area":"%s"}}`, area), ""), propertyFormStr)
|
|
|
+ propertyFormStr += `],"minimum_should_match": 1`
|
|
|
+ sql = `{"query":{"bool":{"must_not":[{"term":{"project_bidstatus":1}}],%s,"must":[{"terms":{"buyer":[%s]}}%s]}},"aggs":{"buyer_count":{"terms":{"field":"buyer","size":500,"order":{"zbtime_count":"desc"}},"aggs":{"area_count":{"terms":{"field":"area"}},"buyer_id":{"terms":{"field":"buyer_id"}},"money_count":{"sum":{"field":"project_money"}},"zbtime_count":{"max":{"field":"zbtime"}}}}},"size":0}`
|
|
|
+ sqlStr = fmt.Sprintf(sql, propertyFormStr, strings.Join(buyerArr, ","), common.If(area != "", fmt.Sprintf(`,{"term":{"area":"%s"}}`, area), ""))
|
|
|
startTime := time.Now().Unix()
|
|
|
data, _, _ := elastic.GetAggs(INDEX_1, INDEX_1, sqlStr)
|
|
|
endTime := time.Now().Unix()
|