Selaa lähdekoodia

fix:代码优化

xuemingyang 3 vuotta sitten
vanhempi
commit
1a77196ddb

+ 10 - 3
src/jfw/modules/bigmember/src/entity/marketAnalysis/customized_analysis.go

@@ -19,13 +19,16 @@ const (
 	aggs_buyerclass_counttop3  = `"buyerclass_count_top3":{"terms":{"field":"buyerclass","exclude":["其它",""],"order":[{"buyerclass_count":"desc"}],"size":3},"aggs":{"buyerclass_count":{"filter":{}},"bidcount_top":{"terms":{"field":"entidlist","exclude": ["-"],"order":[{"buyer_winner_count":"desc"}],"size":3},"aggs":{"buyer_winner_count":{"filter":{}}}}}}`
 	aggs_buyerclass_amounttop3 = `"buyerclass_amount_top3":{"terms":{"field":"buyerclass","exclude":["其它",""],"order":[{"buyerclass_amount":"desc"}],"size":3},"aggs":{"buyerclass_amount":{"sum":{"field":"sortprice"}},"winner_top":{"terms":{"field":"entidlist","exclude": ["-"],"order":[{"buyer_winner_amount":"desc"}],"size":3},"aggs":{"buyer_winner_amount":{"sum":{"field":"sortprice"}}}}}}`
 	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"}}`
+	aggs_all_c_m               = `"project_count": {"filter": {}},"project_count_not0": {"filter": {"range": {"sortprice": {"gt": 0}}}},"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 {
-	Total  int64 `json:"doc_count"`
+	Total     int64 `json:"doc_count"`
+	CountNot0 struct {
+		Count int64 `json:"doc_count"`
+	} `json:"project_count_not0"`
 	Amount struct {
 		Value float64 `json:"value"`
 	} `json:"project_amount"`
@@ -242,6 +245,10 @@ func (mae *MarketAnalysisEntity) AllData() (rMap map[string]interface{}, err err
 			if json.Unmarshal(bArr, &thisRow) != nil {
 				continue
 			}
+		} else if name == "project_count_not0" {
+			if json.Unmarshal(bArr, &thisRow.CountNot0) != nil {
+				continue
+			}
 		} else if name == "sortprice_ranges" {
 			if json.Unmarshal(bArr, &thisRow.SortpriceRanges) != nil {
 				continue
@@ -288,7 +295,7 @@ func (mae *MarketAnalysisEntity) AllData() (rMap map[string]interface{}, err err
 //项目规模分布
 func ProjectScale(thisRow AreaCTop) (data []interface{}) {
 	ammount := thisRow.Amount.Value
-	total := thisRow.Total
+	total := thisRow.CountNot0.Count
 	buckets := thisRow.SortpriceRanges.Buckets
 	type Scale struct {
 		Name      string