区分楼下、省级平台场景的报告路径

This commit is contained in:
caozehui
2025-05-14 09:07:38 +08:00
parent 2f303e63a3
commit 3736082096

View File

@@ -41,8 +41,6 @@ import com.njcn.gather.report.pojo.vo.PqReportVO;
import com.njcn.gather.report.service.IPqReportService; import com.njcn.gather.report.service.IPqReportService;
import com.njcn.gather.report.utils.Docx4jUtil; import com.njcn.gather.report.utils.Docx4jUtil;
import com.njcn.gather.report.utils.WordUtil; 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.result.service.IResultService;
import com.njcn.gather.script.pojo.po.PqScriptCheckData; import com.njcn.gather.script.pojo.po.PqScriptCheckData;
import com.njcn.gather.script.pojo.po.PqScriptDtls; 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.pojo.vo.RawResultDataVO;
import com.njcn.gather.storage.service.AdHarmonicService; import com.njcn.gather.storage.service.AdHarmonicService;
import com.njcn.gather.storage.service.AdNonHarmonicService; 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.DictData;
import com.njcn.gather.system.dictionary.pojo.po.DictTree; import com.njcn.gather.system.dictionary.pojo.po.DictTree;
import com.njcn.gather.system.dictionary.service.IDictDataService; import com.njcn.gather.system.dictionary.service.IDictDataService;
@@ -138,6 +138,8 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
private final ISysUserService sysUserService; private final ISysUserService sysUserService;
private final ISysTestConfigService sysTestConfigService;
private final long FILE_SIZE_LIMIT = 5 * 1024 * 1024; private final long FILE_SIZE_LIMIT = 5 * 1024 * 1024;
@Override @Override
@@ -1018,8 +1020,15 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
throw new BusinessException("设备类型丢失,请联系管理员!"); throw new BusinessException("设备类型丢失,请联系管理员!");
} }
// 找到该文件的路径 // 找到该文件的路径
String filePath = reportPath.concat(File.separator).concat(devType.getName()).concat(File.separator).concat(pqDevVO.getCreateId()).concat(".docx"); String currrentScene = sysTestConfigService.getCurrrentScene();
File reportFile = new File(filePath);
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()) { if (!reportFile.exists()) {
// 如果文件不存在,则将改设备的报告生成状态调整为未生成 // 如果文件不存在,则将改设备的报告生成状态调整为未生成
iPqDevService.updatePqDevReportState(devReportParam.getDevId(), 0); iPqDevService.updatePqDevReportState(devReportParam.getDevId(), 0);