增加报告模板友好提示信息

This commit is contained in:
2025-10-20 13:37:38 +08:00
parent 33cefdd0b1
commit e81413eaa9
3 changed files with 27 additions and 1 deletions

View File

@@ -67,6 +67,7 @@ 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.service.IDictDataService;
import com.njcn.gather.system.pojo.enums.SystemResponseEnum;
import com.njcn.gather.tools.report.model.constant.ReportConstant;
import com.njcn.gather.tools.report.service.IWordReportService;
import com.njcn.gather.tools.report.util.BookmarkUtil;
@@ -108,6 +109,7 @@ import java.math.BigInteger;
import java.math.RoundingMode;
import java.net.URLEncoder;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.LocalDateTime;
@@ -639,6 +641,13 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
}
}
});
} catch (NoSuchFileException e) {
String filePath = e.getFile() != null ? e.getFile().replaceAll("\\\\", "/") : "未知文件";
log.error("报告模板文件不存在 - 文件路径: {}", filePath, e);
throw new BusinessException(SystemResponseEnum.FILE_NOT_FOUND);
} catch (IOException e) {
log.error("报告文件读写异常", e);
throw new BusinessException(SystemResponseEnum.FILE_IO_ERROR);
} catch (Exception e) {
log.error(ReportResponseEnum.GENERATE_REPORT_ERROR.getMessage(), e);
throw new BusinessException(ReportResponseEnum.GENERATE_REPORT_ERROR);
@@ -814,6 +823,13 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
Docx4jUtil.cleanBlankPagesAndRedundantPageBreaks(baseModelDocument);
baseModelDocument.save(new File(dirPath.concat(File.separator).concat(fileName)));
this.updateDevAndPlanState(devId, devReportParam.getPlanId());
} catch (NoSuchFileException e) {
String filePath = e.getFile() != null ? e.getFile().replaceAll("\\\\", "/") : "未知文件";
log.error("报告模板文件不存在 - 文件路径: {}", filePath, e);
throw new BusinessException(SystemResponseEnum.FILE_NOT_FOUND);
} catch (IOException e) {
log.error("报告文件读写异常", e);
throw new BusinessException(SystemResponseEnum.FILE_IO_ERROR);
} catch (Exception e) {
log.error(ReportResponseEnum.GENERATE_REPORT_ERROR.getMessage(), e);
throw new BusinessException(ReportResponseEnum.GENERATE_REPORT_ERROR);
@@ -869,6 +885,13 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
ensureDirectoryExists(dirPath);
baseModelDocument.save(new File(dirPath.concat(File.separator).concat(pqDevVO.getCreateId()).concat(ReportConstant.DOCX)));
this.updateDevAndPlanState(devId, devReportParam.getPlanId());
} catch (NoSuchFileException e) {
String filePath = e.getFile() != null ? e.getFile().replaceAll("\\\\", "/") : "未知文件";
log.error("报告模板文件不存在 - 文件路径: {}", filePath, e);
throw new BusinessException(SystemResponseEnum.FILE_NOT_FOUND);
} catch (IOException e) {
log.error("报告文件读写异常", e);
throw new BusinessException(SystemResponseEnum.FILE_IO_ERROR);
} catch (Exception e) {
log.error(ReportResponseEnum.GENERATE_REPORT_ERROR.getMessage(), e);
throw new BusinessException(ReportResponseEnum.GENERATE_REPORT_ERROR);

View File

@@ -27,7 +27,9 @@ public enum SystemResponseEnum {
GET_MAC_ADDRESS_FAILED("A01040", "获取本机MAC地址失败"),
REGISTRATION_CODE_FORMAT_ERROR("A01041", "注册码格式错误"),
MAC_ADDRESS_NOT_MATCH("A01042","注册码中的MAC地址与本机MAC地址不匹配"),
REGISTRATION_CODE_EXPIRED("A01043","注册码已过期"),;
REGISTRATION_CODE_EXPIRED("A01043","注册码已过期"),
FILE_NOT_FOUND("A01050", "模板文件不存在"),
FILE_IO_ERROR("A01051", "文件读写异常"),;
private final String code;

View File

@@ -427,6 +427,7 @@ public class CompareWaveServiceImpl implements ICompareWaveService {
if (sourceLowSampleRate || targetLowSampleRate) {
log.warn("窗口 {} - 采样率过低(源文件: {}点/周波, 目标文件: {}点/周波, 最小要求128该窗口被丢弃",
window, sourceSampleRate, targetSampleRate);
// 推进位置到下一个窗口
sourceCurrentPos = sourceWindowEnd;