浏览代码

fix:预测指标参与画图,领先、滞后时,预测开始日期也要领先、滞后对应期数

Roc 1 年之前
父节点
当前提交
4690dba0a1
共有 1 个文件被更改,包括 15 次插入0 次删除
  1. 15 0
      services/data/chart_info.go

+ 15 - 0
services/data/chart_info.go

@@ -354,6 +354,21 @@ func getEdbDataMapList(chartInfoId, chartType int, calendar, startDate, endDate
 					startDateReal = startDate
 					diffSeconds = 0
 				}
+
+				// 预测指标的开始日期也要偏移
+				{
+					day, tmpErr := utils.GetDaysBetween2Date(utils.FormatDate, startDateReal, startDate)
+					if tmpErr != nil {
+						err = tmpErr
+						return
+					}
+					latestDateTime, tmpErr := time.ParseInLocation(utils.FormatDate, v.LatestDate, time.Local)
+					if tmpErr != nil {
+						err = tmpErr
+						return
+					}
+					v.LatestDate = latestDateTime.AddDate(0, 0, day).Format(utils.FormatDate)
+				}
 			} else {
 				startDateReal = startDate
 			}