|
@@ -70,7 +70,7 @@ func getPreviousMarket(sTime, eTime time.Time) int64 {
|
|
return os_time
|
|
return os_time
|
|
}
|
|
}
|
|
|
|
|
|
-//判断是否月初到月末
|
|
|
|
|
|
+// 判断是否月初到月末
|
|
func SEMonth(sTime, eTime time.Time) bool {
|
|
func SEMonth(sTime, eTime time.Time) bool {
|
|
var day int
|
|
var day int
|
|
month := int(eTime.Month())
|
|
month := int(eTime.Month())
|
|
@@ -153,8 +153,8 @@ func getBidamountStatistics(sTime, eTime time.Time) string {
|
|
return timeRange[:len(timeRange)-1]
|
|
return timeRange[:len(timeRange)-1]
|
|
}
|
|
}
|
|
|
|
|
|
-//getMonthRange获取月份范围
|
|
|
|
-//isStart true本月月初 false 本月月末(下月月初)
|
|
|
|
|
|
+// getMonthRange获取月份范围
|
|
|
|
+// isStart true本月月初 false 本月月末(下月月初)
|
|
func getMonthRange(t time.Time, isStart bool) time.Time {
|
|
func getMonthRange(t time.Time, isStart bool) time.Time {
|
|
if isStart {
|
|
if isStart {
|
|
return time.Date(t.Year(), t.Month(), 1, 0, 0, 0, 0, t.Location())
|
|
return time.Date(t.Year(), t.Month(), 1, 0, 0, 0, 0, t.Location())
|
|
@@ -172,8 +172,8 @@ func GetYearData(sTime, eTime time.Time) (bool, string) {
|
|
return _b, getCommonYearStatistics(sTime, eTime)
|
|
return _b, getCommonYearStatistics(sTime, eTime)
|
|
}
|
|
}
|
|
|
|
|
|
-//getYearRange获取月份范围
|
|
|
|
-//isStart true本月月初 false 本月月末(下月月初)
|
|
|
|
|
|
+// getYearRange获取月份范围
|
|
|
|
+// isStart true本月月初 false 本月月末(下月月初)
|
|
func getYearRange(t time.Time, isStart bool) time.Time {
|
|
func getYearRange(t time.Time, isStart bool) time.Time {
|
|
if isStart {
|
|
if isStart {
|
|
return time.Date(t.Year(), 1, 1, 0, 0, 0, 0, t.Location())
|
|
return time.Date(t.Year(), 1, 1, 0, 0, 0, 0, t.Location())
|
|
@@ -181,7 +181,7 @@ func getYearRange(t time.Time, isStart bool) time.Time {
|
|
return time.Date(t.Year()+1, 1, 1, 0, 0, 0, 0, t.Location())
|
|
return time.Date(t.Year()+1, 1, 1, 0, 0, 0, 0, t.Location())
|
|
}
|
|
}
|
|
|
|
|
|
-//年份统计
|
|
|
|
|
|
+// 年份统计
|
|
func getCommonYearStatistics(sTime, eTime time.Time) string {
|
|
func getCommonYearStatistics(sTime, eTime time.Time) string {
|
|
timeRange := ``
|
|
timeRange := ``
|
|
tmpTime, rTime, tEndTime := sTime, sTime, getYearRange(eTime, false)
|
|
tmpTime, rTime, tEndTime := sTime, sTime, getYearRange(eTime, false)
|
|
@@ -261,7 +261,7 @@ func sequential(now, old float64) interface{} {
|
|
return (now - old) / old
|
|
return (now - old) / old
|
|
}
|
|
}
|
|
|
|
|
|
-//市场概况+时间分布
|
|
|
|
|
|
+// 市场概况+时间分布
|
|
func (mae *MarketAnalysisEntity) MarketTime() (map[string]interface{}, error) {
|
|
func (mae *MarketAnalysisEntity) MarketTime() (map[string]interface{}, error) {
|
|
var (
|
|
var (
|
|
sql []string
|
|
sql []string
|
|
@@ -352,7 +352,7 @@ func (mae *MarketAnalysisEntity) MarketTime() (map[string]interface{}, error) {
|
|
return rMap, nil
|
|
return rMap, nil
|
|
}
|
|
}
|
|
|
|
|
|
-//时间分布月,年通用数据处理
|
|
|
|
|
|
+// 时间分布月,年通用数据处理
|
|
func (mae *MarketAnalysisEntity) TimeData(_b bool, thisRow []Buckets) map[string]interface{} {
|
|
func (mae *MarketAnalysisEntity) TimeData(_b bool, thisRow []Buckets) map[string]interface{} {
|
|
var count_ss, amout_ss []map[string]interface{}
|
|
var count_ss, amout_ss []map[string]interface{}
|
|
|
|
|
|
@@ -395,35 +395,35 @@ func amountDistribution(v float64, data map[string]*distributionTrend) {
|
|
data["<10万"].Amount += v
|
|
data["<10万"].Amount += v
|
|
data["<10万"].Count++
|
|
data["<10万"].Count++
|
|
} else if v < 500000 {
|
|
} else if v < 500000 {
|
|
- if data["10万-50万"] == nil {
|
|
|
|
- data["10万-50万"] = new(distributionTrend)
|
|
|
|
|
|
+ if data["10万~50万"] == nil {
|
|
|
|
+ data["10万~50万"] = new(distributionTrend)
|
|
}
|
|
}
|
|
- data["10万-50万"].Amount += v
|
|
|
|
- data["10万-50万"].Count++
|
|
|
|
|
|
+ data["10万~50万"].Amount += v
|
|
|
|
+ data["10万~50万"].Count++
|
|
} else if v < 1000000 {
|
|
} else if v < 1000000 {
|
|
- if data["50万-100万"] == nil {
|
|
|
|
- data["50万-100万"] = new(distributionTrend)
|
|
|
|
|
|
+ if data["50万~100万"] == nil {
|
|
|
|
+ data["50万~100万"] = new(distributionTrend)
|
|
}
|
|
}
|
|
- data["50万-100万"].Amount += v
|
|
|
|
- data["50万-100万"].Count++
|
|
|
|
|
|
+ data["50万~100万"].Amount += v
|
|
|
|
+ data["50万~100万"].Count++
|
|
} else if v < 1000000*5 {
|
|
} else if v < 1000000*5 {
|
|
- if data["100万-500万"] == nil {
|
|
|
|
- data["100万-500万"] = new(distributionTrend)
|
|
|
|
|
|
+ if data["100万~500万"] == nil {
|
|
|
|
+ data["100万~500万"] = new(distributionTrend)
|
|
}
|
|
}
|
|
- data["100万-500万"].Amount += v
|
|
|
|
- data["100万-500万"].Count++
|
|
|
|
|
|
+ data["100万~500万"].Amount += v
|
|
|
|
+ data["100万~500万"].Count++
|
|
} else if v < 1000000*10 {
|
|
} else if v < 1000000*10 {
|
|
- if data["500万-1000万"] == nil {
|
|
|
|
- data["500万-1000万"] = new(distributionTrend)
|
|
|
|
|
|
+ if data["500万~1000万"] == nil {
|
|
|
|
+ data["500万~1000万"] = new(distributionTrend)
|
|
}
|
|
}
|
|
- data["500万-1000万"].Amount += v
|
|
|
|
- data["500万-1000万"].Count++
|
|
|
|
|
|
+ data["500万~1000万"].Amount += v
|
|
|
|
+ data["500万~1000万"].Count++
|
|
} else if v < 100000000 {
|
|
} else if v < 100000000 {
|
|
- if data["1000万-1亿"] == nil {
|
|
|
|
- data["1000万-1亿"] = new(distributionTrend)
|
|
|
|
|
|
+ if data["1000万~1亿"] == nil {
|
|
|
|
+ data["1000万~1亿"] = new(distributionTrend)
|
|
}
|
|
}
|
|
- data["1000万-1亿"].Amount += v
|
|
|
|
- data["1000万-1亿"].Count++
|
|
|
|
|
|
+ data["1000万~1亿"].Amount += v
|
|
|
|
+ data["1000万~1亿"].Count++
|
|
} else if v >= 100000000 {
|
|
} else if v >= 100000000 {
|
|
if data["≥1亿"] == nil {
|
|
if data["≥1亿"] == nil {
|
|
data["≥1亿"] = new(distributionTrend)
|
|
data["≥1亿"] = new(distributionTrend)
|
|
@@ -673,7 +673,7 @@ type distributionTrend struct {
|
|
Amount float64
|
|
Amount float64
|
|
}
|
|
}
|
|
|
|
|
|
-var Analysis = []string{"<10万", "10万-50万", "50万-100万", "100万-500万", "500万-1000万", "1000万-1亿", "≥1亿"}
|
|
|
|
|
|
+var Analysis = []string{"<10万", "10万~50万", "50万~100万", "100万~500万", "500万~1000万", "1000万~1亿", "≥1亿"}
|
|
|
|
|
|
func BuyerAnalysis(thisBuyerRow BuyerWinnerRow, rMap map[string]interface{}, winnerName map[string]string) {
|
|
func BuyerAnalysis(thisBuyerRow BuyerWinnerRow, rMap map[string]interface{}, winnerName map[string]string) {
|
|
type buyer struct {
|
|
type buyer struct {
|
|
@@ -796,7 +796,7 @@ func BuyerAnalysis(thisBuyerRow BuyerWinnerRow, rMap map[string]interface{}, win
|
|
rMap["buyer_amount_top3"] = amountMap
|
|
rMap["buyer_amount_top3"] = amountMap
|
|
}
|
|
}
|
|
|
|
|
|
-//中标单位分析
|
|
|
|
|
|
+// 中标单位分析
|
|
func WinningAnalysis(thisWinnerRow BuyerWinnerRow, rMap map[string]interface{}, winnerName map[string]string) {
|
|
func WinningAnalysis(thisWinnerRow BuyerWinnerRow, rMap map[string]interface{}, winnerName map[string]string) {
|
|
type s_Winner struct {
|
|
type s_Winner struct {
|
|
Name string `json:"key"`
|
|
Name string `json:"key"`
|