liding
5 小时以前 51786b723d0a91d11476776d9ce50af7994dc4bd
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsReportServiceImpl.java
@@ -6,6 +6,7 @@
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
import com.aspose.words.FontSettings;
import com.aspose.words.License;
import com.aspose.words.SaveFormat;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -46,6 +47,7 @@
import com.ruoyi.inspect.service.InsReportService;
import com.ruoyi.inspect.service.RawMaterialOrderService;
import com.ruoyi.inspect.util.PreserveReportPicturePlaceholderHandler;
import com.ruoyi.inspect.util.ReportSignaturePictureUtils;
import com.ruoyi.system.mapper.UserMapper;
import com.ruoyi.system.service.InformationNotificationService;
import lombok.extern.slf4j.Slf4j;
@@ -86,6 +88,12 @@
@Slf4j
public class InsReportServiceImpl extends ServiceImpl<InsReportMapper, InsReport>
        implements InsReportService {
    static {
        // Linux 服务器缺少中文字体,报告转 PDF 时中文会变成方块;将模板字体映射到 Noto CJK 兜底。
        FontSettings.addFontSubstitutes("宋体", "Noto Serif CJK SC");
        FontSettings.addFontSubstitutes("黑体", "Noto Sans CJK SC");
    }
    private static final int DETECTION_REPORT = 0;
    private static final int INSPECTION_REPORT = 1;
@@ -228,9 +236,9 @@
        }
        Map<String, Object> writeMarks = new HashMap<String, Object>() {{
            put("writeUrl", Pictures.ofLocal(imgUrl + "/" + signatureUrl).create());
            put("writeUrl", ReportSignaturePictureUtils.create(imgUrl, signatureUrl));
            put("writeDateUrl", Pictures.ofStream(DateImageUtil.createDateImage(null)).create());
            put("insUrl", Pictures.ofLocal(imgUrl + "/" + signatureUrl).create());
            put("insUrl", ReportSignaturePictureUtils.create(imgUrl, signatureUrl));
        }};
        writeMarksToReportFiles(insReport, writeMarks);
@@ -306,6 +314,9 @@
            if (userId == null) {
                throw new ErrorException("缺少批准人");
            }
            if (Objects.equals(insReport.getExamineUserId(), userId)) {
                throw new ErrorException("审核人和批准人不能为同一人,请重新选择批准人");
            }
        }
        insReport.setRatifyUserId(userId);//批准人
        //获取审核人的签名地址
@@ -335,7 +346,7 @@
        informationNotificationService.addInformationNotification(info);
        String primaryReportUrl = getPrimaryReportUrl(insReport);
        Map<String, Object> examineMarks = new HashMap<String, Object>() {{
            put("examineUrl", Pictures.ofLocal(imgUrl + "/" + signatureUrl).create());
            put("examineUrl", ReportSignaturePictureUtils.create(imgUrl, signatureUrl));
            put("examineDateUrl", Pictures.ofStream(DateImageUtil.createDateImage(null)).create());
        }};
        writeMarksToReportFiles(insReport, examineMarks);
@@ -388,6 +399,9 @@
    @Transactional(rollbackFor = Exception.class)
    public int ratifyReport(Integer id, Integer isRatify, String ratifyTell) {
        InsReport insReport = insReportMapper.selectById(id);
        if (Objects.equals(insReport.getExamineUserId(), SecurityUtils.getUserId().intValue())) {
            throw new ErrorException("审核人和批准人不能为同一人,请重新选择批准人");
        }
        insReport.setIsRatify(isRatify);
        if (ObjectUtils.isNotEmpty(ratifyTell)) {
            insReport.setRatifyTell(ratifyTell);
@@ -478,7 +492,7 @@
        String finalUrl = primaryReportUrl.replace("/word", wordUrl);
        Map<String, Object> ratifyMarks = new HashMap<String, Object>() {{
            put("ratifyUrl", Pictures.ofLocal(imgUrl + "/" + signatureUrl).create());
            put("ratifyUrl", ReportSignaturePictureUtils.create(imgUrl, signatureUrl));
            put("ratifyDateUrl", Pictures.ofStream(DateImageUtil.createDateImage(null)).create());
            put("seal1", Pictures.ofLocal(imgUrl + "/" + sealUrl).create());
            put("seal2", Pictures.ofLocal(imgUrl + "/" + sealUrl).create());