|
@@ -32,15 +32,21 @@ func BuyerListQuery(in *bxbuyer.BuyerListReq) (qstr string) {
|
|
query_aggs := `"aggs": {"group_field": {"terms": {"field": %s,"size": %d%s},"aggs": {"count": {"sum": {"field": "bidamount"}}}}}`
|
|
query_aggs := `"aggs": {"group_field": {"terms": {"field": %s,"size": %d%s},"aggs": {"count": {"sum": {"field": "bidamount"}}}}}`
|
|
query_sort := `,"order": {"count": "desc"}`
|
|
query_sort := `,"order": {"count": "desc"}`
|
|
query_bool_must := `{"terms":{"%s":[%s]}}`
|
|
query_bool_must := `{"terms":{"%s":[%s]}}`
|
|
|
|
+ query_bool_should := `{"bool":{"should":[%s],"minimum_should_match": 1}}`
|
|
|
|
+
|
|
bools := []string{}
|
|
bools := []string{}
|
|
musts := []string{}
|
|
musts := []string{}
|
|
|
|
+ musts_should := []string{}
|
|
//省份
|
|
//省份
|
|
if len(in.Province) > 0 {
|
|
if len(in.Province) > 0 {
|
|
- musts = append(musts, fmt.Sprintf(`{"terms":{"area":["%s"]}}`, strings.Join(in.Province, "\",\"")))
|
|
|
|
|
|
+ musts_should = append(musts_should, fmt.Sprintf(`{"terms":{"area":["%s"]}}`, strings.Join(in.Province, "\",\"")))
|
|
}
|
|
}
|
|
//城市
|
|
//城市
|
|
if len(in.City) > 0 {
|
|
if len(in.City) > 0 {
|
|
- musts = append(musts, fmt.Sprintf(`{"terms":{"city":["%s"]}}`, strings.Join(in.City, "\",\"")))
|
|
|
|
|
|
+ musts_should = append(musts_should, fmt.Sprintf(`{"terms":{"city":["%s"]}}`, strings.Join(in.City, "\",\"")))
|
|
|
|
+ }
|
|
|
|
+ if len(musts_should) > 0 {
|
|
|
|
+ musts = append(musts, fmt.Sprintf(query_bool_should, strings.Join(musts_should, ",")))
|
|
}
|
|
}
|
|
//采购单位名称
|
|
//采购单位名称
|
|
if len(in.BuyerName) > 0 {
|
|
if len(in.BuyerName) > 0 {
|
|
@@ -196,7 +202,7 @@ func GetBuyerList(qstr string, in *bxbuyer.BuyerListReq, isCache bool) (resp *bx
|
|
if icr {
|
|
if icr {
|
|
isRws = IsReceived(buyerNames, entUserId)
|
|
isRws = IsReceived(buyerNames, entUserId)
|
|
}
|
|
}
|
|
- log.Println("---:", isRws)
|
|
|
|
|
|
+ //log.Println("---:", isRws)
|
|
for _, fv := range fiftyArr {
|
|
for _, fv := range fiftyArr {
|
|
fv.Province = infoMap[fv.Buyer].Province
|
|
fv.Province = infoMap[fv.Buyer].Province
|
|
fv.City = infoMap[fv.Buyer].City
|
|
fv.City = infoMap[fv.Buyer].City
|