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

sds

上级 d482af48
......@@ -22,6 +22,7 @@ import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* @author mcj
......@@ -182,8 +183,18 @@ public class EvaluationController {
}else{
wps.put("agree", "不同意");
}
Set<String> strings = wps.keySet();
for (String str : strings) {
String s = wps.get(str);
if(!StringUtils.isEmpty(s)&&s.equals("-1")){
wps.put(str,"0");
}else if(StringUtils.isEmpty(s)){
wps.put(str,"无");
}
}
String w = FreeMakerUtils.parseTpl("reportTemplate", wps);
if(w==null){
if(StringUtils.isEmpty(w)){
return ServerResponse.error(500);
}
return ServerResponse.ok(w);
......
......@@ -13,18 +13,16 @@ import java.util.Map;
public class FreeMakerUtils {
public static String parseTpl(String viewName, Map params) {
// Configuration cfg = SpringContextHolder.getBean(Configuration.class);
Configuration cfg = new Configuration();
cfg.setClassForTemplateLoading(FreeMakerUtils.class, "/templates/");
Template t = null;
try {
t = cfg.getTemplate(viewName + ".ftl");
Configuration cfg = new Configuration();
cfg.setClassForTemplateLoading(FreeMakerUtils.class, "/templates/");
Template t = cfg.getTemplate(viewName + ".ftl");
String word = createWord(t, params);
return "/doc/"+word;
} catch (Exception e) {
e.printStackTrace();
return null;
}
return null;
}
public static String createWord(Template template, Map<String, List<TechnologyContent>> dataMap){
try {
......
......@@ -42,16 +42,32 @@ public class WpsUtil {
keyValue.put("applicationType" + i + 1, ApplicationType.getByCode(code).getName());
}
keyValue.put("time", String.valueOf(reform.getTime()));
keyValue.put("tableNum", String.valueOf(reform.getTableNum()));
if(StringUtils.isEmpty(String.valueOf(reform.getTime()))){
keyValue.put("time", "0");
}
keyValue.put("tableNum", "0");
if(!StringUtils.isEmpty(String.valueOf(reform.getTableNum()))){
keyValue.put("tableNum", String.valueOf(reform.getTableNum()));
}
keyValue.put("databaseNum", String.valueOf(reform.getDatabaseNum()));
keyValue.put("strategy", strategyToString(reform.getStrategy()));
keyValue.put("rto", RtoEnum.getByCode(reform.getRto()).getName());
keyValue.put("rpo", RpoEnum.getByCode(reform.getRpo()).getName());
keyValue.put("unitName", reform.getUnitName());
keyValue.put("unitName","无");
if(!StringUtils.isEmpty(reform.getUnitName())){
keyValue.put("unitName",reform.getUnitName() );
}
keyValue.put("unitPhone", reform.getUnitPhone());
keyValue.put("unitContent", reform.getUnitContent());
keyValue.put("gradeProtection", flipYesOrNo(reform.getGradeProtection()));
keyValue.put("cycle", String.valueOf(reform.getCycle()));
if(reform.getCycle()==null){
keyValue.put("cycle","0" );
}
SystemStructure systemStructure = reform.getSystemStructure();
Details application = systemStructure.getApplication();
getSys("application", application, keyValue);
......@@ -114,7 +130,14 @@ public class WpsUtil {
Apply apply = reform.getApply();
keyValue.put("applyCost", String.valueOf(apply.getCost()));
keyValue.put("applyReason", apply.getReason());
if(StringUtils.isEmpty(String.valueOf(apply.getCost()))||apply.getCost()==-1) {
keyValue.put("applyCost", "0");
}
if(!StringUtils.isEmpty(apply.getReason())&&apply.getReason().equals("-1")) {
keyValue.put("applyReason","无");
}else {
keyValue.put("applyReason",apply.getReason());
}
DevelopLanguageSystem developLanguageSystem = reform.getDevelopLanguageSystem();
keyValue.put("language", developLanguageSystem.getName());
......@@ -134,12 +157,18 @@ public class WpsUtil {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String format = simpleDateFormat.format(assessmentReport.getTime());
keyValue.put("inspectTime", format);
keyValue.put("createTime", System.currentTimeMillis() + "");
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
String f = sdf.format(assessmentReport.getTime());
keyValue.put("createTime", f);
keyValue.put("difficulty", String.valueOf(assessmentReport.getDifficulty()));
keyValue.put("budget", assessmentReport.getBudget());
SysScale sysScale = assessmentReport.getSysScale();
keyValue.put("sysScaleCodeNum", sysScale.getCode().getNum().toString());
if(StringUtils.isEmpty(sysScale.getCode().getNum().toString())||sysScale.getCode().getNum()==-1) {
keyValue.put("sysScaleCodeNum", "0");
}else{
keyValue.put("sysScaleCodeNum", sysScale.getCode().getNum().toString());
}
keyValue.put("sysScaleCodeDes", sysScale.getCode().getDes());
keyValue.put("sysScaleFileNum", sysScale.getFile().getNum().toString());
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论