正在显示
18 个修改的文件
包含
679 行增加
和
1 行删除
1 | +package command | ||
2 | + | ||
3 | +import ( | ||
4 | + "fmt" | ||
5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | ||
6 | + | ||
7 | + "github.com/beego/beego/v2/core/validation" | ||
8 | +) | ||
9 | + | ||
10 | +type UserInfoCommand struct { | ||
11 | + //操作人 | ||
12 | + Operator domain.Operator `json:"-"` | ||
13 | +} | ||
14 | + | ||
15 | +func (userInfoCommand *UserInfoCommand) Valid(validation *validation.Validation) { | ||
16 | + | ||
17 | +} | ||
18 | + | ||
19 | +func (userInfoCommand *UserInfoCommand) ValidateCommand() error { | ||
20 | + valid := validation.Validation{} | ||
21 | + b, err := valid.Valid(userInfoCommand) | ||
22 | + if err != nil { | ||
23 | + return err | ||
24 | + } | ||
25 | + if !b { | ||
26 | + for _, validErr := range valid.Errors { | ||
27 | + return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
28 | + } | ||
29 | + } | ||
30 | + return nil | ||
31 | +} |
1 | +package command | ||
2 | + | ||
3 | +import ( | ||
4 | + "fmt" | ||
5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | ||
6 | + | ||
7 | + "github.com/beego/beego/v2/core/validation" | ||
8 | +) | ||
9 | + | ||
10 | +type UserMenusCommand struct { | ||
11 | + //操作人 | ||
12 | + Operator domain.Operator `json:"-"` | ||
13 | +} | ||
14 | + | ||
15 | +func (userMenusCommand *UserMenusCommand) Valid(validation *validation.Validation) { | ||
16 | + | ||
17 | +} | ||
18 | + | ||
19 | +func (userMenusCommand *UserMenusCommand) ValidateCommand() error { | ||
20 | + valid := validation.Validation{} | ||
21 | + b, err := valid.Valid(userMenusCommand) | ||
22 | + if err != nil { | ||
23 | + return err | ||
24 | + } | ||
25 | + if !b { | ||
26 | + for _, validErr := range valid.Errors { | ||
27 | + return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
28 | + } | ||
29 | + } | ||
30 | + return nil | ||
31 | +} |
1 | +package command | ||
2 | + | ||
3 | +import ( | ||
4 | + "fmt" | ||
5 | + "github.com/beego/beego/v2/core/validation" | ||
6 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | ||
7 | +) | ||
8 | + | ||
9 | +type UserOrgCommand struct { | ||
10 | + //操作人 | ||
11 | + Operator domain.Operator `json:"-"` | ||
12 | +} | ||
13 | + | ||
14 | +func (userOrgCommand *UserOrgCommand) Valid(validation *validation.Validation) { | ||
15 | + | ||
16 | +} | ||
17 | + | ||
18 | +func (userOrgCommand *UserOrgCommand) ValidateCommand() error { | ||
19 | + valid := validation.Validation{} | ||
20 | + b, err := valid.Valid(userOrgCommand) | ||
21 | + if err != nil { | ||
22 | + return err | ||
23 | + } | ||
24 | + if !b { | ||
25 | + for _, validErr := range valid.Errors { | ||
26 | + return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
27 | + } | ||
28 | + } | ||
29 | + return nil | ||
30 | +} |
@@ -326,3 +326,76 @@ loopUser1: | @@ -326,3 +326,76 @@ loopUser1: | ||
326 | "expiresIn": currentAccess.AccessExpired - nowTime, | 326 | "expiresIn": currentAccess.AccessExpired - nowTime, |
327 | }, nil | 327 | }, nil |
328 | } | 328 | } |
329 | + | ||
330 | +//GetUserMenus 获取用户信息 | ||
331 | +func (srv AuthService) GetUserInfo(userInfoCommand *command.UserInfoCommand) (interface{}, error) { | ||
332 | + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( | ||
333 | + userInfoCommand.Operator) | ||
334 | + resultUser, err := creationUserGateway.UserGet(allied_creation_user.ReqGateUser{ | ||
335 | + UserId: int(userInfoCommand.Operator.UserId), | ||
336 | + }) | ||
337 | + if err != nil { | ||
338 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
339 | + } | ||
340 | + var user = map[string]interface{}{ | ||
341 | + "userId": resultUser.UserId, | ||
342 | + "userInfo": map[string]interface{}{ | ||
343 | + "userName": resultUser.UserInfo.UserName, | ||
344 | + "userPhone": resultUser.UserInfo.Phone, | ||
345 | + "userAvatar": resultUser.UserInfo.Avatar, | ||
346 | + }, | ||
347 | + "department": resultUser.Department, | ||
348 | + "company": map[string]interface{}{ | ||
349 | + "companyId": resultUser.Company.CompanyId, | ||
350 | + "companyName": resultUser.Company.CompanyName, | ||
351 | + "logo": resultUser.Company.Log, | ||
352 | + }, | ||
353 | + "im": resultUser.IM, | ||
354 | + "org": resultUser.Org, | ||
355 | + } | ||
356 | + | ||
357 | + return map[string]interface{}{ | ||
358 | + "user": user, | ||
359 | + }, nil | ||
360 | +} | ||
361 | + | ||
362 | +//GetUserMenus 获取用户菜单 | ||
363 | +func (srv AuthService) GetUserMenus(userMenusCommand *command.UserMenusCommand) (interface{}, error) { | ||
364 | + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( | ||
365 | + userMenusCommand.Operator) | ||
366 | + resultMenu, err := creationUserGateway.UserAccessMenus(allied_creation_user.ReqUserAccessMenus{ | ||
367 | + UserId: int(userMenusCommand.Operator.UserId), | ||
368 | + }) | ||
369 | + if err != nil { | ||
370 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
371 | + } | ||
372 | + return map[string]interface{}{ | ||
373 | + "accessMenus": resultMenu.Menus, | ||
374 | + }, nil | ||
375 | +} | ||
376 | + | ||
377 | +//GetUserMenus 获取用户组织 | ||
378 | +func (srv AuthService) GetUserOrg(userOrgCommand *command.UserOrgCommand) (interface{}, error) { | ||
379 | + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(userOrgCommand.Operator) | ||
380 | + result, err := creationUserGateway.UserSearch(allied_creation_user.ReqUserSearch{ | ||
381 | + Offset: 0, | ||
382 | + Limit: 100, | ||
383 | + UserBaseId: userOrgCommand.Operator.UserBaseId, | ||
384 | + UserType: 1, | ||
385 | + PullRealTime: true, | ||
386 | + }) | ||
387 | + if err != nil { | ||
388 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
389 | + } | ||
390 | + var res = make([]interface{}, 0) | ||
391 | + for i := range result.Users { | ||
392 | + for j := range result.Users[i].UserOrg { | ||
393 | + org := result.Users[i].UserOrg[j] | ||
394 | + res = append(res, map[string]interface{}{ | ||
395 | + "orgId": org.OrgID, | ||
396 | + "orgName": org.OrgName, | ||
397 | + }) | ||
398 | + } | ||
399 | + } | ||
400 | + return res, nil | ||
401 | +} |
1 | +package command | ||
2 | + | ||
3 | +import ( | ||
4 | + "fmt" | ||
5 | + "reflect" | ||
6 | + "strings" | ||
7 | + "time" | ||
8 | + | ||
9 | + "github.com/beego/beego/v2/core/validation" | ||
10 | +) | ||
11 | + | ||
12 | +type CreateCompanyCommand struct { | ||
13 | + // 企业名称 | ||
14 | + CompanyName string `cname:"企业名称" json:"companyName" valid:"Required"` | ||
15 | + // 规模 | ||
16 | + Scale string `cname:"规模" json:"scale" valid:"Required"` | ||
17 | + // 公司Logo地址 | ||
18 | + Logo string `cname:"公司Logo地址" json:"logo" valid:"Required"` | ||
19 | + // 公司地址 | ||
20 | + Address string `cname:"公司地址" json:"address" valid:"Required"` | ||
21 | + // 所属行业 | ||
22 | + IndustryCategory string `cname:"所属行业" json:"industryCategory" valid:"Required"` | ||
23 | + // 联系人 | ||
24 | + Contacts string `cname:"联系人" json:"contacts" valid:"Required"` | ||
25 | + // 注册时间 | ||
26 | + RegisteredTime time.Time `cname:"注册时间" json:"registeredTime,omitempty"` | ||
27 | + // 注册状态 1:已注册 2:待认证 3:已认证 | ||
28 | + Status int `cname:"注册状态 1:已注册 2:待认证 3:已认证" json:"status,omitempty"` | ||
29 | +} | ||
30 | + | ||
31 | +func (createCompanyCommand *CreateCompanyCommand) Valid(validation *validation.Validation) { | ||
32 | + validation.SetError("CustomValid", "未实现的自定义认证") | ||
33 | +} | ||
34 | + | ||
35 | +func (createCompanyCommand *CreateCompanyCommand) ValidateCommand() error { | ||
36 | + valid := validation.Validation{} | ||
37 | + b, err := valid.Valid(createCompanyCommand) | ||
38 | + if err != nil { | ||
39 | + return err | ||
40 | + } | ||
41 | + if !b { | ||
42 | + elem := reflect.TypeOf(createCompanyCommand).Elem() | ||
43 | + for _, validErr := range valid.Errors { | ||
44 | + field, isExist := elem.FieldByName(validErr.Field) | ||
45 | + if isExist { | ||
46 | + return fmt.Errorf(strings.Replace(validErr.Message, validErr.Field, field.Tag.Get("cname"), -1)) | ||
47 | + } else { | ||
48 | + return fmt.Errorf(validErr.Message) | ||
49 | + } | ||
50 | + } | ||
51 | + } | ||
52 | + return nil | ||
53 | +} |
1 | +package command | ||
2 | + | ||
3 | +import ( | ||
4 | + "fmt" | ||
5 | + "reflect" | ||
6 | + "strings" | ||
7 | + | ||
8 | + "github.com/beego/beego/v2/core/validation" | ||
9 | +) | ||
10 | + | ||
11 | +type ListCompanyCustomizeMenusCommand struct { | ||
12 | + // 企业id | ||
13 | + CompanyId int64 `cname:"企业id" json:"companyId,string" valid:"Required"` | ||
14 | + // 菜单类别 web app | ||
15 | + MenuCategory string `cname:"菜单类别" json:"menuCategory,omitempty" valid:"Required"` | ||
16 | +} | ||
17 | + | ||
18 | +func (listCompanyCustomizeMenusCommand *ListCompanyCustomizeMenusCommand) Valid(validation *validation.Validation) { | ||
19 | + | ||
20 | +} | ||
21 | + | ||
22 | +func (listCompanyCustomizeMenusCommand *ListCompanyCustomizeMenusCommand) ValidateCommand() error { | ||
23 | + valid := validation.Validation{} | ||
24 | + b, err := valid.Valid(listCompanyCustomizeMenusCommand) | ||
25 | + if err != nil { | ||
26 | + return err | ||
27 | + } | ||
28 | + if !b { | ||
29 | + elem := reflect.TypeOf(listCompanyCustomizeMenusCommand).Elem() | ||
30 | + for _, validErr := range valid.Errors { | ||
31 | + field, isExist := elem.FieldByName(validErr.Field) | ||
32 | + if isExist { | ||
33 | + return fmt.Errorf(strings.Replace(validErr.Message, validErr.Field, field.Tag.Get("cname"), -1)) | ||
34 | + } else { | ||
35 | + return fmt.Errorf(validErr.Message) | ||
36 | + } | ||
37 | + } | ||
38 | + } | ||
39 | + return nil | ||
40 | +} |
1 | +package command | ||
2 | + | ||
3 | +import ( | ||
4 | + "fmt" | ||
5 | + "reflect" | ||
6 | + "strings" | ||
7 | + | ||
8 | + "github.com/beego/beego/v2/core/validation" | ||
9 | +) | ||
10 | + | ||
11 | +type RemoveCompanyCommand struct { | ||
12 | + // 企业id | ||
13 | + CompanyId int64 `cname:"企业id" json:"companyId,string" valid:"Required"` | ||
14 | +} | ||
15 | + | ||
16 | +func (removeCompanyCommand *RemoveCompanyCommand) Valid(validation *validation.Validation) { | ||
17 | + validation.SetError("CustomValid", "未实现的自定义认证") | ||
18 | +} | ||
19 | + | ||
20 | +func (removeCompanyCommand *RemoveCompanyCommand) ValidateCommand() error { | ||
21 | + valid := validation.Validation{} | ||
22 | + b, err := valid.Valid(removeCompanyCommand) | ||
23 | + if err != nil { | ||
24 | + return err | ||
25 | + } | ||
26 | + if !b { | ||
27 | + elem := reflect.TypeOf(removeCompanyCommand).Elem() | ||
28 | + for _, validErr := range valid.Errors { | ||
29 | + field, isExist := elem.FieldByName(validErr.Field) | ||
30 | + if isExist { | ||
31 | + return fmt.Errorf(strings.Replace(validErr.Message, validErr.Field, field.Tag.Get("cname"), -1)) | ||
32 | + } else { | ||
33 | + return fmt.Errorf(validErr.Message) | ||
34 | + } | ||
35 | + } | ||
36 | + } | ||
37 | + return nil | ||
38 | +} |
1 | +package command | ||
2 | + | ||
3 | +import ( | ||
4 | + "fmt" | ||
5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | ||
6 | + "reflect" | ||
7 | + "strings" | ||
8 | + | ||
9 | + "github.com/beego/beego/v2/core/validation" | ||
10 | +) | ||
11 | + | ||
12 | +type UpdateCompanyCommand struct { | ||
13 | + //操作人 | ||
14 | + Operator domain.Operator `json:"-"` | ||
15 | + // 企业名称 | ||
16 | + CompanyName string `cname:"企业名称" json:"companyName" valid:"Required"` | ||
17 | + // 公司地址 | ||
18 | + Address string `cname:"公司地址" json:"address" valid:"Required"` | ||
19 | + // 系统名称 | ||
20 | + SystemName string `cname:"系统名称" json:"systemName" valid:"Required"` | ||
21 | + // 公司Logo地址 | ||
22 | + Logo string `cname:"公司Logo地址" json:"logo" valid:"Required"` | ||
23 | +} | ||
24 | + | ||
25 | +func (updateCompanyCommand *UpdateCompanyCommand) Valid(validation *validation.Validation) { | ||
26 | + validation.SetError("CustomValid", "未实现的自定义认证") | ||
27 | +} | ||
28 | + | ||
29 | +func (updateCompanyCommand *UpdateCompanyCommand) ValidateCommand() error { | ||
30 | + valid := validation.Validation{} | ||
31 | + b, err := valid.Valid(updateCompanyCommand) | ||
32 | + if err != nil { | ||
33 | + return err | ||
34 | + } | ||
35 | + if !b { | ||
36 | + elem := reflect.TypeOf(updateCompanyCommand).Elem() | ||
37 | + for _, validErr := range valid.Errors { | ||
38 | + field, isExist := elem.FieldByName(validErr.Field) | ||
39 | + if isExist { | ||
40 | + return fmt.Errorf(strings.Replace(validErr.Message, validErr.Field, field.Tag.Get("cname"), -1)) | ||
41 | + } else { | ||
42 | + return fmt.Errorf(validErr.Message) | ||
43 | + } | ||
44 | + } | ||
45 | + } | ||
46 | + return nil | ||
47 | +} |
1 | +package command | ||
2 | + | ||
3 | +import ( | ||
4 | + "fmt" | ||
5 | + "reflect" | ||
6 | + "strings" | ||
7 | + | ||
8 | + "github.com/beego/beego/v2/core/validation" | ||
9 | +) | ||
10 | + | ||
11 | +type UpdateCompanyCustomizeMenusCommand struct { | ||
12 | + // 企业id | ||
13 | + CompanyId int64 `cname:"企业id" json:"companyId" valid:"Required"` | ||
14 | + // 菜单编号 | ||
15 | + MenuId int64 `cname:"菜单编号" json:"menuId" valid:"Required"` | ||
16 | + // 菜单名称 | ||
17 | + //MenuName string `cname:"菜单名称" json:"menuName" valid:"Required"` | ||
18 | + // 菜单别名 | ||
19 | + MenuAlias string `cname:"菜单别名" json:"menuAlias" valid:"Required"` | ||
20 | + // 排序 | ||
21 | + Sort int `cname:"排序" json:"sort" valid:"Required"` | ||
22 | +} | ||
23 | + | ||
24 | +func (updateCompanyCustomizeMenusCommand *UpdateCompanyCustomizeMenusCommand) Valid(validation *validation.Validation) { | ||
25 | + //validation.SetError("CustomValid", "未实现的自定义认证") | ||
26 | +} | ||
27 | + | ||
28 | +func (updateCompanyCustomizeMenusCommand *UpdateCompanyCustomizeMenusCommand) ValidateCommand() error { | ||
29 | + valid := validation.Validation{} | ||
30 | + b, err := valid.Valid(updateCompanyCustomizeMenusCommand) | ||
31 | + if err != nil { | ||
32 | + return err | ||
33 | + } | ||
34 | + if !b { | ||
35 | + elem := reflect.TypeOf(updateCompanyCustomizeMenusCommand).Elem() | ||
36 | + for _, validErr := range valid.Errors { | ||
37 | + field, isExist := elem.FieldByName(validErr.Field) | ||
38 | + if isExist { | ||
39 | + return fmt.Errorf(strings.Replace(validErr.Message, validErr.Field, field.Tag.Get("cname"), -1)) | ||
40 | + } else { | ||
41 | + return fmt.Errorf(validErr.Message) | ||
42 | + } | ||
43 | + } | ||
44 | + } | ||
45 | + return nil | ||
46 | +} |
1 | +package query | ||
2 | + | ||
3 | +import ( | ||
4 | + "fmt" | ||
5 | + "reflect" | ||
6 | + "strings" | ||
7 | + | ||
8 | + "github.com/beego/beego/v2/core/validation" | ||
9 | +) | ||
10 | + | ||
11 | +type GetCompanyQuery struct { | ||
12 | + // 企业id | ||
13 | + CompanyId int64 `cname:"企业id" json:"companyId,string" valid:"Required"` | ||
14 | +} | ||
15 | + | ||
16 | +func (getCompanyQuery *GetCompanyQuery) Valid(validation *validation.Validation) { | ||
17 | + validation.SetError("CustomValid", "未实现的自定义认证") | ||
18 | +} | ||
19 | + | ||
20 | +func (getCompanyQuery *GetCompanyQuery) ValidateQuery() error { | ||
21 | + valid := validation.Validation{} | ||
22 | + b, err := valid.Valid(getCompanyQuery) | ||
23 | + if err != nil { | ||
24 | + return err | ||
25 | + } | ||
26 | + if !b { | ||
27 | + elem := reflect.TypeOf(getCompanyQuery).Elem() | ||
28 | + for _, validErr := range valid.Errors { | ||
29 | + field, isExist := elem.FieldByName(validErr.Field) | ||
30 | + if isExist { | ||
31 | + return fmt.Errorf(strings.Replace(validErr.Message, validErr.Field, field.Tag.Get("cname"), -1)) | ||
32 | + } else { | ||
33 | + return fmt.Errorf(validErr.Message) | ||
34 | + } | ||
35 | + } | ||
36 | + } | ||
37 | + return nil | ||
38 | +} |
1 | +package query | ||
2 | + | ||
3 | +import ( | ||
4 | + "fmt" | ||
5 | + "reflect" | ||
6 | + "strings" | ||
7 | + | ||
8 | + "github.com/beego/beego/v2/core/validation" | ||
9 | +) | ||
10 | + | ||
11 | +type ListCompanyQuery struct { | ||
12 | + // 查询偏离量 | ||
13 | + Offset int `cname:"查询偏离量" json:"offset" valid:"Required"` | ||
14 | + // 查询限制 | ||
15 | + Limit int `cname:"查询限制" json:"limit" valid:"Required"` | ||
16 | +} | ||
17 | + | ||
18 | +func (listCompanyQuery *ListCompanyQuery) Valid(validation *validation.Validation) { | ||
19 | + validation.SetError("CustomValid", "未实现的自定义认证") | ||
20 | +} | ||
21 | + | ||
22 | +func (listCompanyQuery *ListCompanyQuery) ValidateQuery() error { | ||
23 | + valid := validation.Validation{} | ||
24 | + b, err := valid.Valid(listCompanyQuery) | ||
25 | + if err != nil { | ||
26 | + return err | ||
27 | + } | ||
28 | + if !b { | ||
29 | + elem := reflect.TypeOf(listCompanyQuery).Elem() | ||
30 | + for _, validErr := range valid.Errors { | ||
31 | + field, isExist := elem.FieldByName(validErr.Field) | ||
32 | + if isExist { | ||
33 | + return fmt.Errorf(strings.Replace(validErr.Message, validErr.Field, field.Tag.Get("cname"), -1)) | ||
34 | + } else { | ||
35 | + return fmt.Errorf(validErr.Message) | ||
36 | + } | ||
37 | + } | ||
38 | + } | ||
39 | + return nil | ||
40 | +} |
1 | +package service | ||
2 | + | ||
3 | +import ( | ||
4 | + "github.com/linmadan/egglib-go/core/application" | ||
5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/company/command" | ||
6 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/company/query" | ||
7 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user" | ||
8 | +) | ||
9 | + | ||
10 | +// 企业 | ||
11 | +type CompanyService struct { | ||
12 | +} | ||
13 | + | ||
14 | +// 创建企业 | ||
15 | +func (companyService *CompanyService) CreateCompany(createCompanyCommand *command.CreateCompanyCommand) (interface{}, error) { | ||
16 | + return nil, nil | ||
17 | +} | ||
18 | + | ||
19 | +// 返回企业 | ||
20 | +func (companyService *CompanyService) GetCompany(getCompanyQuery *query.GetCompanyQuery) (interface{}, error) { | ||
21 | + return nil, nil | ||
22 | +} | ||
23 | + | ||
24 | +// 返回企业列表 | ||
25 | +func (companyService *CompanyService) ListCompany(listCompanyQuery *query.ListCompanyQuery) (interface{}, error) { | ||
26 | + return nil, nil | ||
27 | +} | ||
28 | + | ||
29 | +// 返回自定义菜单列表(匹配有设置的菜单) | ||
30 | +func (companyService *CompanyService) ListCompanyCustomizeMenus(listCompanyCustomizeMenusCommand *command.ListCompanyCustomizeMenusCommand) (interface{}, error) { | ||
31 | + return nil, nil | ||
32 | +} | ||
33 | + | ||
34 | +// 移除企业 | ||
35 | +func (companyService *CompanyService) RemoveCompany(removeCompanyCommand *command.RemoveCompanyCommand) (interface{}, error) { | ||
36 | + return nil, nil | ||
37 | +} | ||
38 | + | ||
39 | +// 更新企业 | ||
40 | +func (companyService *CompanyService) UpdateCompany(updateCompanyCommand *command.UpdateCompanyCommand) (interface{}, error) { | ||
41 | + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(updateCompanyCommand.Operator) | ||
42 | + _, err := creationUserGateway.CompanyUpdate(allied_creation_user.ReqCompanyUpdate{ | ||
43 | + CompanyId: updateCompanyCommand.Operator.CompanyId, | ||
44 | + CompanyName: updateCompanyCommand.CompanyName, | ||
45 | + Address: updateCompanyCommand.Address, | ||
46 | + SystemName: updateCompanyCommand.SystemName, | ||
47 | + Logo: updateCompanyCommand.Logo, | ||
48 | + }) | ||
49 | + if err != nil { | ||
50 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
51 | + } | ||
52 | + return updateCompanyCommand, nil | ||
53 | +} | ||
54 | + | ||
55 | +// 更新自定义菜单 | ||
56 | +func (companyService *CompanyService) UpdateCompanyCustomizeMenus(updateCompanyCustomizeMenusCommand *command.UpdateCompanyCustomizeMenusCommand) (interface{}, error) { | ||
57 | + return nil, nil | ||
58 | +} | ||
59 | + | ||
60 | +func NewCompanyService(options map[string]interface{}) *CompanyService { | ||
61 | + newCompanyService := &CompanyService{} | ||
62 | + return newCompanyService | ||
63 | +} |
@@ -12,7 +12,11 @@ type ( | @@ -12,7 +12,11 @@ type ( | ||
12 | //更新企业 | 12 | //更新企业 |
13 | type ( | 13 | type ( |
14 | ReqCompanyUpdate struct { | 14 | ReqCompanyUpdate struct { |
15 | - CompanyId int64 | 15 | + CompanyId int64 |
16 | + CompanyName string `json:"companyName"` | ||
17 | + Address string `json:"address"` | ||
18 | + SystemName string `json:"systemName"` | ||
19 | + Logo string `json:"logo"` | ||
16 | } | 20 | } |
17 | 21 | ||
18 | DataCompanyUpdate struct { | 22 | DataCompanyUpdate struct { |
@@ -31,6 +31,9 @@ type UserDetail struct { | @@ -31,6 +31,9 @@ type UserDetail struct { | ||
31 | IndustryCategory string `json:"industryCategory"` | 31 | IndustryCategory string `json:"industryCategory"` |
32 | RegisteredTime time.Time `json:"registeredTime"` | 32 | RegisteredTime time.Time `json:"registeredTime"` |
33 | Status int64 `json:"status"` | 33 | Status int64 `json:"status"` |
34 | + Log string `json:"log"` | ||
35 | + Address string `json:"address"` | ||
36 | + SystemName string `json:"systemName"` | ||
34 | } `json:"company,omitempty"` | 37 | } `json:"company,omitempty"` |
35 | Org *struct { | 38 | Org *struct { |
36 | OrgId int `json:"orgId"` | 39 | OrgId int `json:"orgId"` |
@@ -55,6 +58,11 @@ type UserDetail struct { | @@ -55,6 +58,11 @@ type UserDetail struct { | ||
55 | DeletedAt time.Time `json:"deletedAt"` | 58 | DeletedAt time.Time `json:"deletedAt"` |
56 | OrgName string `json:"orgName"` | 59 | OrgName string `json:"orgName"` |
57 | } `json:"userOrg"` | 60 | } `json:"userOrg"` |
61 | + IM struct { | ||
62 | + Accid string `json:"accid"` | ||
63 | + ImToken string `json:"imToken"` | ||
64 | + CsAccountID string `json:"csAccountId"` | ||
65 | + } `json:"im"` | ||
58 | } | 66 | } |
59 | 67 | ||
60 | //搜索用户列表 | 68 | //搜索用户列表 |
@@ -64,6 +72,8 @@ type ( | @@ -64,6 +72,8 @@ type ( | ||
64 | Offset int `json:"offset"` | 72 | Offset int `json:"offset"` |
65 | // 查询限制 | 73 | // 查询限制 |
66 | Limit int `json:"limit"` | 74 | Limit int `json:"limit"` |
75 | + // 用户基础id | ||
76 | + UserBaseId int64 ` json:"userBaseId"` | ||
67 | // 企业id | 77 | // 企业id |
68 | CompanyId int64 ` json:"companyId"` | 78 | CompanyId int64 ` json:"companyId"` |
69 | // 组织ID | 79 | // 组织ID |
@@ -44,3 +44,42 @@ func (controller *AuthController) RefreshAuthAccessToken() { | @@ -44,3 +44,42 @@ func (controller *AuthController) RefreshAuthAccessToken() { | ||
44 | data, err := authService.RefreshAuthAccessToken(refreshTokenCmd) | 44 | data, err := authService.RefreshAuthAccessToken(refreshTokenCmd) |
45 | controller.Response(data, err) | 45 | controller.Response(data, err) |
46 | } | 46 | } |
47 | + | ||
48 | +func (controller *AuthController) GetUserInfo() { | ||
49 | + authService := service.AuthService{} | ||
50 | + userInfoCommand := &command.UserInfoCommand{} | ||
51 | + err := controller.Unmarshal(userInfoCommand) | ||
52 | + if err != nil { | ||
53 | + controller.Response(nil, err) | ||
54 | + return | ||
55 | + } | ||
56 | + userInfoCommand.Operator = controller.GetOperator() | ||
57 | + data, err := authService.GetUserInfo(userInfoCommand) | ||
58 | + controller.Response(data, err) | ||
59 | +} | ||
60 | + | ||
61 | +func (controller *AuthController) GetUserMenus() { | ||
62 | + authService := service.AuthService{} | ||
63 | + userMenusCommand := &command.UserMenusCommand{} | ||
64 | + err := controller.Unmarshal(userMenusCommand) | ||
65 | + if err != nil { | ||
66 | + controller.Response(nil, err) | ||
67 | + return | ||
68 | + } | ||
69 | + userMenusCommand.Operator = controller.GetOperator() | ||
70 | + data, err := authService.GetUserMenus(userMenusCommand) | ||
71 | + controller.Response(data, err) | ||
72 | +} | ||
73 | + | ||
74 | +func (controller *AuthController) GetUserOrg() { | ||
75 | + authService := service.AuthService{} | ||
76 | + userOrgCommand := &command.UserOrgCommand{} | ||
77 | + err := controller.Unmarshal(userOrgCommand) | ||
78 | + if err != nil { | ||
79 | + controller.Response(nil, err) | ||
80 | + return | ||
81 | + } | ||
82 | + userOrgCommand.Operator = controller.GetOperator() | ||
83 | + data, err := authService.GetUserOrg(userOrgCommand) | ||
84 | + controller.Response(data, err) | ||
85 | +} |
1 | +package web_client | ||
2 | + | ||
3 | +import ( | ||
4 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/company/command" | ||
5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/company/query" | ||
6 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/company/service" | ||
7 | +) | ||
8 | + | ||
9 | +type CompanyController struct { | ||
10 | + baseController | ||
11 | +} | ||
12 | + | ||
13 | +func (controller *CompanyController) CreateCompany() { | ||
14 | + companyService := service.NewCompanyService(nil) | ||
15 | + createCompanyCommand := &command.CreateCompanyCommand{} | ||
16 | + controller.Unmarshal(createCompanyCommand) | ||
17 | + data, err := companyService.CreateCompany(createCompanyCommand) | ||
18 | + controller.Response(data, err) | ||
19 | +} | ||
20 | + | ||
21 | +func (controller *CompanyController) UpdateCompany() { | ||
22 | + companyService := service.NewCompanyService(nil) | ||
23 | + updateCompanyCommand := &command.UpdateCompanyCommand{} | ||
24 | + controller.Unmarshal(updateCompanyCommand) | ||
25 | + updateCompanyCommand.Operator = controller.GetOperator() | ||
26 | + data, err := companyService.UpdateCompany(updateCompanyCommand) | ||
27 | + controller.Response(data, err) | ||
28 | +} | ||
29 | + | ||
30 | +func (controller *CompanyController) GetCompany() { | ||
31 | + companyService := service.NewCompanyService(nil) | ||
32 | + getCompanyQuery := &query.GetCompanyQuery{} | ||
33 | + companyId, _ := controller.GetInt64(":companyId") | ||
34 | + getCompanyQuery.CompanyId = companyId | ||
35 | + data, err := companyService.GetCompany(getCompanyQuery) | ||
36 | + controller.Response(data, err) | ||
37 | +} | ||
38 | + | ||
39 | +func (controller *CompanyController) RemoveCompany() { | ||
40 | + companyService := service.NewCompanyService(nil) | ||
41 | + removeCompanyCommand := &command.RemoveCompanyCommand{} | ||
42 | + controller.Unmarshal(removeCompanyCommand) | ||
43 | + companyId, _ := controller.GetInt64(":companyId") | ||
44 | + removeCompanyCommand.CompanyId = companyId | ||
45 | + data, err := companyService.RemoveCompany(removeCompanyCommand) | ||
46 | + controller.Response(data, err) | ||
47 | +} | ||
48 | + | ||
49 | +func (controller *CompanyController) ListCompany() { | ||
50 | + companyService := service.NewCompanyService(nil) | ||
51 | + listCompanyQuery := &query.ListCompanyQuery{} | ||
52 | + data, err := companyService.ListCompany(listCompanyQuery) | ||
53 | + controller.Response(data, err) | ||
54 | +} | ||
55 | + | ||
56 | +func (controller *CompanyController) ListCompanyCustomizeMenus() { | ||
57 | + companyService := service.NewCompanyService(nil) | ||
58 | + listCompanyCustomizeMenusCommand := &command.ListCompanyCustomizeMenusCommand{} | ||
59 | + controller.Unmarshal(listCompanyCustomizeMenusCommand) | ||
60 | + companyId, _ := controller.GetInt64(":companyId") | ||
61 | + listCompanyCustomizeMenusCommand.CompanyId = companyId | ||
62 | + listCompanyCustomizeMenusCommand.MenuCategory = controller.GetString("menuCategory") | ||
63 | + data, err := companyService.ListCompanyCustomizeMenus(listCompanyCustomizeMenusCommand) | ||
64 | + controller.Response(data, err) | ||
65 | +} | ||
66 | + | ||
67 | +func (controller *CompanyController) UpdateCompanyCustomizeMenus() { | ||
68 | + companyService := service.NewCompanyService(nil) | ||
69 | + updateCompanyCustomizeMenusCommand := &command.UpdateCompanyCustomizeMenusCommand{} | ||
70 | + controller.Unmarshal(updateCompanyCustomizeMenusCommand) | ||
71 | + companyId, _ := controller.GetInt64(":companyId") | ||
72 | + updateCompanyCustomizeMenusCommand.CompanyId = companyId | ||
73 | + data, err := companyService.UpdateCompanyCustomizeMenus(updateCompanyCustomizeMenusCommand) | ||
74 | + controller.Response(data, err) | ||
75 | +} |
@@ -11,4 +11,8 @@ func init() { | @@ -11,4 +11,8 @@ func init() { | ||
11 | web.Router("/v1/app/auth/login", &mobile_client.AuthController{}, "Post:Login") | 11 | web.Router("/v1/app/auth/login", &mobile_client.AuthController{}, "Post:Login") |
12 | web.Router("/v1/app/auth/access-token", &mobile_client.AuthController{}, "Post:GetAuthAccessToken") | 12 | web.Router("/v1/app/auth/access-token", &mobile_client.AuthController{}, "Post:GetAuthAccessToken") |
13 | web.Router("/v1/app/auth/refresh-token", &mobile_client.AuthController{}, "Post:RefreshAuthAccessToken") | 13 | web.Router("/v1/app/auth/refresh-token", &mobile_client.AuthController{}, "Post:RefreshAuthAccessToken") |
14 | + | ||
15 | + web.Router("/v1/app/auth/user-info", &mobile_client.AuthController{}, "Post:GetUserInfo") | ||
16 | + web.Router("/v1/app/auth/user-menu", &mobile_client.AuthController{}, "Post:GetUserMenus") | ||
17 | + web.Router("/v1/app/auth/user-orgs", &mobile_client.AuthController{}, "Post:GetUserOrg") | ||
14 | } | 18 | } |
pkg/port/beego/routers/web_company_router.go
0 → 100644
1 | +package routers | ||
2 | + | ||
3 | +import ( | ||
4 | + "github.com/beego/beego/v2/server/web" | ||
5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/port/beego/controllers/web_client" | ||
6 | +) | ||
7 | + | ||
8 | +func init() { | ||
9 | + //web.Router("/company/", &web_client.CompanyController{}, "Post:CreateCompany") | ||
10 | + web.Router("/v1/web/company/", &web_client.CompanyController{}, "Put:UpdateCompany") | ||
11 | + //web.Router("/company/:companyId", &web_client.CompanyController{}, "Get:GetCompany") | ||
12 | + //web.Router("/company/:companyId", &web_client.CompanyController{}, "Delete:RemoveCompany") | ||
13 | + //web.Router("/company/search", &web_client.CompanyController{}, "Post:ListCompany") | ||
14 | + //web.Router("/company/:companyId/customize-menus/", &web_client.CompanyController{}, "Get:ListCompanyCustomizeMenus") | ||
15 | + //web.Router("/company/:companyId/customize-menus", &web_client.CompanyController{}, "Put:UpdateCompanyCustomizeMenus") | ||
16 | +} |
-
请 注册 或 登录 后发表评论