|
@@ -1656,6 +1656,10 @@ func GetChartPredictEdbInfoDataListByRuleAnnualValueInversion(edbInfoId int, con
|
|
|
//兼容历史数据
|
|
|
yearList = append(yearList, annualValueInversionConf.Year)
|
|
|
}
|
|
|
+ if len(yearList) == 0 {
|
|
|
+ err = errors.New("同比年份不能为空")
|
|
|
+ return
|
|
|
+ }
|
|
|
// 每年截止到当前日期的累计值
|
|
|
dateTotalMap := make(map[time.Time]float64)
|
|
|
|
|
@@ -1753,6 +1757,10 @@ func GetChartPredictEdbInfoDataListByRuleAnnualValueInversion(edbInfoId int, con
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ if sum == 0 {
|
|
|
+ err = errors.New("同比年份的累计值为0")
|
|
|
+ return
|
|
|
+ }
|
|
|
//fmt.Printf("同比年份的余额%.4f\n", sum)
|
|
|
avg = sum / float64(len(yearList))
|
|
|
//fmt.Printf("同比年份的余额%.4f\n", avg)
|