| 
						
						
							
								
							
						
						
					 | 
					@ -213,6 +213,7 @@ public class AccessConfigServiceImpl implements AccessConfigService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    */ | 
					 | 
					 | 
					    */ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Override | 
					 | 
					 | 
					    @Override | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    public void addOpeAndScopes4Role(String roleKey, String operationKey, List<String> scopeKeys) { | 
					 | 
					 | 
					    public void addOpeAndScopes4Role(String roleKey, String operationKey, List<String> scopeKeys) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        // 所有客户下该角色的列表
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        Result<List<GovStaffRoleResultDTO>> rolesResult = epmetUserOpenFeignClient.listRolesByRoleKey(roleKey); | 
					 | 
					 | 
					        Result<List<GovStaffRoleResultDTO>> rolesResult = epmetUserOpenFeignClient.listRolesByRoleKey(roleKey); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        if (!rolesResult.success()) { | 
					 | 
					 | 
					        if (!rolesResult.success()) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            String msg = "调用user服务,根据key查询角色列表失败"; | 
					 | 
					 | 
					            String msg = "调用user服务,根据key查询角色列表失败"; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -220,39 +221,41 @@ public class AccessConfigServiceImpl implements AccessConfigService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    RenException.MessageMode.CODE_INTERNAL_EXTERNAL.CODE_INTERNAL_EXTERNAL); | 
					 | 
					 | 
					                    RenException.MessageMode.CODE_INTERNAL_EXTERNAL.CODE_INTERNAL_EXTERNAL); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        List<GovStaffRoleResultDTO> roles = rolesResult.getData(); | 
					 | 
					 | 
					        List<GovStaffRoleResultDTO> rolesOfAllCustomer = rolesResult.getData(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        List<String> roleIds2Add = roles.stream().map(GovStaffRoleResultDTO::getRoleId).collect(Collectors.toList()); | 
					 | 
					 | 
					        addOpeAndScopes4Role(rolesOfAllCustomer, operationKey, scopeKeys); | 
				
			
			
				
				
			
		
	
		
		
			
				
					 | 
					 | 
					        addOpeAndScopes4Role(roleIds2Add, operationKey, scopeKeys); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    /** | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @Description 将默认的角色操作和范围同步给具体的角色 | 
					 | 
					 | 
					     * @Description 将默认的角色操作和范围同步给具体的角色 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @param rolesOfAllCustomer 所有客户的该角色的列表 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @return | 
					 | 
					 | 
					     * @return | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @author wxz | 
					 | 
					 | 
					     * @author wxz | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @date 2020.11.17 17:38 | 
					 | 
					 | 
					     * @date 2020.11.17 17:38 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    */ | 
					 | 
					 | 
					    */ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Transactional(rollbackFor = Exception.class) | 
					 | 
					 | 
					    @Transactional(rollbackFor = Exception.class) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					    public void addOpeAndScopes4Role(List<String> roleIds, String operationKey, List<String> scopeKeys) { | 
					 | 
					 | 
					    public void addOpeAndScopes4Role(List<GovStaffRoleResultDTO> rolesOfAllCustomer, String operationKey, List<String> scopeKeys) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        for (String roleId : roleIds) { | 
					 | 
					 | 
					        for (GovStaffRoleResultDTO role : rolesOfAllCustomer) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            // 只给没有添加该权限的用户赋予该权限,已经添加了和添加了又取消的不操作
 | 
					 | 
					 | 
					            // 只给没有添加该权限的用户赋予该权限,已经添加了和添加了又取消的不操作
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            RoleOperationEntity roleOpe = roleOperationDao.getRoleOpe(roleId, operationKey); | 
					 | 
					 | 
					            RoleOperationEntity roleOpe = roleOperationDao.getRoleOpe(role.getRoleId(), operationKey); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            boolean needRefreshCache = false; | 
					 | 
					 | 
					            boolean needRefreshCache = false; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            if (roleOpe == null) { | 
					 | 
					 | 
					            if (roleOpe == null) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                // 没有该操作,则添加
 | 
					 | 
					 | 
					                // 没有该操作,则添加
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                RoleOperationEntity roleOperation = new RoleOperationEntity(); | 
					 | 
					 | 
					                RoleOperationEntity roleOperation = new RoleOperationEntity(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                roleOperation.setOperationKey(operationKey); | 
					 | 
					 | 
					                roleOperation.setOperationKey(operationKey); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                roleOperation.setRoleId(roleId); | 
					 | 
					 | 
					                roleOperation.setRoleId(role.getRoleId()); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                roleOperation.setCustomerId(role.getCustomerId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                roleOperationDao.insert(roleOperation); | 
					 | 
					 | 
					                roleOperationDao.insert(roleOperation); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                needRefreshCache = true; | 
					 | 
					 | 
					                needRefreshCache = true; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            } | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            for (String scopeKey : scopeKeys) { | 
					 | 
					 | 
					            for (String scopeKey : scopeKeys) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                // 没有的话则添加
 | 
					 | 
					 | 
					                // 没有的话则添加
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                RoleScopeEntity roleScopeInDb = roleScopeDao.getByRoleIdAndOpeKey(roleId, operationKey, scopeKey); | 
					 | 
					 | 
					                RoleScopeEntity roleScopeInDb = roleScopeDao.getByRoleIdAndOpeKey(role.getRoleId(), operationKey, scopeKey); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                if (roleScopeInDb == null) { | 
					 | 
					 | 
					                if (roleScopeInDb == null) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    RoleScopeEntity roleScopeEntity = new RoleScopeEntity(); | 
					 | 
					 | 
					                    RoleScopeEntity roleScopeEntity = new RoleScopeEntity(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    roleScopeEntity.setOperationKey(operationKey); | 
					 | 
					 | 
					                    roleScopeEntity.setOperationKey(operationKey); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                    roleScopeEntity.setRoleId(roleId); | 
					 | 
					 | 
					                    roleScopeEntity.setRoleId(role.getRoleId()); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                    roleScopeEntity.setScopeKey(scopeKey); | 
					 | 
					 | 
					                    roleScopeEntity.setScopeKey(scopeKey); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    roleScopeEntity.setCustomerId(role.getCustomerId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    roleScopeDao.insert(roleScopeEntity); | 
					 | 
					 | 
					                    roleScopeDao.insert(roleScopeEntity); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    needRefreshCache = true; | 
					 | 
					 | 
					                    needRefreshCache = true; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                } | 
					 | 
					 | 
					                } | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -260,7 +263,7 @@ public class AccessConfigServiceImpl implements AccessConfigService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            // 清空角色的权限缓存
 | 
					 | 
					 | 
					            // 清空角色的权限缓存
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            if (needRefreshCache) { | 
					 | 
					 | 
					            if (needRefreshCache) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                roleOpeScopeRedis.delRoleAllOpeScopes(roleId); | 
					 | 
					 | 
					                roleOpeScopeRedis.delRoleAllOpeScopes(role.getRoleId()); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            } | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  |