Browse Source

add /print/parameter

sunyj 7 years ago
parent
commit
b1b1485fec

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

@@ -114,7 +114,9 @@ public class PrintController {
      * @param id       预打印时获取的 id
      * @param id       预打印时获取的 id
      * @return 缓存的打印参数
      * @return 缓存的打印参数
      */
      */
-    private PrintParameter getPrintParameter(String id) {
+    @RequestMapping(value = "/parameter")
+    @ResponseBody
+    public PrintParameter getPrintParameter(String id, HttpServletRequest request, HttpServletResponse response) {
         Assert.hasText(id, "Required String parameter 'id' is not present");
         Assert.hasText(id, "Required String parameter 'id' is not present");
         PrintParameter printParameter = printParameters.get(id);
         PrintParameter printParameter = printParameters.get(id);
         Assert.notNull(printParameter, "id 不存在");
         Assert.notNull(printParameter, "id 不存在");
@@ -136,7 +138,7 @@ public class PrintController {
     @RequestMapping(value = "/routing", method = RequestMethod.GET)
     @RequestMapping(value = "/routing", method = RequestMethod.GET)
     public void routing(String id, HttpServletRequest request, HttpServletResponse response)
     public void routing(String id, HttpServletRequest request, HttpServletResponse response)
             throws JRException, IOException, DocumentException, SQLException, ServletException {
             throws JRException, IOException, DocumentException, SQLException, ServletException {
-        PrintParameter printParameter = getPrintParameter(id);
+        PrintParameter printParameter = getPrintParameter(id, request, response);
         switch (printParameter.getPrintType()) {
         switch (printParameter.getPrintType()) {
             // 预览或打印
             // 预览或打印
             case PREVIEW:
             case PREVIEW:
@@ -186,7 +188,7 @@ public class PrintController {
     public void export(String id, String exportFileType, Boolean flush, HttpServletRequest request,
     public void export(String id, String exportFileType, Boolean flush, HttpServletRequest request,
 			HttpServletResponse response) throws JRException, IOException, DocumentException, SQLException {
 			HttpServletResponse response) throws JRException, IOException, DocumentException, SQLException {
 		// TODO show download process
 		// TODO show download process
-        PrintParameter printParameter = getPrintParameter(id);
+        PrintParameter printParameter = getPrintParameter(id, request, response);
         String userName = printParameter.getUserName();
         String userName = printParameter.getUserName();
         String profile = printParameter.getProfile();
         String profile = printParameter.getProfile();
         String reportName = printParameter.getReportName();
         String reportName = printParameter.getReportName();
@@ -233,7 +235,7 @@ public class PrintController {
     @RequestMapping(value = "/pdfPath")
     @RequestMapping(value = "/pdfPath")
 	@ResponseBody
 	@ResponseBody
 	public String getPdfPath(String id, Boolean flush, HttpServletRequest request, HttpServletResponse response) throws JRException, IOException, DocumentException, SQLException {
 	public String getPdfPath(String id, Boolean flush, HttpServletRequest request, HttpServletResponse response) throws JRException, IOException, DocumentException, SQLException {
-        PrintParameter printParameter = getPrintParameter(id);
+        PrintParameter printParameter = getPrintParameter(id, request, response);
         String userName = printParameter.getUserName();
         String userName = printParameter.getUserName();
         String profile = printParameter.getProfile();
         String profile = printParameter.getProfile();
         String reportName = printParameter.getReportName();
         String reportName = printParameter.getReportName();