|
|
package allied_creation_user
|
|
|
|
|
|
import "time"
|
|
|
import (
|
|
|
"strconv"
|
|
|
"time"
|
|
|
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
|
|
|
)
|
|
|
|
|
|
//################用户模块##################
|
|
|
|
|
|
//单体用户详情数据
|
|
|
type UserDetail struct {
|
|
|
UserId int64 `json:"userId"`
|
|
|
UserBaseId int64 `json:"userBaseId"`
|
|
|
UserType int `json:"userType"`
|
|
|
UserCode string `json:"userCode"`
|
|
|
EnableStatus int `json:"enableStatus"`
|
|
|
CooperationInfo struct {
|
|
|
CooperationCompany string `json:"cooperationCompany"`
|
|
|
CooperationDeadline time.Time `json:"cooperationDeadline"`
|
|
|
} `json:"cooperationInfo,omitempty"`
|
|
|
UserInfo struct {
|
|
|
Phone string `json:"phone"`
|
|
|
UserCode string `json:"userCode"`
|
|
|
Email string `json:"email"`
|
|
|
UserName string `json:"userName"`
|
|
|
Avatar string `json:"avatar"`
|
|
|
} `json:"userInfo,omitempty"`
|
|
|
Company *struct {
|
|
|
CompanyId int64 `json:"companyId"`
|
|
|
CompanyName string `json:"companyName"`
|
|
|
Scale string `json:"scale"`
|
|
|
IndustryCategory string `json:"industryCategory"`
|
|
|
RegisteredTime time.Time `json:"registeredTime"`
|
|
|
Status int64 `json:"status"`
|
|
|
} `json:"company,omitempty"`
|
|
|
Org *struct {
|
|
|
OrgId int64 `json:"orgId"`
|
|
|
OrgCode string `json:"orgCode"`
|
|
|
OrgName string `json:"orgName"`
|
|
|
} `json:"org,omitempty"`
|
|
|
Department *struct {
|
|
|
DepartmentId int64 `json:"departmentId"`
|
|
|
DepartmentName string `json:"departmentName"`
|
|
|
} `json:"department,omitempty"`
|
|
|
UserRole []struct {
|
|
|
RoleID int `json:"roleId"`
|
|
|
RoleName string `json:"roleName"`
|
|
|
Ext struct {
|
|
|
OrgName string `json:"orgName"`
|
|
|
} `json:"ext,omitempty"`
|
|
|
} `json:"userRole"`
|
|
|
UserOrg []struct {
|
|
|
OrgID int `json:"orgId"`
|
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
|
UpdatedAt time.Time `json:"updatedAt"`
|
|
|
DeletedAt time.Time `json:"deletedAt"`
|
|
|
OrgName string `json:"orgName"`
|
|
|
} `json:"userOrg"`
|
|
|
}
|
|
|
|
|
|
func (info *UserDetail) GetUserBase() *domain.UsersBase {
|
|
|
return &domain.UsersBase{
|
|
|
UserId: strconv.Itoa(int(info.UserId)),
|
|
|
UserBaseId: strconv.Itoa(int(info.UserBaseId)),
|
|
|
UserType: info.UserType,
|
|
|
// 用户状态,1启用,2禁用
|
|
|
EnableStatus: info.EnableStatus,
|
|
|
// 手机号码
|
|
|
Phone: info.UserInfo.Phone,
|
|
|
// 用户编号
|
|
|
UserCode: info.UserCode,
|
|
|
// 用户姓名
|
|
|
UserName: info.UserInfo.UserName,
|
|
|
// 邮箱
|
|
|
Email: info.UserInfo.Email,
|
|
|
//头像
|
|
|
Avatar: info.UserInfo.Avatar,
|
|
|
// 共创公司
|
|
|
CooperationCompany: info.CooperationInfo.CooperationCompany,
|
|
|
// 共创公司到期时间
|
|
|
CooperationDeadline: info.CooperationInfo.CooperationDeadline,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func (info *UserDetail) GetCompanyInfo() *domain.CompanyInfo {
|
|
|
if info.Company == nil {
|
|
|
return nil
|
|
|
}
|
|
|
return &domain.CompanyInfo{
|
|
|
CompanyId: strconv.Itoa(int(info.Company.CompanyId)),
|
|
|
CompanyName: info.Company.CompanyName,
|
|
|
Scale: info.Company.Scale,
|
|
|
Logo: "",
|
|
|
Address: "",
|
|
|
IndustryCategory: info.Company.IndustryCategory,
|
|
|
Contacts: "",
|
|
|
RegisteredTime: info.Company.RegisteredTime,
|
|
|
RegistStatus: info.Company.Status,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func (info *UserDetail) GetDepartment() *domain.Department {
|
|
|
if info.Department == nil {
|
|
|
return nil
|
|
|
}
|
|
|
return &domain.Department{
|
|
|
OrgId: info.Department.DepartmentId,
|
|
|
OrgName: info.Org.OrgName,
|
|
|
OrgCode: "",
|
|
|
ParentId: 0,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func (info *UserDetail) GetOrg() *domain.Orgs {
|
|
|
if info.Org == nil {
|
|
|
return nil
|
|
|
}
|
|
|
return &domain.Orgs{
|
|
|
OrgId: strconv.Itoa(int(info.Department.DepartmentId)),
|
|
|
OrgName: info.Org.OrgName,
|
|
|
OrgCode: "",
|
|
|
ParentId: 0,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//搜索用户列表
|
|
|
type (
|
|
|
ReqUserSearch struct {
|
...
|
...
|
@@ -25,40 +146,10 @@ type ( |
|
|
Phone string `json:"phone"`
|
|
|
}
|
|
|
|
|
|
// //DataUserSearch 搜索用户列表
|
|
|
//DataUserSearch 搜索用户列表
|
|
|
DataUserSearch struct {
|
|
|
Count int `json:"count"`
|
|
|
Users []struct {
|
|
|
UserID int `json:"userId"`
|
|
|
CompanyID int `json:"companyId"`
|
|
|
UserBaseID int `json:"userBaseId"`
|
|
|
UserType int `json:"userType"`
|
|
|
UserName string `json:"userName"`
|
|
|
UserCode string `json:"userCode"`
|
|
|
OrganizationID int `json:"organizationId"`
|
|
|
DepartmentID int `json:"departmentId"`
|
|
|
UserOrg []struct {
|
|
|
OrgID int `json:"orgId"`
|
|
|
OrgName string `json:"orgName"`
|
|
|
} `json:"userOrg"`
|
|
|
UserRole []struct {
|
|
|
RoleID int `json:"roleId"`
|
|
|
RoleName string `json:"roleName"`
|
|
|
Ext struct {
|
|
|
OrgName string `json:"orgName"`
|
|
|
} `json:"ext"`
|
|
|
} `json:"userRole"`
|
|
|
CooperationInfo struct {
|
|
|
CooperationCompany string `json:"cooperationCompany"`
|
|
|
CooperationDeadline time.Time `json:"cooperationDeadline"`
|
|
|
} `json:"cooperationInfo"`
|
|
|
EnableStatus int `json:"enableStatus"`
|
|
|
Ext struct {
|
|
|
OrgName string `json:"orgName"`
|
|
|
Phone string `json:"phone"`
|
|
|
DepName string `json:"depName"`
|
|
|
} `json:"ext"`
|
|
|
} `json:"users"`
|
|
|
Count int64 `json:"count"`
|
|
|
Users []UserDetail `json:"users"`
|
|
|
}
|
|
|
)
|
|
|
|
...
|
...
|
@@ -97,6 +188,7 @@ type ( |
|
|
Email string `json:"email"`
|
|
|
}
|
|
|
DataCreateUser struct {
|
|
|
UserDetail
|
|
|
}
|
|
|
)
|
|
|
|
...
|
...
|
@@ -146,39 +238,7 @@ type ( |
|
|
}
|
|
|
|
|
|
DataGateUser struct {
|
|
|
UserId int64 `json:"userId"`
|
|
|
UserBaseId int64 `json:"userBaseId"`
|
|
|
UserType int64 `json:"userType"`
|
|
|
UserCode string `json:"userCode"`
|
|
|
EnableStatus int64 `json:"enableStatus"`
|
|
|
CooperationInfo struct {
|
|
|
CooperationCompany string `json:"cooperationCompany"`
|
|
|
CooperationDeadline time.Time `json:"cooperationDeadline"`
|
|
|
} `json:"cooperationInfo"`
|
|
|
UserInfo struct {
|
|
|
Phone string `json:"phone"`
|
|
|
UserCode string `json:"userCode"`
|
|
|
Email string `json:"email"`
|
|
|
UserName string `json:"userName"`
|
|
|
Avatar string `json:"avatar"`
|
|
|
} `json:"userInfo"`
|
|
|
Company struct {
|
|
|
CompanyId int64 `json:"companyId"`
|
|
|
CompanyName string `json:"companyName"`
|
|
|
Scale string `json:"scale"`
|
|
|
IndustryCategory string `json:"industryCategory"`
|
|
|
RegisteredTime time.Time `json:"registeredTime"`
|
|
|
Status int64 `json:"status"`
|
|
|
} `json:"company"`
|
|
|
Org struct {
|
|
|
OrgId int64 `json:"orgId"`
|
|
|
OrgCode string `json:"orgCode"`
|
|
|
OrgName string `json:"orgName"`
|
|
|
} `json:"org"`
|
|
|
Department struct {
|
|
|
DepartmentId int64 `json:"departmentId"`
|
|
|
DepartmentName string `json:"departmentName"`
|
|
|
} `json:"department"`
|
|
|
UserDetail
|
|
|
}
|
|
|
)
|
|
|
|
...
|
...
|
|