提交 a4f7bfd3 authored 作者: 马晨俊's avatar 马晨俊

Merge branch 'lj-project' of git.yfzx.zjtys.com.cn:912-system/monitor/inspect into lj-project

......@@ -37,4 +37,3 @@ build/
### VS Code ###
.vscode/
/src/main/resources/
......@@ -32,7 +32,7 @@ public class MvcConfig extends WebMvcConfigurationSupport {
registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/");
registry.addResourceHandler("/**")
registry.addResourceHandler("/templates/**")
.addResourceLocations("classpath:/META-INF/resources/templates/");
registry.addResourceHandler("/static/**")
.addResourceLocations("classpath:/static/");
......
......@@ -194,7 +194,7 @@ public class EvaluationController {
}else{
wps.put("agree", "不同意");
}
String w = FreeMakerUtils.parseTpl("报告模板", wps);
String w = FreeMakerUtils.parseTpl("reportTemplate", wps);
if(w==null){
return ServerResponse.error(500);
}
......
......@@ -3,6 +3,8 @@ package com.zjty.inspect.utils;
import com.zjty.inspect.entity.TechnologyContent;
import freemarker.template.Configuration;
import freemarker.template.Template;
import org.springframework.web.servlet.view.freemarker.FreeMarkerConfig;
import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;
import java.io.*;
import java.util.List;
......@@ -11,7 +13,9 @@ import java.util.Map;
public class FreeMakerUtils {
public static String parseTpl(String viewName, Map params) {
Configuration cfg = SpringContextHolder.getBean(Configuration.class);
// Configuration cfg = SpringContextHolder.getBean(Configuration.class);
Configuration cfg = new Configuration();
cfg.setClassForTemplateLoading(FreeMakerUtils.class, "/templates/");
Template t = null;
try {
t = cfg.getTemplate(viewName + ".ftl");
......
......@@ -61,7 +61,7 @@ spring.jackson.time-zone=GMT
spring.freemarker.charset=UTF-8
spring.freemarker.suffix=.ftl
spring.freemarker.content-type=text/html; charset=utf-8
spring.freemarker.template-loader-path=classpath:/templates
spring.freemarker.template-loader-path=classpath:/templates/
#spring.redis.host=127.0.0.1
##Redis\u670D\u52A1\u5668\u8FDE\u63A5\u7AEF\u53E3
#spring.redis.port=6379
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论