|
@@ -442,8 +442,24 @@ public class OrgController extends ControllerSupport {
|
|
throw new StatusException("B-140001", "非法访问");
|
|
throw new StatusException("B-140001", "非法访问");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ Long id = domain.getId();
|
|
|
|
+ if (null == id) {
|
|
|
|
+ throw new StatusException("B-140001", "id is null");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ OrgEntity orgEntity = orgRepo.findOne(id);
|
|
|
|
+ if (null == orgEntity) {
|
|
|
|
+ throw new StatusException("B-140002", "orgEntity is null");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ validateRootOrgIsolation(orgEntity.getRootId());
|
|
|
|
+
|
|
OrgInfo info = new OrgInfo();
|
|
OrgInfo info = new OrgInfo();
|
|
- info.setCode(domain.getCode());
|
|
|
|
|
|
+
|
|
|
|
+ info.setCode(orgEntity.getCode());
|
|
|
|
+ info.setParentId(orgEntity.getParentId());
|
|
|
|
+ info.setRootId(orgEntity.getRootId());
|
|
|
|
+
|
|
info.setName(domain.getName());
|
|
info.setName(domain.getName());
|
|
info.setContacts(domain.getContacts());
|
|
info.setContacts(domain.getContacts());
|
|
info.setTelephone(domain.getTelephone());
|
|
info.setTelephone(domain.getTelephone());
|
|
@@ -473,19 +489,30 @@ public class OrgController extends ControllerSupport {
|
|
trim(domain, true);
|
|
trim(domain, true);
|
|
|
|
|
|
User accessUser = getAccessUser();
|
|
User accessUser = getAccessUser();
|
|
|
|
+ Long rootId = domain.getRootId();
|
|
|
|
+ if (null == rootId) {
|
|
|
|
+ throw new StatusException("B-140001", "rootId is null");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ validateRootOrgIsolation(rootId);
|
|
|
|
|
|
OrgEntity subOrg = orgRepo.findByRootIdAndCode(accessUser.getRootOrgId(), domain.getCode());
|
|
OrgEntity subOrg = orgRepo.findByRootIdAndCode(accessUser.getRootOrgId(), domain.getCode());
|
|
if (null != subOrg) {
|
|
if (null != subOrg) {
|
|
throw new StatusException("B-140001", "机构代码已存在");
|
|
throw new StatusException("B-140001", "机构代码已存在");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ Long parentId = domain.getParentId();
|
|
|
|
+ if (null == parentId) {
|
|
|
|
+ parentId = rootId;
|
|
|
|
+ }
|
|
|
|
+
|
|
OrgInfo info = new OrgInfo();
|
|
OrgInfo info = new OrgInfo();
|
|
info.setCode(domain.getCode());
|
|
info.setCode(domain.getCode());
|
|
info.setName(domain.getName());
|
|
info.setName(domain.getName());
|
|
info.setContacts(domain.getContacts());
|
|
info.setContacts(domain.getContacts());
|
|
info.setTelephone(domain.getTelephone());
|
|
info.setTelephone(domain.getTelephone());
|
|
- info.setParentId(accessUser.getRootOrgId());
|
|
|
|
- info.setRootId(accessUser.getRootOrgId());
|
|
|
|
|
|
+ info.setParentId(parentId);
|
|
|
|
+ info.setRootId(rootId);
|
|
info.setRemark(domain.getRemark());
|
|
info.setRemark(domain.getRemark());
|
|
|
|
|
|
Map<String, String> properties = domain.getProperties();
|
|
Map<String, String> properties = domain.getProperties();
|
|
@@ -510,15 +537,26 @@ public class OrgController extends ControllerSupport {
|
|
public OrgEntity updateSubOrg(@RequestBody OrgDomain domain) {
|
|
public OrgEntity updateSubOrg(@RequestBody OrgDomain domain) {
|
|
trim(domain, true);
|
|
trim(domain, true);
|
|
|
|
|
|
- User accessUser = getAccessUser();
|
|
|
|
|
|
+ Long id = domain.getId();
|
|
|
|
+ if (null == id) {
|
|
|
|
+ throw new StatusException("B-140001", "id is null");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ OrgEntity orgEntity = orgRepo.findOne(id);
|
|
|
|
+ if (null == orgEntity) {
|
|
|
|
+ throw new StatusException("B-140002", "orgEntity is null");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ validateRootOrgIsolation(orgEntity.getRootId());
|
|
|
|
|
|
OrgInfo info = new OrgInfo();
|
|
OrgInfo info = new OrgInfo();
|
|
- info.setCode(domain.getCode());
|
|
|
|
|
|
+ info.setCode(orgEntity.getCode());
|
|
|
|
+ info.setParentId(orgEntity.getParentId());
|
|
|
|
+ info.setRootId(orgEntity.getRootId());
|
|
|
|
+
|
|
info.setName(domain.getName());
|
|
info.setName(domain.getName());
|
|
info.setContacts(domain.getContacts());
|
|
info.setContacts(domain.getContacts());
|
|
info.setTelephone(domain.getTelephone());
|
|
info.setTelephone(domain.getTelephone());
|
|
- info.setParentId(accessUser.getRootOrgId());
|
|
|
|
- info.setRootId(accessUser.getRootOrgId());
|
|
|
|
info.setRemark(domain.getRemark());
|
|
info.setRemark(domain.getRemark());
|
|
|
|
|
|
Map<String, String> properties = domain.getProperties();
|
|
Map<String, String> properties = domain.getProperties();
|