正在显示
9 个修改的文件
包含
101 行增加
和
16 行删除
@@ -677,6 +677,7 @@ func (svr AuthService) GetCompanyOrgsByUser(queryParam *query.GetCompanyOrgsByUs | @@ -677,6 +677,7 @@ func (svr AuthService) GetCompanyOrgsByUser(queryParam *query.GetCompanyOrgsByUs | ||
677 | Phone: queryParam.Operator.Phone, | 677 | Phone: queryParam.Operator.Phone, |
678 | UserType: domain.UserTypeEmployee, | 678 | UserType: domain.UserTypeEmployee, |
679 | PullRealTime: true, | 679 | PullRealTime: true, |
680 | + EnableStatus: domain.UserStatusEnable, | ||
680 | }) | 681 | }) |
681 | if err != nil { | 682 | if err != nil { |
682 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 683 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
@@ -19,7 +19,7 @@ type CreditAccountPaySearchCommand struct { | @@ -19,7 +19,7 @@ type CreditAccountPaySearchCommand struct { | ||
19 | // 开始时间 | 19 | // 开始时间 |
20 | BeginTime int64 `json:"beginTime"` | 20 | BeginTime int64 `json:"beginTime"` |
21 | // 结算时间 | 21 | // 结算时间 |
22 | - EndTime int64 `json:"beginTime"` | 22 | + EndTime int64 `json:"endTime"` |
23 | } | 23 | } |
24 | 24 | ||
25 | func (cmd *CreditAccountPaySearchCommand) Valid(validation *validation.Validation) { | 25 | func (cmd *CreditAccountPaySearchCommand) Valid(validation *validation.Validation) { |
@@ -29,12 +29,12 @@ type CreditAccountItem struct { | @@ -29,12 +29,12 @@ type CreditAccountItem struct { | ||
29 | //Email string `json:"email,omitempty"` | 29 | //Email string `json:"email,omitempty"` |
30 | } `json:"userInfo"` | 30 | } `json:"userInfo"` |
31 | } `json:"participator"` // 参与人 | 31 | } `json:"participator"` // 参与人 |
32 | - ParticipateType string `json:"participateType"` // 参与类型 | ||
33 | - PaymentDocumentAttachment []domain.Attachment `json:"paymentDocumentAttachment"` // 支付凭证附件,复数 | ||
34 | - Org domain.Org `json:"org"` // 数据所属组织机构 | ||
35 | - Company domain.CompanyData `json:"company"` // 公司 | ||
36 | - CreatedAt int64 `json:"createdAt"` // 创建时间 | ||
37 | - UpdatedAt int64 `json:"updatedAt"` // 更新时间 | 32 | + ParticipateType string `json:"participateType"` // 参与类型 |
33 | + PaymentDocumentAttachment []domain.Attachment `json:"paymentDocumentAttachments"` // 支付凭证附件,复数 | ||
34 | + Org domain.Org `json:"org"` // 数据所属组织机构 | ||
35 | + Company domain.CompanyData `json:"company"` // 公司 | ||
36 | + CreatedAt int64 `json:"createdAt"` // 创建时间 | ||
37 | + UpdatedAt int64 `json:"updatedAt"` // 更新时间 | ||
38 | AccountDetail []struct { | 38 | AccountDetail []struct { |
39 | DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"` | 39 | DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"` |
40 | DividendsType int `json:"dividendsType"` | 40 | DividendsType int `json:"dividendsType"` |
1 | package service | 1 | package service |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | + "github.com/linmadan/egglib-go/utils/json" | ||
4 | "time" | 5 | "time" |
5 | 6 | ||
6 | "github.com/linmadan/egglib-go/core/application" | 7 | "github.com/linmadan/egglib-go/core/application" |
@@ -83,24 +84,59 @@ func (srv CompanyCreditAccountService) CreditAccountPay(cmd *command.CreditAccou | @@ -83,24 +84,59 @@ func (srv CompanyCreditAccountService) CreditAccountPay(cmd *command.CreditAccou | ||
83 | func (srv CompanyCreditAccountService) CreditAccountPaySearch(cmd *command.CreditAccountPaySearchCommand) (interface{}, error) { | 84 | func (srv CompanyCreditAccountService) CreditAccountPaySearch(cmd *command.CreditAccountPaySearchCommand) (interface{}, error) { |
84 | gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( | 85 | gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( |
85 | cmd.Operator) | 86 | cmd.Operator) |
86 | - resultMenu, err := gateway.CreditAccountsSearch(allied_creation_cooperation.ReqCreditAccountsSearch{ | 87 | + var beginTime, endTime time.Time |
88 | + if cmd.BeginTime > 0 { | ||
89 | + beginTime = time.Unix(cmd.BeginTime/1000, 0) | ||
90 | + } | ||
91 | + if cmd.EndTime > 0 { | ||
92 | + endTime = time.Unix(cmd.EndTime/1000, 0) | ||
93 | + } | ||
94 | + req := allied_creation_cooperation.ReqCreditAccountsSearch{ | ||
87 | PageNumber: cmd.PageNumber + 1, //手机序号从0开始的 | 95 | PageNumber: cmd.PageNumber + 1, //手机序号从0开始的 |
88 | PageSize: cmd.PageSize, | 96 | PageSize: cmd.PageSize, |
89 | PaymentStatus: 2, | 97 | PaymentStatus: 2, |
90 | - //TODO:时间段过滤 | ||
91 | - }) | 98 | + OrgId: cmd.Operator.OrgId, |
99 | + BeginTime: beginTime, | ||
100 | + EndTime: endTime, | ||
101 | + } | ||
102 | + resultMenu, err := gateway.CreditAccountsSearch(req) | ||
92 | if err != nil { | 103 | if err != nil { |
93 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | 104 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) |
94 | } | 105 | } |
95 | - var items []*dto.CreditAccountItem | 106 | + queryOptions := map[string]interface{}{ |
107 | + "orgId": cmd.Operator.OrgId, | ||
108 | + } | ||
109 | + if cmd.BeginTime > 0 { | ||
110 | + queryOptions["beginTime"] = beginTime | ||
111 | + } | ||
112 | + if cmd.EndTime > 0 { | ||
113 | + queryOptions["endTime"] = endTime | ||
114 | + } | ||
115 | + // 2.分红统计 | ||
116 | + dividendStatisticsResult, err := gateway.CooperationStatistics(allied_creation_cooperation.CreditAccountStatistics, queryOptions) | ||
117 | + if err != nil { | ||
118 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
119 | + } | ||
120 | + type AnnualDividend struct { | ||
121 | + Total float64 `json:"total"` | ||
122 | + Accounting float64 `json:"accounting"` | ||
123 | + Accounted float64 `json:"accounted"` | ||
124 | + Paid float64 `json:"paid"` | ||
125 | + Unpaid float64 `json:"unpaid"` | ||
126 | + } | ||
127 | + var annualDividend = &AnnualDividend{} | ||
128 | + if err := json.UnmarshalFromString(json.MarshalToString(dividendStatisticsResult), annualDividend); err != nil { | ||
129 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
130 | + } | ||
131 | + | ||
132 | + var items = make([]*dto.CreditAccountItem, 0) | ||
96 | for i := 0; i < len(resultMenu.Grid.List); i++ { | 133 | for i := 0; i < len(resultMenu.Grid.List); i++ { |
97 | items = append(items, dto.ToCreditAccountItem(&resultMenu.Grid.List[i])) | 134 | items = append(items, dto.ToCreditAccountItem(&resultMenu.Grid.List[i])) |
98 | } | 135 | } |
99 | return map[string]interface{}{ | 136 | return map[string]interface{}{ |
100 | "grid": map[string]interface{}{ | 137 | "grid": map[string]interface{}{ |
101 | "list": items, | 138 | "list": items, |
102 | - //TODO:sum 时间段支付金额 | ||
103 | - "sum": 6000, | 139 | + "sum": annualDividend.Paid, |
104 | }, | 140 | }, |
105 | }, nil | 141 | }, nil |
106 | } | 142 | } |
@@ -2,7 +2,9 @@ package service | @@ -2,7 +2,9 @@ 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" |
7 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/cooperation/dto" | ||
6 | "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" |
7 | "time" | 9 | "time" |
8 | ) | 10 | ) |
@@ -15,19 +17,58 @@ type PersonCreditAccountService struct { | @@ -15,19 +17,58 @@ type PersonCreditAccountService struct { | ||
15 | func (srv PersonCreditAccountService) CreditAccountPaySearch(cmd *command.CreditAccountPaySearchCommand) (interface{}, error) { | 17 | func (srv PersonCreditAccountService) CreditAccountPaySearch(cmd *command.CreditAccountPaySearchCommand) (interface{}, error) { |
16 | gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( | 18 | gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( |
17 | cmd.Operator) | 19 | cmd.Operator) |
20 | + var beginTime, endTime time.Time | ||
21 | + if cmd.BeginTime > 0 { | ||
22 | + beginTime = time.Unix(cmd.BeginTime/1000, 0) | ||
23 | + } | ||
24 | + if cmd.EndTime > 0 { | ||
25 | + endTime = time.Unix(cmd.EndTime/1000, 0) | ||
26 | + } | ||
18 | resultMenu, err := gateway.CreditAccountsSearch(allied_creation_cooperation.ReqCreditAccountsSearch{ | 27 | resultMenu, err := gateway.CreditAccountsSearch(allied_creation_cooperation.ReqCreditAccountsSearch{ |
19 | PageNumber: cmd.PageNumber + 1, //手机序号从0开始的 | 28 | PageNumber: cmd.PageNumber + 1, //手机序号从0开始的 |
20 | PageSize: cmd.PageSize, | 29 | PageSize: cmd.PageSize, |
21 | PaymentStatus: 2, | 30 | PaymentStatus: 2, |
22 | UserBaseId: cmd.Operator.UserBaseId, | 31 | UserBaseId: cmd.Operator.UserBaseId, |
32 | + BeginTime: beginTime, | ||
33 | + EndTime: endTime, | ||
23 | }) | 34 | }) |
24 | if err != nil { | 35 | if err != nil { |
25 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | 36 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) |
26 | } | 37 | } |
38 | + queryOptions := map[string]interface{}{ | ||
39 | + "userBaseId": cmd.Operator.UserBaseId, | ||
40 | + } | ||
41 | + if cmd.BeginTime > 0 { | ||
42 | + queryOptions["beginTime"] = beginTime | ||
43 | + } | ||
44 | + if cmd.EndTime > 0 { | ||
45 | + queryOptions["endTime"] = endTime | ||
46 | + } | ||
47 | + // 2.分红统计 | ||
48 | + dividendStatisticsResult, err := gateway.CooperationStatistics(allied_creation_cooperation.CreditAccountStatistics, queryOptions) | ||
49 | + if err != nil { | ||
50 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
51 | + } | ||
52 | + type AnnualDividend struct { | ||
53 | + Total float64 `json:"total"` | ||
54 | + Accounting float64 `json:"accounting"` | ||
55 | + Accounted float64 `json:"accounted"` | ||
56 | + Paid float64 `json:"paid"` | ||
57 | + Unpaid float64 `json:"unpaid"` | ||
58 | + } | ||
59 | + var annualDividend = &AnnualDividend{} | ||
60 | + if err := json.UnmarshalFromString(json.MarshalToString(dividendStatisticsResult), annualDividend); err != nil { | ||
61 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
62 | + } | ||
63 | + | ||
64 | + var items = make([]*dto.CreditAccountItem, 0) | ||
65 | + for i := 0; i < len(resultMenu.Grid.List); i++ { | ||
66 | + items = append(items, dto.ToCreditAccountItem(&resultMenu.Grid.List[i])) | ||
67 | + } | ||
27 | return map[string]interface{}{ | 68 | return map[string]interface{}{ |
28 | "grid": map[string]interface{}{ | 69 | "grid": map[string]interface{}{ |
29 | - "list": resultMenu.Grid.List, | ||
30 | - "sum": 6000, | 70 | + "list": items, |
71 | + "sum": annualDividend.Paid, | ||
31 | }, | 72 | }, |
32 | }, nil | 73 | }, nil |
33 | } | 74 | } |
@@ -188,6 +188,7 @@ func (srv UserService) DepartmentsUsers(departmentsUsersQuery *query.Departments | @@ -188,6 +188,7 @@ func (srv UserService) DepartmentsUsers(departmentsUsersQuery *query.Departments | ||
188 | CompanyId: departmentsUsersQuery.Operator.CompanyId, | 188 | CompanyId: departmentsUsersQuery.Operator.CompanyId, |
189 | OrganizationId: departmentsUsersQuery.Operator.OrgId, | 189 | OrganizationId: departmentsUsersQuery.Operator.OrgId, |
190 | UserType: domain.UserTypeEmployee, //TODO:是否要共创用户 | 190 | UserType: domain.UserTypeEmployee, //TODO:是否要共创用户 |
191 | + InEnableStatus: []int{domain.UserStatusEnable, domain.UserStatusDisable}, | ||
191 | }) | 192 | }) |
192 | if err != nil { | 193 | if err != nil { |
193 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | 194 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) |
1 | package service | 1 | package service |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | ||
4 | "strconv" | 5 | "strconv" |
5 | 6 | ||
6 | "github.com/linmadan/egglib-go/core/application" | 7 | "github.com/linmadan/egglib-go/core/application" |
@@ -163,6 +164,7 @@ func (orgsService OrgsService) DepartmentsUsers(departmentsUsersQuery *query.Dep | @@ -163,6 +164,7 @@ func (orgsService OrgsService) DepartmentsUsers(departmentsUsersQuery *query.Dep | ||
163 | CompanyId: departmentsUsersQuery.Operator.CompanyId, | 164 | CompanyId: departmentsUsersQuery.Operator.CompanyId, |
164 | OrganizationId: departmentsUsersQuery.Operator.OrgId, | 165 | OrganizationId: departmentsUsersQuery.Operator.OrgId, |
165 | Limit: 1000, | 166 | Limit: 1000, |
167 | + InEnableStatus: []int{domain.UserStatusEnable, domain.UserStatusDisable}, | ||
166 | }) | 168 | }) |
167 | if err != nil { | 169 | if err != nil { |
168 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | 170 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) |
@@ -87,7 +87,9 @@ type ( | @@ -87,7 +87,9 @@ type ( | ||
87 | // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 | 87 | // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 |
88 | UserId int64 `cname:"用户ID" json:"userId"` | 88 | UserId int64 `cname:"用户ID" json:"userId"` |
89 | // 用户基础数据id | 89 | // 用户基础数据id |
90 | - UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId"` | 90 | + UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId"` |
91 | + BeginTime time.Time `json:"beginTime"` | ||
92 | + EndTime time.Time `json:"endTime"` | ||
91 | } | 93 | } |
92 | 94 | ||
93 | DataCreditAccountsSearch struct { | 95 | DataCreditAccountsSearch struct { |
@@ -101,6 +101,8 @@ type ( | @@ -101,6 +101,8 @@ type ( | ||
101 | PullRealTime bool `cname:"拉取最新数据" json:"pullRealTime,omitempty"` | 101 | PullRealTime bool `cname:"拉取最新数据" json:"pullRealTime,omitempty"` |
102 | // 状态(1:启用 2:禁用 3:注销) | 102 | // 状态(1:启用 2:禁用 3:注销) |
103 | EnableStatus int `cname:"状态(1:启用 2:禁用 3:注销)" json:"enableStatus,omitempty"` | 103 | EnableStatus int `cname:"状态(1:启用 2:禁用 3:注销)" json:"enableStatus,omitempty"` |
104 | + // 状态(1:启用 2:禁用 3:注销) | ||
105 | + InEnableStatus []int `cname:"状态(1:启用 2:禁用 3:注销)" json:"inEnableStatus,omitempty"` | ||
104 | } | 106 | } |
105 | 107 | ||
106 | //DataUserSearch 搜索用户列表 | 108 | //DataUserSearch 搜索用户列表 |
-
请 注册 或 登录 后发表评论