...
|
...
|
@@ -222,6 +222,7 @@ func (userService *UserService) CreateUser(createUserCommand *command.CreateUser |
|
|
EnableStatus: createUserCommand.EnableStatus,
|
|
|
Ext: &domain.Ext{
|
|
|
Phone: createUserCommand.Phone,
|
|
|
UserName: createUserCommand.UserName,
|
|
|
},
|
|
|
CreatedAt: time.Now(),
|
|
|
UpdatedAt: time.Now(),
|
...
|
...
|
@@ -391,15 +392,36 @@ func (userService *UserService) ListUser(listUserQuery *query.ListUserQuery) (in |
|
|
} else {
|
|
|
userRepository = value
|
|
|
}
|
|
|
_, company, _ := factory.FastPgCompany(transactionContext, listUserQuery.CompanyId)
|
|
|
var dtoUsers []*dto.UserDto
|
|
|
if count, users, err := userRepository.Find(utils.ObjectToMap(listUserQuery)); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
for i := range users {
|
|
|
user := users[i]
|
|
|
userDto := &dto.UserDto{}
|
|
|
if listUserQuery.PullRealTime {
|
|
|
_, dep, _ := factory.FastPgOrg(transactionContext, user.DepartmentId)
|
|
|
_, org, _ := factory.FastPgOrg(transactionContext, user.OrganizationId)
|
|
|
_, userBase, _ := factory.FastPgUserBase(transactionContext, user.UserBaseId)
|
|
|
if dep != nil && org != nil && company != nil && userBase != nil {
|
|
|
user.Department = dep.ConvDep()
|
|
|
user.Organization = org.CloneSample()
|
|
|
user.Company = company.CloneSample()
|
|
|
user.UserInfo = userBase.UserInfo
|
|
|
}
|
|
|
}
|
|
|
if err := userDto.LoadDto(users[i], company); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
dtoUsers = append(dtoUsers, userDto)
|
|
|
}
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
return map[string]interface{}{
|
|
|
"count": count,
|
|
|
"users": users,
|
|
|
"users": dtoUsers,
|
|
|
}, nil
|
|
|
}
|
|
|
}
|
...
|
...
|
|