zss
8 天以前 51ec98113c6d49d0f7eec4e3c030e55e337e97db
cnas-manage/src/main/java/com/yuanchu/mom/service/impl/ManageRecordCancelServiceImpl.java
@@ -44,7 +44,7 @@
 * 作废文件销魂记录 服务实现类
 * </p>
 *
 * @author 芯导软件(江苏)有限公司
 * @author
 * @since 2024-11-13 01:27:22
 */
@Service
@@ -85,18 +85,7 @@
    public String exportOutManageRecordCancel(ManageRecordCancel manageRecordCancel, HttpServletResponse response) {
        List<ManageRecordCancel> manageRecordCancelList = manageRecordCancelMapper.pageManageRecordCancel(new Page(-1, -1), QueryWrappers.queryWrappers(manageRecordCancel)).getRecords();
        //生成检验报告发放登记表
        String url;
        try {
            InputStream inputStream = this.getClass().getResourceAsStream("/static/cancel-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/cancel-deal.docx");
        ConfigureBuilder builder = Configure.builder();
        builder.useSpringEL(true);
@@ -360,15 +349,12 @@
                tableRenderData.setTableStyle(tableStyle);
                Map<String, Object> table = new HashMap<>();
                table.put("cancel", tableRenderData);
                table.put("index1", index1);
                cancelList.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("cancelList", cancelList);
                }});
        String name = UUID.randomUUID() + "_文件销毁申请表" + ".docx";