1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| @PostMapping("/generateReferenceReview") public void generateReferenceReview(String json, String orderId, HttpServletResponse response) throws Exception { String diskPath = orderConsumerService.generateReferenceReview(JSONObject.parseObject(json));
CommonUtil.setContentType(response, diskPath); response.setHeader("Content-Disposition", "attachment;filename=" + java.net.URLEncoder.encode(FilenameUtils.getName(diskPath), "UTF-8").replaceAll("\\+", "%20") ); ServletOutputStream outputStream = response.getOutputStream(); FileUtils.copyFile(new File(diskPath), outputStream); outputStream.close(); }
@PostMapping("/generatePPT") public void generatePPT(String json, String orderId, HttpServletResponse response) throws Exception { String diskPath = orderConsumerService.generatePPT(JSONObject.parseObject(json), orderId); CommonUtil.setContentType(response, diskPath); response.setHeader("Content-Disposition", "attachment;filename=" + java.net.URLEncoder.encode(FilenameUtils.getName(diskPath), "UTF-8").replaceAll("\\+", "%20") ); ServletOutputStream outputStream = response.getOutputStream(); FileUtils.copyFile(new File(diskPath), outputStream); outputStream.close(); }
|