zss
8 天以前 51ec98113c6d49d0f7eec4e3c030e55e337e97db
cnas-process/src/main/java/com/yuanchu/mom/service/impl/ProcessTotaldealServiceImpl.java
@@ -40,7 +40,7 @@
 * 检测或校准物品的处置总表(历史) 服务实现类
 * </p>
 *
 * @author 芯导软件(江苏)有限公司
 * @author
 * @since 2024-11-02 03:59:09
 */
@Service
@@ -128,18 +128,7 @@
    //生成样品处理表word
    private String processTotaldeal(Integer id,String signatureUrl){
        List<ProcessDeal> processDeals = processDealMapper.selectList(Wrappers.<ProcessDeal>lambdaQuery().eq(ProcessDeal::getTotaldealId,id));
        String url;
        try {
            InputStream inputStream = this.getClass().getResourceAsStream("/static/sample-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/sample-deal.docx");
        ConfigureBuilder builder = Configure.builder();
        builder.useSpringEL(true);
@@ -351,16 +340,13 @@
                tableRenderData.setTableStyle(tableStyle);
                Map<String, Object> table = new HashMap<>();
                table.put("sample", tableRenderData);
                table.put("index1", index1);
                sampleList.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("sampleList", sampleList);
                    put("size", finalIndex);
                    put("examineUrl", null);
                    put("ratifyUrl", null);
                    put("writeUrl", new FilePictureRenderData(100,50,imgUrl + "/" + signatureUrl));