作者 yangfu

账期结算单统计

@@ -6,7 +6,7 @@ import ( @@ -6,7 +6,7 @@ import (
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 ) 7 )
8 8
9 -// 企业端分红服务 【80%】 9 +// 企业端分红服务
10 type CompanyDividendsService struct { 10 type CompanyDividendsService struct {
11 } 11 }
12 12
@@ -6,7 +6,7 @@ import ( @@ -6,7 +6,7 @@ import (
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 ) 7 )
8 8
9 -// 企业端分红服务 【50%】 9 +// 企业端分红服务
10 type PersonDividendsService struct { 10 type PersonDividendsService struct {
11 } 11 }
12 12
@@ -9,7 +9,7 @@ import ( @@ -9,7 +9,7 @@ import (
9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation" 9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
10 ) 10 )
11 11
12 -// CooperationProjectService 共创项目服务 【100%】 12 +// CooperationProjectService 共创项目服务
13 type CooperationProjectService struct { 13 type CooperationProjectService struct {
14 } 14 }
15 15
@@ -8,7 +8,7 @@ import ( @@ -8,7 +8,7 @@ import (
8 "time" 8 "time"
9 ) 9 )
10 10
11 -// CompanyCreditAccountService 企业端账期结算 【50%】 11 +// CompanyCreditAccountService 企业端账期结算
12 type CompanyCreditAccountService struct { 12 type CompanyCreditAccountService struct {
13 } 13 }
14 14
@@ -138,23 +138,23 @@ func (srv CompanyCreditAccountService) PaymentHistoryStatistics(cmd *command.Cre @@ -138,23 +138,23 @@ func (srv CompanyCreditAccountService) PaymentHistoryStatistics(cmd *command.Cre
138 138
139 // PaymentHistoryHistogramStatistics 支付历史统计-直方图 139 // PaymentHistoryHistogramStatistics 支付历史统计-直方图
140 func (srv CompanyCreditAccountService) PaymentHistoryHistogramStatistics(cmd *command.CreditAccountPaySearchCommand) (interface{}, error) { 140 func (srv CompanyCreditAccountService) PaymentHistoryHistogramStatistics(cmd *command.CreditAccountPaySearchCommand) (interface{}, error) {
141 - //gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(  
142 - // cmd.Operator)  
143 - //resultMenu, err := gateway.CreditAccountsSearch(allied_creation_cooperation.ReqCreditAccountsSearch{  
144 - // PageNumber: cmd.PageNumber,  
145 - // PageSize: cmd.PageSize,  
146 - // PaymentStatus: 2,  
147 - //})  
148 - //if err != nil {  
149 - // return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())  
150 - //}  
151 - return map[string]interface{}{  
152 - "xAxis": map[string]interface{}{  
153 - "data": []string{"7-5", "7-15", "7-25"},  
154 - },  
155 - "yAxis": struct{}{},  
156 - "source": map[string]interface{}{  
157 - "value": []float64{60, 80, 90},  
158 - },  
159 - }, nil 141 + //return map[string]interface{}{
  142 + // "xAxis": map[string]interface{}{
  143 + // "data": []string{"7-5", "7-15", "7-25"},
  144 + // },
  145 + // "yAxis": struct{}{},
  146 + // "source": map[string]interface{}{
  147 + // "value": []float64{60, 80, 90},
  148 + // },
  149 + //}, nil
  150 + gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
  151 + cmd.Operator)
  152 + paymentHistoryHistogramStatistics, err := gateway.CreditAccountStatistics(allied_creation_cooperation.PaymentHistoryHistogramStatistics, map[string]interface{}{
  153 + "orgId": cmd.Operator.OrgId,
  154 + })
  155 + if err != nil {
  156 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  157 + }
  158 +
  159 + return paymentHistoryHistogramStatistics, nil
160 } 160 }
@@ -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 }
@@ -33,9 +33,13 @@ const ( @@ -33,9 +33,13 @@ const (
33 CooperationCompanyStatistics = "CooperationCompanyStatistics" 33 CooperationCompanyStatistics = "CooperationCompanyStatistics"
34 // 个人 - 用户合约统计 34 // 个人 - 用户合约统计
35 PersonCooperationContractStatistics = "PersonCooperationContractStatistics" 35 PersonCooperationContractStatistics = "PersonCooperationContractStatistics"
  36 + // 个人 - 企业支付统计
  37 + PersonCompanyPaymentHistoryStatistics = "PersonCompanyPaymentHistoryStatistics"
36 38
37 // 账期结算单统计 39 // 账期结算单统计
38 CreditAccountStatistics = "CreditAccountStatistics" 40 CreditAccountStatistics = "CreditAccountStatistics"
  41 + // 公司/个人 - 支付历史统计直方图
  42 + PaymentHistoryHistogramStatistics = "PaymentHistoryHistogramStatistics"
39 ) 43 )
40 44
41 // CooperationStatistics 共创统计 45 // CooperationStatistics 共创统计