正在显示
7 个修改的文件
包含
123 行增加
和
18 行删除
@@ -17,9 +17,9 @@ type CreditAccountPaySearchCommand struct { | @@ -17,9 +17,9 @@ type CreditAccountPaySearchCommand struct { | ||
17 | // 账期结算支付状态,1待支付,2已支付 0全部 | 17 | // 账期结算支付状态,1待支付,2已支付 0全部 |
18 | PaymentStatus int32 `json:"paymentStatus"` | 18 | PaymentStatus int32 `json:"paymentStatus"` |
19 | // 开始时间 | 19 | // 开始时间 |
20 | - BeginTime int `json:"beginTime"` | 20 | + BeginTime int64 `json:"beginTime"` |
21 | // 结算时间 | 21 | // 结算时间 |
22 | - EndTime int `json:"beginTime"` | 22 | + EndTime int64 `json:"beginTime"` |
23 | } | 23 | } |
24 | 24 | ||
25 | func (cmd *CreditAccountPaySearchCommand) Valid(validation *validation.Validation) { | 25 | func (cmd *CreditAccountPaySearchCommand) Valid(validation *validation.Validation) { |
@@ -10,6 +10,8 @@ import ( | @@ -10,6 +10,8 @@ import ( | ||
10 | type CooperationPersonStatisticsCommand struct { | 10 | type CooperationPersonStatisticsCommand struct { |
11 | //操作人 | 11 | //操作人 |
12 | Operator domain.Operator `json:"-"` | 12 | Operator domain.Operator `json:"-"` |
13 | + // 用户ID | ||
14 | + UserId int `json:"userId"` | ||
13 | } | 15 | } |
14 | 16 | ||
15 | func (cmd *CooperationPersonStatisticsCommand) Valid(validation *validation.Validation) { | 17 | func (cmd *CooperationPersonStatisticsCommand) Valid(validation *validation.Validation) { |
@@ -5,6 +5,7 @@ import ( | @@ -5,6 +5,7 @@ import ( | ||
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/application/mobile/cooperation/dto" | 6 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/cooperation/dto" |
7 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation" | 7 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation" |
8 | + "time" | ||
8 | ) | 9 | ) |
9 | 10 | ||
10 | // CompanyCreditAccountService 企业端账期结算 【50%】 | 11 | // CompanyCreditAccountService 企业端账期结算 【50%】 |
@@ -105,19 +106,33 @@ func (srv CompanyCreditAccountService) CreditAccountPaySearch(cmd *command.Credi | @@ -105,19 +106,33 @@ func (srv CompanyCreditAccountService) CreditAccountPaySearch(cmd *command.Credi | ||
105 | 106 | ||
106 | // PaymentHistoryStatistics 支付历史统计 | 107 | // PaymentHistoryStatistics 支付历史统计 |
107 | func (srv CompanyCreditAccountService) PaymentHistoryStatistics(cmd *command.CreditAccountPaySearchCommand) (interface{}, error) { | 108 | func (srv CompanyCreditAccountService) PaymentHistoryStatistics(cmd *command.CreditAccountPaySearchCommand) (interface{}, error) { |
108 | - //gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( | ||
109 | - // cmd.Operator) | ||
110 | - //resultMenu, err := gateway.CreditAccountsSearch(allied_creation_cooperation.ReqCreditAccountsSearch{ | ||
111 | - // PageNumber: cmd.PageNumber, | ||
112 | - // PageSize: cmd.PageSize, | ||
113 | - // PaymentStatus: 2, | ||
114 | - //}) | ||
115 | - //if err != nil { | ||
116 | - // return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
117 | - //} | 109 | + gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( |
110 | + cmd.Operator) | ||
111 | + queryOptions := map[string]interface{}{ | ||
112 | + "orgId": cmd.Operator.OrgId, | ||
113 | + "offset": cmd.PageNumber * cmd.PageSize, | ||
114 | + "limit": cmd.PageSize, | ||
115 | + "sortByActuallyPaidAmount": 2, | ||
116 | + } | ||
117 | + if cmd.BeginTime > 0 { | ||
118 | + queryOptions["beginTime"] = time.Unix(cmd.BeginTime/1000, 0) | ||
119 | + } | ||
120 | + if cmd.EndTime > 0 { | ||
121 | + queryOptions["endTime"] = time.Unix(cmd.EndTime/1000, 0) | ||
122 | + } | ||
123 | + cooperationUsersStatistics, err := gateway.CooperationStatistics(allied_creation_cooperation.CompanyCooperationUsersStatistics, queryOptions) | ||
124 | + if err != nil { | ||
125 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
126 | + } | ||
127 | + | ||
128 | + creditAccountStatistics, err := gateway.CreditAccountStatistics(allied_creation_cooperation.CreditAccountStatistics, queryOptions) | ||
129 | + if err != nil { | ||
130 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
131 | + } | ||
132 | + | ||
118 | return map[string]interface{}{ | 133 | return map[string]interface{}{ |
119 | - "rankItems": []struct{}{}, | ||
120 | - "totalPaymentAmount": 6000, | 134 | + "rankItems": cooperationUsersStatistics, |
135 | + "totalPaymentAmount": creditAccountStatistics.Paid, | ||
121 | }, nil | 136 | }, nil |
122 | } | 137 | } |
123 | 138 |
@@ -2,13 +2,14 @@ package service | @@ -2,13 +2,14 @@ package service | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "github.com/linmadan/egglib-go/core/application" | 4 | "github.com/linmadan/egglib-go/core/application" |
5 | + "github.com/linmadan/egglib-go/utils/json" | ||
5 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/cooperation/command" | 6 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/cooperation/command" |
6 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | 7 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" |
7 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation" | 8 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation" |
8 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user" | 9 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user" |
9 | ) | 10 | ) |
10 | 11 | ||
11 | -// 企业端统计 【25%】 | 12 | +// 企业端统计 |
12 | type CompanyStatisticsService struct { | 13 | type CompanyStatisticsService struct { |
13 | } | 14 | } |
14 | 15 | ||
@@ -142,7 +143,44 @@ func (srv CompanyStatisticsService) CooperationDividendsStatistics(cmd *command. | @@ -142,7 +143,44 @@ func (srv CompanyStatisticsService) CooperationDividendsStatistics(cmd *command. | ||
142 | return 0, cooperationUsersStatistics, nil | 143 | return 0, cooperationUsersStatistics, nil |
143 | } | 144 | } |
144 | 145 | ||
145 | -// CooperationPersonStatistics TODO:共创人员统计(共创人员明细) | ||
146 | -func (srv CompanyStatisticsService) CooperationPersonStatistics(userMenusCommand *command.CooperationPersonStatisticsCommand) (interface{}, error) { | ||
147 | - return map[string]interface{}{}, nil | 146 | +// CooperationPersonStatistics 共创人明细员统计(共创人员明细) |
147 | +func (srv CompanyStatisticsService) CooperationPersonStatistics(cmd *command.CooperationPersonStatisticsCommand) (interface{}, error) { | ||
148 | + gatewayUser := allied_creation_user.NewHttplibAlliedCreationUser( | ||
149 | + cmd.Operator) | ||
150 | + user, err := gatewayUser.UserGet(allied_creation_user.ReqGetUser{ | ||
151 | + UserId: cmd.UserId, | ||
152 | + }) | ||
153 | + if err != nil { | ||
154 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
155 | + } | ||
156 | + | ||
157 | + gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( | ||
158 | + cmd.Operator) | ||
159 | + cooperationUserModeStatistics, err := gateway.CooperationStatistics(allied_creation_cooperation.CooperationUserModeStatistics, map[string]interface{}{ | ||
160 | + "userId": cmd.UserId, | ||
161 | + }) | ||
162 | + if err != nil { | ||
163 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
164 | + } | ||
165 | + | ||
166 | + var modeStatistics = struct { | ||
167 | + CooperationTypes interface{} `json:"cooperationTypes"` | ||
168 | + DividendsDetails interface{} `json:"dividendsDetails"` | ||
169 | + OrderDetails interface{} `json:"orderDetails"` | ||
170 | + }{} | ||
171 | + | ||
172 | + if err := json.UnmarshalFromString(json.MarshalToString(cooperationUserModeStatistics), &modeStatistics); err != nil { | ||
173 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
174 | + } | ||
175 | + | ||
176 | + var response = map[string]interface{}{ | ||
177 | + "userName": user.UserInfo.UserName, | ||
178 | + "cooperationTime": user.CreatedAt.Unix() * 1000, | ||
179 | + "cooperationTypes": modeStatistics.CooperationTypes, | ||
180 | + "dividendsDetails": modeStatistics.DividendsDetails, | ||
181 | + "orderDetails": modeStatistics.OrderDetails, | ||
182 | + } | ||
183 | + return map[string]interface{}{ | ||
184 | + "cooperationPersonStatistics": response, | ||
185 | + }, nil | ||
148 | } | 186 | } |
@@ -26,11 +26,16 @@ const ( | @@ -26,11 +26,16 @@ const ( | ||
26 | SearchDividendsEstimates = "SearchDividendsEstimates" | 26 | SearchDividendsEstimates = "SearchDividendsEstimates" |
27 | // 公司 - 共创用户统计 | 27 | // 公司 - 共创用户统计 |
28 | CompanyCooperationUsersStatistics = "CompanyCooperationUsersStatistics" | 28 | CompanyCooperationUsersStatistics = "CompanyCooperationUsersStatistics" |
29 | + //公司 - 共创用户模式统计 | ||
30 | + CooperationUserModeStatistics = "CooperationUserModeStatistics" | ||
29 | 31 | ||
30 | // 个人 - 共创企业统计 | 32 | // 个人 - 共创企业统计 |
31 | CooperationCompanyStatistics = "CooperationCompanyStatistics" | 33 | CooperationCompanyStatistics = "CooperationCompanyStatistics" |
32 | // 个人 - 用户合约统计 | 34 | // 个人 - 用户合约统计 |
33 | PersonCooperationContractStatistics = "PersonCooperationContractStatistics" | 35 | PersonCooperationContractStatistics = "PersonCooperationContractStatistics" |
36 | + | ||
37 | + // 账期结算单统计 | ||
38 | + CreditAccountStatistics = "CreditAccountStatistics" | ||
34 | ) | 39 | ) |
35 | 40 | ||
36 | // CooperationStatistics 共创统计 | 41 | // CooperationStatistics 共创统计 |
@@ -67,3 +72,38 @@ func (gateway HttplibAlliedCreationCooperation) CooperationStatistics(action str | @@ -67,3 +72,38 @@ func (gateway HttplibAlliedCreationCooperation) CooperationStatistics(action str | ||
67 | err = gateway.GetResponseData(result, &data) | 72 | err = gateway.GetResponseData(result, &data) |
68 | return &data, err | 73 | return &data, err |
69 | } | 74 | } |
75 | + | ||
76 | +// CreditAccountStatistics 账期结算单统计 | ||
77 | +func (gateway HttplibAlliedCreationCooperation) CreditAccountStatistics(action string, queryOptions interface{}) (*DataCreditAccountStatistics, error) { | ||
78 | + url := gateway.baseUrL + "/cooperation-statistics" | ||
79 | + method := "post" | ||
80 | + req := gateway.CreateRequest(url, method) | ||
81 | + log.Logger.Debug("向业务模块请求数据:共创统计。", map[string]interface{}{ | ||
82 | + "api": method + ":" + url, | ||
83 | + "param": queryOptions, | ||
84 | + }) | ||
85 | + param := map[string]interface{}{ | ||
86 | + "action": action, | ||
87 | + "queryOptions": queryOptions, | ||
88 | + } | ||
89 | + req, err := req.JSONBody(param) | ||
90 | + if err != nil { | ||
91 | + return nil, fmt.Errorf("请求共创统计失败:%w", err) | ||
92 | + } | ||
93 | + | ||
94 | + byteResult, err := req.Bytes() | ||
95 | + if err != nil { | ||
96 | + return nil, fmt.Errorf("获取共创统计失败:%w", err) | ||
97 | + } | ||
98 | + log.Logger.Debug("获取业务模块请求数据:共创统计。", map[string]interface{}{ | ||
99 | + "result": string(byteResult), | ||
100 | + }) | ||
101 | + var result service_gateway.GatewayResponse | ||
102 | + err = json.Unmarshal(byteResult, &result) | ||
103 | + if err != nil { | ||
104 | + return nil, fmt.Errorf("解析共创统计:%w", err) | ||
105 | + } | ||
106 | + var data DataCreditAccountStatistics | ||
107 | + err = gateway.GetResponseData(result, &data) | ||
108 | + return &data, err | ||
109 | +} |
@@ -65,6 +65,8 @@ type UserDetail struct { | @@ -65,6 +65,8 @@ type UserDetail struct { | ||
65 | } `json:"im"` | 65 | } `json:"im"` |
66 | // 收藏的菜单(工作台)(菜单编码列表) | 66 | // 收藏的菜单(工作台)(菜单编码列表) |
67 | FavoriteMenus []string `json:"favoriteMenus"` | 67 | FavoriteMenus []string `json:"favoriteMenus"` |
68 | + // 创建时间 | ||
69 | + CreatedAt time.Time `json:"createdAt,omitempty"` | ||
68 | } | 70 | } |
69 | 71 | ||
70 | //搜索用户列表 | 72 | //搜索用户列表 |
-
请 注册 或 登录 后发表评论