|
@@ -175,7 +175,25 @@ func (srv CompanyCreditAccountService) CreditAccountPaySearch(cmd *command.Credi |
|
@@ -175,7 +175,25 @@ func (srv CompanyCreditAccountService) CreditAccountPaySearch(cmd *command.Credi |
175
|
func (srv CompanyCreditAccountService) PaymentHistoryStatistics(cmd *command.CreditAccountPaySearchCommand) (interface{}, error) {
|
175
|
func (srv CompanyCreditAccountService) PaymentHistoryStatistics(cmd *command.CreditAccountPaySearchCommand) (interface{}, error) {
|
176
|
gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
|
176
|
gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
|
177
|
cmd.Operator)
|
177
|
cmd.Operator)
|
|
|
178
|
+
|
|
|
179
|
+ var response = struct {
|
|
|
180
|
+ rankItems interface{} `json:"rankItems"`
|
|
|
181
|
+ TotalPaymentAmount interface{} `json:"totalPaymentAmount"`
|
|
|
182
|
+ }{}
|
|
|
183
|
+ cooperationContractNumbers, err := gateway.RelevantCooperationContractNumbers(allied_creation_cooperation.RelevantCooperationContractNumbers, map[string]interface{}{
|
|
|
184
|
+ "companyId": cmd.Operator.CompanyId,
|
|
|
185
|
+ "orgId": cmd.Operator.OrgId,
|
|
|
186
|
+ "userId": cmd.Operator.UserId,
|
|
|
187
|
+ })
|
|
|
188
|
+ if err != nil {
|
|
|
189
|
+ return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
190
|
+ }
|
|
|
191
|
+ if len(cooperationContractNumbers) == 0 {
|
|
|
192
|
+ return response, nil
|
|
|
193
|
+ }
|
|
|
194
|
+
|
178
|
queryOptions := map[string]interface{}{
|
195
|
queryOptions := map[string]interface{}{
|
|
|
196
|
+ "userId": cmd.Operator.UserId,
|
179
|
"orgId": cmd.Operator.OrgId,
|
197
|
"orgId": cmd.Operator.OrgId,
|
180
|
"offset": cmd.PageNumber * cmd.PageSize,
|
198
|
"offset": cmd.PageNumber * cmd.PageSize,
|
181
|
"limit": cmd.PageSize,
|
199
|
"limit": cmd.PageSize,
|
|
@@ -192,15 +210,15 @@ func (srv CompanyCreditAccountService) PaymentHistoryStatistics(cmd *command.Cre |
|
@@ -192,15 +210,15 @@ func (srv CompanyCreditAccountService) PaymentHistoryStatistics(cmd *command.Cre |
192
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
210
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
193
|
}
|
211
|
}
|
194
|
|
212
|
|
|
|
213
|
+ queryOptions["cooperationContractNumbers"] = cooperationContractNumbers
|
195
|
creditAccountStatistics, err := gateway.CreditAccountStatistics(allied_creation_cooperation.CreditAccountStatistics, queryOptions)
|
214
|
creditAccountStatistics, err := gateway.CreditAccountStatistics(allied_creation_cooperation.CreditAccountStatistics, queryOptions)
|
196
|
if err != nil {
|
215
|
if err != nil {
|
197
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
216
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
198
|
}
|
217
|
}
|
|
|
218
|
+ response.rankItems = cooperationUsersStatistics
|
|
|
219
|
+ response.TotalPaymentAmount = creditAccountStatistics.Paid
|
199
|
|
220
|
|
200
|
- return map[string]interface{}{
|
|
|
201
|
- "rankItems": cooperationUsersStatistics,
|
|
|
202
|
- "totalPaymentAmount": creditAccountStatistics.Paid,
|
|
|
203
|
- }, nil
|
221
|
+ return response, nil
|
204
|
}
|
222
|
}
|
205
|
|
223
|
|
206
|
// PaymentHistoryHistogramStatistics 支付历史统计-直方图
|
224
|
// PaymentHistoryHistogramStatistics 支付历史统计-直方图
|
|
@@ -208,7 +226,10 @@ func (srv CompanyCreditAccountService) PaymentHistoryHistogramStatistics(cmd *co |
|
@@ -208,7 +226,10 @@ func (srv CompanyCreditAccountService) PaymentHistoryHistogramStatistics(cmd *co |
208
|
gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
|
226
|
gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
|
209
|
cmd.Operator)
|
227
|
cmd.Operator)
|
210
|
paymentHistoryHistogramStatistics, err := gateway.CooperationStatistics(allied_creation_cooperation.PaymentHistoryHistogramStatistics, map[string]interface{}{
|
228
|
paymentHistoryHistogramStatistics, err := gateway.CooperationStatistics(allied_creation_cooperation.PaymentHistoryHistogramStatistics, map[string]interface{}{
|
211
|
- "orgId": cmd.Operator.OrgId,
|
229
|
+ "orgId": cmd.Operator.OrgId,
|
|
|
230
|
+ "userId": cmd.Operator.UserId,
|
|
|
231
|
+ "beginTime": time.Unix(cmd.BeginTime/1000, 0),
|
|
|
232
|
+ "endTime": time.Unix(cmd.EndTime/1000, 0),
|
212
|
})
|
233
|
})
|
213
|
if err != nil {
|
234
|
if err != nil {
|
214
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
235
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|