没有图片的freemarker下载,备份

 //以下代码也可以使用/* public String exportApproveCase(@PathVariable("proId") Integer proId, HttpServletRequest request) throws Exception {     //获取项目名TJ-IKC     String path = request.getContextPath();     System.out.println(path);     //获取工程目录     //绝对路径:request.getSession().getServletContext()     String finalPath = request.getSession().getServletContext().getRealPath(path);     System.out.println(finalPath);     String templatePath = "/templates/docTemplates/";     //指定文件存储的路径     java.io.File file = new java.io.File(finalPath + File.separator + "upload");     System.out.println(file.getName());     if (!file.exists() && !file.isDirectory()) {         file.mkdir();     }     java.io.File file1 = new java.io.File(finalPath + File.separator + "upload" + File.separator + "案例报告");     if (!file1.exists() && !file1.isDirectory()) {         file1.mkdir();     }     //获取保存路径的绝对地址     String savePath = "/upload/案例报告/";     String finalSavePath = request.getSession().getServletContext().getRealPath(savePath);     System.out.println(finalSavePath);     //封装数据     Map<String, Object> dataMap = new HashMap<>();     DocUtil docUtil = new DocUtil();     //时间转换     Calendar calendar = Calendar.getInstance();     String data = calendar.get(Calendar.YEAR) + "." + calendar.get(Calendar.MONTH) + "." + calendar.get(Calendar.DATE);     //查找出来单个难题数据     Problem problem = new Problem();     problem = caseService.findByCategoryAndId(proId);     ModelAndView modelAndView = new ModelAndView();     modelAndView.addObject("problem", problem);     dataMap.put("proTitle", problem.getProTitle());     dataMap.put("proLevel", problem.getProLevel());     dataMap.put("proIndustry", problem.getProIndustry());     dataMap.put("proCompany", problem.getProCompany());     dataMap.put("proKeyword", problem.getProKeyword());     dataMap.put("proTheory", problem.getProTheory());     dataMap.put("proFunction", problem.getProFunction());     dataMap.put("proBackgroud", problem.getProBackgroud());     dataMap.put("proAbstract", problem.getProAbstract());     dataMap.put("proDescription", problem.getProDescription());     dataMap.put("proSolution", problem.getProSolution());     dataMap.put("proResult", problem.getProResult());     String fileName = "case" + ".doc";     docUtil.write(templatePath, "caseTemplate.ftl", dataMap, finalSavePath, fileName);     String filePath = "/upload/案例报告/" + fileName;     return filePath; }*/
 posted on 2019-10-30 11:11  ben跑的换行符  阅读(103)  评论(0编辑  收藏  举报