作者 tangxuhui

更新

@@ -4,17 +4,20 @@ import ( @@ -4,17 +4,20 @@ import (
4 "fmt" 4 "fmt"
5 5
6 "github.com/beego/beego/v2/core/validation" 6 "github.com/beego/beego/v2/core/validation"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
7 ) 8 )
8 9
9 type CompanyUserAddCommand struct { 10 type CompanyUserAddCommand struct {
  11 + //操作人
  12 + Operator domain.Operator `json:"-"`
10 // 用户编号 13 // 用户编号
11 UsersCode string `json:"usersCode" valid:"Required"` 14 UsersCode string `json:"usersCode" valid:"Required"`
12 // 用户姓名 15 // 用户姓名
13 UsersName string `json:"usersName" valid:"Required"` 16 UsersName string `json:"usersName" valid:"Required"`
14 // 组织ID 17 // 组织ID
15 - OrgId int64 `json:"orgId" valid:"Required"` 18 + OrgId string `json:"orgId" valid:"Required"`
16 // 部门id 19 // 部门id
17 - DepartmentId int64 `json:"departmentId" valid:"Required"` 20 + DepartmentId string `json:"departmentId" valid:"Required"`
18 // 启用状态(启用:1 禁用:2) 21 // 启用状态(启用:1 禁用:2)
19 EnableStatus int `json:"enableStatus" valid:"Required"` 22 EnableStatus int `json:"enableStatus" valid:"Required"`
20 // 手机号码 23 // 手机号码
@@ -22,9 +25,9 @@ type CompanyUserAddCommand struct { @@ -22,9 +25,9 @@ type CompanyUserAddCommand struct {
22 // 邮箱 25 // 邮箱
23 Email string `json:"email" valid:"Required"` 26 Email string `json:"email" valid:"Required"`
24 // 关联的组织机构 27 // 关联的组织机构
25 - UsersOrg []int64 `json:"usersOrg,omitempty"` 28 + UsersOrg []string `json:"usersOrg"`
26 // 关联的用户 29 // 关联的用户
27 - UsersRole []int64 `json:"usersRole,omitempty"` 30 + UsersRole []string `json:"usersRole"`
28 // 头像 31 // 头像
29 Avator string `json:"avator" valid:"Required"` 32 Avator string `json:"avator" valid:"Required"`
30 } 33 }
1 package dto 1 package dto
2 2
3 -type UserListItem struct {  
4 - DepName string  
5 - OrgName string  
6 - Phone string  
7 - EnableStatus int  
8 - UserCode string  
9 - UserId int64  
10 - UserName string 3 +type CompanyUserItem struct {
  4 + DepName string `json:"depName"`
  5 + OrgName string `json:"orgName"`
  6 + Phone string `json:"phone"`
  7 + EnableStatus int `json:"enableStatus"`
  8 + UserCode string `json:"userCode"`
  9 + UserId string `json:"userId"`
  10 + UserName string `json:"userName"`
11 } 11 }
12 12
13 type CooperationUserInfo struct { 13 type CooperationUserInfo struct {
@@ -29,3 +29,15 @@ type CooperationUserInfo struct { @@ -29,3 +29,15 @@ type CooperationUserInfo struct {
29 //头像 29 //头像
30 Avatar string `json:"avatar"` 30 Avatar string `json:"avatar"`
31 } 31 }
  32 +
  33 +type CooperationUserItem struct {
  34 + CooperationCompany string `json:"cooperationCompany"`
  35 + UserId string `json:"userId"`
  36 + CooperationDeadline int64 `json:"cooperationDeadline"`
  37 + Phone string `json:"phone"`
  38 + EnableStatus int `json:"enableStatus"`
  39 + UserCode string `json:"userCode"`
  40 + UserName string `json:"userName"`
  41 + OrgName string `json:"orgName"`
  42 + OrgId string `json:"orgId"`
  43 +}
@@ -4,9 +4,12 @@ import ( @@ -4,9 +4,12 @@ import (
4 "fmt" 4 "fmt"
5 5
6 "github.com/beego/beego/v2/core/validation" 6 "github.com/beego/beego/v2/core/validation"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
7 ) 8 )
8 9
9 type CompanyUserGetQuery struct { 10 type CompanyUserGetQuery struct {
  11 + //操作人
  12 + Operator domain.Operator `json:"-"`
10 // 用户编号 13 // 用户编号
11 UsersId int64 `json:"usersId" valid:"Required"` 14 UsersId int64 `json:"usersId" valid:"Required"`
12 } 15 }
@@ -4,9 +4,11 @@ import ( @@ -4,9 +4,11 @@ import (
4 "fmt" 4 "fmt"
5 5
6 "github.com/beego/beego/v2/core/validation" 6 "github.com/beego/beego/v2/core/validation"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
7 ) 8 )
8 9
9 type CompanyUserListQuery struct { 10 type CompanyUserListQuery struct {
  11 +
10 // 页码 12 // 页码
11 PageNumber int `json:"pageNumber"` 13 PageNumber int `json:"pageNumber"`
12 // 每页数量 14 // 每页数量
@@ -15,7 +17,8 @@ type CompanyUserListQuery struct { @@ -15,7 +17,8 @@ type CompanyUserListQuery struct {
15 UserName string `json:"userName"` 17 UserName string `json:"userName"`
16 //所属部门 18 //所属部门
17 DepartmentName string `json:"departmentName"` 19 DepartmentName string `json:"departmentName"`
18 - CompanyId int64 `json:"companyId" valid:"Required"` 20 + //操作人
  21 + Operator domain.Operator `json:"-"`
19 } 22 }
20 23
21 func (companyUserListQuery *CompanyUserListQuery) Valid(validation *validation.Validation) { 24 func (companyUserListQuery *CompanyUserListQuery) Valid(validation *validation.Validation) {
@@ -4,13 +4,20 @@ import ( @@ -4,13 +4,20 @@ import (
4 "fmt" 4 "fmt"
5 5
6 "github.com/beego/beego/v2/core/validation" 6 "github.com/beego/beego/v2/core/validation"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
7 ) 8 )
8 9
9 type CooperationUserListQuery struct { 10 type CooperationUserListQuery struct {
  11 + //操作人
  12 + Operator domain.Operator `json:"-"`
  13 + //用户名称
  14 + UserName string `json:"userName"`
  15 + //共创公司
  16 + CooperationCompany string `json:"cooperationCompany"`
10 // 查询偏离量 17 // 查询偏离量
11 - Offset int `json:"offset" valid:"Required"` 18 + PageNumber int `json:"pageNumber"`
12 // 查询限制 19 // 查询限制
13 - Limit int `json:"limit" valid:"Required"` 20 + PageSize int `json:"pageSize" valid:"Required"`
14 } 21 }
15 22
16 func (cooperationUserListQuery *CooperationUserListQuery) Valid(validation *validation.Validation) { 23 func (cooperationUserListQuery *CooperationUserListQuery) Valid(validation *validation.Validation) {
@@ -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 )
@@ -18,14 +19,67 @@ type UsersService struct { @@ -18,14 +19,67 @@ type UsersService struct {
18 19
19 // 获取公司用户信息 20 // 获取公司用户信息
20 func (usersService *UsersService) CompanyUserGet(companyUserGetQuery *query.CompanyUserGetQuery) (interface{}, error) { 21 func (usersService *UsersService) CompanyUserGet(companyUserGetQuery *query.CompanyUserGetQuery) (interface{}, error) {
21 -  
22 - return nil, nil 22 + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
  23 + companyUserGetQuery.Operator.CompanyId,
  24 + companyUserGetQuery.Operator.OrgId,
  25 + companyUserGetQuery.Operator.UserId)
  26 + result, err := creationUserGateway.UserGet(allied_creation_user.ReqGateUser{
  27 + UserId: companyUserGetQuery.UsersId,
  28 + })
  29 + if err != nil {
  30 + return nil, err
  31 + }
  32 + //TODO 数据拼接
  33 + userInfo := domain.Users{
  34 + UserId: "",
  35 + UserInfo: result.GetUserBase(),
  36 + Org: result.GetOrg(),
  37 + Department: result.GetDepartment(),
  38 + Company: nil,
  39 + }
  40 + return userInfo, err
23 } 41 }
24 42
25 // 创建公司用户信息 43 // 创建公司用户信息
26 func (usersService *UsersService) CompanyUserAdd(companyUserAddCommand *command.CompanyUserAddCommand) (interface{}, error) { 44 func (usersService *UsersService) CompanyUserAdd(companyUserAddCommand *command.CompanyUserAddCommand) (interface{}, error) {
27 -  
28 - return nil, nil 45 + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
  46 + companyUserAddCommand.Operator.CompanyId,
  47 + companyUserAddCommand.Operator.OrgId,
  48 + companyUserAddCommand.Operator.UserId)
  49 + departmentId, _ := strconv.Atoi(companyUserAddCommand.OrgId)
  50 + orgId, _ := strconv.Atoi(companyUserAddCommand.OrgId)
  51 + userOrg := []int64{}
  52 + userRole := []int64{}
  53 + for _, v := range companyUserAddCommand.UsersOrg {
  54 + id, err := strconv.Atoi(v)
  55 + if err == nil {
  56 + userOrg = append(userOrg, int64(id))
  57 + }
  58 + }
  59 + for _, v := range companyUserAddCommand.UsersRole {
  60 + id, err := strconv.Atoi(v)
  61 + if err == nil {
  62 + userRole = append(userRole, int64(id))
  63 + }
  64 + }
  65 + result, err := creationUserGateway.UserCreate(allied_creation_user.ReqCreateUser{
  66 + CompanyId: companyUserAddCommand.Operator.CompanyId,
  67 + // 用户类型 1:企业内部用户(内部添加) 2:共创用户 1024:企业注册用户(注册添加)
  68 + UserType: 1,
  69 + UserCode: companyUserAddCommand.UsersCode,
  70 + OrganizationId: int64(orgId),
  71 + DepartmentId: int64(departmentId),
  72 + UserOrg: userOrg,
  73 + UserRole: userRole,
  74 + // 启用状态(启用:1 禁用:2)
  75 + EnableStatus: companyUserAddCommand.EnableStatus,
  76 + Password: "",
  77 + UserName: companyUserAddCommand.UsersName,
  78 + Phone: companyUserAddCommand.Phone,
  79 + Avatar: companyUserAddCommand.Avator,
  80 + Email: companyUserAddCommand.Avator,
  81 + })
  82 + return result, err
29 } 83 }
30 84
31 // 启用禁用公司用户信息 85 // 启用禁用公司用户信息
@@ -47,8 +101,8 @@ func (usersService *UsersService) CompanyUserList(companyUserListQuery *query.Co @@ -47,8 +101,8 @@ func (usersService *UsersService) CompanyUserList(companyUserListQuery *query.Co
47 result, err := creationUserGateway.UserSearch(allied_creation_user.ReqUserSearch{ 101 result, err := creationUserGateway.UserSearch(allied_creation_user.ReqUserSearch{
48 Offset: (companyUserListQuery.PageNumber - 1) * companyUserListQuery.PageSize, 102 Offset: (companyUserListQuery.PageNumber - 1) * companyUserListQuery.PageSize,
49 Limit: companyUserListQuery.PageSize, 103 Limit: companyUserListQuery.PageSize,
50 - CompanyId: companyUserListQuery.CompanyId,  
51 - OrganizationId: 0, 104 + CompanyId: companyUserListQuery.Operator.CompanyId,
  105 + OrganizationId: companyUserListQuery.Operator.OrgId,
52 DepartmentId: 0, 106 DepartmentId: 0,
53 UserName: companyUserListQuery.UserName, 107 UserName: companyUserListQuery.UserName,
54 DepName: companyUserListQuery.DepartmentName, 108 DepName: companyUserListQuery.DepartmentName,
@@ -61,18 +115,18 @@ func (usersService *UsersService) CompanyUserList(companyUserListQuery *query.Co @@ -61,18 +115,18 @@ func (usersService *UsersService) CompanyUserList(companyUserListQuery *query.Co
61 //数据转换 115 //数据转换
62 cnt := int64(result.Count) 116 cnt := int64(result.Count)
63 var ( 117 var (
64 - listData []dto.UserListItem  
65 - item dto.UserListItem 118 + listData []dto.CompanyUserItem
  119 + item dto.CompanyUserItem
66 ) 120 )
67 for _, v := range result.Users { 121 for _, v := range result.Users {
68 - item = dto.UserListItem{  
69 - DepName: v.Ext.DepName,  
70 - OrgName: v.Ext.OrgName,  
71 - Phone: v.Ext.Phone, 122 + item = dto.CompanyUserItem{
  123 + DepName: v.Department.DepartmentName,
  124 + OrgName: v.Org.OrgName,
  125 + Phone: v.UserInfo.Phone,
72 EnableStatus: v.EnableStatus, 126 EnableStatus: v.EnableStatus,
73 UserCode: v.UserCode, 127 UserCode: v.UserCode,
74 - UserId: int64(v.UserID),  
75 - UserName: v.UserName, 128 + UserId: strconv.FormatInt(v.UserId, 10),
  129 + UserName: v.UserInfo.UserName,
76 } 130 }
77 listData = append(listData, item) 131 listData = append(listData, item)
78 } 132 }
@@ -160,9 +214,38 @@ func (usersService *UsersService) CooperationUserGet(cooperationUserGetQuery *qu @@ -160,9 +214,38 @@ func (usersService *UsersService) CooperationUserGet(cooperationUserGetQuery *qu
160 } 214 }
161 215
162 // 返回共创用户信息列表 216 // 返回共创用户信息列表
163 -func (usersService *UsersService) CooperationUserList(cooperationUserListQuery *query.CooperationUserListQuery) (interface{}, error) {  
164 -  
165 - return nil, nil 217 +func (usersService *UsersService) CooperationUserList(cooperationUserListQuery *query.CooperationUserListQuery) (int64, interface{}, error) {
  218 + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(0, 0, 0)
  219 + result, err := creationUserGateway.UserSearch(allied_creation_user.ReqUserSearch{
  220 + Offset: (cooperationUserListQuery.PageNumber - 1) * cooperationUserListQuery.PageSize,
  221 + Limit: cooperationUserListQuery.PageSize,
  222 + CompanyId: cooperationUserListQuery.Operator.CompanyId,
  223 + OrganizationId: cooperationUserListQuery.Operator.OrgId,
  224 + DepartmentId: 0,
  225 + UserName: cooperationUserListQuery.UserName,
  226 + DepName: "",
  227 + Phone: "",
  228 + })
  229 + var (
  230 + listData []dto.CooperationUserItem
  231 + item dto.CooperationUserItem
  232 + )
  233 + cnt := result.Count
  234 + for _, v := range result.Users {
  235 + item = dto.CooperationUserItem{
  236 + CooperationCompany: v.CooperationInfo.CooperationCompany,
  237 + UserId: strconv.FormatInt(v.UserId, 10),
  238 + CooperationDeadline: v.CooperationInfo.CooperationDeadline.Unix(),
  239 + Phone: v.UserInfo.Phone,
  240 + EnableStatus: v.EnableStatus,
  241 + UserCode: v.UserCode,
  242 + UserName: v.UserInfo.UserName,
  243 + OrgName: v.Org.OrgName,
  244 + OrgId: strconv.FormatInt(v.Org.OrgId, 10),
  245 + }
  246 + listData = append(listData, item)
  247 + }
  248 + return cnt, listData, err
166 } 249 }
167 250
168 // 批量重置密码 251 // 批量重置密码
@@ -4,6 +4,7 @@ import "time" @@ -4,6 +4,7 @@ import "time"
4 4
5 // 公司信息 5 // 公司信息
6 type CompanyInfo struct { 6 type CompanyInfo struct {
  7 + CompanyId string `json:"companyId"`
7 // 企业名称 8 // 企业名称
8 CompanyName string `json:"companyName"` 9 CompanyName string `json:"companyName"`
9 // 规模 10 // 规模
@@ -19,5 +20,5 @@ type CompanyInfo struct { @@ -19,5 +20,5 @@ type CompanyInfo struct {
19 // 注册时间 20 // 注册时间
20 RegisteredTime time.Time `json:"registeredTime"` 21 RegisteredTime time.Time `json:"registeredTime"`
21 // 注册状态 1:已注册 2:待认证 3:已认证 22 // 注册状态 1:已注册 2:待认证 3:已认证
22 - RegistStatus int `json:"registStatus"` 23 + RegistStatus int64 `json:"registStatus"`
23 } 24 }
@@ -3,9 +3,9 @@ package domain @@ -3,9 +3,9 @@ package domain
3 // 组织organization 3 // 组织organization
4 type Orgs struct { 4 type Orgs struct {
5 // 组织ID 5 // 组织ID
6 - OrgId int64 `json:"orgId"` 6 + OrgId string `json:"orgId"`
7 // 企业id 7 // 企业id
8 - CompanyId int64 `json:"companyId"` 8 + CompanyId string `json:"companyId"`
9 // 组织编码 9 // 组织编码
10 OrgCode string `json:"orgCode"` 10 OrgCode string `json:"orgCode"`
11 // 组织名称 11 // 组织名称
  1 +package domain
  2 +
  3 +// 角色 (base)
  4 +type Roles struct {
  5 + // 角色ID
  6 + RoleId string `json:"roleId"`
  7 + // 角色名称
  8 + RoleName string `json:"roleName"`
  9 + // 描述
  10 + Desc string `json:"desc"`
  11 + // 用户的组织
  12 + Org *Orgs `json:"org,omitempty,"`
  13 + // 用户的部门
  14 + Department *Department `json:"department,omitempty,"`
  15 +}
@@ -9,13 +9,6 @@ const ( @@ -9,13 +9,6 @@ const (
9 type Users struct { 9 type Users struct {
10 // 用户id 10 // 用户id
11 UserId string `json:"userId"` 11 UserId string `json:"userId"`
12 - UserBaseId int64 `json:"userBaseId"`  
13 - UserType int `json:"userType"`  
14 - UserCode string `json:"userCode"`  
15 - // 用户状态,1启用,2禁用  
16 - EnableStatus int32 `json:"enableStatus"`  
17 - //共创信息  
18 - CooperationInfo *CooperationInfo `json:"cooperationInfo,omitempty,"`  
19 // 用户基础信息 12 // 用户基础信息
20 UserInfo *UsersBase `json:"userInfo,omitempty,"` 13 UserInfo *UsersBase `json:"userInfo,omitempty,"`
21 // 用户的组织 14 // 用户的组织
@@ -23,5 +16,8 @@ type Users struct { @@ -23,5 +16,8 @@ type Users struct {
23 // 用户的部门 16 // 用户的部门
24 Department *Department `json:"department,omitempty,"` 17 Department *Department `json:"department,omitempty,"`
25 18
26 - Company *CompanyInfo `json:"company"` 19 + Company *CompanyInfo `json:"company,omitempty,"`
  20 +
  21 + UserOrg []Orgs `json:"userOrg"`
  22 + UserRole []Roles `json:"userRole"`
27 } 23 }
1 package domain 1 package domain
2 2
  3 +import "time"
  4 +
3 // 用户基础信息 5 // 用户基础信息
4 type UsersBase struct { 6 type UsersBase struct {
  7 + UserId string `json:"userId"`
  8 + UserBaseId string `json:"userBaseId"`
  9 + UserType int `json:"userType"`
  10 + // 用户状态,1启用,2禁用
  11 + EnableStatus int `json:"enableStatus"`
5 // 手机号码 12 // 手机号码
6 Phone string `json:"phone"` 13 Phone string `json:"phone"`
7 // 用户编号 14 // 用户编号
8 UserCode string `json:"userCode"` 15 UserCode string `json:"userCode"`
9 - // 用户编号  
10 - UserId int64 `json:"userId"`  
11 // 用户姓名 16 // 用户姓名
12 UserName string `json:"userName"` 17 UserName string `json:"userName"`
13 // 邮箱 18 // 邮箱
14 Email string `json:"email"` 19 Email string `json:"email"`
  20 + //头像
  21 + Avatar string `json:"avatar"`
  22 + // 共创公司
  23 + CooperationCompany string `json:"cooperationCompany"`
  24 + // 共创公司到期时间
  25 + CooperationDeadline time.Time `json:"cooperationDeadline"`
15 } 26 }
1 package allied_creation_user 1 package allied_creation_user
2 2
3 -import "time" 3 +import (
  4 + "strconv"
  5 + "time"
  6 +
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
  8 +)
4 9
5 //################用户模块################## 10 //################用户模块##################
6 11
  12 +//单体用户详情数据
  13 +type UserDetail struct {
  14 + UserId int64 `json:"userId"`
  15 + UserBaseId int64 `json:"userBaseId"`
  16 + UserType int `json:"userType"`
  17 + UserCode string `json:"userCode"`
  18 + EnableStatus int `json:"enableStatus"`
  19 + CooperationInfo struct {
  20 + CooperationCompany string `json:"cooperationCompany"`
  21 + CooperationDeadline time.Time `json:"cooperationDeadline"`
  22 + } `json:"cooperationInfo,omitempty"`
  23 + UserInfo struct {
  24 + Phone string `json:"phone"`
  25 + UserCode string `json:"userCode"`
  26 + Email string `json:"email"`
  27 + UserName string `json:"userName"`
  28 + Avatar string `json:"avatar"`
  29 + } `json:"userInfo,omitempty"`
  30 + Company *struct {
  31 + CompanyId int64 `json:"companyId"`
  32 + CompanyName string `json:"companyName"`
  33 + Scale string `json:"scale"`
  34 + IndustryCategory string `json:"industryCategory"`
  35 + RegisteredTime time.Time `json:"registeredTime"`
  36 + Status int64 `json:"status"`
  37 + } `json:"company,omitempty"`
  38 + Org *struct {
  39 + OrgId int64 `json:"orgId"`
  40 + OrgCode string `json:"orgCode"`
  41 + OrgName string `json:"orgName"`
  42 + } `json:"org,omitempty"`
  43 + Department *struct {
  44 + DepartmentId int64 `json:"departmentId"`
  45 + DepartmentName string `json:"departmentName"`
  46 + } `json:"department,omitempty"`
  47 + UserRole []struct {
  48 + RoleID int `json:"roleId"`
  49 + RoleName string `json:"roleName"`
  50 + Ext struct {
  51 + OrgName string `json:"orgName"`
  52 + } `json:"ext,omitempty"`
  53 + } `json:"userRole"`
  54 + UserOrg []struct {
  55 + OrgID int `json:"orgId"`
  56 + CreatedAt time.Time `json:"createdAt"`
  57 + UpdatedAt time.Time `json:"updatedAt"`
  58 + DeletedAt time.Time `json:"deletedAt"`
  59 + OrgName string `json:"orgName"`
  60 + } `json:"userOrg"`
  61 +}
  62 +
  63 +func (info *UserDetail) GetUserBase() *domain.UsersBase {
  64 + return &domain.UsersBase{
  65 + UserId: strconv.Itoa(int(info.UserId)),
  66 + UserBaseId: strconv.Itoa(int(info.UserBaseId)),
  67 + UserType: info.UserType,
  68 + // 用户状态,1启用,2禁用
  69 + EnableStatus: info.EnableStatus,
  70 + // 手机号码
  71 + Phone: info.UserInfo.Phone,
  72 + // 用户编号
  73 + UserCode: info.UserCode,
  74 + // 用户姓名
  75 + UserName: info.UserInfo.UserName,
  76 + // 邮箱
  77 + Email: info.UserInfo.Email,
  78 + //头像
  79 + Avatar: info.UserInfo.Avatar,
  80 + // 共创公司
  81 + CooperationCompany: info.CooperationInfo.CooperationCompany,
  82 + // 共创公司到期时间
  83 + CooperationDeadline: info.CooperationInfo.CooperationDeadline,
  84 + }
  85 +}
  86 +
  87 +func (info *UserDetail) GetCompanyInfo() *domain.CompanyInfo {
  88 + if info.Company == nil {
  89 + return nil
  90 + }
  91 + return &domain.CompanyInfo{
  92 + CompanyId: strconv.Itoa(int(info.Company.CompanyId)),
  93 + CompanyName: info.Company.CompanyName,
  94 + Scale: info.Company.Scale,
  95 + Logo: "",
  96 + Address: "",
  97 + IndustryCategory: info.Company.IndustryCategory,
  98 + Contacts: "",
  99 + RegisteredTime: info.Company.RegisteredTime,
  100 + RegistStatus: info.Company.Status,
  101 + }
  102 +}
  103 +
  104 +func (info *UserDetail) GetDepartment() *domain.Department {
  105 + if info.Department == nil {
  106 + return nil
  107 + }
  108 + return &domain.Department{
  109 + OrgId: info.Department.DepartmentId,
  110 + OrgName: info.Org.OrgName,
  111 + OrgCode: "",
  112 + ParentId: 0,
  113 + }
  114 +}
  115 +
  116 +func (info *UserDetail) GetOrg() *domain.Orgs {
  117 + if info.Org == nil {
  118 + return nil
  119 + }
  120 + return &domain.Orgs{
  121 + OrgId: strconv.Itoa(int(info.Department.DepartmentId)),
  122 + OrgName: info.Org.OrgName,
  123 + OrgCode: "",
  124 + ParentId: 0,
  125 + }
  126 +}
  127 +
7 //搜索用户列表 128 //搜索用户列表
8 type ( 129 type (
9 ReqUserSearch struct { 130 ReqUserSearch struct {
@@ -25,40 +146,10 @@ type ( @@ -25,40 +146,10 @@ type (
25 Phone string `json:"phone"` 146 Phone string `json:"phone"`
26 } 147 }
27 148
28 - // //DataUserSearch 搜索用户列表 149 + //DataUserSearch 搜索用户列表
29 DataUserSearch struct { 150 DataUserSearch struct {
30 - Count int `json:"count"`  
31 - Users []struct {  
32 - UserID int `json:"userId"`  
33 - CompanyID int `json:"companyId"`  
34 - UserBaseID int `json:"userBaseId"`  
35 - UserType int `json:"userType"`  
36 - UserName string `json:"userName"`  
37 - UserCode string `json:"userCode"`  
38 - OrganizationID int `json:"organizationId"`  
39 - DepartmentID int `json:"departmentId"`  
40 - UserOrg []struct {  
41 - OrgID int `json:"orgId"`  
42 - OrgName string `json:"orgName"`  
43 - } `json:"userOrg"`  
44 - UserRole []struct {  
45 - RoleID int `json:"roleId"`  
46 - RoleName string `json:"roleName"`  
47 - Ext struct {  
48 - OrgName string `json:"orgName"`  
49 - } `json:"ext"`  
50 - } `json:"userRole"`  
51 - CooperationInfo struct {  
52 - CooperationCompany string `json:"cooperationCompany"`  
53 - CooperationDeadline time.Time `json:"cooperationDeadline"`  
54 - } `json:"cooperationInfo"`  
55 - EnableStatus int `json:"enableStatus"`  
56 - Ext struct {  
57 - OrgName string `json:"orgName"`  
58 - Phone string `json:"phone"`  
59 - DepName string `json:"depName"`  
60 - } `json:"ext"`  
61 - } `json:"users"` 151 + Count int64 `json:"count"`
  152 + Users []UserDetail `json:"users"`
62 } 153 }
63 ) 154 )
64 155
@@ -97,6 +188,7 @@ type ( @@ -97,6 +188,7 @@ type (
97 Email string `json:"email"` 188 Email string `json:"email"`
98 } 189 }
99 DataCreateUser struct { 190 DataCreateUser struct {
  191 + UserDetail
100 } 192 }
101 ) 193 )
102 194
@@ -146,39 +238,7 @@ type ( @@ -146,39 +238,7 @@ type (
146 } 238 }
147 239
148 DataGateUser struct { 240 DataGateUser struct {
149 - UserId int64 `json:"userId"`  
150 - UserBaseId int64 `json:"userBaseId"`  
151 - UserType int64 `json:"userType"`  
152 - UserCode string `json:"userCode"`  
153 - EnableStatus int64 `json:"enableStatus"`  
154 - CooperationInfo struct {  
155 - CooperationCompany string `json:"cooperationCompany"`  
156 - CooperationDeadline time.Time `json:"cooperationDeadline"`  
157 - } `json:"cooperationInfo"`  
158 - UserInfo struct {  
159 - Phone string `json:"phone"`  
160 - UserCode string `json:"userCode"`  
161 - Email string `json:"email"`  
162 - UserName string `json:"userName"`  
163 - Avatar string `json:"avatar"`  
164 - } `json:"userInfo"`  
165 - Company struct {  
166 - CompanyId int64 `json:"companyId"`  
167 - CompanyName string `json:"companyName"`  
168 - Scale string `json:"scale"`  
169 - IndustryCategory string `json:"industryCategory"`  
170 - RegisteredTime time.Time `json:"registeredTime"`  
171 - Status int64 `json:"status"`  
172 - } `json:"company"`  
173 - Org struct {  
174 - OrgId int64 `json:"orgId"`  
175 - OrgCode string `json:"orgCode"`  
176 - OrgName string `json:"orgName"`  
177 - } `json:"org"`  
178 - Department struct {  
179 - DepartmentId int64 `json:"departmentId"`  
180 - DepartmentName string `json:"departmentName"`  
181 - } `json:"department"` 241 + UserDetail
182 } 242 }
183 ) 243 )
184 244