Browse Source

decode whereCondition and otherParameters in preprint

sunyj 7 years ago
parent
commit
d7bccd8d87

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

@@ -24,6 +24,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponse;
 import java.io.File;
 import java.io.File;
 import java.io.IOException;
 import java.io.IOException;
+import java.net.URLDecoder;
 import java.sql.SQLException;
 import java.sql.SQLException;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
@@ -85,6 +86,12 @@ public class PrintController {
     public void preprint(String userName, String profile, String reportName, String whereCondition, String otherParameters,
     public void preprint(String userName, String profile, String reportName, String whereCondition, String otherParameters,
                          String printType, String title, HttpServletRequest request, HttpServletResponse response)
                          String printType, String title, HttpServletRequest request, HttpServletResponse response)
             throws JRException, IOException, DocumentException, SQLException, ServletException {
             throws JRException, IOException, DocumentException, SQLException, ServletException {
+        if(!StringUtils.isEmpty(whereCondition)){
+            whereCondition = URLDecoder.decode(whereCondition, "UTF-8");
+        }
+        if(!StringUtils.isEmpty(otherParameters)){
+            otherParameters = URLDecoder.decode(otherParameters, "UTF-8");
+        }
         userName = userName == null ? null : userName.toUpperCase();
         userName = userName == null ? null : userName.toUpperCase();
         // printType为空,默认进入预览页
         // printType为空,默认进入预览页
         PrintType type = StringUtils.isEmpty(printType) ? PrintType.PREVIEW : PrintType.checkType(printType);
         PrintType type = StringUtils.isEmpty(printType) ? PrintType.PREVIEW : PrintType.checkType(printType);

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

@@ -179,7 +179,7 @@ public class PrintServiceImpl implements PrintService {
 		// 报表模板不存在
 		// 报表模板不存在
 		if (!jrxmlFile.exists()) {
 		if (!jrxmlFile.exists()) {
 			// 替换windows下路径中的双反斜杠为单斜杠
 			// 替换windows下路径中的双反斜杠为单斜杠
-			throw new FileNotFoundException("报表模板不存在");
+			throw new FileNotFoundException("报表模板不存在" + jrxmlFile.getName());
 		}
 		}
 
 
 		// 首先解析jrxml文件,检查是否引用子报表,如果是,先(递归)编译子报表
 		// 首先解析jrxml文件,检查是否引用子报表,如果是,先(递归)编译子报表
@@ -655,7 +655,7 @@ public class PrintServiceImpl implements PrintService {
 			// 报表模板不存在
 			// 报表模板不存在
 			if (!jrxmlFile.exists()) {
 			if (!jrxmlFile.exists()) {
 				// 替换windows下路径中的双反斜杠为单斜杠
 				// 替换windows下路径中的双反斜杠为单斜杠
-				throw new FileNotFoundException("报表模板不存在");
+				throw new FileNotFoundException("报表模板不存在" + jrxmlFile.getName());
 			}
 			}
 
 
 			// 因为子报表数据量较小,而且其参数来自主报表,无法简单地进行判断,所以不判断子报表是否过载
 			// 因为子报表数据量较小,而且其参数来自主报表,无法简单地进行判断,所以不判断子报表是否过载