Browse Source

支持对打印的最大记录行数进行配置

sunyj 8 years ago
parent
commit
e4b886f6d4

+ 29 - 0
src/main/java/com/uas/report/SystemProperties.java

@@ -23,6 +23,18 @@ public class SystemProperties {
 	 */
 	@Value("${schedule.auto-start}")
 	private boolean taskAutoStart;
+	
+	/**
+	 * PC端支持打印的最大记录行数
+	 */
+	@Value("${max-record-size.pc}")
+	private int maxRecordSizePc;
+	
+	/**
+	 * 手机端支持打印的最大记录行数
+	 */
+	@Value("${max-record-size.phone}")
+	private int maxRecordSizePhone;
 
 	public int getTaskPeriod() {
 		return taskPeriod;
@@ -40,4 +52,21 @@ public class SystemProperties {
 		this.taskAutoStart = taskAutoStart;
 	}
 
+	public int getMaxRecordSizePc() {
+		return maxRecordSizePc;
+	}
+
+	public void setMaxRecordSizePc(int maxRecordSizePc) {
+		this.maxRecordSizePc = maxRecordSizePc;
+	}
+
+	public int getMaxRecordSizePhone() {
+		return maxRecordSizePhone;
+	}
+
+	public void setMaxRecordSizePhone(int maxRecordSizePhone) {
+		this.maxRecordSizePhone = maxRecordSizePhone;
+	}
+
+	
 }

+ 8 - 4
src/main/java/com/uas/report/service/impl/PrintServiceImpl.java

@@ -40,6 +40,7 @@ import org.springframework.stereotype.Service;
 
 import com.alibaba.fastjson.JSONObject;
 import com.uas.report.SpecialProperties;
+import com.uas.report.SystemProperties;
 import com.uas.report.core.exception.ReportException;
 import com.uas.report.jasperreports.engine.export.CustomJRXlsExporter;
 import com.uas.report.model.Master;
@@ -82,6 +83,9 @@ public class PrintServiceImpl implements PrintService {
 
 	@Autowired
 	private FileService fileService;
+	
+	@Autowired
+	private SystemProperties systemProperties;
 
 	@Autowired
 	private SpecialProperties specialProperties;
@@ -198,7 +202,7 @@ public class PrintServiceImpl implements PrintService {
 				data = outputStream.toByteArray();
 				outputStream.close();
 			}
-			// 报表预览,则直接输出pdf,并且需要进行分页
+			// 报表预览,则直接输出pdf,并且也许需要分页
 			else {
 				logger.info("preview fillReport...");
 				jasperPrint = JasperFillManager.fillReport(jasperFilePath, parameters, connection);
@@ -632,14 +636,14 @@ public class PrintServiceImpl implements PrintService {
 			platform = Platform.PC;
 		}
 
-		// 报表支持的最大数据库记录数
+		// 支持打印的最大记录
 		int maxRecordSize = 0;
 		switch (platform) {
 		case PC:
-			maxRecordSize = 100000;
+			maxRecordSize = systemProperties.getMaxRecordSizePc();
 			break;
 		case PHONE:
-			maxRecordSize = 10000;
+			maxRecordSize = systemProperties.getMaxRecordSizePhone();
 			break;
 		}
 

+ 4 - 0
src/main/resources/bootstrap.yml

@@ -22,6 +22,10 @@ schedule:
  period: 3600000
  auto-start: true
  
+max-record-size:
+ pc: 100000
+ phone: 10000
+ 
 jasperserver:
  rest:
   api: