|
@ -31,6 +31,7 @@ import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.utils.CpUserDetailRedis; |
|
|
import com.epmet.commons.tools.utils.CpUserDetailRedis; |
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
import com.epmet.constant.CustomerStaffConstant; |
|
|
import com.epmet.constant.CustomerStaffConstant; |
|
|
|
|
|
import com.epmet.constant.RoleKeyConstants; |
|
|
import com.epmet.constant.UserConstant; |
|
|
import com.epmet.constant.UserConstant; |
|
|
import com.epmet.constant.UserRoleConstant; |
|
|
import com.epmet.constant.UserRoleConstant; |
|
|
import com.epmet.dao.CustomerStaffDao; |
|
|
import com.epmet.dao.CustomerStaffDao; |
|
@ -55,6 +56,7 @@ import org.apache.logging.log4j.Logger; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
|
import java.util.Arrays; |
|
|
import java.util.Arrays; |
|
@ -244,14 +246,17 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao, |
|
|
List<GovStaffRoleDTO> roleList = govStaffRoleService.getGovStaffRoleList(govStaffRoleDTO); |
|
|
List<GovStaffRoleDTO> roleList = govStaffRoleService.getGovStaffRoleList(govStaffRoleDTO); |
|
|
//获取工作人员角色
|
|
|
//获取工作人员角色
|
|
|
List<GovStaffRoleEntity> staffRoles = govStaffRoleService.listRolesByStaffId(fromDTO.getStaffId(), fromDTO.getAgencyId()); |
|
|
List<GovStaffRoleEntity> staffRoles = govStaffRoleService.listRolesByStaffId(fromDTO.getStaffId(), fromDTO.getAgencyId()); |
|
|
List<StaffRoleResultDTO> staffRoleList = roleList.stream().map(p -> { |
|
|
List<StaffRoleResultDTO> staffRoleList = roleList |
|
|
StaffRoleResultDTO staffRoleResultDTO = new StaffRoleResultDTO(); |
|
|
.stream() |
|
|
staffRoleResultDTO.setRoleId(p.getId()); |
|
|
.filter(p -> !RoleKeyConstants.ROLE_KEY_ROOT_MANAGER.equals(p.getRoleKey())) |
|
|
staffRoleResultDTO.setRoleName(p.getRoleName()); |
|
|
.map(p -> { |
|
|
staffRoleResultDTO.setFullTimeOnly(p.getFullTimeOnly()); |
|
|
StaffRoleResultDTO staffRoleResultDTO = new StaffRoleResultDTO(); |
|
|
staffRoleResultDTO.setSelected(false); |
|
|
staffRoleResultDTO.setRoleId(p.getId()); |
|
|
return staffRoleResultDTO; |
|
|
staffRoleResultDTO.setRoleName(p.getRoleName()); |
|
|
}).collect(Collectors.toList()); |
|
|
staffRoleResultDTO.setFullTimeOnly(p.getFullTimeOnly()); |
|
|
|
|
|
staffRoleResultDTO.setSelected(false); |
|
|
|
|
|
return staffRoleResultDTO; |
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
staffRoleList.forEach(role -> staffRoles.forEach(staffRole -> { |
|
|
staffRoleList.forEach(role -> staffRoles.forEach(staffRole -> { |
|
|
if (role.getRoleId().equals(staffRole.getId())) { |
|
|
if (role.getRoleId().equals(staffRole.getId())) { |
|
@ -337,11 +342,18 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao, |
|
|
staffRoleService.insert(staffRoleEntity); |
|
|
staffRoleService.insert(staffRoleEntity); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// 重新查询用户的角色列表(可以取到前端没有传过来的角色,例如根管理员)
|
|
|
|
|
|
List<StaffRoleEntity> staffRoleEntytiesByStaffIdAndOrgId = staffRoleService.getStaffRoleEntytiesByStaffIdAndOrgId(fromDTO.getAgencyId(), fromDTO.getStaffId()); |
|
|
|
|
|
List<String> roleIds = new ArrayList<>(); |
|
|
|
|
|
if (!CollectionUtils.isEmpty(staffRoleEntytiesByStaffIdAndOrgId)) { |
|
|
|
|
|
roleIds = staffRoleEntytiesByStaffIdAndOrgId.stream().map(sr -> sr.getRoleId()).collect(Collectors.toList()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// redis缓存角色修改
|
|
|
// redis缓存角色修改
|
|
|
UpdateCachedRolesFormDTO updateRolesForm = new UpdateCachedRolesFormDTO(); |
|
|
UpdateCachedRolesFormDTO updateRolesForm = new UpdateCachedRolesFormDTO(); |
|
|
updateRolesForm.setOrgId(fromDTO.getAgencyId()); |
|
|
updateRolesForm.setOrgId(fromDTO.getAgencyId()); |
|
|
updateRolesForm.setStaffId(fromDTO.getStaffId()); |
|
|
updateRolesForm.setStaffId(fromDTO.getStaffId()); |
|
|
updateRolesForm.setRoleIds(fromDTO.getRoles()); |
|
|
updateRolesForm.setRoleIds(roleIds); |
|
|
try { |
|
|
try { |
|
|
Result result = authFeignClient.updateCachedRoles(updateRolesForm); |
|
|
Result result = authFeignClient.updateCachedRoles(updateRolesForm); |
|
|
if (!result.success()) { |
|
|
if (!result.success()) { |
|
|