From f8c024b1c1de318a4de485e048d1044cd6dcaa53 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期六, 24 十月 2026 21:05:42 +0800
Subject: [PATCH] feat(search-new): 1.标准查新模块 2.印章使用记录
---
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsReportServiceImpl.java | 65 ++++++++++++++++++++++++++------
1 files changed, 53 insertions(+), 12 deletions(-)
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsReportServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsReportServiceImpl.java
index f8e1376..14df655 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsReportServiceImpl.java
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsReportServiceImpl.java
@@ -50,6 +50,7 @@
import com.ruoyi.inspect.service.InsOrderService;
import com.ruoyi.inspect.service.InsReportService;
import com.ruoyi.inspect.service.RawMaterialOrderService;
+import com.ruoyi.inspect.service.SealUsageLedgerService;
import com.ruoyi.inspect.util.PreserveReportPicturePlaceholderHandler;
import com.ruoyi.inspect.util.ReportSealLayoutUtil;
import com.ruoyi.inspect.util.ReportSignaturePictureUtils;
@@ -107,6 +108,8 @@
private UserMapper userMapper;
@Resource
private InsReportMapper insReportMapper;
+ @Resource
+ private SealUsageLedgerService sealUsageLedgerService;
@Resource
private InsOrderStateMapper insOrderStateMapper;
@Resource
@@ -231,8 +234,6 @@
info.setViewStatus(false);
info.setJumpPath(MenuJumpPathConstants.REPORT_PREPARATION);
informationNotificationService.addInformationNotification(info);
- String primaryReportUrl = getPrimaryReportUrl(insReport);
-
// 鍒ゆ柇鏄惁鏄師鏉愭枡 闇�瑕佹浛鎹�****鎴愪緵搴斿晢
IfsInventoryQuantity one = ifsInventoryQuantityMapper.selectOne(new LambdaQueryWrapper<IfsInventoryQuantity>()
.eq(IfsInventoryQuantity::getId, order.getIfsInventoryId()));
@@ -253,9 +254,7 @@
}};
writeMarksToReportFiles(insReport, writeMarks);
- // 淇敼涓存椂pdf
- String tempUrlPdf = wordToPdfTemp(primaryReportUrl.replace("/word", wordUrl));
- insReport.setTempUrlPdf("/word/" + tempUrlPdf);
+ refreshTemporaryPreviews(insReport);
insReportMapper.updateById(insReport);
@@ -383,16 +382,13 @@
info.setViewStatus(false);
info.setJumpPath(MenuJumpPathConstants.REPORT_PREPARATION);
informationNotificationService.addInformationNotification(info);
- String primaryReportUrl = getPrimaryReportUrl(insReport);
Map<String, Object> examineMarks = new HashMap<String, Object>() {{
put("examineUrl", ReportSignaturePictureUtils.create(imgUrl, signatureUrl));
put("examineDateUrl", Pictures.ofStream(DateImageUtil.createDateImage(null)).create());
}};
writeMarksToReportFiles(insReport, examineMarks);
- // 淇敼涓存椂pdf
- String tempUrlPdf = wordToPdfTemp(primaryReportUrl.replace("/word", wordUrl));
- insReport.setTempUrlPdf("/word/" + tempUrlPdf);
+ refreshTemporaryPreviews(insReport);
// 鍙戦�佷紒涓氬井淇¢�氱煡(閫氱煡鎵瑰噯浜哄鎵�)
threadPoolTaskExecutor.execute(() -> {
@@ -438,7 +434,18 @@
@Transactional(rollbackFor = Exception.class)
public int ratifyReport(Integer id, Integer isRatify, String ratifyTell, String sealIds,
Integer maSealId, Integer reportSealId, Integer seamSealId) {
- InsReport insReport = insReportMapper.selectById(id);
+ if (id == null || (isRatify == null || (isRatify != 0 && isRatify != 1))) {
+ throw new ErrorException("鎵瑰噯鍙傛暟涓嶆纭�");
+ }
+ InsReport insReport = insReportMapper.selectOne(Wrappers.<InsReport>lambdaQuery()
+ .eq(InsReport::getId, id)
+ .last("FOR UPDATE"));
+ if (insReport == null) {
+ throw new ErrorException("鎶ュ憡涓嶅瓨鍦�");
+ }
+ if (Objects.equals(insReport.getIsRatify(), 1)) {
+ throw new ErrorException("鎶ュ憡宸叉壒鍑嗭紝璇峰嬁閲嶅鎿嶄綔");
+ }
if (Objects.equals(insReport.getExamineUserId(), SecurityUtils.getUserId().intValue())) {
throw new ErrorException("瀹℃牳浜哄拰鎵瑰噯浜轰笉鑳戒负鍚屼竴浜猴紝璇烽噸鏂伴�夋嫨鎵瑰噯浜�");
}
@@ -609,7 +616,12 @@
});
}
- return insReportMapper.updateById(insReport);
+ int affected = insReportMapper.updateById(insReport);
+ if (affected != 1) {
+ throw new ErrorException("鎶ュ憡鎵瑰噯鐘舵�佷繚瀛樺け璐�");
+ }
+ sealUsageLedgerService.recordApprovedReport(insReport);
+ return affected;
}
/**
@@ -728,6 +740,30 @@
.collect(Collectors.toList());
}
+ private void refreshTemporaryPreviews(InsReport report) {
+ String primaryPdf = wordToPdfTemp(getPrimaryReportUrl(report).replace("/word", wordUrl));
+ if (StringUtils.isBlank(primaryPdf)) {
+ throw new ErrorException("妫�娴嬫姤鍛婇瑙堢敓鎴愬け璐�");
+ }
+ report.setTempUrlPdf("/word/" + primaryPdf);
+ if (StringUtils.isNotBlank(report.getInspectionUrl())) {
+ String inspectionPdf = wordToPdfTemp(report.getInspectionUrl().replace("/word", wordUrl));
+ if (StringUtils.isBlank(inspectionPdf)) {
+ throw new ErrorException("妫�楠屾姤鍛婇瑙堢敓鎴愬け璐�");
+ }
+ report.setInspectionTempUrlPdf("/word/" + inspectionPdf);
+ }
+ }
+
+ @Override
+ public String prepareEditedReportPreview(String absoluteDocxPath) {
+ String pdfName = wordToPdfTemp(absoluteDocxPath);
+ if (StringUtils.isBlank(pdfName)) {
+ throw new ErrorException("鎶ュ憡棰勮鐢熸垚澶辫触");
+ }
+ return "/word/" + pdfName;
+ }
+
private void writeMarksToReportFiles(InsReport report, Map<String, Object> marks) {
for (String reportUrl : getApprovalReportUrls(report)) {
wordInsertUrl(marks, reportUrl.replace("/word", wordUrl));
@@ -804,7 +840,12 @@
throw new ErrorException("鎶ュ憡鏂囦欢涓嶅瓨鍦紝璇疯仈绯荤鐞嗗憳");
}
try {
- String filename = file.getFileName().toString();
+ // 鐗╃悊鏂囦欢鍙兘鏄� reviewed/edited UUID锛涘鐢ㄦ埛濮嬬粓浣跨敤涓氬姟鎶ュ憡缂栧彿銆�
+ String reportNumber = StringUtils.isBlank(report.getCode()) ? "鎶ュ憡" : report.getCode();
+ reportNumber = reportNumber.replaceAll("[\\\\/:*?\"<>|\\p{Cntrl}]", "-").trim();
+ String suffix = StringUtils.isNotBlank(report.getInspectionUrl())
+ ? (Objects.equals(reportType, INSPECTION_REPORT) ? "-妫�楠屾姤鍛�" : "-妫�娴嬫姤鍛�") : "";
+ String filename = reportNumber + suffix + ".docx";
String encodedName = URLEncoder.encode(filename, "UTF-8").replace("+", "%20");
response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document");
response.setHeader("Content-Disposition", "attachment; filename*=UTF-8''" + encodedName);
--
Gitblit v1.9.3