Przeglądaj źródła

检测数据量是否超出限制放在检测文件是否失效之后

sunyj 8 lat temu
rodzic
commit
600a8bed7f

+ 7 - 6
src/main/java/com/uas/report/controller/PrintController.java

@@ -138,9 +138,6 @@ public class PrintController {
 			HttpServletResponse response) {
 		userName = userName == null ? null : userName.toUpperCase();
 		ReportUtils.checkParameters(userName, reportName);
-		if (printService.overload(userName, profile, reportName, whereCondition, otherParameters, Platform.PC)) {
-			throw new ReportException("数据量过大,无法提供服务");
-		}
 		String masterOfJrxml = printService.getMasterOfJrxml(userName, reportName);
 		if (StringUtils.isEmpty(exportFileType)) {
 			exportFileType = ReportConstants.PDF_FILE_TYPE;
@@ -160,6 +157,9 @@ public class PrintController {
 		// 文件无效(不存在或过期),创建
 		if ((flush != null && flush.booleanValue())
 				|| !fileService.isFileValid(file.getPath(), fileService.getJrxmlFilePath(masterOfJrxml, reportName))) {
+			if (printService.overload(userName, profile, reportName, whereCondition, otherParameters, Platform.PC)) {
+				throw new ReportException("数据量过大,无法提供服务");
+			}
 			data = printService.export(userName, profile, reportName, whereCondition, otherParameters, exportFileType);
 			if (ArrayUtils.isEmpty(data)) {
 				throw new ReportException("报表导出失败:" + userName + "/" + reportName + "\n");
@@ -234,9 +234,6 @@ public class PrintController {
 			HttpServletRequest request, HttpServletResponse response) {
 		userName = userName == null ? null : userName.toUpperCase();
 		ReportUtils.checkParameters(userName, reportName);
-		if (printService.overload(userName, profile, reportName, whereCondition, otherParameters, Platform.PC)) {
-			throw new ReportException("数据量过大,无法提供服务");
-		}
 		String masterOfJrxml = printService.getMasterOfJrxml(userName, reportName);
 		Map<String, Object> result = new HashMap<>();
 
@@ -251,6 +248,10 @@ public class PrintController {
 			// 文件无效(不存在或过期),重新创建pdf文件
 			if ((flush != null && flush.booleanValue()) || !fileService.isFileValid(file.getPath(),
 					fileService.getJrxmlFilePath(masterOfJrxml, reportName))) {
+				if (printService.overload(userName, profile, reportName, whereCondition, otherParameters,
+						Platform.PC)) {
+					throw new ReportException("数据量过大,无法提供服务");
+				}
 				// 参数pageIndex为null或1,表示是直接打印或预览第一页,
 				// 需要生成第一页(可能页数过多,提示用户不支持预览打印),再在后台开线程生成总的pdf
 				// 先生成第一页pdf