提交 96e59986 authored 作者: liujie's avatar liujie

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

Conflicts: src/main/java/com/zjty/inspect/controller/EvaluationController.java src/main/resources/application.properties
......@@ -54,7 +54,7 @@ public class AopIntercept {
String url = "http://"+address+":12345/user/getLogin/"+sessionId;
ServerResponse serverResponse = restTemplate.getForObject(url, ServerResponse.class);
if(serverResponse!=null && serverResponse.getCode()!=200){
ResponseEntity.status(403).build();
ResponseEntity.status(403).body(1);
}
User user = serverResponse.getData();
AuthAnnotation authAnnotation = ((MethodSignature)joinPoint.getSignature()).getMethod().getAnnotation(AuthAnnotation.class);
......@@ -77,7 +77,7 @@ public class AopIntercept {
}
}
}
return ResponseEntity.status(403).build();
return ResponseEntity.status(403).body("f");
}
}
......@@ -5,6 +5,7 @@ import com.zjty.inspect.aop.AuthAnnotation;
import com.zjty.inspect.entity.*;
import com.zjty.inspect.service.EvaluationService;
import com.zjty.inspect.utils.ExcelUtil;
import com.zjty.inspect.utils.WpsUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
......@@ -21,48 +22,50 @@ import java.util.Map;
@RestController
@RequestMapping("/evaluation")
@Api(value = "评估报告管理接口",description = "评估报告管理接口,提供页面的增、删、改、查")
@Api(value = "评估报告管理接口", description = "评估报告管理接口,提供页面的增、删、改、查")
public class EvaluationController {
@Autowired
private EvaluationService evaluationService;
/**
* 新增评估报告
*
* @param evaluation 评估报告
* @return
*/
@PostMapping
@ApiOperation("新增评估报告")
public ResponseEntity rule(@RequestBody Evaluation evaluation){
public ResponseEntity rule(@RequestBody Evaluation evaluation) {
evaluationService.save(evaluation);
return ResponseEntity.ok(200);
}
@ApiOperation("根据用户名查询最新的报告输出")
@GetMapping(value = "/eva")
public ResponseEntity getName(@RequestParam String name,@RequestParam String id) {
if(StringUtils.isEmpty(id)||id.equals("null")){
public ResponseEntity getName(@RequestParam String name, @RequestParam String id) {
if (StringUtils.isEmpty(id) || id.equals("null")) {
Evaluation e = evaluationService.findByName(name);
if(e!=null){
if (e != null) {
AssessmentReport assessmentReport = JSON.parseObject(e.getOutEva(), AssessmentReport.class);
return ResponseEntity.ok(assessmentReport);
}
return ResponseEntity.ok(null);
}
Evaluation evaluation = evaluationService.findById(id);
if(evaluation!=null){
if (evaluation != null) {
AssessmentReport assessmentReport = JSON.parseObject(evaluation.getOutEva(), AssessmentReport.class);
return ResponseEntity.ok(assessmentReport);
}
return ResponseEntity.ok(null);
}
@ApiOperation("根据id查询输入")
@GetMapping(value = "/in/{name}")
//@AuthAnnotation(code = {"000800"})
public ResponseEntity getInName(@PathVariable String name) {
Evaluation evaluation = evaluationService.findById(name);
if(evaluation!=null){
if (evaluation != null) {
Reform reform = JSON.parseObject(evaluation.getInEva(), Reform.class);
return ResponseEntity.ok(reform);
}
......@@ -74,7 +77,7 @@ public class EvaluationController {
@AuthAnnotation(code = {"000800"})
public ResponseEntity getInId(@PathVariable String id) {
Evaluation evaluation = evaluationService.findById(id);
if(evaluation!=null){
if (evaluation != null) {
return ResponseEntity.ok(evaluation);
}
return ResponseEntity.ok(null);
......@@ -84,58 +87,76 @@ public class EvaluationController {
@GetMapping(value = "/in/excel/{id}")
public ResponseEntity exportInName(@PathVariable String id) {
Evaluation evaluation = evaluationService.findById(id);
if(evaluation!=null){
if (evaluation != null) {
List<ExcelDataTemp> excelDataTemp = ExcelUtil.parseExcel2Entity(evaluation);
return ResponseEntity.ok(excelDataTemp);
}else{
} else {
return ResponseEntity.ok(new ArrayList<ExcelDataTemp>());
}
}
/**
* 修改评估报告
*
* @param evaluation 规则封装
* @param id id
* @param id id
* @return
*/
@PostMapping(value = "/{id}")
@ApiOperation("修改评估报告")
@AuthAnnotation(code = {"000800"})
public ResponseEntity update(@RequestBody Evaluation evaluation,@PathVariable String id){
public ResponseEntity update(@RequestBody Evaluation evaluation, @PathVariable String id) {
evaluation.setId(id);
evaluationService.update(evaluation);
return ResponseEntity.ok(200);
}
/**
* 根据id删除评估报告
*
* @param id id
* @return
*/
@ApiOperation("根据id删除评估报告")
@DeleteMapping(value = "/{id}")
@AuthAnnotation(code = {"000800"})
public ResponseEntity deleteById(@PathVariable String id){
public ResponseEntity deleteById(@PathVariable String id) {
evaluationService.delete(id);
return ResponseEntity.ok(200);
}
/**
* 分页+多条件查询
*
* @param searchMap 查询条件封装
* @param page 页码
* @param size 页大小
* @param page 页码
* @param size 页大小
* @return 分页结果
*/
@ApiOperation("分页查询页面列表")
@ApiImplicitParams({
@ApiImplicitParam(name="page",value = "页码",required=true,paramType="path",dataType="int"),
@ApiImplicitParam(name="size",value = "每页记录数",required=true,paramType="path",dataType="int")
@ApiImplicitParam(name = "page", value = "页码", required = true, paramType = "path", dataType = "int"),
@ApiImplicitParam(name = "size", value = "每页记录数", required = true, paramType = "path", dataType = "int")
})
@RequestMapping(value="/search/{page}/{size}",method= RequestMethod.POST)
@RequestMapping(value = "/search/{page}/{size}", method = RequestMethod.POST)
@AuthAnnotation(code = {"000800"})
public ResponseEntity findSearch(@RequestBody Map searchMap , @PathVariable int page, @PathVariable int size){
public ResponseEntity findSearch(@RequestBody Map searchMap, @PathVariable int page, @PathVariable int size) {
Page<Evaluation> pageList = evaluationService.findSearch(searchMap, page, size);
return ResponseEntity.ok(new PageResult<Evaluation>(pageList.getTotalElements(), pageList.getContent()) );
return ResponseEntity.ok(new PageResult<Evaluation>(pageList.getTotalElements(), pageList.getContent()));
}
/**
* 修改评估报告
*
* @param id id
* @return
*/
@GetMapping(value = "/bg/{id}")
@ApiOperation("修改评估报告")
public ResponseEntity findall(@PathVariable String id) {
Evaluation evaluation = evaluationService.findById(id);
Map<String, String> wps = WpsUtil.createWps(evaluation);
return ResponseEntity.ok(wps);
@ApiOperation("下载报告")
@ApiImplicitParams({
@ApiImplicitParam(name="id",value = "报告主键"),
......
......@@ -3,6 +3,7 @@ package com.zjty.inspect.entity;
import lombok.Data;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
/**
......@@ -13,5 +14,5 @@ import java.util.List;
public class ExcelDataTemp {
private String name;
private List<ExcelDataEntity> arrayList = new ArrayList();
private List<ExcelDataEntity> arrayList = new LinkedList<>();
}
package com.zjty.inspect.enums;
import lombok.Getter;
import java.util.HashMap;
import java.util.Map;
@Getter
public enum DocumentTitleEnum {
MAINTITLE(0,"主标题",2,0,0),
FIRSTLEVELTITLE(1,"一级标题",2,0,1),
TWOTITLE(2,"二级标题",3,1,2),
THREETITLE(3,"三级标题",4,2,2),
FOURTITLE(4,"四级标题",5,3,2),
OTHER(8,"其他",0,0,0);
private Integer code;
private String name;
private Integer style;
private Integer ilvl;
private Integer ilfo;
private static Map<Integer,DocumentTitleEnum> documentTitleEnumMap=new HashMap<>();
static {
for (DocumentTitleEnum documentTitleEnum : DocumentTitleEnum.values()) {
documentTitleEnumMap.put(documentTitleEnum.getCode(),documentTitleEnum);
}
}
DocumentTitleEnum() {
}
DocumentTitleEnum(Integer code, String name, Integer style, Integer ilvl, Integer ilfo) {
this.code = code;
this.name = name;
this.style = style;
this.ilvl = ilvl;
this.ilfo = ilfo;
}
public static DocumentTitleEnum getByCode(Integer code){
DocumentTitleEnum documentTitleEnum = documentTitleEnumMap.get(code);
if(documentTitleEnum==null){
return null;
}
return documentTitleEnum;
}
}
package com.zjty.inspect.enums;
import java.util.HashMap;
import java.util.Map;
public enum Framework {
/**
* 架构
*/
SEPARATE("分离型架构",1),
MIXTURE("混合型架构",2);
MIXTURE("混合型架构",2),
NONE("无",3);
Framework(String name,Integer status){
this.name=name;
this.status=status;
......@@ -24,4 +27,27 @@ public enum Framework {
public Integer getStatus() {
return status;
}
private static Map<String,Framework> frameWorkEnumMap=new HashMap<>();
private static Map<Integer,Framework> frameWorkEnumCodeMap=new HashMap<>();
static {
for (Framework frameWorkEnum : Framework.values()) {
frameWorkEnumMap.put(frameWorkEnum.getName(),frameWorkEnum);
frameWorkEnumCodeMap.put(frameWorkEnum.getStatus(),frameWorkEnum);
}
}
public static Framework getByName(String name){
Framework frameWorkEnum = frameWorkEnumMap.get(name);
if(frameWorkEnum==null){
return NONE;
}
return frameWorkEnum;
}
public static Framework getByCode(Integer code){
Framework frameWorkEnum = frameWorkEnumCodeMap.get(code);
if(frameWorkEnum==null){
return NONE;
}
return frameWorkEnum;
}
}
......@@ -24,6 +24,9 @@ public enum LanguageEnum {
QITA(12,"其他:请在备注中填写,如需填写多个,请以逗号分隔"),
JAVASCRIPT(13,"JavaScript"),
HTML(14,"HTML"),
JSP(15,"JSP"),
NET(16,".NET"),
;
private Integer code;
......
......@@ -203,6 +203,9 @@ public class Inspector {
* 配置文件的一个类型,xml文件
*/
if ("xml".equals(entry.getKey())) {
List<Path> value = entry.getValue();
for (Path path : entry.getValue()) {
if (path.getFileName().endsWith("pom.xml")) {
try {
......@@ -224,6 +227,8 @@ public class Inspector {
}
}
}
}
}
//指定后缀到文件匹配关键字
......@@ -267,6 +272,7 @@ public class Inspector {
mostStatus = language.getCode();
maxnum = entry.getValue().getNumber();
}
}
//设置语言
report.setLanguage(most == null ? LanguageEnum.NONE.getCode() : mostStatus);
......
......@@ -3,11 +3,13 @@ package com.zjty.inspect.service.impl;
import com.zjty.inspect.entity.DocumentContent;
import com.zjty.inspect.entity.DocumentPage;
import com.zjty.inspect.entity.TitleHead;
import com.zjty.inspect.enums.DocumentTitleEnum;
import com.zjty.inspect.service.DocumentService;
import com.zjty.inspect.utils.DocumentWordUtil;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.security.cert.X509Certificate;
import java.util.List;
@Service
......@@ -20,11 +22,10 @@ public class DocumentServiceImpl implements DocumentService {
String enddard = DocumentWordUtil.enddard();
//标题内容
String maintitle = DocumentWordUtil.Maintitle();
String subheading = DocumentWordUtil.subheading();
//标题下的内容
String standContent = DocumentWordUtil.content();
//表格内容
//表格内容
//页眉
String header = documentPage.getHeader();
......@@ -34,36 +35,38 @@ public class DocumentServiceImpl implements DocumentService {
List<TitleHead> titleHeads = documentPage.getTitleHeads();
if(titleHeads!=null&&titleHeads.size()>0){
for (TitleHead titleHead : titleHeads) {
String titleContent=subheading;
//标题名称
String name = titleHead.getName();
if(!StringUtils.isEmpty(name)) {
//标题级别
int parentId = titleHead.getParentId();
String s = titleContent.replaceAll("#title#", name)
.replaceAll("#parentId#", String.valueOf(parentId));
sb.append(s);
}
List<DocumentContent> documentContents = titleHead.getDocumentContents();
if(documentContents!=null&&documentContents.size()>0){
for (DocumentContent documentContent : documentContents) {
if(documentContent!=null){
DocumentTitleEnum documentTitleEnum = DocumentTitleEnum.getByCode(titleHead.getParentId());
if(documentTitleEnum!=null) {
String titleContent = DocumentWordUtil.subheading(documentTitleEnum);
//标题名称
String name = titleHead.getName();
if (!StringUtils.isEmpty(name)) {
//标题级别
int parentId = titleHead.getParentId();
String s = titleContent.replaceAll("#title#", name)
.replaceAll("#parentId#", String.valueOf(parentId));
sb.append(s);
}
List<DocumentContent> documentContents = titleHead.getDocumentContents();
if (documentContents != null && documentContents.size() > 0) {
for (DocumentContent documentContent : documentContents) {
if (documentContent != null) {
String content = documentContent.getContent();
String baseUrl = documentContent.getBaseUrl();
String documentTable = documentContent.getDocumentTable();
if(!StringUtils.isEmpty(content)){
String c=standContent;
String s = c.replaceAll("#content#",content);
if (!StringUtils.isEmpty(content)) {
String c = standContent;
String s = c.replaceAll("#content#", content);
sb.append(s);
}
if(!StringUtils.isEmpty(baseUrl)){
if (!StringUtils.isEmpty(baseUrl)) {
}
if(!StringUtils.isEmpty(documentTable)){
if (!StringUtils.isEmpty(documentTable)) {
sb.append(documentTable);
}
}
}
}
}
}
......
......@@ -53,10 +53,15 @@ public class InspectServiceImpl implements InspectService {
suffixLanguageMapping.put("vue", LanguageEnum.JAVASCRIPT);
suffixLanguageMapping.put("cpp", LanguageEnum.C);
suffixLanguageMapping.put("py", LanguageEnum.PYTHON);
suffixLanguageMapping.put("jsp", LanguageEnum.JAVA);
suffixLanguageMapping.put("jsp", LanguageEnum.JSP);
suffixLanguageMapping.put("go", LanguageEnum.GO);
suffixLanguageMapping.put("js", LanguageEnum.JAVASCRIPT);
suffixLanguageMapping.put("html", LanguageEnum.HTML);
suffixLanguageMapping.put("php",LanguageEnum.PHP);
suffixLanguageMapping.put("vbp",LanguageEnum.VB);
suffixLanguageMapping.put("rs",LanguageEnum.RUST);
suffixLanguageMapping.put("dpk",LanguageEnum.DELPHI);
//构造成员变量
inspector.setInspectParameter(inspectParameter);
//构造报告vo
......
package com.zjty.inspect.utils;
import com.zjty.inspect.entity.DocumentContent;
import com.zjty.inspect.entity.DocumentPage;
import com.zjty.inspect.entity.TitleHead;
import com.zjty.inspect.enums.DocumentTitleEnum;
import org.springframework.util.StringUtils;
import java.util.List;
import java.util.regex.Matcher;
......@@ -46,10 +52,15 @@ public class DocumentWordUtil {
" </w:p>";
}
public static String subheading(){
public static String subheading(DocumentTitleEnum documentTitleEnum){
return "<w:p>\n" +
" <w:pPr>\n" +
" <w:pStyle w:val=\"#parentId#\"/>\n" +
" <w:pStyle w:val=\""+documentTitleEnum.getStyle()+"\"/>\n" +
"<w:listPr>\n" +
" <w:ilvl w:val=\""+documentTitleEnum.getIlvl()+"\"/>\n" +
" <w:ilfo w:val=\""+documentTitleEnum.getIlfo()+"\"/>\n" +
" </w:listPr>" +
" <w:rPr>\n" +
" <w:rFonts w:hint=\"default\"/>\n" +
" <w:lang w:val=\"EN-US\" w:fareast=\"ZH-CN\"/>\n" +
......@@ -1295,4 +1306,66 @@ public class DocumentWordUtil {
" <w:trHeight w:val=\"400\" w:h-rule=\"atLeast\"/>\n" +
" </w:trPr>";
}
public static String createDocument(DocumentPage documentPage) {
StringBuilder sb=new StringBuilder();
//前面部分内容
String standard = DocumentWordUtil.standard();
String enddard = DocumentWordUtil.enddard();
//标题内容
String maintitle = DocumentWordUtil.Maintitle();
// String subheading = DocumentWordUtil.subheading();
//标题下的内容
String standContent = DocumentWordUtil.content();
//表格内容
//页眉
String header = documentPage.getHeader();
String s1 = maintitle.replaceAll("#title#", header);
sb.append(standard);
sb.append(s1);
List<TitleHead> titleHeads = documentPage.getTitleHeads();
if(titleHeads!=null&&titleHeads.size()>0){
for (TitleHead titleHead : titleHeads) {
DocumentTitleEnum byCode = DocumentTitleEnum.getByCode(titleHead.getParentId());
if (byCode != null) {
String titleContent = DocumentWordUtil.subheading(byCode);
//标题名称
String name = titleHead.getName();
if (!StringUtils.isEmpty(name)) {
//标题级别
int parentId = titleHead.getParentId();
String s = titleContent.replaceAll("#title#", name)
.replaceAll("#parentId#", String.valueOf(parentId));
sb.append(s);
}
List<DocumentContent> documentContents = titleHead.getDocumentContents();
if (documentContents != null && documentContents.size() > 0) {
for (DocumentContent documentContent : documentContents) {
if (documentContent != null) {
String content = documentContent.getContent();
String baseUrl = documentContent.getBaseUrl();
String documentTable = documentContent.getDocumentTable();
if (!StringUtils.isEmpty(content)) {
String c = standContent;
String s = c.replaceAll("#content#", content);
sb.append(s);
}
if (!StringUtils.isEmpty(baseUrl)) {
}
if (!StringUtils.isEmpty(documentTable)) {
sb.append(documentTable);
}
}
}
}
}
}
}
sb.append(enddard);
return sb.toString();
}
}
......@@ -472,12 +472,15 @@ public class ExcelUtil {
public static List<ExcelDataTemp> parseExcel2Entity(Evaluation evaluation) {
ArrayList<ExcelDataTemp> excelDataTemps = new ArrayList<>();
ArrayList<String> tables = new ArrayList<>();
String inEva = evaluation.getInEva();
ExcelDataTemp excelDataTemp = new ExcelDataTemp();
excelDataTemp.setName("基本信息");
List<ExcelDataEntity> arrayList = excelDataTemp.getArrayList();
if (inEva != null) {
Reform reform = JSON.parseObject(evaluation.getInEva(), Reform.class);
arrayList.add(exportEntity("用户名", reform.getUsername()));
if(reform.getAssessmentType()==1){
arrayList.add(exportEntity("评估类型", "快速评估"));
......
package com.zjty.inspect.utils;
import com.alibaba.fastjson.JSON;
import com.zjty.inspect.entity.*;
import com.zjty.inspect.enums.*;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author Mcj
* @date 2020-04-17 09:58
*/
public class WpsUtil {
public static Map<String,String> createWps(Evaluation evaluation) {
Reform reform = JSON.parseObject(evaluation.getInEva(), Reform.class);
AssessmentReport assessmentReport = JSON.parseObject(evaluation.getOutEva(), AssessmentReport.class);
HashMap<String, String> keyValue = new HashMap<>();
keyValue.put("username",reform.getUsername());
keyValue.put("mode",getMode(reform.getMode()));
keyValue.put("projectName",reform.getProjectName());
keyValue.put("codeUrl",reform.getCodeUrl());
keyValue.put("codeName",reform.getCodeName());
keyValue.put("gitUrl",reform.getGitUrl());
keyValue.put("moduleNum",String.valueOf(reform.getModuleNum()));
keyValue.put("cost",String.valueOf(reform.getCost()));
keyValue.put("address",flipYesOrNo(reform.getAddress()));
keyValue.put("localContact",reform.getLocalContact());
keyValue.put("localPhone",reform.getLocalPhone());
keyValue.put("secret",flipYesOrNo(reform.getSecret()));
keyValue.put("disasterTolerance",flipYesOrNo(reform.getDisasterTolerance()));
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());
}
keyValue.put("time",String.valueOf(reform.getTime()));
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("unitPhone",reform.getUnitPhone());
keyValue.put("unitContent",reform.getUnitContent());
keyValue.put("gradeProtection",flipYesOrNo(reform.getGradeProtection()));
keyValue.put("cycle",String.valueOf(reform.getCycle()));
SystemStructure systemStructure = reform.getSystemStructure();
Details application = systemStructure.getApplication();
getSys("application",application,keyValue);
Details database = systemStructure.getDatabase();
getSys("database",database,keyValue);
Details nas = systemStructure.getNas();
getSys("nas",nas,keyValue);
Details slb = systemStructure.getSlb();
getSys("slb",slb,keyValue);
Details cdn = systemStructure.getCdn();
getSys("cdn",cdn,keyValue);
Details vps = systemStructure.getVps();
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());
}
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++) {
int i1 = i + 1;
keyValue.put("otherApi"+i1, otherApis.get(i).getApiName());
}
for (int i = 0; i < middleware.getMicroServices().size(); i++) {
int i1 = i + 1;
keyValue.put("microService"+i1, middleware.getMicroServices().get(i).getName());
}
Database database1 = reform.getDatabase();
for (int i = 0; i < database1.getDatabaseType().size(); i++) {
int i1 = i + 1;
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()));
keyValue.put("databaseDbLink", flipYesOrNo(database1.getDbLink()));
keyValue.put("databaseTimeTask", flipYesOrNo(database1.getTimeTask()));
keyValue.put("databaseSequence", flipYesOrNo(database1.getSequence()));
keyValue.put("databaseTrigger", flipYesOrNo(database1.getTrigger()));
keyValue.put("databaseSafe", flipYesOrNo(database1.getSafe()));
keyValue.put("databaseDisasterTolerance", flipYesOrNo(database1.getDisasterTolerance()));
keyValue.put("databaseSeparate", flipYesOrNo(database1.getSeparate()));
keyValue.put("databasePerformance", flipYesOrNo(database1.getPerformance()));
keyValue.put("databaseOtherContent",database1.getOtherContent());
Apply apply = reform.getApply();
keyValue.put("applyCost",String.valueOf(apply.getCost()));
keyValue.put("applyReason",apply.getReason());
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());
}
LocalSystemDep localSystemDep = reform.getLocalSystemDep();
keyValue.put("localSystemDepName", localSystemDep.getName());
keyValue.put("localSystemDepMoney", String.valueOf(localSystemDep.getMoney()));
keyValue.put("localSystemDepDes", localSystemDep.getDes());
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String format = simpleDateFormat.format(assessmentReport.getTime());
keyValue.put("inspectTime", format);
keyValue.put("difficulty",String.valueOf(assessmentReport.getDifficulty()));
keyValue.put("budget",assessmentReport.getBudget());
SysScale sysScale = assessmentReport.getSysScale();
keyValue.put("sysScaleCodeNum",sysScale.getCode().getNum().toString());
keyValue.put("sysScaleCodeDes",sysScale.getCode().getDes());
keyValue.put("sysScaleFileNum",sysScale.getFile().getNum().toString());
keyValue.put("sysScaleFileDes",sysScale.getFile().getDes());
keyValue.put("sysScaleModeNum",sysScale.getMode().getNum().toString());
keyValue.put("sysScaleModeDes",sysScale.getMode().getDes());
TechnologyList technologyList = assessmentReport.getTechnologyList();
keyValue.put("technologyDes",technologyList.getDes());
List<TechnologyReport> technologyReports = technologyList.getTechnologyReports();
for (int i = 0; i < technologyList.getTechnologyReports().size(); i++) {
int i2 = i + 1;
keyValue.put("technology"+i2, technologyReports.get(i).getTechnology());
for (int i1 = 0; i1 < technologyReports.get(i).getTechnologyContents().size(); i1++) {
int i3 = i1 + 1;
TechnologyContent technologyContent = technologyReports.get(i).getTechnologyContents().get(i1);
keyValue.put("technologyContentLocal"+i2+"-"+i3, technologyContent.getLocal());
keyValue.put("technologyContentKeyWord"+i2+"-"+i3, technologyContent.getKeyWord());
keyValue.put("technologyContentFile"+i2+"-"+i3, technologyContent.getFile());
keyValue.put("technologyContentPosition"+i2+"-"+i3, technologyContent.getPosition());
keyValue.put("technologyContentStrategy"+i2+"-"+i3, getMode(technologyContent.getStrategy()));
}
}
Workload workload = assessmentReport.getWorkload();
keyValue.put("workloadDes",workload.getDes());
keyValue.put("workloadCost",String.valueOf(workload.getCost()));
keyValue.put("workloadMode",String.valueOf(workload.getMode()));
Basis development = workload.getDevelopment();
keyValue.put("workloadDevelopmentVolume",String.valueOf(development.getDevelopmentVolume()));
keyValue.put("workloadDevelopmentCorrectionFactor",String.valueOf(development.getCorrectionFactor()));
Basis test = workload.getTest();
keyValue.put("workloadTestVolume",String.valueOf(test.getDevelopmentVolume()));
keyValue.put("workloadTestCorrectionFactor",String.valueOf(test.getCorrectionFactor()));
Basis deploy = workload.getDeploy();
keyValue.put("workloadDeployVolume",String.valueOf(deploy.getDevelopmentVolume()));
keyValue.put("workloadDeployCorrectionFactor",String.valueOf(deploy.getCorrectionFactor()));
Basis total = workload.getTotal();
keyValue.put("workloadTotalVolume",String.valueOf(total.getDevelopmentVolume()));
keyValue.put("workloadTotalCorrectionFactor",String.valueOf(total.getCorrectionFactor()));
DifficultyAssessment difficultyAssessment = assessmentReport.getDifficultyAssessment();
keyValue.put("difficultyAssessmentDes",difficultyAssessment.getDes());
FrameDifficulty frameDifficulty = difficultyAssessment.getFrameDifficulty();
keyValue.put("difficultyDifficultySystemEvaluation",String.valueOf(frameDifficulty.getSystemEvaluation()));
keyValue.put("difficultyDifficultyMessage",String.valueOf(frameDifficulty.getMessage()));
keyValue.put("difficultyDifficultyDifficulty",String.valueOf(frameDifficulty.getDifficulty()));
keyValue.put("difficultyDifficultyLoad",String.valueOf(frameDifficulty.getLoad()));
keyValue.put("difficultyDifficultyDetails",Framework.getByCode(frameDifficulty.getDetails()).getName());
keyValue.put("difficultyDifficultyDistributed",flipYesOrNo(frameDifficulty.getDistributed()));
keyValue.put("difficultyDifficultyLoadBalance",flipYesOrNo(frameDifficulty.getLoadBalance()));
keyValue.put("difficultyDifficultyDisaster",flipYesOrNo(frameDifficulty.getDisaster()));
keyValue.put("difficultyDifficultyOtherDemand",frameDifficulty.getOtherDemand());
BrowserDifficulty browserDifficulty = difficultyAssessment.getBrowserDifficulty();
keyValue.put("browserDifficultySystemEvaluation",String.valueOf(browserDifficulty.getSystemEvaluation()));
keyValue.put("browserDifficultyMessage",String.valueOf(browserDifficulty.getMessage()));
keyValue.put("browserDifficultyDifficulty",String.valueOf(browserDifficulty.getDifficulty()));
keyValue.put("browserDifficultyLoad",String.valueOf(browserDifficulty.getLoad()));
keyValue.put("browserDifficultyStyle",flipYesOrNo(browserDifficulty.getStyle()));
keyValue.put("browserDifficultyApi",flipYesOrNo(browserDifficulty.getApi()));
keyValue.put("browserDifficultyPlugInUnit",flipYesOrNo(browserDifficulty.getPlugInUnit()));
keyValue.put("browserDifficultyGeography",flipYesOrNo(browserDifficulty.getGeography()));
keyValue.put("browserDifficultyPeripheral",flipYesOrNo(browserDifficulty.getPeripheral()));
keyValue.put("browserDifficultyAnimation",flipYesOrNo(browserDifficulty.getAnimation()));
keyValue.put("browserDifficultyThreeD",flipYesOrNo(browserDifficulty.getThreeD()));
keyValue.put("browserDifficultyDocument",flipYesOrNo(browserDifficulty.getDocument()));
keyValue.put("browserDifficultyMedia",flipYesOrNo(browserDifficulty.getMedia()));
keyValue.put("browserDifficultyFlash",flipYesOrNo(browserDifficulty.getFlash()));
keyValue.put("browserDifficultyOtherDemand",flipYesOrNo(browserDifficulty.getOtherDemand()));
MiddlewareDifficulty middlewareDifficulty = difficultyAssessment.getMiddlewareDifficulty();
keyValue.put("middlewareDifficultySystemEvaluation",String.valueOf(middlewareDifficulty.getSystemEvaluation()));
keyValue.put("middlewareDifficultyMessage",String.valueOf(middlewareDifficulty.getMessage()));
keyValue.put("middlewareDifficultyDifficulty",String.valueOf(middlewareDifficulty.getDifficulty()));
keyValue.put("middlewareDifficultyLoad",String.valueOf(middlewareDifficulty.getLoad()));
keyValue.put("middlewareDifficultyNumber",String.valueOf(middlewareDifficulty.getNumber()));
keyValue.put("middlewareDifficultyWeb",flipYesOrNo(middlewareDifficulty.getWeb()));
keyValue.put("middlewareDifficultyJndi",flipYesOrNo(middlewareDifficulty.getJndi()));
keyValue.put("middlewareDifficultyJms",flipYesOrNo(middlewareDifficulty.getJms()));
keyValue.put("middlewareDifficultyRoute",flipYesOrNo(middlewareDifficulty.getRoute()));
DatabaseDifficulty databaseDifficulty = difficultyAssessment.getDatabaseDifficulty();
keyValue.put("databaseDifficultyDifficulty",String.valueOf(databaseDifficulty.getDifficulty()));
keyValue.put("databaseDifficultyLoad",String.valueOf(databaseDifficulty.getLoad()));
keyValue.put("databaseDisasterTolerance",getDis(databaseDifficulty.getDisasterTolerance()));
keyValue.put("databaseDifficultySafe",flipYesOrNo(databaseDifficulty.getSafe()));
keyValue.put("databaseDifficultySeparate",flipYesOrNo(databaseDifficulty.getSeparate()));
keyValue.put("databaseDifficultyPerformance",flipYesOrNo(databaseDifficulty.getPerformance()));
ProgramDifficulty programDifficulty = difficultyAssessment.getProgramDifficulty();
keyValue.put("programDifficultyDifficulty",String.valueOf(programDifficulty.getDifficulty()));
keyValue.put("programDifficultyLoad",String.valueOf(programDifficulty.getLoad()));
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;
}
public static List<DocumentContent> setDocumentContents(DocumentContent documentContent){
ArrayList<DocumentContent> documentContents = new ArrayList<>();
documentContents.add(documentContent);
return documentContents;
}
private static int getFramework(String construction) {
switch (construction) {
case "B/S":
return 1;
case "C/S":
return 2;
case "单机运行":
return 0;
case "分布式":
return 4;
}
return -1;
}
private static String getFilpFramework(int construction) {
switch (construction) {
case 1:
return "B/S";
case 2:
return "C/S";
case 0:
return "单机运行";
case 4:
return "分布式";
default:
break;
}
return "";
}
private static int yesOrNo(String target) {
if ("是".equals(target)) {
return 1;
} else if ("否".equals(target)) {
return 2;
} else {
return -1;
}
}
private static int SpecialYesOrNo(String target) {
if ("是".equals(target)) {
return 4;
} else if ("否".equals(target)) {
return 0;
} else {
return -1;
}
}
private static String flipYesOrNo(Integer target) {
if (target == 1) {
return "是";
} else if (target == 2) {
return "否";
} else {
return "我不清楚";
}
}
private static String flipSafeYesOrNo(Integer target) {
if(target==null){
return "否";
}
if (target == 4) {
return "强";
} else if (target == 2) {
return "弱";
} else {
return "我不清楚";
}
}
private static String flipSpecialYesOrNo(Integer target) {
if (target == 4) {
return "是";
} else if (target == 0) {
return "否";
} else {
return "我不清楚";
}
}
private static String getMode(Integer target) {
if(target==null){
return "我不清楚";
}
if (target == 1) {
return "改造";
} else if (target == 2) {
return "适配";
} else {
return "我不清楚";
}
}
private static String flipSafeStrong(Integer target) {
if(target==null || target==1){
return "无";
}
if (target == 3) {
return "强";
} else if (target == 2) {
return "弱";
} else {
return "我不清楚";
}
}
private static String strategyToString(Integer target){
if(target == 1){
return "休息日或晚间切换";
}else if(target == 2){
return "暂停服务";
}else if(target == 3){
return "平滑过渡";
}else{
return "不清楚";
}
}
private static String localOrCloud(Integer deploy){
if(deploy==1){
return "本地";
}else if(deploy==2){
return "政务云";
}else{
return "不清楚";
}
}
private static String getDis(Integer dis){
if(dis==1){
return "否";
}else if(dis==2){
return "主备";
}else if(dis==3){
return "分布式";
}else{
return "不清楚";
}
}
private static void getSys(String sysName,Details application, Map<String,String> keyValue){
keyValue.put(sysName+"Deploy",localOrCloud(application.getDeploy()));
keyValue.put(sysName+"OperateSystem",application.getOperateSystem().getName());
keyValue.put(sysName+"Code",String.valueOf(application.getOperateSystem().getCode()));
keyValue.put(sysName+"Num",application.getNum());
keyValue.put(sysName+"CpuNum",application.getCpuNum());
keyValue.put(sysName+"Ghz",application.getGhz());
keyValue.put(sysName+"Space",application.getSpace());
keyValue.put(sysName+"Other",application.getSpace());
keyValue.put(sysName+"Edition",application.getEdition());
keyValue.put(sysName+"Memory",application.getMemory());
}
}
......@@ -67,6 +67,7 @@ spring.freemarker.template-loader-path=classpath:/templates
#spring.redis.port=6379
##Redis\u670D\u52A1\u5668\u8FDE\u63A5\u5BC6\u7801\uFF08\u9ED8\u8BA4\u4E3A\u7A7A\uFF09
#spring.redis.password=
#宁波项目服务器ip
address=120.55.57.35
# 核心线程池大小、最大线程数、空闲活跃时间、队列容量
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论