|
@@ -887,13 +887,16 @@ func getCensusIncomeListV2(ch chan models.CensusIncomeChartResp, req fms.IncomeL
|
|
|
monthNum = int(latestTime.Month() - 1)
|
|
|
}
|
|
|
|
|
|
- if yearNum < 0 {
|
|
|
- yearNum = -yearNum
|
|
|
- }
|
|
|
- if monthNum < 0 {
|
|
|
- monthNum = -monthNum
|
|
|
- }
|
|
|
+ //if yearNum < 0 {
|
|
|
+ // yearNum = -yearNum
|
|
|
+ //}
|
|
|
+ //if monthNum < 0 {
|
|
|
+ // monthNum = -monthNum
|
|
|
+ //}
|
|
|
numMonth := yearNum*12 + monthNum //共存在多少个月
|
|
|
+ if numMonth < 0 {
|
|
|
+ numMonth = -numMonth
|
|
|
+ }
|
|
|
//if req.ListParam == "1" {
|
|
|
// numMonth = numMonth / 3
|
|
|
//} else if req.ListParam == "2" {
|
|
@@ -923,10 +926,6 @@ 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")
|
|
@@ -941,8 +940,8 @@ func getCensusIncomeListV2(ch chan models.CensusIncomeChartResp, req fms.IncomeL
|
|
|
endDateTime = reqStartDate.AddDate(0, i+1, -1)
|
|
|
prevEndDateTime = reqStartDate.AddDate(-1, i+1, -1)
|
|
|
if reqEndDate.After(latestTime) {
|
|
|
- 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)
|
|
|
}
|
|
|
} else {
|
|
|
endDateTime = latestTime.AddDate(0, i-numMonth+1, -1)
|