| | |
| | | import com.estate.expert.admin.service.CheckTaskService; |
| | | import com.estate.expert.admin.service.ReportService; |
| | | import com.estate.expert.admin.service.ReportTemplateService; |
| | | import com.estate.expert.admin.utils.WordToPdfConverter; |
| | | import com.estate.expert.admin.utils.wordtopdf.PdfUtils; |
| | | import com.estate.expert.admin.utils.wordtopdf.WordUtil; |
| | | import com.estate.expert.admin.utils.wordtopdf.WordToPdfTest; |
| | | import com.estate.expert.common.auth.IgnoreAuth; |
| | | import com.estate.expert.common.rpc.Result; |
| | | import fr.opensagres.poi.xwpf.converter.pdf.PdfConverter; |
| | |
| | | import java.nio.file.Files; |
| | | import java.nio.file.Path; |
| | | import java.nio.file.StandardOpenOption; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Api(tags = "管理后台/统计/报告下载") |
| | | @Slf4j |
| | |
| | | @IgnoreAuth |
| | | public void scoreReport(@ApiParam("检查任务ID") @RequestParam(value = "checkTaskId") Integer checkTaskId, |
| | | @ApiParam("报告模版ID") @RequestParam(value = "templateId") Integer templateId, |
| | | @ApiParam("uuid") @RequestParam(value = "uuid",required = false) String uuid, |
| | | HttpServletResponse response) throws IOException { |
| | | try (var doc = reportService.scoreReport(checkTaskId, templateId)) { |
| | | download(doc, response, "打分评价", checkTaskId, templateId,null); |
| | | download(doc, response, "打分评价", checkTaskId, templateId,uuid); |
| | | } |
| | | } |
| | | |
| | |
| | | @ApiOperation("模糊评价报告PDF下载(新接口)- 通过Word链接转换") |
| | | @GetMapping("/fuzzyReportPdfNew") |
| | | @IgnoreAuth |
| | | public void fuzzyReportPdfNew(@ApiParam("Word文档URL") @RequestParam(value = "wordUrl") String wordUrl, |
| | | @ApiParam("文件名(可选)") @RequestParam(value = "fileName", required = false) String fileName, |
| | | @ResponseBody |
| | | public Result fuzzyReportPdfNew( @RequestParam(value = "uuid", required = false) String uuid, |
| | | HttpServletResponse response) throws Exception { |
| | | |
| | | try { |
| | | String test = pdfUtils.test("1769239688785.docx"); |
| | | |
| | | // String test = pdfUtils.test("F:\\file\\estate\\reports\\1769239688785.docx"); |
| | | String s = WordToPdfTest.testSingleFileConversion(uuid); |
| | | return Result.success(s); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | |
| | | out.flush(); |
| | | |
| | | // 保存文件到服务器 |
| | | // if(uuid!=null && !uuid.isEmpty()){ |
| | | // saveFileToServer(docBytes, docName + ".docx",uuid); |
| | | // } |
| | | if(uuid!=null && !uuid.isEmpty()){ |
| | | saveFileToServer(docBytes, docName + ".docx",uuid); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("文档下载失败", e); |
| | | throw new IOException("文档下载失败: " + e.getMessage(), e); |