Browse Source

党建声音-政府端-可选发布单位接口首次提交

dev_shibei_match
sunyuchao 5 years ago
parent
commit
ddcbe527ea
  1. 9
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/feign/GovOrgSelfFeignClient.java
  2. 6
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/feign/fallback/GovOrgSelfFeignClientFallBack.java
  3. 44
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyDeptList.java
  4. 44
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyGridList.java
  5. 53
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/PublishAgencyListResultDTO.java
  6. 13
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java
  7. 9
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerDepartmentDao.java
  8. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java
  9. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java
  10. 109
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java
  11. 17
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerDepartmentDao.xml
  12. 17
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml
  13. 12
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java
  14. 9
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java
  15. 13
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java

9
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/feign/GovOrgSelfFeignClient.java

@ -4,6 +4,7 @@ import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.feign.fallback.GovOrgSelfFeignClientFallBack;
import com.epmet.dto.result.ArticleGridResultDTO;
import com.epmet.dto.result.PublishAgencyListResultDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PathVariable;
@ -25,4 +26,12 @@ public interface GovOrgSelfFeignClient {
@PostMapping(value = "gov/org/customeragency/getagencygridlist/{staffId}", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
Result<ArticleGridResultDTO> getAgencyGridList(@PathVariable("staffId") String staffId);
/**
* @param staffId
* @return
* @Author sun
* @Description 党建声音-政府端-可选发布单位接口调用
**/
@PostMapping(value = "gov/org/customeragency/getpublishagencylist/{staffId}", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
Result<PublishAgencyListResultDTO> getPublishAgencyList(@PathVariable("staffId") String staffId);
}

6
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/feign/fallback/GovOrgSelfFeignClientFallBack.java

@ -5,6 +5,7 @@ import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.feign.GovOrgSelfFeignClient;
import com.epmet.dto.result.ArticleGridResultDTO;
import com.epmet.dto.result.PublishAgencyListResultDTO;
import org.springframework.stereotype.Component;
/**
@ -18,4 +19,9 @@ public class GovOrgSelfFeignClientFallBack implements GovOrgSelfFeignClient {
public Result<ArticleGridResultDTO> getAgencyGridList(String staffId) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getAgencyGridList", staffId);
}
@Override
public Result<PublishAgencyListResultDTO> getPublishAgencyList(String staffId) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getPublishAgencyList", staffId);
}
}

44
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyDeptList.java

@ -0,0 +1,44 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* 添加组织-接口返参
*
* @author sun
*/
@Data
public class AgencyDeptList implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 部门Id
*/
private String departmentId = "";
/**
* 机关-部门名称
*/
private String agencyDeptName = "";
}

44
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyGridList.java

@ -0,0 +1,44 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* 添加组织-接口返参
*
* @author sun
*/
@Data
public class AgencyGridList implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 网格Id
*/
private String gridId = "";
/**
* 机关-网格名称
*/
private String agencyGridName = "";
}

53
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/PublishAgencyListResultDTO.java

@ -0,0 +1,53 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 党建声音-可选发布单位-接口返参
*
* @author sun
*/
@Data
public class PublishAgencyListResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 机关组织Id
*/
private String agencyId = "";
/**
* 机关组织名称
*/
private String agencyName = "";
/**
* 机关下部门列表信息
*/
private List<AgencyDeptList> agencyDeptList;
/**
* 机关下网格列表信息
*/
private List<AgencyGridList> agencyGridList;
}

13
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java

@ -169,9 +169,20 @@ public class CustomerAgencyController {
* @Author sun
* @Description 党建声音-政府端-可选发布范围接口调用-根据人员角色查询对应的不同发布范围
**/
@PostMapping("getagencygridlist/{agencyId}")
@PostMapping("getagencygridlist/{staffId}")
public Result<ArticleGridResultDTO> getAgencyGridList(@PathVariable("staffId") String staffId) {
return new Result<ArticleGridResultDTO>().ok(customerAgencyService.getAgencyGridList(staffId));
}
/**
* @param staffId
* @return
* @Author sun
* @Description 党建声音-政府端-可选发布范围接口调用-根据人员角色查询对应的不同发布范围
**/
@PostMapping("getpublishagencylist/{staffId}")
public Result<PublishAgencyListResultDTO> getPublishAgencyList(@PathVariable("staffId") String staffId) {
return new Result<PublishAgencyListResultDTO>().ok(customerAgencyService.getPublishAgencyList(staffId));
}
}

9
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerDepartmentDao.java

@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.CustomerDepartmentDTO;
import com.epmet.dto.CustomerIdDTO;
import com.epmet.dto.result.AgencyDeptList;
import com.epmet.dto.result.DepartmentListResultDTO;
import com.epmet.dto.result.SubListResultDTO;
import com.epmet.entity.CustomerDepartmentEntity;
@ -75,4 +76,12 @@ public interface CustomerDepartmentDao extends BaseDao<CustomerDepartmentEntity>
* @Description 批量查询部门信息
**/
List<CustomerDepartmentDTO> selectDeptListByIds(@Param("deptIdList") List<String> deptIdList);
/**
* @param agencyId
* @return
* @Author sun
* @Description 查询机关下部门列表信息
**/
List<AgencyDeptList> selectAgencyDeptMsgList(@Param("agencyId") String agencyId);
}

8
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java

@ -192,4 +192,12 @@ public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
* @Description 查询组织下网格列表
**/
List<AgencyGridListResultDTO> selectAgencyGridList(@Param("agencyId") String agencyId);
/**
* @param agencyId
* @return
* @Author sun
* @Description 查询机关下网格列表信息
**/
List<AgencyGridList> selectAgencyGridMsgList(@Param("agencyId") String agencyId);
}

8
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java

@ -164,4 +164,12 @@ public interface CustomerAgencyService extends BaseService<CustomerAgencyEntity>
* @Description 党建声音-政府端-可选发布范围接口调用-根据人员角色查询对应的不同发布范围
**/
ArticleGridResultDTO getAgencyGridList(String staffId);
/**
* @param staffId
* @return
* @Author sun
* @Description 党建声音-政府端-可选发布单位接口调用-根据人员角色查询对应的不同发布单位
**/
PublishAgencyListResultDTO getPublishAgencyList(String staffId);
}

109
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java

@ -640,52 +640,55 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
@Override
public ArticleGridResultDTO getAgencyGridList(String staffId) {
ArticleGridResultDTO returnDTO = new ArticleGridResultDTO();
//1:根据staffId查询跟工作人员对应的客户Id
//1:根据staffId查询该工作人员对应的机关Id、客户Id
CustomerStaffAgencyDTO staffAgencyDTO = new CustomerStaffAgencyDTO();
staffAgencyDTO.setUserId(staffId);
staffAgencyDTO = customerStaffAgencyDao.selectByStaffId(staffAgencyDTO);
if (null == staffAgencyDTO.getId()) {
throw new RenException(CustomerAgencyConstant.SELECT_AGENCY_STAFF_EXCEPTION);
}
CustomerAgencyEntity agencyEntity = baseDao.selectById(staffAgencyDTO.getAgencyId());
returnDTO.setAgencyId(agencyEntity.getId());
returnDTO.setAgencyName(agencyEntity.getOrganizationName());
//2:调用epmet-user服务,根据客户Id、staffId获取该人员在该客户下的角色列表
CustomerStaffRoleListFormDTO formDTO = new CustomerStaffRoleListFormDTO();
formDTO.setCustomerId(staffAgencyDTO.getCustomerId());
formDTO.setStaffId(staffId);
Result<List<CustomerStaffRoleListResultDTO>> listResult = epmetUserSelfFeignClient.getCustomerStaffRoleList(formDTO);
if(null==listResult.getData()||listResult.getData().size()<NumConstant.ONE){
if (null == listResult.getData() || listResult.getData().size() < NumConstant.ONE) {
return returnDTO;
}
List<CustomerStaffRoleListResultDTO> RoleList = listResult.getData();
//3:判断用户是否具有机关党建负责人或网格指导员角色
boolean party = false;//机关党建负责人角色
boolean gridParty = false;//网格指导员角色
for(CustomerStaffRoleListResultDTO role : RoleList){
if(CustomerAgencyConstant.PARTY_PRINCIPALS.equals(role.getRoleKey())){
//机关党建负责人角色
boolean party = false;
//网格指导员角色
boolean gridParty = false;
for (CustomerStaffRoleListResultDTO role : RoleList) {
if (CustomerAgencyConstant.PARTY_PRINCIPALS.equals(role.getRoleKey())) {
party = true;
}
if(CustomerAgencyConstant.GRID_PARTY_DIRECTOR.equals(role.getRoleKey())){
if (CustomerAgencyConstant.GRID_PARTY_DIRECTOR.equals(role.getRoleKey())) {
gridParty = true;
}
}
if(!party&&!gridParty){
if (!party && !gridParty) {
return returnDTO;
}
//4:根据不同角色查询不同数据
if(party){
CustomerAgencyEntity agencyEntity = baseDao.selectById(staffAgencyDTO.getAgencyId());
if (party) {
//4.1:查询当前机关的网格列表以及所有下级机关的网格列表
//当前机关信息
returnDTO.setAgencyId(agencyEntity.getId());
returnDTO.setAgencyName(agencyEntity.getOrganizationName());
//当前机关下网格列表
List<AgencyGridListResultDTO> gridList = customerGridDao.selectAgencyGridList(agencyEntity.getId());
returnDTO.setGridList(gridList);
//递归查询当前组织的下级组织以及每个下级组织对应的网格列表
List<ArticleGridResultDTO> subAgencyGridList = getGridList(agencyEntity.getPids() + ":" + agencyEntity.getId());
returnDTO.setSubAgencyGridList(subAgencyGridList);
}else if(gridParty){
} else if (gridParty) {
//4.2:查询人员在当前机关下参与的网格列表
//查询当前组织下的网格列表
List<AgencyGridListResultDTO> gridList = customerGridDao.selectAgencyGridList(agencyEntity.getId());
@ -722,5 +725,85 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
return subAgencyList;
}
/**
* @param staffId
* @return
* @Author sun
* @Description 党建声音-政府端-可选发布单位接口调用-根据人员角色查询对应的不同发布单位
**/
@Override
public PublishAgencyListResultDTO getPublishAgencyList(String staffId) {
PublishAgencyListResultDTO returnDTO = new PublishAgencyListResultDTO();
//1:根据staffId查询该工作人员对应的机关Id、客户Id
CustomerStaffAgencyDTO staffAgencyDTO = new CustomerStaffAgencyDTO();
staffAgencyDTO.setUserId(staffId);
staffAgencyDTO = customerStaffAgencyDao.selectByStaffId(staffAgencyDTO);
if (null == staffAgencyDTO.getId()) {
throw new RenException(CustomerAgencyConstant.SELECT_AGENCY_STAFF_EXCEPTION);
}
//2:调用epmet-user服务,根据客户Id、staffId获取该人员在该客户下的角色列表
CustomerStaffRoleListFormDTO formDTO = new CustomerStaffRoleListFormDTO();
formDTO.setCustomerId(staffAgencyDTO.getCustomerId());
formDTO.setStaffId(staffId);
Result<List<CustomerStaffRoleListResultDTO>> listResult = epmetUserSelfFeignClient.getCustomerStaffRoleList(formDTO);
if (null == listResult.getData() || listResult.getData().size() < NumConstant.ONE) {
return returnDTO;
}
List<CustomerStaffRoleListResultDTO> RoleList = listResult.getData();
//3:判断用户是否具有机关党建负责人或网格指导员角色
//机关党建负责人角色
boolean party = false;
//网格指导员角色
boolean gridParty = false;
for (CustomerStaffRoleListResultDTO role : RoleList) {
if (CustomerAgencyConstant.PARTY_PRINCIPALS.equals(role.getRoleKey())) {
party = true;
}
if (CustomerAgencyConstant.GRID_PARTY_DIRECTOR.equals(role.getRoleKey())) {
gridParty = true;
}
}
if (!party && !gridParty) {
return returnDTO;
}
//4:根据不同角色查询不同数据
CustomerAgencyEntity agencyEntity = baseDao.selectById(staffAgencyDTO.getAgencyId());
if (party) {
//4.1:查询当前机关的网格列表以及所有下级机关的网格列表
//当前机关信息
returnDTO.setAgencyId(agencyEntity.getId());
returnDTO.setAgencyName(agencyEntity.getOrganizationName());
//当前机关下部门列表信息
List<AgencyDeptList> agencyDeptList = customerDepartmentDao.selectAgencyDeptMsgList(agencyEntity.getId());
returnDTO.setAgencyDeptList(agencyDeptList);
//当前机关下网格列表
List<AgencyGridList> agencyGridList = customerGridDao.selectAgencyGridMsgList(agencyEntity.getId());
returnDTO.setAgencyGridList(agencyGridList);
} else if (gridParty) {
//4.2:查询人员在当前机关下参与的网格列表
//查询当前组织下的网格列表
List<AgencyGridListResultDTO> gridList = customerGridDao.selectAgencyGridList(agencyEntity.getId());
//查询该工作人员在该客户下参与的网格列表
CustomerStaffGridDTO staffGridDTO = new CustomerStaffGridDTO();
staffGridDTO.setCustomerId(staffAgencyDTO.getCustomerId());
staffGridDTO.setUserId(staffId);
List<CustomerStaffGridDTO> gridDTOList = customerStaffGridDao.selectStaffGridList(staffGridDTO);
//遍历取出该人员在该组织下参与的网格列表
List<AgencyGridList> resultList = gridList.stream().flatMap(agencyGrid -> gridDTOList.stream().filter(staffGrid ->
agencyGrid.getGridId().equals(staffGrid.getGridId())).map(grid -> {
AgencyGridList resultDTO = new AgencyGridList();
resultDTO.setGridId(agencyGrid.getGridId());
resultDTO.setAgencyGridName(agencyEntity.getOrganizationName() + "-" + agencyGrid.getGridName());
return resultDTO;
})).collect(Collectors.toList());
returnDTO.setAgencyGridList(resultList);
}
return returnDTO;
}
}

17
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerDepartmentDao.xml

@ -54,4 +54,21 @@
id = #{departmentId}
</foreach>
</select>
<select id="selectAgencyDeptMsgList" resultType="com.epmet.dto.result.AgencyDeptList">
SELECT
cd.id AS "departmentId",
CONCAT(
ca.organization_name,
"-",
cd.department_name
) "agencyDeptName"
FROM
customer_department cd
INNER JOIN customer_agency ca ON cd.agency_id = ca.id
WHERE
cd.del_flag = '0'
AND ca.del_flag = '0'
AND cd.agency_id = #{agencyId}
</select>
</mapper>

17
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml

@ -329,4 +329,21 @@
WHERE del_flag = '0'
AND pid = #{agencyId}
</select>
<select id="selectAgencyGridMsgList" resultType="com.epmet.dto.result.AgencyGridList">
SELECT
cg.id AS "gridId",
CONCAT(
ca.organization_name,
"-",
cg.grid_name
) "agencyGridName"
FROM
customer_grid cg
INNER JOIN customer_agency ca ON cg.pid = ca.id
WHERE
cg.del_flag = '0'
AND ca.del_flag = '0'
AND cg.pid = #{agencyId}
</select>
</mapper>

12
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java

@ -31,6 +31,7 @@ import com.epmet.dto.ArticleDTO;
import com.epmet.dto.form.LatestListFormDTO;
import com.epmet.dto.result.ArticleGridResultDTO;
import com.epmet.dto.result.LatestListResultDTO;
import com.epmet.dto.result.PublishAgencyListResultDTO;
import com.epmet.excel.ArticleExcel;
import com.epmet.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
@ -107,4 +108,15 @@ public class ArticleController {
return new Result<ArticleGridResultDTO>().ok(articleService.agencyGridList(tokenDTO));
}
/**
* @param tokenDTO
* @return
* @Author sun
* @Description 党建声音-政府端-可选发布单位
**/
@PostMapping("publishagencylist")
public Result<PublishAgencyListResultDTO> publishAgencyList(@LoginUser TokenDto tokenDTO) {
return new Result<PublishAgencyListResultDTO>().ok(articleService.publishAgencyList(tokenDTO));
}
}

9
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java

@ -22,6 +22,7 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dto.ArticleDTO;
import com.epmet.dto.result.ArticleGridResultDTO;
import com.epmet.dto.result.PublishAgencyListResultDTO;
import com.epmet.entity.ArticleEntity;
import java.util.List;
@ -102,4 +103,12 @@ public interface ArticleService extends BaseService<ArticleEntity> {
* @Description 党建声音-政府端-可选发布范围
**/
ArticleGridResultDTO agencyGridList(TokenDto tokenDTO);
/**
* @param tokenDTO
* @return
* @Author sun
* @Description 党建声音-政府端-可选发布单位
**/
PublishAgencyListResultDTO publishAgencyList(TokenDto tokenDTO);
}

13
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java

@ -29,6 +29,7 @@ import com.epmet.dao.ArticleDao;
import com.epmet.dto.ArticleDTO;
import com.epmet.dto.feign.GovOrgSelfFeignClient;
import com.epmet.dto.result.ArticleGridResultDTO;
import com.epmet.dto.result.PublishAgencyListResultDTO;
import com.epmet.entity.ArticleEntity;
import com.epmet.redis.ArticleRedis;
import com.epmet.service.ArticleService;
@ -120,4 +121,16 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
return result.getData();
}
/**
* @param tokenDTO
* @return
* @Author sun
* @Description 党建声音-政府端-可选发布单位
**/
@Override
public PublishAgencyListResultDTO publishAgencyList(TokenDto tokenDTO) {
Result<PublishAgencyListResultDTO> result = govOrgSelfFeignClient.getPublishAgencyList(tokenDTO.getUserId());
return result.getData();
}
}
Loading…
Cancel
Save