From 112a87d32e19b47b9c92534900d9cdd02846bdb3 Mon Sep 17 00:00:00 2001 From: value <z1292839451@163.com> Date: 星期三, 24 四月 2024 18:17:25 +0800 Subject: [PATCH] 完善检验流程 --- inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsReportServiceImpl.java | 30 ++++++++++++++++++++++++++++-- 1 files changed, 28 insertions(+), 2 deletions(-) diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsReportServiceImpl.java b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsReportServiceImpl.java index 4195719..ee1ad15 100644 --- a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsReportServiceImpl.java +++ b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsReportServiceImpl.java @@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.deepoove.poi.XWPFTemplate; +import com.deepoove.poi.data.Pictures; import com.spire.doc.Document; import com.spire.doc.FileFormat; import com.yuanchu.mom.common.GetLook; @@ -26,7 +28,10 @@ import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; import java.util.HashMap; import java.util.Map; @@ -50,6 +55,9 @@ @Value("${wordUrl}") private String wordUrl; + + @Value("${file.path}") + private String imgUrl; @Override public Map<String, Object> pageInsReport(Page page, ReportPageDto reportPageDto) { @@ -100,6 +108,9 @@ String url = insReport.getUrl(); //鎵嬪姩涓婁紶鎶ュ憡鍦板潃 String urlS = insReport.getUrlS(); + wordInsertUrl(new HashMap<String, Object>(){{ + put("writeUrl", Pictures.ofLocal(imgUrl+"/"+signatureUrl).create()); + }}, (urlS==null?url:urlS).replace("/word", wordUrl)); return insReportMapper.updateById(insReport); } @@ -123,7 +134,9 @@ String url = insReport.getUrl(); //鎵嬪姩涓婁紶鎶ュ憡鍦板潃 String urlS = insReport.getUrlS(); - + wordInsertUrl(new HashMap<String, Object>(){{ + put("examineUrl", Pictures.ofLocal(imgUrl+"/"+signatureUrl).create()); + }}, (urlS==null?url:urlS).replace("/word", wordUrl)); return insReportMapper.updateById(insReport); } @@ -147,9 +160,22 @@ String url = insReport.getUrl(); //鎵嬪姩涓婁紶鎶ュ憡鍦板潃 String urlS = insReport.getUrlS(); - + wordInsertUrl(new HashMap<String, Object>(){{ + put("ratifyUrl", Pictures.ofLocal(imgUrl+"/"+signatureUrl).create()); + }}, (urlS==null?url:urlS).replace("/word", wordUrl)); return insReportMapper.updateById(insReport); } + + @Override + public int wordInsertUrl(Map<String, Object> map, String url) { + XWPFTemplate template = XWPFTemplate.compile(url).render(map); + try { + template.writeAndClose(Files.newOutputStream(Paths.get(url))); + } catch (IOException e) { + throw new RuntimeException(e); + } + return 1; + } } -- Gitblit v1.9.3