作者 yangfu

个人首页统计修改

@@ -56,7 +56,7 @@ func (srv PersonStatisticsService) IndexStatistics(cmd *command.IndexStatisticsC @@ -56,7 +56,7 @@ func (srv PersonStatisticsService) IndexStatistics(cmd *command.IndexStatisticsC
56 beginTime := time.Date(year, month, 1, 0, 0, 0, 0, time.Local) 56 beginTime := time.Date(year, month, 1, 0, 0, 0, 0, time.Local)
57 endTime := beginTime.AddDate(0, 1, 0) 57 endTime := beginTime.AddDate(0, 1, 0)
58 // 2.本月分红统计 - 个人 58 // 2.本月分红统计 - 个人
59 - dividendStatisticsResult, err := gateway.CooperationStatistics(allied_creation_cooperation.CreditAccountStatistics, map[string]interface{}{ 59 + unPaidResult, err := gateway.CooperationStatistics(allied_creation_cooperation.CreditAccountStatistics, map[string]interface{}{
60 "userBaseId": cmd.Operator.UserBaseId, 60 "userBaseId": cmd.Operator.UserBaseId,
61 "beginTime": beginTime, 61 "beginTime": beginTime,
62 "endTime": endTime, 62 "endTime": endTime,
@@ -71,14 +71,24 @@ func (srv PersonStatisticsService) IndexStatistics(cmd *command.IndexStatisticsC @@ -71,14 +71,24 @@ func (srv PersonStatisticsService) IndexStatistics(cmd *command.IndexStatisticsC
71 Paid float64 `json:"paid"` 71 Paid float64 `json:"paid"`
72 Unpaid float64 `json:"unpaid"` 72 Unpaid float64 `json:"unpaid"`
73 } 73 }
74 - var annualDividend = &AnnualDividend{}  
75 - if err := json.UnmarshalFromString(json.MarshalToString(dividendStatisticsResult), annualDividend); err != nil { 74 + var annualUnPaidDividend = &AnnualDividend{}
  75 + if err := json.UnmarshalFromString(json.MarshalToString(unPaidResult), annualUnPaidDividend); err != nil {
  76 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  77 + }
  78 + // 2.本月分红统计 - 个人
  79 + paymentResult, err := gateway.CooperationStatistics(allied_creation_cooperation.CreditAccountStatistics, map[string]interface{}{
  80 + "userBaseId": cmd.Operator.UserBaseId,
  81 + "paymentBeginTime": beginTime,
  82 + "paymentEndTime": endTime,
  83 + })
  84 + var annualPaymentDividend = &AnnualDividend{}
  85 + if err := json.UnmarshalFromString(json.MarshalToString(paymentResult), annualPaymentDividend); err != nil {
76 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 86 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
77 } 87 }
78 dividendStatistics := map[string]interface{}{ 88 dividendStatistics := map[string]interface{}{
79 - "dividendAmount": annualDividend.Paid + annualDividend.Unpaid, // 分红金额 annualDividend.Total  
80 - "paidAmount": annualDividend.Paid, // 已支付  
81 - "unPaidAmount": annualDividend.Unpaid, // 未支付 89 + "dividendAmount": annualPaymentDividend.Paid + annualUnPaidDividend.Unpaid, // 分红金额 annualDividend.Total
  90 + "paidAmount": annualPaymentDividend.Paid, // 已支付
  91 + "unPaidAmount": annualUnPaidDividend.Unpaid, // 未支付
82 } 92 }
83 93
84 return map[string]interface{}{ 94 return map[string]interface{}{