From 81c480b33e5cc9cc20d2ebece6d81a3e7ef67f3b Mon Sep 17 00:00:00 2001 From: jishenghua <752718920@qq.com> Date: Mon, 7 Apr 2025 21:37:40 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=99excel=E5=AF=BC=E5=87=BA=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=8D=95=E6=AC=A11=E4=B8=87=E6=9D=A1=E7=9A=84?= =?UTF-8?q?=E9=99=90=E5=88=B6=EF=BC=8C=E9=98=B2=E6=AD=A2=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E5=8D=95=E6=AC=A1=E6=B6=88=E8=80=97=E5=A4=AA=E5=A4=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/jsh/erp/constants/ExceptionConstants.java | 3 +++ .../src/main/java/com/jsh/erp/service/MaterialService.java | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/jshERP-boot/src/main/java/com/jsh/erp/constants/ExceptionConstants.java b/jshERP-boot/src/main/java/com/jsh/erp/constants/ExceptionConstants.java index e6f82672..5490190b 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/constants/ExceptionConstants.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/constants/ExceptionConstants.java @@ -353,6 +353,9 @@ public class ExceptionConstants { //EXCEL中有副条码在系统中已存在(除自身商品之外) public static final int MATERIAL_EXCEL_IMPORT_MANY_BARCODE_EXIST_CODE = 80000028; public static final String MATERIAL_EXCEL_IMPORT_MANY_BARCODE_EXIST_MSG = "抱歉,EXCEL中有副条码在系统中已存在,具体副条码为:%s"; + //单次导出条数超出限制(1万条) + public static final int MATERIAL_EXPORT_LIMIT_CODE = 8000029; + public static final String MATERIAL_EXPORT_LIMIT_MSG = "单次导出条数超出限制(1万条)"; /** * 单据信息 diff --git a/jshERP-boot/src/main/java/com/jsh/erp/service/MaterialService.java b/jshERP-boot/src/main/java/com/jsh/erp/service/MaterialService.java index 444c8a81..2cfedd96 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/service/MaterialService.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/service/MaterialService.java @@ -73,6 +73,8 @@ public class MaterialService { @Value(value="${file.uploadType}") private Long fileUploadType; + private static final Integer EXPORT_LIMIT = 10000; + public Material getMaterial(long id)throws Exception { Material result=null; try{ @@ -472,6 +474,10 @@ public class MaterialService { //查询商品主条码相关列表 List dataList = materialMapperEx.exportExcel(materialParam, color, materialOther, weight, expiryNum, enabled, enableSerialNumber, enableBatchNumber, remark, idList); + if (null != dataList && dataList.size() > EXPORT_LIMIT) { + throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_EXPORT_LIMIT_CODE, + ExceptionConstants.MATERIAL_EXPORT_LIMIT_MSG); + } //查询商品副条码相关列表 Map otherMaterialMap = new HashMap<>(); List otherDataList = materialMapperEx.getOtherMaterialList();