|
@@ -53,25 +53,25 @@ func (i *InterpolateStrategy) Deal(tmpConfig data_manage.AreaExtraConf, edbDataL
|
|
|
|
|
|
// 插值法补充数据
|
|
|
var startEdbInfoData *data_manage.EdbDataList
|
|
|
- for index := 0; index < len(dataList)-1; index++ {
|
|
|
+ for index := 0; index < len(dataList); index++ {
|
|
|
// 获取当前数据和下一个数据
|
|
|
- beforeIndexData := dataList[index]
|
|
|
- afterIndexData := dataList[index+1]
|
|
|
+ currentIndexData := dataList[index]
|
|
|
+ //afterIndexData := dataList[index+1]
|
|
|
|
|
|
if startEdbInfoData == nil {
|
|
|
- startEdbInfoData = beforeIndexData
|
|
|
+ startEdbInfoData = currentIndexData
|
|
|
continue
|
|
|
}
|
|
|
|
|
|
// 获取两条数据之间相差的天数
|
|
|
startDataTime, _ := time.ParseInLocation(utils.FormatDate, startEdbInfoData.DataTime, time.Local)
|
|
|
- currDataTime, _ := time.ParseInLocation(utils.FormatDate, afterIndexData.DataTime, time.Local)
|
|
|
+ currDataTime, _ := time.ParseInLocation(utils.FormatDate, currentIndexData.DataTime, time.Local)
|
|
|
betweenHour := int(currDataTime.Sub(startDataTime).Hours())
|
|
|
betweenDay := betweenHour / 24
|
|
|
|
|
|
// 如果相差一天,那么过滤
|
|
|
if betweenDay <= 1 {
|
|
|
- startEdbInfoData = afterIndexData
|
|
|
+ startEdbInfoData = currentIndexData
|
|
|
continue
|
|
|
}
|
|
|
|
|
@@ -86,7 +86,7 @@ func (i *InterpolateStrategy) Deal(tmpConfig data_manage.AreaExtraConf, edbDataL
|
|
|
coordinateData = append(coordinateData, tmpCoordinate1)
|
|
|
tmpCoordinate2 := utils.Coordinate{
|
|
|
X: float64(betweenDay) + 1,
|
|
|
- Y: afterIndexData.Value,
|
|
|
+ Y: currentIndexData.Value,
|
|
|
}
|
|
|
coordinateData = append(coordinateData, tmpCoordinate2)
|
|
|
|
|
@@ -108,7 +108,7 @@ func (i *InterpolateStrategy) Deal(tmpConfig data_manage.AreaExtraConf, edbDataL
|
|
|
nextDay := tmpDataTime.Format(utils.FormatDate)
|
|
|
|
|
|
replenishIndexData := data_manage.EdbDataList{
|
|
|
- EdbDataId: afterIndexData.EdbDataId,
|
|
|
+ EdbDataId: currentIndexData.EdbDataId,
|
|
|
DataTime: nextDay,
|
|
|
DataTimestamp: tmpDataTime.UnixMilli(),
|
|
|
Value: val,
|
|
@@ -117,7 +117,7 @@ func (i *InterpolateStrategy) Deal(tmpConfig data_manage.AreaExtraConf, edbDataL
|
|
|
// 将补充数据加入补充数据列表
|
|
|
replenishDataList = append(replenishDataList, &replenishIndexData)
|
|
|
}
|
|
|
- startEdbInfoData = afterIndexData
|
|
|
+ startEdbInfoData = currentIndexData
|
|
|
}
|
|
|
|
|
|
// 处理从最后一个数据到 endDate 的日期补充
|