作者 yangfu

个人首页统计修改

... ... @@ -56,7 +56,7 @@ func (srv PersonStatisticsService) IndexStatistics(cmd *command.IndexStatisticsC
beginTime := time.Date(year, month, 1, 0, 0, 0, 0, time.Local)
endTime := beginTime.AddDate(0, 1, 0)
// 2.本月分红统计 - 个人
dividendStatisticsResult, err := gateway.CooperationStatistics(allied_creation_cooperation.CreditAccountStatistics, map[string]interface{}{
unPaidResult, err := gateway.CooperationStatistics(allied_creation_cooperation.CreditAccountStatistics, map[string]interface{}{
"userBaseId": cmd.Operator.UserBaseId,
"beginTime": beginTime,
"endTime": endTime,
... ... @@ -71,14 +71,24 @@ func (srv PersonStatisticsService) IndexStatistics(cmd *command.IndexStatisticsC
Paid float64 `json:"paid"`
Unpaid float64 `json:"unpaid"`
}
var annualDividend = &AnnualDividend{}
if err := json.UnmarshalFromString(json.MarshalToString(dividendStatisticsResult), annualDividend); err != nil {
var annualUnPaidDividend = &AnnualDividend{}
if err := json.UnmarshalFromString(json.MarshalToString(unPaidResult), annualUnPaidDividend); err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
// 2.本月分红统计 - 个人
paymentResult, err := gateway.CooperationStatistics(allied_creation_cooperation.CreditAccountStatistics, map[string]interface{}{
"userBaseId": cmd.Operator.UserBaseId,
"paymentBeginTime": beginTime,
"paymentEndTime": endTime,
})
var annualPaymentDividend = &AnnualDividend{}
if err := json.UnmarshalFromString(json.MarshalToString(paymentResult), annualPaymentDividend); err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
dividendStatistics := map[string]interface{}{
"dividendAmount": annualDividend.Paid + annualDividend.Unpaid, // 分红金额 annualDividend.Total
"paidAmount": annualDividend.Paid, // 已支付
"unPaidAmount": annualDividend.Unpaid, // 未支付
"dividendAmount": annualPaymentDividend.Paid + annualUnPaidDividend.Unpaid, // 分红金额 annualDividend.Total
"paidAmount": annualPaymentDividend.Paid, // 已支付
"unPaidAmount": annualUnPaidDividend.Unpaid, // 未支付
}
return map[string]interface{}{
... ...