|
@@ -1461,15 +1461,17 @@ type AnnualValueInversionConf struct {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
func GetChartPredictEdbInfoDataListByRuleAnnualValueInversion(edbInfoId int, configValue string, dayList []time.Time, frequency string, realPredictEdbInfoData, predictEdbInfoData []*EdbInfoSearchData, existMap map[string]float64) (newPredictEdbInfoData []*EdbInfoSearchData, minValue, maxValue float64, err error) {
|
|
|
if frequency == "年度" {
|
|
|
err = errors.New("当前指标频度是年度,不允许配置年度值倒推")
|
|
@@ -1688,7 +1690,12 @@ func GetChartPredictEdbInfoDataListByRuleAnnualValueInversion(edbInfoId int, con
|
|
|
}
|
|
|
|
|
|
yearVal := yearTotalMap[currentDate.Year()]
|
|
|
- yearVal = yearVal + val
|
|
|
+ if frequency == "周度" {
|
|
|
+
|
|
|
+ yearVal = yearVal + val/7
|
|
|
+ } else {
|
|
|
+ yearVal = yearVal + val
|
|
|
+ }
|
|
|
yearTotalMap[currentDate.Year()] = yearVal
|
|
|
dateTotalMap[currentDate] = yearVal
|
|
|
dateIndexMap[currentDate] = i
|
|
@@ -1712,12 +1719,16 @@ func GetChartPredictEdbInfoDataListByRuleAnnualValueInversion(edbInfoId int, con
|
|
|
}
|
|
|
|
|
|
currYearBalance := yearValueConfig - yearTotalMap[currDayTime.Year()]
|
|
|
+
|
|
|
|
|
|
var sum, avg float64
|
|
|
for _, year := range yearList {
|
|
|
yearTotal := yearTotalMap[year]
|
|
|
+
|
|
|
tmpDate := time.Date(year, currDayTime.Month(), currDayTime.Day(), 0, 0, 0, 0, currDayTime.Location())
|
|
|
+
|
|
|
dateTotal, ok := dateTotalMap[tmpDate]
|
|
|
+
|
|
|
if ok {
|
|
|
sum = sum + (yearTotal - dateTotal)
|
|
|
} else {
|
|
@@ -1727,6 +1738,7 @@ func GetChartPredictEdbInfoDataListByRuleAnnualValueInversion(edbInfoId int, con
|
|
|
for tmpDateTime := indexDateMap[tmpIndex+1]; tmpDateTime.Year() == year; tmpDateTime = indexDateMap[tmpIndex+1] {
|
|
|
dateTotal, ok = dateTotalMap[tmpDateTime]
|
|
|
if ok {
|
|
|
+
|
|
|
sum = sum + (yearTotal - dateTotal)
|
|
|
break
|
|
|
}
|
|
@@ -1735,9 +1747,13 @@ func GetChartPredictEdbInfoDataListByRuleAnnualValueInversion(edbInfoId int, con
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
avg = sum / float64(len(yearList))
|
|
|
+
|
|
|
|
|
|
tbVal := decimal.NewFromFloat(currYearBalance).Div(decimal.NewFromFloat(avg))
|
|
|
+
|
|
|
+ fmt.Printf("同比增速%.4f\n", tbVal11)*/
|
|
|
|
|
|
for k, currentDate := range dayList {
|
|
|
|