|
|
@@ -10,15 +10,11 @@ import com.github.microservice.components.data.base.util.PageEntityUtil;
|
|
|
import com.zhongshu.card.client.model.base.AuthTypeParam;
|
|
|
import com.zhongshu.card.client.model.base.UserIdModel;
|
|
|
import com.zhongshu.card.client.model.org.*;
|
|
|
-import com.zhongshu.card.client.model.school.DictInfoParam;
|
|
|
import com.zhongshu.card.client.model.school.DictInfoSimpleModel;
|
|
|
-import com.zhongshu.card.client.model.school.RegisterUserParam;
|
|
|
import com.zhongshu.card.client.ret.ResultContent;
|
|
|
import com.zhongshu.card.client.ret.ResultMessage;
|
|
|
-import com.zhongshu.card.client.service.org.DepartmentService;
|
|
|
import com.zhongshu.card.client.service.org.OrganizationService;
|
|
|
import com.zhongshu.card.client.service.org.UserAccountService;
|
|
|
-import com.zhongshu.card.client.service.school.DictInfoService;
|
|
|
import com.zhongshu.card.client.utils.type.*;
|
|
|
import com.zhongshu.card.server.core.dao.org.*;
|
|
|
import com.zhongshu.card.server.core.dao.school.DictInfoDao;
|
|
|
@@ -27,7 +23,10 @@ import com.zhongshu.card.server.core.domain.org.*;
|
|
|
import com.zhongshu.card.server.core.domain.school.DictInfo;
|
|
|
import com.zhongshu.card.server.core.service.base.SuperService;
|
|
|
import com.zhongshu.card.server.core.service.school.DictInfoServiceImpl;
|
|
|
-import com.zhongshu.card.server.core.util.*;
|
|
|
+import com.zhongshu.card.server.core.util.BeanUtils;
|
|
|
+import com.zhongshu.card.server.core.util.CommonUtil;
|
|
|
+import com.zhongshu.card.server.core.util.ValidateResult;
|
|
|
+import com.zhongshu.card.server.core.util.ValidateUtils;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
@@ -116,12 +115,12 @@ public class UserAccountServiceImpl extends SuperService implements UserAccountS
|
|
|
return ResultContent.buildFail(String.format("oid不存在:%s", oid));
|
|
|
}
|
|
|
List<Role> roles = new ArrayList<>();
|
|
|
- List<Department> departments = new ArrayList<>();
|
|
|
+ Department department = null;
|
|
|
if (ObjectUtils.isNotEmpty(param.getRoleIds())) {
|
|
|
roles = roleDao.findByOidAndIdIn(oid, param.getRoleIds());
|
|
|
}
|
|
|
- if (ObjectUtils.isNotEmpty(param.getDepartmentIds())) {
|
|
|
- departments = departmentDao.findByOidAndIdIn(oid, param.getDepartmentIds());
|
|
|
+ if (ObjectUtils.isNotEmpty(param.getDepartmentId())) {
|
|
|
+ department = departmentDao.findTopById(param.getDepartmentId());
|
|
|
}
|
|
|
|
|
|
UserAccount temp = null;
|
|
|
@@ -210,14 +209,17 @@ public class UserAccountServiceImpl extends SuperService implements UserAccountS
|
|
|
|
|
|
BeanUtils.copyProperties(param, organizationUser, "id", "oid");
|
|
|
// 职位信息
|
|
|
+ DictInfo position = null;
|
|
|
if (StringUtils.isNotEmpty(param.getPositionId())) {
|
|
|
- organizationUser.setPosition(dictInfoDao.findTopById(param.getPositionId()));
|
|
|
+ position = dictInfoDao.findTopById(param.getPositionId());
|
|
|
}
|
|
|
+ organizationUser.setPosition(position);
|
|
|
+
|
|
|
organizationUser.setAuthType(organization.getAuthType());
|
|
|
// 设置角色
|
|
|
organizationUser.setRoles(roles);
|
|
|
// 设置部门
|
|
|
- organizationUser.setDepartments(departments);
|
|
|
+ organizationUser.setDepartment(department);
|
|
|
organizationUserDao.save(organizationUser);
|
|
|
|
|
|
// 权限中心
|
|
|
@@ -585,9 +587,11 @@ public class UserAccountServiceImpl extends SuperService implements UserAccountS
|
|
|
model.setRoles(roleModels);
|
|
|
}
|
|
|
// 部门信息
|
|
|
- if (ObjectUtils.isNotEmpty(entity.getDepartments())) {
|
|
|
- List<DepartmentModel> roleModels = entity.getDepartments().stream().map(departmentService::toModel).collect(Collectors.toList());
|
|
|
- model.setDepartments(roleModels);
|
|
|
+ if (ObjectUtils.isNotEmpty(entity.getDepartment())) {
|
|
|
+ DepartmentModel departmentModel = departmentService.toModel(entity.getDepartment());
|
|
|
+ model.setDepartment(departmentModel);
|
|
|
+ List<DepartmentModel> departmentModels = departmentService.getParents(entity.getDepartment().getId());
|
|
|
+ model.setDepartments(departmentModels);
|
|
|
}
|
|
|
}
|
|
|
return model;
|