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