xyxie 2 months ago
parent
commit
bc02fcbb16
1 changed files with 6 additions and 2 deletions
  1. 6 2
      models/edb_info.go

+ 6 - 2
models/edb_info.go

@@ -743,6 +743,7 @@ func UnifiedModifyPredictEdbInfoMaxAndMinInfo(edbInfo *EdbInfo, latestDateStr st
 
 // GetChartPredictEdbInfoDataListByConfList 获取图表的预测指标的未来数据
 func GetChartPredictEdbInfoDataListByConfList(predictEdbConfList []*PredictEdbConfAndData, filtrateStartDateStr, latestDateStr, endDateStr, frequency, dataDateType string, endDateType int, realPredictEdbInfoData []*EdbInfoSearchData) (predictEdbInfoData []*EdbInfoSearchData, minValue, maxValue float64, err error) {
+	hasEndNum := 0 //如果选择了未来期数,用来保存已经预测过的期数
 	var endDate time.Time
 	if endDateStr != `` {
 		endDate, err = time.ParseInLocation(utils.FormatDate, endDateStr, time.Local)
@@ -790,8 +791,8 @@ func GetChartPredictEdbInfoDataListByConfList(predictEdbConfList []*PredictEdbCo
 		//}
 		//endDate = predictEdbConf.EndDate
 		var tmpMinValue, tmpMaxValue float64 // 当前预测结果中的最大/最小值
-
-		dayList := getPredictEdbDayList(startDate, predictEdbConf.EndDate, frequency, dataDateType, endDateType, predictEdbConf.EndNum)
+		endNum := predictEdbConf.EndNum - hasEndNum
+		dayList := getPredictEdbDayList(startDate, predictEdbConf.EndDate, frequency, dataDateType, endDateType, endNum)
 		if len(dayList) <= 0 { // 如果未来没有日期的话,那么就退出当前循环,进入下一个循环
 			continue
 		}
@@ -1001,6 +1002,9 @@ func GetChartPredictEdbInfoDataListByConfList(predictEdbConfList []*PredictEdbCo
 		{
 			lenPredictEdbInfoData := len(predictEdbInfoData)
 			if lenPredictEdbInfoData > 0 {
+				if endDateType == 1 {
+					hasEndNum = predictEdbConf.EndNum
+				}
 				tmpDataEndTime, _ := time.ParseInLocation(utils.FormatDate, predictEdbInfoData[lenPredictEdbInfoData-1].DataTime, time.Local)
 				if startDate.Before(tmpDataEndTime) {
 					startDate = tmpDataEndTime