liding
8 小时以前 2e378480e4920042ce57cc853ed33b35bcd580aa
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsReportServiceImpl.java
@@ -43,6 +43,7 @@
import com.ruoyi.system.mapper.UserMapper;
import com.ruoyi.system.service.InformationNotificationService;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.openxml4j.util.ZipSecureFile;
import org.apache.poi.xwpf.usermodel.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@@ -449,8 +450,12 @@
        }
        Integer insOrderId = insReportMapper.selectById(id).getInsOrderId();
        InsOrder order = insOrderMapper.selectById(insOrderId);
        boolean isRawMater = order.getTypeSource() != null && order.getTypeSource().equals(1);
        IfsInventoryQuantity ifsInventoryQuantity = null;
        if(ObjectUtils.isNotEmpty(order.getIfsInventoryId())){
            ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(order.getIfsInventoryId());
        }
        boolean isRawMater = order.getTypeSource() != null && !order.getTypeSource().equals(-1);
        String contract = ObjectUtils.isNotEmpty(ifsInventoryQuantity)?ifsInventoryQuantity.getContract():order.getContract();//ifs域
        //获取场所的报告专用章
        String sealUrl;
        String laboratory = insOrderMapper.selectById(insReport.getInsOrderId()).getLaboratory();
@@ -461,7 +466,7 @@
            } else {
                type = "委托报告";
            }
            sealUrl = insReportMapper.getLaboratoryByName(laboratory, type);
            sealUrl = insReportMapper.getLaboratoryByName(laboratory, type,contract);
        } catch (Exception e) {
            throw new ErrorException(laboratory + "找不到报告专用章");
        }
@@ -520,7 +525,18 @@
    @Override
    public int wordInsertUrl(Map<String, Object> map, String url) {
        XWPFTemplate template = XWPFTemplate.compile(url).render(map);
        XWPFTemplate template;
        synchronized (ZipSecureFile.class) {
            double originalMinInflateRatio = ZipSecureFile.getMinInflateRatio();
            try {
                // 兼容报告中压缩率较高的纯色/透明 PNG,编译后立即恢复 POI 安全阈值。
                ZipSecureFile.setMinInflateRatio(0.001D);
                template = XWPFTemplate.compile(url);
            } finally {
                ZipSecureFile.setMinInflateRatio(originalMinInflateRatio);
            }
        }
        template.render(map);
        try {
            template.writeAndClose(Files.newOutputStream(Paths.get(url)));
        } catch (IOException e) {