@Autowired
private AsyncTaskExecutor taskPool;
//通过线程池执行批量保存的功能
newLinks.stream().filter(newLink -> {
return (MpmStringUtil.isNotEmpty(newLink.getFormBizId()) && MpmStringUtil.isNotEmpty(newLink.getToBizId()));
}).forEach(newLink -> taskPool.execute(() -> {
String oldId = newLink.getId();
newLink.setId(null);
save(newLink);
// 复制软属性
repFileTypeService.copyAttributeValues(oldId, newLink.getId());
}));
异步线程池在开发中的使用
最新推荐文章于 2024-08-11 20:00:32 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)