From e7278a2ef8b346288f099510b79e6da7181d98a3 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Fri, 27 Aug 2021 11:58:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A5=E5=8F=82=E6=B7=BB=E5=8A=A0=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E5=8C=85=E6=8B=AC=E6=9C=AC=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/epmetuser/form/RoleListFormDTO.java | 29 +++++++++++++++++++ .../dto/epmetuser/form/RoleUsersFormDTO.java | 9 ++++++ .../dto/govorg/form/ReceiversFormDTO.java | 4 ++- .../dto/govorg/form/SubOrgFormDTO.java | 9 ++++++ .../controller/EpmetUserController.java | 8 +++-- .../controller/GovOrgController.java | 3 +- .../dataaggre/dao/epmetuser/StaffRoleDao.java | 4 +-- .../dao/govorg/CustomerStaffAgencyDao.java | 2 +- .../govorg/CustomerStaffDepartmentDao.java | 2 +- .../dao/govorg/CustomerStaffGridDao.java | 2 +- .../impl/EpmetMessageServiceImpl.java | 2 +- .../service/epmetuser/EpmetUserService.java | 4 +-- .../epmetuser/impl/EpmetUserServiceImpl.java | 18 ++++++++---- .../govorg/impl/GovOrgServiceImpl.java | 10 +++++-- .../mapper/epmetuser/StaffRoleDao.xml | 9 +++++- .../mapper/govorg/CustomerStaffAgencyDao.xml | 3 ++ .../govorg/CustomerStaffDepartmentDao.xml | 3 ++ .../mapper/govorg/CustomerStaffGridDao.xml | 3 ++ 18 files changed, 103 insertions(+), 21 deletions(-) create mode 100644 epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/RoleListFormDTO.java diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/RoleListFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/RoleListFormDTO.java new file mode 100644 index 0000000000..601cef4cb7 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/RoleListFormDTO.java @@ -0,0 +1,29 @@ +package com.epmet.dataaggre.dto.epmetuser.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2021/8/27 10:40 + */ +@Data +public class RoleListFormDTO implements Serializable { + private static final long serialVersionUID = -3331980620366027460L; + /** + * 客户ID + */ + private String customerId; + /** + * 是否包括我(1 是,0 否) + */ + @NotBlank(message = "是否包括我不能为空") + private String includeMe; + /** + * 用户ID + */ + private String userId; +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/RoleUsersFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/RoleUsersFormDTO.java index 5978cd7c2c..9b49994db3 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/RoleUsersFormDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/RoleUsersFormDTO.java @@ -16,4 +16,13 @@ public class RoleUsersFormDTO implements Serializable { @NotBlank(message = "角色ID不能为空") private String roleId; private String customerId; + /** + * 是否包括我(1 是,0 否) + */ + @NotBlank(message = "是否包括我不能为空") + private String includeMe; + /** + * 用户ID + */ + private String userId; } diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/ReceiversFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/ReceiversFormDTO.java index 775086e16d..24c3ebb984 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/ReceiversFormDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/ReceiversFormDTO.java @@ -16,7 +16,9 @@ public class ReceiversFormDTO implements Serializable { private String infoId; private Integer pageNo = 1; private Integer pageSize = 10; + /** + * 1: 已读,0: 未读 + */ private String readFlag; - } diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/SubOrgFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/SubOrgFormDTO.java index 1bc7ccddef..f0344698c5 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/SubOrgFormDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/SubOrgFormDTO.java @@ -15,4 +15,13 @@ public class SubOrgFormDTO implements Serializable { private static final long serialVersionUID = -3651225675593357002L; @NotBlank(message = "组织ID不能为空") private String agencyId; + /** + * 是否包括我(1 是,0 否) + */ + @NotBlank(message = "是否包括我不能为空") + private String includeMe; + /** + * 用户ID + */ + private String userId; } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java index dbe444201e..3c20f3dad8 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java @@ -229,6 +229,7 @@ public class EpmetUserController { public Result> roleUsers(@LoginUser TokenDto tokenDto, @RequestBody RoleUsersFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO); formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); return new Result>().ok(epmetUserService.getRoleUsers(formDTO)); } @@ -241,8 +242,11 @@ public class EpmetUserController { * @Date 2021/8/19 15:10 */ @PostMapping("rolelist") - public Result> roleList(@LoginUser TokenDto tokenDto) { - return new Result>().ok(epmetUserService.getRoleList(tokenDto.getCustomerId())); + public Result> roleList(@LoginUser TokenDto tokenDto, @RequestBody RoleListFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + return new Result>().ok(epmetUserService.getRoleList(formDTO)); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java index b42b8aef17..561dff2acc 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java @@ -159,8 +159,9 @@ public class GovOrgController { * @Date 2021/8/19 15:13 */ @PostMapping("suborg") - public Result subOrg(@RequestBody SubOrgFormDTO formDTO) { + public Result subOrg(@LoginUser TokenDto tokenDto, @RequestBody SubOrgFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO); + formDTO.setUserId(tokenDto.getUserId()); return new Result().ok(govOrgService.getSubOrg(formDTO)); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffRoleDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffRoleDao.java index 52b425be78..e508cb2666 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffRoleDao.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffRoleDao.java @@ -62,7 +62,7 @@ public interface StaffRoleDao extends BaseDao { * @Author zhaoqifeng * @Date 2021/8/19 17:16 */ - List getRoleCountList(@Param("customerId") String customerId); + List getRoleCountList(@Param("customerId") String customerId, @Param("userId") String userId); /** * @Description 根据角色查询人员列表 @@ -72,6 +72,6 @@ public interface StaffRoleDao extends BaseDao { * @Author zhaoqifeng * @Date 2021/8/26 16:48 */ - List selectStaffByRole(@Param("customerId") String customerId, @Param("roleId") String roleId); + List selectStaffByRole(@Param("customerId") String customerId, @Param("roleId") String roleId, @Param("userId") String userId); } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffAgencyDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffAgencyDao.java index 06869bcfdb..043d5c245d 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffAgencyDao.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffAgencyDao.java @@ -69,6 +69,6 @@ public interface CustomerStaffAgencyDao extends BaseDao selectSubAgency(@Param("agencyId") String agencyId); + List selectSubAgency(@Param("agencyId") String agencyId, @Param("userId") String userId); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffDepartmentDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffDepartmentDao.java index 014c374aca..866d3239bf 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffDepartmentDao.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffDepartmentDao.java @@ -50,5 +50,5 @@ public interface CustomerStaffDepartmentDao extends BaseDao selectDepartmentList(@Param("agencyId") String agencyId); + List selectDepartmentList(@Param("agencyId") String agencyId, @Param("userId") String userId); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffGridDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffGridDao.java index 9a4c01d8b6..2fcba2cdc4 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffGridDao.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffGridDao.java @@ -55,5 +55,5 @@ public interface CustomerStaffGridDao extends BaseDao { * @Author zhaoqifeng * @Date 2021/8/20 14:37 */ - List selectGridList(@Param("agencyId") String agencyId); + List selectGridList(@Param("agencyId") String agencyId, @Param("userId") String userId); } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetmessage/impl/EpmetMessageServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetmessage/impl/EpmetMessageServiceImpl.java index 4f7c8b3117..43f9db3b22 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetmessage/impl/EpmetMessageServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetmessage/impl/EpmetMessageServiceImpl.java @@ -63,7 +63,7 @@ public class EpmetMessageServiceImpl implements EpmetMessageService { //检索已读/未读人员列表,并分页 LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); wrapper.eq(InfoReceiversEntity :: getInfoId, formDTO.getInfoId()); - wrapper.eq(StringUtils.isNotBlank(formDTO.getReadFlag()), InfoReceiversEntity :: getReadFlag, NumConstant.ONE_STR.equals(formDTO.getReadFlag())); + wrapper.eq(StringUtils.isNotBlank(formDTO.getReadFlag()), InfoReceiversEntity :: getReadFlag, Integer.valueOf(formDTO.getReadFlag())); Page page = new Page<>(formDTO.getPageNo(), formDTO.getPageSize()); IPage iPage = infoReceiversDao.selectPage(page, wrapper); List list = iPage.getRecords(); diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java index 28820e015b..dad8570062 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java @@ -115,12 +115,12 @@ public interface EpmetUserService { /** * @Description 获取角色列表 - * @Param customerId + * @Param formDTO * @Return {@link List} * @Author zhaoqifeng * @Date 2021/8/19 15:09 */ - List getRoleList(String customerId); + List getRoleList(RoleListFormDTO formDTO); /** * desc:根据工作人员Id 获取工作人员全部信息 diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java index 21fa74fabd..9188197a25 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java @@ -474,7 +474,11 @@ public class EpmetUserServiceImpl implements EpmetUserService { */ @Override public List getRoleUsers(RoleUsersFormDTO formDTO) { - List staffRoleList = staffRoleDao.selectStaffByRole(formDTO.getCustomerId(), formDTO.getRoleId()); + String userId = null; + if (NumConstant.ZERO_STR.equals(formDTO.getIncludeMe())) { + userId = formDTO.getUserId(); + } + List staffRoleList = staffRoleDao.selectStaffByRole(formDTO.getCustomerId(), formDTO.getRoleId(), userId); if (CollectionUtils.isEmpty(staffRoleList)) { return Collections.emptyList(); } @@ -496,7 +500,7 @@ public class EpmetUserServiceImpl implements EpmetUserService { } /** - * @param customerId + * @param formDTO * @Description 获取角色列表 * @Param customerId * @Return {@link List} @@ -504,14 +508,18 @@ public class EpmetUserServiceImpl implements EpmetUserService { * @Date 2021/8/19 15:09 */ @Override - public List getRoleList(String customerId) { + public List getRoleList(RoleListFormDTO formDTO) { //获取角色列表 LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(GovStaffRoleEntity :: getCustomerId, customerId); + wrapper.eq(GovStaffRoleEntity :: getCustomerId, formDTO.getCustomerId()); wrapper.orderByAsc(GovStaffRoleEntity ::getSort); List list = govStaffRoleDao.selectList(wrapper); //获取角色人数 - List countList = staffRoleDao.getRoleCountList(customerId); + String userId = null; + if (NumConstant.ZERO_STR.equals(formDTO.getIncludeMe())) { + userId = formDTO.getUserId(); + } + List countList = staffRoleDao.getRoleCountList(formDTO.getCustomerId(), userId); Map map = new HashMap<>(); if (CollectionUtils.isNotEmpty(countList)) { map = countList.stream().collect(Collectors.toMap(RoleListResultDTO :: getRoleId, RoleListResultDTO :: getStaffNum)); diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java index 3def866d1e..745e68e804 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java @@ -446,12 +446,16 @@ public class GovOrgServiceImpl implements GovOrgService { */ @Override public SubOrgResultDTO getSubOrg(SubOrgFormDTO formDTO) { + String userId = null; + if (NumConstant.ZERO_STR.equals(formDTO.getIncludeMe())) { + userId = formDTO.getUserId(); + } //下级组织列表 - List subAgencyList = customerStaffAgencyDao.selectSubAgency(formDTO.getAgencyId()); + List subAgencyList = customerStaffAgencyDao.selectSubAgency(formDTO.getAgencyId(), userId); //下级部门列表 - List departmentList = customerStaffDepartmentDao.selectDepartmentList(formDTO.getAgencyId()); + List departmentList = customerStaffDepartmentDao.selectDepartmentList(formDTO.getAgencyId(), userId); //下级网格列表 - List gridList = customerStaffGridDao.selectGridList(formDTO.getAgencyId()); + List gridList = customerStaffGridDao.selectGridList(formDTO.getAgencyId(), userId); SubOrgResultDTO result = new SubOrgResultDTO(); result.setSubAgencyList(subAgencyList); result.setDepartmentList(departmentList); diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffRoleDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffRoleDao.xml index 8d1ac0c2d2..cbe39ede21 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffRoleDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffRoleDao.xml @@ -66,7 +66,11 @@ FROM staff_role WHERE - CUSTOMER_ID = #{customerId} + DEL_FLAG = '0' + AND CUSTOMER_ID = #{customerId} + + AND STAFF_ID != #{userId} + GROUP BY ROLE_ID @@ -85,5 +89,8 @@ AND a.CUSTOMER_ID = #{customerId} AND b.CUSTOMER_ID = #{customerId} AND b.ROLE_ID = #{roleId} + + AND b.STAFF_ID != #{userId} + \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffAgencyDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffAgencyDao.xml index e41789ecf6..65afdbabdd 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffAgencyDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffAgencyDao.xml @@ -108,6 +108,9 @@ AND b.DEL_FLAG = '0' WHERE a.DEL_FLAG = '0' + + AND b.USER_ID != #{userId} + ) csa ON csa.PIDS LIKE CONCAT( '%', ca.ID, '%' ) WHERE ca.DEL_FLAG = '0' diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffDepartmentDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffDepartmentDao.xml index 3d217ce65e..d2fdcb467c 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffDepartmentDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffDepartmentDao.xml @@ -25,6 +25,9 @@ customer_department cd LEFT JOIN customer_staff_department csd ON cd.ID = csd.DEPARTMENT_ID AND csd.DEL_FLAG = '0' + + AND csd.USER_ID != #{userId} + WHERE cd.DEL_FLAG = '0' AND cd.AGENCY_ID = #{agencyId} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffGridDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffGridDao.xml index 1534bf1fab..d7bfb5ff40 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffGridDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffGridDao.xml @@ -45,6 +45,9 @@ customer_grid cg LEFT JOIN customer_staff_grid csg ON cg.ID = csg.GRID_ID AND csg.DEL_FLAG = '0' + + AND csg.USER_ID != #{userId} + WHERE cg.DEL_FLAG = 0 AND cg.PID = #{agencyId}