...
|
...
|
@@ -9,6 +9,7 @@ import ( |
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/application/user/query"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/domain"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/utils"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/log"
|
|
|
"time"
|
|
|
)
|
|
|
|
...
|
...
|
@@ -359,12 +360,24 @@ func (userService *UserService) GetUser(getUserQuery *query.GetUserQuery) (inter |
|
|
_, org, _ := factory.FastPgOrg(transactionContext, user.OrganizationId)
|
|
|
_, company, _ := factory.FastPgCompany(transactionContext, user.CompanyId)
|
|
|
_, userBase, _ := factory.FastPgUserBase(transactionContext, user.UserBaseId)
|
|
|
if dep != nil && org != nil && userBase != nil {
|
|
|
user.Department = dep.ConvDep()
|
|
|
user.Organization = org.CloneSample()
|
|
|
if company != nil {
|
|
|
user.Company = company.CloneSample()
|
|
|
}
|
|
|
if org != nil {
|
|
|
user.Organization = org.CloneSample()
|
|
|
}
|
|
|
if dep != nil {
|
|
|
user.Department = dep.ConvDep()
|
|
|
}
|
|
|
if userBase != nil {
|
|
|
user.UserInfo = userBase.UserInfo
|
|
|
}
|
|
|
// TODO:后期可以移除有冗余roleType
|
|
|
for i := range user.UserRole {
|
|
|
if _, role, _ := factory.FastPgRole(transactionContext, user.UserRole[i].RoleId); role != nil {
|
|
|
user.UserRole[i].RoleType = role.RoleType
|
|
|
}
|
|
|
}
|
|
|
userDto := &dto.UserDto{Im: userBase.Im}
|
|
|
if err := userDto.LoadDto(user, company); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
...
|
...
|
@@ -486,6 +499,7 @@ func (userService *UserService) ListUser(listUserQuery *query.ListUserQuery) (in |
|
|
userRepository = value
|
|
|
}
|
|
|
var company *domain.Company
|
|
|
var mapCompany = make(map[int64]*domain.Company)
|
|
|
var dtoUsers []*dto.UserDto
|
|
|
queryOptions := utils.ObjectToMap(listUserQuery)
|
|
|
if len(listUserQuery.Phone) > 0 {
|
...
|
...
|
@@ -502,8 +516,14 @@ func (userService *UserService) ListUser(listUserQuery *query.ListUserQuery) (in |
|
|
for i := range users {
|
|
|
user := users[i]
|
|
|
userDto := &dto.UserDto{}
|
|
|
if company == nil && user.CompanyId != 0 {
|
|
|
_, company, _ = factory.FastPgCompany(transactionContext, user.CompanyId)
|
|
|
var ok bool
|
|
|
if company, ok = mapCompany[user.CompanyId]; !ok {
|
|
|
_, company, err = factory.FastPgCompany(transactionContext, user.CompanyId)
|
|
|
if err != nil {
|
|
|
log.Logger.Error(err.Error())
|
|
|
continue
|
|
|
}
|
|
|
mapCompany[company.CompanyId] = company
|
|
|
}
|
|
|
if listUserQuery.PullRealTime {
|
|
|
_, dep, _ := factory.FastPgOrg(transactionContext, user.DepartmentId)
|
...
|
...
|
|