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