update
This commit is contained in:
@@ -23,5 +23,6 @@ WORKDIR /app
|
||||
EXPOSE 8080
|
||||
#ADD ./src/main/resources/jeecg ./config/jeecg
|
||||
COPY --from=build /app/physical-launcher/target/physical-launcher-3.7.0.jar physical-launcher-3.7.0.jar
|
||||
COPY --from=build /app/templates ./templates
|
||||
|
||||
CMD sleep 10;java -Djava.security.egd=file:/dev/./urandom -jar physical-launcher-3.7.0.jar --spring.profiles.active=test
|
||||
@@ -204,7 +204,10 @@ mybatis-plus:
|
||||
#jeecg专用配置
|
||||
minidao:
|
||||
base-package: org.jeecg.modules.jmreport.*,org.jeecg.modules.drag.*
|
||||
|
||||
jeecg:
|
||||
template:
|
||||
path: /app/templates
|
||||
# 平台上线安全配置
|
||||
firewall:
|
||||
# 数据源安全 (开启后,Online报表和图表的数据源为必填)
|
||||
|
||||
@@ -207,6 +207,8 @@ mybatis-plus:
|
||||
minidao:
|
||||
base-package: org.jeecg.modules.jmreport.*,org.jeecg.modules.drag.*
|
||||
jeecg:
|
||||
template:
|
||||
path: /app/templates
|
||||
# 平台上线安全配置
|
||||
firewall:
|
||||
# 数据源安全 (开启后,Online报表和图表的数据源为必填)
|
||||
|
||||
@@ -207,6 +207,8 @@ mybatis-plus:
|
||||
minidao:
|
||||
base-package: org.jeecg.modules.jmreport.*,org.jeecg.modules.drag.*
|
||||
jeecg:
|
||||
template:
|
||||
path: /app/templates
|
||||
# 平台上线安全配置
|
||||
firewall:
|
||||
# 数据源安全 (开启后,Online报表和图表的数据源为必填)
|
||||
|
||||
@@ -9,13 +9,13 @@ import org.jeecg.common.util.MinioUtil;
|
||||
import org.jeecg.modules.database.entity.ExperimentDoc;
|
||||
import org.jeecg.modules.database.mapper.ExperimentDocMapper;
|
||||
import org.jeecg.modules.database.service.IExperimentDocService;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @Description: 试验文档
|
||||
@@ -27,6 +27,9 @@ import java.util.Objects;
|
||||
@Slf4j
|
||||
public class ExperimentDocServiceImpl extends ServiceImpl<ExperimentDocMapper, ExperimentDoc> implements IExperimentDocService {
|
||||
|
||||
@Value("${jeecg.template.path}")
|
||||
private String templatePath;
|
||||
|
||||
static Map<String, String> docTempalteMap = new HashMap<>();
|
||||
|
||||
static {
|
||||
@@ -42,17 +45,15 @@ public class ExperimentDocServiceImpl extends ServiceImpl<ExperimentDocMapper, E
|
||||
//The core API uses a minimalist design, only one line of code is required
|
||||
Map<String, Object> maps = new HashMap<>();
|
||||
maps.put("title", "辐照试验计划表");
|
||||
generateExperimentDoc("20241028号实验", "辐照试验计划表", maps);
|
||||
//generateExperimentDoc("20241028号实验", "辐照试验计划表", maps);
|
||||
}
|
||||
|
||||
public static String generateExperimentDoc(String experimentId, String fileName, Map<String, Object> params) {
|
||||
URL resourceUrl = ExperimentDocServiceImpl.class.getClassLoader().getResource("templates/doc/" + docTempalteMap.get(fileName));
|
||||
if (Objects.isNull(resourceUrl)) {
|
||||
public String generateExperimentDoc(String experimentId, String fileName, Map<String, Object> params) {
|
||||
String absolutePath = templatePath + File.separator + docTempalteMap.get(fileName);
|
||||
log.info("doc template path: " + absolutePath);
|
||||
if (FileUtil.exist(absolutePath)) {
|
||||
throw new RuntimeException("模板文件不存在!");
|
||||
}
|
||||
String absolutePath = resourceUrl.getPath();
|
||||
log.info("doc template path: " + absolutePath);
|
||||
|
||||
try {
|
||||
String tmpDirPath = FileUtil.getTmpDirPath();
|
||||
String outputFile = tmpDirPath + fileName + "-" + experimentId + ".docx";
|
||||
|
||||
Reference in New Issue
Block a user