From 090d642cb6afad3fcea92b280ff60fea22e0e7cb Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Tue, 2 Jun 2020 16:03:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=9A=E5=BB=BA=E5=A3=B0=E9=9F=B3-=E6=94=BF?= =?UTF-8?q?=E5=BA=9C=E7=AB=AF-=E5=8F=AF=E9=80=89=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E8=8C=83=E5=9B=B4=E6=8E=A5=E5=8F=A3=E9=A6=96=E6=AC=A1=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/feign/GovOrgSelfFeignClient.java | 28 ++++++ .../GovOrgSelfFeignClientFallBack.java | 21 ++++ .../dto/result/AgencyGridListResultDTO.java | 41 ++++++++ .../dto/result/ArticleGridResultDTO.java | 57 +++++++++++ .../constant/CustomerAgencyConstant.java | 12 +++ .../controller/CustomerAgencyController.java | 11 +++ .../java/com/epmet/dao/CustomerAgencyDao.java | 8 ++ .../java/com/epmet/dao/CustomerGridDao.java | 8 ++ .../com/epmet/dao/CustomerStaffAgencyDao.java | 8 ++ .../com/epmet/dao/CustomerStaffGridDao.java | 7 ++ .../epmet/service/CustomerAgencyService.java | 8 ++ .../impl/CustomerAgencyServiceImpl.java | 95 +++++++++++++++++++ .../resources/mapper/CustomerAgencyDao.xml | 11 +++ .../main/resources/mapper/CustomerGridDao.xml | 9 ++ .../mapper/CustomerStaffAgencyDao.xml | 12 +++ .../resources/mapper/CustomerStaffGridDao.xml | 11 +++ .../gov-voice/gov-voice-server/pom.xml | 6 ++ .../epmet/controller/ArticleController.java | 16 ++++ .../com/epmet/service/ArticleService.java | 10 ++ .../service/impl/ArticleServiceImpl.java | 19 ++++ .../form/CustomerStaffRoleListFormDTO.java | 26 +++++ .../CustomerStaffRoleListResultDTO.java | 41 ++++++++ .../epmet/feign/EpmetUserSelfFeignClient.java | 29 ++++++ .../EpmetUserSelfFeignClientFallBack.java | 24 +++++ .../epmet/controller/StaffRoleController.java | 16 +++- .../main/java/com/epmet/dao/StaffRoleDao.java | 12 ++- .../com/epmet/service/StaffRoleService.java | 8 ++ .../service/impl/StaffRoleServiceImpl.java | 11 +++ .../main/resources/mapper/StaffRoleDao.xml | 23 +++++ 29 files changed, 580 insertions(+), 8 deletions(-) create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/feign/GovOrgSelfFeignClient.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/feign/fallback/GovOrgSelfFeignClientFallBack.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyGridListResultDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ArticleGridResultDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CustomerStaffRoleListFormDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CustomerStaffRoleListResultDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserSelfFeignClient.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserSelfFeignClientFallBack.java diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/feign/GovOrgSelfFeignClient.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/feign/GovOrgSelfFeignClient.java new file mode 100644 index 0000000000..1388593063 --- /dev/null +++ b/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 getAgencyGridList(@PathVariable("staffId") String staffId); + +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/feign/fallback/GovOrgSelfFeignClientFallBack.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/feign/fallback/GovOrgSelfFeignClientFallBack.java new file mode 100644 index 0000000000..d1210a4f23 --- /dev/null +++ b/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 getAgencyGridList(String staffId) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getAgencyGridList", staffId); + } +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyGridListResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyGridListResultDTO.java new file mode 100644 index 0000000000..5474009956 --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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 = ""; + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ArticleGridResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ArticleGridResultDTO.java new file mode 100644 index 0000000000..2e83e432c3 --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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 gridList; + /** + * 当前组织的所有下级组织信息(递归) + */ + private List subAgencyGridList; + /** + * 所有上级机关Ids + */ + private String pids = ""; + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerAgencyConstant.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerAgencyConstant.java index c4d48ee458..b1a42c4209 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerAgencyConstant.java +++ b/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"; } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java index 2bc9b1e136..5c6d37a701 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java +++ b/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().ok(customerAgencyService.getProcessorList(agencyId)); } + /** + * @param staffId + * @return + * @Author sun + * @Description 党建声音-政府端-可选发布范围接口调用-根据人员角色查询对应的不同发布范围 + **/ + @PostMapping("getagencygridlist/{agencyId}") + public Result getAgencyGridList(@PathVariable("staffId") String staffId) { + return new Result().ok(customerAgencyService.getAgencyGridList(staffId)); + } + } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java index ec559ccaa6..8a51d3ad19 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java @@ -116,4 +116,12 @@ public interface CustomerAgencyDao extends BaseDao { * @return java.lang.String */ String selectAgencyName(@Param("agencyId") String agencyId); + + /** + * @param subAgencyPids + * @return + * @Author sun + * @Description 递归查询当前机关的下一级机关列表 + **/ + List selectAllSubAgency(@Param("subAgencyPids") String subAgencyPids); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java index 2256263cd0..2f2fd75797 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java @@ -184,4 +184,12 @@ public interface CustomerGridDao extends BaseDao { * @date 2020.05.13 11:01 **/ CommonDataFilterResultDTO getGridDataFilterMsg(@Param("gridId")String gridId); + + /** + * @param agencyId + * @return + * @Author sun + * @Description 查询组织下网格列表 + **/ + List selectAgencyGridList(@Param("agencyId") String agencyId); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffAgencyDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffAgencyDao.java index 767b073359..7f980cb8c8 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffAgencyDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffAgencyDao.java @@ -72,4 +72,12 @@ public interface CustomerStaffAgencyDao extends BaseDao selectAgencyStaffList(@Param("agencyId") String agencyId); + + /** + * @param dto + * @return + * @Author sun + * @Description 根据staffId查询数据 + **/ + CustomerStaffAgencyDTO selectByStaffId(CustomerStaffAgencyDTO dto); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffGridDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffGridDao.java index 2a160f8a90..54cad95662 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffGridDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffGridDao.java @@ -90,4 +90,11 @@ public interface CustomerStaffGridDao extends BaseDao { * @Description 遍历查询每个部门下人员 */ List selectGridStaffs(@Param("gridIdList") List gridIdList); + + /** + * + * @Author sun + * @Description 查询人员在客户下参与的网格列表 + */ + List selectStaffGridList(CustomerStaffGridDTO staffGridDTO); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java index e29bff8bf1..bbd40017b2 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java @@ -156,4 +156,12 @@ public interface CustomerAgencyService extends BaseService * @return java.lang.String */ String getAgencyName(String agencyId); + + /** + * @param staffId + * @return + * @Author sun + * @Description 党建声音-政府端-可选发布范围接口调用-根据人员角色查询对应的不同发布范围 + **/ + ArticleGridResultDTO getAgencyGridList(String staffId); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java index bf01b2e618..45f234258d 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java +++ b/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 page(Map params) { @@ -628,4 +631,96 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl> listResult = epmetUserSelfFeignClient.getCustomerStaffRoleList(formDTO); + if(null==listResult.getData()||listResult.getData().size() 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 gridList = customerGridDao.selectAgencyGridList(agencyEntity.getId()); + returnDTO.setGridList(gridList); + //递归查询当前组织的下级组织以及每个下级组织对应的网格列表 + List subAgencyGridList = getGridList(agencyEntity.getPids() + ":" + agencyEntity.getId()); + returnDTO.setSubAgencyGridList(subAgencyGridList); + }else if(gridParty){ + //4.2:查询人员在当前机关下参与的网格列表 + //查询当前组织下的网格列表 + List gridList = customerGridDao.selectAgencyGridList(agencyEntity.getId()); + //查询该工作人员在该客户下参与的网格列表 + CustomerStaffGridDTO staffGridDTO = new CustomerStaffGridDTO(); + staffGridDTO.setCustomerId(staffAgencyDTO.getCustomerId()); + staffGridDTO.setUserId(staffId); + List gridDTOList = customerStaffGridDao.selectStaffGridList(staffGridDTO); + //遍历取出该人员在该组织下参与的网格列表 + List 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 getGridList(String subAgencyPids) { + List subAgencyList = baseDao.selectAllSubAgency(subAgencyPids); + if (subAgencyList.size() > NumConstant.ZERO) { + for (ArticleGridResultDTO sub : subAgencyList) { + List gridList = customerGridDao.selectAgencyGridList(sub.getAgencyId()); + sub.setGridList(gridList); + List subAgency = getGridList(sub.getPids() + ":" + sub.getAgencyId()); + sub.setSubAgencyGridList(subAgency); + } + } + return subAgencyList; + } + + } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml index 6b7afa1455..2f9ea62ff0 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml @@ -156,4 +156,15 @@ WHERE a.ID = #{agencyId} + + \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml index c82576b64b..cbced7f6d6 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml +++ b/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} + + \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffAgencyDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffAgencyDao.xml index cd4f40f9fb..21d9cf139c 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffAgencyDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffAgencyDao.xml @@ -105,4 +105,16 @@ AND agency_id =#{agencyId} + + \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffGridDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffGridDao.xml index 1e6501c6bb..7f1a8d3220 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffGridDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffGridDao.xml @@ -77,6 +77,17 @@ + + insert into customer_staff_grid diff --git a/epmet-module/gov-voice/gov-voice-server/pom.xml b/epmet-module/gov-voice/gov-voice-server/pom.xml index aee9221446..f5f6490001 100644 --- a/epmet-module/gov-voice/gov-voice-server/pom.xml +++ b/epmet-module/gov-voice/gov-voice-server/pom.xml @@ -55,6 +55,12 @@ feign-httpclient 10.3.0 + + com.epmet + gov-org-client + 2.0.0 + compile + diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java index e1f69c6a2e..ed34ef585d 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java +++ b/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 agencyGridList(@LoginUser TokenDto tokenDTO) { + return new Result().ok(articleService.agencyGridList(tokenDTO)); + } + } \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java index ce2f27cfbc..10d6d9adb9 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java +++ b/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 { * @date 2020-06-02 */ void delete(String[] ids); + + /** + * @param tokenDTO + * @return + * @Author sun + * @Description 党建声音-政府端-可选发布范围 + **/ + ArticleGridResultDTO agencyGridList(TokenDto tokenDTO); } \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java index 682df1669e..f1ea163a90 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java +++ b/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 page(Map params) { @@ -101,4 +108,16 @@ public class ArticleServiceImpl extends BaseServiceImpl result = govOrgSelfFeignClient.getAgencyGridList(tokenDTO.getUserId()); + return result.getData(); + } + } \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CustomerStaffRoleListFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CustomerStaffRoleListFormDTO.java new file mode 100644 index 0000000000..050dc62091 --- /dev/null +++ b/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; + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CustomerStaffRoleListResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CustomerStaffRoleListResultDTO.java new file mode 100644 index 0000000000..66b843e924 --- /dev/null +++ b/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; + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserSelfFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserSelfFeignClient.java new file mode 100644 index 0000000000..1a944da826 --- /dev/null +++ b/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> getCustomerStaffRoleList(CustomerStaffRoleListFormDTO formDTO); + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserSelfFeignClientFallBack.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserSelfFeignClientFallBack.java new file mode 100644 index 0000000000..4f14d7eac4 --- /dev/null +++ b/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> getCustomerStaffRoleList(CustomerStaffRoleListFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustomerStaffRoleList", formDTO); + } +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java index 7b9424076f..5e86a9a74c 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java +++ b/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().ok(role); } + + /** + * @Description 根据客户Id和staffId查询一个员工在指定客户下的角色列表 + * @Author sun + **/ + @PostMapping("getcustomerstaffrolelist") + public Result> getCustomerStaffRoleList(@RequestBody CustomerStaffRoleListFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return new Result>().ok(staffRoleService.getCustomerStaffRoleList(formDTO)); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java index c7e1be6e9c..c376850ac1 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java +++ b/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 { * @Description 根据staffId集合查询人员拥有的所有角色信息 **/ List selectStaffRoleList(@Param("staffIdList") List staffIdList); + + /** + * @Description 根据客户Id和staffId查询一个员工在指定客户下的角色列表 + * @Author sun + **/ + List selectCustomerStaffRoleList(CustomerStaffRoleListFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java index 04dfb2d94f..d8de0777d0 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java +++ b/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 { * @date 2020.04.29 23:44 **/ Result> getSpecificRolesStaffs(RolesUsersListFormDTO rolesUsersListFormDTO); + + /** + * @Description 根据客户Id和staffId查询一个员工在指定客户下的角色列表 + * @Author sun + **/ + List getCustomerStaffRoleList(CustomerStaffRoleListFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java index a38188f700..07181e174e 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java +++ b/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>().ok(new ArrayList<>()); } + /** + * @Description 根据客户Id和staffId查询一个员工在指定客户下的角色列表 + * @Author sun + **/ + @Override + public List getCustomerStaffRoleList(CustomerStaffRoleListFormDTO formDTO) { + return baseDao.selectCustomerStaffRoleList(formDTO); + } + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml index 1f570a073d..a90bdc4938 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml @@ -119,4 +119,27 @@ sr.staff_id = #{staffId} + \ No newline at end of file