|
@@ -16,7 +16,7 @@ import (
|
|
|
)
|
|
|
|
|
|
// 中标单位分析
|
|
|
-func WinningAnalysis(thisWinnerRow BuyerWinnerRow, rMap *sync.Map, entArrMap map[string]float64, winnerName map[string]string, sy *sync.WaitGroup) {
|
|
|
+func WinningAnalysis(thisWinnerRow BuyerWinnerRow, rMap *sync.Map, entArrMap map[string]float64, winnerName map[string]string, sy *sync.WaitGroup, offline bool) {
|
|
|
defer sy.Done()
|
|
|
type s_Winner struct {
|
|
|
Name string `json:"key"`
|
|
@@ -100,13 +100,15 @@ func WinningAnalysis(thisWinnerRow BuyerWinnerRow, rMap *sync.Map, entArrMap map
|
|
|
}*/
|
|
|
ss = append(ss, _dd)
|
|
|
}
|
|
|
- if len(ss) > Top3 {
|
|
|
- _d.Data = ss[:Top3]
|
|
|
- } else {
|
|
|
+ if offline {
|
|
|
_d.Data = ss
|
|
|
- }
|
|
|
- if len(countMap) >= Top30 {
|
|
|
- break
|
|
|
+ } else {
|
|
|
+ if len(ss) > Top3 {
|
|
|
+ _d.Data = ss[:Top3]
|
|
|
+ }
|
|
|
+ if len(countMap) >= Top30 {
|
|
|
+ break
|
|
|
+ }
|
|
|
}
|
|
|
countMap = append(countMap, _d)
|
|
|
}
|
|
@@ -150,13 +152,15 @@ func WinningAnalysis(thisWinnerRow BuyerWinnerRow, rMap *sync.Map, entArrMap map
|
|
|
}*/
|
|
|
ss = append(ss, _dd)
|
|
|
}
|
|
|
- if len(ss) > Top3 {
|
|
|
- _d.Data = ss[:Top3]
|
|
|
- } else {
|
|
|
+ if offline {
|
|
|
_d.Data = ss
|
|
|
- }
|
|
|
- if len(amountMap) >= Top30 {
|
|
|
- break
|
|
|
+ } else {
|
|
|
+ if len(ss) > Top3 {
|
|
|
+ _d.Data = ss[:Top3]
|
|
|
+ }
|
|
|
+ if len(amountMap) >= Top30 {
|
|
|
+ break
|
|
|
+ }
|
|
|
}
|
|
|
amountMap = append(amountMap, _d)
|
|
|
}
|
|
@@ -213,7 +217,7 @@ func amountDistribution(v float64, data map[string]*distributionTrend) {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
-func BuyerAnalysis(thisBuyerRow BuyerWinnerRow, rMap *sync.Map, winnerName map[string]string, sy *sync.WaitGroup) {
|
|
|
+func BuyerAnalysis(thisBuyerRow BuyerWinnerRow, rMap *sync.Map, winnerName map[string]string, sy *sync.WaitGroup, offline bool) {
|
|
|
defer sy.Done()
|
|
|
type buyer struct {
|
|
|
Name string `json:"key"`
|
|
@@ -293,14 +297,16 @@ func BuyerAnalysis(thisBuyerRow BuyerWinnerRow, rMap *sync.Map, winnerName map[s
|
|
|
}*/
|
|
|
ss = append(ss, _dd)
|
|
|
}
|
|
|
- if len(ss) > Top3 {
|
|
|
- _d.Data = ss[:Top3]
|
|
|
+ if !offline {
|
|
|
+ if len(ss) > Top3 {
|
|
|
+ _d.Data = ss[:Top3]
|
|
|
+ }
|
|
|
+ if len(countMap) >= Top30 {
|
|
|
+ break
|
|
|
+ }
|
|
|
} else {
|
|
|
_d.Data = ss
|
|
|
}
|
|
|
- if len(countMap) >= Top30 {
|
|
|
- break
|
|
|
- }
|
|
|
countMap = append(countMap, _d)
|
|
|
}
|
|
|
|
|
@@ -345,14 +351,16 @@ func BuyerAnalysis(thisBuyerRow BuyerWinnerRow, rMap *sync.Map, winnerName map[s
|
|
|
|
|
|
ss = append(ss, _dd)
|
|
|
}
|
|
|
- if len(ss) > Top3 {
|
|
|
- _d.Data = ss[:Top3]
|
|
|
+ if !offline {
|
|
|
+ if len(ss) > Top3 {
|
|
|
+ _d.Data = ss[:Top3]
|
|
|
+ }
|
|
|
+ if len(amountMap) >= Top30 {
|
|
|
+ break
|
|
|
+ }
|
|
|
} else {
|
|
|
_d.Data = ss
|
|
|
}
|
|
|
- if len(amountMap) >= Top30 {
|
|
|
- break
|
|
|
- }
|
|
|
amountMap = append(amountMap, _d)
|
|
|
}
|
|
|
rMap.Store("buyer_time_distribution", buyerMap)
|