|
@@ -572,6 +572,7 @@ func MovePredictEdbInfo(edbInfoId, classifyId, prevEdbInfoId, nextEdbInfoId int,
|
|
|
|
|
|
// GetChartPredictEdbInfoDataListByConfList 获取图表的预测指标的未来数据
|
|
|
func GetChartPredictEdbInfoDataListByConfList(predictEdbConfList []data_manage.PredictEdbConfAndData, filtrateStartDateStr, latestDateStr, endDateStr string, endDateType int, frequency, dataDateType string, realPredictEdbInfoData []*data_manage.EdbDataList) (predictEdbInfoData []*data_manage.EdbDataList, minValue, maxValue float64, err error, errMsg string) {
|
|
|
+ hasEndNum := 0 //如果选择了未来期数,用来保存已经预测过的期数
|
|
|
var endDate time.Time
|
|
|
if endDateStr != `` {
|
|
|
endDate, err = time.ParseInLocation(utils.FormatDate, endDateStr, time.Local)
|
|
@@ -620,8 +621,12 @@ func GetChartPredictEdbInfoDataListByConfList(predictEdbConfList []data_manage.P
|
|
|
}
|
|
|
|
|
|
var tmpMinValue, tmpMaxValue float64 // 当前预测结果中的最大/最小值
|
|
|
-
|
|
|
- dayList := getPredictEdbDayList(startDate, dataEndTime, frequency, dataDateType, endDateType, predictEdbConf.EndNum)
|
|
|
+ endNum := predictEdbConf.EndNum - hasEndNum
|
|
|
+ if endNum <= 0 {
|
|
|
+ err = fmt.Errorf("预测期数不能小于等于0")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ dayList := getPredictEdbDayList(startDate, dataEndTime, frequency, dataDateType, endDateType, endNum)
|
|
|
|
|
|
if len(dayList) <= 0 { // 如果未来没有日期的话,那么就退出当前循环,进入下一个循环
|
|
|
continue
|
|
@@ -815,6 +820,9 @@ func GetChartPredictEdbInfoDataListByConfList(predictEdbConfList []data_manage.P
|
|
|
{
|
|
|
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
|