|
|
@@ -265,36 +265,51 @@ public class OrganizationServiceImpl extends SuperService implements Organizatio
|
|
|
Assert.hasText(param.getContactPhone(), "手机号不能为空");
|
|
|
|
|
|
String projectId = param.getProjectOid();
|
|
|
- Organization organization = organizationDao.findTopByOid(projectId);
|
|
|
- if (ObjectUtils.isEmpty(organization)) {
|
|
|
+ Organization projectOrg = organizationDao.findTopByOid(projectId);
|
|
|
+ if (ObjectUtils.isEmpty(projectOrg)) {
|
|
|
return ResultContent.buildSuccess(String.format("项目不存在:%s", projectId));
|
|
|
}
|
|
|
- Organization main = organizationDao.findTopById(param.getId());
|
|
|
- if (ObjectUtils.isEmpty(main)) {
|
|
|
+ Organization schoolInfo = organizationDao.findTopById(param.getId());
|
|
|
+ if (ObjectUtils.isEmpty(schoolInfo)) {
|
|
|
return ResultContent.buildFail(String.format(ResultMessage.DATA_NOT_EXIST, param.getId()));
|
|
|
}
|
|
|
if (param.getState() == null) {
|
|
|
param.setState(OrganizationState.Normal);
|
|
|
}
|
|
|
- BeanUtils.copyProperties(param, main);
|
|
|
- organizationDao.save(main);
|
|
|
+ BeanUtils.copyProperties(param, schoolInfo);
|
|
|
+ organizationDao.save(schoolInfo);
|
|
|
|
|
|
// 找出关联的项目
|
|
|
- OrganizationRelation organizationRelation = organizationRelationDao.findTopByMainOrganizationAndRelationType(main, OrganizationRelationType.SchoolToProject);
|
|
|
+ OrganizationRelation organizationRelation = organizationRelationDao.findTopByMainOrganizationAndRelationType(schoolInfo, OrganizationRelationType.SchoolToProject);
|
|
|
if (ObjectUtils.isEmpty(organizationRelation)) {
|
|
|
organizationRelation = new OrganizationRelation();
|
|
|
}
|
|
|
organizationRelation.setAuthType(AuthType.School);
|
|
|
- organizationRelation.setMainOrganization(main);
|
|
|
- organizationRelation.setMainName(main.getName());
|
|
|
- organizationRelation.setRelOrganization(organization);
|
|
|
- organizationRelation.setRelName(organization.getName());
|
|
|
+ organizationRelation.setMainOrganization(schoolInfo);
|
|
|
+ organizationRelation.setMainName(schoolInfo.getName());
|
|
|
+ organizationRelation.setRelOrganization(projectOrg);
|
|
|
+ organizationRelation.setRelName(projectOrg.getName());
|
|
|
organizationRelation.setRelationType(OrganizationRelationType.SchoolToProject);
|
|
|
organizationRelationDao.save(organizationRelation);
|
|
|
|
|
|
return ResultContent.buildSuccess();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 得到学校绑定项目 绑定学校
|
|
|
+ *
|
|
|
+ * @param schoolOid
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public OrganizationRelation getSchoolRelationProject(String schoolOid) {
|
|
|
+ Organization organization = organizationDao.findTopByOid(schoolOid);
|
|
|
+ if (ObjectUtils.isNotEmpty(organization)) {
|
|
|
+ OrganizationRelation organizationRelation = organizationRelationDao.findTopByMainOrganizationAndRelationType(main, OrganizationRelationType.SchoolToProject);
|
|
|
+ return organizationRelation;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 编辑机构 (编辑基本信息)
|
|
|
*
|