|
@@ -1492,14 +1492,14 @@ func getCensusIncomeListV2(ch chan models.CensusIncomeChartResp, req fms.IncomeL
|
|
|
// 移动平均值:若是10月份,计算8月,9月,10月,这三个月的收入金额平均值
|
|
|
if req.ListParam == "0" {
|
|
|
for i := range prevTotalMoneySlice {
|
|
|
+ totalMoneySlice[i], _ = strconv.ParseFloat(fmt.Sprintf("%.2f", totalMoneySlice[i] - prevTotalMoneySlice[i]), 64)
|
|
|
+ var yoy float64
|
|
|
+ var yoyStr string
|
|
|
if i > 2 {
|
|
|
// 前俩月没有
|
|
|
- var yoy float64
|
|
|
- var yoyStr string
|
|
|
//fmt.Println("1:", prevTotalMoneySlice[i])
|
|
|
//fmt.Println("2:", totalMoneySlice[i])
|
|
|
//fmt.Println("3:", totalMoneySlice[i]-prevTotalMoneySlice[i])
|
|
|
- totalMoneySlice[i], _ = strconv.ParseFloat(fmt.Sprintf("%.2f", totalMoneySlice[i] - prevTotalMoneySlice[i]), 64)
|
|
|
//if prevTotalMoneySlice[i] != 0 && totalMoneySlice[i] != 0 {
|
|
|
// yoy = (totalMoneySlice[i] - prevTotalMoneySlice[i]) / prevTotalMoneySlice[i]
|
|
|
// yoyStr = fmt.Sprintf("%.4f", yoy)
|
|
@@ -1514,6 +1514,8 @@ func getCensusIncomeListV2(ch chan models.CensusIncomeChartResp, req fms.IncomeL
|
|
|
yoyStr = fmt.Sprintf("%.4f", yoy)
|
|
|
yoySlice = append(yoySlice, yoyStr)
|
|
|
}
|
|
|
+ yoyStr = fmt.Sprintf("%.4f", yoy)
|
|
|
+ yoySlice = append(yoySlice, yoyStr)
|
|
|
}
|
|
|
}
|
|
|
}
|