作者 tangxuhui

新增 部门管理 模块

1 -{"D:\\workspaceGo\\src\\allied-creation-gateway\\pkg\\port\\beego":1627356799005386400}  
  1 +{"D:\\workspaceGo\\src\\allied-creation-gateway\\pkg\\port\\beego":1627475088561293500}
  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 OrgAddCommand struct {
  11 + //操作人
  12 + Operator domain.Operator `json:"-"`
  13 + // 组织编码
  14 + OrgCode string `json:"orgCode" valid:"Required"`
  15 + // 组织名称
  16 + OrgName string `json:"orgName" valid:"Required"`
  17 + IsOrg int `json:"isOrg" valid:"Required"`
  18 + // 父级id
  19 + ParentId string `json:"parentId" valid:"Required"`
  20 +}
  21 +
  22 +func (orgAddCommand *OrgAddCommand) Valid(validation *validation.Validation) {
  23 +
  24 +}
  25 +
  26 +func (orgAddCommand *OrgAddCommand) ValidateCommand() error {
  27 + valid := validation.Validation{}
  28 + b, err := valid.Valid(orgAddCommand)
  29 + if err != nil {
  30 + return err
  31 + }
  32 + if !b {
  33 + for _, validErr := range valid.Errors {
  34 + return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
  35 + }
  36 + }
  37 + return nil
  38 +}
  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 OrgEnableCommand struct {
  11 + //操作人
  12 + Operator domain.Operator `json:"-"`
  13 + OrgId string `json:"orgId,omitempty"`
  14 + Status int `json:"status,omitempty"`
  15 +}
  16 +
  17 +func (orgEnableCommand *OrgEnableCommand) Valid(validation *validation.Validation) {
  18 +
  19 +}
  20 +
  21 +func (orgEnableCommand *OrgEnableCommand) ValidateCommand() error {
  22 + valid := validation.Validation{}
  23 + b, err := valid.Valid(orgEnableCommand)
  24 + if err != nil {
  25 + return err
  26 + }
  27 + if !b {
  28 + for _, validErr := range valid.Errors {
  29 + return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
  30 + }
  31 + }
  32 + return nil
  33 +}
  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 OrgRemoveCommand struct {
  11 + //操作人
  12 + Operator domain.Operator `json:"-"`
  13 + OrgId []string `json:"orgId,omitempty"`
  14 +}
  15 +
  16 +func (orgRemoveCommand *OrgRemoveCommand) Valid(validation *validation.Validation) {
  17 +
  18 +}
  19 +
  20 +func (orgRemoveCommand *OrgRemoveCommand) ValidateCommand() error {
  21 + valid := validation.Validation{}
  22 + b, err := valid.Valid(orgRemoveCommand)
  23 + if err != nil {
  24 + return err
  25 + }
  26 + if !b {
  27 + for _, validErr := range valid.Errors {
  28 + return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
  29 + }
  30 + }
  31 + return nil
  32 +}
  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 OrgUpdateCommand struct {
  11 + //操作人
  12 + Operator domain.Operator `json:"-"`
  13 + // 组织ID
  14 + OrgId string `json:"orgId" valid:"Required"`
  15 + // 组织编码
  16 + OrgCode string `json:"orgCode" valid:"Required"`
  17 + // 组织名称
  18 + OrgName string `json:"orgName" valid:"Required"`
  19 + IsOrg int `json:"isOrg" valid:"Required"`
  20 + // 父级id
  21 + ParentId string `json:"parentId" valid:"Required"`
  22 +}
  23 +
  24 +func (orgUpdateCommand *OrgUpdateCommand) Valid(validation *validation.Validation) {
  25 +
  26 +}
  27 +
  28 +func (orgUpdateCommand *OrgUpdateCommand) ValidateCommand() error {
  29 + valid := validation.Validation{}
  30 + b, err := valid.Valid(orgUpdateCommand)
  31 + if err != nil {
  32 + return err
  33 + }
  34 + if !b {
  35 + for _, validErr := range valid.Errors {
  36 + return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
  37 + }
  38 + }
  39 + return nil
  40 +}
  1 +package dto
  2 +
  3 +type OrgItem struct {
  4 + OrgId string `json:"orgId"`
  5 + OrgName string `json:"orgName"`
  6 + ParentId string `json:"parentId"`
  7 + IsOrg int `json:"isOrg"`
  8 + OrgCode string `json:"orgCode"`
  9 + ParentDepName string `json:"parentDepName"`
  10 +}
  11 +
  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 OrgGetQuery struct {
  11 + //操作人
  12 + Operator domain.Operator `json:"-"`
  13 + // 组织ID
  14 + OrgId string `json:"orgId" valid:"Required"`
  15 +}
  16 +
  17 +func (orgGetQuery *OrgGetQuery) Valid(validation *validation.Validation) {
  18 + validation.SetError("CustomValid", "未实现的自定义认证")
  19 +}
  20 +
  21 +func (orgGetQuery *OrgGetQuery) ValidateQuery() error {
  22 + valid := validation.Validation{}
  23 + b, err := valid.Valid(orgGetQuery)
  24 + if err != nil {
  25 + return err
  26 + }
  27 + if !b {
  28 + for _, validErr := range valid.Errors {
  29 + return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
  30 + }
  31 + }
  32 + return nil
  33 +}
  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 OrgListQuery struct {
  11 + //操作人
  12 + Operator domain.Operator `json:"-"`
  13 + OrgCode string `json:"OrgCode"`
  14 + DepName string `json:"depName"`
  15 + ParentId int `json:"parentId"`
  16 +}
  17 +
  18 +func (orgListQuery *OrgListQuery) Valid(validation *validation.Validation) {
  19 +
  20 +}
  21 +
  22 +func (orgListQuery *OrgListQuery) ValidateQuery() error {
  23 + valid := validation.Validation{}
  24 + b, err := valid.Valid(orgListQuery)
  25 + if err != nil {
  26 + return err
  27 + }
  28 + if !b {
  29 + for _, validErr := range valid.Errors {
  30 + return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
  31 + }
  32 + }
  33 + return nil
  34 +}
  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/orgs/command"
  8 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/orgs/dto"
  9 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/orgs/query"
  10 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
  11 +)
  12 +
  13 +// 组织管理
  14 +type OrgsService struct {
  15 +}
  16 +
  17 +// 创建组织管理
  18 +func (orgsService *OrgsService) OrgAdd(orgAddCommand *command.OrgAddCommand) (interface{}, error) {
  19 + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
  20 + orgAddCommand.Operator.CompanyId,
  21 + orgAddCommand.Operator.OrgId,
  22 + orgAddCommand.Operator.UserId)
  23 + parentId, _ := strconv.Atoi(orgAddCommand.ParentId)
  24 + result, err := creationUserGateway.OrgCreate(allied_creation_user.ReqOrgCreate{
  25 + CompanyId: int(orgAddCommand.Operator.CompanyId),
  26 + IsOrg: orgAddCommand.IsOrg,
  27 + OrgCode: orgAddCommand.OrgCode,
  28 + OrgName: orgAddCommand.OrgName,
  29 + ParentId: parentId,
  30 + })
  31 + if err != nil {
  32 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  33 + }
  34 + data := struct {
  35 + OrgId int `json:"orgId"`
  36 + command.OrgAddCommand
  37 + }{
  38 + OrgId: result.OrgId,
  39 + OrgAddCommand: *orgAddCommand,
  40 + }
  41 + return data, nil
  42 +}
  43 +
  44 +// 禁用、启用组织管理
  45 +func (orgsService *OrgsService) OrgEnable(orgEnableCommand *command.OrgEnableCommand) (interface{}, error) {
  46 + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
  47 + orgEnableCommand.Operator.CompanyId,
  48 + orgEnableCommand.Operator.OrgId,
  49 + orgEnableCommand.Operator.UserId)
  50 + orgId, _ := strconv.Atoi(orgEnableCommand.OrgId)
  51 + _, err := creationUserGateway.OrgEnable(allied_creation_user.ReqOrgEnable{
  52 + OrgId: orgId,
  53 + OrgStatus: orgEnableCommand.Status,
  54 + })
  55 + if err != nil {
  56 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  57 + }
  58 + return orgEnableCommand, nil
  59 +}
  60 +
  61 +// 返回组织管理
  62 +func (orgsService *OrgsService) OrgGet(orgGetQuery *query.OrgGetQuery) (interface{}, error) {
  63 + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
  64 + orgGetQuery.Operator.CompanyId,
  65 + orgGetQuery.Operator.OrgId,
  66 + orgGetQuery.Operator.UserId)
  67 + orgId, _ := strconv.Atoi(orgGetQuery.OrgId)
  68 + result, err := creationUserGateway.OrgGet(allied_creation_user.ReqOrgGet{
  69 + OrgId: orgId,
  70 + })
  71 + if err != nil {
  72 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  73 + }
  74 + data := dto.OrgItem{
  75 + OrgId: strconv.Itoa(result.Org.OrgID),
  76 + OrgName: result.Org.OrgName,
  77 + ParentId: strconv.Itoa(result.Org.ParentID),
  78 + IsOrg: result.Org.IsOrg,
  79 + OrgCode: result.Org.OrgCode,
  80 + ParentDepName: result.Org.Ext.ParentDepName,
  81 + }
  82 + return data, nil
  83 +}
  84 +
  85 +// 返回组织管理列表
  86 +func (orgsService *OrgsService) OrgList(orgListQuery *query.OrgListQuery) (interface{}, error) {
  87 + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
  88 + orgListQuery.Operator.CompanyId,
  89 + orgListQuery.Operator.OrgId,
  90 + orgListQuery.Operator.UserId)
  91 + result, err := creationUserGateway.OrgSearch(allied_creation_user.ReqOrgSearch{
  92 + CompanyId: int(orgListQuery.Operator.CompanyId),
  93 + DepName: orgListQuery.DepName,
  94 + IsOrg: 0,
  95 + Limit: 0,
  96 + Offset: 0,
  97 + OrgCode: orgListQuery.OrgCode,
  98 + ParentId: orgListQuery.ParentId,
  99 + })
  100 + if err != nil {
  101 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  102 + }
  103 + var (
  104 + dataList []dto.OrgItem
  105 + item dto.OrgItem
  106 + )
  107 + for _, v := range result.Orgs {
  108 + item = dto.OrgItem{
  109 + OrgId: strconv.Itoa(v.OrgID),
  110 + OrgName: v.OrgName,
  111 + ParentId: strconv.Itoa(v.ParentID),
  112 + IsOrg: v.IsOrg,
  113 + OrgCode: v.OrgCode,
  114 + ParentDepName: v.Ext.ParentDepName,
  115 + }
  116 + dataList = append(dataList, item)
  117 + }
  118 + return dataList, nil
  119 +}
  120 +
  121 +// 更新组织管理
  122 +func (orgsService *OrgsService) OrgUpdate(orgUpdateCommand *command.OrgUpdateCommand) (interface{}, error) {
  123 + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
  124 + orgUpdateCommand.Operator.CompanyId,
  125 + orgUpdateCommand.Operator.OrgId,
  126 + orgUpdateCommand.Operator.UserId)
  127 + parentId, _ := strconv.Atoi(orgUpdateCommand.ParentId)
  128 + _, err := creationUserGateway.OrgCreate(allied_creation_user.ReqOrgCreate{
  129 + IsOrg: orgUpdateCommand.IsOrg,
  130 + OrgCode: orgUpdateCommand.OrgCode,
  131 + OrgName: orgUpdateCommand.OrgName,
  132 + ParentId: parentId,
  133 + })
  134 + if err != nil {
  135 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  136 + }
  137 + return orgUpdateCommand, nil
  138 +}
  139 +
  140 +func NewOrgsService(options map[string]interface{}) *OrgsService {
  141 + newOrgsService := &OrgsService{}
  142 + return newOrgsService
  143 +}
@@ -20,14 +20,21 @@ func (rolesService *RolesService) RoleAdd(roleAddCommand *command.RoleAddCommand @@ -20,14 +20,21 @@ func (rolesService *RolesService) RoleAdd(roleAddCommand *command.RoleAddCommand
20 roleAddCommand.Operator.CompanyId, 20 roleAddCommand.Operator.CompanyId,
21 roleAddCommand.Operator.OrgId, 21 roleAddCommand.Operator.OrgId,
22 roleAddCommand.Operator.UserId) 22 roleAddCommand.Operator.UserId)
23 - _, err := creationUserGateway.RoleCreate(allied_creation_user.ReqRoleCreate{ 23 + result, err := creationUserGateway.RoleCreate(allied_creation_user.ReqRoleCreate{
24 RoleName: roleAddCommand.RoleName, 24 RoleName: roleAddCommand.RoleName,
25 Desc: roleAddCommand.Desc, 25 Desc: roleAddCommand.Desc,
26 }) 26 })
27 if err != nil { 27 if err != nil {
28 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 28 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
29 } 29 }
30 - return roleAddCommand, err 30 + data := struct {
  31 + RoleId string `json:"roleId"`
  32 + command.RoleAddCommand
  33 + }{
  34 + RoleId: strconv.Itoa(int(result.RoleID)),
  35 + RoleAddCommand: *roleAddCommand,
  36 + }
  37 + return data, err
31 } 38 }
32 39
33 // 编辑role 40 // 编辑role
@@ -55,22 +62,6 @@ func (rolesService *RolesService) RoleGet(roleGetQuery *query.RoleGetQuery) (int @@ -55,22 +62,6 @@ func (rolesService *RolesService) RoleGet(roleGetQuery *query.RoleGetQuery) (int
55 roleGetQuery.Operator.OrgId, 62 roleGetQuery.Operator.OrgId,
56 roleGetQuery.Operator.UserId) 63 roleGetQuery.Operator.UserId)
57 roleId, _ := strconv.Atoi(roleGetQuery.RoleId) 64 roleId, _ := strconv.Atoi(roleGetQuery.RoleId)
58 - result, err := creationUserGateway.RoleGet(allied_creation_user.ReqRoleGet{  
59 - RoleId: int64(roleId),  
60 - })  
61 - if err != nil {  
62 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())  
63 - }  
64 - return result, nil  
65 -}  
66 -  
67 -// 返角全部详情色  
68 -func (rolesService *RolesService) RoleAllDetail(roleGetQuery *query.RoleGetQuery) (interface{}, error) {  
69 - creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(  
70 - roleGetQuery.Operator.CompanyId,  
71 - roleGetQuery.Operator.OrgId,  
72 - roleGetQuery.Operator.UserId)  
73 - roleId, _ := strconv.Atoi(roleGetQuery.RoleId)  
74 roleData, err := creationUserGateway.RoleGet(allied_creation_user.ReqRoleGet{ 65 roleData, err := creationUserGateway.RoleGet(allied_creation_user.ReqRoleGet{
75 RoleId: int64(roleId), 66 RoleId: int64(roleId),
76 }) 67 })
@@ -122,7 +113,7 @@ func (rolesService *RolesService) RoleMenuBeforeEdit(roleMenuBeforeEditQuery *qu @@ -122,7 +113,7 @@ func (rolesService *RolesService) RoleMenuBeforeEdit(roleMenuBeforeEditQuery *qu
122 113
123 // 编辑角色关联用户的前置准备数据 114 // 编辑角色关联用户的前置准备数据
124 func (rolesService *RolesService) RoleUserBeforeEdit(roleUserBeforeEditQuery *query.RoleUserBeforeEditQuery) (interface{}, error) { 115 func (rolesService *RolesService) RoleUserBeforeEdit(roleUserBeforeEditQuery *query.RoleUserBeforeEditQuery) (interface{}, error) {
125 - 116 + //TODO
126 return nil, nil 117 return nil, nil
127 } 118 }
128 119
@@ -223,7 +214,7 @@ func (rolesService *RolesService) RoleUserDelete(roleUserDeleteCommand *command. @@ -223,7 +214,7 @@ func (rolesService *RolesService) RoleUserDelete(roleUserDeleteCommand *command.
223 214
224 // 角色下关联用户的数据 215 // 角色下关联用户的数据
225 func (rolesService *RolesService) RoleUserInfo(roleUserInfoQuery *query.RoleUserInfoQuery) (interface{}, error) { 216 func (rolesService *RolesService) RoleUserInfo(roleUserInfoQuery *query.RoleUserInfoQuery) (interface{}, error) {
226 - 217 + //TODO
227 return nil, nil 218 return nil, nil
228 } 219 }
229 220
@@ -67,7 +67,7 @@ func (usersService *UsersService) CompanyUserAdd(companyUserAddCommand *command. @@ -67,7 +67,7 @@ func (usersService *UsersService) CompanyUserAdd(companyUserAddCommand *command.
67 userRole = append(userRole, int64(id)) 67 userRole = append(userRole, int64(id))
68 } 68 }
69 } 69 }
70 - _, err := creationUserGateway.UserCreate(allied_creation_user.ReqCreateUser{ 70 + result, err := creationUserGateway.UserCreate(allied_creation_user.ReqCreateUser{
71 CompanyId: companyUserAddCommand.Operator.CompanyId, 71 CompanyId: companyUserAddCommand.Operator.CompanyId,
72 // 用户类型 1:企业内部用户(内部添加) 2:共创用户 1024:企业注册用户(注册添加) 72 // 用户类型 1:企业内部用户(内部添加) 2:共创用户 1024:企业注册用户(注册添加)
73 UserType: 1, 73 UserType: 1,
@@ -84,7 +84,15 @@ func (usersService *UsersService) CompanyUserAdd(companyUserAddCommand *command. @@ -84,7 +84,15 @@ func (usersService *UsersService) CompanyUserAdd(companyUserAddCommand *command.
84 Avatar: companyUserAddCommand.Avator, 84 Avatar: companyUserAddCommand.Avator,
85 Email: companyUserAddCommand.Avator, 85 Email: companyUserAddCommand.Avator,
86 }) 86 })
87 - return companyUserAddCommand, err 87 +
  88 + data := struct {
  89 + UserId string `json:"userId"`
  90 + command.CompanyUserAddCommand
  91 + }{
  92 + UserId: strconv.Itoa(result.UserId),
  93 + CompanyUserAddCommand: *companyUserAddCommand,
  94 + }
  95 + return data, err
88 } 96 }
89 97
90 // 启用禁用公司用户信息 98 // 启用禁用公司用户信息
@@ -197,7 +205,7 @@ func (usersService *UsersService) CooperationUserAdd(cooperationUserAddCommand * @@ -197,7 +205,7 @@ func (usersService *UsersService) CooperationUserAdd(cooperationUserAddCommand *
197 cooperationUserAddCommand.Operator.CompanyId, 205 cooperationUserAddCommand.Operator.CompanyId,
198 cooperationUserAddCommand.Operator.OrgId, 206 cooperationUserAddCommand.Operator.OrgId,
199 cooperationUserAddCommand.Operator.UserId) 207 cooperationUserAddCommand.Operator.UserId)
200 - _, err := creationUserGateway.CooperatorUserCreate(allied_creation_user.ReqCreateCooperatorUser{ 208 + result, err := creationUserGateway.CooperatorUserCreate(allied_creation_user.ReqCreateCooperatorUser{
201 CooperationCompany: cooperationUserAddCommand.CooperationCompany, 209 CooperationCompany: cooperationUserAddCommand.CooperationCompany,
202 CooperationDeadline: time.Unix(cooperationUserAddCommand.CooperationDeadline, 0), 210 CooperationDeadline: time.Unix(cooperationUserAddCommand.CooperationDeadline, 0),
203 Email: cooperationUserAddCommand.Email, 211 Email: cooperationUserAddCommand.Email,
@@ -209,7 +217,14 @@ func (usersService *UsersService) CooperationUserAdd(cooperationUserAddCommand * @@ -209,7 +217,14 @@ func (usersService *UsersService) CooperationUserAdd(cooperationUserAddCommand *
209 Phone: cooperationUserAddCommand.Phone, 217 Phone: cooperationUserAddCommand.Phone,
210 Password: "", //TODO 填充默认密码 218 Password: "", //TODO 填充默认密码
211 }) 219 })
212 - return cooperationUserAddCommand, err 220 + data := struct {
  221 + UserId string `json:"userId"`
  222 + command.CooperationUserAddCommand
  223 + }{
  224 + UserId: strconv.Itoa(result.UserId),
  225 + CooperationUserAddCommand: *cooperationUserAddCommand,
  226 + }
  227 + return data, err
213 } 228 }
214 229
215 // 启用禁用共创用户信息 230 // 启用禁用共创用户信息
@@ -10,7 +10,7 @@ import ( @@ -10,7 +10,7 @@ import (
10 ) 10 )
11 11
12 // Org 创建组织 12 // Org 创建组织
13 -func (gateway HttplibAlliedCreationUser) OrgCreate(param ReqOrg) (*DataOrg, error) { 13 +func (gateway HttplibAlliedCreationUser) OrgCreate(param ReqOrgCreate) (*DataOrgCreate, error) {
14 url := gateway.baseUrL + "/org" 14 url := gateway.baseUrL + "/org"
15 method := "post" 15 method := "post"
16 req := gateway.CreateRequest(url, method) 16 req := gateway.CreateRequest(url, method)
@@ -35,7 +35,7 @@ func (gateway HttplibAlliedCreationUser) OrgCreate(param ReqOrg) (*DataOrg, erro @@ -35,7 +35,7 @@ func (gateway HttplibAlliedCreationUser) OrgCreate(param ReqOrg) (*DataOrg, erro
35 if err != nil { 35 if err != nil {
36 return nil, fmt.Errorf("解析创建组织:%w", err) 36 return nil, fmt.Errorf("解析创建组织:%w", err)
37 } 37 }
38 - var data DataOrg 38 + var data DataOrgCreate
39 err = gateway.GetResponseData(result, &data) 39 err = gateway.GetResponseData(result, &data)
40 return &data, err 40 return &data, err
41 } 41 }
@@ -166,7 +166,7 @@ func (gateway HttplibAlliedCreationUser) OrgEnable(param ReqOrgEnable) (*DataOrg @@ -166,7 +166,7 @@ func (gateway HttplibAlliedCreationUser) OrgEnable(param ReqOrgEnable) (*DataOrg
166 166
167 // Org[orgId} 返回组织 167 // Org[orgId} 返回组织
168 func (gateway HttplibAlliedCreationUser) OrgGet(param ReqOrgGet) (*DataOrgGet, error) { 168 func (gateway HttplibAlliedCreationUser) OrgGet(param ReqOrgGet) (*DataOrgGet, error) {
169 - url := gateway.baseUrL + "/org/" + strconv.FormatInt(param.OrgId, 10) 169 + url := gateway.baseUrL + "/org/" + strconv.Itoa(param.OrgId)
170 method := "get" 170 method := "get"
171 req := gateway.CreateRequest(url, method) 171 req := gateway.CreateRequest(url, method)
172 log.Logger.Debug("向用户模块请求数据:返回组织。", map[string]interface{}{ 172 log.Logger.Debug("向用户模块请求数据:返回组织。", map[string]interface{}{
@@ -2,10 +2,16 @@ package allied_creation_user @@ -2,10 +2,16 @@ package allied_creation_user
2 2
3 //创建组织 3 //创建组织
4 type ( 4 type (
5 - ReqOrg struct { 5 + ReqOrgCreate struct {
  6 + CompanyId int `json:"companyId"`
  7 + IsOrg int `json:"isOrg"`
  8 + OrgCode string `json:"orgCode"`
  9 + OrgName string `json:"orgName"`
  10 + ParentId int `json:"parentId"`
6 } 11 }
7 12
8 - DataOrg struct { 13 + DataOrgCreate struct {
  14 + OrgId int `json:"orgId"`
9 } 15 }
10 ) 16 )
11 17
@@ -42,6 +48,8 @@ type ( @@ -42,6 +48,8 @@ type (
42 //设置组织启用状态 48 //设置组织启用状态
43 type ( 49 type (
44 ReqOrgEnable struct { 50 ReqOrgEnable struct {
  51 + OrgId int `json:"orgId"`
  52 + OrgStatus int `json:"orgStatus"` // 组织状态 1:启用 2:禁用 3.删除
45 } 53 }
46 54
47 DataOrgEnable struct { 55 DataOrgEnable struct {
@@ -51,18 +59,60 @@ type ( @@ -51,18 +59,60 @@ type (
51 //返回组织 59 //返回组织
52 type ( 60 type (
53 ReqOrgGet struct { 61 ReqOrgGet struct {
54 - OrgId int64 62 + OrgId int `json:"orgId"`
55 } 63 }
56 64
57 DataOrgGet struct { 65 DataOrgGet struct {
  66 + Org struct {
  67 + CompanyID int `json:"companyId"`
  68 + Ext struct {
  69 + DepName string `json:"depName"`
  70 + OrgName string `json:"orgName"`
  71 + ParentDepName string `json:"parentDepName"`
  72 + Phone string `json:"phone"`
  73 + UserName string `json:"userName"`
  74 + } `json:"ext"`
  75 + IsOrg int `json:"isOrg"`
  76 + OrgCode string `json:"orgCode"`
  77 + OrgID int `json:"orgId"`
  78 + OrgName string `json:"orgName"`
  79 + OrgStatus int `json:"orgStatus"`
  80 + ParentID int `json:"parentId"`
  81 + ParentPath string `json:"parentPath"`
  82 + } `json:"org"`
58 } 83 }
59 ) 84 )
60 85
61 //返回组织列表 86 //返回组织列表
62 type ( 87 type (
63 ReqOrgSearch struct { 88 ReqOrgSearch struct {
  89 + CompanyId int `json:"companyId"`
  90 + DepName string `json:"depName"`
  91 + IsOrg int `json:"isOrg"`
  92 + Limit int `json:"limit"`
  93 + Offset int `json:"offset"`
  94 + OrgCode string `json:"orgCode"`
  95 + ParentId int `json:"parentId"`
64 } 96 }
65 97
66 DataOrgSearch struct { 98 DataOrgSearch struct {
  99 + Count int `json:"count"`
  100 + Orgs []struct {
  101 + CompanyID int `json:"companyId"`
  102 + Ext struct {
  103 + DepName string `json:"depName"`
  104 + OrgName string `json:"orgName"`
  105 + ParentDepName string `json:"parentDepName"`
  106 + Phone string `json:"phone"`
  107 + UserName string `json:"userName"`
  108 + } `json:"ext"`
  109 + IsOrg int `json:"isOrg"`
  110 + OrgCode string `json:"orgCode"`
  111 + OrgID int `json:"orgId"`
  112 + OrgName string `json:"orgName"`
  113 + OrgStatus int `json:"orgStatus"`
  114 + ParentID int `json:"parentId"`
  115 + ParentPath string `json:"parentPath"`
  116 + } `json:"orgs"`
67 } 117 }
68 ) 118 )
@@ -87,6 +87,7 @@ type ( @@ -87,6 +87,7 @@ type (
87 } 87 }
88 88
89 DataRoleCreate struct { 89 DataRoleCreate struct {
  90 + RoleID int64 `json:"roleID"`
90 } 91 }
91 ) 92 )
92 93
@@ -216,7 +216,7 @@ type ( @@ -216,7 +216,7 @@ type (
216 Email string `json:"email"` 216 Email string `json:"email"`
217 } 217 }
218 DataCreateUser struct { 218 DataCreateUser struct {
219 - UserDetail 219 + UserId int `json:"userId"`
220 } 220 }
221 ) 221 )
222 222
@@ -323,6 +323,7 @@ type ( @@ -323,6 +323,7 @@ type (
323 Password string `json:"password"` 323 Password string `json:"password"`
324 } 324 }
325 DataCreateCooperatorUser struct { 325 DataCreateCooperatorUser struct {
  326 + UserId int `json:"userId"`
326 } 327 }
327 ) 328 )
328 329