|
@@ -749,19 +749,20 @@ func GetChartPredictEdbInfoDataListByRuleSeason(edbInfoId int, yearsList []int,
|
|
tmpLenAllDataList := len(allDataList)
|
|
tmpLenAllDataList := len(allDataList)
|
|
tmpK := tmpLenAllDataList - 1 //上1期数据的下标
|
|
tmpK := tmpLenAllDataList - 1 //上1期数据的下标
|
|
lastDayData := allDataList[tmpK] // 上1期的数据
|
|
lastDayData := allDataList[tmpK] // 上1期的数据
|
|
- lastDayStr := lastDayData.DataTime
|
|
|
|
|
|
+ //lastDayStr := lastDayData.DataTime
|
|
lastDayVal := lastDayData.Value
|
|
lastDayVal := lastDayData.Value
|
|
- lastDay, tmpErr := time.ParseInLocation(utils.FormatDate, lastDayStr, time.Local)
|
|
|
|
- if tmpErr != nil {
|
|
|
|
- err = errors.New("获取上期日期转换失败:" + tmpErr.Error())
|
|
|
|
- }
|
|
|
|
|
|
+ //lastDay, tmpErr := time.ParseInLocation(utils.FormatDate, lastDayStr, time.Local)
|
|
|
|
+ //if tmpErr != nil {
|
|
|
|
+ // err = errors.New("获取上期日期转换失败:" + tmpErr.Error())
|
|
|
|
+ //}
|
|
|
|
+ //lastDay := currentDate
|
|
for _, year := range yearsList {
|
|
for _, year := range yearsList {
|
|
moveDay := moveDayMap[year] //需要移动的天数
|
|
moveDay := moveDayMap[year] //需要移动的天数
|
|
var tmpHistoryCurrentVal, tmpHistoryLastVal float64
|
|
var tmpHistoryCurrentVal, tmpHistoryLastVal float64
|
|
var isFindHistoryCurrent, isFindHistoryLast bool //是否找到前几年的数据
|
|
var isFindHistoryCurrent, isFindHistoryLast bool //是否找到前几年的数据
|
|
|
|
|
|
//前几年当日的日期
|
|
//前几年当日的日期
|
|
- tmpHistoryCurrentDate := currentDate.AddDate(year-currentDate.Year(), 0, -moveDay)
|
|
|
|
|
|
+ tmpHistoryCurrentDate := currentDate.AddDate(year-currentDate.Year(), 0, -(moveDay + 1))
|
|
for i := 0; i <= 35; i++ { // 前后35天找数据,找到最近的值,先向后面找,再往前面找
|
|
for i := 0; i <= 35; i++ { // 前后35天找数据,找到最近的值,先向后面找,再往前面找
|
|
tmpDate := tmpHistoryCurrentDate.AddDate(0, 0, i)
|
|
tmpDate := tmpHistoryCurrentDate.AddDate(0, 0, i)
|
|
if val, ok := handleDataMap[tmpDate.Format(utils.FormatDate)]; ok {
|
|
if val, ok := handleDataMap[tmpDate.Format(utils.FormatDate)]; ok {
|
|
@@ -779,7 +780,7 @@ func GetChartPredictEdbInfoDataListByRuleSeason(edbInfoId int, yearsList []int,
|
|
}
|
|
}
|
|
|
|
|
|
//前几年上一期的日期
|
|
//前几年上一期的日期
|
|
- tmpHistoryLastDate := lastDay.AddDate(year-lastDay.Year(), 0, -moveDay)
|
|
|
|
|
|
+ tmpHistoryLastDate := tmpHistoryCurrentDate.AddDate(0, 0, -1)
|
|
for i := 0; i <= 35; i++ { // 前后35天找数据,找到最近的值,先向后面找,再往前面找
|
|
for i := 0; i <= 35; i++ { // 前后35天找数据,找到最近的值,先向后面找,再往前面找
|
|
tmpDate := tmpHistoryLastDate.AddDate(0, 0, i)
|
|
tmpDate := tmpHistoryLastDate.AddDate(0, 0, i)
|
|
if val, ok := handleDataMap[tmpDate.Format(utils.FormatDate)]; ok {
|
|
if val, ok := handleDataMap[tmpDate.Format(utils.FormatDate)]; ok {
|