...
|
...
|
@@ -5,10 +5,9 @@ import ( |
|
|
"time"
|
|
|
|
|
|
"github.com/linmadan/egglib-go/core/application"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/users/command"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/users/dto"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/users/query"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/command"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/dto"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/query"
|
|
|
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
|
|
|
)
|
...
|
...
|
@@ -23,24 +22,49 @@ func (usersService *UsersService) CompanyUserGet(companyUserGetQuery *query.Comp |
|
|
companyUserGetQuery.Operator.CompanyId,
|
|
|
companyUserGetQuery.Operator.OrgId,
|
|
|
companyUserGetQuery.Operator.UserId)
|
|
|
result, err := creationUserGateway.UserGet(allied_creation_user.ReqGateUser{
|
|
|
UserId: companyUserGetQuery.UsersId,
|
|
|
userid, _ := strconv.Atoi(companyUserGetQuery.UsersId)
|
|
|
resultUser, err := creationUserGateway.UserGet(allied_creation_user.ReqGateUser{
|
|
|
UserId: userid,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
user := domain.Users{
|
|
|
UserId: strconv.FormatInt(result.UserId, 10),
|
|
|
UserInfo: result.GetUserBase(),
|
|
|
Org: result.GetOrg(),
|
|
|
Department: result.GetDepartment(),
|
|
|
Company: nil,
|
|
|
UserOrg: result.GetUserOrg(),
|
|
|
UserRole: result.GetUserRole(),
|
|
|
creationUserGateway.UserAccessMenus(allied_creation_user.ReqUserAccessMenus{})
|
|
|
var (
|
|
|
usersOrg []dto.UserOrg
|
|
|
userRole []dto.UserRole
|
|
|
)
|
|
|
for _, v := range resultUser.UserOrg {
|
|
|
usersOrg = append(usersOrg, dto.UserOrg{
|
|
|
OrgID: strconv.Itoa(v.OrgID),
|
|
|
OrgName: v.OrgName,
|
|
|
})
|
|
|
}
|
|
|
for _, v := range resultUser.UserRole {
|
|
|
userRole = append(userRole, dto.UserRole{
|
|
|
RoleID: strconv.Itoa(v.RoleID),
|
|
|
RoleName: v.RoleName,
|
|
|
OrgName: v.Ext.OrgName,
|
|
|
})
|
|
|
}
|
|
|
user := dto.CompanyUserInfo{
|
|
|
Email: resultUser.UserInfo.Email,
|
|
|
Phone: resultUser.UserInfo.Phone,
|
|
|
Avatar: resultUser.UserInfo.Avatar,
|
|
|
EnableStatus: resultUser.EnableStatus,
|
|
|
UsersCode: resultUser.UserCode,
|
|
|
UsersID: strconv.Itoa(resultUser.UserId),
|
|
|
UsersName: resultUser.UserInfo.UserName,
|
|
|
OrgID: strconv.Itoa(resultUser.Org.OrgId),
|
|
|
OrgName: resultUser.Org.OrgName,
|
|
|
DepartmentID: strconv.Itoa(resultUser.Department.DepartmentId),
|
|
|
DepartmentName: resultUser.Department.DepartmentName,
|
|
|
UsersOrg: usersOrg,
|
|
|
UsersRole: userRole,
|
|
|
}
|
|
|
|
|
|
datas := map[string]interface{}{
|
|
|
"user": user,
|
|
|
"userMenu": "", //TODO
|
|
|
"user": user,
|
|
|
}
|
|
|
return datas, err
|
|
|
}
|
...
|
...
|
@@ -138,7 +162,7 @@ func (usersService *UsersService) CompanyUserList(companyUserListQuery *query.Co |
|
|
Phone: v.UserInfo.Phone,
|
|
|
EnableStatus: v.EnableStatus,
|
|
|
UserCode: v.UserCode,
|
|
|
UserId: strconv.FormatInt(v.UserId, 10),
|
|
|
UserId: strconv.Itoa(v.UserId),
|
|
|
UserName: v.UserInfo.UserName,
|
|
|
}
|
|
|
listData = append(listData, item)
|
...
|
...
|
@@ -246,15 +270,16 @@ func (usersService *UsersService) CooperationUserGet(cooperationUserGetQuery *qu |
|
|
cooperationUserGetQuery.Operator.CompanyId,
|
|
|
cooperationUserGetQuery.Operator.OrgId,
|
|
|
cooperationUserGetQuery.Operator.UserId)
|
|
|
userId, _ := strconv.Atoi(cooperationUserGetQuery.UsersId)
|
|
|
result, err := creationUserGateway.UserGet(allied_creation_user.ReqGateUser{
|
|
|
UserId: cooperationUserGetQuery.UsersId,
|
|
|
UserId: userId,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
deadline := result.CooperationInfo.CooperationDeadline.Unix()
|
|
|
userInfo := dto.CooperationUserInfo{
|
|
|
UserId: strconv.FormatInt(result.UserId, 10),
|
|
|
UserId: strconv.Itoa(result.UserId),
|
|
|
UserCode: result.UserCode,
|
|
|
EnableStatus: int32(result.EnableStatus),
|
|
|
CooperationCompany: result.CooperationInfo.CooperationCompany,
|
...
|
...
|
@@ -288,14 +313,14 @@ func (usersService *UsersService) CooperationUserList(cooperationUserListQuery * |
|
|
for _, v := range result.Users {
|
|
|
item = dto.CooperationUserItem{
|
|
|
CooperationCompany: v.CooperationInfo.CooperationCompany,
|
|
|
UserId: strconv.FormatInt(v.UserId, 10),
|
|
|
UserId: strconv.Itoa(v.UserId),
|
|
|
CooperationDeadline: v.CooperationInfo.CooperationDeadline.Unix(),
|
|
|
Phone: v.UserInfo.Phone,
|
|
|
EnableStatus: v.EnableStatus,
|
|
|
UserCode: v.UserCode,
|
|
|
UserName: v.UserInfo.UserName,
|
|
|
OrgName: v.Org.OrgName,
|
|
|
OrgId: strconv.FormatInt(v.Org.OrgId, 10),
|
|
|
OrgId: strconv.Itoa(v.Org.OrgId),
|
|
|
}
|
|
|
listData = append(listData, item)
|
|
|
}
|
...
|
...
|
|