zss
2024-12-25 6d493697ae4bf63c0ce72034e1f1b703081b436f
cnas-manage/src/main/java/com/yuanchu/mom/service/impl/ManageRecordCheckServiceImpl.java
@@ -94,18 +94,7 @@
    public String exportOutManageRecordCheck(ManageRecordCheck manageRecordCheck, HttpServletResponse response) {
        List<ManageRecordCheck> manageRecordCheckList = manageRecordCheckMapper.pageManageRecordCheck(new Page(-1, -1), QueryWrappers.queryWrappers(manageRecordCheck)).getRecords();
        //生成检验报告发放登记表
        String url;
        try {
            InputStream inputStream = this.getClass().getResourceAsStream("/static/check-deal.docx");
            File file = File.createTempFile("temp", ".tmp");
            OutputStream outputStream = new FileOutputStream(file);
            IOUtils.copy(inputStream, outputStream);
            url = file.getAbsolutePath();
        } catch (FileNotFoundException e) {
            throw new ErrorException("找不到模板文件");
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        InputStream inputStream = this.getClass().getResourceAsStream("/static/check-deal.docx");
        ConfigureBuilder builder = Configure.builder();
        builder.useSpringEL(true);
@@ -349,15 +338,12 @@
                tableRenderData.setTableStyle(tableStyle);
                Map<String, Object> table = new HashMap<>();
                table.put("check", tableRenderData);
                table.put("index1", index1);
                checkList.add(table);
                index1++;
            }
        }
        Integer finalIndex = index1;
        XWPFTemplate template = XWPFTemplate.compile(url, builder.build()).render(
        XWPFTemplate template = XWPFTemplate.compile(inputStream, builder.build()).render(
                new HashMap<String, Object>() {{
                    put("size", finalIndex);
                    put("checkList", checkList);
                }});
        String name = UUID.randomUUID() + "_文件审批记录" + ".docx";