Browse Source

1.运营端添加客户,为客户设置管理员,此时设置的是root_manager跟管理员

2.工作端为工作人员配置角色时,不显示root_manager根管理员
dev
wxz 5 years ago
parent
commit
db5907c478
  1. 2
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java
  2. 3
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java
  3. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/constant/RoleKeyConstants.java
  4. 20
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java
  5. 1
      epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.4__add_rootmanager.sql
  6. 10
      epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml

2
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
*/

3
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<CustomerDao, CustomerEn
// 查询客户具有指定RoleKey的角色信息
CustomerRoleFormDTO customerRoleForm = new CustomerRoleFormDTO();
customerRoleForm.setCustomerId(form.getCustomerId());
customerRoleForm.setRoleKey(RoleKeyConstants.ROLE_KEY_MANAGER);
// customerRoleForm.setRoleKey(RoleKeyConstants.ROLE_KEY_MANAGER);
customerRoleForm.setRoleKey(RoleKeyConstants.ROLE_KEY_ROOT_MANAGER);
Result<GovStaffRoleDTO> getRoleResult = epmetUserFeignClient.getRoleOfCustomer(customerRoleForm);
if (!getRoleResult.success()) {
log.error("查询客户具有指定RoleKey的角色信息失败:".concat(getRoleResult.toString()));

5
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";
/**
* 党建负责人
*/

20
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<CustomerStaffDao,
List<GovStaffRoleDTO> roleList = govStaffRoleService.getGovStaffRoleList(govStaffRoleDTO);
//获取工作人员角色
List<GovStaffRoleEntity> staffRoles = govStaffRoleService.listRolesByStaffId(fromDTO.getStaffId(), fromDTO.getAgencyId());
List<StaffRoleResultDTO> 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<StaffRoleResultDTO> 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())) {

1
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());

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

@ -17,11 +17,11 @@
</resultMap>
<update id="delStaffRoles" parameterType="com.epmet.dto.StaffRoleDTO">
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'
</update>

Loading…
Cancel
Save