|
|
@@ -8,6 +8,7 @@ import com.zhongshu.card.client.model.org.OrganizationMiniModel;
|
|
|
import com.zhongshu.card.client.model.org.OrganizationRelationSearch;
|
|
|
import com.zhongshu.card.client.model.orgModel.ProjectBindOrgModel;
|
|
|
import com.zhongshu.card.client.model.orgModel.ProjectBindOrgParam;
|
|
|
+import com.zhongshu.card.client.model.orgModel.ProjectBindOrgsParam;
|
|
|
import com.zhongshu.card.client.type.OrganizationRelationType;
|
|
|
import com.zhongshu.card.server.core.dao.org.OrganizationDao;
|
|
|
import com.zhongshu.card.server.core.dao.org.OrganizationRelationDao;
|
|
|
@@ -116,7 +117,50 @@ public class ProjectBindOrgServiceImpl extends SuperService {
|
|
|
organizationRelation.setAboutAuthType(projectInfo.getAuthType());
|
|
|
|
|
|
organizationRelationDao.save(organizationRelation);
|
|
|
+ return ResultContent.buildSuccess();
|
|
|
+ }
|
|
|
|
|
|
+ public ResultContent projectBindOids(ProjectBindOrgsParam param) {
|
|
|
+ String projectOid = param.getProjectOid();
|
|
|
+ Organization projectInfo = organizationDao.findTopByOid(projectOid);
|
|
|
+ if (ObjectUtils.isEmpty(projectInfo)) {
|
|
|
+ return ResultContent.buildFail(String.format(ResultMessage.DATA_NOT_EXIST, projectInfo));
|
|
|
+ }
|
|
|
+ if (projectInfo.getAuthType() != AuthType.Project) {
|
|
|
+ return ResultContent.buildFail(String.format("不属于项目类型:%s", projectOid));
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNotEmpty(param.getOrgOids())) {
|
|
|
+ List<OrganizationRelation> list = new ArrayList<>();
|
|
|
+ for (String oid : param.getOrgOids()) {
|
|
|
+ Organization orgInfo = organizationDao.findTopByOid(oid);
|
|
|
+ if (ObjectUtils.isEmpty(orgInfo)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ OrganizationRelation orgRelation = null;
|
|
|
+ if (ObjectUtils.isNotEmpty(orgInfo)) {
|
|
|
+ orgRelation = organizationRelationDao.findTopByMainOrganizationAndRelOrganizationAndRelationType(
|
|
|
+ projectInfo, orgInfo, OrganizationRelationType.ProjectBindOrg);
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isEmpty(orgRelation)) {
|
|
|
+ orgRelation = new OrganizationRelation();
|
|
|
+ }
|
|
|
+ BeanUtils.copyProperties(param, orgRelation);
|
|
|
+ orgRelation.setMainOrganization(projectInfo);
|
|
|
+ orgRelation.setMainName(projectInfo.getName());
|
|
|
+ orgRelation.setAuthType(projectInfo.getAuthType());
|
|
|
+
|
|
|
+ orgRelation.setRelOrganization(orgInfo);
|
|
|
+ orgRelation.setRelName(orgInfo.getName());
|
|
|
+ orgRelation.setRelAuthType(orgInfo.getAuthType());
|
|
|
+ orgRelation.setRelationType(OrganizationRelationType.ProjectBindOrg);
|
|
|
+
|
|
|
+ orgRelation.setAboutOid(projectInfo.getOid());
|
|
|
+ orgRelation.setAboutAuthType(projectInfo.getAuthType());
|
|
|
+ list.add(orgRelation);
|
|
|
+ }
|
|
|
+ organizationRelationDao.saveAll(list);
|
|
|
+ }
|
|
|
return ResultContent.buildSuccess();
|
|
|
}
|
|
|
|