增加报告模板友好提示信息
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user