|
@@ -1761,7 +1761,12 @@ func GetChartPredictEdbInfoDataListByRuleAnnualValueInversion(edbInfoId int, con
|
|
|
}
|
|
|
//计算每一天的年初至今累计值
|
|
|
yearVal := yearTotalMap[currentDate.Year()]
|
|
|
- yearVal = yearVal + val
|
|
|
+ if frequency == "周度" {
|
|
|
+ // 每日累计值需要当前值除7
|
|
|
+ yearVal = yearVal + val/7
|
|
|
+ } else {
|
|
|
+ yearVal = yearVal + val
|
|
|
+ }
|
|
|
yearTotalMap[currentDate.Year()] = yearVal
|
|
|
dateTotalMap[currentDate] = yearVal
|
|
|
dateIndexMap[currentDate] = i
|
|
@@ -1785,12 +1790,16 @@ func GetChartPredictEdbInfoDataListByRuleAnnualValueInversion(edbInfoId int, con
|
|
|
}
|
|
|
// 当年的余额
|
|
|
currYearBalance := yearValueConfig - yearTotalMap[currDayTime.Year()]
|
|
|
+ //fmt.Printf("当年的余额%.4f=给定额度%.4f-当年累计值%.4f\n", currYearBalance, yearValueConfig, yearTotalMap[currDayTime.Year()])
|
|
|
// 循环统计同比年份同期余额
|
|
|
var sum, avg float64
|
|
|
for _, year := range yearList {
|
|
|
yearTotal := yearTotalMap[year]
|
|
|
+ //fmt.Printf("同比年份的累计值%.4f\n", yearTotal)
|
|
|
tmpDate := time.Date(year, currDayTime.Month(), currDayTime.Day(), 0, 0, 0, 0, currDayTime.Location())
|
|
|
+ //fmt.Printf("同比年份的同期%s\n", tmpDate)
|
|
|
dateTotal, ok := dateTotalMap[tmpDate]
|
|
|
+ //fmt.Printf("同比年份的同期累计值%.4f\n", dateTotal)
|
|
|
if ok {
|
|
|
sum = sum + (yearTotal - dateTotal)
|
|
|
} else {
|
|
@@ -1800,6 +1809,7 @@ func GetChartPredictEdbInfoDataListByRuleAnnualValueInversion(edbInfoId int, con
|
|
|
for tmpDateTime := indexDateMap[tmpIndex+1]; tmpDateTime.Year() == year; tmpDateTime = indexDateMap[tmpIndex+1] {
|
|
|
dateTotal, ok = dateTotalMap[tmpDateTime]
|
|
|
if ok {
|
|
|
+ //fmt.Printf("同比年份的同期累计值%.4f\n", dateTotal)
|
|
|
sum = sum + (yearTotal - dateTotal)
|
|
|
break
|
|
|
}
|
|
@@ -1808,9 +1818,13 @@ func GetChartPredictEdbInfoDataListByRuleAnnualValueInversion(edbInfoId int, con
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ //fmt.Printf("同比年份的余额%.4f\n", sum)
|
|
|
avg = sum / float64(len(yearList))
|
|
|
+ //fmt.Printf("同比年份的余额%.4f\n", avg)
|
|
|
// 同比增速=当年余额/同比年份上一期日期的余额
|
|
|
tbVal := decimal.NewFromFloat(currYearBalance).Div(decimal.NewFromFloat(avg))
|
|
|
+ /*tbVal11, _ := tbVal.Round(4).Float64()
|
|
|
+ fmt.Printf("同比增速%.4f\n", tbVal11)*/
|
|
|
//(同比增速=余额/同比年份相应日期的余额的平均值,预测值等于同比年份同期值*同比增速);
|
|
|
for k, currentDate := range dayList {
|
|
|
// 循环遍历多个同比年份
|