浏览代码

指标期数位移-预测指标

gmy 6 月之前
父节点
当前提交
93b5401473
共有 1 个文件被更改,包括 9 次插入1 次删除
  1. 9 1
      models/predict_edb_data_calculate_phase_shift.go

+ 9 - 1
models/predict_edb_data_calculate_phase_shift.go

@@ -241,6 +241,10 @@ func refreshAllPredictCalculatePhaseShift(to orm.TxOrmer, edbInfoId, source, sub
 			if periods < dataLen {
 				newIndex := dataList[dataLen-periods-1]
 				resultMap[newIndex.DataTime] = currentIndex.Value
+
+				if strings.Contains(currentIndex.DataTime, fromEdbInfo.LatestDate) {
+					latestDateStr = newIndex.DataTime
+				}
 			} else {
 				moveNum = formulaInt - i
 
@@ -269,6 +273,10 @@ func refreshAllPredictCalculatePhaseShift(to orm.TxOrmer, edbInfoId, source, sub
 			if periods > 0 {
 				newIndex := dataList[dataLen-periods]
 				resultMap[newIndex.DataTime] = currentIndex.Value
+
+				if strings.Contains(currentIndex.DataTime, fromEdbInfo.LatestDate) {
+					latestDateStr = newIndex.DataTime
+				}
 			} else {
 				moveNum = formulaInt + 1 - (dataLen - i)
 				// 新数据须根据频度补充key
@@ -284,11 +292,11 @@ func refreshAllPredictCalculatePhaseShift(to orm.TxOrmer, edbInfoId, source, sub
 				}
 
 				format := newDate.Format(utils.FormatDate)
+				resultMap[format] = currentIndex.Value
 
 				if strings.Contains(currentIndex.DataTime, fromEdbInfo.LatestDate) {
 					latestDateStr = format
 				}
-				resultMap[format] = currentIndex.Value
 			}
 		}
 	}