|
@@ -4,9 +4,10 @@ import ( |
|
@@ -4,9 +4,10 @@ import ( |
|
4
|
"github.com/linmadan/egglib-go/core/application"
|
4
|
"github.com/linmadan/egglib-go/core/application"
|
|
5
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/cooperation/command"
|
5
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/cooperation/command"
|
|
6
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
|
6
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
|
|
|
|
7
|
+ "time"
|
|
7
|
)
|
8
|
)
|
|
8
|
|
9
|
|
|
9
|
-// PersonCreditAccountService 企业端账期结算 【0%】
|
10
|
+// PersonCreditAccountService 企业端账期结算
|
|
10
|
type PersonCreditAccountService struct {
|
11
|
type PersonCreditAccountService struct {
|
|
11
|
}
|
12
|
}
|
|
12
|
|
13
|
|
|
@@ -33,41 +34,56 @@ func (srv PersonCreditAccountService) CreditAccountPaySearch(cmd *command.Credit |
|
@@ -33,41 +34,56 @@ func (srv PersonCreditAccountService) CreditAccountPaySearch(cmd *command.Credit |
|
33
|
|
34
|
|
|
34
|
// PaymentHistoryStatistics 支付历史统计
|
35
|
// PaymentHistoryStatistics 支付历史统计
|
|
35
|
func (srv PersonCreditAccountService) PaymentHistoryStatistics(cmd *command.CreditAccountPaySearchCommand) (interface{}, error) {
|
36
|
func (srv PersonCreditAccountService) PaymentHistoryStatistics(cmd *command.CreditAccountPaySearchCommand) (interface{}, error) {
|
|
36
|
- //gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
|
|
|
|
37
|
- // cmd.Operator)
|
|
|
|
38
|
- //resultMenu, err := gateway.CreditAccountsSearch(allied_creation_cooperation.ReqCreditAccountsSearch{
|
|
|
|
39
|
- // PageNumber: cmd.PageNumber,
|
|
|
|
40
|
- // PageSize: cmd.PageSize,
|
|
|
|
41
|
- // PaymentStatus: 2,
|
|
|
|
42
|
- //})
|
|
|
|
43
|
- //if err != nil {
|
|
|
|
44
|
- // return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
|
45
|
- //}
|
37
|
+ gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
|
|
|
|
38
|
+ cmd.Operator)
|
|
|
|
39
|
+ queryOptions := map[string]interface{}{
|
|
|
|
40
|
+ "orgId": cmd.Operator.OrgId,
|
|
|
|
41
|
+ "userBaseId": cmd.Operator.UserBaseId,
|
|
|
|
42
|
+ "offset": cmd.PageNumber * cmd.PageSize,
|
|
|
|
43
|
+ "limit": cmd.PageSize,
|
|
|
|
44
|
+ "sortByActuallyPaidAmount": 2,
|
|
|
|
45
|
+ }
|
|
|
|
46
|
+ if cmd.BeginTime > 0 {
|
|
|
|
47
|
+ queryOptions["beginTime"] = time.Unix(cmd.BeginTime/1000, 0)
|
|
|
|
48
|
+ }
|
|
|
|
49
|
+ if cmd.EndTime > 0 {
|
|
|
|
50
|
+ queryOptions["endTime"] = time.Unix(cmd.EndTime/1000, 0)
|
|
|
|
51
|
+ }
|
|
|
|
52
|
+ cooperationUsersStatistics, err := gateway.CooperationStatistics(allied_creation_cooperation.PersonCompanyPaymentHistoryStatistics, queryOptions)
|
|
|
|
53
|
+ if err != nil {
|
|
|
|
54
|
+ return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
|
55
|
+ }
|
|
|
|
56
|
+
|
|
|
|
57
|
+ creditAccountStatistics, err := gateway.CreditAccountStatistics(allied_creation_cooperation.CreditAccountStatistics, queryOptions)
|
|
|
|
58
|
+ if err != nil {
|
|
|
|
59
|
+ return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
|
60
|
+ }
|
|
|
|
61
|
+
|
|
46
|
return map[string]interface{}{
|
62
|
return map[string]interface{}{
|
|
47
|
- "rankItems": []struct{}{},
|
|
|
|
48
|
- "totalPaymentAmount": 6000,
|
63
|
+ "rankItems": cooperationUsersStatistics,
|
|
|
|
64
|
+ "totalPaymentAmount": creditAccountStatistics.Paid,
|
|
49
|
}, nil
|
65
|
}, nil
|
|
50
|
}
|
66
|
}
|
|
51
|
|
67
|
|
|
52
|
// PaymentHistoryHistogramStatistics 支付历史统计-直方图
|
68
|
// PaymentHistoryHistogramStatistics 支付历史统计-直方图
|
|
53
|
func (srv PersonCreditAccountService) PaymentHistoryHistogramStatistics(cmd *command.CreditAccountPaySearchCommand) (interface{}, error) {
|
69
|
func (srv PersonCreditAccountService) PaymentHistoryHistogramStatistics(cmd *command.CreditAccountPaySearchCommand) (interface{}, error) {
|
|
54
|
- //gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
|
|
|
|
55
|
- // cmd.Operator)
|
|
|
|
56
|
- //resultMenu, err := gateway.CreditAccountsSearch(allied_creation_cooperation.ReqCreditAccountsSearch{
|
|
|
|
57
|
- // PageNumber: cmd.PageNumber,
|
|
|
|
58
|
- // PageSize: cmd.PageSize,
|
|
|
|
59
|
- // PaymentStatus: 2,
|
|
|
|
60
|
- //})
|
|
|
|
61
|
- //if err != nil {
|
|
|
|
62
|
- // return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
|
63
|
- //}
|
|
|
|
64
|
- return map[string]interface{}{
|
|
|
|
65
|
- "xAxis": map[string]interface{}{
|
|
|
|
66
|
- "data": []string{"7-5", "7-15", "7-25"},
|
|
|
|
67
|
- },
|
|
|
|
68
|
- "yAxis": struct{}{},
|
|
|
|
69
|
- "source": map[string]interface{}{
|
|
|
|
70
|
- "value": []float64{60, 80, 90},
|
|
|
|
71
|
- },
|
|
|
|
72
|
- }, nil
|
70
|
+ //return map[string]interface{}{
|
|
|
|
71
|
+ // "xAxis": map[string]interface{}{
|
|
|
|
72
|
+ // "data": []string{"7-5", "7-15", "7-25"},
|
|
|
|
73
|
+ // },
|
|
|
|
74
|
+ // "yAxis": struct{}{},
|
|
|
|
75
|
+ // "source": map[string]interface{}{
|
|
|
|
76
|
+ // "value": []float64{60, 80, 90},
|
|
|
|
77
|
+ // },
|
|
|
|
78
|
+ //}, nil
|
|
|
|
79
|
+ gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
|
|
|
|
80
|
+ cmd.Operator)
|
|
|
|
81
|
+ paymentHistoryHistogramStatistics, err := gateway.CreditAccountStatistics(allied_creation_cooperation.PaymentHistoryHistogramStatistics, map[string]interface{}{
|
|
|
|
82
|
+ "userBaseId": cmd.Operator.UserBaseId,
|
|
|
|
83
|
+ })
|
|
|
|
84
|
+ if err != nil {
|
|
|
|
85
|
+ return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
|
86
|
+ }
|
|
|
|
87
|
+
|
|
|
|
88
|
+ return paymentHistoryHistogramStatistics, nil
|
|
73
|
} |
89
|
} |