Merge branch 'dev' of http://gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway into dev
正在显示
32 个修改的文件
包含
214 行增加
和
90 行删除
| @@ -2,11 +2,14 @@ package command | @@ -2,11 +2,14 @@ package command | ||
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | "fmt" | 4 | "fmt" |
| 5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | ||
| 5 | 6 | ||
| 6 | "github.com/beego/beego/v2/core/validation" | 7 | "github.com/beego/beego/v2/core/validation" |
| 7 | ) | 8 | ) |
| 8 | 9 | ||
| 9 | type MenuFavoriteCommand struct { | 10 | type MenuFavoriteCommand struct { |
| 11 | + //操作人 | ||
| 12 | + Operator domain.Operator `json:"-"` | ||
| 10 | // 企业id | 13 | // 企业id |
| 11 | CompanyId int64 `json:"companyId" valid:"Required"` | 14 | CompanyId int64 `json:"companyId" valid:"Required"` |
| 12 | // 对应菜单的id | 15 | // 对应菜单的id |
| @@ -10,12 +10,12 @@ import ( | @@ -10,12 +10,12 @@ import ( | ||
| 10 | type MenuUpdateCommand struct { | 10 | type MenuUpdateCommand struct { |
| 11 | //操作人 | 11 | //操作人 |
| 12 | Operator domain.Operator `json:"-"` | 12 | Operator domain.Operator `json:"-"` |
| 13 | - // 企业id | ||
| 14 | - CompanyId int64 `json:"companyId" valid:"Required"` | ||
| 15 | // 菜单编号 | 13 | // 菜单编号 |
| 16 | MenuId int64 `json:"menuId" valid:"Required"` | 14 | MenuId int64 `json:"menuId" valid:"Required"` |
| 17 | // 菜单名称 | 15 | // 菜单名称 |
| 18 | MenuName string `json:"menuName" valid:"Required"` | 16 | MenuName string `json:"menuName" valid:"Required"` |
| 17 | + // 菜单名称 | ||
| 18 | + MenuAlias string `json:"menuAlias" valid:"Required"` | ||
| 19 | // 排序 | 19 | // 排序 |
| 20 | Sort int `json:"sort" valid:"Required"` | 20 | Sort int `json:"sort" valid:"Required"` |
| 21 | } | 21 | } |
| @@ -10,6 +10,8 @@ import ( | @@ -10,6 +10,8 @@ import ( | ||
| 10 | type MenuListQuery struct { | 10 | type MenuListQuery struct { |
| 11 | //操作人 | 11 | //操作人 |
| 12 | Operator domain.Operator `json:"-"` | 12 | Operator domain.Operator `json:"-"` |
| 13 | + // 菜单类别 web app | ||
| 14 | + MenuCategory string `json:"menuCategory"` | ||
| 13 | } | 15 | } |
| 14 | 16 | ||
| 15 | func (menuListQuery *MenuListQuery) Valid(validation *validation.Validation) { | 17 | func (menuListQuery *MenuListQuery) Valid(validation *validation.Validation) { |
| @@ -13,8 +13,17 @@ type MenuService struct { | @@ -13,8 +13,17 @@ type MenuService struct { | ||
| 13 | 13 | ||
| 14 | // 设置收藏菜单 | 14 | // 设置收藏菜单 |
| 15 | func (menuService *MenuService) MenuFavorite(menuFavoriteCommand *command.MenuFavoriteCommand) (interface{}, error) { | 15 | func (menuService *MenuService) MenuFavorite(menuFavoriteCommand *command.MenuFavoriteCommand) (interface{}, error) { |
| 16 | - | ||
| 17 | - return nil, nil | 16 | + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( |
| 17 | + menuFavoriteCommand.Operator.CompanyId, | ||
| 18 | + menuFavoriteCommand.Operator.OrgId, | ||
| 19 | + menuFavoriteCommand.Operator.UserId) | ||
| 20 | + result, err := creationUserGateway.CompanyGetCustomizeMenus(allied_creation_user.ReqCompanyGetCustomizeMenus{ | ||
| 21 | + CompanyId: menuFavoriteCommand.Operator.CompanyId, | ||
| 22 | + }) | ||
| 23 | + if err != nil { | ||
| 24 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 25 | + } | ||
| 26 | + return result, nil | ||
| 18 | } | 27 | } |
| 19 | 28 | ||
| 20 | // 返回菜单列表 | 29 | // 返回菜单列表 |
| @@ -24,12 +33,15 @@ func (menuService *MenuService) MenuList(menuListQuery *query.MenuListQuery) (in | @@ -24,12 +33,15 @@ func (menuService *MenuService) MenuList(menuListQuery *query.MenuListQuery) (in | ||
| 24 | menuListQuery.Operator.OrgId, | 33 | menuListQuery.Operator.OrgId, |
| 25 | menuListQuery.Operator.UserId) | 34 | menuListQuery.Operator.UserId) |
| 26 | result, err := creationUserGateway.CompanyGetCustomizeMenus(allied_creation_user.ReqCompanyGetCustomizeMenus{ | 35 | result, err := creationUserGateway.CompanyGetCustomizeMenus(allied_creation_user.ReqCompanyGetCustomizeMenus{ |
| 27 | - CompanyId: menuListQuery.Operator.CompanyId, | 36 | + CompanyId: menuListQuery.Operator.CompanyId, |
| 37 | + MenuCategory: menuListQuery.MenuCategory, | ||
| 28 | }) | 38 | }) |
| 29 | if err != nil { | 39 | if err != nil { |
| 30 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 40 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
| 31 | } | 41 | } |
| 32 | - return result, nil | 42 | + return map[string]interface{}{ |
| 43 | + "menus": result.Menus, | ||
| 44 | + }, nil | ||
| 33 | } | 45 | } |
| 34 | 46 | ||
| 35 | // 更新菜单 | 47 | // 更新菜单 |
| @@ -39,8 +51,8 @@ func (menuService *MenuService) MenuUpdate(menuUpdateCommand *command.MenuUpdate | @@ -39,8 +51,8 @@ func (menuService *MenuService) MenuUpdate(menuUpdateCommand *command.MenuUpdate | ||
| 39 | menuUpdateCommand.Operator.OrgId, | 51 | menuUpdateCommand.Operator.OrgId, |
| 40 | menuUpdateCommand.Operator.UserId) | 52 | menuUpdateCommand.Operator.UserId) |
| 41 | _, err := creationUserGateway.CompanySetCustomizeMenus(allied_creation_user.ReqCompanySetCustomizeMenus{ | 53 | _, err := creationUserGateway.CompanySetCustomizeMenus(allied_creation_user.ReqCompanySetCustomizeMenus{ |
| 42 | - CompanyId: menuUpdateCommand.CompanyId, | ||
| 43 | - MenuAlias: menuUpdateCommand.MenuName, | 54 | + CompanyId: menuUpdateCommand.Operator.CompanyId, |
| 55 | + MenuAlias: menuUpdateCommand.MenuAlias, | ||
| 44 | MenuId: int(menuUpdateCommand.MenuId), | 56 | MenuId: int(menuUpdateCommand.MenuId), |
| 45 | Sort: menuUpdateCommand.Sort, | 57 | Sort: menuUpdateCommand.Sort, |
| 46 | }) | 58 | }) |
| @@ -11,7 +11,7 @@ type OrgEnableCommand struct { | @@ -11,7 +11,7 @@ type OrgEnableCommand struct { | ||
| 11 | //操作人 | 11 | //操作人 |
| 12 | Operator domain.Operator `json:"-"` | 12 | Operator domain.Operator `json:"-"` |
| 13 | OrgId string `json:"orgId,omitempty"` | 13 | OrgId string `json:"orgId,omitempty"` |
| 14 | - Status int `json:"status,omitempty"` | 14 | + Status int `json:"orgStatus,omitempty"` |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | func (orgEnableCommand *OrgEnableCommand) Valid(validation *validation.Validation) { | 17 | func (orgEnableCommand *OrgEnableCommand) Valid(validation *validation.Validation) { |
| @@ -7,5 +7,5 @@ type OrgItem struct { | @@ -7,5 +7,5 @@ type OrgItem struct { | ||
| 7 | IsOrg int `json:"isOrg"` | 7 | IsOrg int `json:"isOrg"` |
| 8 | OrgCode string `json:"orgCode"` | 8 | OrgCode string `json:"orgCode"` |
| 9 | ParentDepName string `json:"parentDepName"` | 9 | ParentDepName string `json:"parentDepName"` |
| 10 | + OrgStatus int `json:"orgStatus"` | ||
| 10 | } | 11 | } |
| 11 | - |
| @@ -12,7 +12,7 @@ type OrgListQuery struct { | @@ -12,7 +12,7 @@ type OrgListQuery struct { | ||
| 12 | Operator domain.Operator `json:"-"` | 12 | Operator domain.Operator `json:"-"` |
| 13 | OrgCode string `json:"OrgCode"` | 13 | OrgCode string `json:"OrgCode"` |
| 14 | DepName string `json:"depName"` | 14 | DepName string `json:"depName"` |
| 15 | - ParentId int `json:"parentId"` | 15 | + ParentId string `json:"parentId"` |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | func (orgListQuery *OrgListQuery) Valid(validation *validation.Validation) { | 18 | func (orgListQuery *OrgListQuery) Valid(validation *validation.Validation) { |
| @@ -88,6 +88,7 @@ func (orgsService *OrgsService) OrgList(orgListQuery *query.OrgListQuery) (inter | @@ -88,6 +88,7 @@ func (orgsService *OrgsService) OrgList(orgListQuery *query.OrgListQuery) (inter | ||
| 88 | orgListQuery.Operator.CompanyId, | 88 | orgListQuery.Operator.CompanyId, |
| 89 | orgListQuery.Operator.OrgId, | 89 | orgListQuery.Operator.OrgId, |
| 90 | orgListQuery.Operator.UserId) | 90 | orgListQuery.Operator.UserId) |
| 91 | + parentOrgId, _ := strconv.Atoi(orgListQuery.ParentId) | ||
| 91 | result, err := creationUserGateway.OrgSearch(allied_creation_user.ReqOrgSearch{ | 92 | result, err := creationUserGateway.OrgSearch(allied_creation_user.ReqOrgSearch{ |
| 92 | CompanyId: int(orgListQuery.Operator.CompanyId), | 93 | CompanyId: int(orgListQuery.Operator.CompanyId), |
| 93 | DepName: orgListQuery.DepName, | 94 | DepName: orgListQuery.DepName, |
| @@ -95,7 +96,7 @@ func (orgsService *OrgsService) OrgList(orgListQuery *query.OrgListQuery) (inter | @@ -95,7 +96,7 @@ func (orgsService *OrgsService) OrgList(orgListQuery *query.OrgListQuery) (inter | ||
| 95 | Limit: 0, | 96 | Limit: 0, |
| 96 | Offset: 0, | 97 | Offset: 0, |
| 97 | OrgCode: orgListQuery.OrgCode, | 98 | OrgCode: orgListQuery.OrgCode, |
| 98 | - ParentId: orgListQuery.ParentId, | 99 | + ParentId: parentOrgId, |
| 99 | }) | 100 | }) |
| 100 | if err != nil { | 101 | if err != nil { |
| 101 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 102 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
| @@ -112,6 +113,7 @@ func (orgsService *OrgsService) OrgList(orgListQuery *query.OrgListQuery) (inter | @@ -112,6 +113,7 @@ func (orgsService *OrgsService) OrgList(orgListQuery *query.OrgListQuery) (inter | ||
| 112 | IsOrg: v.IsOrg, | 113 | IsOrg: v.IsOrg, |
| 113 | OrgCode: v.OrgCode, | 114 | OrgCode: v.OrgCode, |
| 114 | ParentDepName: v.Ext.ParentDepName, | 115 | ParentDepName: v.Ext.ParentDepName, |
| 116 | + OrgStatus: v.OrgStatus, | ||
| 115 | } | 117 | } |
| 116 | dataList = append(dataList, item) | 118 | dataList = append(dataList, item) |
| 117 | } | 119 | } |
| @@ -125,11 +127,13 @@ func (orgsService *OrgsService) OrgUpdate(orgUpdateCommand *command.OrgUpdateCom | @@ -125,11 +127,13 @@ func (orgsService *OrgsService) OrgUpdate(orgUpdateCommand *command.OrgUpdateCom | ||
| 125 | orgUpdateCommand.Operator.OrgId, | 127 | orgUpdateCommand.Operator.OrgId, |
| 126 | orgUpdateCommand.Operator.UserId) | 128 | orgUpdateCommand.Operator.UserId) |
| 127 | parentId, _ := strconv.Atoi(orgUpdateCommand.ParentId) | 129 | parentId, _ := strconv.Atoi(orgUpdateCommand.ParentId) |
| 128 | - _, err := creationUserGateway.OrgCreate(allied_creation_user.ReqOrgCreate{ | 130 | + orgId, _ := strconv.Atoi(orgUpdateCommand.OrgId) |
| 131 | + _, err := creationUserGateway.OrgUpdate(allied_creation_user.ReqOrgUpdate{ | ||
| 132 | + OrgId: int64(orgId), | ||
| 129 | IsOrg: orgUpdateCommand.IsOrg, | 133 | IsOrg: orgUpdateCommand.IsOrg, |
| 130 | OrgCode: orgUpdateCommand.OrgCode, | 134 | OrgCode: orgUpdateCommand.OrgCode, |
| 131 | OrgName: orgUpdateCommand.OrgName, | 135 | OrgName: orgUpdateCommand.OrgName, |
| 132 | - ParentId: parentId, | 136 | + ParentId: int64(parentId), |
| 133 | }) | 137 | }) |
| 134 | if err != nil { | 138 | if err != nil { |
| 135 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 139 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
| @@ -121,21 +121,31 @@ func (rolesService *RolesService) RoleList(roleListQuery *query.RoleListQuery) ( | @@ -121,21 +121,31 @@ func (rolesService *RolesService) RoleList(roleListQuery *query.RoleListQuery) ( | ||
| 121 | 121 | ||
| 122 | // 编辑角色关联权限菜单的前置准备数据 | 122 | // 编辑角色关联权限菜单的前置准备数据 |
| 123 | func (rolesService *RolesService) RoleMenuBeforeEdit(roleMenuBeforeEditQuery *query.RoleMenuBeforeEditQuery) (interface{}, error) { | 123 | func (rolesService *RolesService) RoleMenuBeforeEdit(roleMenuBeforeEditQuery *query.RoleMenuBeforeEditQuery) (interface{}, error) { |
| 124 | - //creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( | ||
| 125 | - // roleMenuBeforeEditQuery.Operator.CompanyId, | ||
| 126 | - // roleMenuBeforeEditQuery.Operator.OrgId, | ||
| 127 | - // roleMenuBeforeEditQuery.Operator.UserId) | ||
| 128 | - //roleId, _ := strconv.Atoi(roleMenuBeforeEditQuery.RoleId) | ||
| 129 | - //roles, err := creationUserGateway.RoleSearch(allied_creation_user.ReqRoleSearch{ | ||
| 130 | - // OrgId: roleMenuBeforeEditQuery.Operator.OrgId, | ||
| 131 | - // Limit: 999, | ||
| 132 | - // RoleType: 1, | ||
| 133 | - //}) | ||
| 134 | - //if err != nil { | ||
| 135 | - // return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
| 136 | - //} | 124 | + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( |
| 125 | + roleMenuBeforeEditQuery.Operator.CompanyId, | ||
| 126 | + roleMenuBeforeEditQuery.Operator.OrgId, | ||
| 127 | + roleMenuBeforeEditQuery.Operator.UserId) | ||
| 128 | + roleId, _ := strconv.Atoi(roleMenuBeforeEditQuery.RoleId) | ||
| 129 | + roles, err := creationUserGateway.RoleSearch(allied_creation_user.ReqRoleSearch{ | ||
| 130 | + OrgId: roleMenuBeforeEditQuery.Operator.OrgId, | ||
| 131 | + Limit: 999, | ||
| 132 | + RoleType: 1, | ||
| 133 | + }) | ||
| 134 | + if err != nil { | ||
| 135 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
| 136 | + } | ||
| 137 | 137 | ||
| 138 | - return nil, nil | 138 | + menus, err := creationUserGateway.RoleGetAccessMenus(allied_creation_user.ReqRoleGetAccessMenus{ |
| 139 | + RoleId: int64(roleId), | ||
| 140 | + }) | ||
| 141 | + if err != nil { | ||
| 142 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
| 143 | + } | ||
| 144 | + result := map[string]interface{}{ | ||
| 145 | + "roles": roles.Roles, | ||
| 146 | + "menus": menus.Menus, | ||
| 147 | + } | ||
| 148 | + return result, nil | ||
| 139 | } | 149 | } |
| 140 | 150 | ||
| 141 | // 编辑角色关联用户的前置准备数据 | 151 | // 编辑角色关联用户的前置准备数据 |
| @@ -11,7 +11,7 @@ type CompanyUserEnableCommand struct { | @@ -11,7 +11,7 @@ type CompanyUserEnableCommand struct { | ||
| 11 | //操作人 | 11 | //操作人 |
| 12 | Operator domain.Operator `json:"-"` | 12 | Operator domain.Operator `json:"-"` |
| 13 | //用户id | 13 | //用户id |
| 14 | - UsersIds []int64 `json:"usersIds,omitempty"` | 14 | + UsersIds []string `json:"usersIds,omitempty"` |
| 15 | // 启用状态(启用:1 禁用:2) | 15 | // 启用状态(启用:1 禁用:2) |
| 16 | EnableStatus int `json:"enableStatus,omitempty"` | 16 | EnableStatus int `json:"enableStatus,omitempty"` |
| 17 | } | 17 | } |
| @@ -10,7 +10,7 @@ import ( | @@ -10,7 +10,7 @@ import ( | ||
| 10 | type CompanyUserResetPasswordCommand struct { | 10 | type CompanyUserResetPasswordCommand struct { |
| 11 | //操作人 | 11 | //操作人 |
| 12 | Operator domain.Operator `json:"-"` | 12 | Operator domain.Operator `json:"-"` |
| 13 | - UsersIds []int64 `json:"usersIds" valid:"Required"` | 13 | + UserIds []string `json:"userIds" valid:"Required"` |
| 14 | } | 14 | } |
| 15 | 15 | ||
| 16 | func (companyUserResetPasswordCommand *CompanyUserResetPasswordCommand) Valid(validation *validation.Validation) { | 16 | func (companyUserResetPasswordCommand *CompanyUserResetPasswordCommand) Valid(validation *validation.Validation) { |
| @@ -11,9 +11,9 @@ type CooperationUserAddCommand struct { | @@ -11,9 +11,9 @@ type CooperationUserAddCommand struct { | ||
| 11 | //操作人 | 11 | //操作人 |
| 12 | Operator domain.Operator `json:"-"` | 12 | Operator domain.Operator `json:"-"` |
| 13 | // 用户编号 | 13 | // 用户编号 |
| 14 | - UsersCode string `json:"usersCode" valid:"Required"` | 14 | + UsersCode string `json:"userCode" valid:"Required"` |
| 15 | // 用户姓名 | 15 | // 用户姓名 |
| 16 | - UsersName string `json:"usersName" valid:"Required"` | 16 | + UsersName string `json:"userName" valid:"Required"` |
| 17 | // 共创公司 | 17 | // 共创公司 |
| 18 | CooperationCompany string `json:"cooperationCompany" valid:"Required"` | 18 | CooperationCompany string `json:"cooperationCompany" valid:"Required"` |
| 19 | // 共创公司到期时间 | 19 | // 共创公司到期时间 |
| @@ -11,7 +11,7 @@ type CooperationUserEnableCommand struct { | @@ -11,7 +11,7 @@ type CooperationUserEnableCommand struct { | ||
| 11 | //操作人 | 11 | //操作人 |
| 12 | Operator domain.Operator `json:"-"` | 12 | Operator domain.Operator `json:"-"` |
| 13 | //用户id | 13 | //用户id |
| 14 | - UsersIds []int64 `json:"usersIds,omitempty"` | 14 | + UsersIds []string `json:"userIds,omitempty"` |
| 15 | // 启用状态(启用:1 禁用:2) | 15 | // 启用状态(启用:1 禁用:2) |
| 16 | EnableStatus int `json:"enableStatus,omitempty"` | 16 | EnableStatus int `json:"enableStatus,omitempty"` |
| 17 | } | 17 | } |
| @@ -10,7 +10,7 @@ import ( | @@ -10,7 +10,7 @@ import ( | ||
| 10 | type CooperationUserResetPasswordCommand struct { | 10 | type CooperationUserResetPasswordCommand struct { |
| 11 | //操作人 | 11 | //操作人 |
| 12 | Operator domain.Operator `json:"-"` | 12 | Operator domain.Operator `json:"-"` |
| 13 | - UsersIds []int64 `json:"usersIds" valid:"Required"` | 13 | + UserIds []string `json:"userIds" valid:"Required"` |
| 14 | } | 14 | } |
| 15 | 15 | ||
| 16 | func (cooperationUserResetPasswordCommand *CooperationUserResetPasswordCommand) Valid(validation *validation.Validation) { | 16 | func (cooperationUserResetPasswordCommand *CooperationUserResetPasswordCommand) Valid(validation *validation.Validation) { |
| @@ -11,11 +11,11 @@ type CooperationUserUpdateCommand struct { | @@ -11,11 +11,11 @@ type CooperationUserUpdateCommand struct { | ||
| 11 | //操作人 | 11 | //操作人 |
| 12 | Operator domain.Operator `json:"-"` | 12 | Operator domain.Operator `json:"-"` |
| 13 | // 用户编号 | 13 | // 用户编号 |
| 14 | - UsersId int64 `json:"usersId" valid:"Required"` | 14 | + UserId int64 `json:"userId" valid:"Required"` |
| 15 | // 用户编号 | 15 | // 用户编号 |
| 16 | - UsersCode string `json:"usersCode" valid:"Required"` | 16 | + UserCode string `json:"userCode" valid:"Required"` |
| 17 | // 用户姓名 | 17 | // 用户姓名 |
| 18 | - UsersName string `json:"usersName" valid:"Required"` | 18 | + UserName string `json:"userName" valid:"Required"` |
| 19 | // 共创公司 | 19 | // 共创公司 |
| 20 | CooperationCompany string `json:"cooperationCompany" valid:"Required"` | 20 | CooperationCompany string `json:"cooperationCompany" valid:"Required"` |
| 21 | // 共创公司到期时间 | 21 | // 共创公司到期时间 |
| @@ -23,7 +23,7 @@ type CooperationUserUpdateCommand struct { | @@ -23,7 +23,7 @@ type CooperationUserUpdateCommand struct { | ||
| 23 | // 启用状态(启用:1 禁用:2) | 23 | // 启用状态(启用:1 禁用:2) |
| 24 | EnableStatus int `json:"enableStatus" valid:"Required"` | 24 | EnableStatus int `json:"enableStatus" valid:"Required"` |
| 25 | // 邮箱 | 25 | // 邮箱 |
| 26 | - Email string `json:"email" valid:"Required"` | 26 | + Email string `json:"email"` |
| 27 | //头像 | 27 | //头像 |
| 28 | Avatar string `json:"avatar"` | 28 | Avatar string `json:"avatar"` |
| 29 | 29 |
| @@ -76,7 +76,7 @@ type CooperationUserInfo struct { | @@ -76,7 +76,7 @@ type CooperationUserInfo struct { | ||
| 76 | type CooperationUserItem struct { | 76 | type CooperationUserItem struct { |
| 77 | CooperationCompany string `json:"cooperationCompany"` | 77 | CooperationCompany string `json:"cooperationCompany"` |
| 78 | UserId string `json:"userId"` | 78 | UserId string `json:"userId"` |
| 79 | - CooperationDeadline int64 `json:"cooperationDeadline"` | 79 | + CooperationDeadline string `json:"cooperationDeadline"` |
| 80 | Phone string `json:"phone"` | 80 | Phone string `json:"phone"` |
| 81 | EnableStatus int `json:"enableStatus"` | 81 | EnableStatus int `json:"enableStatus"` |
| 82 | UserCode string `json:"userCode"` | 82 | UserCode string `json:"userCode"` |
| @@ -11,7 +11,7 @@ type CooperationUserGetQuery struct { | @@ -11,7 +11,7 @@ type CooperationUserGetQuery struct { | ||
| 11 | //操作人 | 11 | //操作人 |
| 12 | Operator domain.Operator `json:"-"` | 12 | Operator domain.Operator `json:"-"` |
| 13 | // 用户编号 | 13 | // 用户编号 |
| 14 | - UsersId string `json:"usersId" valid:"Required"` | 14 | + UserId string `json:"userId" valid:"Required"` |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | func (cooperationUserGetQuery *CooperationUserGetQuery) Valid(validation *validation.Validation) { | 17 | func (cooperationUserGetQuery *CooperationUserGetQuery) Valid(validation *validation.Validation) { |
| @@ -130,7 +130,7 @@ func (usersService *UsersService) CompanyUserAdd(companyUserAddCommand *command. | @@ -130,7 +130,7 @@ func (usersService *UsersService) CompanyUserAdd(companyUserAddCommand *command. | ||
| 130 | Phone: companyUserAddCommand.Phone, | 130 | Phone: companyUserAddCommand.Phone, |
| 131 | Avatar: companyUserAddCommand.Avator, | 131 | Avatar: companyUserAddCommand.Avator, |
| 132 | Email: companyUserAddCommand.Avator, | 132 | Email: companyUserAddCommand.Avator, |
| 133 | - Password: "", //TODO 填充密码 | 133 | + Password: "123456", //TODO 填充密码 |
| 134 | }) | 134 | }) |
| 135 | 135 | ||
| 136 | data := struct { | 136 | data := struct { |
| @@ -149,10 +149,19 @@ func (usersService *UsersService) CompanyUserEnable(companyUserEnableCommand *co | @@ -149,10 +149,19 @@ func (usersService *UsersService) CompanyUserEnable(companyUserEnableCommand *co | ||
| 149 | companyUserEnableCommand.Operator.CompanyId, | 149 | companyUserEnableCommand.Operator.CompanyId, |
| 150 | companyUserEnableCommand.Operator.OrgId, | 150 | companyUserEnableCommand.Operator.OrgId, |
| 151 | companyUserEnableCommand.Operator.UserId) | 151 | companyUserEnableCommand.Operator.UserId) |
| 152 | + | ||
| 153 | + var userIds []int64 | ||
| 154 | + for i := range companyUserEnableCommand.UsersIds { | ||
| 155 | + id, _ := strconv.Atoi(companyUserEnableCommand.UsersIds[i]) | ||
| 156 | + userIds = append(userIds, int64(id)) | ||
| 157 | + } | ||
| 152 | _, err := creationUserGateway.UserBatchEnable(allied_creation_user.ReqBatchEnableUser{ | 158 | _, err := creationUserGateway.UserBatchEnable(allied_creation_user.ReqBatchEnableUser{ |
| 153 | - UserIds: companyUserEnableCommand.UsersIds, | 159 | + UserIds: userIds, |
| 154 | EnableStatus: companyUserEnableCommand.EnableStatus, | 160 | EnableStatus: companyUserEnableCommand.EnableStatus, |
| 155 | }) | 161 | }) |
| 162 | + if err != nil { | ||
| 163 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
| 164 | + } | ||
| 156 | return companyUserEnableCommand, err | 165 | return companyUserEnableCommand, err |
| 157 | } | 166 | } |
| 158 | 167 | ||
| @@ -171,7 +180,7 @@ func (usersService *UsersService) CompanyUserList(companyUserListQuery *query.Co | @@ -171,7 +180,7 @@ func (usersService *UsersService) CompanyUserList(companyUserListQuery *query.Co | ||
| 171 | }) | 180 | }) |
| 172 | 181 | ||
| 173 | if err != nil { | 182 | if err != nil { |
| 174 | - return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 183 | + return 0, nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) |
| 175 | } | 184 | } |
| 176 | //数据转换 | 185 | //数据转换 |
| 177 | cnt := int64(result.Count) | 186 | cnt := int64(result.Count) |
| @@ -200,10 +209,18 @@ func (usersService *UsersService) CompanyUserResetPassword(companyUserResetPassw | @@ -200,10 +209,18 @@ func (usersService *UsersService) CompanyUserResetPassword(companyUserResetPassw | ||
| 200 | companyUserResetPasswordCommand.Operator.CompanyId, | 209 | companyUserResetPasswordCommand.Operator.CompanyId, |
| 201 | companyUserResetPasswordCommand.Operator.OrgId, | 210 | companyUserResetPasswordCommand.Operator.OrgId, |
| 202 | companyUserResetPasswordCommand.Operator.UserId) | 211 | companyUserResetPasswordCommand.Operator.UserId) |
| 212 | + var userIds []int64 | ||
| 213 | + for i := range companyUserResetPasswordCommand.UserIds { | ||
| 214 | + id, _ := strconv.Atoi(companyUserResetPasswordCommand.UserIds[i]) | ||
| 215 | + userIds = append(userIds, int64(id)) | ||
| 216 | + } | ||
| 203 | _, err := creationUserGateway.UserBatchResetPassword(allied_creation_user.ReqBatchResetPasswordUser{ | 217 | _, err := creationUserGateway.UserBatchResetPassword(allied_creation_user.ReqBatchResetPasswordUser{ |
| 204 | - Password: "", //TODO 填充密码 | ||
| 205 | - UserIds: companyUserResetPasswordCommand.UsersIds, | 218 | + Password: "123456", //TODO 填充密码 |
| 219 | + UserIds: userIds, | ||
| 206 | }) | 220 | }) |
| 221 | + if err != nil { | ||
| 222 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
| 223 | + } | ||
| 207 | return companyUserResetPasswordCommand, err | 224 | return companyUserResetPasswordCommand, err |
| 208 | } | 225 | } |
| 209 | 226 | ||
| @@ -244,6 +261,9 @@ func (usersService *UsersService) CompanyUserUpdate(companyUserUpdateCommand *co | @@ -244,6 +261,9 @@ func (usersService *UsersService) CompanyUserUpdate(companyUserUpdateCommand *co | ||
| 244 | Avatar: companyUserUpdateCommand.Avator, | 261 | Avatar: companyUserUpdateCommand.Avator, |
| 245 | Email: companyUserUpdateCommand.Avator, | 262 | Email: companyUserUpdateCommand.Avator, |
| 246 | }) | 263 | }) |
| 264 | + if err != nil { | ||
| 265 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
| 266 | + } | ||
| 247 | return companyUserUpdateCommand, err | 267 | return companyUserUpdateCommand, err |
| 248 | } | 268 | } |
| 249 | 269 | ||
| @@ -254,8 +274,9 @@ func (usersService *UsersService) CooperationUserAdd(cooperationUserAddCommand * | @@ -254,8 +274,9 @@ func (usersService *UsersService) CooperationUserAdd(cooperationUserAddCommand * | ||
| 254 | cooperationUserAddCommand.Operator.OrgId, | 274 | cooperationUserAddCommand.Operator.OrgId, |
| 255 | cooperationUserAddCommand.Operator.UserId) | 275 | cooperationUserAddCommand.Operator.UserId) |
| 256 | result, err := creationUserGateway.CooperatorUserCreate(allied_creation_user.ReqCreateCooperatorUser{ | 276 | result, err := creationUserGateway.CooperatorUserCreate(allied_creation_user.ReqCreateCooperatorUser{ |
| 277 | + CompanyId: cooperationUserAddCommand.Operator.CompanyId, | ||
| 257 | CooperationCompany: cooperationUserAddCommand.CooperationCompany, | 278 | CooperationCompany: cooperationUserAddCommand.CooperationCompany, |
| 258 | - CooperationDeadline: time.Unix(cooperationUserAddCommand.CooperationDeadline, 0), | 279 | + CooperationDeadline: time.Unix(cooperationUserAddCommand.CooperationDeadline/1000, 0), |
| 259 | Email: cooperationUserAddCommand.Email, | 280 | Email: cooperationUserAddCommand.Email, |
| 260 | EnableStatus: cooperationUserAddCommand.EnableStatus, | 281 | EnableStatus: cooperationUserAddCommand.EnableStatus, |
| 261 | UserCode: cooperationUserAddCommand.UsersCode, | 282 | UserCode: cooperationUserAddCommand.UsersCode, |
| @@ -265,6 +286,9 @@ func (usersService *UsersService) CooperationUserAdd(cooperationUserAddCommand * | @@ -265,6 +286,9 @@ func (usersService *UsersService) CooperationUserAdd(cooperationUserAddCommand * | ||
| 265 | Phone: cooperationUserAddCommand.Phone, | 286 | Phone: cooperationUserAddCommand.Phone, |
| 266 | Password: "123456", //TODO 填充默认密码 | 287 | Password: "123456", //TODO 填充默认密码 |
| 267 | }) | 288 | }) |
| 289 | + if err != nil { | ||
| 290 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
| 291 | + } | ||
| 268 | data := struct { | 292 | data := struct { |
| 269 | UserId string `json:"userId"` | 293 | UserId string `json:"userId"` |
| 270 | command.CooperationUserAddCommand | 294 | command.CooperationUserAddCommand |
| @@ -281,10 +305,18 @@ func (usersService *UsersService) CooperationUserEnable(cooperationUserEnableCom | @@ -281,10 +305,18 @@ func (usersService *UsersService) CooperationUserEnable(cooperationUserEnableCom | ||
| 281 | cooperationUserEnableCommand.Operator.CompanyId, | 305 | cooperationUserEnableCommand.Operator.CompanyId, |
| 282 | cooperationUserEnableCommand.Operator.OrgId, | 306 | cooperationUserEnableCommand.Operator.OrgId, |
| 283 | cooperationUserEnableCommand.Operator.UserId) | 307 | cooperationUserEnableCommand.Operator.UserId) |
| 308 | + var userIds []int64 | ||
| 309 | + for i := range cooperationUserEnableCommand.UsersIds { | ||
| 310 | + id, _ := strconv.Atoi(cooperationUserEnableCommand.UsersIds[i]) | ||
| 311 | + userIds = append(userIds, int64(id)) | ||
| 312 | + } | ||
| 284 | _, err := creationUserGateway.UserBatchEnable(allied_creation_user.ReqBatchEnableUser{ | 313 | _, err := creationUserGateway.UserBatchEnable(allied_creation_user.ReqBatchEnableUser{ |
| 285 | - UserIds: cooperationUserEnableCommand.UsersIds, | 314 | + UserIds: userIds, |
| 286 | EnableStatus: cooperationUserEnableCommand.EnableStatus, | 315 | EnableStatus: cooperationUserEnableCommand.EnableStatus, |
| 287 | }) | 316 | }) |
| 317 | + if err != nil { | ||
| 318 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
| 319 | + } | ||
| 288 | return cooperationUserEnableCommand, err | 320 | return cooperationUserEnableCommand, err |
| 289 | } | 321 | } |
| 290 | 322 | ||
| @@ -294,12 +326,12 @@ func (usersService *UsersService) CooperationUserGet(cooperationUserGetQuery *qu | @@ -294,12 +326,12 @@ func (usersService *UsersService) CooperationUserGet(cooperationUserGetQuery *qu | ||
| 294 | cooperationUserGetQuery.Operator.CompanyId, | 326 | cooperationUserGetQuery.Operator.CompanyId, |
| 295 | cooperationUserGetQuery.Operator.OrgId, | 327 | cooperationUserGetQuery.Operator.OrgId, |
| 296 | cooperationUserGetQuery.Operator.UserId) | 328 | cooperationUserGetQuery.Operator.UserId) |
| 297 | - userId, _ := strconv.Atoi(cooperationUserGetQuery.UsersId) | 329 | + userId, _ := strconv.Atoi(cooperationUserGetQuery.UserId) |
| 298 | result, err := creationUserGateway.UserGet(allied_creation_user.ReqGateUser{ | 330 | result, err := creationUserGateway.UserGet(allied_creation_user.ReqGateUser{ |
| 299 | UserId: userId, | 331 | UserId: userId, |
| 300 | }) | 332 | }) |
| 301 | if err != nil { | 333 | if err != nil { |
| 302 | - return nil, err | 334 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) |
| 303 | } | 335 | } |
| 304 | deadline := result.CooperationInfo.CooperationDeadline.Unix() | 336 | deadline := result.CooperationInfo.CooperationDeadline.Unix() |
| 305 | userInfo := dto.CooperationUserInfo{ | 337 | userInfo := dto.CooperationUserInfo{ |
| @@ -320,14 +352,16 @@ func (usersService *UsersService) CooperationUserGet(cooperationUserGetQuery *qu | @@ -320,14 +352,16 @@ func (usersService *UsersService) CooperationUserGet(cooperationUserGetQuery *qu | ||
| 320 | func (usersService *UsersService) CooperationUserList(cooperationUserListQuery *query.CooperationUserListQuery) (int64, interface{}, error) { | 352 | func (usersService *UsersService) CooperationUserList(cooperationUserListQuery *query.CooperationUserListQuery) (int64, interface{}, error) { |
| 321 | creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(0, 0, 0) | 353 | creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(0, 0, 0) |
| 322 | result, err := creationUserGateway.UserSearch(allied_creation_user.ReqUserSearch{ | 354 | result, err := creationUserGateway.UserSearch(allied_creation_user.ReqUserSearch{ |
| 323 | - Offset: (cooperationUserListQuery.PageNumber - 1) * cooperationUserListQuery.PageSize, | ||
| 324 | - Limit: cooperationUserListQuery.PageSize, | ||
| 325 | - CompanyId: cooperationUserListQuery.Operator.CompanyId, | ||
| 326 | - OrganizationId: cooperationUserListQuery.Operator.OrgId, | ||
| 327 | - DepartmentId: 0, | ||
| 328 | - UserName: cooperationUserListQuery.UserName, | ||
| 329 | - DepName: "", | ||
| 330 | - Phone: "", | 355 | + Offset: (cooperationUserListQuery.PageNumber - 1) * cooperationUserListQuery.PageSize, |
| 356 | + Limit: cooperationUserListQuery.PageSize, | ||
| 357 | + CompanyId: cooperationUserListQuery.Operator.CompanyId, | ||
| 358 | + OrganizationId: cooperationUserListQuery.Operator.OrgId, | ||
| 359 | + DepartmentId: 0, | ||
| 360 | + UserName: cooperationUserListQuery.UserName, | ||
| 361 | + CooperationCompany: cooperationUserListQuery.CooperationCompany, | ||
| 362 | + DepName: "", | ||
| 363 | + Phone: "", | ||
| 364 | + UserType: 2, | ||
| 331 | }) | 365 | }) |
| 332 | var ( | 366 | var ( |
| 333 | listData []dto.CooperationUserItem | 367 | listData []dto.CooperationUserItem |
| @@ -338,7 +372,7 @@ func (usersService *UsersService) CooperationUserList(cooperationUserListQuery * | @@ -338,7 +372,7 @@ func (usersService *UsersService) CooperationUserList(cooperationUserListQuery * | ||
| 338 | item = dto.CooperationUserItem{ | 372 | item = dto.CooperationUserItem{ |
| 339 | CooperationCompany: v.CooperationInfo.CooperationCompany, | 373 | CooperationCompany: v.CooperationInfo.CooperationCompany, |
| 340 | UserId: strconv.Itoa(v.UserId), | 374 | UserId: strconv.Itoa(v.UserId), |
| 341 | - CooperationDeadline: v.CooperationInfo.CooperationDeadline.Unix(), | 375 | + CooperationDeadline: v.CooperationInfo.CooperationDeadline.Format("2006-01-02"), |
| 342 | Phone: v.UserInfo.Phone, | 376 | Phone: v.UserInfo.Phone, |
| 343 | EnableStatus: v.EnableStatus, | 377 | EnableStatus: v.EnableStatus, |
| 344 | UserCode: v.UserCode, | 378 | UserCode: v.UserCode, |
| @@ -357,11 +391,20 @@ func (usersService *UsersService) CooperationUserResetPassword(cooperationUserRe | @@ -357,11 +391,20 @@ func (usersService *UsersService) CooperationUserResetPassword(cooperationUserRe | ||
| 357 | cooperationUserResetPasswordCommand.Operator.CompanyId, | 391 | cooperationUserResetPasswordCommand.Operator.CompanyId, |
| 358 | cooperationUserResetPasswordCommand.Operator.OrgId, | 392 | cooperationUserResetPasswordCommand.Operator.OrgId, |
| 359 | cooperationUserResetPasswordCommand.Operator.UserId) | 393 | cooperationUserResetPasswordCommand.Operator.UserId) |
| 394 | + var userIds []int64 | ||
| 395 | + for i := range cooperationUserResetPasswordCommand.UserIds { | ||
| 396 | + id, _ := strconv.Atoi(cooperationUserResetPasswordCommand.UserIds[i]) | ||
| 397 | + userIds = append(userIds, int64(id)) | ||
| 398 | + } | ||
| 360 | _, err := creationUserGateway.UserBatchResetPassword(allied_creation_user.ReqBatchResetPasswordUser{ | 399 | _, err := creationUserGateway.UserBatchResetPassword(allied_creation_user.ReqBatchResetPasswordUser{ |
| 361 | - Password: "", //TODO 填充密码 | ||
| 362 | - UserIds: cooperationUserResetPasswordCommand.UsersIds, | 400 | + Password: "123456", //TODO 填充密码 |
| 401 | + UserIds: userIds, | ||
| 363 | }) | 402 | }) |
| 364 | - return cooperationUserResetPasswordCommand, err | 403 | + if err != nil { |
| 404 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
| 405 | + } | ||
| 406 | + // TODO:返回消息提示 密码重置成功,初始密码为TL123456! | ||
| 407 | + return "123456", err | ||
| 365 | } | 408 | } |
| 366 | 409 | ||
| 367 | // 编辑共创用户信息 | 410 | // 编辑共创用户信息 |
| @@ -371,17 +414,20 @@ func (usersService *UsersService) CooperationUserUpdate(cooperationUserUpdateCom | @@ -371,17 +414,20 @@ func (usersService *UsersService) CooperationUserUpdate(cooperationUserUpdateCom | ||
| 371 | cooperationUserUpdateCommand.Operator.OrgId, | 414 | cooperationUserUpdateCommand.Operator.OrgId, |
| 372 | cooperationUserUpdateCommand.Operator.UserId) | 415 | cooperationUserUpdateCommand.Operator.UserId) |
| 373 | _, err := creationUserGateway.CooperatorUserUpdate(allied_creation_user.ReqUpdateCooperatorUser{ | 416 | _, err := creationUserGateway.CooperatorUserUpdate(allied_creation_user.ReqUpdateCooperatorUser{ |
| 374 | - UserId: cooperationUserUpdateCommand.UsersId, | 417 | + UserId: cooperationUserUpdateCommand.UserId, |
| 375 | CooperationCompany: cooperationUserUpdateCommand.CooperationCompany, | 418 | CooperationCompany: cooperationUserUpdateCommand.CooperationCompany, |
| 376 | CooperationDeadline: time.Unix(cooperationUserUpdateCommand.CooperationDeadline, 0), | 419 | CooperationDeadline: time.Unix(cooperationUserUpdateCommand.CooperationDeadline, 0), |
| 377 | Email: cooperationUserUpdateCommand.Email, | 420 | Email: cooperationUserUpdateCommand.Email, |
| 378 | EnableStatus: cooperationUserUpdateCommand.EnableStatus, | 421 | EnableStatus: cooperationUserUpdateCommand.EnableStatus, |
| 379 | - UserCode: cooperationUserUpdateCommand.UsersCode, | ||
| 380 | - UserName: cooperationUserUpdateCommand.UsersName, | 422 | + UserCode: cooperationUserUpdateCommand.UserCode, |
| 423 | + UserName: cooperationUserUpdateCommand.UserName, | ||
| 381 | Avatar: cooperationUserUpdateCommand.Avatar, | 424 | Avatar: cooperationUserUpdateCommand.Avatar, |
| 382 | OrgId: cooperationUserUpdateCommand.Operator.OrgId, | 425 | OrgId: cooperationUserUpdateCommand.Operator.OrgId, |
| 383 | Phone: cooperationUserUpdateCommand.Phone, | 426 | Phone: cooperationUserUpdateCommand.Phone, |
| 384 | }) | 427 | }) |
| 428 | + if err != nil { | ||
| 429 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
| 430 | + } | ||
| 385 | return cooperationUserUpdateCommand, err | 431 | return cooperationUserUpdateCommand, err |
| 386 | } | 432 | } |
| 387 | 433 | ||
| @@ -401,7 +447,7 @@ func (usersService *UsersService) SelectorCompanyOrg(selectorQuery *query.Compan | @@ -401,7 +447,7 @@ func (usersService *UsersService) SelectorCompanyOrg(selectorQuery *query.Compan | ||
| 401 | ParentId: 0, | 447 | ParentId: 0, |
| 402 | }) | 448 | }) |
| 403 | if err != nil { | 449 | if err != nil { |
| 404 | - return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 450 | + return 0, nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) |
| 405 | } | 451 | } |
| 406 | var ( | 452 | var ( |
| 407 | dataList []dto.UserOrg | 453 | dataList []dto.UserOrg |
| @@ -431,7 +477,7 @@ func (usersService *UsersService) SelectorCompanyRole(selectorQuery *query.Compa | @@ -431,7 +477,7 @@ func (usersService *UsersService) SelectorCompanyRole(selectorQuery *query.Compa | ||
| 431 | RoleName: selectorQuery.RoleName, | 477 | RoleName: selectorQuery.RoleName, |
| 432 | }) | 478 | }) |
| 433 | if err != nil { | 479 | if err != nil { |
| 434 | - return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 480 | + return 0, nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) |
| 435 | } | 481 | } |
| 436 | var ( | 482 | var ( |
| 437 | dataList []dto.UserRole | 483 | dataList []dto.UserRole |
| @@ -197,7 +197,7 @@ func (gateway HttplibAlliedCreationUser) CompanySearch(param ReqCompanySearch) ( | @@ -197,7 +197,7 @@ func (gateway HttplibAlliedCreationUser) CompanySearch(param ReqCompanySearch) ( | ||
| 197 | 197 | ||
| 198 | // CompanyGetCustomizeMenus 返回自定义菜单列表 | 198 | // CompanyGetCustomizeMenus 返回自定义菜单列表 |
| 199 | func (gateway HttplibAlliedCreationUser) CompanyGetCustomizeMenus(param ReqCompanyGetCustomizeMenus) (*DataCompanyGetCustomizeMenus, error) { | 199 | func (gateway HttplibAlliedCreationUser) CompanyGetCustomizeMenus(param ReqCompanyGetCustomizeMenus) (*DataCompanyGetCustomizeMenus, error) { |
| 200 | - url := gateway.baseUrL + "/company/" + strconv.FormatInt(param.CompanyId, 10) + "/customize-menus" | 200 | + url := gateway.baseUrL + "/company/" + strconv.FormatInt(param.CompanyId, 10) + "/customize-menus?menuCategory=" + param.MenuCategory |
| 201 | method := "get" | 201 | method := "get" |
| 202 | req := gateway.CreateRequest(url, method) | 202 | req := gateway.CreateRequest(url, method) |
| 203 | log.Logger.Debug("向用户模块请求数据:返回自定义菜单列表。", map[string]interface{}{ | 203 | log.Logger.Debug("向用户模块请求数据:返回自定义菜单列表。", map[string]interface{}{ |
| @@ -63,7 +63,9 @@ type ( | @@ -63,7 +63,9 @@ type ( | ||
| 63 | //返回自定义菜单列表 | 63 | //返回自定义菜单列表 |
| 64 | type ( | 64 | type ( |
| 65 | ReqCompanyGetCustomizeMenus struct { | 65 | ReqCompanyGetCustomizeMenus struct { |
| 66 | - CompanyId int64 | 66 | + CompanyId int64 `json:"companyId"` |
| 67 | + // 菜单类别 web app | ||
| 68 | + MenuCategory string `cname:"菜单类别" json:"menuCategory,omitempty"` | ||
| 67 | } | 69 | } |
| 68 | 70 | ||
| 69 | DataCompanyGetCustomizeMenus struct { | 71 | DataCompanyGetCustomizeMenus struct { |
| @@ -19,6 +19,14 @@ type ( | @@ -19,6 +19,14 @@ type ( | ||
| 19 | type ( | 19 | type ( |
| 20 | ReqOrgUpdate struct { | 20 | ReqOrgUpdate struct { |
| 21 | OrgId int64 | 21 | OrgId int64 |
| 22 | + // 组织编码 | ||
| 23 | + OrgCode string `cname:"组织编码" json:"orgCode"` | ||
| 24 | + // 组织名称 | ||
| 25 | + OrgName string `cname:"组织名称" json:"orgName"` | ||
| 26 | + // 是否是组织(是:1 不是:2) | ||
| 27 | + IsOrg int `cname:"是否是组织(是:1 不是:2)" json:"isOrg"` | ||
| 28 | + // 父级ID | ||
| 29 | + ParentId int64 `cname:"父级ID" json:"parentId" valid:"Required"` | ||
| 22 | } | 30 | } |
| 23 | 31 | ||
| 24 | DataOrgUpdate struct { | 32 | DataOrgUpdate struct { |
| @@ -38,10 +38,10 @@ type ( | @@ -38,10 +38,10 @@ type ( | ||
| 38 | DataRoleSearch struct { | 38 | DataRoleSearch struct { |
| 39 | Count int64 | 39 | Count int64 |
| 40 | Roles []struct { | 40 | Roles []struct { |
| 41 | - AccessMenus []int `json:"accessMenus"` | ||
| 42 | - CompanyID Int64String `json:"companyId"` | ||
| 43 | - CreatedAt string `json:"createdAt"` | ||
| 44 | - Desc string `json:"desc"` | 41 | + AccessMenus []Int64String `json:"accessMenus"` |
| 42 | + CompanyID Int64String `json:"companyId"` | ||
| 43 | + CreatedAt string `json:"createdAt"` | ||
| 44 | + Desc string `json:"desc"` | ||
| 45 | Ext struct { | 45 | Ext struct { |
| 46 | DepName string `json:"depName"` | 46 | DepName string `json:"depName"` |
| 47 | OrgName string `json:"orgName"` | 47 | OrgName string `json:"orgName"` |
| @@ -188,20 +188,20 @@ type ( | @@ -188,20 +188,20 @@ type ( | ||
| 188 | 188 | ||
| 189 | DataRoleGetAccessMenus struct { | 189 | DataRoleGetAccessMenus struct { |
| 190 | Menus []struct { | 190 | Menus []struct { |
| 191 | - MenuID int `json:"menuId"` | ||
| 192 | - ParentID int `json:"parentId"` | ||
| 193 | - MenuName string `json:"menuName"` | ||
| 194 | - MenuAlias string `json:"menuAlias"` | ||
| 195 | - Code string `json:"code"` | ||
| 196 | - AccessCode string `json:"accessCode,omitempty"` | ||
| 197 | - MenuType string `json:"menuType"` | ||
| 198 | - Icon string `json:"icon"` | ||
| 199 | - Sort int `json:"sort"` | ||
| 200 | - Remark string `json:"remark,omitempty"` | ||
| 201 | - Category string `json:"category"` | ||
| 202 | - IsPublish int `json:"isPublish"` | ||
| 203 | - EnableStatus int `json:"enableStatus"` | ||
| 204 | - ParentPath string `json:"parentPath,omitempty"` | 191 | + MenuID Int64String `json:"menuId"` |
| 192 | + ParentID Int64String `json:"parentId"` | ||
| 193 | + MenuName string `json:"menuName"` | ||
| 194 | + MenuAlias string `json:"menuAlias"` | ||
| 195 | + Code string `json:"code"` | ||
| 196 | + AccessCode string `json:"accessCode,omitempty"` | ||
| 197 | + MenuType string `json:"menuType"` | ||
| 198 | + Icon string `json:"icon"` | ||
| 199 | + Sort int `json:"sort"` | ||
| 200 | + Remark string `json:"remark,omitempty"` | ||
| 201 | + Category string `json:"category"` | ||
| 202 | + IsPublish int `json:"isPublish"` | ||
| 203 | + EnableStatus int `json:"enableStatus"` | ||
| 204 | + ParentPath string `json:"parentPath,omitempty"` | ||
| 205 | } `json:"menus"` | 205 | } `json:"menus"` |
| 206 | } | 206 | } |
| 207 | ) | 207 | ) |
| @@ -72,10 +72,16 @@ type ( | @@ -72,10 +72,16 @@ type ( | ||
| 72 | DepartmentId int64 `json:"departmentId"` | 72 | DepartmentId int64 `json:"departmentId"` |
| 73 | // 用户姓名 | 73 | // 用户姓名 |
| 74 | UserName string `json:"userName"` | 74 | UserName string `json:"userName"` |
| 75 | + // 共创公司 | ||
| 76 | + CooperationCompany string `cname:"共创公司" json:"cooperationCompany,omitempty"` | ||
| 75 | // 部门名称 | 77 | // 部门名称 |
| 76 | DepName string `json:"depName"` | 78 | DepName string `json:"depName"` |
| 77 | // 手机号码 | 79 | // 手机号码 |
| 78 | Phone string `json:"phone"` | 80 | Phone string `json:"phone"` |
| 81 | + // 用户类型 | ||
| 82 | + UserType int `cname:"用户类型 1:普通用户 2:共创用户 1024:企业注册用户" json:"userType,omitempty"` | ||
| 83 | + // 实时拉取数据 (获取最新的) | ||
| 84 | + PullRealTime bool `cname:"拉取最新数据" json:"pullRealTime,omitempty"` | ||
| 79 | } | 85 | } |
| 80 | 86 | ||
| 81 | //DataUserSearch 搜索用户列表 | 87 | //DataUserSearch 搜索用户列表 |
| @@ -205,6 +211,8 @@ type ( | @@ -205,6 +211,8 @@ type ( | ||
| 205 | //创建共创用户 | 211 | //创建共创用户 |
| 206 | type ( | 212 | type ( |
| 207 | ReqCreateCooperatorUser struct { | 213 | ReqCreateCooperatorUser struct { |
| 214 | + // 企业ID | ||
| 215 | + CompanyId int64 `cname:"企业ID" json:"companyId"` | ||
| 208 | // 共创公司 | 216 | // 共创公司 |
| 209 | CooperationCompany string ` json:"cooperationCompany"` | 217 | CooperationCompany string ` json:"cooperationCompany"` |
| 210 | // 共创到期时间 | 218 | // 共创到期时间 |
| @@ -13,6 +13,7 @@ type MenuController struct { | @@ -13,6 +13,7 @@ type MenuController struct { | ||
| 13 | func (controller *MenuController) MenuList() { | 13 | func (controller *MenuController) MenuList() { |
| 14 | menuService := service.NewMenuService(nil) | 14 | menuService := service.NewMenuService(nil) |
| 15 | menuListQuery := &query.MenuListQuery{} | 15 | menuListQuery := &query.MenuListQuery{} |
| 16 | + controller.Unmarshal(menuListQuery) | ||
| 16 | menuListQuery.Operator = controller.GetOperator() | 17 | menuListQuery.Operator = controller.GetOperator() |
| 17 | data, err := menuService.MenuList(menuListQuery) | 18 | data, err := menuService.MenuList(menuListQuery) |
| 18 | controller.Response(data, err) | 19 | controller.Response(data, err) |
| @@ -31,6 +32,7 @@ func (controller *MenuController) MenuFavorite() { | @@ -31,6 +32,7 @@ func (controller *MenuController) MenuFavorite() { | ||
| 31 | menuService := service.NewMenuService(nil) | 32 | menuService := service.NewMenuService(nil) |
| 32 | menuFavoriteCommand := &command.MenuFavoriteCommand{} | 33 | menuFavoriteCommand := &command.MenuFavoriteCommand{} |
| 33 | controller.Unmarshal(menuFavoriteCommand) | 34 | controller.Unmarshal(menuFavoriteCommand) |
| 35 | + menuFavoriteCommand.Operator = controller.GetOperator() | ||
| 34 | data, err := menuService.MenuFavorite(menuFavoriteCommand) | 36 | data, err := menuService.MenuFavorite(menuFavoriteCommand) |
| 35 | controller.Response(data, err) | 37 | controller.Response(data, err) |
| 36 | } | 38 | } |
| @@ -48,3 +48,12 @@ func (controller *OrgsController) OrgGet() { | @@ -48,3 +48,12 @@ func (controller *OrgsController) OrgGet() { | ||
| 48 | data, err := orgsService.OrgGet(orgGetQuery) | 48 | data, err := orgsService.OrgGet(orgGetQuery) |
| 49 | controller.Response(data, err) | 49 | controller.Response(data, err) |
| 50 | } | 50 | } |
| 51 | + | ||
| 52 | +func (controller *OrgsController) OrgEnable() { | ||
| 53 | + orgsService := service.NewOrgsService(nil) | ||
| 54 | + orgEnableCommand := &command.OrgEnableCommand{} | ||
| 55 | + controller.Unmarshal(orgEnableCommand) | ||
| 56 | + orgEnableCommand.Operator = controller.GetOperator() | ||
| 57 | + data, err := orgsService.OrgEnable(orgEnableCommand) | ||
| 58 | + controller.Response(data, err) | ||
| 59 | +} |
| @@ -92,6 +92,8 @@ func (controller *RolesController) RoleMenuBeforeEdit() { | @@ -92,6 +92,8 @@ func (controller *RolesController) RoleMenuBeforeEdit() { | ||
| 92 | roleMenuBeforeEditQuery := &query.RoleMenuBeforeEditQuery{} | 92 | roleMenuBeforeEditQuery := &query.RoleMenuBeforeEditQuery{} |
| 93 | roleMenuBeforeEditQuery.Operator = controller.GetOperator() | 93 | roleMenuBeforeEditQuery.Operator = controller.GetOperator() |
| 94 | controller.Unmarshal(roleMenuBeforeEditQuery) | 94 | controller.Unmarshal(roleMenuBeforeEditQuery) |
| 95 | + roleId := controller.GetString(":roleId") | ||
| 96 | + roleMenuBeforeEditQuery.RoleId = roleId | ||
| 95 | data, err := rolesService.RoleMenuBeforeEdit(roleMenuBeforeEditQuery) | 97 | data, err := rolesService.RoleMenuBeforeEdit(roleMenuBeforeEditQuery) |
| 96 | controller.Response(data, err) | 98 | controller.Response(data, err) |
| 97 | } | 99 | } |
| @@ -4,6 +4,7 @@ import ( | @@ -4,6 +4,7 @@ import ( | ||
| 4 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/command" | 4 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/command" |
| 5 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/query" | 5 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/query" |
| 6 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/service" | 6 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/service" |
| 7 | + "strconv" | ||
| 7 | ) | 8 | ) |
| 8 | 9 | ||
| 9 | type UsersController struct { | 10 | type UsersController struct { |
| @@ -78,6 +79,8 @@ func (controller *UsersController) CooperationUserUpdate() { | @@ -78,6 +79,8 @@ func (controller *UsersController) CooperationUserUpdate() { | ||
| 78 | usersService := service.NewUsersService(nil) | 79 | usersService := service.NewUsersService(nil) |
| 79 | cooperationUserUpdateCommand := &command.CooperationUserUpdateCommand{} | 80 | cooperationUserUpdateCommand := &command.CooperationUserUpdateCommand{} |
| 80 | controller.Unmarshal(cooperationUserUpdateCommand) | 81 | controller.Unmarshal(cooperationUserUpdateCommand) |
| 82 | + userId := controller.GetString(":userId") | ||
| 83 | + cooperationUserUpdateCommand.UserId, _ = strconv.ParseInt(userId, 10, 64) | ||
| 81 | cooperationUserUpdateCommand.Operator = controller.GetOperator() | 84 | cooperationUserUpdateCommand.Operator = controller.GetOperator() |
| 82 | data, err := usersService.CooperationUserUpdate(cooperationUserUpdateCommand) | 85 | data, err := usersService.CooperationUserUpdate(cooperationUserUpdateCommand) |
| 83 | controller.Response(data, err) | 86 | controller.Response(data, err) |
| @@ -96,7 +99,7 @@ func (controller *UsersController) CooperationUserGet() { | @@ -96,7 +99,7 @@ func (controller *UsersController) CooperationUserGet() { | ||
| 96 | usersService := service.NewUsersService(nil) | 99 | usersService := service.NewUsersService(nil) |
| 97 | cooperationUserGetQuery := &query.CooperationUserGetQuery{} | 100 | cooperationUserGetQuery := &query.CooperationUserGetQuery{} |
| 98 | userId := controller.GetString(":userId") | 101 | userId := controller.GetString(":userId") |
| 99 | - cooperationUserGetQuery.UsersId = userId | 102 | + cooperationUserGetQuery.UserId = userId |
| 100 | cooperationUserGetQuery.Operator = controller.GetOperator() | 103 | cooperationUserGetQuery.Operator = controller.GetOperator() |
| 101 | data, err := usersService.CooperationUserGet(cooperationUserGetQuery) | 104 | data, err := usersService.CooperationUserGet(cooperationUserGetQuery) |
| 102 | controller.Response(data, err) | 105 | controller.Response(data, err) |
pkg/port/beego/routers/web_menus_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("/v1/web/menus/search", &web_client.MenuController{}, "Post:MenuList") | ||
| 10 | + web.Router("/v1/web/menus", &web_client.MenuController{}, "Put:MenuUpdate") | ||
| 11 | + web.Router("/v1/web/menus/favorite", &web_client.MenuController{}, "Put:MenuFavorite") | ||
| 12 | +} |
| @@ -10,4 +10,5 @@ func init() { | @@ -10,4 +10,5 @@ func init() { | ||
| 10 | web.Router("/v1/web/orgs/:orgId", &web_client.OrgsController{}, "Put:OrgUpdate") | 10 | web.Router("/v1/web/orgs/:orgId", &web_client.OrgsController{}, "Put:OrgUpdate") |
| 11 | web.Router("/v1/web/orgs/search", &web_client.OrgsController{}, "Post:OrgList") | 11 | web.Router("/v1/web/orgs/search", &web_client.OrgsController{}, "Post:OrgList") |
| 12 | web.Router("/v1/web/orgs/:orgId", &web_client.OrgsController{}, "Get:OrgGet") | 12 | web.Router("/v1/web/orgs/:orgId", &web_client.OrgsController{}, "Get:OrgGet") |
| 13 | + web.Router("/v1/web/orgs/enable", &web_client.OrgsController{}, "Post:OrgEnable") | ||
| 13 | } | 14 | } |
| @@ -14,7 +14,7 @@ func init() { | @@ -14,7 +14,7 @@ func init() { | ||
| 14 | web.Router("/v1/web/roles/role-user/assign", &web_client.RolesController{}, "Post:RoleUserAdd") | 14 | web.Router("/v1/web/roles/role-user/assign", &web_client.RolesController{}, "Post:RoleUserAdd") |
| 15 | web.Router("/v1/web/roles/role-user/unassign", &web_client.RolesController{}, "Post:RoleUserDelete") | 15 | web.Router("/v1/web/roles/role-user/unassign", &web_client.RolesController{}, "Post:RoleUserDelete") |
| 16 | web.Router("/v1/web/roles/role-user/before-edit", &web_client.RolesController{}, "Get:RoleUserBeforeEdit") | 16 | web.Router("/v1/web/roles/role-user/before-edit", &web_client.RolesController{}, "Get:RoleUserBeforeEdit") |
| 17 | - web.Router("/v1/web/roles/role-menu/before-edit", &web_client.RolesController{}, "Get:RoleMenuBeforeEdit") | 17 | + web.Router("/v1/web/roles/role-menu/before-edit/:roleId", &web_client.RolesController{}, "Get:RoleMenuBeforeEdit") |
| 18 | web.Router("/v1/web/roles/role-menu/:roleId", &web_client.RolesController{}, "Put:RoleMenuEdit") | 18 | web.Router("/v1/web/roles/role-menu/:roleId", &web_client.RolesController{}, "Put:RoleMenuEdit") |
| 19 | web.Router("/v1/web/roles/batch-delete", &web_client.RolesController{}, "Post:RoleDelete") | 19 | web.Router("/v1/web/roles/batch-delete", &web_client.RolesController{}, "Post:RoleDelete") |
| 20 | } | 20 | } |
| @@ -13,7 +13,7 @@ func init() { | @@ -13,7 +13,7 @@ func init() { | ||
| 13 | web.Router("/v1/web/users/company-user/enable", &web_client.UsersController{}, "Put:CompanyUserEnable") | 13 | web.Router("/v1/web/users/company-user/enable", &web_client.UsersController{}, "Put:CompanyUserEnable") |
| 14 | web.Router("/v1/web/users/company-user/reset-password", &web_client.UsersController{}, "Put:CompanyUserResetPassword") | 14 | web.Router("/v1/web/users/company-user/reset-password", &web_client.UsersController{}, "Put:CompanyUserResetPassword") |
| 15 | web.Router("/v1/web/users/cooperation-user", &web_client.UsersController{}, "Post:CooperationUserAdd") | 15 | web.Router("/v1/web/users/cooperation-user", &web_client.UsersController{}, "Post:CooperationUserAdd") |
| 16 | - web.Router("/v1/web/users/cooperation-user", &web_client.UsersController{}, "Put:CooperationUserUpdate") | 16 | + web.Router("/v1/web/users/cooperation-user/:userId", &web_client.UsersController{}, "Put:CooperationUserUpdate") |
| 17 | web.Router("/v1/web/users/cooperation-user/search", &web_client.UsersController{}, "Post:CooperationUserList") | 17 | web.Router("/v1/web/users/cooperation-user/search", &web_client.UsersController{}, "Post:CooperationUserList") |
| 18 | web.Router("/v1/web/users/cooperation-user/:userId", &web_client.UsersController{}, "Get:CooperationUserGet") | 18 | web.Router("/v1/web/users/cooperation-user/:userId", &web_client.UsersController{}, "Get:CooperationUserGet") |
| 19 | web.Router("/v1/web/users/cooperation-user/enable", &web_client.UsersController{}, "Put:CooperationUserEnable") | 19 | web.Router("/v1/web/users/cooperation-user/enable", &web_client.UsersController{}, "Put:CooperationUserEnable") |
-
请 注册 或 登录 后发表评论