浏览代码

Merge branch 'bugfix_0507'

zwxi 11 月之前
父节点
当前提交
bae80679f9
共有 1 个文件被更改,包括 12 次插入1 次删除
  1. 12 1
      controller/census/invoice_payment.go

+ 12 - 1
controller/census/invoice_payment.go

@@ -834,6 +834,17 @@ func getCensusIncomeListV2(ch chan models.CensusIncomeChartResp, req fms.IncomeL
 	}
 
 	latestTime = latestTime.AddDate(0, 0, -latestTime.Day()+1)
+	addMonth := 0
+	if req.ListParam == "1" {
+		addMonth = int(3 - latestTime.Month() % 3)
+	}
+	if req.ListParam == "2" {
+		addMonth = int(6 - latestTime.Month() % 6)
+	}
+	if req.ListParam == "3" {
+		addMonth = int(12 - latestTime.Month() % 12)
+	}
+	latestTime = latestTime.AddDate(0,addMonth,0)
 
 	var dateSlice []string
 	var totalMoneySlice, prevTotalMoneySlice []float64
@@ -1316,7 +1327,7 @@ func getCensusIncomeListV2(ch chan models.CensusIncomeChartResp, req fms.IncomeL
 	}
 
 	incomeChart.Title = "开票到款统计图"
-	incomeChart.Date = dateSlice
+	incomeChart.Date = dateSlice[:len(totalMoneySlice)]
 	incomeChart.TotalMoney = totalMoneySlice
 	incomeChart.PrevTotalMoney = prevTotalMoneySlice
 	incomeChart.Yoy = yoySlice