| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | @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; |
| | | |
| | |
| | | } |
| | | |
| | | 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); |
| | | |
| | |
| | | if (userId == null) { |
| | | throw new ErrorException("缺少批准人"); |
| | | } |
| | | if (Objects.equals(insReport.getExamineUserId(), userId)) { |
| | | throw new ErrorException("审核人和批准人不能为同一人,请重新选择批准人"); |
| | | } |
| | | } |
| | | insReport.setRatifyUserId(userId);//批准人 |
| | | //获取审核人的签名地址 |
| | |
| | | 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); |
| | |
| | | @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); |
| | |
| | | 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()); |