From 37360820961e7c7c4e096a397d0bd5f7624aee63 Mon Sep 17 00:00:00 2001 From: caozehui <2427765068@qq.com> Date: Wed, 14 May 2025 09:07:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=BA=E5=88=86=E6=A5=BC=E4=B8=8B=E3=80=81?= =?UTF-8?q?=E7=9C=81=E7=BA=A7=E5=B9=B3=E5=8F=B0=E5=9C=BA=E6=99=AF=E7=9A=84?= =?UTF-8?q?=E6=8A=A5=E5=91=8A=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/PqReportServiceImpl.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/detection/src/main/java/com/njcn/gather/report/service/impl/PqReportServiceImpl.java b/detection/src/main/java/com/njcn/gather/report/service/impl/PqReportServiceImpl.java index 11660484..fc4372db 100644 --- a/detection/src/main/java/com/njcn/gather/report/service/impl/PqReportServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/report/service/impl/PqReportServiceImpl.java @@ -41,8 +41,6 @@ import com.njcn.gather.report.pojo.vo.PqReportVO; import com.njcn.gather.report.service.IPqReportService; import com.njcn.gather.report.utils.Docx4jUtil; import com.njcn.gather.report.utils.WordUtil; -import com.njcn.gather.result.pojo.param.ResultParam; -import com.njcn.gather.result.pojo.vo.ResultVO; import com.njcn.gather.result.service.IResultService; import com.njcn.gather.script.pojo.po.PqScriptCheckData; import com.njcn.gather.script.pojo.po.PqScriptDtls; @@ -56,6 +54,8 @@ import com.njcn.gather.storage.pojo.po.AdNonHarmonicResult; import com.njcn.gather.storage.pojo.vo.RawResultDataVO; import com.njcn.gather.storage.service.AdHarmonicService; import com.njcn.gather.storage.service.AdNonHarmonicService; +import com.njcn.gather.system.cfg.pojo.enums.SceneEnum; +import com.njcn.gather.system.cfg.service.ISysTestConfigService; import com.njcn.gather.system.dictionary.pojo.po.DictData; import com.njcn.gather.system.dictionary.pojo.po.DictTree; import com.njcn.gather.system.dictionary.service.IDictDataService; @@ -138,6 +138,8 @@ public class PqReportServiceImpl extends ServiceImpl i private final ISysUserService sysUserService; + private final ISysTestConfigService sysTestConfigService; + private final long FILE_SIZE_LIMIT = 5 * 1024 * 1024; @Override @@ -1018,8 +1020,15 @@ public class PqReportServiceImpl extends ServiceImpl i throw new BusinessException("设备类型丢失,请联系管理员!"); } // 找到该文件的路径 - String filePath = reportPath.concat(File.separator).concat(devType.getName()).concat(File.separator).concat(pqDevVO.getCreateId()).concat(".docx"); - File reportFile = new File(filePath); + String currrentScene = sysTestConfigService.getCurrrentScene(); + + StringBuilder filePath = new StringBuilder(reportPath.concat(File.separator)); + if (SceneEnum.LEAVE_FACTORY_TEST.getValue().equals(currrentScene)) { + filePath.append(pqDevVO.getCreateId()).append(".docx"); + } else { + filePath.append(devType.getName()).append(File.separator).append(pqDevVO.getCreateId()).append(".docx"); + } + File reportFile = new File(filePath.toString()); if (!reportFile.exists()) { // 如果文件不存在,则将改设备的报告生成状态调整为未生成 iPqDevService.updatePqDevReportState(devReportParam.getDevId(), 0);