|
@@ -4,18 +4,23 @@ import com.github.microservice.auth.security.type.AuthType;
|
|
|
import com.github.microservice.components.data.base.util.PageEntityUtil;
|
|
import com.github.microservice.components.data.base.util.PageEntityUtil;
|
|
|
import com.github.microservice.net.ResultContent;
|
|
import com.github.microservice.net.ResultContent;
|
|
|
import com.github.microservice.net.ResultMessage;
|
|
import com.github.microservice.net.ResultMessage;
|
|
|
|
|
+import com.zhongshu.card.client.model.org.OrganizationMiniModel;
|
|
|
import com.zhongshu.card.client.model.org.OrganizationRelationSearch;
|
|
import com.zhongshu.card.client.model.org.OrganizationRelationSearch;
|
|
|
import com.zhongshu.card.client.model.org.OrganizationSimpleModel;
|
|
import com.zhongshu.card.client.model.org.OrganizationSimpleModel;
|
|
|
|
|
+import com.zhongshu.card.client.model.orgModel.ProjectBindOrgModel;
|
|
|
import com.zhongshu.card.client.model.orgModel.ProjectBindOrgParam;
|
|
import com.zhongshu.card.client.model.orgModel.ProjectBindOrgParam;
|
|
|
import com.zhongshu.card.client.type.OrganizationRelationType;
|
|
import com.zhongshu.card.client.type.OrganizationRelationType;
|
|
|
import com.zhongshu.card.server.core.dao.org.OrganizationDao;
|
|
import com.zhongshu.card.server.core.dao.org.OrganizationDao;
|
|
|
import com.zhongshu.card.server.core.dao.org.OrganizationRelationDao;
|
|
import com.zhongshu.card.server.core.dao.org.OrganizationRelationDao;
|
|
|
|
|
+import com.zhongshu.card.server.core.dao.projectAbout.PayShareListDao;
|
|
|
import com.zhongshu.card.server.core.domain.org.Organization;
|
|
import com.zhongshu.card.server.core.domain.org.Organization;
|
|
|
import com.zhongshu.card.server.core.domain.org.OrganizationRelation;
|
|
import com.zhongshu.card.server.core.domain.org.OrganizationRelation;
|
|
|
|
|
+import com.zhongshu.card.server.core.domain.projectAbout.PayShareList;
|
|
|
import com.zhongshu.card.server.core.service.base.SuperService;
|
|
import com.zhongshu.card.server.core.service.base.SuperService;
|
|
|
-import com.zhongshu.card.server.core.service.org.OrganizationServiceImpl;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Page;
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.domain.Pageable;
|
|
import org.springframework.data.domain.Pageable;
|
|
@@ -46,6 +51,9 @@ public class ProjectBindOrgServiceImpl extends SuperService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private OrganizationRelationDao organizationRelationDao;
|
|
private OrganizationRelationDao organizationRelationDao;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private PayShareListDao payShareListDao;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 项目绑定机构信息
|
|
* 项目绑定机构信息
|
|
|
*
|
|
*
|
|
@@ -76,16 +84,26 @@ public class ProjectBindOrgServiceImpl extends SuperService {
|
|
|
if (ObjectUtils.isNotEmpty(organizationRelation)) {
|
|
if (ObjectUtils.isNotEmpty(organizationRelation)) {
|
|
|
return ResultContent.buildFail(String.format("项目已绑定机构:%s", orgInfo.getName()));
|
|
return ResultContent.buildFail(String.format("项目已绑定机构:%s", orgInfo.getName()));
|
|
|
}
|
|
}
|
|
|
|
|
+ PayShareList payShareList = null;
|
|
|
|
|
+ if (StringUtils.isNotEmpty(param.getPayShareListId())) {
|
|
|
|
|
+ payShareList = payShareListDao.findTopById(param.getPayShareListId());
|
|
|
|
|
+ if (ObjectUtils.isEmpty(payShareList)) {
|
|
|
|
|
+ return ResultContent.buildFail(String.format("分组规则不存在:%s", param.getPayShareListId()));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
organizationRelation = new OrganizationRelation();
|
|
organizationRelation = new OrganizationRelation();
|
|
|
|
|
+ BeanUtils.copyProperties(param, organizationRelation);
|
|
|
organizationRelation.setMainOrganization(projectInfo);
|
|
organizationRelation.setMainOrganization(projectInfo);
|
|
|
organizationRelation.setMainName(projectInfo.getName());
|
|
organizationRelation.setMainName(projectInfo.getName());
|
|
|
organizationRelation.setAuthType(projectInfo.getAuthType());
|
|
organizationRelation.setAuthType(projectInfo.getAuthType());
|
|
|
|
|
+ organizationRelation.setPayShareList(payShareList);
|
|
|
|
|
|
|
|
organizationRelation.setRelOrganization(orgInfo);
|
|
organizationRelation.setRelOrganization(orgInfo);
|
|
|
organizationRelation.setRelName(orgInfo.getName());
|
|
organizationRelation.setRelName(orgInfo.getName());
|
|
|
organizationRelation.setRelAuthType(orgInfo.getAuthType());
|
|
organizationRelation.setRelAuthType(orgInfo.getAuthType());
|
|
|
organizationRelation.setRelationType(OrganizationRelationType.ProjectBindOrg);
|
|
organizationRelation.setRelationType(OrganizationRelationType.ProjectBindOrg);
|
|
|
|
|
+
|
|
|
organizationRelationDao.save(organizationRelation);
|
|
organizationRelationDao.save(organizationRelation);
|
|
|
|
|
|
|
|
return ResultContent.buildSuccess();
|
|
return ResultContent.buildSuccess();
|
|
@@ -98,12 +116,12 @@ public class ProjectBindOrgServiceImpl extends SuperService {
|
|
|
* @param pageable
|
|
* @param pageable
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
- public ResultContent<Page<OrganizationSimpleModel>> orgPage(OrganizationRelationSearch param, Pageable pageable) {
|
|
|
|
|
- Assert.hasText(param.getMainOid(), "mainOid不能为空");
|
|
|
|
|
|
|
+ public ResultContent<Page<ProjectBindOrgModel>> orgPage(OrganizationRelationSearch param, Pageable pageable) {
|
|
|
|
|
+ // projectOid
|
|
|
|
|
+ Assert.hasText(param.getProjectOid(), "projectOid不能为空");
|
|
|
|
|
+ param.setMainOid(param.getProjectOid());
|
|
|
Page<OrganizationRelation> page = organizationRelationDao.page(pageable, param);
|
|
Page<OrganizationRelation> page = organizationRelationDao.page(pageable, param);
|
|
|
- return ResultContent.buildSuccess(PageEntityUtil.concurrent2PageModel(page, (it) -> {
|
|
|
|
|
- return organizationManagerService.toSimpleModel(it.getRelOrganization());
|
|
|
|
|
- }));
|
|
|
|
|
|
|
+ return ResultContent.buildSuccess(PageEntityUtil.concurrent2PageModel(page, this::toModel));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -112,8 +130,8 @@ public class ProjectBindOrgServiceImpl extends SuperService {
|
|
|
* @param projectOid
|
|
* @param projectOid
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
- public ResultContent<List<OrganizationSimpleModel>> getProjectOrgList(String projectOid) {
|
|
|
|
|
- List<OrganizationSimpleModel> models = new ArrayList<>();
|
|
|
|
|
|
|
+ public ResultContent<List<OrganizationMiniModel>> getProjectOrgList(String projectOid) {
|
|
|
|
|
+ List<OrganizationMiniModel> models = new ArrayList<>();
|
|
|
Organization projectInfo = organizationDao.findTopByOid(projectOid);
|
|
Organization projectInfo = organizationDao.findTopByOid(projectOid);
|
|
|
if (ObjectUtils.isEmpty(projectInfo)) {
|
|
if (ObjectUtils.isEmpty(projectInfo)) {
|
|
|
return ResultContent.buildFail(String.format(ResultMessage.DATA_NOT_EXIST, projectOid));
|
|
return ResultContent.buildFail(String.format(ResultMessage.DATA_NOT_EXIST, projectOid));
|
|
@@ -122,7 +140,7 @@ public class ProjectBindOrgServiceImpl extends SuperService {
|
|
|
List<OrganizationRelation> list = organizationRelationDao.findByMainOrganizationAndRelationType(projectInfo, OrganizationRelationType.ProjectBindOrg);
|
|
List<OrganizationRelation> list = organizationRelationDao.findByMainOrganizationAndRelationType(projectInfo, OrganizationRelationType.ProjectBindOrg);
|
|
|
if (ObjectUtils.isNotEmpty(list)) {
|
|
if (ObjectUtils.isNotEmpty(list)) {
|
|
|
models = list.stream().map(it -> {
|
|
models = list.stream().map(it -> {
|
|
|
- return organizationManagerService.toSimpleModel(it.getRelOrganization());
|
|
|
|
|
|
|
+ return organizationManagerService.toMiniModel(it.getRelOrganization());
|
|
|
}).collect(Collectors.toList());
|
|
}).collect(Collectors.toList());
|
|
|
}
|
|
}
|
|
|
return ResultContent.buildSuccess(models);
|
|
return ResultContent.buildSuccess(models);
|
|
@@ -171,4 +189,48 @@ public class ProjectBindOrgServiceImpl extends SuperService {
|
|
|
return organizationRelationDao.countByMainOrganizationAndRelationType(organization, OrganizationRelationType.ProjectBindOrg);
|
|
return organizationRelationDao.countByMainOrganizationAndRelationType(organization, OrganizationRelationType.ProjectBindOrg);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 得到机构绑定的项目列表
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param oid
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public List<Organization> getOrgBindProjects(String oid) {
|
|
|
|
|
+ List<Organization> list = new ArrayList<>();
|
|
|
|
|
+ Organization organization = organizationDao.findTopByOid(oid);
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(organization)) {
|
|
|
|
|
+ List<OrganizationRelation> _list = organizationRelationDao.findByRelOrganizationAndRelationType(organization, OrganizationRelationType.ProjectBindOrg);
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(_list)) {
|
|
|
|
|
+ list = _list.stream().map(it -> it.getMainOrganization()).collect(Collectors.toList());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return list;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 得到项目绑定的结构信息
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param projectOid
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public List<Organization> getProjectBindOrgs(String projectOid) {
|
|
|
|
|
+ List<Organization> list = new ArrayList<>();
|
|
|
|
|
+ Organization organization = organizationDao.findTopByOid(projectOid);
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(organization)) {
|
|
|
|
|
+ List<OrganizationRelation> _list = organizationRelationDao.findByMainOrganizationAndRelationType(organization, OrganizationRelationType.ProjectBindOrg);
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(_list)) {
|
|
|
|
|
+ list = _list.stream().map(it -> it.getRelOrganization()).collect(Collectors.toList());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return list;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public ProjectBindOrgModel toModel(OrganizationRelation entity) {
|
|
|
|
|
+ ProjectBindOrgModel model = null;
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(entity)) {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ return model;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|