|
|
|
@ -15,9 +15,11 @@ import ${basePackage}.frame.utils.MapperUtil;
|
|
|
|
|
import ${basePackage}.frame.utils.Message;
|
|
|
|
|
import ${basePackage}.frame.utils.ValidationUtil;
|
|
|
|
|
import ${basePackage}.module.system.ent.Dept;
|
|
|
|
|
import ${basePackage}.module.system.ent.Role;
|
|
|
|
|
import ${basePackage}.module.system.ent.User;
|
|
|
|
|
import ${basePackage}.module.system.mpr.UserMapper;
|
|
|
|
|
import ${basePackage}.module.system.req.DeptFindRequest;
|
|
|
|
|
import ${basePackage}.module.system.req.RoleFindRequest;
|
|
|
|
|
import ${basePackage}.module.system.req.UserCreateRequest;
|
|
|
|
|
import ${basePackage}.module.system.req.UserDeleteRequest;
|
|
|
|
|
import ${basePackage}.module.system.req.UserFindRequest;
|
|
|
|
@ -25,6 +27,7 @@ import ${basePackage}.module.system.req.UserGetRequest;
|
|
|
|
|
import ${basePackage}.module.system.req.UserRoleCreateRequest;
|
|
|
|
|
import ${basePackage}.module.system.req.UserUpdateRequest;
|
|
|
|
|
import ${basePackage}.module.system.rsp.DeptFindResponse;
|
|
|
|
|
import ${basePackage}.module.system.rsp.RoleFindResponse;
|
|
|
|
|
import ${basePackage}.module.system.rsp.UserCreateResponse;
|
|
|
|
|
import ${basePackage}.module.system.rsp.UserDeleteResponse;
|
|
|
|
|
import ${basePackage}.module.system.rsp.UserFindResponse;
|
|
|
|
@ -48,6 +51,8 @@ public class UserManagerImpl implements UserManager {
|
|
|
|
|
@Autowired
|
|
|
|
|
private DeptManager deptManager;
|
|
|
|
|
@Autowired
|
|
|
|
|
private RoleManager roleManager;
|
|
|
|
|
@Autowired
|
|
|
|
|
private UserRoleManager userRoleManager;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -94,12 +99,26 @@ public class UserManagerImpl implements UserManager {
|
|
|
|
|
return response;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (Long aLong : request.getRoleIdList()) {
|
|
|
|
|
for (String code : request.getRoleCodeList()) {
|
|
|
|
|
RoleFindRequest roleFindRequest = new RoleFindRequest();
|
|
|
|
|
roleFindRequest.setCode(code);
|
|
|
|
|
RoleFindResponse roleFindResponse = roleManager.find(roleFindRequest, token);
|
|
|
|
|
if (roleFindResponse.hasError()) {
|
|
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
|
|
response.addErrors(roleFindResponse.getErrors());
|
|
|
|
|
return response;
|
|
|
|
|
} else if (roleFindResponse.getResult().size() == 0) {
|
|
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
|
|
response.addError(ErrorType.BUSINESS_ERROR, "[" + code + "]角色代码不存在!");
|
|
|
|
|
return response;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Role role = roleFindResponse.getResult().get(0);
|
|
|
|
|
UserRoleCreateRequest userRoleCreateRequest = new UserRoleCreateRequest();
|
|
|
|
|
userRoleCreateRequest.setUserId(id);
|
|
|
|
|
userRoleCreateRequest.setUserCode(null);
|
|
|
|
|
userRoleCreateRequest.setRoleId(aLong);
|
|
|
|
|
userRoleCreateRequest.setRoleCode(null);
|
|
|
|
|
userRoleCreateRequest.setUserCode(request.getUserCode());
|
|
|
|
|
userRoleCreateRequest.setRoleId(role.getId());
|
|
|
|
|
userRoleCreateRequest.setRoleCode(role.getCode());
|
|
|
|
|
UserRoleCreateResponse userRoleCreateResponse = userRoleManager.create(userRoleCreateRequest, token);
|
|
|
|
|
if (userRoleCreateResponse.hasError()) {
|
|
|
|
|
response.addErrors(userRoleCreateResponse.getErrors());
|
|
|
|
|