|
@@ -9,9 +9,10 @@ import (
|
|
|
"eta/eta_chart_lib/services/data"
|
|
|
"eta/eta_chart_lib/utils"
|
|
|
"fmt"
|
|
|
- "github.com/shopspring/decimal"
|
|
|
"math"
|
|
|
"time"
|
|
|
+
|
|
|
+ "github.com/shopspring/decimal"
|
|
|
)
|
|
|
|
|
|
// GetAutoCalculateDateDataList 获取当前时间相关的区间作为计算依据
|
|
@@ -447,7 +448,7 @@ func GetChartDataByEdbInfoList(chartInfoId int, dateType, startYear int, startDa
|
|
|
xEdbIdValue = append(xEdbIdValue, edbInfoMapping.EdbInfoId)
|
|
|
}
|
|
|
//根据时间类型来筛选最终的数据
|
|
|
- yearMax := 0
|
|
|
+ var dateMax time.Time
|
|
|
if dateType == utils.DateTypeNYears {
|
|
|
for _, v := range edbInfoMappingList {
|
|
|
dataList := v.DataList.([]*models.EdbDataList)
|
|
@@ -457,16 +458,15 @@ func GetChartDataByEdbInfoList(chartInfoId int, dateType, startYear int, startDa
|
|
|
lastDateT, tErr := time.Parse(utils.FormatDate, latestDate)
|
|
|
if tErr != nil {
|
|
|
err = fmt.Errorf("获取图表日期信息失败,Err:" + tErr.Error())
|
|
|
- return
|
|
|
}
|
|
|
- if lastDateT.Year() > yearMax {
|
|
|
- yearMax = lastDateT.Year()
|
|
|
+ if lastDateT.After(dateMax) {
|
|
|
+ dateMax = lastDateT
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- startDate, endDate = utils.GetDateByDateTypeV2(dateType, startDate, endDate, startYear, yearMax)
|
|
|
+ startDate, endDate = utils.GetDateByDateTypeV2(dateType, startDate, endDate, startYear, dateMax)
|
|
|
|
|
|
if startDate != "" {
|
|
|
for k, v := range edbInfoMappingList {
|
|
@@ -579,7 +579,7 @@ func GetChartDataByEdbInfoListBySeries(chartInfoId int, dateType, startYear int,
|
|
|
edbInfoMapping.MinData = minData
|
|
|
xEdbIdValue = append(xEdbIdValue, edbInfoMapping.EdbInfoId)
|
|
|
}
|
|
|
- yearMax := 0
|
|
|
+ var dateMax time.Time
|
|
|
if dateType == utils.DateTypeNYears {
|
|
|
for _, v := range edbInfoMappingList {
|
|
|
dataList := v.DataList.([]*models.EdbDataList)
|
|
@@ -590,13 +590,13 @@ func GetChartDataByEdbInfoListBySeries(chartInfoId int, dateType, startYear int,
|
|
|
err = fmt.Errorf("获取图表日期信息失败,Err:" + tErr.Error())
|
|
|
return
|
|
|
}
|
|
|
- if lastDateT.Year() > yearMax {
|
|
|
- yearMax = lastDateT.Year()
|
|
|
+ if lastDateT.After(dateMax) {
|
|
|
+ dateMax = lastDateT
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- startDate, endDate = utils.GetDateByDateTypeV2(dateType, startDate, endDate, startYear, yearMax)
|
|
|
+ startDate, endDate = utils.GetDateByDateTypeV2(dateType, startDate, endDate, startYear, dateMax)
|
|
|
|
|
|
if startDate != "" {
|
|
|
for k, v := range edbInfoMappingList {
|