给excel导出增加单次1万条的限制,防止资源单次消耗太大
This commit is contained in:
@@ -353,6 +353,9 @@ public class ExceptionConstants {
|
|||||||
//EXCEL中有副条码在系统中已存在(除自身商品之外)
|
//EXCEL中有副条码在系统中已存在(除自身商品之外)
|
||||||
public static final int MATERIAL_EXCEL_IMPORT_MANY_BARCODE_EXIST_CODE = 80000028;
|
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";
|
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万条)";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 单据信息
|
* 单据信息
|
||||||
|
|||||||
@@ -73,6 +73,8 @@ public class MaterialService {
|
|||||||
@Value(value="${file.uploadType}")
|
@Value(value="${file.uploadType}")
|
||||||
private Long fileUploadType;
|
private Long fileUploadType;
|
||||||
|
|
||||||
|
private static final Integer EXPORT_LIMIT = 10000;
|
||||||
|
|
||||||
public Material getMaterial(long id)throws Exception {
|
public Material getMaterial(long id)throws Exception {
|
||||||
Material result=null;
|
Material result=null;
|
||||||
try{
|
try{
|
||||||
@@ -472,6 +474,10 @@ public class MaterialService {
|
|||||||
//查询商品主条码相关列表
|
//查询商品主条码相关列表
|
||||||
List<MaterialVo4Unit> dataList = materialMapperEx.exportExcel(materialParam, color, materialOther, weight, expiryNum, enabled, enableSerialNumber,
|
List<MaterialVo4Unit> dataList = materialMapperEx.exportExcel(materialParam, color, materialOther, weight, expiryNum, enabled, enableSerialNumber,
|
||||||
enableBatchNumber, remark, idList);
|
enableBatchNumber, remark, idList);
|
||||||
|
if (null != dataList && dataList.size() > EXPORT_LIMIT) {
|
||||||
|
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_EXPORT_LIMIT_CODE,
|
||||||
|
ExceptionConstants.MATERIAL_EXPORT_LIMIT_MSG);
|
||||||
|
}
|
||||||
//查询商品副条码相关列表
|
//查询商品副条码相关列表
|
||||||
Map<Long, MaterialExtend> otherMaterialMap = new HashMap<>();
|
Map<Long, MaterialExtend> otherMaterialMap = new HashMap<>();
|
||||||
List<MaterialExtend> otherDataList = materialMapperEx.getOtherMaterialList();
|
List<MaterialExtend> otherDataList = materialMapperEx.getOtherMaterialList();
|
||||||
|
|||||||
Reference in New Issue
Block a user