From db5907c478534ca235b4a597f9ae5c4104a8c119 Mon Sep 17 00:00:00 2001 From: wxz Date: Thu, 23 Jul 2020 13:36:14 +0800 Subject: [PATCH] =?UTF-8?q?1.=E8=BF=90=E8=90=A5=E7=AB=AF=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=EF=BC=8C=E4=B8=BA=E5=AE=A2=E6=88=B7=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E7=AE=A1=E7=90=86=E5=91=98=EF=BC=8C=E6=AD=A4=E6=97=B6?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E7=9A=84=E6=98=AFroot=5Fmanager=E8=B7=9F?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=202.=E5=B7=A5=E4=BD=9C=E7=AB=AF?= =?UTF-8?q?=E4=B8=BA=E5=B7=A5=E4=BD=9C=E4=BA=BA=E5=91=98=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E8=A7=92=E8=89=B2=E6=97=B6=EF=BC=8C=E4=B8=8D=E6=98=BE=E7=A4=BA?= =?UTF-8?q?root=5Fmanager=E6=A0=B9=E7=AE=A1=E7=90=86=E5=91=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/controller/CustomerController.java | 2 +- .../service/impl/CustomerServiceImpl.java | 3 ++- .../com/epmet/constant/RoleKeyConstants.java | 5 +++++ .../impl/CustomerStaffServiceImpl.java | 20 +++++++++++-------- .../db/migration/V0.0.4__add_rootmanager.sql | 1 + .../main/resources/mapper/StaffRoleDao.xml | 10 +++++----- 6 files changed, 26 insertions(+), 15 deletions(-) create mode 100644 epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.4__add_rootmanager.sql diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java index c8c17dcfad..508f0ba09b 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java @@ -197,7 +197,7 @@ public class CustomerController { /** * - * 添加管理员 + * 添加根管理员(不能被取消角色的管理员) * @param form * @return */ diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java index 2dc57cd47f..ecafef1a96 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java @@ -250,7 +250,8 @@ public class CustomerServiceImpl extends BaseServiceImpl getRoleResult = epmetUserFeignClient.getRoleOfCustomer(customerRoleForm); if (!getRoleResult.success()) { log.error("查询客户具有指定RoleKey的角色信息失败:".concat(getRoleResult.toString())); diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/RoleKeyConstants.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/RoleKeyConstants.java index 4d82df0d1f..3a8361be2c 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/RoleKeyConstants.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/RoleKeyConstants.java @@ -9,6 +9,11 @@ public class RoleKeyConstants { */ public static final String ROLE_KEY_MANAGER = "manager"; + /** + * 根管理员(不能通过工作端取消的角色,且不会再工作端显示) + */ + public static final String ROLE_KEY_ROOT_MANAGER = "root_manager"; + /** * 党建负责人 */ diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java index a0f3aab8e2..09760dac92 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java @@ -31,6 +31,7 @@ import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.CpUserDetailRedis; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.CustomerStaffConstant; +import com.epmet.constant.RoleKeyConstants; import com.epmet.constant.UserConstant; import com.epmet.constant.UserRoleConstant; import com.epmet.dao.CustomerStaffDao; @@ -244,14 +245,17 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl roleList = govStaffRoleService.getGovStaffRoleList(govStaffRoleDTO); //获取工作人员角色 List staffRoles = govStaffRoleService.listRolesByStaffId(fromDTO.getStaffId(), fromDTO.getAgencyId()); - List staffRoleList = roleList.stream().map(p -> { - StaffRoleResultDTO staffRoleResultDTO = new StaffRoleResultDTO(); - staffRoleResultDTO.setRoleId(p.getId()); - staffRoleResultDTO.setRoleName(p.getRoleName()); - staffRoleResultDTO.setFullTimeOnly(p.getFullTimeOnly()); - staffRoleResultDTO.setSelected(false); - return staffRoleResultDTO; - }).collect(Collectors.toList()); + List staffRoleList = roleList + .stream() + .filter(p -> !RoleKeyConstants.ROLE_KEY_ROOT_MANAGER.equals(p.getRoleKey())) + .map(p -> { + StaffRoleResultDTO staffRoleResultDTO = new StaffRoleResultDTO(); + staffRoleResultDTO.setRoleId(p.getId()); + staffRoleResultDTO.setRoleName(p.getRoleName()); + staffRoleResultDTO.setFullTimeOnly(p.getFullTimeOnly()); + staffRoleResultDTO.setSelected(false); + return staffRoleResultDTO; + }).collect(Collectors.toList()); staffRoleList.forEach(role -> staffRoles.forEach(staffRole -> { if (role.getRoleId().equals(staffRole.getId())) { diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.4__add_rootmanager.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.4__add_rootmanager.sql new file mode 100644 index 0000000000..31f2f20fdb --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.4__add_rootmanager.sql @@ -0,0 +1 @@ +INSERT INTO epmet_user.gov_staff_role_template (ID, ROLE_KEY, ROLE_NAME, ORG_TYPE, FULL_TIME_ONLY, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME) VALUES (uuid(), 'root_manager', '根管理员', 'agency', 1, 0, 0, 'APP_USER', now(), 'APP_USER', now()); \ 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 94ae4b700d..e16b649d47 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 @@ -17,11 +17,11 @@ update - staff_role - set DEL_FLAG = '1' - where STAFF_ID = #{staffId} - and ORG_ID = #{orgId} - and DEL_FLAG = '0' + staff_role sr inner join gov_staff_role gsr on (sr.ROLE_ID = gsr.ID and gsr.ROLE_KEY != 'root_manager') + set sr.DEL_FLAG = '1' + where sr.STAFF_ID = #{staffId} + and sr.ORG_ID = #{orgId} + and sr.DEL_FLAG = '0'