Browse Source

fix:优化区域分布图包含边界问题

duxin 3 years ago
parent
commit
a84f14c872

+ 16 - 27
src/jfw/modules/bigmember/src/entity/marketAnalysis/customizad_distribution.go

@@ -386,62 +386,51 @@ func (mae *MarketAnalysisEntity) TimeData(_b bool, thisRow []Buckets) map[string
 }
 
 func amountDistribution(v float64, data map[string]*distributionTrend) {
+	if v <= 0 {
+		return
+	}
 	if v < 100000 {
 		if data["<10万"] == nil {
 			data["<10万"] = new(distributionTrend)
 		}
 		data["<10万"].Amount += v
-		if v != 0 {
-			data["<10万"].Count++
-		}
-	} else if v <= 500000 {
+		data["<10万"].Count++
+	} else if v < 500000 {
 		if data["10万-50万"] == nil {
 			data["10万-50万"] = new(distributionTrend)
 		}
 		data["10万-50万"].Amount += v
-		if v != 0 {
-			data["10万-50万"].Count++
-		}
-	} else if v <= 1000000 {
+		data["10万-50万"].Count++
+	} else if v < 1000000 {
 		if data["50万-100万"] == nil {
 			data["50万-100万"] = new(distributionTrend)
 		}
 		data["50万-100万"].Amount += v
-		if v != 0 {
-			data["50万-100万"].Count++
-		}
-	} else if v <= 1000000*5 {
+		data["50万-100万"].Count++
+	} else if v < 1000000*5 {
 		if data["100万-500万"] == nil {
 			data["100万-500万"] = new(distributionTrend)
 		}
 		data["100万-500万"].Amount += v
-		if v != 0 {
-			data["100万-500万"].Count++
-		}
-	} else if v <= 1000000*10 {
+		data["100万-500万"].Count++
+	} else if v < 1000000*10 {
 		if data["500万-1000万"] == nil {
 			data["500万-1000万"] = new(distributionTrend)
 		}
 		data["500万-1000万"].Amount += v
-		if v != 0 {
-			data["500万-1000万"].Count++
-		}
-	} else if v <= 100000000 {
+		data["500万-1000万"].Count++
+	} else if v < 100000000 {
 		if data["1000万-1亿"] == nil {
 			data["1000万-1亿"] = new(distributionTrend)
 		}
 		data["1000万-1亿"].Amount += v
-		if v != 0 {
-			data["1000万-1亿"].Count++
-		}
-	} else if v > 100000000 {
+		data["1000万-1亿"].Count++
+	} else if v >= 100000000 {
 		if data["≥1亿"] == nil {
 			data["≥1亿"] = new(distributionTrend)
 		}
 		data["≥1亿"].Amount += v
-		if v != 0 {
-			data["≥1亿"].Count++
-		}
+		data["≥1亿"].Count++
 	}
 
 }