正在显示
29 个修改的文件
包含
292 行增加
和
50 行删除
1 | FROM 192.168.0.243:5000/mmm/allied-creation-user:20210809 | 1 | FROM 192.168.0.243:5000/mmm/allied-creation-user:20210809 |
2 | -ENV APP_DIR $GOPATH/src/project-20210825 | 2 | +ENV APP_DIR $GOPATH/src/project-20210906 |
3 | RUN mkdir -p $APP_DIR | 3 | RUN mkdir -p $APP_DIR |
4 | WORKDIR $APP_DIR/ | 4 | WORKDIR $APP_DIR/ |
5 | COPY ./pkg pkg | 5 | COPY ./pkg pkg |
6 | +COPY ./config config | ||
6 | COPY ./go.mod go.mod | 7 | COPY ./go.mod go.mod |
7 | COPY ./go.sum go.sum | 8 | COPY ./go.sum go.sum |
8 | COPY ./main.go main.go | 9 | COPY ./main.go main.go |
config/fjmaimaimai.com.key
0 → 100644
1 | +-----BEGIN RSA PRIVATE KEY----- | ||
2 | +MIIEpQIBAAKCAQEAy0OxRf+NheQG9epxbrudwnrzqVgqK5zCuRAkLUgaSMATVXEA | ||
3 | +iDzJN39om+Q49MmtEk4pXGzKUyzkFJG96PA8tJq0E+bSDtSK3n+2mjZb6pChmgHw | ||
4 | +KEX7T8ZVLqJBSrfrI4Z2BJDNEC+3wvVW3zpog1RlfKgft6NYUzNLUqE5Mxzq7lpD | ||
5 | +eRsq+FhzM1sOeEb2dAmUlDDs+7HcR3Kj0ttKeg+hKqIottQ/H6Tq4c8deEQGnO0+ | ||
6 | +RN3CygyETbYmLuWttI/sUltulWJALIuU81Yr6uCOq5MSt2WsU8CTuhRwGXSvcQCO | ||
7 | +FLYppYktoMDOGIBQffmJc/DdT1d35fvdpKbm+QIDAQABAoIBAQC8X7+qX2uI6gqJ | ||
8 | +XPxC4x0RX2DxUAPE50KOv6bHUEsLoPZJ+K/Fko/oHuuTja47Lax3inhKb4gSDUhS | ||
9 | +x754YivgNH8u8ns5wz/vc+yGflowyFj7oVAwAqslA2luDnD0Df6crcAx+wAQQCjN | ||
10 | +RRF9T2QMUeq73BOI3Ji+gosLyN55vms2KadrwpPQwYN7qhdrerE7vPqCZeswzs1/ | ||
11 | +A5M9PVGBG+simNea5kv+tVJUdLi6ckGAB5KabyhpG779ckwzV/aZy3wIj4SvUvCd | ||
12 | +bewH0xPHx5TqnMOXtzHgktClmL7hIYxy9sL14Dn0KVHbyolQ7IqmJtjXYqG84Fmx | ||
13 | +AfyDfeABAoGBAPP820tKElrfTuZ+Z19kJBTp6I5iax2Ph10glUHLlLqJ82clI/Gl | ||
14 | +CbMtnGmD72HfnJei82xqoVLsUkN9Sp+TSNJALh4N8rHkAtwq5kWToiAWZydwxVsp | ||
15 | +x5OWEN3+QFIdjVW6fhg6jZSK5HHIqMdZOVvbfKP+Cv9fWWzlS7/WVTlJAoGBANVF | ||
16 | +kol+KojM4DEASrw0s1mfPr0XvUFvKJ2TgVGR3HxAk4r0e0WwJdSfwGiB/ePcc6g5 | ||
17 | +D5dxBe8W5g3+V0DaC0f1DDNXg2MjYWoByWrurbm14FRnpMnx/UfZLo7rq8T9YrUT | ||
18 | +Bd/y0/JasndN27bIfd60n233IYMqhV2+wBwqD3AxAoGAE2/wdHYJMk4Z9gjZ6WKL | ||
19 | +8VKVIUq759X4XbXrzhsO1TGKP4xY6bZRKIIYtNs65dwvmHD13Yw9H+MNxqyjlkTg | ||
20 | +h0dvpRtNW1ij1bBhOefCAbZnL2AviMyyRpKs81J/A0uxZ8P8qad4gf3ypxHqSD9W | ||
21 | +b3fz3QivDZsl/6Pgvf6wOWkCgYEA1Cv9x5lj2WrxEu62axyG3P9nHBm055cdsf5g | ||
22 | +JfVVg6t+3TuyM7c1O52efpnsKrdTvKTf1QrVG3INdxh0V4lUtcac16sVhBhbvml+ | ||
23 | +p0pCPMIrJe1ibKG5F7SB9B+TaEuo2nnNW2mp367JY5VqoyI8zsWk4nJ8vZAc1BGD | ||
24 | +78EMUNECgYEAtV0pta3GuHKOLX1HMRsUsYuWjLqAbahnciF6MnjNWSonEK3VjMhI | ||
25 | +g+krP/9sWoC3cFOG+4s96ubjDTWImvQvCrPaENdvlNwgp035bn51eFRv00QchM2H | ||
26 | +VCS9Nhoqj5BIHl1G7Q13+tYTzjUWtteG902nWDVhgSlNLJf1rbTn34g= | ||
27 | +-----END RSA PRIVATE KEY----- |
config/fjmaimaimai.com_bundle.crt
0 → 100644
1 | +-----BEGIN CERTIFICATE----- | ||
2 | +MIIGazCCBVOgAwIBAgIQZBwijHoFToh2kjGwQ1E6bjANBgkqhkiG9w0BAQsFADBc | ||
3 | +MQswCQYDVQQGEwJDTjEaMBgGA1UEChMRV29UcnVzIENBIExpbWl0ZWQxMTAvBgNV | ||
4 | +BAMMKFdvVHJ1cyBPViBTZXJ2ZXIgQ0EgIFtSdW4gYnkgdGhlIElzc3Vlcl0wHhcN | ||
5 | +MjEwMjA0MDAwMDAwWhcNMjIwMzA2MjM1OTU5WjCB0TELMAkGA1UEBhMCQ04xDzAN | ||
6 | +BgNVBBETBjM1MDAxNTESMBAGA1UEBwwJ56aP5bee5biCMU8wTQYDVQQJDEbpqazl | ||
7 | +sL7ljLrmuZbph4zot68yN+WPtzEj5qW85LqU5qW8NTEw44CBNTEx5a6k77yI6Ieq | ||
8 | +6LS46K+V6aqM5Yy65YaF77yJMTAwLgYDVQQKDCfnpo/lu7rkubDkubDkubDkv6Hm | ||
9 | +ga/np5HmioDmnInpmZDlhazlj7gxGjAYBgNVBAMMESouZmptYWltYWltYWkuY29t | ||
10 | +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAy0OxRf+NheQG9epxbrud | ||
11 | +wnrzqVgqK5zCuRAkLUgaSMATVXEAiDzJN39om+Q49MmtEk4pXGzKUyzkFJG96PA8 | ||
12 | +tJq0E+bSDtSK3n+2mjZb6pChmgHwKEX7T8ZVLqJBSrfrI4Z2BJDNEC+3wvVW3zpo | ||
13 | +g1RlfKgft6NYUzNLUqE5Mxzq7lpDeRsq+FhzM1sOeEb2dAmUlDDs+7HcR3Kj0ttK | ||
14 | +eg+hKqIottQ/H6T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||
29 | +v7Xs0z7J47lM6HTPOU+xXL2riC69LC1KCOS6GTAtBgNVHREEJjAkghEqLmZqbWFp | ||
30 | +bWFpbWFpLmNvbYIPZmptYWltYWltYWkuY29tMA0GCSqGSIb3DQEBCwUAA4IBAQBn | ||
31 | ++jDy7sZS0gZzwMR4hnZHWqFYcJR3wnk77xr+5Yu2ifhlxaLHE3rEY3xTR9LsPwfW | ||
32 | +pdg2McinPCI6vs009NYIpeTiHzVDPzKu2BaUfKj+EHLwZQGfXkNhp3cpqZMiTkr/ | ||
33 | +YNqf25GXsBa+spwzyHh9MBXXCfWRfdHX7JlH5zyoLNztTp8unxaRYldjghHDA3Q7 | ||
34 | +8Fyz6OncY3I4U4KKBSq2/TTxveDW6NxTTuJTPOg3/qSIkwdOBLuIzuhxmF4D9wpl | ||
35 | +LMHmne2CilVeg73/GAzQt/w7FzmdvaHPAOVYWzdaTNALiXJxbi7EyO8q/uNK0GqY | ||
36 | +hljMsnA1hApG+/2sOP/P | ||
37 | +-----END CERTIFICATE----- | ||
38 | +-----BEGIN CERTIFICATE----- | ||
39 | +MIIF4TCCA8mgAwIBAgIQHQgpVDhMv3SvabmRFpvwLTANBgkqhkiG9w0BAQwFADCB | ||
40 | +iDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0pl | ||
41 | +cnNleSBDaXR5MR4wHAYDVQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNV | ||
42 | +BAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMjAw | ||
43 | +MTA4MDAwMDAwWhcNMzAwMTA3MjM1OTU5WjBcMQswCQYDVQQGEwJDTjEaMBgGA1UE | ||
44 | +ChMRV29UcnVzIENBIExpbWl0ZWQxMTAvBgNVBAMMKFdvVHJ1cyBPViBTZXJ2ZXIg | ||
45 | +Q0EgIFtSdW4gYnkgdGhlIElzc3Vlcl0wggEiMA0G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fy | ||
60 | +uotoII38/32eZ4UrC1vGFPEtDyd0yzOrr7SvQUoO2GLxFzIQ0SsgMNXJ4UAhMkTD | ||
61 | +yz1OA0tx0g0GjOQXBGA/yfRR7SgitRJAdbqkPfppMn+dtKXCHHx35ohTL0PklRdb | ||
62 | +mXacvR7rXUIiJMdsvZZqYwc+DpGJ+Zv0sRJZEL7pm1oZv6EV+UzjAlOnLe6yrnyD | ||
63 | +c99Kk1H/RFPUzduUWjiVR2aMDT1oMiwYeB2Zq60Sb201jqZPNQj5E+TkDD5BPFVc | ||
64 | +kLeRi3LyXBUuBvXPsdLtBNlr+LExtCDd66kjeUe2/YbTHF4ai5PZPraQxgbOJJyc | ||
65 | +gizGl/JOgrIQPUOLSQvXlxpKEqS+0z6KqV52bco2PNrC0f8ILKuw0nsfhgcGy46d | ||
66 | +Su8fmU9+FT6e61i2nteKvt8qkkSkAJKQxRUWYduN24mG/OOIkoeOPdYHi+qEfbyI | ||
67 | +qxiiqcH9cZgLK9AVuJoKtt7vg21OyrWi7S5T/WbTfTz9XL7QGe8ZODZZx6d50uo/ | ||
68 | +lDOmXm3p/kdGApvUF1UrL+og22jBLi0Ns6xzCfzrI3SpC9abvU8E9EnxQABuu/gM | ||
69 | +/B63dbaZzSsMVFxeECD9nMWv7IH+/rqyGmjqEJzgKdPGvXhqpebQ1HhWrV+j+ipc | ||
70 | +jplXB1j3GCozDFsninXG102N6wC8 | ||
71 | +-----END CERTIFICATE----- | ||
72 | +-----BEGIN CERTIFICATE----- | ||
73 | +MIIFgTCCBGmgAwIBAgIQOXJEOvkit1HX02wQ3TE1lTANBgkqhkiG9w0BAQwFADB7 | ||
74 | +MQswCQYDVQQGEwJHQjEbMBkGA1UECAwSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYD | ||
75 | +VQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0EgTGltaXRlZDEhMB8GA1UE | ||
76 | +AwwYQUFBIENlcnRpZmljYXRlIFNlcnZpY2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m4Diup8kyXHAc/DVL17e8vgg8CAwEAAaOB8jCB7zAfBgNVHSMEGDAWgBSg | ||
92 | +EQojPpbxB+zirynvgqV/0DCktDAdBgNVHQ4EFgQUU3m/WqorSs9UgOHYm8Cd8rID | ||
93 | +ZsswDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMBAf8wEQYDVR0gBAowCDAG | ||
94 | +BgRVHSAAMEMGA1UdHwQ8MDowOKA2oDSGMmh0dHA6Ly9jcmwuY29tb2RvY2EuY29t | ||
95 | +L0FBQUNlcnRpZmljYXRlU2VydmljZXMuY3JsMDQGCCsGAQUFBwEBBCgwJjAkBggr | ||
96 | +BgEFBQcwAYYYaHR0cDovL29jc3AuY29tb2RvY2EuY29tMA0GCSqGSIb3DQEBDAUA | ||
97 | +A4IBAQAYh1HcdCE9nIrgJ7cz0C7M7PDmy14R3iJvm3WOnnL+5Nb+qh+cli3vA0p+ | ||
98 | +rvSNb3I8QzvAP+u431yqqcau8vzY7qN7Q/aGNnwU4M309z/+3ri0ivCRlv79Q2R+ | ||
99 | +/czSAaF9ffgZGclCKxO/WIu6pKJmBHaIkU4MiRTOok3JMrO66BQavHHxW/BBC5gA | ||
100 | +CiIDEOUMsfnNkjcZ7Tvx5Dq2+UUTJnWvu6rvP3t3O9LEApE9GQDTF1w52z97GA1F | ||
101 | +zZOFli9d31kWTz9RvdVFGD/tSo7oBmF0Ixa1DVBzJ0RHfxBdiSprhTEUxOipakyA | ||
102 | +vGp4z7h/jnZymQyd/teRCBaho1+V | ||
103 | +-----END CERTIFICATE----- |
@@ -10,7 +10,7 @@ import ( | @@ -10,7 +10,7 @@ import ( | ||
10 | 10 | ||
11 | type DestroyAccountCommand struct { | 11 | type DestroyAccountCommand struct { |
12 | // 用户Id 用户唯一标识 | 12 | // 用户Id 用户唯一标识 |
13 | - UserId int64 `cname:"用户Id 用户唯一标识" json:"userId" valid:"Required"` | 13 | + Account string `cname:"账号" json:"account" valid:"Required"` |
14 | } | 14 | } |
15 | 15 | ||
16 | func (destroyAccountCommand *DestroyAccountCommand) Valid(validation *validation.Validation) { | 16 | func (destroyAccountCommand *DestroyAccountCommand) Valid(validation *validation.Validation) { |
@@ -7,6 +7,7 @@ import ( | @@ -7,6 +7,7 @@ import ( | ||
7 | type UserBaseDto struct { | 7 | type UserBaseDto struct { |
8 | // 用户基础数据id | 8 | // 用户基础数据id |
9 | UserBaseId int64 `json:"userBaseId,omitempty"` | 9 | UserBaseId int64 `json:"userBaseId,omitempty"` |
10 | + UserType int `json:"userType"` | ||
10 | // 用户信息 | 11 | // 用户信息 |
11 | UserInfo *domain.UserInfo `json:"userInfo,omitempty"` | 12 | UserInfo *domain.UserInfo `json:"userInfo,omitempty"` |
12 | // 手机号码 | 13 | // 手机号码 |
@@ -28,5 +29,6 @@ type UserBaseDto struct { | @@ -28,5 +29,6 @@ type UserBaseDto struct { | ||
28 | func (u *UserBaseDto) LoadDto(ub *domain.UserBase) { | 29 | func (u *UserBaseDto) LoadDto(ub *domain.UserBase) { |
29 | u.UserBaseId = ub.UserBaseId | 30 | u.UserBaseId = ub.UserBaseId |
30 | u.UserInfo = ub.UserInfo | 31 | u.UserInfo = ub.UserInfo |
32 | + u.UserType = domain.UserTypeVisitor | ||
31 | u.Im = ub.Im | 33 | u.Im = ub.Im |
32 | } | 34 | } |
@@ -9,11 +9,15 @@ import ( | @@ -9,11 +9,15 @@ import ( | ||
9 | ) | 9 | ) |
10 | 10 | ||
11 | type UserInfoQuery struct { | 11 | type UserInfoQuery struct { |
12 | - Account string `cname:"账号" json:"account" valid:"Required"` | 12 | + Account string `cname:"账号" json:"account"` |
13 | + UserBaseId int64 `cname:"用户编号" json:"userBaseId"` | ||
13 | } | 14 | } |
14 | 15 | ||
15 | func (userInfoQuery *UserInfoQuery) Valid(validation *validation.Validation) { | 16 | func (userInfoQuery *UserInfoQuery) Valid(validation *validation.Validation) { |
16 | //validation.SetError("CustomValid", "未实现的自定义认证") | 17 | //validation.SetError("CustomValid", "未实现的自定义认证") |
18 | + if len(userInfoQuery.Account) == 0 && userInfoQuery.UserBaseId <= 0 { | ||
19 | + validation.SetError("CustomValid", "参数不能为空") | ||
20 | + } | ||
17 | } | 21 | } |
18 | 22 | ||
19 | func (userInfoQuery *UserInfoQuery) ValidateQuery() error { | 23 | func (userInfoQuery *UserInfoQuery) ValidateQuery() error { |
@@ -81,7 +81,7 @@ func (authService *AuthService) DestroyAccount(destroyAccountCommand *command.De | @@ -81,7 +81,7 @@ func (authService *AuthService) DestroyAccount(destroyAccountCommand *command.De | ||
81 | if err != nil { | 81 | if err != nil { |
82 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 82 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
83 | } | 83 | } |
84 | - if err := accountDestroyService.DestroyAccount(nil, destroyAccountCommand.UserId); err != nil { | 84 | + if err := accountDestroyService.DestroyAccount(nil, destroyAccountCommand.Account); err != nil { |
85 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 85 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
86 | } | 86 | } |
87 | 87 | ||
@@ -319,8 +319,13 @@ func (authService *AuthService) UserInfo(userInfoQuery *query.UserInfoQuery) (in | @@ -319,8 +319,13 @@ func (authService *AuthService) UserInfo(userInfoQuery *query.UserInfoQuery) (in | ||
319 | transactionContext.RollbackTransaction() | 319 | transactionContext.RollbackTransaction() |
320 | }() | 320 | }() |
321 | 321 | ||
322 | + var userBase *domain.UserBase | ||
322 | userBaseRepository, _, _ := factory.FastPgUserBase(transactionContext, 0) | 323 | userBaseRepository, _, _ := factory.FastPgUserBase(transactionContext, 0) |
323 | - userBase, err := userBaseRepository.FindOne(map[string]interface{}{"account": userInfoQuery.Account}) | 324 | + if len(userInfoQuery.Account) > 0 { |
325 | + userBase, err = userBaseRepository.FindOne(map[string]interface{}{"account": userInfoQuery.Account}) | ||
326 | + } else if userInfoQuery.UserBaseId > 0 { | ||
327 | + userBase, err = userBaseRepository.FindOne(map[string]interface{}{"userBaseId": userInfoQuery.UserBaseId}) | ||
328 | + } | ||
324 | if err != nil { | 329 | if err != nil { |
325 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | 330 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) |
326 | } | 331 | } |
@@ -25,6 +25,8 @@ type ListOrgQuery struct { | @@ -25,6 +25,8 @@ type ListOrgQuery struct { | ||
25 | ParentId int64 `cname:"父级ID" json:"parentId,omitempty"` | 25 | ParentId int64 `cname:"父级ID" json:"parentId,omitempty"` |
26 | // 是否是组织(是:1 不是:2) | 26 | // 是否是组织(是:1 不是:2) |
27 | IsOrg int `cname:"是否是组织(是:1 不是:2)" json:"isOrg,omitempty"` | 27 | IsOrg int `cname:"是否是组织(是:1 不是:2)" json:"isOrg,omitempty"` |
28 | + // 模糊匹配组织名称 | ||
29 | + MatchOrgName string `cname:"部门名称" json:"matchOrgName,omitempty"` | ||
28 | } | 30 | } |
29 | 31 | ||
30 | func (listOrgQuery *ListOrgQuery) Valid(validation *validation.Validation) { | 32 | func (listOrgQuery *ListOrgQuery) Valid(validation *validation.Validation) { |
@@ -185,7 +185,7 @@ func (orgService *OrgService) GetOrgSubDepartment(getOrgSubDepartmentQuery *quer | @@ -185,7 +185,7 @@ func (orgService *OrgService) GetOrgSubDepartment(getOrgSubDepartmentQuery *quer | ||
185 | treeNodes[i] = orgs[i] | 185 | treeNodes[i] = orgs[i] |
186 | } | 186 | } |
187 | tree := domain.NewTrees(treeNodes) | 187 | tree := domain.NewTrees(treeNodes) |
188 | - nodes := tree.AllChildNodes(org) | 188 | + nodes := tree.AllSubDepartment(org) |
189 | if err := transactionContext.CommitTransaction(); err != nil { | 189 | if err := transactionContext.CommitTransaction(); err != nil { |
190 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 190 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
191 | } | 191 | } |
@@ -12,7 +12,7 @@ import ( | @@ -12,7 +12,7 @@ import ( | ||
12 | type GetRoleRelatedUsersQuery struct { | 12 | type GetRoleRelatedUsersQuery struct { |
13 | OperateInfo *domain.OperateInfo `json:"-"` | 13 | OperateInfo *domain.OperateInfo `json:"-"` |
14 | // 组织ID | 14 | // 组织ID |
15 | - OrgId int64 `cname:"组织ID" json:"orgId,string,omitempty"` | 15 | + OrgId int64 `cname:"组织ID" json:"orgId,omitempty"` |
16 | 16 | ||
17 | // 角色ID | 17 | // 角色ID |
18 | RoleId int64 `cname:"角色ID" json:"roleId" valid:"Required"` | 18 | RoleId int64 `cname:"角色ID" json:"roleId" valid:"Required"` |
@@ -20,6 +20,8 @@ type GetRoleRelatedUsersQuery struct { | @@ -20,6 +20,8 @@ type GetRoleRelatedUsersQuery struct { | ||
20 | DepartmentId int64 `cname:"部门编号" json:"departmentId,omitempty"` | 20 | DepartmentId int64 `cname:"部门编号" json:"departmentId,omitempty"` |
21 | // 只需要关联的用户 true:仅返回关联用户信息 false:返回所有其他信息(未关联的用户) | 21 | // 只需要关联的用户 true:仅返回关联用户信息 false:返回所有其他信息(未关联的用户) |
22 | //OnlyRelatedUser bool `cname:"部门编号" json:"onlyRelatedUser,omitempty"` | 22 | //OnlyRelatedUser bool `cname:"部门编号" json:"onlyRelatedUser,omitempty"` |
23 | + // 组织ID | ||
24 | + InOrgIds []int64 `cname:"组织ID" json:"orgIds,omitempty"` | ||
23 | } | 25 | } |
24 | 26 | ||
25 | func (getRoleRelatedUsersQuery *GetRoleRelatedUsersQuery) Valid(validation *validation.Validation) { | 27 | func (getRoleRelatedUsersQuery *GetRoleRelatedUsersQuery) Valid(validation *validation.Validation) { |
@@ -27,6 +27,8 @@ type ListRoleQuery struct { | @@ -27,6 +27,8 @@ type ListRoleQuery struct { | ||
27 | OrgId int64 `cname:"组织ID" json:"orgId,omitempty"` | 27 | OrgId int64 `cname:"组织ID" json:"orgId,omitempty"` |
28 | // 匹配多个组织 | 28 | // 匹配多个组织 |
29 | InOrgIds []int64 `cname:"匹配多个组织" json:"inOrgIds,omitempty"` | 29 | InOrgIds []int64 `cname:"匹配多个组织" json:"inOrgIds,omitempty"` |
30 | + // 角色名称 | ||
31 | + MatchRoleName string `cname:"匹配角色名称" json:"matchRoleName,omitempty"` | ||
30 | } | 32 | } |
31 | 33 | ||
32 | func (listRoleQuery *ListRoleQuery) Valid(validation *validation.Validation) { | 34 | func (listRoleQuery *ListRoleQuery) Valid(validation *validation.Validation) { |
@@ -218,10 +218,15 @@ func (roleService *RoleService) GetRoleRelatedUsers(getRoleRelatedUsersQuery *qu | @@ -218,10 +218,15 @@ func (roleService *RoleService) GetRoleRelatedUsers(getRoleRelatedUsersQuery *qu | ||
218 | } | 218 | } |
219 | queryOptions := make(map[string]interface{}) | 219 | queryOptions := make(map[string]interface{}) |
220 | queryOptions["companyId"] = role.CompanyId | 220 | queryOptions["companyId"] = role.CompanyId |
221 | - queryOptions["organizationId"] = getRoleRelatedUsersQuery.OrgId | ||
222 | if getRoleRelatedUsersQuery.DepartmentId > 0 { | 221 | if getRoleRelatedUsersQuery.DepartmentId > 0 { |
223 | queryOptions["departmentId"] = getRoleRelatedUsersQuery.DepartmentId | 222 | queryOptions["departmentId"] = getRoleRelatedUsersQuery.DepartmentId |
224 | } | 223 | } |
224 | + // 按组织过滤 | ||
225 | + if len(getRoleRelatedUsersQuery.InOrgIds) > 0 { | ||
226 | + queryOptions["inOrgIds"] = getRoleRelatedUsersQuery.InOrgIds | ||
227 | + } else { | ||
228 | + queryOptions["organizationId"] = getRoleRelatedUsersQuery.OrgId | ||
229 | + } | ||
225 | queryOptions["userType"] = domain.UserTypeEmployee | 230 | queryOptions["userType"] = domain.UserTypeEmployee |
226 | _, users, err := userRepository.Find(queryOptions) | 231 | _, users, err := userRepository.Find(queryOptions) |
227 | if err != nil { | 232 | if err != nil { |
@@ -39,6 +39,8 @@ type ListUserQuery struct { | @@ -39,6 +39,8 @@ type ListUserQuery struct { | ||
39 | PullRealTime bool `cname:"拉取最新数据" json:"pullRealTime,omitempty"` | 39 | PullRealTime bool `cname:"拉取最新数据" json:"pullRealTime,omitempty"` |
40 | // 状态(1:启用 2:禁用 3:注销) | 40 | // 状态(1:启用 2:禁用 3:注销) |
41 | EnableStatus int `cname:"状态(1:启用 2:禁用 3:注销)" json:"enableStatus,omitempty"` | 41 | EnableStatus int `cname:"状态(1:启用 2:禁用 3:注销)" json:"enableStatus,omitempty"` |
42 | + // 状态(1:启用 2:禁用 3:注销) | ||
43 | + InEnableStatus []int `cname:"状态(1:启用 2:禁用 3:注销)" json:"inEnableStatus,omitempty"` | ||
42 | } | 44 | } |
43 | 45 | ||
44 | func (listUserQuery *ListUserQuery) Valid(validation *validation.Validation) { | 46 | func (listUserQuery *ListUserQuery) Valid(validation *validation.Validation) { |
@@ -65,10 +65,15 @@ func (userService *UserService) BatchAdd2(batchAddCommand *command.BatchAdd2Comm | @@ -65,10 +65,15 @@ func (userService *UserService) BatchAdd2(batchAddCommand *command.BatchAdd2Comm | ||
65 | batchAddUserService, _ := factory.CreateBatchAddUserService(map[string]interface{}{ | 65 | batchAddUserService, _ := factory.CreateBatchAddUserService(map[string]interface{}{ |
66 | "transactionContext": transactionContext, | 66 | "transactionContext": transactionContext, |
67 | }) | 67 | }) |
68 | - if err = batchAddUserService.BatchAddUser2(batchAddCommand.OperateInfo, batchAddCommand.Users, batchAddCommand.Password); err != nil { | ||
69 | - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 68 | + var failRows []*domain.BatchAddUserItem |
69 | + if failRows, err = batchAddUserService.BatchAddUser2(batchAddCommand.OperateInfo, batchAddCommand.Users, batchAddCommand.Password); err != nil { | ||
70 | + return batchAddCommand.Users, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
71 | + } | ||
72 | + if len(failRows) != 0 { | ||
73 | + return map[string]interface{}{ | ||
74 | + "failRows": failRows, | ||
75 | + }, nil //有错误行,回滚 | ||
70 | } | 76 | } |
71 | - | ||
72 | if err := transactionContext.CommitTransaction(); err != nil { | 77 | if err := transactionContext.CommitTransaction(); err != nil { |
73 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 78 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
74 | } | 79 | } |
@@ -360,12 +365,24 @@ func (userService *UserService) GetUser(getUserQuery *query.GetUserQuery) (inter | @@ -360,12 +365,24 @@ func (userService *UserService) GetUser(getUserQuery *query.GetUserQuery) (inter | ||
360 | _, org, _ := factory.FastPgOrg(transactionContext, user.OrganizationId) | 365 | _, org, _ := factory.FastPgOrg(transactionContext, user.OrganizationId) |
361 | _, company, _ := factory.FastPgCompany(transactionContext, user.CompanyId) | 366 | _, company, _ := factory.FastPgCompany(transactionContext, user.CompanyId) |
362 | _, userBase, _ := factory.FastPgUserBase(transactionContext, user.UserBaseId) | 367 | _, userBase, _ := factory.FastPgUserBase(transactionContext, user.UserBaseId) |
363 | - if dep != nil && org != nil && userBase != nil { | ||
364 | - user.Department = dep.ConvDep() | ||
365 | - user.Organization = org.CloneSample() | 368 | + if company != nil { |
366 | user.Company = company.CloneSample() | 369 | user.Company = company.CloneSample() |
370 | + } | ||
371 | + if org != nil { | ||
372 | + user.Organization = org.CloneSample() | ||
373 | + } | ||
374 | + if dep != nil { | ||
375 | + user.Department = dep.ConvDep() | ||
376 | + } | ||
377 | + if userBase != nil { | ||
367 | user.UserInfo = userBase.UserInfo | 378 | user.UserInfo = userBase.UserInfo |
368 | } | 379 | } |
380 | + // TODO:后期可以移除有冗余roleType | ||
381 | + for i := range user.UserRole { | ||
382 | + if _, role, _ := factory.FastPgRole(transactionContext, user.UserRole[i].RoleId); role != nil { | ||
383 | + user.UserRole[i].RoleType = role.RoleType | ||
384 | + } | ||
385 | + } | ||
369 | userDto := &dto.UserDto{Im: userBase.Im} | 386 | userDto := &dto.UserDto{Im: userBase.Im} |
370 | if err := userDto.LoadDto(user, company); err != nil { | 387 | if err := userDto.LoadDto(user, company); err != nil { |
371 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 388 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
@@ -402,7 +419,7 @@ func (userService *UserService) GetUserAccessMenus(getUserAccessMenusQuery *quer | @@ -402,7 +419,7 @@ func (userService *UserService) GetUserAccessMenus(getUserAccessMenusQuery *quer | ||
402 | "transactionContext": transactionContext, | 419 | "transactionContext": transactionContext, |
403 | }) | 420 | }) |
404 | 421 | ||
405 | - menus, err := roleAccessMenusService.AccessMenus(nil, user.UserRoleIds(), domain.AccessMenusOptions{ | 422 | + menus, err := roleAccessMenusService.AccessMenus(getUserAccessMenusQuery.OperateInfo, user.UserRoleIds(), domain.AccessMenusOptions{ |
406 | CompanyId: user.CompanyId, | 423 | CompanyId: user.CompanyId, |
407 | MenuCategory: getUserAccessMenusQuery.MenuCategory, | 424 | MenuCategory: getUserAccessMenusQuery.MenuCategory, |
408 | OrgId: getUserAccessMenusQuery.OrgId, | 425 | OrgId: getUserAccessMenusQuery.OrgId, |
@@ -127,6 +127,7 @@ func (role *Role) CloneSample() *Role { | @@ -127,6 +127,7 @@ func (role *Role) CloneSample() *Role { | ||
127 | RoleId: role.RoleId, | 127 | RoleId: role.RoleId, |
128 | RoleName: role.RoleName, | 128 | RoleName: role.RoleName, |
129 | Ext: role.Ext, | 129 | Ext: role.Ext, |
130 | + RoleType: role.RoleType, | ||
130 | } | 131 | } |
131 | } | 132 | } |
132 | 133 |
@@ -4,5 +4,5 @@ import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/domain" | @@ -4,5 +4,5 @@ import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/domain" | ||
4 | 4 | ||
5 | // PgAuthAccountDestroyService 账号注销服务 | 5 | // PgAuthAccountDestroyService 账号注销服务 |
6 | type PgAuthAccountDestroyService interface { | 6 | type PgAuthAccountDestroyService interface { |
7 | - DestroyAccount(optUser *domain.User, userId int64) error | 7 | + DestroyAccount(optUser *domain.User, userId string) error |
8 | } | 8 | } |
@@ -5,5 +5,5 @@ import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/domain" | @@ -5,5 +5,5 @@ import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/domain" | ||
5 | // PgBatchAddUserService 批量添加用户服务 | 5 | // PgBatchAddUserService 批量添加用户服务 |
6 | type PgBatchAddUserService interface { | 6 | type PgBatchAddUserService interface { |
7 | BatchAddUser(optUser *domain.OperateInfo, users []*domain.User, password string) error | 7 | BatchAddUser(optUser *domain.OperateInfo, users []*domain.User, password string) error |
8 | - BatchAddUser2(optUser *domain.OperateInfo, users []*domain.BatchAddUserItem, password string) error | 8 | + BatchAddUser2(optUser *domain.OperateInfo, users []*domain.BatchAddUserItem, password string) ([]*domain.BatchAddUserItem, error) |
9 | } | 9 | } |
@@ -111,6 +111,35 @@ func traverse(tree *Tree, node TreeNode) bool { | @@ -111,6 +111,35 @@ func traverse(tree *Tree, node TreeNode) bool { | ||
111 | return match | 111 | return match |
112 | } | 112 | } |
113 | 113 | ||
114 | +// 返回tree下的所有子部门 (如果节点是组织,跳过) | ||
115 | +func (tree *Tree) AllSubDepartment(node TreeNode) []TreeNode { | ||
116 | + treeNode := tree.find(node) | ||
117 | + if treeNode == nil { | ||
118 | + return []TreeNode{} | ||
119 | + } | ||
120 | + var stack []*Tree | ||
121 | + stack = append(stack, treeNode) | ||
122 | + var res []TreeNode | ||
123 | + rootId := treeNode.Node.(*Org).OrgId | ||
124 | + for { | ||
125 | + if len(stack) == 0 { | ||
126 | + break | ||
127 | + } | ||
128 | + pop := stack[0] | ||
129 | + stack = stack[1:] | ||
130 | + /***特殊处理***/ | ||
131 | + if org, ok := pop.Node.(*Org); ok && org.OrgId != int64(rootId) { | ||
132 | + if org.IsOrg == IsOrgFlag { | ||
133 | + continue | ||
134 | + } | ||
135 | + } | ||
136 | + /***特殊处理***/ | ||
137 | + stack = append(stack, pop.Nodes...) | ||
138 | + res = append(res, pop.Node) | ||
139 | + } | ||
140 | + return res | ||
141 | +} | ||
142 | + | ||
114 | // Int64String 1 -> "1" 1->1 | 143 | // Int64String 1 -> "1" 1->1 |
115 | type Int64String int64 | 144 | type Int64String int64 |
116 | 145 |
@@ -14,6 +14,7 @@ const ( | @@ -14,6 +14,7 @@ const ( | ||
14 | const ( | 14 | const ( |
15 | UserTypeEmployee = 1 | 15 | UserTypeEmployee = 1 |
16 | UserTypeCooperation = 2 | 16 | UserTypeCooperation = 2 |
17 | + UserTypeVisitor = 4 // 游客 | ||
17 | UserTypeCompanyAdmin = 1024 | 18 | UserTypeCompanyAdmin = 1024 |
18 | ) | 19 | ) |
19 | 20 | ||
@@ -293,21 +294,24 @@ type BatchAddUserItem struct { | @@ -293,21 +294,24 @@ type BatchAddUserItem struct { | ||
293 | // 用户类型 1:企业内部用户(内部添加) 2:共创用户 1024:企业注册用户(注册添加) | 294 | // 用户类型 1:企业内部用户(内部添加) 2:共创用户 1024:企业注册用户(注册添加) |
294 | UserType int `json:"userType,omitempty"` | 295 | UserType int `json:"userType,omitempty"` |
295 | // 用户姓名 | 296 | // 用户姓名 |
296 | - UserName string `json:"userName,omitempty"` | 297 | + UserName string `json:"userName"` |
297 | // 手机号码 | 298 | // 手机号码 |
298 | - Phone string `json:"phone,omitempty"` | 299 | + Phone string `json:"phone"` |
299 | // 邮箱 | 300 | // 邮箱 |
300 | - Email string `json:"email,omitempty"` | 301 | + Email string `json:"email"` |
301 | // 用户编号 企业内标识 | 302 | // 用户编号 企业内标识 |
302 | - UserCode string `json:"userCode,omitempty"` | 303 | + UserCode string `json:"userCode"` |
303 | // 组织编码 | 304 | // 组织编码 |
304 | - Org string `json:"org,omitempty"` | 305 | + Org string `json:"org"` |
305 | // 部门编码 | 306 | // 部门编码 |
306 | - Department string `json:"department,omitempty"` | 307 | + Department string `json:"department"` |
307 | // 状态(1:启用 2:禁用 3:注销) | 308 | // 状态(1:启用 2:禁用 3:注销) |
308 | EnableStatus int `json:"enableStatus,omitempty"` | 309 | EnableStatus int `json:"enableStatus,omitempty"` |
309 | // 共创公司 cooperationCompany | 310 | // 共创公司 cooperationCompany |
310 | CooperationCompany string `json:"cooperationCompany"` | 311 | CooperationCompany string `json:"cooperationCompany"` |
311 | // 共创到期时间 (yyyy-MM-dd) cooperationDeadline | 312 | // 共创到期时间 (yyyy-MM-dd) cooperationDeadline |
312 | CooperationDeadline time.Time `json:"cooperationDeadline"` | 313 | CooperationDeadline time.Time `json:"cooperationDeadline"` |
314 | + | ||
315 | + // 失败理由 | ||
316 | + FailReason string `json:"failReason"` | ||
313 | } | 317 | } |
@@ -13,21 +13,21 @@ type PgAuthAccountDestroyService struct { | @@ -13,21 +13,21 @@ type PgAuthAccountDestroyService struct { | ||
13 | transactionContext *pgTransaction.TransactionContext | 13 | transactionContext *pgTransaction.TransactionContext |
14 | } | 14 | } |
15 | 15 | ||
16 | -func (ptr *PgAuthAccountDestroyService) DestroyAccount(optUser *domain.User, userId int64) error { | 16 | +func (ptr *PgAuthAccountDestroyService) DestroyAccount(optUser *domain.User, account string) error { |
17 | // 1.查询账号记录 | 17 | // 1.查询账号记录 |
18 | userRepository, _ := repository.NewUserRepository(ptr.transactionContext) | 18 | userRepository, _ := repository.NewUserRepository(ptr.transactionContext) |
19 | - var userBaseId int64 | ||
20 | - if user, err := userRepository.FindOne(map[string]interface{}{"userId": userId}); err != nil { | ||
21 | - if err == domain.ErrorNotFound { | ||
22 | - return fmt.Errorf("该用户不存在") | ||
23 | - } | ||
24 | - return err | ||
25 | - } else { | ||
26 | - userBaseId = user.UserBaseId | ||
27 | - } | 19 | + //var userBaseId int64 |
20 | + //if user, err := userRepository.FindOne(map[string]interface{}{"userId": userId}); err != nil { | ||
21 | + // if err == domain.ErrorNotFound { | ||
22 | + // return fmt.Errorf("该用户不存在") | ||
23 | + // } | ||
24 | + // return err | ||
25 | + //} else { | ||
26 | + // userBaseId = user.UserBaseId | ||
27 | + //} | ||
28 | 28 | ||
29 | userBaseRepository, _ := repository.NewUserBaseRepository(ptr.transactionContext) | 29 | userBaseRepository, _ := repository.NewUserBaseRepository(ptr.transactionContext) |
30 | - userBase, err := userBaseRepository.FindOne(map[string]interface{}{"userBaseId": userBaseId}) | 30 | + userBase, err := userBaseRepository.FindOne(map[string]interface{}{"account": account}) |
31 | if err != nil { | 31 | if err != nil { |
32 | return err | 32 | return err |
33 | } | 33 | } |
@@ -14,9 +14,6 @@ type PgBatchAddOrgService struct { | @@ -14,9 +14,6 @@ type PgBatchAddOrgService struct { | ||
14 | } | 14 | } |
15 | 15 | ||
16 | func (ptr *PgBatchAddOrgService) BatchAddOrg(optUser *domain.OperateInfo, orgList []*domain.BatchAddOrgItem) error { | 16 | func (ptr *PgBatchAddOrgService) BatchAddOrg(optUser *domain.OperateInfo, orgList []*domain.BatchAddOrgItem) error { |
17 | - var ( | ||
18 | - err error | ||
19 | - ) | ||
20 | orgRepository, err := repository.NewOrgRepository(ptr.transactionContext) | 17 | orgRepository, err := repository.NewOrgRepository(ptr.transactionContext) |
21 | if err != nil { | 18 | if err != nil { |
22 | return err | 19 | return err |
@@ -37,7 +34,7 @@ func (ptr *PgBatchAddOrgService) BatchAddOrg(optUser *domain.OperateInfo, orgLis | @@ -37,7 +34,7 @@ func (ptr *PgBatchAddOrgService) BatchAddOrg(optUser *domain.OperateInfo, orgLis | ||
37 | CompanyId: optUser.CompanyId, | 34 | CompanyId: optUser.CompanyId, |
38 | OrgCode: item.OrgCode, | 35 | OrgCode: item.OrgCode, |
39 | OrgName: item.OrgName, | 36 | OrgName: item.OrgName, |
40 | - IsOrg: domain.IsOrgFlag, | 37 | + IsOrg: domain.IsNotOrgFlag, |
41 | ParentId: 0, | 38 | ParentId: 0, |
42 | OrgStatus: domain.OrgStatusEnable, | 39 | OrgStatus: domain.OrgStatusEnable, |
43 | CreatedAt: time.Now(), | 40 | CreatedAt: time.Now(), |
@@ -82,17 +82,18 @@ func (ptr *PgBatchAddUserService) BatchAddUser(optUser *domain.OperateInfo, user | @@ -82,17 +82,18 @@ func (ptr *PgBatchAddUserService) BatchAddUser(optUser *domain.OperateInfo, user | ||
82 | return nil | 82 | return nil |
83 | } | 83 | } |
84 | 84 | ||
85 | -func (ptr *PgBatchAddUserService) BatchAddUser2(optUser *domain.OperateInfo, users []*domain.BatchAddUserItem, password string) error { | 85 | +func (ptr *PgBatchAddUserService) BatchAddUser2(optUser *domain.OperateInfo, users []*domain.BatchAddUserItem, password string) ([]*domain.BatchAddUserItem, error) { |
86 | var ( | 86 | var ( |
87 | err error | 87 | err error |
88 | ) | 88 | ) |
89 | + var failRows = make([]*domain.BatchAddUserItem, 0) | ||
89 | orgRepository, err := repository.NewOrgRepository(ptr.transactionContext) | 90 | orgRepository, err := repository.NewOrgRepository(ptr.transactionContext) |
90 | if err != nil { | 91 | if err != nil { |
91 | - return err | 92 | + return failRows, err |
92 | } | 93 | } |
93 | _, orgs, err := orgRepository.Find(map[string]interface{}{"companyId": optUser.CompanyId, "limit": 10000}) | 94 | _, orgs, err := orgRepository.Find(map[string]interface{}{"companyId": optUser.CompanyId, "limit": 10000}) |
94 | if err != nil { | 95 | if err != nil { |
95 | - return err | 96 | + return failRows, err |
96 | } | 97 | } |
97 | var mapOrg = make(map[string]*domain.Org) | 98 | var mapOrg = make(map[string]*domain.Org) |
98 | for i := range orgs { | 99 | for i := range orgs { |
@@ -103,15 +104,24 @@ func (ptr *PgBatchAddUserService) BatchAddUser2(optUser *domain.OperateInfo, use | @@ -103,15 +104,24 @@ func (ptr *PgBatchAddUserService) BatchAddUser2(optUser *domain.OperateInfo, use | ||
103 | for i := range users { | 104 | for i := range users { |
104 | user := users[i] | 105 | user := users[i] |
105 | if err = ptr.preCheck2(user); err != nil { | 106 | if err = ptr.preCheck2(user); err != nil { |
106 | - return err | 107 | + user.FailReason = err.Error() |
108 | + failRows = append(failRows, user) | ||
109 | + continue | ||
110 | + //return err | ||
107 | } | 111 | } |
108 | var org, dep *domain.Org | 112 | var org, dep *domain.Org |
109 | var ok bool | 113 | var ok bool |
110 | if org, ok = mapOrg[user.Org]; !ok { | 114 | if org, ok = mapOrg[user.Org]; !ok { |
111 | - return fmt.Errorf("导入的组织机构不存在:" + user.Org) | 115 | + user.FailReason = "导入的组织机构不存在:" + user.Org |
116 | + failRows = append(failRows, user) | ||
117 | + continue | ||
118 | + //return fmt.Errorf("导入的组织机构不存在:" + user.Org) | ||
112 | } | 119 | } |
113 | if dep, ok = mapOrg[user.Department]; !ok { | 120 | if dep, ok = mapOrg[user.Department]; !ok { |
114 | - return fmt.Errorf("导入的所属部门不存在:" + user.Department) | 121 | + user.FailReason = "导入的所属部门不存在:" + user.Department |
122 | + failRows = append(failRows, user) | ||
123 | + continue | ||
124 | + //return fmt.Errorf("导入的所属部门不存在:" + user.Department) | ||
115 | } | 125 | } |
116 | newUser := &domain.User{ | 126 | newUser := &domain.User{ |
117 | CompanyId: user.CompanyId, | 127 | CompanyId: user.CompanyId, |
@@ -143,10 +153,13 @@ func (ptr *PgBatchAddUserService) BatchAddUser2(optUser *domain.OperateInfo, use | @@ -143,10 +153,13 @@ func (ptr *PgBatchAddUserService) BatchAddUser2(optUser *domain.OperateInfo, use | ||
143 | UpdatedAt: time.Now(), | 153 | UpdatedAt: time.Now(), |
144 | } | 154 | } |
145 | if newUser, err = createUserService.CreateUser(nil, newUser, password); err != nil { | 155 | if newUser, err = createUserService.CreateUser(nil, newUser, password); err != nil { |
146 | - return fmt.Errorf("%v %v", user.UserName, err.Error()) | 156 | + user.FailReason = err.Error() |
157 | + failRows = append(failRows, user) | ||
158 | + continue | ||
159 | + //return fmt.Errorf("%v %v", user.UserName, err.Error()) | ||
147 | } | 160 | } |
148 | } | 161 | } |
149 | - return nil | 162 | + return failRows, nil |
150 | } | 163 | } |
151 | 164 | ||
152 | func (ptr *PgBatchAddUserService) preCheck(user *domain.User) error { | 165 | func (ptr *PgBatchAddUserService) preCheck(user *domain.User) error { |
@@ -191,6 +191,9 @@ func (repository *OrgRepository) Find(queryOptions map[string]interface{}) (int6 | @@ -191,6 +191,9 @@ func (repository *OrgRepository) Find(queryOptions map[string]interface{}) (int6 | ||
191 | query.SetWhereByQueryOption("org_name = ?", "depName") | 191 | query.SetWhereByQueryOption("org_name = ?", "depName") |
192 | query.SetWhereByQueryOption("org_code = ?", "orgCode") | 192 | query.SetWhereByQueryOption("org_code = ?", "orgCode") |
193 | query.SetWhereByQueryOption("parent_id = ?", "parentId") | 193 | query.SetWhereByQueryOption("parent_id = ?", "parentId") |
194 | + if v, ok := queryOptions["matchOrgName"]; ok && len(v.(string)) > 0 { | ||
195 | + query.Where(fmt.Sprintf(`org_name like '%%%v%%'`, v)) | ||
196 | + } | ||
194 | query.SetOrderDirect("org_id", "ASC") | 197 | query.SetOrderDirect("org_id", "ASC") |
195 | if count, err := query.SelectAndCount(); err != nil { | 198 | if count, err := query.SelectAndCount(); err != nil { |
196 | return 0, orgs, err | 199 | return 0, orgs, err |
@@ -185,6 +185,9 @@ func (repository *RoleRepository) Find(queryOptions map[string]interface{}) (int | @@ -185,6 +185,9 @@ func (repository *RoleRepository) Find(queryOptions map[string]interface{}) (int | ||
185 | if orgName, ok := queryOptions["orgName"]; ok && len(orgName.(string)) > 0 { | 185 | if orgName, ok := queryOptions["orgName"]; ok && len(orgName.(string)) > 0 { |
186 | query.Where(fmt.Sprintf("ext->>'orgName' like '%%%v%%'", orgName)) | 186 | query.Where(fmt.Sprintf("ext->>'orgName' like '%%%v%%'", orgName)) |
187 | } | 187 | } |
188 | + if matchRoleName, ok := queryOptions["matchRoleName"]; ok && len(matchRoleName.(string)) > 0 { | ||
189 | + query.Where(fmt.Sprintf("role_name like '%%%v%%'", matchRoleName)) | ||
190 | + } | ||
188 | // 包含删除的 | 191 | // 包含删除的 |
189 | if v, ok := queryOptions["includeDeleted"]; ok && !(v.(bool)) { | 192 | if v, ok := queryOptions["includeDeleted"]; ok && !(v.(bool)) { |
190 | query.Where("deleted_at is null") | 193 | query.Where("deleted_at is null") |
@@ -204,7 +204,9 @@ func (repository *UserRepository) Find(queryOptions map[string]interface{}) (int | @@ -204,7 +204,9 @@ func (repository *UserRepository) Find(queryOptions map[string]interface{}) (int | ||
204 | query.SetWhereByQueryOption("(user_type & ?)>0", "userType") | 204 | query.SetWhereByQueryOption("(user_type & ?)>0", "userType") |
205 | query.SetWhereByQueryOption("enable_status=?", "enableStatus") | 205 | query.SetWhereByQueryOption("enable_status=?", "enableStatus") |
206 | query.SetWhereByQueryOption(fmt.Sprintf(`user_role @> '[{"roleId":%v}]'`, queryOptions["roleId"]), "roleId") | 206 | query.SetWhereByQueryOption(fmt.Sprintf(`user_role @> '[{"roleId":%v}]'`, queryOptions["roleId"]), "roleId") |
207 | - | 207 | + if v, ok := queryOptions["inEnableStatus"]; ok && len(v.([]int)) > 0 { |
208 | + query.Where(`enable_status in (?)`, pg.In(v)) | ||
209 | + } | ||
208 | if v, ok := queryOptions["depName"]; ok && len(v.(string)) > 0 { | 210 | if v, ok := queryOptions["depName"]; ok && len(v.(string)) > 0 { |
209 | query.Where(fmt.Sprintf(`ext->>'depName' like '%%%v%%'`, v)) | 211 | query.Where(fmt.Sprintf(`ext->>'depName' like '%%%v%%'`, v)) |
210 | } | 212 | } |
1 | package beego | 1 | package beego |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | + "os" | ||
5 | + "strconv" | ||
6 | + | ||
4 | "github.com/beego/beego/v2/server/web" | 7 | "github.com/beego/beego/v2/server/web" |
5 | "github.com/beego/beego/v2/server/web/context" | 8 | "github.com/beego/beego/v2/server/web/context" |
6 | "github.com/linmadan/egglib-go/log" | 9 | "github.com/linmadan/egglib-go/log" |
@@ -9,8 +12,6 @@ import ( | @@ -9,8 +12,6 @@ import ( | ||
9 | . "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/log" | 12 | . "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/log" |
10 | _ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/log" | 13 | _ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/log" |
11 | _ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/port/beego/routers" | 14 | _ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/port/beego/routers" |
12 | - "os" | ||
13 | - "strconv" | ||
14 | ) | 15 | ) |
15 | 16 | ||
16 | func init() { | 17 | func init() { |
@@ -29,6 +30,11 @@ func init() { | @@ -29,6 +30,11 @@ func init() { | ||
29 | web.BConfig.Listen.HTTPPort = port | 30 | web.BConfig.Listen.HTTPPort = port |
30 | } | 31 | } |
31 | } | 32 | } |
33 | + //https支持 | ||
34 | + web.BConfig.Listen.EnableHTTPS = true | ||
35 | + web.BConfig.Listen.HTTPSPort = 443 | ||
36 | + web.BConfig.Listen.HTTPSCertFile = "./config/fjmaimaimai.com_bundle.crt" | ||
37 | + web.BConfig.Listen.HTTPSKeyFile = "./config/fjmaimaimai.com.key" | ||
32 | web.InsertFilter("/*", web.BeforeRouter, filters.AllowCors()) | 38 | web.InsertFilter("/*", web.BeforeRouter, filters.AllowCors()) |
33 | web.InsertFilter("/*", web.BeforeExec, CreateRequestLogFilter(Logger)) | 39 | web.InsertFilter("/*", web.BeforeExec, CreateRequestLogFilter(Logger)) |
34 | web.InsertFilter("/*", web.AfterExec, filters.CreateResponseLogFilter(Logger), web.WithReturnOnOutput(false)) | 40 | web.InsertFilter("/*", web.AfterExec, filters.CreateResponseLogFilter(Logger), web.WithReturnOnOutput(false)) |
@@ -92,6 +92,17 @@ func (controller *RoleController) GetRoleRelatedUsers() { | @@ -92,6 +92,17 @@ func (controller *RoleController) GetRoleRelatedUsers() { | ||
92 | controller.Response(data, err) | 92 | controller.Response(data, err) |
93 | } | 93 | } |
94 | 94 | ||
95 | +func (controller *RoleController) RoleRelatedUsers() { | ||
96 | + roleService := service.NewRoleService(nil) | ||
97 | + getRoleRelatedUsersQuery := &query.GetRoleRelatedUsersQuery{} | ||
98 | + controller.Unmarshal(getRoleRelatedUsersQuery) | ||
99 | + roleId, _ := controller.GetInt64(":roleId") | ||
100 | + getRoleRelatedUsersQuery.RoleId = roleId | ||
101 | + getRoleRelatedUsersQuery.OperateInfo = ParseOperateInfo(controller.BaseController) | ||
102 | + data, err := roleService.GetRoleRelatedUsers(getRoleRelatedUsersQuery) | ||
103 | + controller.Response(data, err) | ||
104 | +} | ||
105 | + | ||
95 | func (controller *RoleController) GetRoleAccessMenus() { | 106 | func (controller *RoleController) GetRoleAccessMenus() { |
96 | roleService := service.NewRoleService(nil) | 107 | roleService := service.NewRoleService(nil) |
97 | getRoleAccessMenusQuery := &query.GetRoleAccessMenusQuery{} | 108 | getRoleAccessMenusQuery := &query.GetRoleAccessMenusQuery{} |
@@ -13,5 +13,5 @@ func init() { | @@ -13,5 +13,5 @@ func init() { | ||
13 | web.Router("/auth/reset-phone", &controllers.AuthController{}, "Post:PhoneAuthResetPhone") | 13 | web.Router("/auth/reset-phone", &controllers.AuthController{}, "Post:PhoneAuthResetPhone") |
14 | web.Router("/auth/destroy-account", &controllers.AuthController{}, "Post:DestroyAccount") | 14 | web.Router("/auth/destroy-account", &controllers.AuthController{}, "Post:DestroyAccount") |
15 | web.Router("/auth/refresh-im", &controllers.AuthController{}, "Post:RefreshIM") | 15 | web.Router("/auth/refresh-im", &controllers.AuthController{}, "Post:RefreshIM") |
16 | - web.Router("/auth/user-base-info", &controllers.AuthController{}, "Post:UserInfo") | 16 | + web.Router("/auth/user-info", &controllers.AuthController{}, "Post:UserInfo") |
17 | } | 17 | } |
@@ -12,6 +12,7 @@ func init() { | @@ -12,6 +12,7 @@ func init() { | ||
12 | web.Router("/role/:roleId", &controllers.RoleController{}, "Delete:RemoveRole") | 12 | web.Router("/role/:roleId", &controllers.RoleController{}, "Delete:RemoveRole") |
13 | web.Router("/role/search", &controllers.RoleController{}, "Post:SearchRole") | 13 | web.Router("/role/search", &controllers.RoleController{}, "Post:SearchRole") |
14 | web.Router("/role/:roleId/related-user", &controllers.RoleController{}, "Get:GetRoleRelatedUsers") | 14 | web.Router("/role/:roleId/related-user", &controllers.RoleController{}, "Get:GetRoleRelatedUsers") |
15 | + web.Router("/role/:roleId/related-user", &controllers.RoleController{}, "Post:RoleRelatedUsers") | ||
15 | web.Router("/role/:roleId/access-menus", &controllers.RoleController{}, "Get:GetRoleAccessMenus") | 16 | web.Router("/role/:roleId/access-menus", &controllers.RoleController{}, "Get:GetRoleAccessMenus") |
16 | web.Router("/role/:roleId/access-menus", &controllers.RoleController{}, "Put:UpdateRoleAccessMenus") | 17 | web.Router("/role/:roleId/access-menus", &controllers.RoleController{}, "Put:UpdateRoleAccessMenus") |
17 | web.Router("/role/assign", &controllers.RoleController{}, "Post:AssginRoleToUsers") | 18 | web.Router("/role/assign", &controllers.RoleController{}, "Post:AssginRoleToUsers") |
-
请 注册 或 登录 后发表评论