Browse Source

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

dev
sunyuchao 5 years ago
parent
commit
090d642cb6
  1. 28
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/feign/GovOrgSelfFeignClient.java
  2. 21
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/feign/fallback/GovOrgSelfFeignClientFallBack.java
  3. 41
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyGridListResultDTO.java
  4. 57
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ArticleGridResultDTO.java
  5. 12
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerAgencyConstant.java
  6. 11
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java
  7. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.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/dao/CustomerStaffAgencyDao.java
  10. 7
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffGridDao.java
  11. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java
  12. 95
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java
  13. 11
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml
  14. 9
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml
  15. 12
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffAgencyDao.xml
  16. 11
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffGridDao.xml
  17. 6
      epmet-module/gov-voice/gov-voice-server/pom.xml
  18. 16
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java
  19. 10
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java
  20. 19
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java
  21. 26
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CustomerStaffRoleListFormDTO.java
  22. 41
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CustomerStaffRoleListResultDTO.java
  23. 29
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserSelfFeignClient.java
  24. 24
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserSelfFeignClientFallBack.java
  25. 16
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java
  26. 12
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java
  27. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java
  28. 11
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java
  29. 23
      epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml

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

@ -0,0 +1,28 @@
package com.epmet.dto.feign;
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 org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
/**
* @Description gov-org服务
* @Author sun
*/
@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgSelfFeignClientFallBack.class)
public interface GovOrgSelfFeignClient {
/**
* @param staffId
* @return
* @Author sun
* @Description 党建声音-政府端-可选发布范围接口调用
**/
@PostMapping(value = "gov/org/customeragency/getagencygridlist/{staffId}", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
Result<ArticleGridResultDTO> getAgencyGridList(@PathVariable("staffId") String staffId);
}

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

@ -0,0 +1,21 @@
package com.epmet.dto.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
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 org.springframework.stereotype.Component;
/**
* @Description gov-org服务
* @Author sun
*/
@Component
public class GovOrgSelfFeignClientFallBack implements GovOrgSelfFeignClient {
@Override
public Result<ArticleGridResultDTO> getAgencyGridList(String staffId) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getAgencyGridList", staffId);
}
}

41
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyGridListResultDTO.java

@ -0,0 +1,41 @@
/**
* 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 AgencyGridListResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 机关组织Id
*/
private String gridId = "";
private String gridName = "";
}

57
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ArticleGridResultDTO.java

@ -0,0 +1,57 @@
/**
* 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 ArticleGridResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 机关组织Id
*/
private String agencyId = "";
/**
* 机关组织名称
*/
private String agencyName = "";
/**
* 当前机关的下属网格列表
*/
private List<AgencyGridListResultDTO> gridList;
/**
* 当前组织的所有下级组织信息(递归)
*/
private List<ArticleGridResultDTO> subAgencyGridList;
/**
* 所有上级机关Ids
*/
private String pids = "";
}

12
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerAgencyConstant.java

@ -55,4 +55,16 @@ public interface CustomerAgencyConstant {
* 调用epmet-user服务查询用户基础信息失败
*/
String SELECT_USER_EXCEPTION = "获取用户基本信息失败";
/**
* 获取组织人员关系表数据失败
*/
String SELECT_AGENCY_STAFF_EXCEPTION = "获取机关下人员信息失败";
/**
* 党建负责人角色
*/
String PARTY_PRINCIPALS = "party_principals";
/**
* 网格党建指导员角色
*/
String GRID_PARTY_DIRECTOR = "grid_party_director";
}

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

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

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

@ -116,4 +116,12 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
* @return java.lang.String
*/
String selectAgencyName(@Param("agencyId") String agencyId);
/**
* @param subAgencyPids
* @return
* @Author sun
* @Description 递归查询当前机关的下一级机关列表
**/
List<ArticleGridResultDTO> selectAllSubAgency(@Param("subAgencyPids") String subAgencyPids);
}

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

@ -184,4 +184,12 @@ public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
* @date 2020.05.13 11:01
**/
CommonDataFilterResultDTO getGridDataFilterMsg(@Param("gridId")String gridId);
/**
* @param agencyId
* @return
* @Author sun
* @Description 查询组织下网格列表
**/
List<AgencyGridListResultDTO> selectAgencyGridList(@Param("agencyId") String agencyId);
}

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

@ -72,4 +72,12 @@ public interface CustomerStaffAgencyDao extends BaseDao<CustomerStaffAgencyEntit
* @Author sun
*/
List<StaffListResultDTO> selectAgencyStaffList(@Param("agencyId") String agencyId);
/**
* @param dto
* @return
* @Author sun
* @Description 根据staffId查询数据
**/
CustomerStaffAgencyDTO selectByStaffId(CustomerStaffAgencyDTO dto);
}

7
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffGridDao.java

@ -90,4 +90,11 @@ public interface CustomerStaffGridDao extends BaseDao<CustomerStaffGridEntity> {
* @Description 遍历查询每个部门下人员
*/
List<CustomerStaffGridDTO> selectGridStaffs(@Param("gridIdList") List<String> gridIdList);
/**
*
* @Author sun
* @Description 查询人员在客户下参与的网格列表
*/
List<CustomerStaffGridDTO> selectStaffGridList(CustomerStaffGridDTO staffGridDTO);
}

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

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

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

@ -35,6 +35,7 @@ import com.epmet.dto.result.*;
import com.epmet.entity.CustomerAgencyEntity;
import com.epmet.entity.CustomerGridEntity;
import com.epmet.feign.EpmetUserFeignClient;
import com.epmet.feign.EpmetUserSelfFeignClient;
import com.epmet.feign.OperCrmFeignClient;
import com.epmet.redis.CustomerAgencyRedis;
import com.epmet.service.CustomerAgencyService;
@ -75,6 +76,8 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
private CustomerStaffGridDao customerStaffGridDao;
@Autowired
private EpmetUserFeignClient epmetUserFeignClient;
@Autowired
private EpmetUserSelfFeignClient epmetUserSelfFeignClient;
@Override
public PageData<CustomerAgencyDTO> page(Map<String, Object> params) {
@ -628,4 +631,96 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
return subAgencyList;
}
/**
* @param staffId
* @return
* @Author sun
* @Description 党建声音-政府端-可选发布范围接口调用-根据人员角色查询对应的不同发布范围
**/
@Override
public ArticleGridResultDTO getAgencyGridList(String staffId) {
ArticleGridResultDTO returnDTO = new ArticleGridResultDTO();
//1:根据staffId查询跟工作人员对应的客户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){
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:根据不同角色查询不同数据
if(party){
//4.1:查询当前机关的网格列表以及所有下级机关的网格列表
//当前机关下网格列表
List<AgencyGridListResultDTO> gridList = customerGridDao.selectAgencyGridList(agencyEntity.getId());
returnDTO.setGridList(gridList);
//递归查询当前组织的下级组织以及每个下级组织对应的网格列表
List<ArticleGridResultDTO> subAgencyGridList = getGridList(agencyEntity.getPids() + ":" + agencyEntity.getId());
returnDTO.setSubAgencyGridList(subAgencyGridList);
}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<AgencyGridListResultDTO> resultList = gridList.stream().flatMap(agencyGrid -> gridDTOList.stream().filter(staffGrid ->
agencyGrid.getGridId().equals(staffGrid.getGridId())).map(grid -> {
AgencyGridListResultDTO resultDTO = ConvertUtils.sourceToTarget(agencyGrid, AgencyGridListResultDTO.class);
return resultDTO;
})).collect(Collectors.toList());
returnDTO.setGridList(resultList);
}
return returnDTO;
}
/**
* @Author sun
* @Description 递归查询当前机关的下一级机关列表
**/
private List<ArticleGridResultDTO> getGridList(String subAgencyPids) {
List<ArticleGridResultDTO> subAgencyList = baseDao.selectAllSubAgency(subAgencyPids);
if (subAgencyList.size() > NumConstant.ZERO) {
for (ArticleGridResultDTO sub : subAgencyList) {
List<AgencyGridListResultDTO> gridList = customerGridDao.selectAgencyGridList(sub.getAgencyId());
sub.setGridList(gridList);
List<ArticleGridResultDTO> subAgency = getGridList(sub.getPids() + ":" + sub.getAgencyId());
sub.setSubAgencyGridList(subAgency);
}
}
return subAgencyList;
}
}

11
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml

@ -156,4 +156,15 @@
WHERE a.ID = #{agencyId}
</select>
<select id="selectAllSubAgency" resultType="com.epmet.dto.result.ArticleGridResultDTO">
SELECT
id AS "agencyId",
organization_name AS "agencyName",
pids AS "pids"
FROM customer_agency
WHERE del_flag = '0'
AND pids = #{subAgencyPids}
ORDER BY created_time DESC
</select>
</mapper>

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

@ -320,4 +320,13 @@
AND agency.DEL_FLAG = '0'
AND grid.ID = #{gridId}
</select>
<select id="selectAgencyGridList" resultType="com.epmet.dto.result.AgencyGridListResultDTO">
SELECT
id AS "gridId",
grid_name AS "gridName"
FROM customer_grid
WHERE del_flag = '0'
AND pid = #{agencyId}
</select>
</mapper>

12
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffAgencyDao.xml

@ -105,4 +105,16 @@
AND agency_id =#{agencyId}
</select>
<select id="selectByStaffId" resultType="com.epmet.dto.CustomerStaffAgencyDTO">
SELECT
*
FROM
customer_staff_agency
WHERE
del_flag = '0'
<if test='null != userId and "" != userId'>
AND user_id = #{userId}
</if>
</select>
</mapper>

11
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffGridDao.xml

@ -77,6 +77,17 @@
</foreach>
</select>
<select id="selectStaffGridList" resultType="com.epmet.dto.CustomerStaffGridDTO">
SELECT
*
FROM
customer_staff_grid
WHERE
del_flag = '0'
AND user_id = #{userId}
AND customer_id = #{customerId}
</select>
<!-- 批量插入网格工作人员 -->
<insert id="insertBatch" parameterType="java.util.List">
insert into customer_staff_grid

6
epmet-module/gov-voice/gov-voice-server/pom.xml

@ -55,6 +55,12 @@
<artifactId>feign-httpclient</artifactId>
<version>10.3.0</version>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>gov-org-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

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

@ -17,7 +17,9 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
@ -26,6 +28,9 @@ import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
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.excel.ArticleExcel;
import com.epmet.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
@ -91,4 +96,15 @@ public class ArticleController {
ExcelUtils.exportExcelToTarget(response, null, list, ArticleExcel.class);
}
/**
* @param tokenDTO
* @return
* @Author sun
* @Description 党建声音-政府端-可选发布范围
**/
@PostMapping("agencygridlist")
public Result<ArticleGridResultDTO> agencyGridList(@LoginUser TokenDto tokenDTO) {
return new Result<ArticleGridResultDTO>().ok(articleService.agencyGridList(tokenDTO));
}
}

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

@ -19,7 +19,9 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
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.entity.ArticleEntity;
import java.util.List;
@ -92,4 +94,12 @@ public interface ArticleService extends BaseService<ArticleEntity> {
* @date 2020-06-02
*/
void delete(String[] ids);
/**
* @param tokenDTO
* @return
* @Author sun
* @Description 党建声音-政府端-可选发布范围
**/
ArticleGridResultDTO agencyGridList(TokenDto tokenDTO);
}

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

@ -21,10 +21,14 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
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.entity.ArticleEntity;
import com.epmet.redis.ArticleRedis;
import com.epmet.service.ArticleService;
@ -32,6 +36,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PathVariable;
import java.util.Arrays;
import java.util.List;
@ -48,6 +53,8 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
@Autowired
private ArticleRedis articleRedis;
@Autowired
private GovOrgSelfFeignClient govOrgSelfFeignClient;
@Override
public PageData<ArticleDTO> page(Map<String, Object> params) {
@ -101,4 +108,16 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* @param tokenDTO
* @return
* @Author sun
* @Description 党建声音-政府端-可选发布范围
**/
@Override
public ArticleGridResultDTO agencyGridList(TokenDto tokenDTO) {
Result<ArticleGridResultDTO> result = govOrgSelfFeignClient.getAgencyGridList(tokenDTO.getUserId());
return result.getData();
}
}

26
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CustomerStaffRoleListFormDTO.java

@ -0,0 +1,26 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description 查询客户下人员拥有的角色列表-接口入参
* @Author sun
*/
@Data
public class CustomerStaffRoleListFormDTO implements Serializable{
private static final long serialVersionUID = -7994579456530273809L;
/**
* 客户Id
* */
private String customerId;
/**
* 用户Id
* */
@NotBlank(message = "用户Id不能为空")
private String staffId;
}

41
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CustomerStaffRoleListResultDTO.java

@ -0,0 +1,41 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Description 根据客户Id staffId查询人员在客户下的角色列表-接口返参
* @Author sun
*/
@Data
public class CustomerStaffRoleListResultDTO implements Serializable {
private static final long serialVersionUID = -2049883620062097446L;
/**
* 客户Id
* */
private String customerId;
/**
* 员工Id
* */
private String staffId;
/**
* 员工姓名
* */
private String staffName;
/**
* 角色Id
* */
private String roleId;
/**
* 角色Key
* */
private String roleKey;
/**
* 角色名称
* */
private String roleName;
}

29
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserSelfFeignClient.java

@ -0,0 +1,29 @@
package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.CustomerStaffRoleListFormDTO;
import com.epmet.dto.result.CustomerStaffRoleListResultDTO;
import com.epmet.feign.fallback.EpmetUserSelfFeignClientFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import java.util.List;
/**
* @dscription epmet-user服务
* @author sun
*/
@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserSelfFeignClientFallBack.class)
public interface EpmetUserSelfFeignClient {
/**
* @param formDTO
* @return
* @Author sun
* @Description 根据客户Id和staffId查询一个员工在指定客户下的角色列表
**/
@PostMapping("/epmetuser/staffrole/getcustomerstaffrolelist")
Result<List<CustomerStaffRoleListResultDTO>> getCustomerStaffRoleList(CustomerStaffRoleListFormDTO formDTO);
}

24
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserSelfFeignClientFallBack.java

@ -0,0 +1,24 @@
package com.epmet.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.CustomerStaffRoleListFormDTO;
import com.epmet.dto.result.CustomerStaffRoleListResultDTO;
import com.epmet.feign.EpmetUserSelfFeignClient;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @dscription epmet-user服务
* @author sun
*/
@Component
public class EpmetUserSelfFeignClientFallBack implements EpmetUserSelfFeignClient {
@Override
public Result<List<CustomerStaffRoleListResultDTO>> getCustomerStaffRoleList(CustomerStaffRoleListFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustomerStaffRoleList", formDTO);
}
}

16
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java

@ -5,10 +5,8 @@ import com.epmet.commons.mybatis.entity.DataScope;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.GovStaffRoleDTO;
import com.epmet.dto.form.CommonUserFormDTO;
import com.epmet.dto.form.CustomerRoleFormDTO;
import com.epmet.dto.form.RolesUsersListFormDTO;
import com.epmet.dto.form.StaffRoleFormDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.CustomerStaffRoleListResultDTO;
import com.epmet.dto.result.GovStaffRoleResultDTO;
import com.epmet.dto.result.StaffRolesResultDTO;
import com.epmet.entity.GovStaffRoleEntity;
@ -142,4 +140,14 @@ public class StaffRoleController {
GovStaffRoleDTO role = govStaffRoleService.getRoleByCustomerIdAndRoleKey(form.getCustomerId(), form.getRoleKey());
return new Result<GovStaffRoleDTO>().ok(role);
}
/**
* @Description 根据客户Id和staffId查询一个员工在指定客户下的角色列表
* @Author sun
**/
@PostMapping("getcustomerstaffrolelist")
public Result<List<CustomerStaffRoleListResultDTO>> getCustomerStaffRoleList(@RequestBody CustomerStaffRoleListFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
return new Result<List<CustomerStaffRoleListResultDTO>>().ok(staffRoleService.getCustomerStaffRoleList(formDTO));
}
}

12
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java

@ -22,10 +22,8 @@ import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.commons.mybatis.entity.DataScope;
import com.epmet.dto.StaffRoleDTO;
import com.epmet.dto.form.CommonUserFormDTO;
import com.epmet.dto.result.CustomerStaffRoleResultDTO;
import com.epmet.dto.result.GovStaffRoleResultDTO;
import com.epmet.dto.result.StaffListResultDTO;
import com.epmet.dto.result.StaffRolesResultDTO;
import com.epmet.dto.form.CustomerStaffRoleListFormDTO;
import com.epmet.dto.result.*;
import com.epmet.entity.StaffRoleEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -85,4 +83,10 @@ public interface StaffRoleDao extends BaseDao<StaffRoleEntity> {
* @Description 根据staffId集合查询人员拥有的所有角色信息
**/
List<CustomerStaffRoleResultDTO> selectStaffRoleList(@Param("staffIdList") List<String> staffIdList);
/**
* @Description 根据客户Id和staffId查询一个员工在指定客户下的角色列表
* @Author sun
**/
List<CustomerStaffRoleListResultDTO> selectCustomerStaffRoleList(CustomerStaffRoleListFormDTO formDTO);
}

8
epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java

@ -23,7 +23,9 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.StaffRoleDTO;
import com.epmet.dto.form.CommonUserFormDTO;
import com.epmet.dto.form.CustomerStaffRoleListFormDTO;
import com.epmet.dto.form.RolesUsersListFormDTO;
import com.epmet.dto.result.CustomerStaffRoleListResultDTO;
import com.epmet.dto.result.GovStaffRoleResultDTO;
import com.epmet.dto.result.StaffRolesResultDTO;
import com.epmet.entity.StaffRoleEntity;
@ -130,4 +132,10 @@ public interface StaffRoleService extends BaseService<StaffRoleEntity> {
* @date 2020.04.29 23:44
**/
Result<List<String>> getSpecificRolesStaffs(RolesUsersListFormDTO rolesUsersListFormDTO);
/**
* @Description 根据客户Id和staffId查询一个员工在指定客户下的角色列表
* @Author sun
**/
List<CustomerStaffRoleListResultDTO> getCustomerStaffRoleList(CustomerStaffRoleListFormDTO formDTO);
}

11
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java

@ -31,7 +31,9 @@ import com.epmet.dao.GovStaffRoleTemplateDao;
import com.epmet.dao.StaffRoleDao;
import com.epmet.dto.StaffRoleDTO;
import com.epmet.dto.form.CommonUserFormDTO;
import com.epmet.dto.form.CustomerStaffRoleListFormDTO;
import com.epmet.dto.form.RolesUsersListFormDTO;
import com.epmet.dto.result.CustomerStaffRoleListResultDTO;
import com.epmet.dto.result.GovStaffRoleResultDTO;
import com.epmet.dto.result.GovStaffRoleTemplateDTO;
import com.epmet.dto.result.StaffRolesResultDTO;
@ -163,4 +165,13 @@ public class StaffRoleServiceImpl extends BaseServiceImpl<StaffRoleDao, StaffRol
return new Result<List<String>>().ok(new ArrayList<>());
}
/**
* @Description 根据客户Id和staffId查询一个员工在指定客户下的角色列表
* @Author sun
**/
@Override
public List<CustomerStaffRoleListResultDTO> getCustomerStaffRoleList(CustomerStaffRoleListFormDTO formDTO) {
return baseDao.selectCustomerStaffRoleList(formDTO);
}
}

23
epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml

@ -119,4 +119,27 @@
sr.staff_id = #{staffId}
</foreach>
</select>
<select id="selectCustomerStaffRoleList" resultType="com.epmet.dto.result.CustomerStaffRoleListResultDTO">
SELECT
staff.customer_id AS "customerId",
staff.user_id AS "staffId",
staff.real_name AS "staffName",
role.role_id AS "roleId",
rolename.role_key AS "roleKey",
rolename.role_name AS "roleName"
FROM
staff_role role
LEFT JOIN customer_staff staff ON ( role.staff_id = staff.user_id )
LEFT JOIN gov_staff_role rolename ON ( role.role_id = rolename.id )
WHERE
role.del_flag = '0'
AND staff.del_flag = '0'
AND rolename.del_flag = '0'
<if test='null != customerId and "" != customerId'>
AND staff.customer_id = #{customerId}
</if>
<if test='null != staffId and "" != staffId'>
AND staff.user_id = #{staffId}
</if>
</select>
</mapper>
Loading…
Cancel
Save