zwxi 1 年之前
父节点
当前提交
903e382625
共有 1 个文件被更改,包括 6 次插入2 次删除
  1. 6 2
      controller/census/invoice_payment.go

+ 6 - 2
controller/census/invoice_payment.go

@@ -1163,6 +1163,10 @@ func getCensusIncomeListV2(ch chan models.CensusIncomeChartResp, req fms.IncomeL
 		if req.StartDate != "" && req.EndDate != "" {
 			startDate = reqStartDate.AddDate(0, i, 0).Format("2006-01")
 			prevStartDate = reqStartDate.AddDate(-1, i, 0).Format("2006-01")
+			if reqEndDate.After(latestTime) {
+				endDateTime = latestTime.AddDate(0, i-numMonth+1, -1)
+				prevEndDateTime = latestTime.AddDate(-1, i-numMonth+1, -1)
+			}
 		} else {
 			startDate = latestTime.AddDate(0, i-numMonth, 0).Format("2006-01")
 			prevStartDate = latestTime.AddDate(-1, i-numMonth, 0).Format("2006-01")
@@ -1181,8 +1185,8 @@ func getCensusIncomeListV2(ch chan models.CensusIncomeChartResp, req fms.IncomeL
 				prevEndDateTime = latestTime.AddDate(-1, i+1, -1)
 			}
 		} else {
-			endDateTime = latestTime.AddDate(0, i+1, -1)
-			prevEndDateTime = latestTime.AddDate(-1, i+1, -1)
+			endDateTime = latestTime.AddDate(0, i-numMonth+1, -1)
+			prevEndDateTime = latestTime.AddDate(-1, i-numMonth+1, -1)
 		}
 		endDate = endDateTime.Format(utils.FormatDate)
 		prevEndDate = prevEndDateTime.Format(utils.FormatDate)