...
|
...
|
@@ -65,10 +65,15 @@ func (userService *UserService) BatchAdd2(batchAddCommand *command.BatchAdd2Comm |
|
|
batchAddUserService, _ := factory.CreateBatchAddUserService(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
if err = batchAddUserService.BatchAddUser2(batchAddCommand.OperateInfo, batchAddCommand.Users, batchAddCommand.Password); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
var failRows []*domain.BatchAddUserItem
|
|
|
if failRows, err = batchAddUserService.BatchAddUser2(batchAddCommand.OperateInfo, batchAddCommand.Users, batchAddCommand.Password); err != nil {
|
|
|
return batchAddCommand.Users, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
if len(failRows) != 0 {
|
|
|
return map[string]interface{}{
|
|
|
"failRows": failRows,
|
|
|
}, nil //有错误行,回滚
|
|
|
}
|
|
|
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
...
|
...
|
@@ -360,12 +365,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())
|
...
|
...
|
@@ -402,7 +419,7 @@ func (userService *UserService) GetUserAccessMenus(getUserAccessMenusQuery *quer |
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
|
|
|
menus, err := roleAccessMenusService.AccessMenus(nil, user.UserRoleIds(), domain.AccessMenusOptions{
|
|
|
menus, err := roleAccessMenusService.AccessMenus(getUserAccessMenusQuery.OperateInfo, user.UserRoleIds(), domain.AccessMenusOptions{
|
|
|
CompanyId: user.CompanyId,
|
|
|
MenuCategory: getUserAccessMenusQuery.MenuCategory,
|
|
|
OrgId: getUserAccessMenusQuery.OrgId,
|
...
|
...
|
|