作者 yangfu

Merge branch 'dev' of http://gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway into dev

# Conflicts:
#	lastupdate.tmp
#	pkg/infrastructure/service_gateway/allied_creation_user/param_menu.go
正在显示 35 个修改的文件 包含 855 行增加166 行删除
1 -{"F:\\go\\src\\allied-creation\\allied-creation-gateway\\pkg\\port\\beego\\routers":1627893638439130600}  
  1 +{"F:\\go\\src\\allied-creation\\allied-creation-gateway\\pkg\\port\\beego\\routers":1627893928632951500}
@@ -14,9 +14,7 @@ type MenuService struct { @@ -14,9 +14,7 @@ type MenuService struct {
14 // 创建菜单服务 14 // 创建菜单服务
15 func (menuService *MenuService) CreateMenu(createMenuCommand *command.CreateMenuCommand) (interface{}, error) { 15 func (menuService *MenuService) CreateMenu(createMenuCommand *command.CreateMenuCommand) (interface{}, error) {
16 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 16 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
17 - createMenuCommand.Operator.CompanyId,  
18 - createMenuCommand.Operator.OrgId,  
19 - createMenuCommand.Operator.UserId) 17 + createMenuCommand.Operator)
20 result, err := creationUserGateway.MenusCreate(allied_creation_user.ReqMenus{ 18 result, err := creationUserGateway.MenusCreate(allied_creation_user.ReqMenus{
21 ParentId: createMenuCommand.ParentId, 19 ParentId: createMenuCommand.ParentId,
22 MenuName: createMenuCommand.MenuName, 20 MenuName: createMenuCommand.MenuName,
@@ -37,9 +35,7 @@ func (menuService *MenuService) CreateMenu(createMenuCommand *command.CreateMenu @@ -37,9 +35,7 @@ func (menuService *MenuService) CreateMenu(createMenuCommand *command.CreateMenu
37 // 返回菜单服务 35 // 返回菜单服务
38 func (menuService *MenuService) GetMenu(getMenuQuery *query.GetMenuQuery) (interface{}, error) { 36 func (menuService *MenuService) GetMenu(getMenuQuery *query.GetMenuQuery) (interface{}, error) {
39 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 37 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
40 - getMenuQuery.Operator.CompanyId,  
41 - getMenuQuery.Operator.OrgId,  
42 - getMenuQuery.Operator.UserId) 38 + getMenuQuery.Operator)
43 result, err := creationUserGateway.MenusGet(allied_creation_user.ReqMenusGet{ 39 result, err := creationUserGateway.MenusGet(allied_creation_user.ReqMenusGet{
44 MenuId: getMenuQuery.MenuId, 40 MenuId: getMenuQuery.MenuId,
45 }) 41 })
@@ -52,9 +48,7 @@ func (menuService *MenuService) GetMenu(getMenuQuery *query.GetMenuQuery) (inter @@ -52,9 +48,7 @@ func (menuService *MenuService) GetMenu(getMenuQuery *query.GetMenuQuery) (inter
52 // 返回菜单服务列表 48 // 返回菜单服务列表
53 func (menuService *MenuService) ListMenu(listMenuQuery *query.ListMenuQuery) (interface{}, error) { 49 func (menuService *MenuService) ListMenu(listMenuQuery *query.ListMenuQuery) (interface{}, error) {
54 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 50 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
55 - listMenuQuery.Operator.CompanyId,  
56 - listMenuQuery.Operator.OrgId,  
57 - listMenuQuery.Operator.UserId) 51 + listMenuQuery.Operator)
58 result, err := creationUserGateway.MenusSearch(allied_creation_user.ReqMenusSearch{ 52 result, err := creationUserGateway.MenusSearch(allied_creation_user.ReqMenusSearch{
59 MenuCategory: listMenuQuery.MenuCategory, 53 MenuCategory: listMenuQuery.MenuCategory,
60 ParentId: listMenuQuery.ParentId, 54 ParentId: listMenuQuery.ParentId,
@@ -75,9 +69,7 @@ func (menuService *MenuService) RemoveMenu(removeMenuCommand *command.RemoveMenu @@ -75,9 +69,7 @@ func (menuService *MenuService) RemoveMenu(removeMenuCommand *command.RemoveMenu
75 // 更新菜单服务 69 // 更新菜单服务
76 func (menuService *MenuService) UpdateMenu(updateMenuCommand *command.UpdateMenuCommand) (interface{}, error) { 70 func (menuService *MenuService) UpdateMenu(updateMenuCommand *command.UpdateMenuCommand) (interface{}, error) {
77 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 71 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
78 - updateMenuCommand.Operator.CompanyId,  
79 - updateMenuCommand.Operator.OrgId,  
80 - updateMenuCommand.Operator.UserId) 72 + updateMenuCommand.Operator)
81 result, err := creationUserGateway.MenusUpdate(allied_creation_user.ReqMenusUpdate{ 73 result, err := creationUserGateway.MenusUpdate(allied_creation_user.ReqMenusUpdate{
82 MenuId: updateMenuCommand.MenuId, 74 MenuId: updateMenuCommand.MenuId,
83 ParentId: updateMenuCommand.ParentId, 75 ParentId: updateMenuCommand.ParentId,
@@ -99,9 +91,7 @@ func (menuService *MenuService) UpdateMenu(updateMenuCommand *command.UpdateMenu @@ -99,9 +91,7 @@ func (menuService *MenuService) UpdateMenu(updateMenuCommand *command.UpdateMenu
99 // 批量删除菜单 91 // 批量删除菜单
100 func (menuService *MenuService) BatchDeleteMenu(batchDeleteMenu *command.BatchDeleteMenuCommand) (interface{}, error) { 92 func (menuService *MenuService) BatchDeleteMenu(batchDeleteMenu *command.BatchDeleteMenuCommand) (interface{}, error) {
101 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 93 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
102 - batchDeleteMenu.Operator.CompanyId,  
103 - batchDeleteMenu.Operator.OrgId,  
104 - batchDeleteMenu.Operator.UserId) 94 + batchDeleteMenu.Operator)
105 result, err := creationUserGateway.MenusBatchDelete(allied_creation_user.ReqMenusBatchDelete{ 95 result, err := creationUserGateway.MenusBatchDelete(allied_creation_user.ReqMenusBatchDelete{
106 MenuIds: batchDeleteMenu.MenuIds, 96 MenuIds: batchDeleteMenu.MenuIds,
107 }) 97 })
@@ -114,9 +104,7 @@ func (menuService *MenuService) BatchDeleteMenu(batchDeleteMenu *command.BatchDe @@ -114,9 +104,7 @@ func (menuService *MenuService) BatchDeleteMenu(batchDeleteMenu *command.BatchDe
114 // 批量启用菜单 104 // 批量启用菜单
115 func (menuService *MenuService) BatchEnableMenu(batchEnableMenu *command.BatchEnableMenuCommand) (interface{}, error) { 105 func (menuService *MenuService) BatchEnableMenu(batchEnableMenu *command.BatchEnableMenuCommand) (interface{}, error) {
116 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 106 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
117 - batchEnableMenu.Operator.CompanyId,  
118 - batchEnableMenu.Operator.OrgId,  
119 - batchEnableMenu.Operator.UserId) 107 + batchEnableMenu.Operator)
120 result, err := creationUserGateway.MenusBatchEnable(allied_creation_user.ReqMenusBatchEnable{ 108 result, err := creationUserGateway.MenusBatchEnable(allied_creation_user.ReqMenusBatchEnable{
121 MenuIds: batchEnableMenu.MenuIds, 109 MenuIds: batchEnableMenu.MenuIds,
122 Status: batchEnableMenu.Status, 110 Status: batchEnableMenu.Status,
@@ -4,6 +4,7 @@ import ( @@ -4,6 +4,7 @@ import (
4 "github.com/linmadan/egglib-go/core/application" 4 "github.com/linmadan/egglib-go/core/application"
5 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/common/command" 5 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/common/command"
6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/common/query" 6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/common/query"
  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_basic" 8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_basic"
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 )
@@ -17,7 +18,7 @@ func NewCommonService(options map[string]interface{}) *CommonService { @@ -17,7 +18,7 @@ func NewCommonService(options map[string]interface{}) *CommonService {
17 18
18 //GetDictionaryByCode 根据code获取字典数据 19 //GetDictionaryByCode 根据code获取字典数据
19 func (srv *CommonService) GetDictionaryByCode(getDictionaryQuery *query.GetDictionaryByCodeQuery) (interface{}, error) { 20 func (srv *CommonService) GetDictionaryByCode(getDictionaryQuery *query.GetDictionaryByCodeQuery) (interface{}, error) {
20 - creationBasicGateway := allied_creation_basic.NewHttplibAlliedCreationBasic() 21 + creationBasicGateway := allied_creation_basic.NewHttplibAlliedCreationBasic(domain.Operator{})
21 result, err := creationBasicGateway.GetDictionarysByCode(allied_creation_basic.ReqGetDictionaryByCode{ 22 result, err := creationBasicGateway.GetDictionarysByCode(allied_creation_basic.ReqGetDictionaryByCode{
22 DictCode: getDictionaryQuery.DictCode, 23 DictCode: getDictionaryQuery.DictCode,
23 }) 24 })
@@ -33,7 +34,7 @@ func (srv *CommonService) CompanySignUp(signUpCommand *command.CompanySignUpComm @@ -33,7 +34,7 @@ func (srv *CommonService) CompanySignUp(signUpCommand *command.CompanySignUpComm
33 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 34 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
34 } 35 }
35 //校验验证码 36 //校验验证码
36 - creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(0, 0, 0) 37 + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(domain.Operator{})
37 _, err := creationUserGateway.AuthCompanySignUp(allied_creation_user.ReqAuthCompanySignUp{ 38 _, err := creationUserGateway.AuthCompanySignUp(allied_creation_user.ReqAuthCompanySignUp{
38 CompanyName: signUpCommand.CompanyName, 39 CompanyName: signUpCommand.CompanyName,
39 Contacts: signUpCommand.Contacts, 40 Contacts: signUpCommand.Contacts,
@@ -10,6 +10,7 @@ import ( @@ -10,6 +10,7 @@ import (
10 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" 10 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
11 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/cache" 11 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/cache"
12 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user" 12 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
  13 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/sms_serve"
13 ) 14 )
14 15
15 // 组织管理 16 // 组织管理
@@ -26,6 +27,7 @@ func (srv AuthService) AuthLogin(loginCommand *command.LoginCommand) (interface{ @@ -26,6 +27,7 @@ func (srv AuthService) AuthLogin(loginCommand *command.LoginCommand) (interface{
26 case "signInPassword": 27 case "signInPassword":
27 result, err = srv.SignInPassword(loginCommand.Phone, loginCommand.Password) 28 result, err = srv.SignInPassword(loginCommand.Phone, loginCommand.Password)
28 case "signInCaptcha": 29 case "signInCaptcha":
  30 + result, err = srv.SignInCaptcha(loginCommand.Phone, loginCommand.Captcha)
29 default: 31 default:
30 err = errors.New("登录方式无法解析") 32 err = errors.New("登录方式无法解析")
31 } 33 }
@@ -34,7 +36,7 @@ func (srv AuthService) AuthLogin(loginCommand *command.LoginCommand) (interface{ @@ -34,7 +36,7 @@ func (srv AuthService) AuthLogin(loginCommand *command.LoginCommand) (interface{
34 36
35 //SignInPassword 使用账号密码校验 37 //SignInPassword 使用账号密码校验
36 func (srv AuthService) SignInPassword(account string, password string) (interface{}, error) { 38 func (srv AuthService) SignInPassword(account string, password string) (interface{}, error) {
37 - creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(0, 0, 0) 39 + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(domain.Operator{})
38 _, err := creationUserGateway.AuthCheckPassword(allied_creation_user.ReqAuthCheckPassword{ 40 _, err := creationUserGateway.AuthCheckPassword(allied_creation_user.ReqAuthCheckPassword{
39 Password: password, 41 Password: password,
40 Phone: account, 42 Phone: account,
@@ -60,7 +62,25 @@ func (srv AuthService) SignInPassword(account string, password string) (interfac @@ -60,7 +62,25 @@ func (srv AuthService) SignInPassword(account string, password string) (interfac
60 62
61 //SignInCaptcha 使用手机验证码登录 63 //SignInCaptcha 使用手机验证码登录
62 func (srv AuthService) SignInCaptcha(phone string, captcha string) (interface{}, error) { 64 func (srv AuthService) SignInCaptcha(phone string, captcha string) (interface{}, error) {
63 - return nil, nil 65 + smsServeGateway := sms_serve.NewHttplibHttplibSmsServe()
  66 + err := smsServeGateway.CheckSmsCode(phone, captcha)
  67 + if err != nil {
  68 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  69 + }
  70 + ltoken := domain.LoginToken{
  71 + UserId: 0,
  72 + Account: phone,
  73 + Platform: domain.LoginPlatformApp,
  74 + CompanyId: 0,
  75 + }
  76 + authcode, err := ltoken.GenerateAuthCode()
  77 + if err != nil {
  78 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  79 + }
  80 + result := map[string]string{
  81 + "authCode": authcode,
  82 + }
  83 + return result, nil
64 } 84 }
65 85
66 //GetAuthAccessToken 获取令牌Token 86 //GetAuthAccessToken 获取令牌Token
@@ -74,7 +94,7 @@ func (srv AuthService) GetAuthAccessToken(accessTokenCommand *command.AccessToke @@ -74,7 +94,7 @@ func (srv AuthService) GetAuthAccessToken(accessTokenCommand *command.AccessToke
74 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 94 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
75 } 95 }
76 phone := ltoken.Account 96 phone := ltoken.Account
77 - creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(0, 0, 0) 97 + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(domain.Operator{})
78 userSeachResult, err := creationUserGateway.UserSearch(allied_creation_user.ReqUserSearch{ 98 userSeachResult, err := creationUserGateway.UserSearch(allied_creation_user.ReqUserSearch{
79 Phone: phone, 99 Phone: phone,
80 }) 100 })
@@ -153,7 +173,7 @@ loopUser1: @@ -153,7 +173,7 @@ loopUser1:
153 } 173 }
154 } 174 }
155 } 175 }
156 - //TODO 176 +
157 loginToken := domain.LoginToken{ 177 loginToken := domain.LoginToken{
158 UserId: currentAccess.UserId, 178 UserId: currentAccess.UserId,
159 Account: currentAccess.Account, 179 Account: currentAccess.Account,
@@ -206,7 +226,7 @@ func (srv AuthService) RefreshAuthAccessToken(refreshTokenCommand *command.Refre @@ -206,7 +226,7 @@ func (srv AuthService) RefreshAuthAccessToken(refreshTokenCommand *command.Refre
206 return nil, application.ThrowError(application.TRANSACTION_ERROR, "refreshToken 不可用,"+err.Error()) 226 return nil, application.ThrowError(application.TRANSACTION_ERROR, "refreshToken 不可用,"+err.Error())
207 } 227 }
208 phone := ltoken.Account 228 phone := ltoken.Account
209 - creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(0, 0, 0) 229 + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(domain.Operator{})
210 userSeachResult, err := creationUserGateway.UserSearch(allied_creation_user.ReqUserSearch{ 230 userSeachResult, err := creationUserGateway.UserSearch(allied_creation_user.ReqUserSearch{
211 Phone: phone, 231 Phone: phone,
212 }) 232 })
  1 +package command
  2 +
  3 +import (
  4 + "fmt"
  5 +
  6 + "github.com/beego/beego/v2/core/validation"
  7 +)
  8 +
  9 +type SendSmsCodeCommand struct {
  10 + Phone string `json:"phone" valid:"Required"`
  11 +}
  12 +
  13 +func (orgAddCommand *SendSmsCodeCommand) Valid(validation *validation.Validation) {
  14 +
  15 +}
  16 +
  17 +func (orgAddCommand *SendSmsCodeCommand) ValidateCommand() error {
  18 + valid := validation.Validation{}
  19 + b, err := valid.Valid(orgAddCommand)
  20 + if err != nil {
  21 + return err
  22 + }
  23 + if !b {
  24 + for _, validErr := range valid.Errors {
  25 + return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
  26 + }
  27 + }
  28 + return nil
  29 +}
1 package service 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/mobile/user/command"
  6 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/sms_serve"
  7 +)
  8 +
  9 +type UserService struct {
  10 +}
  11 +
  12 +//SendSmsCaptcha 发送验证码短信
  13 +func (srv UserService) SendSmsCaptcha(smsCodeCommand *command.SendSmsCodeCommand) error {
  14 + smsServeGateway := sms_serve.NewHttplibHttplibSmsServe()
  15 + err := smsServeGateway.SendSms(smsCodeCommand.Phone)
  16 + if err != nil {
  17 + return application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  18 + }
  19 + return nil
  20 +}
@@ -7,6 +7,7 @@ import ( @@ -7,6 +7,7 @@ import (
7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" 7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
8 ) 8 )
9 9
  10 +//更新自定义菜单
10 type MenuUpdateCommand struct { 11 type MenuUpdateCommand struct {
11 //操作人 12 //操作人
12 Operator domain.Operator `json:"-"` 13 Operator domain.Operator `json:"-"`
@@ -7,6 +7,7 @@ import ( @@ -7,6 +7,7 @@ import (
7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" 7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
8 ) 8 )
9 9
  10 +//获取自定义菜单列表
10 type MenuListQuery struct { 11 type MenuListQuery struct {
11 //操作人 12 //操作人
12 Operator domain.Operator `json:"-"` 13 Operator domain.Operator `json:"-"`
@@ -14,9 +14,8 @@ type MenuService struct { @@ -14,9 +14,8 @@ type MenuService struct {
14 // 设置收藏菜单 14 // 设置收藏菜单
15 func (menuService *MenuService) MenuFavorite(menuFavoriteCommand *command.MenuFavoriteCommand) (interface{}, error) { 15 func (menuService *MenuService) MenuFavorite(menuFavoriteCommand *command.MenuFavoriteCommand) (interface{}, error) {
16 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 16 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
17 - menuFavoriteCommand.Operator.CompanyId,  
18 - menuFavoriteCommand.Operator.OrgId,  
19 - menuFavoriteCommand.Operator.UserId) 17 + menuFavoriteCommand.Operator,
  18 + )
20 result, err := creationUserGateway.CompanyGetCustomizeMenus(allied_creation_user.ReqCompanyGetCustomizeMenus{ 19 result, err := creationUserGateway.CompanyGetCustomizeMenus(allied_creation_user.ReqCompanyGetCustomizeMenus{
21 CompanyId: menuFavoriteCommand.Operator.CompanyId, 20 CompanyId: menuFavoriteCommand.Operator.CompanyId,
22 }) 21 })
@@ -29,9 +28,8 @@ func (menuService *MenuService) MenuFavorite(menuFavoriteCommand *command.MenuFa @@ -29,9 +28,8 @@ func (menuService *MenuService) MenuFavorite(menuFavoriteCommand *command.MenuFa
29 // 返回菜单列表 28 // 返回菜单列表
30 func (menuService *MenuService) MenuList(menuListQuery *query.MenuListQuery) (interface{}, error) { 29 func (menuService *MenuService) MenuList(menuListQuery *query.MenuListQuery) (interface{}, error) {
31 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 30 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
32 - menuListQuery.Operator.CompanyId,  
33 - menuListQuery.Operator.OrgId,  
34 - menuListQuery.Operator.UserId) 31 + menuListQuery.Operator,
  32 + )
35 result, err := creationUserGateway.CompanyGetCustomizeMenus(allied_creation_user.ReqCompanyGetCustomizeMenus{ 33 result, err := creationUserGateway.CompanyGetCustomizeMenus(allied_creation_user.ReqCompanyGetCustomizeMenus{
36 CompanyId: menuListQuery.Operator.CompanyId, 34 CompanyId: menuListQuery.Operator.CompanyId,
37 MenuCategory: menuListQuery.MenuCategory, 35 MenuCategory: menuListQuery.MenuCategory,
@@ -44,12 +42,11 @@ func (menuService *MenuService) MenuList(menuListQuery *query.MenuListQuery) (in @@ -44,12 +42,11 @@ func (menuService *MenuService) MenuList(menuListQuery *query.MenuListQuery) (in
44 }, nil 42 }, nil
45 } 43 }
46 44
47 -// 更新菜单 45 +// 更新自定义菜单
48 func (menuService *MenuService) MenuUpdate(menuUpdateCommand *command.MenuUpdateCommand) (interface{}, error) { 46 func (menuService *MenuService) MenuUpdate(menuUpdateCommand *command.MenuUpdateCommand) (interface{}, error) {
49 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 47 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
50 - menuUpdateCommand.Operator.CompanyId,  
51 - menuUpdateCommand.Operator.OrgId,  
52 - menuUpdateCommand.Operator.UserId) 48 + menuUpdateCommand.Operator,
  49 + )
53 _, err := creationUserGateway.CompanySetCustomizeMenus(allied_creation_user.ReqCompanySetCustomizeMenus{ 50 _, err := creationUserGateway.CompanySetCustomizeMenus(allied_creation_user.ReqCompanySetCustomizeMenus{
54 CompanyId: menuUpdateCommand.Operator.CompanyId, 51 CompanyId: menuUpdateCommand.Operator.CompanyId,
55 MenuAlias: menuUpdateCommand.MenuAlias, 52 MenuAlias: menuUpdateCommand.MenuAlias,
  1 +package command
  2 +
  3 +import (
  4 + "fmt"
  5 +
  6 + "github.com/beego/beego/v2/core/validation"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
  8 +)
  9 +
  10 +type NoticeSettingAddCommand struct {
  11 + //操作人
  12 + Operator domain.Operator `json:"-"`
  13 + // 消息对应的业务模块
  14 + Module string `json:"module" valid:"Required"`
  15 + // 业务环节
  16 + ModuleAction string `json:"moduleAction" valid:"Required"`
  17 + // 是否推送 【是:1】【否:2】
  18 + IsPush int `json:"isPush" valid:"Required"`
  19 + // 内容模板
  20 + Content string `json:"content" valid:"Required"`
  21 +}
  22 +
  23 +func (noticeSettingUpdateQuery *NoticeSettingAddCommand) Valid(validation *validation.Validation) {
  24 +
  25 +}
  26 +
  27 +func (noticeSettingUpdateQuery *NoticeSettingAddCommand) ValidateCommand() error {
  28 + valid := validation.Validation{}
  29 + b, err := valid.Valid(noticeSettingUpdateQuery)
  30 + if err != nil {
  31 + return err
  32 + }
  33 + if !b {
  34 + for _, validErr := range valid.Errors {
  35 + return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
  36 + }
  37 + }
  38 + return nil
  39 +}
  1 +package command
  2 +
  3 +import (
  4 + "fmt"
  5 +
  6 + "github.com/beego/beego/v2/core/validation"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
  8 +)
  9 +
  10 +type NoticeSettingUpdateCommand struct {
  11 + //操作人
  12 + Operator domain.Operator `json:"-"`
  13 + // id
  14 + NoticeSettingId string `json:"noticeSetting"`
  15 + // 消息对应的业务模块
  16 + Module string `json:"module" valid:"Required"`
  17 + // 业务环节
  18 + ModuleAction string `json:"moduleAction" valid:"Required"`
  19 + // 是否推送 【是:1】【否:2】
  20 + IsPush int `json:"isPush" valid:"Required"`
  21 + // 内容模板
  22 + Content string `json:"content" valid:"Required"`
  23 +}
  24 +
  25 +func (noticeSettingUpdateQuery *NoticeSettingUpdateCommand) Valid(validation *validation.Validation) {
  26 +
  27 +}
  28 +
  29 +func (noticeSettingUpdateQuery *NoticeSettingUpdateCommand) ValidateCommand() error {
  30 + valid := validation.Validation{}
  31 + b, err := valid.Valid(noticeSettingUpdateQuery)
  32 + if err != nil {
  33 + return err
  34 + }
  35 + if !b {
  36 + for _, validErr := range valid.Errors {
  37 + return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
  38 + }
  39 + }
  40 + return nil
  41 +}
  1 +package query
  2 +
  3 +import (
  4 + "fmt"
  5 +
  6 + "github.com/beego/beego/v2/core/validation"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
  8 +)
  9 +
  10 +type NoticeSettingListQuery struct {
  11 + //操作人
  12 + Operator domain.Operator `json:"-"`
  13 + // 查询偏离量
  14 + PageNumber int `json:"pageNumber" valid:"Required"`
  15 + // 查询限制
  16 + PageSize int `json:"pageSize" valid:"Required"`
  17 +}
  18 +
  19 +func (noticeSettingListCommand *NoticeSettingListQuery) Valid(validation *validation.Validation) {
  20 +
  21 +}
  22 +
  23 +func (noticeSettingListCommand *NoticeSettingListQuery) ValidateQuery() error {
  24 + valid := validation.Validation{}
  25 + b, err := valid.Valid(noticeSettingListCommand)
  26 + if err != nil {
  27 + return err
  28 + }
  29 + if !b {
  30 + for _, validErr := range valid.Errors {
  31 + return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
  32 + }
  33 + }
  34 + return nil
  35 +}
  1 +package query
  2 +
  3 +import (
  4 + "fmt"
  5 +
  6 + "github.com/beego/beego/v2/core/validation"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
  8 +)
  9 +
  10 +type NoticeSettingProfileQuery struct {
  11 + //操作人
  12 + Operator domain.Operator `json:"-"`
  13 +}
  14 +
  15 +func (noticeSettingProfileQuery *NoticeSettingProfileQuery) Valid(validation *validation.Validation) {
  16 +
  17 +}
  18 +
  19 +func (noticeSettingProfileQuery *NoticeSettingProfileQuery) ValidateQuery() error {
  20 + valid := validation.Validation{}
  21 + b, err := valid.Valid(noticeSettingProfileQuery)
  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 service
  2 +
  3 +import (
  4 + "strconv"
  5 +
  6 + "github.com/linmadan/egglib-go/core/application"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/noticesetting/command"
  8 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/noticesetting/query"
  9 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_basic"
  10 +)
  11 +
  12 +// 推送消息配置
  13 +type NoticeSettingService struct {
  14 +}
  15 +
  16 +//NoticeSettingList 推送消息配置列表
  17 +func (noticeSettingService *NoticeSettingService) NoticeSettingList(noticeSettingListQuery *query.NoticeSettingListQuery) (int64, interface{}, error) {
  18 + if err := noticeSettingListQuery.ValidateQuery(); err != nil {
  19 + return 0, nil, application.ThrowError(application.ARG_ERROR, err.Error())
  20 + }
  21 + creationBasicGateway := allied_creation_basic.NewHttplibAlliedCreationBasic(
  22 + noticeSettingListQuery.Operator,
  23 + )
  24 + result, err := creationBasicGateway.NoticeSettingSearch(allied_creation_basic.ReqNoticeSettingSearch{
  25 + PageIndex: noticeSettingListQuery.PageNumber,
  26 + PageSize: noticeSettingListQuery.PageSize,
  27 + CompanyId: noticeSettingListQuery.Operator.CompanyId,
  28 + })
  29 + if err != nil {
  30 + return 0, nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  31 + }
  32 +
  33 + return result.Count, result.NoticeSettings, nil
  34 +}
  35 +
  36 +//NoticeSettingProfile 推送消息配置需求的参数候选项
  37 +func (noticeSettingService *NoticeSettingService) NoticeSettingProfile(noticeSettingProfileQuery *query.NoticeSettingProfileQuery) (interface{}, error) {
  38 + if err := noticeSettingProfileQuery.ValidateQuery(); err != nil {
  39 + return nil, application.ThrowError(application.ARG_ERROR, err.Error())
  40 + }
  41 + //TODO
  42 + return nil, nil
  43 +}
  44 +
  45 +// NoticeSettingUpdate 更新配置
  46 +func (noticeSettingService *NoticeSettingService) NoticeSettingUpdate(noticeSettingUpdateCommand *command.NoticeSettingUpdateCommand) (interface{}, error) {
  47 + if err := noticeSettingUpdateCommand.ValidateCommand(); err != nil {
  48 + return nil, application.ThrowError(application.ARG_ERROR, err.Error())
  49 + }
  50 + creationBasicGateway := allied_creation_basic.NewHttplibAlliedCreationBasic(
  51 + noticeSettingUpdateCommand.Operator,
  52 + )
  53 +
  54 + noticeSettingID, _ := strconv.Atoi(noticeSettingUpdateCommand.NoticeSettingId)
  55 + _, err := creationBasicGateway.NoticeSettingUpdate(allied_creation_basic.ReqNoticeSettingUpdate{
  56 + NoticeSettingID: noticeSettingID,
  57 + CompanyID: int(noticeSettingUpdateCommand.Operator.CompanyId),
  58 + Content: noticeSettingUpdateCommand.Content,
  59 + IsPush: noticeSettingUpdateCommand.IsPush,
  60 + Module: noticeSettingUpdateCommand.Module,
  61 + ModuleAction: noticeSettingUpdateCommand.ModuleAction,
  62 + OrganizationID: int(noticeSettingUpdateCommand.Operator.OrgId),
  63 + })
  64 + if err != nil {
  65 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  66 + }
  67 + return noticeSettingUpdateCommand, nil
  68 +}
  69 +
  70 +// NoticeSettingUpdate 添加配置
  71 +func (noticeSettingService *NoticeSettingService) NoticeSettingAdd(noticeSettingAddCommand *command.NoticeSettingAddCommand) (interface{}, error) {
  72 + if err := noticeSettingAddCommand.ValidateCommand(); err != nil {
  73 + return nil, application.ThrowError(application.ARG_ERROR, err.Error())
  74 + }
  75 + creationBasicGateway := allied_creation_basic.NewHttplibAlliedCreationBasic(
  76 + noticeSettingAddCommand.Operator,
  77 + )
  78 + result, err := creationBasicGateway.NoticeSettingAdd(allied_creation_basic.ReqNoticeSettingAdd{
  79 + CompanyID: int(noticeSettingAddCommand.Operator.CompanyId),
  80 + Content: noticeSettingAddCommand.Content,
  81 + IsPush: noticeSettingAddCommand.IsPush,
  82 + Module: noticeSettingAddCommand.Module,
  83 + ModuleAction: noticeSettingAddCommand.ModuleAction,
  84 + OrganizationID: int(noticeSettingAddCommand.Operator.OrgId),
  85 + })
  86 + if err != nil {
  87 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  88 + }
  89 + data := struct {
  90 + NoticeSettingId int `json:"noticeSettingId"`
  91 + command.NoticeSettingAddCommand
  92 + }{
  93 + NoticeSettingId: result.NoticeSettingID,
  94 + NoticeSettingAddCommand: *noticeSettingAddCommand,
  95 + }
  96 + return data, nil
  97 +}
  98 +
  99 +func NewNoticeSettingService(options map[string]interface{}) *NoticeSettingService {
  100 + newNoticeSettingService := &NoticeSettingService{}
  101 + return newNoticeSettingService
  102 +}
@@ -17,9 +17,7 @@ type OrgsService struct { @@ -17,9 +17,7 @@ type OrgsService struct {
17 // 创建组织管理 17 // 创建组织管理
18 func (orgsService *OrgsService) OrgAdd(orgAddCommand *command.OrgAddCommand) (interface{}, error) { 18 func (orgsService *OrgsService) OrgAdd(orgAddCommand *command.OrgAddCommand) (interface{}, error) {
19 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 19 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
20 - orgAddCommand.Operator.CompanyId,  
21 - orgAddCommand.Operator.OrgId,  
22 - orgAddCommand.Operator.UserId) 20 + orgAddCommand.Operator)
23 parentId, _ := strconv.Atoi(orgAddCommand.ParentId) 21 parentId, _ := strconv.Atoi(orgAddCommand.ParentId)
24 result, err := creationUserGateway.OrgCreate(allied_creation_user.ReqOrgCreate{ 22 result, err := creationUserGateway.OrgCreate(allied_creation_user.ReqOrgCreate{
25 CompanyId: int(orgAddCommand.Operator.CompanyId), 23 CompanyId: int(orgAddCommand.Operator.CompanyId),
@@ -44,9 +42,7 @@ func (orgsService *OrgsService) OrgAdd(orgAddCommand *command.OrgAddCommand) (in @@ -44,9 +42,7 @@ func (orgsService *OrgsService) OrgAdd(orgAddCommand *command.OrgAddCommand) (in
44 // 禁用、启用组织管理 42 // 禁用、启用组织管理
45 func (orgsService *OrgsService) OrgEnable(orgEnableCommand *command.OrgEnableCommand) (interface{}, error) { 43 func (orgsService *OrgsService) OrgEnable(orgEnableCommand *command.OrgEnableCommand) (interface{}, error) {
46 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 44 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
47 - orgEnableCommand.Operator.CompanyId,  
48 - orgEnableCommand.Operator.OrgId,  
49 - orgEnableCommand.Operator.UserId) 45 + orgEnableCommand.Operator)
50 orgId, _ := strconv.Atoi(orgEnableCommand.OrgId) 46 orgId, _ := strconv.Atoi(orgEnableCommand.OrgId)
51 _, err := creationUserGateway.OrgEnable(allied_creation_user.ReqOrgEnable{ 47 _, err := creationUserGateway.OrgEnable(allied_creation_user.ReqOrgEnable{
52 OrgId: orgId, 48 OrgId: orgId,
@@ -61,9 +57,7 @@ func (orgsService *OrgsService) OrgEnable(orgEnableCommand *command.OrgEnableCom @@ -61,9 +57,7 @@ func (orgsService *OrgsService) OrgEnable(orgEnableCommand *command.OrgEnableCom
61 // 返回组织管理 57 // 返回组织管理
62 func (orgsService *OrgsService) OrgGet(orgGetQuery *query.OrgGetQuery) (interface{}, error) { 58 func (orgsService *OrgsService) OrgGet(orgGetQuery *query.OrgGetQuery) (interface{}, error) {
63 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 59 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
64 - orgGetQuery.Operator.CompanyId,  
65 - orgGetQuery.Operator.OrgId,  
66 - orgGetQuery.Operator.UserId) 60 + orgGetQuery.Operator)
67 orgId, _ := strconv.Atoi(orgGetQuery.OrgId) 61 orgId, _ := strconv.Atoi(orgGetQuery.OrgId)
68 result, err := creationUserGateway.OrgGet(allied_creation_user.ReqOrgGet{ 62 result, err := creationUserGateway.OrgGet(allied_creation_user.ReqOrgGet{
69 OrgId: orgId, 63 OrgId: orgId,
@@ -85,9 +79,7 @@ func (orgsService *OrgsService) OrgGet(orgGetQuery *query.OrgGetQuery) (interfac @@ -85,9 +79,7 @@ func (orgsService *OrgsService) OrgGet(orgGetQuery *query.OrgGetQuery) (interfac
85 // 返回组织管理列表 79 // 返回组织管理列表
86 func (orgsService *OrgsService) OrgList(orgListQuery *query.OrgListQuery) (interface{}, error) { 80 func (orgsService *OrgsService) OrgList(orgListQuery *query.OrgListQuery) (interface{}, error) {
87 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 81 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
88 - orgListQuery.Operator.CompanyId,  
89 - orgListQuery.Operator.OrgId,  
90 - orgListQuery.Operator.UserId) 82 + orgListQuery.Operator)
91 parentOrgId, _ := strconv.Atoi(orgListQuery.ParentId) 83 parentOrgId, _ := strconv.Atoi(orgListQuery.ParentId)
92 result, err := creationUserGateway.OrgSearch(allied_creation_user.ReqOrgSearch{ 84 result, err := creationUserGateway.OrgSearch(allied_creation_user.ReqOrgSearch{
93 CompanyId: int(orgListQuery.Operator.CompanyId), 85 CompanyId: int(orgListQuery.Operator.CompanyId),
@@ -123,9 +115,7 @@ func (orgsService *OrgsService) OrgList(orgListQuery *query.OrgListQuery) (inter @@ -123,9 +115,7 @@ func (orgsService *OrgsService) OrgList(orgListQuery *query.OrgListQuery) (inter
123 // 更新组织管理 115 // 更新组织管理
124 func (orgsService *OrgsService) OrgUpdate(orgUpdateCommand *command.OrgUpdateCommand) (interface{}, error) { 116 func (orgsService *OrgsService) OrgUpdate(orgUpdateCommand *command.OrgUpdateCommand) (interface{}, error) {
125 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 117 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
126 - orgUpdateCommand.Operator.CompanyId,  
127 - orgUpdateCommand.Operator.OrgId,  
128 - orgUpdateCommand.Operator.UserId) 118 + orgUpdateCommand.Operator)
129 parentId, _ := strconv.Atoi(orgUpdateCommand.ParentId) 119 parentId, _ := strconv.Atoi(orgUpdateCommand.ParentId)
130 orgId, _ := strconv.Atoi(orgUpdateCommand.OrgId) 120 orgId, _ := strconv.Atoi(orgUpdateCommand.OrgId)
131 _, err := creationUserGateway.OrgUpdate(allied_creation_user.ReqOrgUpdate{ 121 _, err := creationUserGateway.OrgUpdate(allied_creation_user.ReqOrgUpdate{
@@ -144,9 +134,7 @@ func (orgsService *OrgsService) OrgUpdate(orgUpdateCommand *command.OrgUpdateCom @@ -144,9 +134,7 @@ func (orgsService *OrgsService) OrgUpdate(orgUpdateCommand *command.OrgUpdateCom
144 // 返回组织管理 134 // 返回组织管理
145 func (orgsService *OrgsService) OrgGetSubDepartment(orgGetQuery *query.OrgGetSubDepartmentQuery) (interface{}, error) { 135 func (orgsService *OrgsService) OrgGetSubDepartment(orgGetQuery *query.OrgGetSubDepartmentQuery) (interface{}, error) {
146 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 136 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
147 - orgGetQuery.Operator.CompanyId,  
148 - orgGetQuery.Operator.OrgId,  
149 - orgGetQuery.Operator.UserId) 137 + orgGetQuery.Operator)
150 orgId, _ := strconv.Atoi(orgGetQuery.OrgId) 138 orgId, _ := strconv.Atoi(orgGetQuery.OrgId)
151 result, err := creationUserGateway.OrgGetSubDepartment(allied_creation_user.ReqOrgGetSubDepartment{ 139 result, err := creationUserGateway.OrgGetSubDepartment(allied_creation_user.ReqOrgGetSubDepartment{
152 OrgId: int64(orgId), 140 OrgId: int64(orgId),
@@ -17,9 +17,7 @@ type RolesService struct { @@ -17,9 +17,7 @@ type RolesService struct {
17 // 创建role 17 // 创建role
18 func (rolesService *RolesService) RoleAdd(roleAddCommand *command.RoleAddCommand) (interface{}, error) { 18 func (rolesService *RolesService) RoleAdd(roleAddCommand *command.RoleAddCommand) (interface{}, error) {
19 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 19 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
20 - roleAddCommand.Operator.CompanyId,  
21 - roleAddCommand.Operator.OrgId,  
22 - roleAddCommand.Operator.UserId) 20 + roleAddCommand.Operator)
23 result, err := creationUserGateway.RoleCreate(allied_creation_user.ReqRoleCreate{ 21 result, err := creationUserGateway.RoleCreate(allied_creation_user.ReqRoleCreate{
24 RoleName: roleAddCommand.RoleName, 22 RoleName: roleAddCommand.RoleName,
25 Desc: roleAddCommand.Desc, 23 Desc: roleAddCommand.Desc,
@@ -40,9 +38,7 @@ func (rolesService *RolesService) RoleAdd(roleAddCommand *command.RoleAddCommand @@ -40,9 +38,7 @@ func (rolesService *RolesService) RoleAdd(roleAddCommand *command.RoleAddCommand
40 // 编辑role 38 // 编辑role
41 func (rolesService *RolesService) RoleEdit(roleUpdateCommand *command.RoleUpdateCommand) (interface{}, error) { 39 func (rolesService *RolesService) RoleEdit(roleUpdateCommand *command.RoleUpdateCommand) (interface{}, error) {
42 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 40 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
43 - roleUpdateCommand.Operator.CompanyId,  
44 - roleUpdateCommand.Operator.OrgId,  
45 - roleUpdateCommand.Operator.UserId) 41 + roleUpdateCommand.Operator)
46 roleId, _ := strconv.Atoi(roleUpdateCommand.RoleId) 42 roleId, _ := strconv.Atoi(roleUpdateCommand.RoleId)
47 _, err := creationUserGateway.RoleUpdate(allied_creation_user.ReqRoleUpdate{ 43 _, err := creationUserGateway.RoleUpdate(allied_creation_user.ReqRoleUpdate{
48 RoleId: int64(roleId), 44 RoleId: int64(roleId),
@@ -58,9 +54,7 @@ func (rolesService *RolesService) RoleEdit(roleUpdateCommand *command.RoleUpdate @@ -58,9 +54,7 @@ func (rolesService *RolesService) RoleEdit(roleUpdateCommand *command.RoleUpdate
58 // 返单个角色 54 // 返单个角色
59 func (rolesService *RolesService) RoleGet(roleGetQuery *query.RoleGetQuery) (interface{}, error) { 55 func (rolesService *RolesService) RoleGet(roleGetQuery *query.RoleGetQuery) (interface{}, error) {
60 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 56 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
61 - roleGetQuery.Operator.CompanyId,  
62 - roleGetQuery.Operator.OrgId,  
63 - roleGetQuery.Operator.UserId) 57 + roleGetQuery.Operator)
64 roleId, _ := strconv.Atoi(roleGetQuery.RoleId) 58 roleId, _ := strconv.Atoi(roleGetQuery.RoleId)
65 roleData, err := creationUserGateway.RoleGet(allied_creation_user.ReqRoleGet{ 59 roleData, err := creationUserGateway.RoleGet(allied_creation_user.ReqRoleGet{
66 RoleId: int64(roleId), 60 RoleId: int64(roleId),
@@ -91,9 +85,7 @@ func (rolesService *RolesService) RoleGet(roleGetQuery *query.RoleGetQuery) (int @@ -91,9 +85,7 @@ func (rolesService *RolesService) RoleGet(roleGetQuery *query.RoleGetQuery) (int
91 // 返回role列表 85 // 返回role列表
92 func (rolesService *RolesService) RoleList(roleListQuery *query.RoleListQuery) (int64, interface{}, error) { 86 func (rolesService *RolesService) RoleList(roleListQuery *query.RoleListQuery) (int64, interface{}, error) {
93 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 87 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
94 - roleListQuery.Operator.CompanyId,  
95 - roleListQuery.Operator.OrgId,  
96 - roleListQuery.Operator.UserId) 88 + roleListQuery.Operator)
97 roleList, err := creationUserGateway.RoleSearch(allied_creation_user.ReqRoleSearch{ 89 roleList, err := creationUserGateway.RoleSearch(allied_creation_user.ReqRoleSearch{
98 Offset: (roleListQuery.PageNumber - 1) * roleListQuery.PageSize, 90 Offset: (roleListQuery.PageNumber - 1) * roleListQuery.PageSize,
99 Limit: roleListQuery.PageSize, 91 Limit: roleListQuery.PageSize,
@@ -122,9 +114,7 @@ func (rolesService *RolesService) RoleList(roleListQuery *query.RoleListQuery) ( @@ -122,9 +114,7 @@ func (rolesService *RolesService) RoleList(roleListQuery *query.RoleListQuery) (
122 // 编辑角色关联权限菜单的前置准备数据 114 // 编辑角色关联权限菜单的前置准备数据
123 func (rolesService *RolesService) RoleMenuBeforeEdit(roleMenuBeforeEditQuery *query.RoleMenuBeforeEditQuery) (interface{}, error) { 115 func (rolesService *RolesService) RoleMenuBeforeEdit(roleMenuBeforeEditQuery *query.RoleMenuBeforeEditQuery) (interface{}, error) {
124 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 116 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
125 - roleMenuBeforeEditQuery.Operator.CompanyId,  
126 - roleMenuBeforeEditQuery.Operator.OrgId,  
127 - roleMenuBeforeEditQuery.Operator.UserId) 117 + roleMenuBeforeEditQuery.Operator)
128 roleId, _ := strconv.Atoi(roleMenuBeforeEditQuery.RoleId) 118 roleId, _ := strconv.Atoi(roleMenuBeforeEditQuery.RoleId)
129 roles, err := creationUserGateway.RoleSearch(allied_creation_user.ReqRoleSearch{ 119 roles, err := creationUserGateway.RoleSearch(allied_creation_user.ReqRoleSearch{
130 OrgId: roleMenuBeforeEditQuery.Operator.OrgId, 120 OrgId: roleMenuBeforeEditQuery.Operator.OrgId,
@@ -151,9 +141,7 @@ func (rolesService *RolesService) RoleMenuBeforeEdit(roleMenuBeforeEditQuery *qu @@ -151,9 +141,7 @@ func (rolesService *RolesService) RoleMenuBeforeEdit(roleMenuBeforeEditQuery *qu
151 // 编辑角色关联用户的前置准备数据 141 // 编辑角色关联用户的前置准备数据
152 func (rolesService *RolesService) RoleUserBeforeEdit(roleUserBeforeEditQuery *query.RoleUserBeforeEditQuery) (interface{}, error) { 142 func (rolesService *RolesService) RoleUserBeforeEdit(roleUserBeforeEditQuery *query.RoleUserBeforeEditQuery) (interface{}, error) {
153 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 143 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
154 - roleUserBeforeEditQuery.Operator.CompanyId,  
155 - roleUserBeforeEditQuery.Operator.OrgId,  
156 - roleUserBeforeEditQuery.Operator.UserId) 144 + roleUserBeforeEditQuery.Operator)
157 roleId, _ := strconv.Atoi(roleUserBeforeEditQuery.RoleId) 145 roleId, _ := strconv.Atoi(roleUserBeforeEditQuery.RoleId)
158 roles, err := creationUserGateway.RoleSearch(allied_creation_user.ReqRoleSearch{ 146 roles, err := creationUserGateway.RoleSearch(allied_creation_user.ReqRoleSearch{
159 OrgId: roleUserBeforeEditQuery.Operator.OrgId, 147 OrgId: roleUserBeforeEditQuery.Operator.OrgId,
@@ -192,9 +180,7 @@ func (rolesService *RolesService) RoleUserBeforeEdit(roleUserBeforeEditQuery *qu @@ -192,9 +180,7 @@ func (rolesService *RolesService) RoleUserBeforeEdit(roleUserBeforeEditQuery *qu
192 // 角色编辑关联菜单权限 180 // 角色编辑关联菜单权限
193 func (rolesService *RolesService) RoleMenuEdit(roleMenuEditCommand *command.RoleMenuEditCommand) (interface{}, error) { 181 func (rolesService *RolesService) RoleMenuEdit(roleMenuEditCommand *command.RoleMenuEditCommand) (interface{}, error) {
194 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 182 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
195 - roleMenuEditCommand.Operator.CompanyId,  
196 - roleMenuEditCommand.Operator.OrgId,  
197 - roleMenuEditCommand.Operator.UserId) 183 + roleMenuEditCommand.Operator)
198 roleId, _ := strconv.Atoi(roleMenuEditCommand.RoleId) 184 roleId, _ := strconv.Atoi(roleMenuEditCommand.RoleId)
199 var menuIds []int64 185 var menuIds []int64
200 for _, v := range roleMenuEditCommand.MenuId { 186 for _, v := range roleMenuEditCommand.MenuId {
@@ -216,9 +202,7 @@ func (rolesService *RolesService) RoleMenuEdit(roleMenuEditCommand *command.Role @@ -216,9 +202,7 @@ func (rolesService *RolesService) RoleMenuEdit(roleMenuEditCommand *command.Role
216 // 移除role 202 // 移除role
217 func (rolesService *RolesService) RoleRemove(roleRemoveCommand *command.RoleRemoveCommand) (interface{}, error) { 203 func (rolesService *RolesService) RoleRemove(roleRemoveCommand *command.RoleRemoveCommand) (interface{}, error) {
218 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 204 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
219 - roleRemoveCommand.Operator.CompanyId,  
220 - roleRemoveCommand.Operator.OrgId,  
221 - roleRemoveCommand.Operator.UserId) 205 + roleRemoveCommand.Operator)
222 206
223 var roleIds []int64 207 var roleIds []int64
224 for _, v := range roleRemoveCommand.RoleIds { 208 for _, v := range roleRemoveCommand.RoleIds {
@@ -239,9 +223,7 @@ func (rolesService *RolesService) RoleRemove(roleRemoveCommand *command.RoleRemo @@ -239,9 +223,7 @@ func (rolesService *RolesService) RoleRemove(roleRemoveCommand *command.RoleRemo
239 // 角色添加关联用户 223 // 角色添加关联用户
240 func (rolesService *RolesService) RoleUserAdd(roleUserAddCommand *command.RoleUserAddCommand) (interface{}, error) { 224 func (rolesService *RolesService) RoleUserAdd(roleUserAddCommand *command.RoleUserAddCommand) (interface{}, error) {
241 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 225 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
242 - roleUserAddCommand.Operator.CompanyId,  
243 - roleUserAddCommand.Operator.OrgId,  
244 - roleUserAddCommand.Operator.UserId) 226 + roleUserAddCommand.Operator)
245 roleId, _ := strconv.Atoi(roleUserAddCommand.RoleId) 227 roleId, _ := strconv.Atoi(roleUserAddCommand.RoleId)
246 var userIds []int64 228 var userIds []int64
247 for _, v := range roleUserAddCommand.UserId { 229 for _, v := range roleUserAddCommand.UserId {
@@ -263,9 +245,7 @@ func (rolesService *RolesService) RoleUserAdd(roleUserAddCommand *command.RoleUs @@ -263,9 +245,7 @@ func (rolesService *RolesService) RoleUserAdd(roleUserAddCommand *command.RoleUs
263 // 角色添加关联用户 245 // 角色添加关联用户
264 func (rolesService *RolesService) RoleUserDelete(roleUserDeleteCommand *command.RoleUserDeleteCommand) (interface{}, error) { 246 func (rolesService *RolesService) RoleUserDelete(roleUserDeleteCommand *command.RoleUserDeleteCommand) (interface{}, error) {
265 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 247 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
266 - roleUserDeleteCommand.Operator.CompanyId,  
267 - roleUserDeleteCommand.Operator.OrgId,  
268 - roleUserDeleteCommand.Operator.UserId) 248 + roleUserDeleteCommand.Operator)
269 roleId, _ := strconv.Atoi(roleUserDeleteCommand.RoleId) 249 roleId, _ := strconv.Atoi(roleUserDeleteCommand.RoleId)
270 var userIds []int64 250 var userIds []int64
271 for _, v := range roleUserDeleteCommand.UserId { 251 for _, v := range roleUserDeleteCommand.UserId {
@@ -287,9 +267,7 @@ func (rolesService *RolesService) RoleUserDelete(roleUserDeleteCommand *command. @@ -287,9 +267,7 @@ func (rolesService *RolesService) RoleUserDelete(roleUserDeleteCommand *command.
287 // 角色下关联用户的数据 (暂时不需要这个) 267 // 角色下关联用户的数据 (暂时不需要这个)
288 func (rolesService *RolesService) RoleUserInfo(roleUserInfoQuery *query.RoleUserInfoQuery) (interface{}, error) { 268 func (rolesService *RolesService) RoleUserInfo(roleUserInfoQuery *query.RoleUserInfoQuery) (interface{}, error) {
289 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 269 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
290 - roleUserInfoQuery.Operator.CompanyId,  
291 - roleUserInfoQuery.Operator.OrgId,  
292 - roleUserInfoQuery.Operator.UserId) 270 + roleUserInfoQuery.Operator)
293 relatedUser, err := creationUserGateway.RoleGetRelatedUser(allied_creation_user.ReqRoleGetRelatedUser{ 271 relatedUser, err := creationUserGateway.RoleGetRelatedUser(allied_creation_user.ReqRoleGetRelatedUser{
294 RoleId: roleUserInfoQuery.RoleId, 272 RoleId: roleUserInfoQuery.RoleId,
295 }) 273 })
@@ -8,6 +8,7 @@ import ( @@ -8,6 +8,7 @@ import (
8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/command" 8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/command"
9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/dto" 9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/dto"
10 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/query" 10 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/query"
  11 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
11 12
12 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user" 13 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
13 ) 14 )
@@ -24,9 +25,7 @@ func NewUsersService(options map[string]interface{}) *UsersService { @@ -24,9 +25,7 @@ func NewUsersService(options map[string]interface{}) *UsersService {
24 // 获取公司用户信息 25 // 获取公司用户信息
25 func (usersService *UsersService) CompanyUserGet(companyUserGetQuery *query.CompanyUserGetQuery) (interface{}, error) { 26 func (usersService *UsersService) CompanyUserGet(companyUserGetQuery *query.CompanyUserGetQuery) (interface{}, error) {
26 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 27 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
27 - companyUserGetQuery.Operator.CompanyId,  
28 - companyUserGetQuery.Operator.OrgId,  
29 - companyUserGetQuery.Operator.UserId) 28 + companyUserGetQuery.Operator)
30 userid, _ := strconv.Atoi(companyUserGetQuery.UsersId) 29 userid, _ := strconv.Atoi(companyUserGetQuery.UsersId)
31 resultUser, err := creationUserGateway.UserGet(allied_creation_user.ReqGateUser{ 30 resultUser, err := creationUserGateway.UserGet(allied_creation_user.ReqGateUser{
32 UserId: userid, 31 UserId: userid,
@@ -98,9 +97,7 @@ func (usersService *UsersService) CompanyUserGet(companyUserGetQuery *query.Comp @@ -98,9 +97,7 @@ func (usersService *UsersService) CompanyUserGet(companyUserGetQuery *query.Comp
98 // 创建公司用户信息 97 // 创建公司用户信息
99 func (usersService *UsersService) CompanyUserAdd(companyUserAddCommand *command.CompanyUserAddCommand) (interface{}, error) { 98 func (usersService *UsersService) CompanyUserAdd(companyUserAddCommand *command.CompanyUserAddCommand) (interface{}, error) {
100 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 99 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
101 - companyUserAddCommand.Operator.CompanyId,  
102 - companyUserAddCommand.Operator.OrgId,  
103 - companyUserAddCommand.Operator.UserId) 100 + companyUserAddCommand.Operator)
104 departmentId, _ := strconv.Atoi(companyUserAddCommand.OrgId) 101 departmentId, _ := strconv.Atoi(companyUserAddCommand.OrgId)
105 orgId, _ := strconv.Atoi(companyUserAddCommand.OrgId) 102 orgId, _ := strconv.Atoi(companyUserAddCommand.OrgId)
106 userOrg := []int64{} 103 userOrg := []int64{}
@@ -148,9 +145,7 @@ func (usersService *UsersService) CompanyUserAdd(companyUserAddCommand *command. @@ -148,9 +145,7 @@ func (usersService *UsersService) CompanyUserAdd(companyUserAddCommand *command.
148 // 启用禁用公司用户信息 145 // 启用禁用公司用户信息
149 func (usersService *UsersService) CompanyUserEnable(companyUserEnableCommand *command.CompanyUserEnableCommand) (interface{}, error) { 146 func (usersService *UsersService) CompanyUserEnable(companyUserEnableCommand *command.CompanyUserEnableCommand) (interface{}, error) {
150 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 147 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
151 - companyUserEnableCommand.Operator.CompanyId,  
152 - companyUserEnableCommand.Operator.OrgId,  
153 - companyUserEnableCommand.Operator.UserId) 148 + companyUserEnableCommand.Operator)
154 149
155 var userIds []int64 150 var userIds []int64
156 for i := range companyUserEnableCommand.UsersIds { 151 for i := range companyUserEnableCommand.UsersIds {
@@ -169,7 +164,7 @@ func (usersService *UsersService) CompanyUserEnable(companyUserEnableCommand *co @@ -169,7 +164,7 @@ func (usersService *UsersService) CompanyUserEnable(companyUserEnableCommand *co
169 164
170 // 返回公司用户信息列表 165 // 返回公司用户信息列表
171 func (usersService *UsersService) CompanyUserList(companyUserListQuery *query.CompanyUserListQuery) (int64, interface{}, error) { 166 func (usersService *UsersService) CompanyUserList(companyUserListQuery *query.CompanyUserListQuery) (int64, interface{}, error) {
172 - creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(0, 0, 0) 167 + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(domain.Operator{})
173 result, err := creationUserGateway.UserSearch(allied_creation_user.ReqUserSearch{ 168 result, err := creationUserGateway.UserSearch(allied_creation_user.ReqUserSearch{
174 Offset: (companyUserListQuery.PageNumber - 1) * companyUserListQuery.PageSize, 169 Offset: (companyUserListQuery.PageNumber - 1) * companyUserListQuery.PageSize,
175 Limit: companyUserListQuery.PageSize, 170 Limit: companyUserListQuery.PageSize,
@@ -208,9 +203,7 @@ func (usersService *UsersService) CompanyUserList(companyUserListQuery *query.Co @@ -208,9 +203,7 @@ func (usersService *UsersService) CompanyUserList(companyUserListQuery *query.Co
208 // 批量重置密码 203 // 批量重置密码
209 func (usersService *UsersService) CompanyUserResetPassword(companyUserResetPasswordCommand *command.CompanyUserResetPasswordCommand) (interface{}, error) { 204 func (usersService *UsersService) CompanyUserResetPassword(companyUserResetPasswordCommand *command.CompanyUserResetPasswordCommand) (interface{}, error) {
210 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 205 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
211 - companyUserResetPasswordCommand.Operator.CompanyId,  
212 - companyUserResetPasswordCommand.Operator.OrgId,  
213 - companyUserResetPasswordCommand.Operator.UserId) 206 + companyUserResetPasswordCommand.Operator)
214 var userIds []int64 207 var userIds []int64
215 for i := range companyUserResetPasswordCommand.UserIds { 208 for i := range companyUserResetPasswordCommand.UserIds {
216 id, _ := strconv.Atoi(companyUserResetPasswordCommand.UserIds[i]) 209 id, _ := strconv.Atoi(companyUserResetPasswordCommand.UserIds[i])
@@ -229,9 +222,7 @@ func (usersService *UsersService) CompanyUserResetPassword(companyUserResetPassw @@ -229,9 +222,7 @@ func (usersService *UsersService) CompanyUserResetPassword(companyUserResetPassw
229 // 更新公司用户信息 222 // 更新公司用户信息
230 func (usersService *UsersService) CompanyUserUpdate(companyUserUpdateCommand *command.CompanyUserUpdateCommand) (interface{}, error) { 223 func (usersService *UsersService) CompanyUserUpdate(companyUserUpdateCommand *command.CompanyUserUpdateCommand) (interface{}, error) {
231 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 224 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
232 - companyUserUpdateCommand.Operator.CompanyId,  
233 - companyUserUpdateCommand.Operator.OrgId,  
234 - companyUserUpdateCommand.Operator.UserId) 225 + companyUserUpdateCommand.Operator)
235 departmentId, _ := strconv.Atoi(companyUserUpdateCommand.OrganizationId) 226 departmentId, _ := strconv.Atoi(companyUserUpdateCommand.OrganizationId)
236 orgId, _ := strconv.Atoi(companyUserUpdateCommand.OrganizationId) 227 orgId, _ := strconv.Atoi(companyUserUpdateCommand.OrganizationId)
237 userOrg := []int64{} 228 userOrg := []int64{}
@@ -272,9 +263,7 @@ func (usersService *UsersService) CompanyUserUpdate(companyUserUpdateCommand *co @@ -272,9 +263,7 @@ func (usersService *UsersService) CompanyUserUpdate(companyUserUpdateCommand *co
272 // 创建共创用户信息 263 // 创建共创用户信息
273 func (usersService *UsersService) CooperationUserAdd(cooperationUserAddCommand *command.CooperationUserAddCommand) (interface{}, error) { 264 func (usersService *UsersService) CooperationUserAdd(cooperationUserAddCommand *command.CooperationUserAddCommand) (interface{}, error) {
274 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 265 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
275 - cooperationUserAddCommand.Operator.CompanyId,  
276 - cooperationUserAddCommand.Operator.OrgId,  
277 - cooperationUserAddCommand.Operator.UserId) 266 + cooperationUserAddCommand.Operator)
278 result, err := creationUserGateway.CooperatorUserCreate(allied_creation_user.ReqCreateCooperatorUser{ 267 result, err := creationUserGateway.CooperatorUserCreate(allied_creation_user.ReqCreateCooperatorUser{
279 CompanyId: cooperationUserAddCommand.Operator.CompanyId, 268 CompanyId: cooperationUserAddCommand.Operator.CompanyId,
280 CooperationCompany: cooperationUserAddCommand.CooperationCompany, 269 CooperationCompany: cooperationUserAddCommand.CooperationCompany,
@@ -304,9 +293,7 @@ func (usersService *UsersService) CooperationUserAdd(cooperationUserAddCommand * @@ -304,9 +293,7 @@ func (usersService *UsersService) CooperationUserAdd(cooperationUserAddCommand *
304 // 启用禁用共创用户信息 293 // 启用禁用共创用户信息
305 func (usersService *UsersService) CooperationUserEnable(cooperationUserEnableCommand *command.CooperationUserEnableCommand) (interface{}, error) { 294 func (usersService *UsersService) CooperationUserEnable(cooperationUserEnableCommand *command.CooperationUserEnableCommand) (interface{}, error) {
306 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 295 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
307 - cooperationUserEnableCommand.Operator.CompanyId,  
308 - cooperationUserEnableCommand.Operator.OrgId,  
309 - cooperationUserEnableCommand.Operator.UserId) 296 + cooperationUserEnableCommand.Operator)
310 var userIds []int64 297 var userIds []int64
311 for i := range cooperationUserEnableCommand.UsersIds { 298 for i := range cooperationUserEnableCommand.UsersIds {
312 id, _ := strconv.Atoi(cooperationUserEnableCommand.UsersIds[i]) 299 id, _ := strconv.Atoi(cooperationUserEnableCommand.UsersIds[i])
@@ -325,9 +312,7 @@ func (usersService *UsersService) CooperationUserEnable(cooperationUserEnableCom @@ -325,9 +312,7 @@ func (usersService *UsersService) CooperationUserEnable(cooperationUserEnableCom
325 // 获取共创用户信息 312 // 获取共创用户信息
326 func (usersService *UsersService) CooperationUserGet(cooperationUserGetQuery *query.CooperationUserGetQuery) (interface{}, error) { 313 func (usersService *UsersService) CooperationUserGet(cooperationUserGetQuery *query.CooperationUserGetQuery) (interface{}, error) {
327 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 314 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
328 - cooperationUserGetQuery.Operator.CompanyId,  
329 - cooperationUserGetQuery.Operator.OrgId,  
330 - cooperationUserGetQuery.Operator.UserId) 315 + cooperationUserGetQuery.Operator)
331 userId, _ := strconv.Atoi(cooperationUserGetQuery.UserId) 316 userId, _ := strconv.Atoi(cooperationUserGetQuery.UserId)
332 result, err := creationUserGateway.UserGet(allied_creation_user.ReqGateUser{ 317 result, err := creationUserGateway.UserGet(allied_creation_user.ReqGateUser{
333 UserId: userId, 318 UserId: userId,
@@ -352,7 +337,7 @@ func (usersService *UsersService) CooperationUserGet(cooperationUserGetQuery *qu @@ -352,7 +337,7 @@ func (usersService *UsersService) CooperationUserGet(cooperationUserGetQuery *qu
352 337
353 // 返回共创用户信息列表 338 // 返回共创用户信息列表
354 func (usersService *UsersService) CooperationUserList(cooperationUserListQuery *query.CooperationUserListQuery) (int64, interface{}, error) { 339 func (usersService *UsersService) CooperationUserList(cooperationUserListQuery *query.CooperationUserListQuery) (int64, interface{}, error) {
355 - creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(0, 0, 0) 340 + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(domain.Operator{})
356 result, err := creationUserGateway.UserSearch(allied_creation_user.ReqUserSearch{ 341 result, err := creationUserGateway.UserSearch(allied_creation_user.ReqUserSearch{
357 Offset: (cooperationUserListQuery.PageNumber - 1) * cooperationUserListQuery.PageSize, 342 Offset: (cooperationUserListQuery.PageNumber - 1) * cooperationUserListQuery.PageSize,
358 Limit: cooperationUserListQuery.PageSize, 343 Limit: cooperationUserListQuery.PageSize,
@@ -390,9 +375,7 @@ func (usersService *UsersService) CooperationUserList(cooperationUserListQuery * @@ -390,9 +375,7 @@ func (usersService *UsersService) CooperationUserList(cooperationUserListQuery *
390 // 批量重置密码 375 // 批量重置密码
391 func (usersService *UsersService) CooperationUserResetPassword(cooperationUserResetPasswordCommand *command.CooperationUserResetPasswordCommand) (interface{}, error) { 376 func (usersService *UsersService) CooperationUserResetPassword(cooperationUserResetPasswordCommand *command.CooperationUserResetPasswordCommand) (interface{}, error) {
392 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 377 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
393 - cooperationUserResetPasswordCommand.Operator.CompanyId,  
394 - cooperationUserResetPasswordCommand.Operator.OrgId,  
395 - cooperationUserResetPasswordCommand.Operator.UserId) 378 + cooperationUserResetPasswordCommand.Operator)
396 var userIds []int64 379 var userIds []int64
397 for i := range cooperationUserResetPasswordCommand.UserIds { 380 for i := range cooperationUserResetPasswordCommand.UserIds {
398 id, _ := strconv.Atoi(cooperationUserResetPasswordCommand.UserIds[i]) 381 id, _ := strconv.Atoi(cooperationUserResetPasswordCommand.UserIds[i])
@@ -412,9 +395,7 @@ func (usersService *UsersService) CooperationUserResetPassword(cooperationUserRe @@ -412,9 +395,7 @@ func (usersService *UsersService) CooperationUserResetPassword(cooperationUserRe
412 // 编辑共创用户信息 395 // 编辑共创用户信息
413 func (usersService *UsersService) CooperationUserUpdate(cooperationUserUpdateCommand *command.CooperationUserUpdateCommand) (interface{}, error) { 396 func (usersService *UsersService) CooperationUserUpdate(cooperationUserUpdateCommand *command.CooperationUserUpdateCommand) (interface{}, error) {
414 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 397 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
415 - cooperationUserUpdateCommand.Operator.CompanyId,  
416 - cooperationUserUpdateCommand.Operator.OrgId,  
417 - cooperationUserUpdateCommand.Operator.UserId) 398 + cooperationUserUpdateCommand.Operator)
418 _, err := creationUserGateway.CooperatorUserUpdate(allied_creation_user.ReqUpdateCooperatorUser{ 399 _, err := creationUserGateway.CooperatorUserUpdate(allied_creation_user.ReqUpdateCooperatorUser{
419 UserId: cooperationUserUpdateCommand.UserId, 400 UserId: cooperationUserUpdateCommand.UserId,
420 CooperationCompany: cooperationUserUpdateCommand.CooperationCompany, 401 CooperationCompany: cooperationUserUpdateCommand.CooperationCompany,
@@ -436,9 +417,7 @@ func (usersService *UsersService) CooperationUserUpdate(cooperationUserUpdateCom @@ -436,9 +417,7 @@ func (usersService *UsersService) CooperationUserUpdate(cooperationUserUpdateCom
436 //CompanyOrgSelector 获取公司组织的下拉列表 417 //CompanyOrgSelector 获取公司组织的下拉列表
437 func (usersService *UsersService) SelectorCompanyOrg(selectorQuery *query.CompanyOrgSelectorQuery) (int64, interface{}, error) { 418 func (usersService *UsersService) SelectorCompanyOrg(selectorQuery *query.CompanyOrgSelectorQuery) (int64, interface{}, error) {
438 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 419 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
439 - selectorQuery.Operator.CompanyId,  
440 - selectorQuery.Operator.OrgId,  
441 - selectorQuery.Operator.UserId) 420 + selectorQuery.Operator)
442 result, err := creationUserGateway.OrgSearch(allied_creation_user.ReqOrgSearch{ 421 result, err := creationUserGateway.OrgSearch(allied_creation_user.ReqOrgSearch{
443 CompanyId: int(selectorQuery.Operator.CompanyId), 422 CompanyId: int(selectorQuery.Operator.CompanyId),
444 DepName: selectorQuery.OrgName, 423 DepName: selectorQuery.OrgName,
@@ -470,9 +449,7 @@ func (usersService *UsersService) SelectorCompanyOrg(selectorQuery *query.Compan @@ -470,9 +449,7 @@ func (usersService *UsersService) SelectorCompanyOrg(selectorQuery *query.Compan
470 //SelectorCompanyRole 获取公司角色的下拉列表 449 //SelectorCompanyRole 获取公司角色的下拉列表
471 func (usersService *UsersService) SelectorCompanyRole(selectorQuery *query.CompanyRoleSelectorQuery) (int64, interface{}, error) { 450 func (usersService *UsersService) SelectorCompanyRole(selectorQuery *query.CompanyRoleSelectorQuery) (int64, interface{}, error) {
472 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 451 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
473 - selectorQuery.Operator.CompanyId,  
474 - selectorQuery.Operator.OrgId,  
475 - selectorQuery.Operator.UserId) 452 + selectorQuery.Operator)
476 result, err := creationUserGateway.RoleSearch(allied_creation_user.ReqRoleSearch{ 453 result, err := creationUserGateway.RoleSearch(allied_creation_user.ReqRoleSearch{
477 Limit: selectorQuery.PageSize, 454 Limit: selectorQuery.PageSize,
478 Offset: (selectorQuery.PageNumber - 1) * selectorQuery.PageSize, 455 Offset: (selectorQuery.PageNumber - 1) * selectorQuery.PageSize,
@@ -500,9 +477,7 @@ func (usersService *UsersService) SelectorCompanyRole(selectorQuery *query.Compa @@ -500,9 +477,7 @@ func (usersService *UsersService) SelectorCompanyRole(selectorQuery *query.Compa
500 //CompanyOrgSelector 获取公司全组织部门的下拉列表 477 //CompanyOrgSelector 获取公司全组织部门的下拉列表
501 func (usersService *UsersService) SelectorCompanyOrgAll(selectorQuery *query.CompanyOrgSelectorQuery) (int64, interface{}, error) { 478 func (usersService *UsersService) SelectorCompanyOrgAll(selectorQuery *query.CompanyOrgSelectorQuery) (int64, interface{}, error) {
502 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 479 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
503 - selectorQuery.Operator.CompanyId,  
504 - selectorQuery.Operator.OrgId,  
505 - selectorQuery.Operator.UserId) 480 + selectorQuery.Operator)
506 result, err := creationUserGateway.OrgSearch(allied_creation_user.ReqOrgSearch{ 481 result, err := creationUserGateway.OrgSearch(allied_creation_user.ReqOrgSearch{
507 CompanyId: int(selectorQuery.Operator.CompanyId), 482 CompanyId: int(selectorQuery.Operator.CompanyId),
508 DepName: "", 483 DepName: "",
@@ -6,10 +6,15 @@ const SERVICE_NAME = "project" @@ -6,10 +6,15 @@ const SERVICE_NAME = "project"
6 6
7 var LOG_LEVEL = "debug" 7 var LOG_LEVEL = "debug"
8 8
  9 +//天联共创基础模块
9 var ALLIED_CREATION_BASIC_HOST = "http://localhost:8080" 10 var ALLIED_CREATION_BASIC_HOST = "http://localhost:8080"
10 11
  12 +//天联共创用户模块
11 var ALLIED_CREATION_USER_HOST = "http://localhost:8081" 13 var ALLIED_CREATION_USER_HOST = "http://localhost:8081"
12 14
  15 +//通用模块短信服务
  16 +var SMS_SERVE_HOST = "http://localhost:8081"
  17 +
13 func init() { 18 func init() {
14 if os.Getenv("LOG_LEVEL") != "" { 19 if os.Getenv("LOG_LEVEL") != "" {
15 LOG_LEVEL = os.Getenv("LOG_LEVEL") 20 LOG_LEVEL = os.Getenv("LOG_LEVEL")
@@ -3,9 +3,9 @@ package allied_creation_basic @@ -3,9 +3,9 @@ package allied_creation_basic
3 import ( 3 import (
4 "time" 4 "time"
5 5
6 - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway"  
7 -  
8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/constant" 6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/constant"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
  8 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway"
9 ) 9 )
10 10
11 type HttplibAlliedCreationBasic struct { 11 type HttplibAlliedCreationBasic struct {
@@ -13,14 +13,17 @@ type HttplibAlliedCreationBasic struct { @@ -13,14 +13,17 @@ type HttplibAlliedCreationBasic struct {
13 baseUrL string 13 baseUrL string
14 } 14 }
15 15
16 -var alliedCreationBasicClient = &HttplibAlliedCreationBasic{  
17 - BaseServiceGateway: service_gateway.BaseServiceGateway{  
18 - ConnectTimeout: 100 * time.Second,  
19 - ReadWriteTimeout: 30 * time.Second,  
20 - },  
21 - baseUrL: constant.ALLIED_CREATION_BASIC_HOST,  
22 -} 16 +func NewHttplibAlliedCreationBasic(operator domain.Operator) *HttplibAlliedCreationBasic {
  17 + return &HttplibAlliedCreationBasic{
  18 + BaseServiceGateway: service_gateway.BaseServiceGateway{
  19 + ConnectTimeout: 100 * time.Second,
  20 + ReadWriteTimeout: 30 * time.Second,
  21 + CompanyId: operator.CompanyId,
  22 + OrgId: operator.OrgId,
  23 + UserId: operator.UserId,
  24 + UserBaseId: operator.UserBaseId,
  25 + },
  26 + baseUrL: constant.ALLIED_CREATION_USER_HOST,
  27 + }
23 28
24 -func NewHttplibAlliedCreationBasic() *HttplibAlliedCreationBasic {  
25 - return alliedCreationBasicClient  
26 } 29 }
  1 +package allied_creation_basic
  2 +
  3 +import (
  4 + "encoding/json"
  5 + "fmt"
  6 + "strconv"
  7 +
  8 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway"
  9 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
  10 +)
  11 +
  12 +// NoticeSettingUpdate 更新消息模板
  13 +func (gateway HttplibAlliedCreationBasic) NoticeSettingUpdate(param ReqNoticeSettingUpdate) (*DataNoticeSettingUpdate, error) {
  14 + url := gateway.baseUrL + "/notice-setting" + strconv.Itoa(param.NoticeSettingID)
  15 + method := "PUT"
  16 + req := gateway.CreateRequest(url, method)
  17 + log.Logger.Debug("向基础模块请求数据:更新消息模板。", map[string]interface{}{
  18 + "api": method + ":" + url,
  19 + "param": param,
  20 + })
  21 + req, err := req.JSONBody(param)
  22 + if err != nil {
  23 + return nil, fmt.Errorf("请求更新消息模板失败:%w", err)
  24 + }
  25 +
  26 + byteResult, err := req.Bytes()
  27 + if err != nil {
  28 + return nil, fmt.Errorf("获取更新消息模板失败:%w", err)
  29 + }
  30 + log.Logger.Debug("获取基础模块请求数据:更新消息模板。", map[string]interface{}{
  31 + "result": string(byteResult),
  32 + })
  33 + var result service_gateway.GatewayResponse
  34 + err = json.Unmarshal(byteResult, &result)
  35 + if err != nil {
  36 + return nil, fmt.Errorf("解析更新消息模板:%w", err)
  37 + }
  38 + var data DataNoticeSettingUpdate
  39 + err = gateway.GetResponseData(result, &data)
  40 + return &data, err
  41 +}
  42 +
  43 +// NoticeSettingAdd 添加化消息模板
  44 +func (gateway HttplibAlliedCreationBasic) NoticeSettingAdd(param ReqNoticeSettingAdd) (*DataNoticeSettingAdd, error) {
  45 + url := gateway.baseUrL + "/notice-setting"
  46 + method := "POST"
  47 + req := gateway.CreateRequest(url, method)
  48 + log.Logger.Debug("向基础模块请求数据:添加化消息模板。", map[string]interface{}{
  49 + "api": method + ":" + url,
  50 + "param": param,
  51 + })
  52 + req, err := req.JSONBody(param)
  53 + if err != nil {
  54 + return nil, fmt.Errorf("请求添加化消息模板失败:%w", err)
  55 + }
  56 +
  57 + byteResult, err := req.Bytes()
  58 + if err != nil {
  59 + return nil, fmt.Errorf("获取添加化消息模板失败:%w", err)
  60 + }
  61 + log.Logger.Debug("获取基础模块请求数据:添加化消息模板。", map[string]interface{}{
  62 + "result": string(byteResult),
  63 + })
  64 + var result service_gateway.GatewayResponse
  65 + err = json.Unmarshal(byteResult, &result)
  66 + if err != nil {
  67 + return nil, fmt.Errorf("解析添加化消息模板:%w", err)
  68 + }
  69 + var data DataNoticeSettingAdd
  70 + err = gateway.GetResponseData(result, &data)
  71 + return &data, err
  72 +}
  73 +
  74 +// NoticeSettingGet 返回编排消息通知内容
  75 +func (gateway HttplibAlliedCreationBasic) NoticeSettingGet(param ReqNoticeSettingGet) (*DataNoticeSettingGet, error) {
  76 + url := gateway.baseUrL + "/notice-setting/" + strconv.Itoa(param.SettingId)
  77 + method := "GET"
  78 + req := gateway.CreateRequest(url, method)
  79 + log.Logger.Debug("向基础模块请求数据:返回编排消息通知内容。", map[string]interface{}{
  80 + "api": method + ":" + url,
  81 + "param": param,
  82 + })
  83 + req, err := req.JSONBody(param)
  84 + if err != nil {
  85 + return nil, fmt.Errorf("请求返回编排消息通知内容失败:%w", err)
  86 + }
  87 +
  88 + byteResult, err := req.Bytes()
  89 + if err != nil {
  90 + return nil, fmt.Errorf("获取返回编排消息通知内容失败:%w", err)
  91 + }
  92 + log.Logger.Debug("获取基础模块请求数据:返回编排消息通知内容。", map[string]interface{}{
  93 + "result": string(byteResult),
  94 + })
  95 + var result service_gateway.GatewayResponse
  96 + err = json.Unmarshal(byteResult, &result)
  97 + if err != nil {
  98 + return nil, fmt.Errorf("解析返回编排消息通知内容:%w", err)
  99 + }
  100 + var data DataNoticeSettingGet
  101 + err = gateway.GetResponseData(result, &data)
  102 + return &data, err
  103 +}
  104 +
  105 +// NoticeSettingSearch 返回编排消息通知内容列表
  106 +func (gateway HttplibAlliedCreationBasic) NoticeSettingSearch(param ReqNoticeSettingSearch) (*DataNoticeSettingSearch, error) {
  107 + url := gateway.baseUrL + "/notice-setting/search"
  108 + method := "POST"
  109 + req := gateway.CreateRequest(url, method)
  110 + log.Logger.Debug("向基础模块请求数据:返回编排消息通知内容列表。", map[string]interface{}{
  111 + "api": method + ":" + url,
  112 + "param": param,
  113 + })
  114 + req, err := req.JSONBody(param)
  115 + if err != nil {
  116 + return nil, fmt.Errorf("请求返回编排消息通知内容列表失败:%w", err)
  117 + }
  118 +
  119 + byteResult, err := req.Bytes()
  120 + if err != nil {
  121 + return nil, fmt.Errorf("获取返回编排消息通知内容列表失败:%w", err)
  122 + }
  123 + log.Logger.Debug("获取基础模块请求数据:返回编排消息通知内容列表。", map[string]interface{}{
  124 + "result": string(byteResult),
  125 + })
  126 + var result service_gateway.GatewayResponse
  127 + err = json.Unmarshal(byteResult, &result)
  128 + if err != nil {
  129 + return nil, fmt.Errorf("解析返回编排消息通知内容列表:%w", err)
  130 + }
  131 + var data DataNoticeSettingSearch
  132 + err = gateway.GetResponseData(result, &data)
  133 + return &data, err
  134 +}
1 -package allied_creation_basic  
2 -  
3 -import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"  
4 -  
5 -//ReqGetDictionarysByCode 根据code获取字典数据  
6 -type ReqGetDictionaryByCode struct {  
7 - DictCode []string `json:"dictCode"`  
8 -}  
9 -  
10 -//DataGetDictionarysByCode 根据code获取字典数据  
11 -type DataGetDictionaryByCode struct {  
12 - Dictionarys []domain.Dictionary `json:"dictionarys"`  
13 -}  
  1 +package allied_creation_basic
  2 +
  3 +//ReqGetDictionarysByCode 根据code获取字典数据
  4 +type ReqGetDictionaryByCode struct {
  5 + DictCode []string `json:"dictCode"`
  6 +}
  7 +
  8 +//DataGetDictionarysByCode 根据code获取字典数据
  9 +type DataGetDictionaryByCode struct {
  10 + Dictionarys []struct {
  11 + // 字典编号 主键
  12 + DictionaryId int64 `json:"dictionaryId"`
  13 + // 字典编码
  14 + DictCode string `json:"dictCode"`
  15 + // 字典名称
  16 + DictName string `json:"dictName"`
  17 + // 备注信息
  18 + Describe string `json:"describe"`
  19 + // 字典值列表
  20 + DictItems []struct {
  21 + // 项编码
  22 + ItemCode string `json:"itemCode"`
  23 + // 项标签
  24 + ItemLabel string `json:"itemLabel"`
  25 + // 值
  26 + ItemValue string `json:"itemValue"`
  27 + // 是否可见【1:不可以】【2:可以】
  28 + IsShow int `json:"isShow"`
  29 + // 显示序号
  30 + Sort int `json:"sort"`
  31 + } `json:"dictItems"`
  32 + } `json:"dictionarys"`
  33 +}
  1 +package allied_creation_basic
  2 +
  3 +//更新消息模板
  4 +type (
  5 + ReqNoticeSettingUpdate struct {
  6 + NoticeSettingID int `json:"noticeSettingId"`
  7 + CompanyID int `json:"companyId"`
  8 + Content string `json:"content"`
  9 + IsPush int `json:"isPush"`
  10 + Module string `json:"module"`
  11 + ModuleAction string `json:"moduleAction"`
  12 + OrganizationID int `json:"organizationId"`
  13 + }
  14 +
  15 + DataNoticeSettingUpdate struct {
  16 + NoticeSettingID int `json:"noticeSettingId"`
  17 + CompanyID int `json:"companyId"`
  18 + Content string `json:"content"`
  19 + IsPush int `json:"isPush"`
  20 + Module string `json:"module"`
  21 + ModuleAction string `json:"moduleAction"`
  22 + OrganizationID int `json:"organizationId"`
  23 + }
  24 +)
  25 +
  26 +//添加化消息模板
  27 +type (
  28 + ReqNoticeSettingAdd struct {
  29 + CompanyID int `json:"companyId"`
  30 + Content string `json:"content"`
  31 + IsPush int `json:"isPush"`
  32 + Module string `json:"module"`
  33 + ModuleAction string `json:"moduleAction"`
  34 + OrganizationID int `json:"organizationId"`
  35 + }
  36 +
  37 + DataNoticeSettingAdd struct {
  38 + CompanyID int `json:"companyId"`
  39 + Content string `json:"content"`
  40 + IsPush int `json:"isPush"`
  41 + Module string `json:"module"`
  42 + ModuleAction string `json:"moduleAction"`
  43 + NoticeSettingID int `json:"noticeSettingId"`
  44 + OrganizationID int `json:"organizationId"`
  45 + }
  46 +)
  47 +
  48 +//返回编排消息通知内容
  49 +type (
  50 + ReqNoticeSettingGet struct {
  51 + SettingId int `json:"settingId"`
  52 + }
  53 +
  54 + DataNoticeSettingGet struct {
  55 + CompanyID int `json:"companyId"`
  56 + Content string `json:"content"`
  57 + IsPush int `json:"isPush"`
  58 + Module string `json:"module"`
  59 + ModuleAction string `json:"moduleAction"`
  60 + NoticeSettingID int `json:"noticeSettingId"`
  61 + OrganizationID int `json:"organizationId"`
  62 + SysCode string `json:"sysCode"`
  63 + }
  64 +)
  65 +
  66 +//返回编排消息通知内容列表
  67 +type (
  68 + ReqNoticeSettingSearch struct {
  69 + PageIndex int `json:"pageIndex"`
  70 + PageSize int `json:"pageSize"`
  71 + CompanyId int64 `json:"companyId"`
  72 + }
  73 +
  74 + DataNoticeSettingSearch struct {
  75 + Count int64 `json:"count"`
  76 + NoticeSettings []struct {
  77 + CompanyID int `json:"companyId"`
  78 + Content string `json:"content"`
  79 + IsPush int `json:"isPush"`
  80 + Module string `json:"module"`
  81 + ModuleAction string `json:"moduleAction"`
  82 + NoticeSettingID int `json:"noticeSettingId"`
  83 + OrganizationID int `json:"organizationId"`
  84 + SysCode string `json:"sysCode"`
  85 + } `json:"noticeSettings"`
  86 + }
  87 +)
@@ -4,6 +4,7 @@ import ( @@ -4,6 +4,7 @@ import (
4 "time" 4 "time"
5 5
6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/constant" 6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/constant"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway" 8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway"
8 ) 9 )
9 10
@@ -13,14 +14,15 @@ type HttplibAlliedCreationUser struct { @@ -13,14 +14,15 @@ type HttplibAlliedCreationUser struct {
13 baseUrL string 14 baseUrL string
14 } 15 }
15 16
16 -func NewHttplibAlliedCreationUser(companyId int64, orgId int64, userId int64) *HttplibAlliedCreationUser { 17 +func NewHttplibAlliedCreationUser(operator domain.Operator) *HttplibAlliedCreationUser {
17 return &HttplibAlliedCreationUser{ 18 return &HttplibAlliedCreationUser{
18 BaseServiceGateway: service_gateway.BaseServiceGateway{ 19 BaseServiceGateway: service_gateway.BaseServiceGateway{
19 ConnectTimeout: 100 * time.Second, 20 ConnectTimeout: 100 * time.Second,
20 ReadWriteTimeout: 30 * time.Second, 21 ReadWriteTimeout: 30 * time.Second,
21 - CompanyId: companyId,  
22 - OrgId: orgId,  
23 - UserId: userId, 22 + CompanyId: operator.CompanyId,
  23 + OrgId: operator.OrgId,
  24 + UserId: operator.UserId,
  25 + UserBaseId: operator.UserBaseId,
24 }, 26 },
25 baseUrL: constant.ALLIED_CREATION_USER_HOST, 27 baseUrL: constant.ALLIED_CREATION_USER_HOST,
26 } 28 }
@@ -73,7 +73,7 @@ func (gateway HttplibAlliedCreationUser) MenusUpdate(param ReqMenusUpdate) (*Dat @@ -73,7 +73,7 @@ func (gateway HttplibAlliedCreationUser) MenusUpdate(param ReqMenusUpdate) (*Dat
73 73
74 // MenusRemove 移除菜单 74 // MenusRemove 移除菜单
75 func (gateway HttplibAlliedCreationUser) MenusRemove(param ReqMenusRemove) (*DataMenusRemove, error) { 75 func (gateway HttplibAlliedCreationUser) MenusRemove(param ReqMenusRemove) (*DataMenusRemove, error) {
76 - url := gateway.baseUrL + "/menus/" + strconv.FormatInt(param.RoleId, 10) 76 + url := gateway.baseUrL + "/menus/" + strconv.FormatInt(param.MenuId, 10)
77 method := "delete" 77 method := "delete"
78 req := gateway.CreateRequest(url, method) 78 req := gateway.CreateRequest(url, method)
79 log.Logger.Debug("向用户模块请求数据:移除菜单。", map[string]interface{}{ 79 log.Logger.Debug("向用户模块请求数据:移除菜单。", map[string]interface{}{
@@ -3,7 +3,8 @@ package allied_creation_user @@ -3,7 +3,8 @@ package allied_creation_user
3 //更新我喜欢菜单列表 3 //更新我喜欢菜单列表
4 type ( 4 type (
5 ReqFavoriteMenusUpdate struct { 5 ReqFavoriteMenusUpdate struct {
6 - UserId int64 6 + UserId int64 `json:"userId"`
  7 + FavoriteMenus []string `json:"favoriteMenus"`
7 } 8 }
8 9
9 DataFavoriteMenusUpdate struct { 10 DataFavoriteMenusUpdate struct {
@@ -13,8 +14,8 @@ type ( @@ -13,8 +14,8 @@ type (
13 //移除我收藏的菜单 14 //移除我收藏的菜单
14 type ( 15 type (
15 ReqFavoriteMenusRemove struct { 16 ReqFavoriteMenusRemove struct {
16 - UserId int64  
17 - MenuCode string 17 + UserId int64 `json:"userId"`
  18 + MenuCode string `json:"menuCode"`
18 } 19 }
19 20
20 DataFavoriteMenusRemove struct { 21 DataFavoriteMenusRemove struct {
@@ -24,9 +25,10 @@ type ( @@ -24,9 +25,10 @@ type (
24 //获取我收藏的菜单 25 //获取我收藏的菜单
25 type ( 26 type (
26 ReqFavoriteMenusGet struct { 27 ReqFavoriteMenusGet struct {
27 - UserId int64 28 + UserId int64 `json:"userId"`
28 } 29 }
29 30
30 DataFavoriteMenusGet struct { 31 DataFavoriteMenusGet struct {
  32 + FavoriteMenus []string `json:"favoriteMenus"`
31 } 33 }
32 ) 34 )
@@ -85,7 +85,7 @@ type ( @@ -85,7 +85,7 @@ type (
85 //移除菜单 85 //移除菜单
86 type ( 86 type (
87 ReqMenusRemove struct { 87 ReqMenusRemove struct {
88 - RoleId int64 88 + MenuId int64
89 } 89 }
90 90
91 DataMenusRemove struct { 91 DataMenusRemove struct {
@@ -36,7 +36,7 @@ type ( @@ -36,7 +36,7 @@ type (
36 //移除组织 36 //移除组织
37 type ( 37 type (
38 ReqOrgRemove struct { 38 ReqOrgRemove struct {
39 - OrgId int64 39 + OrgId int64 `json:"orgId"`
40 } 40 }
41 41
42 DataOrgRemove struct { 42 DataOrgRemove struct {
@@ -36,7 +36,7 @@ type ( @@ -36,7 +36,7 @@ type (
36 } 36 }
37 37
38 DataRoleSearch struct { 38 DataRoleSearch struct {
39 - Count int64 39 + Count int64 `json:"count"`
40 Roles []struct { 40 Roles []struct {
41 AccessMenus []Int64String `json:"accessMenus"` 41 AccessMenus []Int64String `json:"accessMenus"`
42 CompanyID Int64String `json:"companyId"` 42 CompanyID Int64String `json:"companyId"`
@@ -87,8 +87,8 @@ type ( @@ -87,8 +87,8 @@ type (
87 //分配角色给多个用户 87 //分配角色给多个用户
88 type ( 88 type (
89 ReqRoleAssign struct { 89 ReqRoleAssign struct {
90 - RoleId int64  
91 - UserIds []int64 90 + RoleId int64 `json:"roleId"`
  91 + UserIds []int64 `json:"userIds"`
92 } 92 }
93 93
94 DataRoleAssign struct { 94 DataRoleAssign struct {
@@ -26,6 +26,7 @@ type BaseServiceGateway struct { @@ -26,6 +26,7 @@ type BaseServiceGateway struct {
26 CompanyId int64 26 CompanyId int64
27 OrgId int64 27 OrgId int64
28 UserId int64 28 UserId int64
  29 + UserBaseId int64
29 } 30 }
30 31
31 func (gateway BaseServiceGateway) CreateRequest(url string, method string) *httplib.BeegoHTTPRequest { 32 func (gateway BaseServiceGateway) CreateRequest(url string, method string) *httplib.BeegoHTTPRequest {
  1 +package sms_serve
  2 +
  3 +import (
  4 + "encoding/json"
  5 + "fmt"
  6 + "time"
  7 +
  8 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
  9 +
  10 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/constant"
  11 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway"
  12 +)
  13 +
  14 +//公共短信服务模块
  15 +type HttplibSmsServe struct {
  16 + service_gateway.BaseServiceGateway
  17 + baseUrL string
  18 +}
  19 +
  20 +func NewHttplibHttplibSmsServe() *HttplibSmsServe {
  21 + return &HttplibSmsServe{
  22 + BaseServiceGateway: service_gateway.BaseServiceGateway{
  23 + ConnectTimeout: 100 * time.Second,
  24 + ReadWriteTimeout: 30 * time.Second,
  25 + },
  26 + baseUrL: constant.ALLIED_CREATION_USER_HOST,
  27 + }
  28 +
  29 +}
  30 +
  31 +//SendSms 公共短信验证码服务 发送验证码
  32 +func (smsServe HttplibSmsServe) SendSms(phone string) error {
  33 + url := smsServe.baseUrL + "/service/sendSms"
  34 + method := "post"
  35 + req := smsServe.CreateRequest(url, method)
  36 + param := map[string]string{
  37 + "phone": phone,
  38 + }
  39 + log.Logger.Debug("向公共短信验证码服务请求数据:短信验证码接口。", map[string]interface{}{
  40 + "api": method + ":" + url,
  41 + "param": param,
  42 + })
  43 + req, err := req.JSONBody(param)
  44 + if err != nil {
  45 + return fmt.Errorf("请求公共短信验证码服务失败:%w", err)
  46 + }
  47 +
  48 + byteResult, err := req.Bytes()
  49 + if err != nil {
  50 + return fmt.Errorf("获取公共短信验证码服务失败:%w", err)
  51 + }
  52 + log.Logger.Debug("获取公共短信验证码服务请求数据", map[string]interface{}{
  53 + "result": string(byteResult),
  54 + })
  55 + var result service_gateway.GatewayResponse
  56 + err = json.Unmarshal(byteResult, &result)
  57 + if err != nil {
  58 + return fmt.Errorf("解析更新组织:%w", err)
  59 + }
  60 + if result.Code != 0 {
  61 + return fmt.Errorf(result.Msg)
  62 + }
  63 + return nil
  64 +}
  65 +
  66 +//CheckSmsCode 公共短信验证码服务 校验验证码
  67 +func (smsServe HttplibSmsServe) CheckSmsCode(phone string, code string) error {
  68 + url := smsServe.baseUrL + "/service/sendSms"
  69 + method := "post"
  70 + req := smsServe.CreateRequest(url, method)
  71 + param := map[string]string{
  72 + "phone": phone,
  73 + "code": code,
  74 + }
  75 + log.Logger.Debug("向公共短信验证码服务请求数据:短信验证码接口。", map[string]interface{}{
  76 + "api": method + ":" + url,
  77 + "param": param,
  78 + })
  79 + req, err := req.JSONBody(param)
  80 + if err != nil {
  81 + return fmt.Errorf("请求公共短信验证码服务失败:%w", err)
  82 + }
  83 +
  84 + byteResult, err := req.Bytes()
  85 + if err != nil {
  86 + return fmt.Errorf("获取公共短信验证码服务失败:%w", err)
  87 + }
  88 + log.Logger.Debug("获取公共短信验证码服务请求数据", map[string]interface{}{
  89 + "result": string(byteResult),
  90 + })
  91 + var result service_gateway.GatewayResponse
  92 + err = json.Unmarshal(byteResult, &result)
  93 + if err != nil {
  94 + return fmt.Errorf("解析更新组织:%w", err)
  95 + }
  96 + if result.Code != 0 {
  97 + return fmt.Errorf(result.Msg)
  98 + }
  99 + return nil
  100 +}
  1 +package mobile_client
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/user/command"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/user/service"
  6 +)
  7 +
  8 +type UserController struct {
  9 + baseController
  10 +}
  11 +
  12 +func (controller *UserController) SendSmsCode() {
  13 + authService := service.UserService{}
  14 + smsCodeCmd := &command.SendSmsCodeCommand{}
  15 + err := controller.Unmarshal(smsCodeCmd)
  16 + if err != nil {
  17 + controller.Response(nil, err)
  18 + return
  19 + }
  20 + err = authService.SendSmsCaptcha(smsCodeCmd)
  21 + controller.Response(nil, err)
  22 +}
  1 +package web_client
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/noticesetting/command"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/noticesetting/query"
  6 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/noticesetting/service"
  7 +)
  8 +
  9 +type NoticeSettingController struct {
  10 + baseController
  11 +}
  12 +
  13 +func (controller *NoticeSettingController) NoticeSettingList() {
  14 + noticeSettingService := service.NewNoticeSettingService(nil)
  15 + noticeSettingListQuery := &query.NoticeSettingListQuery{}
  16 + controller.Unmarshal(noticeSettingListQuery)
  17 + noticeSettingListQuery.Operator = controller.GetOperator()
  18 + cnt, data, err := noticeSettingService.NoticeSettingList(noticeSettingListQuery)
  19 + controller.returnPageListData(cnt, data, err, noticeSettingListQuery.PageNumber)
  20 +}
  21 +
  22 +func (controller *NoticeSettingController) NoticeSettingProfile() {
  23 + noticeSettingService := service.NewNoticeSettingService(nil)
  24 + noticeSettingProfileQuery := &query.NoticeSettingProfileQuery{}
  25 + noticeSettingProfileQuery.Operator = controller.GetOperator()
  26 + data, err := noticeSettingService.NoticeSettingProfile(noticeSettingProfileQuery)
  27 + controller.Response(data, err)
  28 +}
  29 +
  30 +func (controller *NoticeSettingController) NoticeSettingUpdate() {
  31 + noticeSettingService := service.NewNoticeSettingService(nil)
  32 + noticeSettingUpdateCommand := &command.NoticeSettingUpdateCommand{}
  33 + controller.Unmarshal(noticeSettingUpdateCommand)
  34 + noticeSettingUpdateCommand.Operator = controller.GetOperator()
  35 + data, err := noticeSettingService.NoticeSettingUpdate(noticeSettingUpdateCommand)
  36 + controller.Response(data, err)
  37 +}
  38 +
  39 +func (controller *NoticeSettingController) NoticeSettingAdd() {
  40 + noticeSettingService := service.NewNoticeSettingService(nil)
  41 + noticeSettingAddCommand := &command.NoticeSettingAddCommand{}
  42 + controller.Unmarshal(noticeSettingAddCommand)
  43 + noticeSettingAddCommand.Operator = controller.GetOperator()
  44 + data, err := noticeSettingService.NoticeSettingAdd(noticeSettingAddCommand)
  45 + controller.Response(data, err)
  46 +}
  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/mobile_client"
  6 +)
  7 +
  8 +func init() {
  9 + web.Router("/v1/app/users/smsCode", &mobile_client.UserController{}, "Post:SendSmsCode")
  10 +}
  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("/v1/web/notice-setting/search", &web_client.NoticeSettingController{}, "Post:NoticeSettingList")
  10 + web.Router("/v1/web/notice-setting/profile", &web_client.NoticeSettingController{}, "Get:NoticeSettingProfile")
  11 + web.Router("/v1/web/notice-setting/", &web_client.NoticeSettingController{}, "Put:NoticeSettingUpdate")
  12 +}