提交 ddba1ae7 authored 作者: 孙洁清's avatar 孙洁清

关键技术接口根据name查询功能

上级 a657cb3e
...@@ -103,29 +103,9 @@ public class InspectController { ...@@ -103,29 +103,9 @@ public class InspectController {
int support = technologyService.findAllTechnologyNotSupport(); int support = technologyService.findAllTechnologyNotSupport();
reportVo.setTechnologiesRepair(support); reportVo.setTechnologiesRepair(support);
log.info("inspect:代码评估完成"); log.info("inspect:代码评估完成");
// Map map = new HashMap(); String filePath = inspectService.freemakerData(inspect,count,support);
// map.put("inspect", inspect); reportVo.setHtmlAddress(filePath);
// map.put("time", TimeUtil.getTime());
// HashMap<String, List<Warn>> warnMap = inspect.getWarnDetails();
// List<Technology> technologies = inspect.getTechnologies();
// Map techMap = new HashMap();
// for (Technology technology : technologies) {
// techMap.put(technology.getTechnologyName(), technology.getSupport());
// }
// map.put("techMap", techMap);
// map.put("warnMap", warnMap);
// map.put("technologies", technologies);
// try {
// String template = FreemarkerUtils.getTemplate("pg.ftl", map);
// String s = inspectService.generateHtml(template, map);
// String filePath = FileUtil.createFilePath();
// File file1 = new File("./pgbg/" + filePath + "/" + file.getName() + ".html");
// FileUtil.write(s,"./pgbg/"+filePath+"/"+file.getName()+".html");
// reportVo.setHtmlAddress(file1.getCanonicalPath());
// System.out.println("内容"+s);
// } catch (TemplateException e) {
// e.printStackTrace();
// }
Report report = new Report(); Report report = new Report();
String random = RandomUtil.getRandom(); String random = RandomUtil.getRandom();
report.setId(RandomUtil.getRandom()); report.setId(RandomUtil.getRandom());
......
...@@ -14,4 +14,8 @@ public interface InspectService { ...@@ -14,4 +14,8 @@ public interface InspectService {
*/ */
ReportVo inspect(ReportVo reportVo,InspectParameter inspectParameter); ReportVo inspect(ReportVo reportVo,InspectParameter inspectParameter);
String generateHtml(String templateContent, Map model ); String generateHtml(String templateContent, Map model );
String freemakerData(ReportVo inspect, int count, int support);
} }
package com.zjty.inspect.service.impl; package com.zjty.inspect.service.impl;
import com.zjty.inspect.dao.ReportDao; import com.zjty.inspect.dao.ReportDao;
import com.zjty.inspect.entity.InspectParameter; import com.zjty.inspect.entity.*;
import com.zjty.inspect.entity.Report;
import com.zjty.inspect.entity.ReportVo;
import com.zjty.inspect.enums.Language; import com.zjty.inspect.enums.Language;
import com.zjty.inspect.service.InspectService; import com.zjty.inspect.service.InspectService;
import com.zjty.inspect.inspect.Inspector; import com.zjty.inspect.inspect.Inspector;
import com.zjty.inspect.service.ParameterService; import com.zjty.inspect.service.ParameterService;
import com.zjty.inspect.service.TechnologyService;
import com.zjty.inspect.utils.FileUtil;
import com.zjty.inspect.utils.FreemarkerUtils;
import com.zjty.inspect.utils.RandomUtil; import com.zjty.inspect.utils.RandomUtil;
import com.zjty.inspect.utils.TimeUtil;
import freemarker.cache.StringTemplateLoader; import freemarker.cache.StringTemplateLoader;
import freemarker.template.Configuration; import freemarker.template.Configuration;
import freemarker.template.Template; import freemarker.template.Template;
import freemarker.template.TemplateException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.freemarker.FreeMarkerTemplateUtils; import org.springframework.ui.freemarker.FreeMarkerTemplateUtils;
import java.io.File;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
...@@ -33,6 +38,8 @@ public class InspectServiceImpl implements InspectService { ...@@ -33,6 +38,8 @@ public class InspectServiceImpl implements InspectService {
@Autowired @Autowired
private ReportDao reportDao; private ReportDao reportDao;
@Autowired
private TechnologyService technologyService;
@Autowired @Autowired
private ParameterService parameterService; private ParameterService parameterService;
...@@ -64,8 +71,44 @@ public class InspectServiceImpl implements InspectService { ...@@ -64,8 +71,44 @@ public class InspectServiceImpl implements InspectService {
return reportVoReturn; return reportVoReturn;
} }
/**
* 处理数据
* @return
* count 总共的关键技术
* notSupport 不支持的关键技术数量
*/
@Override
public String freemakerData(ReportVo inspect, int count, int notSupport) {
try {
Map map = new HashMap();
map.put("inspect", inspect);
map.put("time", TimeUtil.getTime());
HashMap<String, List<Warn>> warnMap = inspect.getWarnDetails();
List<Technology> technologies = technologyService.findAllTechnology();
Map techMap = new HashMap();
for (Technology technology : technologies) {
techMap.put(technology.getTechnologyName(), technology.getSupport());
}
map.put("techMap", techMap);
map.put("count",count);
map.put("notSupport",notSupport);
map.put("warnMap", warnMap);
map.put("technologies", technologies);
String template = FreemarkerUtils.getTemplate("pg.ftl", map);
String s = generateHtml(template, map);
String filePath = FileUtil.createFilePath();
FileUtil.write(s,"/opt/inspect/freemaker/"+filePath+"/"+inspect.getProjectName()+".html");
String fn="/freemaker/"+filePath+"/"+inspect.getProjectName()+".html";
return fn;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
//执行静态化 //执行静态化
public String generateHtml(String templateContent,Map model ){ public String generateHtml(String templateContent,Map model ){
//创建配置对象 //创建配置对象
Configuration configuration = new Configuration(Configuration.getVersion()); Configuration configuration = new Configuration(Configuration.getVersion());
//创建模板加载器 //创建模板加载器
...@@ -85,4 +128,6 @@ public class InspectServiceImpl implements InspectService { ...@@ -85,4 +128,6 @@ public class InspectServiceImpl implements InspectService {
return null; return null;
} }
} }
...@@ -118,7 +118,7 @@ public class RuleServiceImpl implements RuleService { ...@@ -118,7 +118,7 @@ public class RuleServiceImpl implements RuleService {
@Override @Override
public void upRule(RuleQo ruleQo) { public void upRule(RuleQo ruleQo) {
Rule rule1 = ruleDao.findByTarget(ruleQo.getId()); Rule rule1 = ruleDao.findByTarget(ruleQo.getId());
if (rule1 == null) { if (rule1 != null) {
return; return;
} }
rule1.setTarget(ruleQo.getTarget()); rule1.setTarget(ruleQo.getTarget());
......
...@@ -224,8 +224,8 @@ ...@@ -224,8 +224,8 @@
<div class="line"></div> <div class="line"></div>
<div class="onAnaly" id="thirdClick"> <div class="onAnaly" id="thirdClick">
<div class="onAonAnalysis">关键技术总共:<span>1000</span></div> <div class="onAonAnalysis">关键技术总共:<span>${count?default("0")}</span></div>
<div class="onAonAnalysis">需要改造的关键技术:<span>1000</span></div> <div class="onAonAnalysis">需要改造的关键技术:<span>${notSupport?default("0")}</span></div>
<div class="onAonAnalysis">泰源系统安可改造评估引擎:<span>版本号:10.6.9</span></div> <div class="onAonAnalysis">泰源系统安可改造评估引擎:<span>版本号:10.6.9</span></div>
</div> </div>
</div> </div>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论