This commit is contained in:
ls
2024-11-21 11:39:51 +08:00
parent 36d80a8349
commit 27a60eb5d3

View File

@@ -51,14 +51,14 @@ public class ExperimentDocServiceImpl extends ServiceImpl<ExperimentDocMapper, E
} }
public String generateExperimentDoc(String experimentId, String fileName, String version) { public String generateExperimentDoc(String experimentId, String fileName, String version) {
String absolutePath = templatePath + File.separator + version + File.separator + docTempalteMap.get(fileName); String absolutePath = templatePath + File.separator + docTempalteMap.get(fileName);
log.info("doc template path: " + absolutePath); log.info("doc template path: " + absolutePath);
if (!FileUtil.exist(absolutePath)) { if (!FileUtil.exist(absolutePath)) {
throw new RuntimeException("模板文件不存在!"); throw new RuntimeException("模板文件不存在!");
} }
try { try {
String tmpDirPath = FileUtil.getTmpDirPath(); String tmpDirPath = FileUtil.getTmpDirPath();
String outputFile = tmpDirPath + fileName + "-" + experimentId + ".docx"; String outputFile = tmpDirPath + fileName + "-" + experimentId + "-" + version + ".docx";
if (FileUtil.exist(outputFile)) { if (FileUtil.exist(outputFile)) {
FileUtil.del(outputFile); FileUtil.del(outputFile);
} }