崔宝铖提交
This commit is contained in:
parent
cd4eafccb2
commit
b0e28be372
@ -9,6 +9,7 @@ import com.cm.news.pojo.dtos.newscontent.NewsContentDTO;
|
||||
import com.cm.news.pojo.dtos.newstemplate.NewsTemplateDTO;
|
||||
import com.cm.news.pojo.vos.newstemplaterecord.NewsTemplateRecordVO;
|
||||
import com.cm.news.service.newscontent.INewsContentService;
|
||||
import com.cm.news.service.newstemplate.INewsTemplateService;
|
||||
import com.cm.news.service.newstemplaterecord.INewsTemplateRecordService;
|
||||
import freemarker.cache.StringTemplateLoader;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -50,11 +51,19 @@ public class TemplateUtil {
|
||||
|
||||
private static INewsContentService iNewsContentStaticService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private INewsTemplateService iNewsTemplateService;
|
||||
|
||||
private static INewsTemplateService iNewsTemplateStaticService;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
iNewsTemplateRecordStaticService = this.iNewsTemplateRecordService;
|
||||
iNewsContentStaticService = this.iNewsContentService;
|
||||
templateStaticProperties = this.templateProperties;
|
||||
iNewsTemplateStaticService = this.iNewsTemplateService;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -156,9 +165,9 @@ public class TemplateUtil {
|
||||
if(saveFile.exists()) {
|
||||
saveFile.delete();
|
||||
}
|
||||
Writer out = new FileWriter(saveFile);
|
||||
temp.process(params, out);
|
||||
out.flush();
|
||||
BufferedWriter writer = new BufferedWriter (new OutputStreamWriter (new FileOutputStream (saveFile,true),"UTF-8"));
|
||||
temp.process(params, writer);
|
||||
writer.flush();
|
||||
/**
|
||||
* 做生成模板记录
|
||||
*/
|
||||
@ -167,7 +176,7 @@ public class TemplateUtil {
|
||||
recordVo.setNewsTemplateId(newsTemplate.getNewsTemplateDTO().getNewsTemplateId());
|
||||
recordVo.setTemplateRecordBuilderTime(DateUtil.getTime());
|
||||
recordVo.setTemplateRecordPath(fileName);
|
||||
recordVo.setTemplateRecordUrl("news/" + templateUrl + "/" + dateTime.getYear()+ "/" + dateTime.getMonthOfYear() + "/" + newsContentId + ".html");
|
||||
recordVo.setTemplateRecordUrl(newsTemplate.getNewsTemplateDTO().getTemplateUrl() + dateTime.getYear()+ "/" + dateTime.getMonthOfYear() + "/" + newsContentId + ".html");
|
||||
iNewsTemplateRecordStaticService.saveNewsTemplateRecord(recordVo);
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,8 @@ public class NewsTemplateVO {
|
||||
@ApiModelProperty(name = "templateCode", value = "模板编码")
|
||||
@CheckEmptyAnnotation(name = "模板编码")
|
||||
private String templateCode;
|
||||
@ApiModelProperty(name = "templateUrl", value = "模板路径")
|
||||
@ApiModelProperty(name = "templateUrl", value = "访问路径")
|
||||
@CheckEmptyAnnotation(name = "访问路径")
|
||||
private String templateUrl;
|
||||
@ApiModelProperty(name = "templateName", value = "模板名称")
|
||||
@CheckEmptyAnnotation(name = "模板名称")
|
||||
|
@ -44,18 +44,18 @@
|
||||
<input type="text" id="templateName" name="templateName" class="layui-input" value="" placeholder="请输入模板名称" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="layui-form-item">
|
||||
<label class="layui-form-label">模板路径<span style="color: red">*</span></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="templateUrl" name="templateUrl" class="layui-input" value="" placeholder="请输入模板路径" lay-verify="required">
|
||||
</div>
|
||||
</div>-->
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">存储路径<span style="color: red">*</span></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="templateSavePath" name="templateSavePath" class="layui-input" value="" placeholder="请输入模板存储路径" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">访问路径<span style="color: red">*</span></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="templateUrl" name="templateUrl" class="layui-input" value="" placeholder="请输入访问路径" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">模板排序<span style="color: red">*</span></label>
|
||||
<div class="layui-input-block">
|
||||
|
@ -44,18 +44,18 @@
|
||||
<input type="text" id="templateName" name="templateName" class="layui-input" value="" placeholder="请输入模板名称" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="layui-form-item">
|
||||
<label class="layui-form-label">模板路径<span style="color: red">*</span></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="templateUrl" name="templateUrl" class="layui-input" value="" placeholder="请输入模板路径" lay-verify="required">
|
||||
</div>
|
||||
</div>-->
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">存储路径<span style="color: red">*</span></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="templateSavePath" name="templateSavePath" class="layui-input" value="" placeholder="请输入模板存储路径" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">访问路径<span style="color: red">*</span></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="templateUrl" name="templateUrl" class="layui-input" value="" placeholder="请输入访问路径" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">模板排序<span style="color: red">*</span></label>
|
||||
<div class="layui-input-block">
|
||||
|
Loading…
Reference in New Issue
Block a user