Browse Source

fix:指标库和预测指标库的季节性图最近N年

zqbao 3 months ago
parent
commit
c3effca5bd

+ 2 - 0
controllers/data_manage/edb_info.go

@@ -4673,7 +4673,9 @@ func (this *ChartInfoController) EdbInfoDataSeasonal() {
 	}
 	var latestDateT time.Time
 	if edbInfo.LatestDate != "" {
+		// 季节性图需要特殊处理最近N年数据
 		latestDateT, _ = time.Parse(utils.FormatDate, edbInfo.LatestDate)
+		latestDateT = time.Date(latestDateT.Year()+1, 1, 1, 0, 0, 0, 0, time.Local)
 	}
 
 	startDate, endDate = utils.GetDateByDateTypeV2(dateType, startDate, endDate, startYear, latestDateT)

+ 4 - 0
controllers/data_manage/predict_edb_info.go

@@ -1412,6 +1412,10 @@ func (this *PredictEdbInfoController) DataList() {
 		latestDateT, _ := time.Parse(utils.FormatDate, edbInfo.LatestDate)
 		maxDate = latestDateT
 	}
+	if chartType == utils.CHART_TYPE_SEASON && dateType == utils.DateTypeNYears {
+		// 季节性图需要特殊处理最近N年数据
+		maxDate = time.Date(maxDate.Year()+1, 1, 1, 0, 0, 0, 0, time.Local)
+	}
 
 	startDate, endDate = utils.GetDateByDateTypeV2(dateType, startDate, endDate, startYear, maxDate)
 	if endDate == "" {