From 3faa961f37997fda1d93fdf90b06b79d5eeace6b Mon Sep 17 00:00:00 2001 From: aike <17730485278@139.com> Date: Fri, 7 Nov 2025 15:29:34 +0800 Subject: [PATCH] =?UTF-8?q?demand:=20=20=20=20TMS=E7=B3=BB=E7=BB=9F=20-=20?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E8=B4=A6=E5=8D=95=E7=AE=A1=E7=90=86=20-=20?= =?UTF-8?q?=E8=B4=A2=E5=8A=A1=E5=BC=80=E7=A5=A8=E5=A4=84=E7=90=86=20-=20?= =?UTF-8?q?=E5=AE=9A=E5=88=B6=E5=AF=BC=E5=87=BA=E8=AE=BE=E7=BD=AE=E8=B6=85?= =?UTF-8?q?=E6=97=B6=E6=97=B6=E9=97=B4=20=20=20TMS=E7=B3=BB=E7=BB=9F=20-?= =?UTF-8?q?=20=E7=AD=BE=E6=94=B6=E7=AE=A1=E7=90=86=20-=20=E7=AD=BE?= =?UTF-8?q?=E6=94=B6=E5=BC=82=E5=B8=B8=E5=AF=B9=E6=AF=94-=E6=9C=AA?= =?UTF-8?q?=E7=AD=BE=E6=94=B6=E5=88=97=E8=A1=A8-=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=E6=8E=89=E8=BF=90=E8=BE=93=E6=96=B9=E5=BC=8F?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA=E8=BF=90=E4=B8=94=E6=B8=85=E5=85=B3=E6=96=B9?= =?UTF-8?q?=E5=BC=8F=E4=B8=BA=E8=87=AA=E6=B8=85=E8=87=AA=E6=8F=90=E7=9A=84?= =?UTF-8?q?=E8=BF=90=E5=8D=95=20committer:=20heyu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EmisSettleInvoiceRecordController.java | 45 +++++++++++++++++-- .../mapper/EmisTmsScanRecordMapper.xml | 2 + 2 files changed, 44 insertions(+), 3 deletions(-) diff --git a/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisSettleInvoiceRecordController.java b/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisSettleInvoiceRecordController.java index 318ab3cbc..a713815d0 100644 --- a/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisSettleInvoiceRecordController.java +++ b/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisSettleInvoiceRecordController.java @@ -13,6 +13,9 @@ package com.xdadan.erp.web.emis; import java.util.List; import java.util.UUID; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; import javax.servlet.http.HttpServletResponse; import com.xdadan.erp.emis.domain.exception.EmisBizError; @@ -113,6 +116,7 @@ public class EmisSettleInvoiceRecordController extends BaseController { /** * 定制导出开票记录表列表 + * 设置5分钟超时,超时后自动关闭 * */ @PreAuthorize("@ss.hasPermi('emis:emisSettleInvoiceRecord:customExport')") @@ -137,9 +141,44 @@ public class EmisSettleInvoiceRecordController extends BaseController { emisSettleInvoiceRecord.getParams().put("billCode", billCodeStr); } - List list = emisSettleInvoiceRecordService - .selectCustomExportList(emisSettleInvoiceRecord); - EmisSettleInvoiceRecordCustomExcelUtil.exportCustomExcel(response, list, "开票记录表定制导出数据_"+ UUID.randomUUID()); + CompletableFuture exportFuture = CompletableFuture.runAsync(() -> { + try { + List list = emisSettleInvoiceRecordService + .selectCustomExportList(emisSettleInvoiceRecord); + EmisSettleInvoiceRecordCustomExcelUtil.exportCustomExcel(response, list, + "开票记录表定制导出数据_" + UUID.randomUUID()); + } catch (Exception e) { + throw new RuntimeException("导出失败: " + e.getMessage(), e); + } + }); + + try { + // 设置5分钟超时 + exportFuture.get(5, TimeUnit.MINUTES); + } catch (TimeoutException e) { + // 超时后取消任务 + exportFuture.cancel(true); + try { + if (!response.isCommitted()) { + response.reset(); + response.setContentType("application/json;charset=utf-8"); + response.getWriter().write("{\"success\":false,\"message\":\"导出数据量过大导致超时,请缩小查询范围后重试\"}"); + } + } catch (Exception ex) { + // 忽略写入错误 + } + } catch (Exception e) { + try { + if (!response.isCommitted()) { + response.reset(); + response.setContentType("application/json;charset=utf-8"); + String errorMsg = e.getCause() != null ? e.getCause().getMessage() : e.getMessage(); + response.getWriter().write("{\"success\":false,\"message\":\"导出失败: " + errorMsg + "\"}"); + } + } catch (Exception ex) { + // 忽略写入错误 + } + } } /** diff --git a/emis-biz/src/main/resources/mapper/EmisTmsScanRecordMapper.xml b/emis-biz/src/main/resources/mapper/EmisTmsScanRecordMapper.xml index 5aaeed49d..ac7d31045 100644 --- a/emis-biz/src/main/resources/mapper/EmisTmsScanRecordMapper.xml +++ b/emis-biz/src/main/resources/mapper/EmisTmsScanRecordMapper.xml @@ -208,11 +208,13 @@ a.scan_man_code FROM emis_tms_scan_record a ,emis_waybill b + LEFT JOIN emis_trans_line k ON b.trans_line_type = k.line_code AND k.del_flag = '0' WHERE a.del_flag = '0' and b.del_flag='0' and a.bill_code = b.bill_code and b.bl_sign = '0' and b.bill_code NOT IN ( SELECT bill_code FROM emis_waybill_problem_info ewpi WHERE ewpi.del_flag = '0' AND ewpi.`problem_type` IN ( 151, 173, 170 ) ) + and NOT (b.customs_clear = 2 AND k.trans_type = 2) and a.scan_site_code=#{scanSiteCode} and a.scan_type=#{scanType}