private void multThreadDownloadPdf(List<EleInvVo> exportList, final ConcurrentLinkedQueue<String> queue,
final CountDownLatch latch) {
ExecutorService threadPool = Executors.newFixedThreadPool(5);
for (final EleInvVo eleInvVo : exportList) {
threadPool.execute(new Runnable() {
@Override
public void run() {
try {
if (!CheckUtil.isNull(eleInvVo.getPdfStorageKey())) {
String pdfPath = WebUtil.getRelativeFilePath(
eleInvVo.getOrderNo() + "_" + eleInvVo.getInvoiceNo() + "_" + RandomStringUtils.randomAlphanumeric(10) + ".pdf");
jCloudService.getStorageObject(eleInvVo.getPdfStorageKey())
.toFile(new File(pdfPath));
queue.offer(pdfPath);
}
} catch (Exception e) {
logger.error("线程下载pdf异常,订单号【{}】,异常信息:{}",eleInvVo.getOrderNo(), e);
} finally {
latch.countDown();
}
}
});
}
threadPool.shutdown();
}