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);