增加接口调用时间,防止生成二维码线程没有生成好二维码

This commit is contained in:
wen 2022-02-18 18:30:33 +08:00
parent 9dcc3a0e1b
commit e7b6ec6db0

View File

@ -478,7 +478,7 @@ public class XhpcChargingPileServiceImpl extends BaseService implements IXhpcCha
//开启多个线程并行执行操作 //开启多个线程并行执行操作
//generate qrcode for every terminal //generate qrcode for every terminal
ThreadPoolExecutor executor = ThreadPoolExecutor executor =
new ThreadPoolExecutor(5, 40, 200, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(40)); new ThreadPoolExecutor(30, 40, 200, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(40));
for (XhpcTerminal xhpcTerminal : xhpcTerminalList) { for (XhpcTerminal xhpcTerminal : xhpcTerminalList) {
executor.execute(() -> { executor.execute(() -> {
//获取场站名称 //获取场站名称
@ -504,6 +504,11 @@ public class XhpcChargingPileServiceImpl extends BaseService implements IXhpcCha
QrImgUtils.uploadImg(xhpcTerminal, xhpcTerminal.getSerialNumber(), environment, xhpcImgMapper, chargingStationName, gunNumber, letterMap, pileNumber.toString()); QrImgUtils.uploadImg(xhpcTerminal, xhpcTerminal.getSerialNumber(), environment, xhpcImgMapper, chargingStationName, gunNumber, letterMap, pileNumber.toString());
}); });
} }
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
return AjaxResult.success(); return AjaxResult.success();
} }
} }