|
@@ -222,6 +222,7 @@ func (userService *UserService) CreateUser(createUserCommand *command.CreateUser |
|
@@ -222,6 +222,7 @@ func (userService *UserService) CreateUser(createUserCommand *command.CreateUser |
222
|
EnableStatus: createUserCommand.EnableStatus,
|
222
|
EnableStatus: createUserCommand.EnableStatus,
|
223
|
Ext: &domain.Ext{
|
223
|
Ext: &domain.Ext{
|
224
|
Phone: createUserCommand.Phone,
|
224
|
Phone: createUserCommand.Phone,
|
|
|
225
|
+ UserName: createUserCommand.UserName,
|
225
|
},
|
226
|
},
|
226
|
CreatedAt: time.Now(),
|
227
|
CreatedAt: time.Now(),
|
227
|
UpdatedAt: time.Now(),
|
228
|
UpdatedAt: time.Now(),
|
|
@@ -391,15 +392,36 @@ func (userService *UserService) ListUser(listUserQuery *query.ListUserQuery) (in |
|
@@ -391,15 +392,36 @@ func (userService *UserService) ListUser(listUserQuery *query.ListUserQuery) (in |
391
|
} else {
|
392
|
} else {
|
392
|
userRepository = value
|
393
|
userRepository = value
|
393
|
}
|
394
|
}
|
|
|
395
|
+ _, company, _ := factory.FastPgCompany(transactionContext, listUserQuery.CompanyId)
|
|
|
396
|
+ var dtoUsers []*dto.UserDto
|
394
|
if count, users, err := userRepository.Find(utils.ObjectToMap(listUserQuery)); err != nil {
|
397
|
if count, users, err := userRepository.Find(utils.ObjectToMap(listUserQuery)); err != nil {
|
395
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
398
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
396
|
} else {
|
399
|
} else {
|
|
|
400
|
+ for i := range users {
|
|
|
401
|
+ user := users[i]
|
|
|
402
|
+ userDto := &dto.UserDto{}
|
|
|
403
|
+ if listUserQuery.PullRealTime {
|
|
|
404
|
+ _, dep, _ := factory.FastPgOrg(transactionContext, user.DepartmentId)
|
|
|
405
|
+ _, org, _ := factory.FastPgOrg(transactionContext, user.OrganizationId)
|
|
|
406
|
+ _, userBase, _ := factory.FastPgUserBase(transactionContext, user.UserBaseId)
|
|
|
407
|
+ if dep != nil && org != nil && company != nil && userBase != nil {
|
|
|
408
|
+ user.Department = dep.ConvDep()
|
|
|
409
|
+ user.Organization = org.CloneSample()
|
|
|
410
|
+ user.Company = company.CloneSample()
|
|
|
411
|
+ user.UserInfo = userBase.UserInfo
|
|
|
412
|
+ }
|
|
|
413
|
+ }
|
|
|
414
|
+ if err := userDto.LoadDto(users[i], company); err != nil {
|
|
|
415
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
416
|
+ }
|
|
|
417
|
+ dtoUsers = append(dtoUsers, userDto)
|
|
|
418
|
+ }
|
397
|
if err := transactionContext.CommitTransaction(); err != nil {
|
419
|
if err := transactionContext.CommitTransaction(); err != nil {
|
398
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
420
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
399
|
}
|
421
|
}
|
400
|
return map[string]interface{}{
|
422
|
return map[string]interface{}{
|
401
|
"count": count,
|
423
|
"count": count,
|
402
|
- "users": users,
|
424
|
+ "users": dtoUsers,
|
403
|
}, nil
|
425
|
}, nil
|
404
|
}
|
426
|
}
|
405
|
}
|
427
|
}
|