作者 yangfu

支付直方图统计

... ... @@ -362,30 +362,32 @@ func (ptr *CooperationStatisticsService) PaymentHistoryHistogramStatistics(query
queryOptions = tool_funs.SimpleStructToMap(&request)
var dividends = &CreditAccountStatisticsResponse{}
var beginTime, endTime time.Time
year, month := time.Now().Year(), time.Now().Month()
var beginTime = time.Date(year, month, 1, 0, 0, 0, 0, time.Local)
var endTime time.Time
var increaseDay = 5
var monthEnd = utils.GetFirstDateOfMonth(time.Now()).Add(-time.Second)
var monthEnd = time.Date(year, month+1, 1, 0, 0, 0, 0, time.Local).Add(-time.Second)
var xAxisData []string
var values []float64
for {
if beginTime.AddDate(0, 0, increaseDay).After(monthEnd) {
endTime = monthEnd
}
if endTime.After(monthEnd) {
break
} else {
endTime = beginTime.AddDate(0, 0, increaseDay).Add(-time.Second)
}
xAxisData = append(xAxisData, endTime.Format("01-02"))
queryOptions["beginTime"] = beginTime
queryOptions["endTime"] = endTime
queryOptions["endTime"] = beginTime.AddDate(0, 0, increaseDay)
if err := creditAccountDao.DividendsStatistics(queryOptions, dividends); err != nil {
return nil, err
}
dividends.Accounting = dividends.Total - dividends.Accounted
values = append(values, dividends.Paid)
beginTime = endTime.AddDate(0, 0, increaseDay)
endTime = endTime.AddDate(0, 0, increaseDay)
beginTime = endTime
if endTime == monthEnd {
break
}
}
return map[string]interface{}{
"xAxis": map[string]interface{}{
... ...