Bläddra i källkod

fix:日度预测指标添加/编辑页可配置预测日期类型

Roc 1 år sedan
förälder
incheckning
1614d90061

+ 1 - 0
models/data_manage/edb_info.go

@@ -34,6 +34,7 @@ type EdbInfo struct {
 	LatestValue      float64 `description:"数据最新值"`
 	MoveType         int     `description:"移动方式:1:领先(默认),2:滞后"`
 	MoveFrequency    string  `description:"移动频度"`
+	DataDateType     string  `orm:"column(data_date_type);size(255);null;default(交易日)"`
 }
 
 type EdbInfoMaxAndMinInfo struct {

+ 21 - 66
services/data/predict_edb_info.go

@@ -11,61 +11,16 @@ import (
 	"time"
 )
 
-// GetChartPredictEdbInfoDataList 获取图表的预测指标的未来数据
-func GetChartPredictEdbInfoDataList(predictEdbConf data_manage.PredictEdbConf, filtrateStartDateStr, latestDateStr string, lastDataValue float64, endDateStr, frequency string) (predictEdbInfoData []*models.EdbDataList, err error) {
-	endDate, err := time.ParseInLocation(utils.FormatDate, endDateStr, time.Local)
-	if err != nil {
-		return
-	}
-
-	latestDate, err := time.ParseInLocation(utils.FormatDate, latestDateStr, time.Local)
-	if err != nil {
-		return
-	}
-
-	// 开始预测数据的时间
-	startDate := latestDate
-
-	// 如果有筛选时间的话
-	if filtrateStartDateStr != `` {
-		filtrateStartDate, tmpErr := time.ParseInLocation(utils.FormatDate, filtrateStartDateStr, time.Local)
-		if tmpErr != nil {
-			err = tmpErr
-			return
-		}
-		//如果筛选时间晚于实际数据时间,那么就以筛选时间作为获取预测数据的时间
-		if filtrateStartDate.After(latestDate) {
-			startDate = filtrateStartDate.AddDate(0, 0, -1)
-		}
-	}
-
-	dataValue := lastDataValue
-	if predictEdbConf.RuleType == 2 {
-		dataValue = predictEdbConf.FixedValue
-	}
-	//获取后面的预测数据
-	dayList := getPredictEdbDayList(startDate, endDate, frequency)
-	predictEdbInfoData = make([]*models.EdbDataList, 0)
-	for k, v := range dayList {
-		predictEdbInfoData = append(predictEdbInfoData, &models.EdbDataList{
-			EdbDataId:     predictEdbConf.PredictEdbInfoId + 10000000000 + k,
-			EdbInfoId:     predictEdbConf.PredictEdbInfoId,
-			DataTime:      v.Format(utils.FormatDate),
-			Value:         dataValue,
-			DataTimestamp: (v.UnixNano() / 1e6) + 1000, //前端需要让加1s,说是2022-09-01 00:00:00 这样的整点不合适
-		})
-	}
-	return
-}
-
 // GetPredictEdbDayList 获取预测指标日期列表
-func getPredictEdbDayList(startDate, endDate time.Time, frequency string) (dayList []time.Time) {
-	//if !utils.InArrayByStr([]string{"日度", "周度", "月度"}, frequency)
+func getPredictEdbDayList(startDate, endDate time.Time, frequency, dataDateType string) (dayList []time.Time) {
+	if dataDateType == `` {
+		dataDateType = `交易日`
+	}
 	switch frequency {
 	case "日度":
 		for currDate := startDate.AddDate(0, 0, 1); currDate.Before(endDate) || currDate.Equal(endDate); currDate = currDate.AddDate(0, 0, 1) {
-			//周六、日排除
-			if currDate.Weekday() == time.Sunday || currDate.Weekday() == time.Saturday {
+			// 如果日期类型是交易日的时候,那么需要将周六、日排除
+			if dataDateType == `交易日` && (currDate.Weekday() == time.Sunday || currDate.Weekday() == time.Saturday) {
 				continue
 			}
 			dayList = append(dayList, currDate)
@@ -207,7 +162,7 @@ func GetPredictDataListByPredictEdbInfo(edbInfo *data_manage.EdbInfo, startDate,
 	}
 	//predictDataList, err = GetChartPredictEdbInfoDataList(*predictEdbConf, startDate, sourceEdbInfoItem.LatestDate, sourceEdbInfoItem.LatestValue, endDateStr, edbInfo.Frequency)
 	var predictMinValue, predictMaxValue float64
-	predictDataList, predictMinValue, predictMaxValue, err = GetChartPredictEdbInfoDataListByConfList(predictEdbConfList, startDate, sourceEdbInfoItem.LatestDate, endDateStr, edbInfo.Frequency, allDataList)
+	predictDataList, predictMinValue, predictMaxValue, err = GetChartPredictEdbInfoDataListByConfList(predictEdbConfList, startDate, sourceEdbInfoItem.LatestDate, endDateStr, edbInfo.Frequency, edbInfo.DataDateType, allDataList)
 
 	if err != nil {
 		return
@@ -234,7 +189,7 @@ func GetPredictCalculateDataListByPredictEdbInfo(edbInfo *data_manage.EdbInfo, s
 }
 
 // GetChartPredictEdbInfoDataListByConfList 获取图表的预测指标的未来数据
-func GetChartPredictEdbInfoDataListByConfList(predictEdbConfList []*data_manage.PredictEdbConf, filtrateStartDateStr, latestDateStr, endDateStr, frequency string, realPredictEdbInfoData []*models.EdbDataList) (predictEdbInfoData []*models.EdbDataList, minValue, maxValue float64, err error) {
+func GetChartPredictEdbInfoDataListByConfList(predictEdbConfList []*data_manage.PredictEdbConf, filtrateStartDateStr, latestDateStr, endDateStr, frequency, dataDateType string, realPredictEdbInfoData []*models.EdbDataList) (predictEdbInfoData []*models.EdbDataList, minValue, maxValue float64, err error) {
 	endDate, err := time.ParseInLocation(utils.FormatDate, endDateStr, time.Local)
 	if err != nil {
 		return
@@ -281,7 +236,7 @@ func GetChartPredictEdbInfoDataListByConfList(predictEdbConfList []*data_manage.
 
 		var tmpMinValue, tmpMaxValue float64 // 当前预测结果中的最大/最小值
 
-		dayList := getPredictEdbDayList(startDate, dataEndTime, frequency)
+		dayList := getPredictEdbDayList(startDate, dataEndTime, frequency, dataDateType)
 		if len(dayList) <= 0 { // 如果未来没有日期的话,那么就退出当前循环,进入下一个循环
 			continue
 		}
@@ -296,7 +251,7 @@ func GetChartPredictEdbInfoDataListByConfList(predictEdbConfList []*data_manage.
 			if lenTmpAllData > 0 {
 				lastDataValue = tmpAllData[lenTmpAllData-1].Value
 			}
-			predictEdbInfoData = GetChartPredictEdbInfoDataListByRule1(predictEdbConf.PredictEdbInfoId, lastDataValue, startDate, dataEndTime, frequency, predictEdbInfoData, existMap)
+			predictEdbInfoData = GetChartPredictEdbInfoDataListByRule1(predictEdbConf.PredictEdbInfoId, lastDataValue, dayList, predictEdbInfoData, existMap)
 			tmpMaxValue = lastDataValue
 			tmpMinValue = lastDataValue
 		case 2: //2:固定值
@@ -306,7 +261,7 @@ func GetChartPredictEdbInfoDataListByConfList(predictEdbConfList []*data_manage.
 				return
 			}
 			dataValue, _ := tmpValDecimal.Float64()
-			predictEdbInfoData = GetChartPredictEdbInfoDataListByRule1(predictEdbConf.PredictEdbInfoId, dataValue, startDate, dataEndTime, frequency, predictEdbInfoData, existMap)
+			predictEdbInfoData = GetChartPredictEdbInfoDataListByRule1(predictEdbConf.PredictEdbInfoId, dataValue, dayList, predictEdbInfoData, existMap)
 
 			tmpMaxValue = dataValue
 			tmpMinValue = dataValue
@@ -317,7 +272,7 @@ func GetChartPredictEdbInfoDataListByConfList(predictEdbConfList []*data_manage.
 				return
 			}
 			tbValue, _ := tmpValDecimal.Float64()
-			predictEdbInfoData, tmpMinValue, tmpMaxValue = GetChartPredictEdbInfoDataListByRuleTb(predictEdbConf.PredictEdbInfoId, tbValue, startDate, dataEndTime, frequency, realPredictEdbInfoData, predictEdbInfoData, existMap)
+			predictEdbInfoData, tmpMinValue, tmpMaxValue = GetChartPredictEdbInfoDataListByRuleTb(predictEdbConf.PredictEdbInfoId, tbValue, dayList, frequency, realPredictEdbInfoData, predictEdbInfoData, existMap)
 		case 4: //4:同差
 			tmpValDecimal, tmpErr := decimal.NewFromString(predictEdbConf.Value)
 			if tmpErr != nil {
@@ -325,7 +280,7 @@ func GetChartPredictEdbInfoDataListByConfList(predictEdbConfList []*data_manage.
 				return
 			}
 			tcValue, _ := tmpValDecimal.Float64()
-			predictEdbInfoData, tmpMinValue, tmpMaxValue = GetChartPredictEdbInfoDataListByRuleTc(predictEdbConf.PredictEdbInfoId, tcValue, startDate, dataEndTime, frequency, realPredictEdbInfoData, predictEdbInfoData, existMap)
+			predictEdbInfoData, tmpMinValue, tmpMaxValue = GetChartPredictEdbInfoDataListByRuleTc(predictEdbConf.PredictEdbInfoId, tcValue, dayList, frequency, realPredictEdbInfoData, predictEdbInfoData, existMap)
 		case 5: //5:环比
 			tmpValDecimal, tmpErr := decimal.NewFromString(predictEdbConf.Value)
 			if tmpErr != nil {
@@ -333,7 +288,7 @@ func GetChartPredictEdbInfoDataListByConfList(predictEdbConfList []*data_manage.
 				return
 			}
 			hbValue, _ := tmpValDecimal.Float64()
-			predictEdbInfoData, tmpMinValue, tmpMaxValue = GetChartPredictEdbInfoDataListByRuleHb(predictEdbConf.PredictEdbInfoId, hbValue, startDate, dataEndTime, frequency, realPredictEdbInfoData, predictEdbInfoData, existMap)
+			predictEdbInfoData, tmpMinValue, tmpMaxValue = GetChartPredictEdbInfoDataListByRuleHb(predictEdbConf.PredictEdbInfoId, hbValue, dayList, realPredictEdbInfoData, predictEdbInfoData, existMap)
 		case 6: //6:环差
 			tmpValDecimal, tmpErr := decimal.NewFromString(predictEdbConf.Value)
 			if tmpErr != nil {
@@ -341,23 +296,23 @@ func GetChartPredictEdbInfoDataListByConfList(predictEdbConfList []*data_manage.
 				return
 			}
 			hcValue, _ := tmpValDecimal.Float64()
-			predictEdbInfoData, tmpMinValue, tmpMaxValue = GetChartPredictEdbInfoDataListByRuleHc(predictEdbConf.PredictEdbInfoId, hcValue, startDate, dataEndTime, frequency, realPredictEdbInfoData, predictEdbInfoData, existMap)
+			predictEdbInfoData, tmpMinValue, tmpMaxValue = GetChartPredictEdbInfoDataListByRuleHc(predictEdbConf.PredictEdbInfoId, hcValue, dayList, realPredictEdbInfoData, predictEdbInfoData, existMap)
 		case 7: //7:N期移动均值
 			nValue, tmpErr := strconv.Atoi(predictEdbConf.Value)
 			if tmpErr != nil {
 				err = tmpErr
 				return
 			}
-			predictEdbInfoData, tmpMinValue, tmpMaxValue = GetChartPredictEdbInfoDataListByRuleNMoveMeanValue(predictEdbConf.PredictEdbInfoId, nValue, startDate, dataEndTime, frequency, realPredictEdbInfoData, predictEdbInfoData, existMap)
+			predictEdbInfoData, tmpMinValue, tmpMaxValue = GetChartPredictEdbInfoDataListByRuleNMoveMeanValue(predictEdbConf.PredictEdbInfoId, nValue, dayList, realPredictEdbInfoData, predictEdbInfoData, existMap)
 		case 8: //8:N期段线性外推值
 			nValue, tmpErr := strconv.Atoi(predictEdbConf.Value)
 			if tmpErr != nil {
 				err = tmpErr
 				return
 			}
-			predictEdbInfoData, tmpMinValue, tmpMaxValue = GetChartPredictEdbInfoDataListByRuleNLinearRegression(predictEdbConf.PredictEdbInfoId, nValue, startDate, dataEndTime, frequency, realPredictEdbInfoData, predictEdbInfoData, existMap)
+			predictEdbInfoData, tmpMinValue, tmpMaxValue = GetChartPredictEdbInfoDataListByRuleNLinearRegression(predictEdbConf.PredictEdbInfoId, nValue, dayList, realPredictEdbInfoData, predictEdbInfoData, existMap)
 		case 9: //9:动态环差”预测规则;
-			predictEdbInfoData, tmpMinValue, tmpMaxValue = GetChartPredictEdbInfoDataListByRuleTrendsHC(predictEdbConf.PredictEdbInfoId, predictEdbConf.ConfigId, startDate, dataEndTime, frequency, realPredictEdbInfoData, predictEdbInfoData, existMap)
+			predictEdbInfoData, tmpMinValue, tmpMaxValue = GetChartPredictEdbInfoDataListByRuleTrendsHC(predictEdbConf.PredictEdbInfoId, predictEdbConf.ConfigId, startDate, dataEndTime, dayList, realPredictEdbInfoData, predictEdbInfoData, existMap)
 		case 10: //10:根据 给定终值后插值 规则获取预测数据
 			tmpValDecimal, tmpErr := decimal.NewFromString(predictEdbConf.Value)
 			if tmpErr != nil {
@@ -365,7 +320,7 @@ func GetChartPredictEdbInfoDataListByConfList(predictEdbConfList []*data_manage.
 				return
 			}
 			finalValue, _ := tmpValDecimal.Float64()
-			predictEdbInfoData, tmpMinValue, tmpMaxValue = GetChartPredictEdbInfoDataListByRuleFinalValueHc(predictEdbConf.PredictEdbInfoId, finalValue, startDate, dataEndTime, frequency, realPredictEdbInfoData, predictEdbInfoData, existMap)
+			predictEdbInfoData, tmpMinValue, tmpMaxValue = GetChartPredictEdbInfoDataListByRuleFinalValueHc(predictEdbConf.PredictEdbInfoId, finalValue, dayList, realPredictEdbInfoData, predictEdbInfoData, existMap)
 		case 11: //11:根据 季节性 规则获取预测数据
 			var seasonConf SeasonConf
 			tmpErr := json.Unmarshal([]byte(predictEdbConf.Value), &seasonConf)
@@ -392,7 +347,7 @@ func GetChartPredictEdbInfoDataListByConfList(predictEdbConfList []*data_manage.
 			} else {
 				yearList = seasonConf.YearList
 			}
-			predictEdbInfoData, tmpMinValue, tmpMaxValue, err = GetChartPredictEdbInfoDataListByRuleSeason(predictEdbConf.PredictEdbInfoId, yearList, calendar, startDate, dataEndTime, frequency, realPredictEdbInfoData, predictEdbInfoData, existMap)
+			predictEdbInfoData, tmpMinValue, tmpMaxValue, err = GetChartPredictEdbInfoDataListByRuleSeason(predictEdbConf.PredictEdbInfoId, yearList, calendar, dayList, realPredictEdbInfoData, predictEdbInfoData, existMap)
 			if err != nil {
 				return
 			}
@@ -403,7 +358,7 @@ func GetChartPredictEdbInfoDataListByConfList(predictEdbConfList []*data_manage.
 				err = errors.New("季节性配置信息异常:" + tmpErr.Error())
 				return
 			}
-			predictEdbInfoData, tmpMinValue, tmpMaxValue, err = GetChartPredictEdbInfoDataListByRuleMoveAverageTb(predictEdbConf.PredictEdbInfoId, moveAverageConf.NValue, moveAverageConf.Year, startDate, dataEndTime, frequency, realPredictEdbInfoData, predictEdbInfoData, existMap)
+			predictEdbInfoData, tmpMinValue, tmpMaxValue, err = GetChartPredictEdbInfoDataListByRuleMoveAverageTb(predictEdbConf.PredictEdbInfoId, moveAverageConf.NValue, moveAverageConf.Year, dayList, realPredictEdbInfoData, predictEdbInfoData, existMap)
 			if err != nil {
 				return
 			}

+ 11 - 23
services/data/predict_edb_info_rule.go

@@ -15,10 +15,9 @@ import (
 )
 
 // GetChartPredictEdbInfoDataListByRule1 根据规则1获取预测数据
-func GetChartPredictEdbInfoDataListByRule1(edbInfoId int, dataValue float64, startDate, endDate time.Time, frequency string, predictEdbInfoData []*models.EdbDataList, existMap map[string]float64) (newPredictEdbInfoData []*models.EdbDataList) {
+func GetChartPredictEdbInfoDataListByRule1(edbInfoId int, dataValue float64, dayList []time.Time, predictEdbInfoData []*models.EdbDataList, existMap map[string]float64) (newPredictEdbInfoData []*models.EdbDataList) {
 	newPredictEdbInfoData = predictEdbInfoData
 	//获取后面的预测数据
-	dayList := getPredictEdbDayList(startDate, endDate, frequency)
 	predictEdbInfoData = make([]*models.EdbDataList, 0)
 	for k, v := range dayList {
 		newPredictEdbInfoData = append(newPredictEdbInfoData, &models.EdbDataList{
@@ -36,7 +35,7 @@ func GetChartPredictEdbInfoDataListByRule1(edbInfoId int, dataValue float64, sta
 // GetChartPredictEdbInfoDataListByRuleTb 根据同比值规则获取预测数据
 // 2.1 同比: 在未来某一个时间段内,给定一个固定的同比增速a,用去年同期值X乘以同比增速(1+a),得到预测值Y=X(1+a)
 // 例: 今年1-3月值,100,100,120。给定同比增速a=0.1,则明年1-3月预测值为: 100*1.1=110,100*1.1=110,120*1.1=132。
-func GetChartPredictEdbInfoDataListByRuleTb(edbInfoId int, tbValue float64, startDate, endDate time.Time, frequency string, realPredictEdbInfoData, predictEdbInfoData []*models.EdbDataList, existMap map[string]float64) (newPredictEdbInfoData []*models.EdbDataList, minValue, maxValue float64) {
+func GetChartPredictEdbInfoDataListByRuleTb(edbInfoId int, tbValue float64, dayList []time.Time, frequency string, realPredictEdbInfoData, predictEdbInfoData []*models.EdbDataList, existMap map[string]float64) (newPredictEdbInfoData []*models.EdbDataList, minValue, maxValue float64) {
 	allDataList := make([]*models.EdbDataList, 0)
 	allDataList = append(allDataList, realPredictEdbInfoData...)
 	allDataList = append(allDataList, predictEdbInfoData...)
@@ -44,7 +43,6 @@ func GetChartPredictEdbInfoDataListByRuleTb(edbInfoId int, tbValue float64, star
 
 	index := len(allDataList)
 	//获取后面的预测数据
-	dayList := getPredictEdbDayList(startDate, endDate, frequency)
 	predictEdbInfoData = make([]*models.EdbDataList, 0)
 	for k, currentDate := range dayList {
 
@@ -163,7 +161,7 @@ func TbzDiv(a, b float64) (result float64) {
 // GetChartPredictEdbInfoDataListByRuleTc 根据同差值规则获取预测数据
 // 2.2 同差: 在未来某一个时间段内,给定一个固定的同比增加值a,用去年同期值X加上同比增加值A,得到预测值Y=X+a
 // 例: 今年1-3月值,100,100,120。给定同比增加值a=10,则明年1-3月预测值为: 100+10=110,100+10=110,120+10=130
-func GetChartPredictEdbInfoDataListByRuleTc(edbInfoId int, tcValue float64, startDate, endDate time.Time, frequency string, realPredictEdbInfoData, predictEdbInfoData []*models.EdbDataList, existMap map[string]float64) (newPredictEdbInfoData []*models.EdbDataList, minValue, maxValue float64) {
+func GetChartPredictEdbInfoDataListByRuleTc(edbInfoId int, tcValue float64, dayList []time.Time, frequency string, realPredictEdbInfoData, predictEdbInfoData []*models.EdbDataList, existMap map[string]float64) (newPredictEdbInfoData []*models.EdbDataList, minValue, maxValue float64) {
 	allDataList := make([]*models.EdbDataList, 0)
 	allDataList = append(allDataList, realPredictEdbInfoData...)
 	allDataList = append(allDataList, predictEdbInfoData...)
@@ -171,7 +169,6 @@ func GetChartPredictEdbInfoDataListByRuleTc(edbInfoId int, tcValue float64, star
 
 	index := len(allDataList)
 	//获取后面的预测数据
-	dayList := getPredictEdbDayList(startDate, endDate, frequency)
 	predictEdbInfoData = make([]*models.EdbDataList, 0)
 	for k, currentDate := range dayList {
 
@@ -288,7 +285,7 @@ func TczDiv(a, b float64) (result float64) {
 // GetChartPredictEdbInfoDataListByRuleHb 根据环比值规则获取预测数据
 // 环比:在未来某一个时间段内,给定一个固定的环比增速a,用上一期值X乘以环比增速(1+a),得到预测值Y=X(1+a)
 // 例: 最近1期值为100,给定环比增速a=0.2,则未来3期预测值为: 100*1.2=120,120*1.2=144,144*1.2=172.8
-func GetChartPredictEdbInfoDataListByRuleHb(edbInfoId int, hbValue float64, startDate, endDate time.Time, frequency string, realPredictEdbInfoData, predictEdbInfoData []*models.EdbDataList, existMap map[string]float64) (newPredictEdbInfoData []*models.EdbDataList, minValue, maxValue float64) {
+func GetChartPredictEdbInfoDataListByRuleHb(edbInfoId int, hbValue float64, dayList []time.Time, realPredictEdbInfoData, predictEdbInfoData []*models.EdbDataList, existMap map[string]float64) (newPredictEdbInfoData []*models.EdbDataList, minValue, maxValue float64) {
 	allDataList := make([]*models.EdbDataList, 0)
 	allDataList = append(allDataList, realPredictEdbInfoData...)
 	allDataList = append(allDataList, predictEdbInfoData...)
@@ -296,7 +293,6 @@ func GetChartPredictEdbInfoDataListByRuleHb(edbInfoId int, hbValue float64, star
 
 	index := len(allDataList)
 	//获取后面的预测数据
-	dayList := getPredictEdbDayList(startDate, endDate, frequency)
 	for k, currentDate := range dayList {
 		tmpK := index + k - 1 //上1期的值
 
@@ -354,7 +350,7 @@ func HbzDiv(a, b float64) (result float64) {
 // GetChartPredictEdbInfoDataListByRuleHc 根据环差值规则获取预测数据
 // 2.4 环差:在未来某一个时间段内,给定一个固定的环比增加值a,用上一期值X加上环比增加值a,得到预测值Y=X+a
 // 例: 最近1期值为100,给定环比增加值a=10,则未来3期预测值为: 100+10=110,110+10=120,120+10=130
-func GetChartPredictEdbInfoDataListByRuleHc(edbInfoId int, hcValue float64, startDate, endDate time.Time, frequency string, realPredictEdbInfoData, predictEdbInfoData []*models.EdbDataList, existMap map[string]float64) (newPredictEdbInfoData []*models.EdbDataList, minValue, maxValue float64) {
+func GetChartPredictEdbInfoDataListByRuleHc(edbInfoId int, hcValue float64, dayList []time.Time, realPredictEdbInfoData, predictEdbInfoData []*models.EdbDataList, existMap map[string]float64) (newPredictEdbInfoData []*models.EdbDataList, minValue, maxValue float64) {
 	allDataList := make([]*models.EdbDataList, 0)
 	allDataList = append(allDataList, realPredictEdbInfoData...)
 	allDataList = append(allDataList, predictEdbInfoData...)
@@ -362,7 +358,6 @@ func GetChartPredictEdbInfoDataListByRuleHc(edbInfoId int, hcValue float64, star
 
 	index := len(allDataList)
 	//获取后面的预测数据
-	dayList := getPredictEdbDayList(startDate, endDate, frequency)
 	for k, currentDate := range dayList {
 		tmpK := index + k - 1 //上1期的值
 
@@ -414,7 +409,7 @@ func HczDiv(a, b float64) (result float64) {
 // GetChartPredictEdbInfoDataListByRuleNMoveMeanValue 根据N期移动均值规则获取预测数据
 // 2.5 N期移动均值:在未来某一个时间段内,下一期值等于过去N期值得平均值。
 // 例:最近3期值(N=3),为95,98,105则未来第1期值为 1/3*(95+98+105)=99.33, 未来第2期值为 1/3*(98+105+99.33)=100.78依次类推。
-func GetChartPredictEdbInfoDataListByRuleNMoveMeanValue(edbInfoId int, nValue int, startDate, endDate time.Time, frequency string, realPredictEdbInfoData, predictEdbInfoData []*models.EdbDataList, existMap map[string]float64) (newPredictEdbInfoData []*models.EdbDataList, minValue, maxValue float64) {
+func GetChartPredictEdbInfoDataListByRuleNMoveMeanValue(edbInfoId int, nValue int, dayList []time.Time, realPredictEdbInfoData, predictEdbInfoData []*models.EdbDataList, existMap map[string]float64) (newPredictEdbInfoData []*models.EdbDataList, minValue, maxValue float64) {
 	allDataList := make([]*models.EdbDataList, 0)
 	allDataList = append(allDataList, realPredictEdbInfoData...)
 	allDataList = append(allDataList, predictEdbInfoData...)
@@ -431,7 +426,6 @@ func GetChartPredictEdbInfoDataListByRuleNMoveMeanValue(edbInfoId int, nValue in
 	decimalN := decimal.NewFromInt(int64(nValue))
 
 	//获取后面的预测数据
-	dayList := getPredictEdbDayList(startDate, endDate, frequency)
 	for k, currentDate := range dayList {
 		tmpIndex := lenAllData + k - 1 //上1期的值
 
@@ -474,7 +468,7 @@ func GetChartPredictEdbInfoDataListByRuleNMoveMeanValue(edbInfoId int, nValue in
 // 例1:过去5期值(N=5)分别为:3,5,7,9,11(每两期值之间的时间间隔相等)。那么按照线性回归方程推算,未来三期的预测值是:13,15,17。
 //
 // 例2:过去6期值(N=6)分别为:3,3,5,7,9,11(每两期值之间的时间间隔相等)。那么按照线性回归方程推算,未来三期的预测值是:12.33,14.05,15.76。例1和例2的区别在于,多加了一期数据,导致回归方程发生改变,从而预测值不同。
-func GetChartPredictEdbInfoDataListByRuleNLinearRegression(edbInfoId int, nValue int, startDate, endDate time.Time, frequency string, realPredictEdbInfoData, predictEdbInfoData []*models.EdbDataList, existMap map[string]float64) (newPredictEdbInfoData []*models.EdbDataList, minValue, maxValue float64) {
+func GetChartPredictEdbInfoDataListByRuleNLinearRegression(edbInfoId int, nValue int, dayList []time.Time, realPredictEdbInfoData, predictEdbInfoData []*models.EdbDataList, existMap map[string]float64) (newPredictEdbInfoData []*models.EdbDataList, minValue, maxValue float64) {
 	//var errMsg string
 	//defer func() {
 	//	if errMsg != `` {
@@ -509,7 +503,6 @@ func GetChartPredictEdbInfoDataListByRuleNLinearRegression(edbInfoId int, nValue
 	a, b := getLinearResult(coordinateData)
 	//fmt.Println("a:", a, ";======b:", b)
 
-	dayList := getPredictEdbDayList(startDate, endDate, frequency)
 	for k, currentDate := range dayList {
 		tmpK := nValue + k + 1
 
@@ -598,7 +591,7 @@ func getLinearResult(s []Coordinate) (gradient, intercept float64) {
 // 计算公式为B-C;
 // 则指标A至2022-10-29的预测值为2022-10-28(100+(240-260)=80)、2022-10-29(80+(300-310)=90);
 // 注:动态环比增加值的计算遵从计算指标的计算规则,即用于计算的指标若有部分指标缺少部分日期数据,则这部分日期数据不做计算,为空;若动态环比增加值某一天为空,则往前追溯最近一期有值的环比增加值作为该天的数值参与计算;
-func GetChartPredictEdbInfoDataListByRuleTrendsHC(edbInfoId, configId int, startDate, endDate time.Time, frequency string, realPredictEdbInfoData, predictEdbInfoData []*models.EdbDataList, existMap map[string]float64) (newPredictEdbInfoData []*models.EdbDataList, minValue, maxValue float64) {
+func GetChartPredictEdbInfoDataListByRuleTrendsHC(edbInfoId, configId int, startDate, endDate time.Time, dayList []time.Time, realPredictEdbInfoData, predictEdbInfoData []*models.EdbDataList, existMap map[string]float64) (newPredictEdbInfoData []*models.EdbDataList, minValue, maxValue float64) {
 	allDataList := make([]*models.EdbDataList, 0)
 	allDataList = append(allDataList, realPredictEdbInfoData...)
 	allDataList = append(allDataList, predictEdbInfoData...)
@@ -619,7 +612,6 @@ func GetChartPredictEdbInfoDataListByRuleTrendsHC(edbInfoId, configId int, start
 	for _, v := range tmpPredictEdbRuleDataList {
 		hcDataMap[v.DataTime] = v.Value
 	}
-	dayList := getPredictEdbDayList(startDate, endDate, frequency)
 	for k, currentDate := range dayList {
 		// 最近一条数据
 		tmpLenAllDataList := len(allDataList)
@@ -668,7 +660,7 @@ func GetChartPredictEdbInfoDataListByRuleTrendsHC(edbInfoId, configId int, start
 // 需求说明:
 // 1、增加一个预测规则,名为“给定终值后插值”,给定预测截止日期和预测终值,计算最新数据日期至预测截止日期的时间差T,计算最新数据和预测终值的数据差S,数据频率与指标频度有关,日度=1,周度=7,旬度=10,月度=30,季度=90,年度=365,环差值=S/T*频率,预测数值=前一天数值+环差值;
 // 2、最新数据值和日期改动后,需重新计算环差值和预测数值;
-func GetChartPredictEdbInfoDataListByRuleFinalValueHc(edbInfoId int, finalValue float64, startDate, endDate time.Time, frequency string, realPredictEdbInfoData, predictEdbInfoData []*models.EdbDataList, existMap map[string]float64) (newPredictEdbInfoData []*models.EdbDataList, minValue, maxValue float64) {
+func GetChartPredictEdbInfoDataListByRuleFinalValueHc(edbInfoId int, finalValue float64, dayList []time.Time, realPredictEdbInfoData, predictEdbInfoData []*models.EdbDataList, existMap map[string]float64) (newPredictEdbInfoData []*models.EdbDataList, minValue, maxValue float64) {
 	allDataList := make([]*models.EdbDataList, 0)
 	allDataList = append(allDataList, realPredictEdbInfoData...)
 	allDataList = append(allDataList, predictEdbInfoData...)
@@ -676,7 +668,6 @@ func GetChartPredictEdbInfoDataListByRuleFinalValueHc(edbInfoId int, finalValue
 
 	index := len(allDataList)
 	//获取后面的预测日期
-	dayList := getPredictEdbDayList(startDate, endDate, frequency)
 	lenDay := len(dayList)
 	if lenDay <= 0 {
 		return
@@ -754,7 +745,7 @@ type SeasonConf struct {
 //
 // 计算2023.1.2预测值,求过去N年环差均值=[(300-200)+(220-210)+(260-250)]/3=40
 // 则2023.1.2预测值=2023.1.1值+过去N年环差均值
-func GetChartPredictEdbInfoDataListByRuleSeason(edbInfoId int, yearsList []int, calendar string, startDate, endDate time.Time, frequency string, realPredictEdbInfoData, predictEdbInfoData []*models.EdbDataList, existMap map[string]float64) (newPredictEdbInfoData []*models.EdbDataList, minValue, maxValue float64, err error) {
+func GetChartPredictEdbInfoDataListByRuleSeason(edbInfoId int, yearsList []int, calendar string, dayList []time.Time, realPredictEdbInfoData, predictEdbInfoData []*models.EdbDataList, existMap map[string]float64) (newPredictEdbInfoData []*models.EdbDataList, minValue, maxValue float64, err error) {
 	allDataList := make([]*models.EdbDataList, 0)
 	allDataList = append(allDataList, realPredictEdbInfoData...)
 	allDataList = append(allDataList, predictEdbInfoData...)
@@ -809,8 +800,6 @@ func GetChartPredictEdbInfoDataListByRuleSeason(edbInfoId int, yearsList []int,
 	}
 
 	index := len(allDataList)
-	//获取后面的预测日期
-	dayList := getPredictEdbDayList(startDate, endDate, frequency)
 
 	//获取后面的预测数据
 	predictEdbInfoData = make([]*models.EdbDataList, 0)
@@ -942,7 +931,7 @@ type MoveAverageConf struct {
 // 以此类推...
 // 计算2023.1.2预测值,求过去N年环差均值=[(200-200)+(250-210)+(270-250)]/3=16.67
 // 则2023.1.2预测值=2023.1.1值+过去N年环差均值
-func GetChartPredictEdbInfoDataListByRuleMoveAverageTb(edbInfoId int, nValue, year int, startDate, endDate time.Time, frequency string, realPredictEdbInfoData, predictEdbInfoData []*models.EdbDataList, existMap map[string]float64) (newPredictEdbInfoData []*models.EdbDataList, minValue, maxValue float64, err error) {
+func GetChartPredictEdbInfoDataListByRuleMoveAverageTb(edbInfoId int, nValue, year int, dayList []time.Time, realPredictEdbInfoData, predictEdbInfoData []*models.EdbDataList, existMap map[string]float64) (newPredictEdbInfoData []*models.EdbDataList, minValue, maxValue float64, err error) {
 	allDataList := make([]*models.EdbDataList, 0)
 	allDataList = append(allDataList, realPredictEdbInfoData...)
 	allDataList = append(allDataList, predictEdbInfoData...)
@@ -959,7 +948,6 @@ func GetChartPredictEdbInfoDataListByRuleMoveAverageTb(edbInfoId int, nValue, ye
 	decimalN := decimal.NewFromInt(int64(nValue))
 
 	//获取后面的预测数据
-	dayList := getPredictEdbDayList(startDate, endDate, frequency)
 	if len(dayList) <= 0 {
 		return
 	}