提交 3223f7ff authored 作者: liujie's avatar liujie

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

......@@ -5,6 +5,7 @@ import com.zjty.inspect.dao.ConfigParamDao;
import com.zjty.inspect.entity.*;
import com.zjty.inspect.enums.LanguageEnum;
import com.zjty.inspect.service.*;
import com.zjty.inspect.thread.task.AsyncTask;
import com.zjty.inspect.utils.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -53,6 +54,8 @@ public class InspectController {
@Value("${upload.location}")
private String uploadPath;
@Autowired
private AsyncTask asyncTask;
//应用类型转换:小型0
Integer[] small = {3, 4};
//应用类型转换:中型2
......@@ -390,6 +393,7 @@ public class InspectController {
private ResponseEntity uploads(@RequestParam(value = "file") MultipartFile multfile) {
try {
File file = FileUtil.saveToLocal(multfile);
String name = file.getName();
String path = file.getCanonicalPath();
return ResponseEntity.ok(new com.zjty.inspect.entity.File(name, path));
......
......@@ -261,6 +261,7 @@ public class Inspector {
* 比对源文件数量得出语言架构
*/
private void setReportLanguageAndFrame() {
HashSet<LanguageEnum> languageEnums = new HashSet<>();
String most = null;
int mostStatus = 0;
int maxnum = 0;
......@@ -272,20 +273,28 @@ public class Inspector {
mostStatus = language.getCode();
maxnum = entry.getValue().getNumber();
}
if (entry.getValue().getNumber() > 0) {
LanguageEnum language = suffixLanguageMapping.get(entry.getKey());
languageEnums.add(language);
}
//设置语言
report.setLanguage(most == null ? LanguageEnum.NONE.getCode() : mostStatus);
//设置架构
report.setFramework(languageMatchMap.get("jsp").i > 0 ? Framework.MIXTURE.getStatus() : Framework.SEPARATE.getStatus());
//设置是否需要重构
if (languageMatchMap.get("jsp").i == 0 & languageMatchMap.get("java").i == 0) {
}
List<LanguageEnum> languageEnums1 = languageEnums.stream()
.filter(e -> e.getCode() != 4 & e.getCode() != 5 & e.getCode() != 6)
.collect(Collectors.toList());
if (!languageEnums1.isEmpty()) {
report.setRecastMethod(RecastMethod.RECONSITUTION.getStatus());
log.info("inspect:代码解析完成,建议进行适配重构");
} else {
report.setRecastMethod(RecastMethod.MODIFICATION.getStatus());
log.info("inspect:代码解析完成,建议进行代码修改");
}
//设置语言
report.setLanguage(most == null ? LanguageEnum.NONE.getCode() : mostStatus);
//设置架构
report.setFramework(languageMatchMap.get("jsp").i > 0 ? Framework.MIXTURE.getStatus() : Framework.SEPARATE.getStatus());
//设置是否需要重构
}
/**
......@@ -605,8 +614,8 @@ public class Inspector {
try {
List<String> allLines = Files.readAllLines(file);
fileLine += allLines.size();
}catch (IOException e){
log.error("当前文件无法读取:{}",e.getMessage());
} catch (IOException e) {
log.error("当前文件无法读取:{}", e.getMessage());
}
for (Map.Entry<String, PathMatcher> entry : languageSuffixMatcherMapping.entrySet()) {
......
......@@ -42,9 +42,7 @@ public class DocumentServiceImpl implements DocumentService {
String name = titleHead.getName();
if (!StringUtils.isEmpty(name)) {
//标题级别
int parentId = titleHead.getParentId();
String s = titleContent.replaceAll("#title#", name)
.replaceAll("#parentId#", String.valueOf(parentId));
String s = titleContent.replaceAll("#title#", name);
sb.append(s);
}
List<DocumentContent> documentContents = titleHead.getDocumentContents();
......
......@@ -2,6 +2,7 @@ package com.zjty.inspect.utils;
import com.zjty.inspect.entity.DocumentContent;
import com.zjty.inspect.entity.DocumentPage;
import com.zjty.inspect.entity.TechnologyContent;
import com.zjty.inspect.entity.TitleHead;
import com.zjty.inspect.enums.DocumentTitleEnum;
import org.springframework.util.StringUtils;
......@@ -96,47 +97,25 @@ public class DocumentWordUtil {
}
public static String getTableString(List<String> tables,int col){
int i=8818/col;
public static String getTableString(List<TechnologyContent> tables, String technologyName, String stra){
//key 表格标题,value 内容
String standtab = standtab();
String tabtr = tabtr();
String tatr = Matcher.quoteReplacement(tabtr);
String tabtb = tabtb();
String tatb = Matcher.quoteReplacement(tabtb);
String s3 = tableTile(technologyName, stra);
String s4 = Matcher.quoteReplacement(s3);
StringBuilder sb=new StringBuilder();
StringBuilder sb1=new StringBuilder();
sb.append(s4);
for (int j = 0; j < tables.size(); j++) {
if(j==0){
String gettr = gettb(tatr, i, tables.get(j));
sb.append(gettr);
continue;
}
System.out.println(tabtb);
String gettb = gettb(tatb, i, tables.get(j));
sb1.append(gettb);
String gettb = gettb(tables.get(j));
String s1 = Matcher.quoteReplacement(gettb);
sb.append(s1);
}
String sta = Matcher.quoteReplacement(standtab);
String s1 = Matcher.quoteReplacement(sb.toString());
String s2 = Matcher.quoteReplacement(sb1.toString());
String s = sta.replaceAll( "#tc1#",s1).replaceAll( "#tb1#",s2);
System.out.println(s);
return s;
sb.append("</w:tbl>");
return sb.toString();
}
public static String gettb(String tb,int i,String key){
public static String gettb(TechnologyContent technologyContent){
StringBuilder sb=new StringBuilder();
String biaoge = biaoge();
String biaoge = biaoge(technologyContent);
sb.append(biaoge);
String keys = Matcher.quoteReplacement(key);
String[] split = keys.split(",");
for (String s : split) {
System.out.println(s);
String s1 = tb.replaceAll("#target#",s );
String s2 = s1.replaceAll("#colW#", "" + i);
sb.append(s2);
}
sb.append("</w:tr>");
return sb.toString();
}
......@@ -485,6 +464,136 @@ public class DocumentWordUtil {
" <w:docGrid w:type=\"lines\" w:line-pitch=\"312\"/>\n" +
" </w:sectPr>";
}
public static String tableTile(String technologyName,String strategy){
return " <w:p>\n" +
" <w:pPr>\n" +
" <w:tabs>\n" +
" <w:tab w:val=\"left\" w:pos=\"5422\"/>\n" +
" </w:tabs>\n" +
" </w:pPr>\n" +
" <w:r><w:rPr><w:rFonts w:hint=\"fareast\"/></w:rPr><w:t>关键技术:"+technologyName+"</w:t></w:r><w:r>\n" +
" <w:rPr>\n" +
" <w:rFonts w:hint=\"fareast\"/>\n" +
" </w:rPr>\n" +
" <w:tab/>\n" +
" </w:r>\n" +
" <w:r><w:rPr><w:rFonts w:hint=\"fareast\"/></w:rPr><w:t>替换策略:"+strategy+"</w:t></w:r></w:p>"+"<w:tbl>\n" +
" <w:tblPr>\n" +
" <w:tblStyle w:val=\"a13\"/>\n" +
" <w:tblW w:w=\"0\" w:type=\"auto\"/>\n" +
" <w:tblInd w:w=\"0\" w:type=\"dxa\"/>\n" +
" <w:tblBorders>\n" +
" <w:top w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/>\n" +
" <w:left w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/>\n" +
" <w:bottom w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/>\n" +
" <w:right w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/>\n" +
" <w:insideH w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/>\n" +
" <w:insideV w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/>\n" +
" </w:tblBorders>\n" +
" <w:tblCellMar>\n" +
" <w:top w:w=\"0\" w:type=\"dxa\"/>\n" +
" <w:left w:w=\"108\" w:type=\"dxa\"/>\n" +
" <w:bottom w:w=\"0\" w:type=\"dxa\"/>\n" +
" <w:right w:w=\"108\" w:type=\"dxa\"/>\n" +
" </w:tblCellMar>\n" +
" </w:tblPr>\n" +
" <w:tblGrid>\n" +
" <w:gridCol w:w=\"1161\"/>\n" +
" <w:gridCol w:w=\"6515\"/>\n" +
" <w:gridCol w:w=\"846\"/>\n" +
" </w:tblGrid>\n" +
" <w:tr>\n" +
" <w:tblPrEx>\n" +
" <w:tblBorders>\n" +
" <w:top w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/>\n" +
" <w:left w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/>\n" +
" <w:bottom w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/>\n" +
" <w:right w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/>\n" +
" <w:insideH w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/>\n" +
" <w:insideV w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/>\n" +
" </w:tblBorders>\n" +
" <w:tblCellMar>\n" +
" <w:top w:w=\"0\" w:type=\"dxa\"/>\n" +
" <w:left w:w=\"108\" w:type=\"dxa\"/>\n" +
" <w:bottom w:w=\"0\" w:type=\"dxa\"/>\n" +
" <w:right w:w=\"108\" w:type=\"dxa\"/>\n" +
" </w:tblCellMar>\n" +
" </w:tblPrEx>\n" +
" <w:trPr/>\n" +
" <w:tc>\n" +
" <w:tcPr>\n" +
" <w:tcW w:w=\"579\" w:type=\"dxa\"/>\n" +
" <w:shd w:val=\"clear\" w:color=\"auto\" w:fill=\"auto\"/>\n" +
" </w:tcPr>\n" +
" <w:p>\n" +
" <w:pPr>\n" +
" <w:spacing w:line=\"240\" w:line-rule=\"auto\"/>\n" +
" <w:jc w:val=\"center\"/>\n" +
" <w:rPr>\n" +
" <w:sz w:val=\"21\"/>\n" +
" <w:sz-cs w:val=\"21\"/>\n" +
" </w:rPr>\n" +
" </w:pPr>\n" +
" <w:r>\n" +
" <w:rPr>\n" +
" <w:rFonts w:hint=\"fareast\"/>\n" +
" <w:sz w:val=\"21\"/>\n" +
" <w:sz-cs w:val=\"21\"/>\n" +
" </w:rPr>\n" +
" <w:t>关键字</w:t>\n" +
" </w:r>\n" +
" </w:p>\n" +
" </w:tc>\n" +
" <w:tc>\n" +
" <w:tcPr>\n" +
" <w:tcW w:w=\"7484\" w:type=\"dxa\"/>\n" +
" <w:shd w:val=\"clear\" w:color=\"auto\" w:fill=\"auto\"/>\n" +
" </w:tcPr>\n" +
" <w:p>\n" +
" <w:pPr>\n" +
" <w:spacing w:line=\"240\" w:line-rule=\"auto\"/>\n" +
" <w:jc w:val=\"center\"/>\n" +
" <w:rPr>\n" +
" <w:sz w:val=\"21\"/>\n" +
" <w:sz-cs w:val=\"21\"/>\n" +
" </w:rPr>\n" +
" </w:pPr>\n" +
" <w:r>\n" +
" <w:rPr>\n" +
" <w:rFonts w:hint=\"fareast\"/>\n" +
" <w:sz w:val=\"21\"/>\n" +
" <w:sz-cs w:val=\"21\"/>\n" +
" </w:rPr>\n" +
" <w:t>所在文件</w:t>\n" +
" </w:r>\n" +
" </w:p>\n" +
" </w:tc>\n" +
" <w:tc>\n" +
" <w:tcPr>\n" +
" <w:tcW w:w=\"459\" w:type=\"dxa\"/>\n" +
" <w:shd w:val=\"clear\" w:color=\"auto\" w:fill=\"auto\"/>\n" +
" </w:tcPr>\n" +
" <w:p>\n" +
" <w:pPr>\n" +
" <w:spacing w:line=\"240\" w:line-rule=\"auto\"/>\n" +
" <w:jc w:val=\"center\"/>\n" +
" <w:rPr>\n" +
" <w:sz w:val=\"21\"/>\n" +
" <w:sz-cs w:val=\"21\"/>\n" +
" </w:rPr>\n" +
" </w:pPr>\n" +
" <w:r>\n" +
" <w:rPr>\n" +
" <w:rFonts w:hint=\"fareast\"/>\n" +
" <w:sz w:val=\"21\"/>\n" +
" <w:sz-cs w:val=\"21\"/>\n" +
" </w:rPr>\n" +
" <w:t>位置</w:t>\n" +
" </w:r>\n" +
" </w:p>\n" +
" </w:tc>\n" +
" </w:tr>\n";
}
public static String enddard(){
return "<w:sectPr>\n" +
" <w:hdr w:type=\"odd\">\n" +
......@@ -1277,23 +1386,16 @@ public class DocumentWordUtil {
" <wx:sect>\n";
return str;
}
public static String biaoge(){
public static String biaoge(TechnologyContent content){
return "<w:tr>\n" +
" <w:tblPrEx>\n" +
" <w:tblBorders>\n" +
" <w:top w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/>\n" +
" <w:left\n" +
" w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/>\n" +
" <w:bottom w:val=\"single\" w:sz=\"4\"\n" +
" wx:bdrwidth=\"10\" w:space=\"0\"\n" +
" w:color=\"auto\"/>\n" +
" <w:right\n" +
" w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/>\n" +
" <w:insideH w:val=\"single\" w:sz=\"4\"\n" +
" wx:bdrwidth=\"10\" w:space=\"0\"\n" +
" w:color=\"auto\"/>\n" +
" <w:insideV\n" +
" w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/>\n" +
" <w:left w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/>\n" +
" <w:bottom w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/>\n" +
" <w:right w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/>\n" +
" <w:insideH w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/>\n" +
" <w:insideV w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/>\n" +
" </w:tblBorders>\n" +
" <w:tblCellMar>\n" +
" <w:top w:w=\"0\" w:type=\"dxa\"/>\n" +
......@@ -1303,8 +1405,81 @@ public class DocumentWordUtil {
" </w:tblCellMar>\n" +
" </w:tblPrEx>\n" +
" <w:trPr>\n" +
" <w:trHeight w:val=\"400\" w:h-rule=\"atLeast\"/>\n" +
" </w:trPr>";
" <w:trHeight w:val=\"756\" w:h-rule=\"atLeast\"/>\n" +
" </w:trPr>\n" +
" <w:tc>\n" +
" <w:tcPr>\n" +
" <w:tcW w:w=\"0\" w:type=\"auto\"/>\n" +
" <w:shd w:val=\"clear\" w:color=\"auto\" w:fill=\"auto\"/>\n" +
" </w:tcPr>\n" +
" <w:p>\n" +
" <w:pPr>\n" +
" <w:spacing w:line=\"240\" w:line-rule=\"auto\"/>\n" +
" <w:jc w:val=\"center\"/>\n" +
" <w:rPr>\n" +
" <w:sz w:val=\"21\"/>\n" +
" <w:sz-cs w:val=\"21\"/>\n" +
" </w:rPr>\n" +
" </w:pPr>\n" +
" <w:r>\n" +
" <w:rPr>\n" +
" <w:rFonts w:hint=\"fareast\"/>\n" +
" <w:sz w:val=\"21\"/>\n" +
" <w:sz-cs w:val=\"21\"/>\n" +
" </w:rPr>\n" +
" <w:t>"+content.getKeyWord()+"</w:t>\n" +
" </w:r>\n" +
" </w:p>\n" +
" </w:tc>\n" +
" <w:tc>\n" +
" <w:tcPr>\n" +
" <w:tcW w:w=\"0\" w:type=\"auto\"/>\n" +
" <w:shd w:val=\"clear\" w:color=\"auto\" w:fill=\"auto\"/>\n" +
" </w:tcPr>\n" +
" <w:p>\n" +
" <w:pPr>\n" +
" <w:spacing w:line=\"240\" w:line-rule=\"auto\"/>\n" +
" <w:jc w:val=\"center\"/>\n" +
" <w:rPr>\n" +
" <w:sz w:val=\"21\"/>\n" +
" <w:sz-cs w:val=\"21\"/>\n" +
" </w:rPr>\n" +
" </w:pPr>\n" +
" <w:r>\n" +
" <w:rPr>\n" +
" <w:rFonts w:hint=\"fareast\"/>\n" +
" <w:sz w:val=\"21\"/>\n" +
" <w:sz-cs w:val=\"21\"/>\n" +
" </w:rPr>\n" +
" <w:t>"+content.getFile()+"</w:t>\n" +
" </w:r>\n" +
" </w:p>\n" +
" </w:tc>\n" +
" <w:tc>\n" +
" <w:tcPr>\n" +
" <w:tcW w:w=\"0\" w:type=\"auto\"/>\n" +
" <w:shd w:val=\"clear\" w:color=\"auto\" w:fill=\"auto\"/>\n" +
" </w:tcPr>\n" +
" <w:p>\n" +
" <w:pPr>\n" +
" <w:spacing w:line=\"240\" w:line-rule=\"auto\"/>\n" +
" <w:jc w:val=\"center\"/>\n" +
" <w:rPr>\n" +
" <w:sz w:val=\"21\"/>\n" +
" <w:sz-cs w:val=\"21\"/>\n" +
" </w:rPr>\n" +
" </w:pPr>\n" +
" <w:r>\n" +
" <w:rPr>\n" +
" <w:rFonts w:hint=\"fareast\"/>\n" +
" <w:sz w:val=\"21\"/>\n" +
" <w:sz-cs w:val=\"21\"/>\n" +
" </w:rPr>\n" +
" <w:t>"+content.getPosition()+"</w:t>\n" +
" </w:r>\n" +
" </w:p>\n" +
" </w:tc>\n" +
" </w:tr>";
}
public static String createDocument(DocumentPage documentPage) {
......
......@@ -10,7 +10,7 @@ import java.util.Map;
public class FreeMakerUtils {
public static String parseTpl(String viewName, Map<String, List<TechnologyContent>> params) {
public static String parseTpl(String viewName, Map params) {
Configuration cfg = SpringContextHolder.getBean(Configuration.class);
String html = null;
Template t = null;
......@@ -18,7 +18,7 @@ public class FreeMakerUtils {
t = cfg.getTemplate(viewName + ".ftl");
createWord(t,params);
// html = FreeMarkerTemplateUtils.processTemplateIntoString(t, params);
System.out.println(html);
// System.out.println(html);
} catch (Exception e) {
e.printStackTrace();
}
......@@ -78,5 +78,32 @@ public class FreeMakerUtils {
}
}
}
public static void createStringTemplate(Map map,String template){
try {
//文件路径
String filePath= "E://doc";
//文件名称
String fileName = System.currentTimeMillis()+".doc";
// 输出文件
File outFile = new File(filePath + File.separator + fileName);
// 如果输出目标文件夹不存在,则创建
if (!outFile.getParentFile().exists()) {
outFile.getParentFile().mkdirs();
}
// 将模板和数据模型合并生成文件
Writer out = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(outFile), "UTF-8"));
Template t = new Template("template", new StringReader(template), new Configuration(Configuration.VERSION_2_3_23));
t.process(map,out);
// 关闭流
out.flush();
out.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
......@@ -3,13 +3,12 @@ package com.zjty.inspect.utils;
import com.alibaba.fastjson.JSON;
import com.zjty.inspect.entity.*;
import com.zjty.inspect.enums.*;
import io.netty.util.internal.StringUtil;
import org.springframework.util.StringUtils;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* @author Mcj
......@@ -19,6 +18,7 @@ import java.util.Map;
public class WpsUtil {
public static Map<String,String> createWps(Evaluation evaluation) {
HashMap<String,List<TechnologyContent>> teMap=new HashMap<>();
Reform reform = JSON.parseObject(evaluation.getInEva(), Reform.class);
AssessmentReport assessmentReport = JSON.parseObject(evaluation.getOutEva(), AssessmentReport.class);
HashMap<String, String> keyValue = new HashMap<>();
......@@ -38,6 +38,7 @@ public class WpsUtil {
keyValue.put("safe",flipSafeStrong(reform.getSafe()));
keyValue.put("framework",Framework.getByCode(reform.getFramework()).getName());
for (int i = 0; i < reform.getApplicationType().size(); i++) {
Integer code = reform.getApplicationType().get(i);
keyValue.put("applicationType"+i+1,ApplicationType.getByCode(code).getName());
}
......@@ -71,36 +72,34 @@ public class WpsUtil {
getSys("vps",vps,keyValue);
Browser browser = reform.getBrowser();
List<BaseDes> compatibleBrowsers = browser.getCompatibleBrowsers();
for (int i = 0; i < compatibleBrowsers.size(); i++) {
int i1 = i + 1;
keyValue.put("compatibleBrowsers"+i1, compatibleBrowsers.get(i).getName());
}
List<BaseDes> browserPlugs = browser.getBrowserPlugs();
for (int i = 0; i < browserPlugs.size(); i++) {
keyValue.put("browserPlugs"+i+1, browserPlugs.get(i).getName());
}
repairMap("compatibleBrowsers", 13, browser.getCompatibleBrowsers(), keyValue);
repairMap("browserPlugs",13,browser.getBrowserPlugs(),keyValue);
repairMap("middleware",13,reform.getMiddleware().getMiddlewareEnums(),keyValue);
Middleware middleware = reform.getMiddleware();
for (int i = 0; i < middleware.getMiddlewareEnums().size(); i++) {
int i1 = i + 1;
keyValue.put("middleware"+i1, middleware.getMiddlewareEnums().get(i).getName());
}
List<OtherApi> otherApis = middleware.getOtherApis();
for (int i = 0; i < otherApis.size(); i++) {
for (int i = 0; i < 13; i++) {
int i1 = i + 1;
keyValue.put("otherApi"+i1, otherApis.get(i).getApiName());
if(i>=otherApis.size()){
keyValue.put("otherApi"+i1, "无");
continue;
}
for (int i = 0; i < middleware.getMicroServices().size(); i++) {
int i1 = i + 1;
keyValue.put("microService"+i1, middleware.getMicroServices().get(i).getName());
keyValue.put("otherApi"+i1, otherApis.get(i).getApiName());
}
repairMap("microService",13,middleware.getMicroServices(),keyValue);
Database database1 = reform.getDatabase();
for (int i = 0; i < database1.getDatabaseType().size(); i++) {
for (int i = 0; i < 13; i++) {
int i1 = i + 1;
if(i>=database1.getDatabaseType().size()){
keyValue.put("database"+i1, "无");
continue;
}
keyValue.put("database"+i1, database1.getDatabaseType().get(i).getName());
}
keyValue.put("databaseView", flipYesOrNo(database1.getView()));
keyValue.put("databaseStorage", flipYesOrNo(database1.getStorage()));
keyValue.put("databaseFunction", flipYesOrNo(database1.getFunction()));
......@@ -120,26 +119,13 @@ public class WpsUtil {
DevelopLanguageSystem developLanguageSystem = reform.getDevelopLanguageSystem();
keyValue.put("language",developLanguageSystem.getName());
for (int i = 0; i < developLanguageSystem.getDevFrameworks().size(); i++) {
int i1 = i + 1;
keyValue.put("devFrameworks"+i1, developLanguageSystem.getDevFrameworks().get(i).getName());
}
for (int i = 0; i < developLanguageSystem.getFontDevTechnologies().size(); i++) {
int i1 = i + 1;
keyValue.put("fontDevTechnologies"+i1, developLanguageSystem.getFontDevTechnologies().get(i).getName());
}
for (int i = 0; i < developLanguageSystem.getCsDevTechnologies().size(); i++) {
int i1 = i + 1;
keyValue.put("csDevTechnologies"+i1, developLanguageSystem.getCsDevTechnologies().get(i).getName());
}
for (int i = 0; i < developLanguageSystem.getOpGAs().size(); i++) {
int i1 = i + 1;
keyValue.put("opGAs"+i1, developLanguageSystem.getOpGAs().get(i).getName());
}
for (int i = 0; i < developLanguageSystem.getDevLanguages().size(); i++) {
int i1 = i + 1;
keyValue.put("devLanguages"+i1, developLanguageSystem.getDevLanguages().get(i).getName());
}
repairMap("devFrameworks",13,developLanguageSystem.getDevFrameworks(),keyValue);
repairMap("fontDevTechnologies",13,developLanguageSystem.getFontDevTechnologies(),keyValue);
repairMap("csDevTechnologies",13,developLanguageSystem.getCsDevTechnologies(),keyValue);
repairMap("opGAs",13,developLanguageSystem.getOpGAs(),keyValue);
repairMap("devLanguages",13,developLanguageSystem.getDevLanguages(),keyValue);
LocalSystemDep localSystemDep = reform.getLocalSystemDep();
keyValue.put("localSystemDepName", localSystemDep.getName());
......@@ -149,6 +135,7 @@ 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()+"");
keyValue.put("difficulty",String.valueOf(assessmentReport.getDifficulty()));
keyValue.put("budget",assessmentReport.getBudget());
......@@ -178,6 +165,32 @@ public class WpsUtil {
keyValue.put("technologyContentStrategy"+i2+"-"+i3, getMode(technologyContent.getStrategy()));
}
}
for (TechnologyReport technologyReport : technologyReports) {
teMap.put(technologyReport.getTechnology(),technologyReport.getTechnologyContents());
}
Set<String> strings = teMap.keySet();
StringBuilder youhua=new StringBuilder();
StringBuilder xiugai=new StringBuilder();
StringBuilder weizhi=new StringBuilder();
for (String string : strings) {
if(string.contains("优化")){
List<TechnologyContent> technologyContents = teMap.get(string);
String str = DocumentWordUtil.getTableString(technologyContents, string, "优化");
youhua.append(str);
}else if(string.contains("不支持")){
List<TechnologyContent> technologyContents = teMap.get(string);
String str = DocumentWordUtil.getTableString(technologyContents, string, "重新开发");
xiugai.append(str);
}else if(string.contains("未知")){
List<TechnologyContent> technologyContents = teMap.get(string);
String str = DocumentWordUtil.getTableString(technologyContents, string, "验证修改或重新开发");
weizhi.append(str);
}
}
keyValue.put("teyouhua",youhua.toString());
keyValue.put("texiugai",xiugai.toString());
keyValue.put("teweizhi",weizhi.toString());
Workload workload = assessmentReport.getWorkload();
keyValue.put("workloadDes",workload.getDes());
keyValue.put("workloadCost",String.valueOf(workload.getCost()));
......@@ -251,16 +264,16 @@ public class WpsUtil {
ProgramDifficulty programDifficulty = difficultyAssessment.getProgramDifficulty();
keyValue.put("programDifficultyDifficulty",String.valueOf(programDifficulty.getDifficulty()));
keyValue.put("programDifficultyLoad",String.valueOf(programDifficulty.getLoad()));
FreeMakerUtils.parseTpl("报告模板",keyValue);
return keyValue;
}
public static DocumentContent setDocumentTable(List<String> data,int col){
String tableString = DocumentWordUtil.getTableString(data, col);
DocumentContent documentContent = new DocumentContent();
//设置进head标题下面的表格中
documentContent.setDocumentTable(tableString);
return documentContent;
// String tableString = DocumentWordUtil.getTableString(data, col);
// DocumentContent documentContent = new DocumentContent();
// 设置进head标题下面的表格中
// documentContent.setDocumentTable(tableString);
return null;
}
public static List<DocumentContent> setDocumentContents(DocumentContent documentContent){
ArrayList<DocumentContent> documentContents = new ArrayList<>();
......@@ -415,4 +428,28 @@ public class WpsUtil {
keyValue.put(sysName+"Edition",application.getEdition());
keyValue.put(sysName+"Memory",application.getMemory());
}
private static void repairMap(String name,int size, List<BaseDes> list, Map<String, String> keyValue){
if(list!=null&&list.size()>0){
int len=list.size();
for (int i = 0; i < size; i++) {
int i1 = i + 1;
if(len>i){
if(!StringUtils.isEmpty(list.get(i).getName())) {
keyValue.put(name+ i1,list.get(i).getName());
}else{
keyValue.put(name + i1,"无" );
}
}else {
keyValue.put(name+i1, "无");
}
}
}else{
for (int i = 0; i < size; i++) {
int i1 = i + 1;
keyValue.put(name+i1, "无");
}
}
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论