/**
* @author YUFEI
* @Date 2022/8/10 20:04
* @Version 1.0
* 公共执行
*/
public class CommonConsumers {
public static void consumers(List<Consumer<Long>> consumers,String tenant,Long deptPk){
ThreadPoolTaskExecutor executor = SpringUtils.getBean("threadPoolTaskExecutor");
consumers.stream().map(consumer->
CompletableFuture.runAsync(()->{
ThreadLocalUtil.set(tenant);
consumer.accept(deptPk);
ThreadLocalUtil.remove();
},executor)
).map(CompletableFuture::join).collect(Collectors.toList());
}


}