|
@@ -384,7 +384,8 @@ func GetSeasonEdbInfoDataListByXDate(dataList []*models.EdbDataList, latestDate
|
|
|
quarterMap := make(map[string][]*models.EdbDataList, 0)
|
|
|
|
|
|
//整理出日期
|
|
|
- leftNameFlag := true
|
|
|
+ idx := 1
|
|
|
+ chartLegendMap := make(map[string]int, 0)
|
|
|
for currentStartYear := startYear; currentStartYear <= endYear; currentStartYear++ {
|
|
|
startStr := fmt.Sprintf("%d-%s", currentStartYear, xStartDate)
|
|
|
currentEndYear := currentStartYear
|
|
@@ -411,11 +412,7 @@ func GetSeasonEdbInfoDataListByXDate(dataList []*models.EdbDataList, latestDate
|
|
|
//如果最新的日期在起始日之前,则跳出循环
|
|
|
break
|
|
|
}
|
|
|
- if startT.Before(lastDateT) && endT.After(lastDateT) {
|
|
|
- if endYear > currentStartYear {
|
|
|
- leftNameFlag = false
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
if endT.Year() > nowYear {
|
|
|
//如果最新的日期比真实年份要大,则数据全部按照最大的年份补齐
|
|
|
nowYear = endT.Year()
|
|
@@ -426,16 +423,17 @@ func GetSeasonEdbInfoDataListByXDate(dataList []*models.EdbDataList, latestDate
|
|
|
ShowName: showName,
|
|
|
}
|
|
|
dataMap[name] = item
|
|
|
+ chartLegendMap[name] = idx
|
|
|
+ idx++
|
|
|
if lastDateT.Before(endT) {
|
|
|
//如果最新的日期在起始日之前,则跳出循环
|
|
|
break
|
|
|
}
|
|
|
}
|
|
|
+ lenYear := len(dataMap)
|
|
|
for k, v := range dataMap {
|
|
|
- if leftNameFlag {
|
|
|
- v.ChartLegend = strconv.Itoa(v.StartDate.Year())
|
|
|
- } else {
|
|
|
- v.ChartLegend = strconv.Itoa(v.EndDate.Year())
|
|
|
+ if i, ok := chartLegendMap[k]; ok {
|
|
|
+ v.ChartLegend = strconv.Itoa(endYear - lenYear + i)
|
|
|
}
|
|
|
dataMap[k] = v
|
|
|
}
|
|
@@ -491,7 +489,9 @@ func GetSeasonEdbInfoDataListByXDate(dataList []*models.EdbDataList, latestDate
|
|
|
quarterItem.Year = v.ChartLegend
|
|
|
quarterItem.ChartLegend = v.ChartLegend
|
|
|
if le, ok := legendMap[v.ShowName]; ok {
|
|
|
- quarterItem.ChartLegend = le
|
|
|
+ if le != strconv.Itoa(v.StartDate.Year()) && le != strconv.Itoa(v.EndDate.Year()) {
|
|
|
+ quarterItem.ChartLegend = le
|
|
|
+ }
|
|
|
}
|
|
|
quarterItem.DataList = itemList
|
|
|
quarterItem.CuttingDataTimestamp = v.CuttingDataTimestamp
|
|
@@ -571,7 +571,8 @@ func GetSeasonEdbInfoDataListByXDateNong(result *models.EdbDataResult, latestDat
|
|
|
quarterMap := make(map[string][]*models.EdbDataList, 0)
|
|
|
|
|
|
//整理出日期
|
|
|
- leftNameFlag := true
|
|
|
+ idx := 1
|
|
|
+ chartLegendMap := make(map[string]int, 0)
|
|
|
for currentStartYear := startYear; currentStartYear <= endYear; currentStartYear++ {
|
|
|
startStr := fmt.Sprintf("%d-%s", currentStartYear, xStartDate)
|
|
|
currentEndYear := currentStartYear
|
|
@@ -597,11 +598,7 @@ func GetSeasonEdbInfoDataListByXDateNong(result *models.EdbDataResult, latestDat
|
|
|
//如果最新的日期在起始日之前,则跳出循环
|
|
|
break
|
|
|
}
|
|
|
- if startT.Before(lastDateT) && endT.After(lastDateT) {
|
|
|
- if endYear > currentStartYear {
|
|
|
- leftNameFlag = false
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
if endT.Year() > nowYear {
|
|
|
//如果最新的日期比真实年份要大,则数据全部按照最大的年份补齐
|
|
|
nowYear = endT.Year()
|
|
@@ -612,16 +609,17 @@ func GetSeasonEdbInfoDataListByXDateNong(result *models.EdbDataResult, latestDat
|
|
|
ShowName: showName,
|
|
|
}
|
|
|
dataMap[showName] = item
|
|
|
+ chartLegendMap[showName] = idx
|
|
|
+ idx++
|
|
|
if lastDateT.Before(endT) {
|
|
|
//如果最新的日期在起始日之前,则跳出循环
|
|
|
break
|
|
|
}
|
|
|
}
|
|
|
+ lenYear := len(dataMap)
|
|
|
for k, v := range dataMap {
|
|
|
- if leftNameFlag {
|
|
|
- v.ChartLegend = strconv.Itoa(v.StartDate.Year())
|
|
|
- } else {
|
|
|
- v.ChartLegend = strconv.Itoa(v.EndDate.Year())
|
|
|
+ if i, ok := chartLegendMap[k]; ok {
|
|
|
+ v.ChartLegend = strconv.Itoa(endYear - lenYear + i)
|
|
|
}
|
|
|
dataMap[k] = v
|
|
|
}
|
|
@@ -739,7 +737,9 @@ func GetSeasonEdbInfoDataListByXDateNong(result *models.EdbDataResult, latestDat
|
|
|
quarterItem.Year = v.ChartLegend
|
|
|
quarterItem.ChartLegend = v.ChartLegend
|
|
|
if le, ok := legendMap[v.ShowName]; ok {
|
|
|
- quarterItem.ChartLegend = le
|
|
|
+ if le != strconv.Itoa(v.StartDate.Year()) && le != strconv.Itoa(v.EndDate.Year()) {
|
|
|
+ quarterItem.ChartLegend = le
|
|
|
+ }
|
|
|
}
|
|
|
quarterItem.DataList = itemList
|
|
|
quarterItem.CuttingDataTimestamp = v.CuttingDataTimestamp
|