class DefaultAuthorizationSettingService extends GenericReactiveCrudService<AuthorizationSettingEntity, String> {

    @Autowired
    private ApplicationEventPublisher eventPublisher;

    @Autowired
    private List<DimensionProvider> providers;

    protected AuthorizationSettingEntity generateId(AuthorizationSettingEntity entity) {
        if (StringUtils.isEmpty(entity.getId())) {
            entity.setId(DigestUtils.md5Hex(entity.getPermission() + entity.getDimensionType() + entity.getDimensionTarget()));
        }
        return entity;
    }

    @Override
    public Mono<SaveResult> save(AuthorizationSettingEntity data) {
        generateId(data);
        return super.save(data);
    }

    @Override
    public Mono<SaveResult> save(Collection<AuthorizationSettingEntity> collection) {
        collection.forEach(this::generateId);
        return super.save(collection);
    }

    @Override
    public Mono<SaveResult> save(Publisher<AuthorizationSettingEntity> entityPublisher) {
        return Flux.from(entityPublisher)
                   .map(this::generateId)
                   .as(super::save);
    }

    @Override
    public Mono<Integer> insert(Publisher<AuthorizationSettingEntity> entityPublisher) {

        return Flux.from(entityPublisher)
                   .map(this::generateId)
                   .as(super::insert);
    }

    @Override
    public Mono<Integer> insertBatch(Publisher<? extends Collection<AuthorizationSettingEntity>> entityPublisher) {
        return Flux
                .from(entityPublisher)
                .doOnNext(list -> list.forEach(this::generateId))
                .as(super::insertBatch);
    }

    protected Mono<Void> clearUserAuthCache(List<AuthorizationSettingEntity> settings) {<FILL_FUNCTION_BODY>}

    @EventListener
    public void handleAuthSettingDeleted(EntityDeletedEvent<AuthorizationSettingEntity> event) {
        event.async(
                clearUserAuthCache(event.getEntity())
        );
    }

    @EventListener
    public void handleAuthSettingChanged(EntityModifyEvent<AuthorizationSettingEntity> event) {
        event.async(
                clearUserAuthCache(event.getAfter())
        );
    }

    @EventListener
    public void handleAuthSettingSaved(EntitySavedEvent<AuthorizationSettingEntity> event) {
        event.async(
                clearUserAuthCache(event.getEntity())
        );
    }

    @EventListener
    public void handleAuthSettingAdded(EntityCreatedEvent<AuthorizationSettingEntity> event) {
        event.async(
                clearUserAuthCache(event.getEntity())
        );
    }

    @EventListener
    public void handleDimensionAdd(DimensionDeletedEvent event) {
        event.async(
                createDelete()
                        .where(AuthorizationSettingEntity::getDimensionType, event.getDimensionType())
                        .and(AuthorizationSettingEntity::getDimensionTarget, event.getDimensionId())
                        .execute()
        );
    }

    @EventListener
    public void handleDimensionDeletedEvent(DimensionDeletedEvent event) {
        event.async(
                createDelete()
                        .where(AuthorizationSettingEntity::getDimensionType, event.getDimensionType())
                        .and(AuthorizationSettingEntity::getDimensionTarget, event.getDimensionId())
                        .execute()
        );
    }
}

        return Flux
                .fromIterable(providers)
                .flatMap(provider ->
                                 //按维度类型进行映射
                                 provider.getAllType()
                                         .map(DimensionType::getId)
                                         .map(t -> Tuples.of(t, provider)))
                .collectMap(Tuple2::getT1, Tuple2::getT2)
                .flatMapMany(typeProviderMapping -> Flux
                        .fromIterable(settings)//根据维度获取所有userId
                        .flatMap(setting -> Mono
                                .justOrEmpty(typeProviderMapping.get(setting.getDimensionType()))
                                .flatMapMany(provider -> provider.getUserIdByDimensionId(setting.getDimensionTarget()))))
                .collectList()
                .flatMap(lst-> ClearUserAuthorizationCacheEvent.of(lst).publish(eventPublisher))
                .then();
    
<methods>public non-sealed void <init>() ,public ReactiveRepository<org.hswebframework.web.system.authorization.api.entity.AuthorizationSettingEntity,java.lang.String> getRepository() <variables>private ReactiveRepository<org.hswebframework.web.system.authorization.api.entity.AuthorizationSettingEntity,java.lang.String> repository