From b6da810145afa2eee428a71e991312a4968c3946 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Thu, 18 Aug 2022 16:37:21 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E3=80=90=E6=8A=A5=E8=A1=A8=E3=80=91?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89excel=E6=89=B9=E9=87=8F=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E5=8E=BB=E6=8E=89@NoRepeatSubmit=E6=B3=A8=E8=A7=A3?= =?UTF-8?q?=EF=BC=8C=E8=A7=A3=E5=86=B3=E6=89=B9=E9=87=8F=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/controller/IcResiUserController.java | 1 - 1 file changed, 1 deletion(-) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java index 40e661a63b..c574eb3dcd 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java @@ -559,7 +559,6 @@ public class IcResiUserController implements ResultDataResolver { * @remark 用于报表调用的接口 试试 */ @ReportRequest - @NoRepeatSubmit @RequestMapping(value = "/exportExcelCustomData") public Map exportExcelCustomData(@LoginUser TokenDto tokenDto, @RequestParam("templateId") String templateId, @RequestBody ExportResiUserFormDTO pageFormDTO) throws Exception { From 0dfe9fb8b3113def4fbc392550b20034ea5339aa Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Thu, 18 Aug 2022 16:40:05 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E3=80=90=E6=8A=A5=E8=A1=A8=E3=80=91?= =?UTF-8?q?=E5=8F=88=E8=A6=81=E7=94=A8=E5=A4=9A=E7=BA=BF=E7=A8=8B=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/IcCustomerReportServiceImpl.java | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java index 4f6277d886..f9a1707342 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java @@ -55,6 +55,8 @@ import java.nio.file.Path; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutorService; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -390,21 +392,20 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl> idParts = ListUtils.partition(idList, 100); // 1. 循环下载所有id对应的excel(积木报表的导出接口有并发问题,多线程会导出空表,暂时不用多线程了) - //CountDownLatch cdl = new CountDownLatch(idParts.size()); + CountDownLatch cdl = new CountDownLatch(idParts.size()); for (List idPart : idParts) { - downloadXlsByBatchByBizId(reportId, idPart, idAndNames, param, xlsxStorePath, files); - //CompletableFuture.runAsync(() -> { - // downloadXlsByBatchByBizId(reportId, idPart, idAndNames, param, xlsxStorePath, files, cdl); - //}, executorService); + CompletableFuture.runAsync(() -> { + downloadXlsByBatchByBizId(reportId, idPart, param, xlsxStorePath, files, cdl); + }, executorService); } // 等待多线程执行完成,再执行打包 - //try { - // cdl.await(); - //} catch (InterruptedException e) { - // log.error(ExceptionUtils.getErrorStackTrace(e)); - // throw new EpmetException("【报表批量导出】CountDownLatch等待被中断"); - //} + try { + cdl.await(); + } catch (InterruptedException e) { + log.error(ExceptionUtils.getErrorStackTrace(e)); + throw new EpmetException("【报表批量导出】CountDownLatch等待被中断"); + } // 2,打包 Path zipFile = storePath.resolve(reportName + "_" + currentTimeStr + ".zip"); @@ -472,7 +473,8 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl bizIds, Map idAndNames, JimuReportExportRequestDTO param, Path xlsxStorePath, Map files) { + public void downloadXlsByBatchByBizId(String reportId, List bizIds, JimuReportExportRequestDTO param, + Path xlsxStorePath, Map files, CountDownLatch cdl) { for (String id : bizIds) { try { @@ -506,7 +508,7 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl Date: Thu, 18 Aug 2022 16:59:09 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E3=80=90=E6=8A=A5=E8=A1=A8=E3=80=91?= =?UTF-8?q?=E5=A4=9A=E7=BA=BF=E7=A8=8B=E5=AF=BC=E5=87=BA=E4=B8=8D=E7=9D=A1?= =?UTF-8?q?=E7=9C=A0=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/IcCustomerReportServiceImpl.java | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java index f9a1707342..2775448c20 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java @@ -476,18 +476,6 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl bizIds, JimuReportExportRequestDTO param, Path xlsxStorePath, Map files, CountDownLatch cdl) { for (String id : bizIds) { - - try { - Thread.sleep(200l); - } catch (InterruptedException e) { - final String errorMsg = ExceptionUtils.getErrorStackTrace(e); - log.error("【报表批量导出】循环导出-请求jmreport,等待过程中睡眠发生意外:{}", errorMsg); - } - - //if (!Arrays.asList("1501821697823608834","1501821694665297922","1501821695114088450","1501821695177003009","1501821695269277697","1501821695344775169","1501821695579656193","1501821695676125186","1501821695755816962","1501821695843897346","1501821695978115074","1501821696108138497","1501821696179441665","1501821696229773313","1501821696284299266","1501821696334630913","1501821696393351170","1501821696452071426","1501821696502403073","1501821696582094849","1501821696645009409","1501821696758255617","1501821696871501826","1501821696917639169","1501821696955387906","1501821696993136641","1501821697135742977","1501821697181880321","1501821697232211969","1501821697274155009").contains(id)) { - // continue; - //} - param.getQueryParam().setId(id); final Response response = jiMuReportOpenFeignClient.exportAllExcelStream(param); // 取出文件后缀