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

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

...@@ -91,18 +91,6 @@ public class EvaluationController { ...@@ -91,18 +91,6 @@ public class EvaluationController {
return ServerResponse.ok(null); return ServerResponse.ok(null);
} }
@ApiOperation("根据报告id查询excel输入")
@GetMapping(value = "/in/excel/{id}")
public ServerResponse<List<ExcelDataTemp>> exportInName(@PathVariable String id) {
Evaluation evaluation = evaluationService.findById(id);
if (evaluation != null) {
List<ExcelDataTemp> excelDataTemp = ExcelUtil.parseExcel2Entity(evaluation);
return ServerResponse.ok(excelDataTemp);
} else {
return ServerResponse.ok(new ArrayList<>());
}
}
/** /**
* 修改评估报告 * 修改评估报告
* *
......
...@@ -10,11 +10,15 @@ import com.zjty.inspect.utils.*; ...@@ -10,11 +10,15 @@ import com.zjty.inspect.utils.*;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*; import java.io.*;
import java.io.File; import java.io.File;
import java.util.*; import java.util.*;
...@@ -53,6 +57,8 @@ public class InspectController { ...@@ -53,6 +57,8 @@ public class InspectController {
//应用类型转换:大型4 //应用类型转换:大型4
private Integer[] big = {5, 9}; private Integer[] big = {5, 9};
@Value("${upload.location}")
private String uploadPath;
/** /**
* 上传代码进行评估 * 上传代码进行评估
* *
...@@ -381,20 +387,58 @@ public class InspectController { ...@@ -381,20 +387,58 @@ public class InspectController {
return ServerResponse.ok(save.getId()); return ServerResponse.ok(save.getId());
} }
@ApiOperation("大文件分片上传")
// @PostMapping("/chunkUpload")
@PostMapping("/uploads") @PostMapping("/uploads")
private ServerResponse uploads(@RequestParam(value = "file") MultipartFile multfile) { public ServerResponse fileChunkUpload(MultipartFileParam param, HttpServletRequest request, HttpServletResponse response){
try { // OSSInformation ossInformation = ossInformationService.queryOne();
File file = FileUtil.saveToLocal(multfile); // String root = ossInformation.getRoot();
String root = uploadPath;
//验证文件夹规则,不能包含特殊字符
java.io.File file = new java.io.File(root);
// createDirectoryQuietly(file);
System.out.println("88888888888888");
String path=file.getAbsolutePath();
response.setContentType("text/html;charset=UTF-8");
// response.setStatus对接前端插件
// 200, 201, 202: 当前块上传成功,不需要重传。
// 404, 415. 500, 501: 当前块上传失败,会取消整个文件上传。
// 其他状态码: 出错了,但是会自动重试上传。
String name = file.getName(); try {
String path = file.getCanonicalPath(); /**
return ServerResponse.ok(new com.zjty.inspect.entity.File(name, path)); * 判断前端Form表单格式是否支持文件上传
} catch (IOException e) { */
boolean isMultipart = ServletFileUpload.isMultipartContent(request);
if(!isMultipart){
//这里是我向前端发送数据的代码,可理解为 return 数据; 具体的就不贴了
System.out.println("不支持的表单格式");
return ServerResponse.badRequest();
}else {
param.setTaskId(param.getIdentifier());
File myfile = inspectService.chunkUploadByMappedByteBuffer(param,path);//service层
if (myfile!=null){
String name = myfile.getName();
String myPath = myfile.getCanonicalPath();
return ServerResponse.ok(new com.zjty.inspect.entity.File(name, myPath));
}else {
return ServerResponse.ok("继续断点传续!");
}
}
} catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return ServerResponse.error(500); // System.out.println("上传文件失败");
// response.setStatus(415);
return ServerResponse.error(415, "上传文件失败");
} }
} }
@PostMapping("/gitdownload") @PostMapping("/gitdownload")
private ServerResponse gitDownloads(String gitAddress, String username, String password) { private ServerResponse gitDownloads(String gitAddress, String username, String password) {
try { try {
...@@ -409,7 +453,6 @@ public class InspectController { ...@@ -409,7 +453,6 @@ public class InspectController {
private ServerResponse<Reform> uploadFileToInspect(MultipartFile file, String username) throws IOException { private ServerResponse<Reform> uploadFileToInspect(MultipartFile file, String username) throws IOException {
Reform reform = ExcelUtil.parseExcel(file.getInputStream(),file.getOriginalFilename()); Reform reform = ExcelUtil.parseExcel(file.getInputStream(),file.getOriginalFilename());
reform.setUsername(username); reform.setUsername(username);
System.out.println("1");
return ServerResponse.ok(reform); return ServerResponse.ok(reform);
} }
} }
...@@ -15,4 +15,6 @@ public class BaseDes { ...@@ -15,4 +15,6 @@ public class BaseDes {
private String des; private String des;
@ApiModelProperty(value = "版本号") @ApiModelProperty(value = "版本号")
private String version; private String version;
@ApiModelProperty(value = "是否为其他项")
private Integer other;
} }
...@@ -45,7 +45,9 @@ public class ServerResponse<T> implements Serializable { ...@@ -45,7 +45,9 @@ public class ServerResponse<T> implements Serializable {
} }
public static <T> ServerResponse error(int status,String data){
return new ServerResponse(status,"请求失败",data);
}
public static <T> ServerResponse error(Object data){ public static <T> ServerResponse error(Object data){
return new ServerResponse(400,"请求失败",data); return new ServerResponse(400,"请求失败",data);
} }
......
...@@ -155,7 +155,12 @@ public class Inspector { ...@@ -155,7 +155,12 @@ public class Inspector {
//初始化成员变量 //初始化成员变量
initData(); initData();
//扫描文件,进行文件分类 //扫描文件,进行文件分类
HashMap<String, String> map = new HashMap<>();
map.put("msg","开始扫描文件");
asyncTask.sendMessageToAll(map);
scanFiles(); scanFiles();
map.put("msg","文件扫描结束");
asyncTask.sendMessageToAll(map);
//配置参数 //配置参数
inspectParameter.setCodeSize((int) codeSize); inspectParameter.setCodeSize((int) codeSize);
report.setFileNum(fileNum); report.setFileNum(fileNum);
...@@ -166,7 +171,11 @@ public class Inspector { ...@@ -166,7 +171,11 @@ public class Inspector {
//根据扫描结果以及用户配置得出需要使用的规则及技术 //根据扫描结果以及用户配置得出需要使用的规则及技术
ruleTransform(inspectParameter.getRecastMethod()); ruleTransform(inspectParameter.getRecastMethod());
//扫描源代码文件 //扫描源代码文件
map.put("msg","开始扫描源代码文件");
asyncTask.sendMessageToAll(map);
forEachFilesMap(); forEachFilesMap();
map.put("msg","源代码文件扫描结束");
asyncTask.sendMessageToAll(map);
//将得到的告警信息根据技术id进行转换 //将得到的告警信息根据技术id进行转换
Set<String> technologyIds = warns.stream().map(Warn::getTechnologyId).collect(Collectors.toSet()); Set<String> technologyIds = warns.stream().map(Warn::getTechnologyId).collect(Collectors.toSet());
List<Technology> technologies = technologyDao.findAllById(technologyIds); List<Technology> technologies = technologyDao.findAllById(technologyIds);
...@@ -247,7 +256,7 @@ public class Inspector { ...@@ -247,7 +256,7 @@ public class Inspector {
for (Path path1 : entry.getValue()) { for (Path path1 : entry.getValue()) {
try { try {
fileNum = fileNum + 1; fileNum = fileNum + 1;
map.put("totalFile", fileNum + "/" + fileSize); map.put("msg", fileNum + "/" + fileSize);
System.out.println(fileNum + "/" + fileSize); System.out.println(fileNum + "/" + fileSize);
asyncTask.sendMessageToAll(map); asyncTask.sendMessageToAll(map);
//如果文件类型为jar活着class则不读取 //如果文件类型为jar活着class则不读取
......
...@@ -24,7 +24,6 @@ public class AsyncTask { ...@@ -24,7 +24,6 @@ public class AsyncTask {
* @Author: LiuJie * @Author: LiuJie
* @Date: 2019/5/20 * @Date: 2019/5/20
*/ */
@Async("myTaskAsyncPool")
public void sendMessageToAll(Map<String,String> map) { public void sendMessageToAll(Map<String,String> map) {
webSocketServer.sendMessageToAll(map); webSocketServer.sendMessageToAll(map);
} }
......
...@@ -69,10 +69,9 @@ public class ExcelUtil { ...@@ -69,10 +69,9 @@ public class ExcelUtil {
if (split.length > 1) { if (split.length > 1) {
reform.setUnitContent(split[0]); reform.setUnitContent(split[0]);
reform.setUnitPhone(split[1]); reform.setUnitPhone(split[1]);
}else if(split.length == 1){ } else if (split.length == 1) {
reform.setUnitContent(split[0]); reform.setUnitContent(split[0]);
} }
reform.setUnitName(unitName); reform.setUnitName(unitName);
//系统名称 //系统名称
...@@ -102,7 +101,7 @@ public class ExcelUtil { ...@@ -102,7 +101,7 @@ public class ExcelUtil {
if (nativeUnit.length > 1) { if (nativeUnit.length > 1) {
reform.setLocalContact(nativeUnit[0]); reform.setLocalContact(nativeUnit[0]);
reform.setLocalPhone(nativeUnit[1]); reform.setLocalPhone(nativeUnit[1]);
}else if(nativeUnit.length > 0){ } else if (nativeUnit.length > 0) {
reform.setLocalContact(nativeUnit[0]); reform.setLocalContact(nativeUnit[0]);
} }
...@@ -113,7 +112,7 @@ public class ExcelUtil { ...@@ -113,7 +112,7 @@ public class ExcelUtil {
reform.setGradeProtection(yesOrNo(gradeProtection)); reform.setGradeProtection(yesOrNo(gradeProtection));
String construction = getExcelCell(10, 2, sheetAt); String construction = getExcelCell(10, 2, sheetAt);
reform.setFramework( getFramework(construction)); reform.setFramework(getFramework(construction));
String disaster = getExcelCell(11, 2, sheetAt); String disaster = getExcelCell(11, 2, sheetAt);
int i2 = SpecialYesOrNo(disaster); int i2 = SpecialYesOrNo(disaster);
...@@ -146,11 +145,10 @@ public class ExcelUtil { ...@@ -146,11 +145,10 @@ public class ExcelUtil {
BaseDes devFramework = new BaseDes(); BaseDes devFramework = new BaseDes();
FrameWorkEnum frameWorkEnum = FrameWorkEnum.getByName(framework); FrameWorkEnum frameWorkEnum = FrameWorkEnum.getByName(framework);
if (frameWorkEnum != null) { if (frameWorkEnum != null) {
if(frameWorkEnum.getCode()==15){ if (frameWorkEnum.getCode() == -1) {
devFramework.setName(remark); continue;
}else{
devFramework.setName(frameWorkEnum.getName());
} }
devFramework.setName(frameWorkEnum.getName());
devFramework.setCode(frameWorkEnum.getCode()); devFramework.setCode(frameWorkEnum.getCode());
devFramework.setVersion(version); devFramework.setVersion(version);
devFramework.setDes(remark); devFramework.setDes(remark);
...@@ -171,11 +169,7 @@ public class ExcelUtil { ...@@ -171,11 +169,7 @@ public class ExcelUtil {
BaseDes font = new BaseDes(); BaseDes font = new BaseDes();
FontTechnologyEnum fontTechnologyEnum = FontTechnologyEnum.getByName(framework); FontTechnologyEnum fontTechnologyEnum = FontTechnologyEnum.getByName(framework);
if (fontTechnologyEnum != null) { if (fontTechnologyEnum != null) {
if(fontTechnologyEnum.getCode()==15){ font.setName(fontTechnologyEnum.getName());
font.setName(remark);
}else{
font.setName(fontTechnologyEnum.getName());
}
font.setCode(fontTechnologyEnum.getCode()); font.setCode(fontTechnologyEnum.getCode());
font.setDes(remark); font.setDes(remark);
font.setVersion(version); font.setVersion(version);
...@@ -197,11 +191,7 @@ public class ExcelUtil { ...@@ -197,11 +191,7 @@ public class ExcelUtil {
cs.setVersion(version); cs.setVersion(version);
CSTechnologyEnum csTechnologyEnum = CSTechnologyEnum.getByName(framework); CSTechnologyEnum csTechnologyEnum = CSTechnologyEnum.getByName(framework);
if (csTechnologyEnum != null) { if (csTechnologyEnum != null) {
if(csTechnologyEnum.getCode()==10){ cs.setName(csTechnologyEnum.getName());
cs.setName(remark);
}else{
cs.setName(csTechnologyEnum.getName());
}
cs.setCode(csTechnologyEnum.getCode()); cs.setCode(csTechnologyEnum.getCode());
fontDevTechnologies.add(cs); fontDevTechnologies.add(cs);
} }
...@@ -220,11 +210,7 @@ public class ExcelUtil { ...@@ -220,11 +210,7 @@ public class ExcelUtil {
BaseDes opGA = new BaseDes(); BaseDes opGA = new BaseDes();
OpgaEnum opgaEnum = OpgaEnum.getByName(framework); OpgaEnum opgaEnum = OpgaEnum.getByName(framework);
if (opgaEnum != null) { if (opgaEnum != null) {
if(opgaEnum.getCode()==4){ opGA.setName(framework);
opGA.setName(remark);
}else{
opGA.setName(framework);
}
opGA.setCode(opgaEnum.getCode()); opGA.setCode(opgaEnum.getCode());
opGA.setVersion(version); opGA.setVersion(version);
opGA.setDes(remark); opGA.setDes(remark);
...@@ -248,11 +234,7 @@ public class ExcelUtil { ...@@ -248,11 +234,7 @@ public class ExcelUtil {
BaseDes devLanguage = new BaseDes(); BaseDes devLanguage = new BaseDes();
LanguageEnum languageEnum = LanguageEnum.getByName(lan); LanguageEnum languageEnum = LanguageEnum.getByName(lan);
if (languageEnum != null) { if (languageEnum != null) {
if(languageEnum.getCode()==12){ devLanguage.setName(languageEnum.getName());
devLanguage.setName(languageEnum.getName());
}else{
devLanguage.setName(remark);
}
devLanguage.setCode(languageEnum.getCode()); devLanguage.setCode(languageEnum.getCode());
devLanguage.setVersion(version); devLanguage.setVersion(version);
devLanguage.setDes(remark); devLanguage.setDes(remark);
...@@ -276,11 +258,7 @@ public class ExcelUtil { ...@@ -276,11 +258,7 @@ public class ExcelUtil {
if (middlewareEnum != null) { if (middlewareEnum != null) {
BaseDes baseDes = new BaseDes(); BaseDes baseDes = new BaseDes();
baseDes.setDes(remark); baseDes.setDes(remark);
if(middlewareEnum.getCode()==15){ baseDes.setName(middlewareEnum.name());
baseDes.setName(remark);
}else{
baseDes.setName(middlewareEnum.name());
}
baseDes.setCode(middlewareEnum.getCode()); baseDes.setCode(middlewareEnum.getCode());
baseDes.setVersion(version); baseDes.setVersion(version);
middlewareEnums.add(baseDes); middlewareEnums.add(baseDes);
...@@ -299,11 +277,7 @@ public class ExcelUtil { ...@@ -299,11 +277,7 @@ public class ExcelUtil {
String remark = getExcelCell(i, 4, sheetAt); String remark = getExcelCell(i, 4, sheetAt);
OtherApi otherApi = new OtherApi(); OtherApi otherApi = new OtherApi();
OtherApiEnum otherApiEnum = OtherApiEnum.getByName(api); OtherApiEnum otherApiEnum = OtherApiEnum.getByName(api);
if(otherApiEnum.getOther()==1){ otherApi.setApiName(api);
otherApi.setApiName(remark);
}else{
otherApi.setApiName(api);
}
otherApi.setDes(remark); otherApi.setDes(remark);
otherApi.setVersion(version); otherApi.setVersion(version);
otherApi.setCode(String.valueOf(otherApiEnum.getCode())); otherApi.setCode(String.valueOf(otherApiEnum.getCode()));
...@@ -322,11 +296,7 @@ public class ExcelUtil { ...@@ -322,11 +296,7 @@ public class ExcelUtil {
BaseDes microService = new BaseDes(); BaseDes microService = new BaseDes();
MicroServiceEnum microServiceEnum = MicroServiceEnum.getByName(name); MicroServiceEnum microServiceEnum = MicroServiceEnum.getByName(name);
if (microServiceEnum != null) { if (microServiceEnum != null) {
if(microServiceEnum.getOther()==1){ microService.setName(microServiceEnum.getName());
microService.setName(remark);
}else{
microService.setName(microServiceEnum.getName());
}
microService.setCode(microServiceEnum.getCode()); microService.setCode(microServiceEnum.getCode());
microService.setDes(remark); microService.setDes(remark);
microService.setVersion(version); microService.setVersion(version);
...@@ -341,9 +311,14 @@ public class ExcelUtil { ...@@ -341,9 +311,14 @@ public class ExcelUtil {
ArrayList<DatabaseType> databaseTypes = new ArrayList<>(); ArrayList<DatabaseType> databaseTypes = new ArrayList<>();
for (int i = 74; i < 77; i++) { for (int i = 74; i < 77; i++) {
String database = getExcelCell(i, 2, sheetAt); String database = getExcelCell(i, 2, sheetAt);
String version = getExcelCell(i, 3, sheetAt);
String remark = getExcelCell(i, 4, sheetAt);
if (!"".equals(database)) { if (!"".equals(database)) {
DatabaseType byName = DatabaseType.getByName(database); DatabaseType databaseType = DatabaseType.getByName(database);
databaseTypes.add(byName); databaseTypes.add(databaseType);
}
if(!"".equals(remark)){
database1.setOtherContent(remark);
} }
} }
database1.setDatabaseType(databaseTypes); database1.setDatabaseType(databaseTypes);
...@@ -374,7 +349,7 @@ public class ExcelUtil { ...@@ -374,7 +349,7 @@ public class ExcelUtil {
String disasterTolerance = getExcelCell(89, 2, sheetAt); String disasterTolerance = getExcelCell(89, 2, sheetAt);
database1.setDisasterTolerance(yesOrNo(disasterTolerance)); database1.setDisasterTolerance(yesOrNo(disasterTolerance));
String safe = getExcelCell(90, 2, sheetAt); String safe = getExcelCell(90, 2, sheetAt);
database1.setSafe(yesOrNo(safe)); database1.setSafe(yesOrNo(safe));
String performance = getExcelCell(91, 2, sheetAt); String performance = getExcelCell(91, 2, sheetAt);
if (!"无".equals(performance)) { if (!"无".equals(performance)) {
database1.setPerformance(1); database1.setPerformance(1);
...@@ -389,11 +364,7 @@ public class ExcelUtil { ...@@ -389,11 +364,7 @@ public class ExcelUtil {
String remark = getExcelCell(i, 4, sheetAt); String remark = getExcelCell(i, 4, sheetAt);
CompatibleBrowser compatibleBrowser = CompatibleBrowser.getByName(brows); CompatibleBrowser compatibleBrowser = CompatibleBrowser.getByName(brows);
BaseDes baseDes = new BaseDes(); BaseDes baseDes = new BaseDes();
if(compatibleBrowser.getCode()==3){ baseDes.setName(compatibleBrowser.getName());
baseDes.setName(remark);
}else{
baseDes.setName(compatibleBrowser.getName());
}
baseDes.setCode(compatibleBrowser.getCode()); baseDes.setCode(compatibleBrowser.getCode());
baseDes.setVersion(version); baseDes.setVersion(version);
baseDes.setDes(remark); baseDes.setDes(remark);
...@@ -413,11 +384,7 @@ public class ExcelUtil { ...@@ -413,11 +384,7 @@ public class ExcelUtil {
browserPlug.setDes(remark); browserPlug.setDes(remark);
BrowserPlugEnum browserPlugEnum = BrowserPlugEnum.getByName(plugin); BrowserPlugEnum browserPlugEnum = BrowserPlugEnum.getByName(plugin);
if(browserPlugEnum.getOther()==1){ browserPlug.setName(browserPlugEnum.getName());
browserPlug.setName(remark);
}else{
browserPlug.setName(browserPlugEnum.getName());
}
browserPlug.setCode(browserPlugEnum.getCode()); browserPlug.setCode(browserPlugEnum.getCode());
switch (plugin) { switch (plugin) {
case "在线文本编辑类:请在备注中填写插件名和版本": case "在线文本编辑类:请在备注中填写插件名和版本":
...@@ -442,7 +409,7 @@ public class ExcelUtil { ...@@ -442,7 +409,7 @@ public class ExcelUtil {
reform.setBrowser(browser); reform.setBrowser(browser);
String apply = getExcelCell(110, 2, sheetAt); String apply = getExcelCell(110, 2, sheetAt);
Apply apply1 = new Apply(); Apply apply1 = new Apply();
if(!"".equals(apply)){ if (!"".equals(apply)) {
apply1.setCost(Double.valueOf(apply)); apply1.setCost(Double.valueOf(apply));
} }
String remark = getExcelCell(110, 3, sheetAt); String remark = getExcelCell(110, 3, sheetAt);
...@@ -484,11 +451,11 @@ public class ExcelUtil { ...@@ -484,11 +451,11 @@ public class ExcelUtil {
reform.setRpo(rpoEnum.getCode()); reform.setRpo(rpoEnum.getCode());
} }
int max = Math.max(rpoEnum.getCode(), rtoEnum.getCode()); int max = Math.max(rpoEnum.getCode(), rtoEnum.getCode());
if(max==1){ if (max == 1) {
reform.setStrategy(3); reform.setStrategy(3);
}else if(max<=5){ } else if (max <= 5) {
reform.setStrategy(1); reform.setStrategy(1);
}else { } else {
reform.setStrategy(2); reform.setStrategy(2);
} }
return reform; return reform;
...@@ -496,7 +463,6 @@ public class ExcelUtil { ...@@ -496,7 +463,6 @@ public class ExcelUtil {
public static List<ExcelDataTemp> parseExcel2Entity(Evaluation evaluation) { public static List<ExcelDataTemp> parseExcel2Entity(Evaluation evaluation) {
ArrayList<ExcelDataTemp> excelDataTemps = new ArrayList<>(); ArrayList<ExcelDataTemp> excelDataTemps = new ArrayList<>();
ArrayList<String> tables = new ArrayList<>();
String inEva = evaluation.getInEva(); String inEva = evaluation.getInEva();
ExcelDataTemp excelDataTemp = new ExcelDataTemp(); ExcelDataTemp excelDataTemp = new ExcelDataTemp();
excelDataTemp.setName("基本信息"); excelDataTemp.setName("基本信息");
...@@ -505,14 +471,14 @@ public class ExcelUtil { ...@@ -505,14 +471,14 @@ public class ExcelUtil {
Reform reform = JSON.parseObject(evaluation.getInEva(), Reform.class); Reform reform = JSON.parseObject(evaluation.getInEva(), Reform.class);
arrayList.add(exportEntity("用户名", reform.getUsername())); arrayList.add(exportEntity("用户名", reform.getUsername()));
if(reform.getAssessmentType()==1){ if (reform.getAssessmentType() == 1) {
arrayList.add(exportEntity("评估类型", "快速评估")); arrayList.add(exportEntity("评估类型", "快速评估"));
}else{ } else {
arrayList.add(exportEntity("评估类型", "详细评估")); arrayList.add(exportEntity("评估类型", "详细评估"));
} }
if(reform.getMode()==1){ if (reform.getMode() == 1) {
arrayList.add(exportEntity("替换方式", "改造")); arrayList.add(exportEntity("替换方式", "改造"));
}else{ } else {
arrayList.add(exportEntity("替换方式", "适配")); arrayList.add(exportEntity("替换方式", "适配"));
} }
arrayList.add(exportEntity("系统名称", reform.getProjectName())); arrayList.add(exportEntity("系统名称", reform.getProjectName()));
...@@ -647,6 +613,7 @@ public class ExcelUtil { ...@@ -647,6 +613,7 @@ public class ExcelUtil {
} }
return -1; return -1;
} }
private static String getFilpFramework(int construction) { private static String getFilpFramework(int construction) {
switch (construction) { switch (construction) {
case 1: case 1:
...@@ -672,6 +639,7 @@ public class ExcelUtil { ...@@ -672,6 +639,7 @@ public class ExcelUtil {
return -1; return -1;
} }
} }
private static int SpecialYesOrNo(String target) { private static int SpecialYesOrNo(String target) {
if ("是".equals(target)) { if ("是".equals(target)) {
return 4; return 4;
...@@ -681,6 +649,7 @@ public class ExcelUtil { ...@@ -681,6 +649,7 @@ public class ExcelUtil {
return -1; return -1;
} }
} }
private static String flipYesOrNo(Integer target) { private static String flipYesOrNo(Integer target) {
if (target == 1) { if (target == 1) {
return "是"; return "是";
...@@ -690,8 +659,9 @@ public class ExcelUtil { ...@@ -690,8 +659,9 @@ public class ExcelUtil {
return "我不清楚"; return "我不清楚";
} }
} }
private static String flipSafeYesOrNo(Integer target) { private static String flipSafeYesOrNo(Integer target) {
if(target==null){ if (target == null) {
return "否"; return "否";
} }
if (target == 4) { if (target == 4) {
...@@ -702,6 +672,7 @@ public class ExcelUtil { ...@@ -702,6 +672,7 @@ public class ExcelUtil {
return "我不清楚"; return "我不清楚";
} }
} }
private static String flipSpecialYesOrNo(Integer target) { private static String flipSpecialYesOrNo(Integer target) {
if (target == 4) { if (target == 4) {
return "是"; return "是";
......
...@@ -17,86 +17,85 @@ import java.util.*; ...@@ -17,86 +17,85 @@ import java.util.*;
public class WpsUtil { public class WpsUtil {
public static Map<String,String> createWps(Evaluation evaluation) { public static Map<String, String> createWps(Evaluation evaluation) {
HashMap<String,List<TechnologyContent>> teMap=new HashMap<>(); HashMap<String, List<TechnologyContent>> teMap = new HashMap<>();
Reform reform = JSON.parseObject(evaluation.getInEva(), Reform.class); Reform reform = JSON.parseObject(evaluation.getInEva(), Reform.class);
AssessmentReport assessmentReport = JSON.parseObject(evaluation.getOutEva(), AssessmentReport.class); AssessmentReport assessmentReport = JSON.parseObject(evaluation.getOutEva(), AssessmentReport.class);
HashMap<String, String> keyValue = new HashMap<>(); HashMap<String, String> keyValue = new HashMap<>();
keyValue.put("username",reform.getUsername()); keyValue.put("username", reform.getUsername());
keyValue.put("mode",getMode(reform.getMode())); keyValue.put("mode", getMode(reform.getMode()));
keyValue.put("projectName",reform.getProjectName()); keyValue.put("projectName", reform.getProjectName());
keyValue.put("codeUrl",reform.getCodeUrl()); keyValue.put("codeUrl", reform.getCodeUrl());
keyValue.put("codeName",reform.getCodeName()); keyValue.put("codeName", reform.getCodeName());
keyValue.put("gitUrl",reform.getGitUrl()); keyValue.put("gitUrl", reform.getGitUrl());
keyValue.put("moduleNum",String.valueOf(reform.getModuleNum())); keyValue.put("moduleNum", String.valueOf(reform.getModuleNum()));
keyValue.put("cost",String.valueOf(reform.getCost())); keyValue.put("cost", String.valueOf(reform.getCost()));
keyValue.put("address",flipYesOrNo(reform.getAddress())); keyValue.put("address", flipYesOrNo(reform.getAddress()));
keyValue.put("localContact",reform.getLocalContact()); keyValue.put("localContact", reform.getLocalContact());
keyValue.put("localPhone",reform.getLocalPhone()); keyValue.put("localPhone", reform.getLocalPhone());
keyValue.put("secret",flipYesOrNo(reform.getSecret())); keyValue.put("secret", flipYesOrNo(reform.getSecret()));
keyValue.put("disasterTolerance",flipYesOrNo(reform.getDisasterTolerance())); keyValue.put("disasterTolerance", flipYesOrNo(reform.getDisasterTolerance()));
keyValue.put("safe",flipSafeStrong(reform.getSafe())); keyValue.put("safe", flipSafeStrong(reform.getSafe()));
keyValue.put("framework",Framework.getByCode(reform.getFramework()).getName()); keyValue.put("framework", Framework.getByCode(reform.getFramework()).getName());
for (int i = 0; i < reform.getApplicationType().size(); i++) { for (int i = 0; i < reform.getApplicationType().size(); i++) {
Integer code = reform.getApplicationType().get(i); Integer code = reform.getApplicationType().get(i);
keyValue.put("applicationType"+i+1,ApplicationType.getByCode(code).getName()); keyValue.put("applicationType" + i + 1, ApplicationType.getByCode(code).getName());
} }
keyValue.put("time",String.valueOf(reform.getTime())); keyValue.put("time", String.valueOf(reform.getTime()));
keyValue.put("tableNum",String.valueOf(reform.getTableNum())); keyValue.put("tableNum", String.valueOf(reform.getTableNum()));
keyValue.put("databaseNum",String.valueOf(reform.getDatabaseNum())); keyValue.put("databaseNum", String.valueOf(reform.getDatabaseNum()));
keyValue.put("strategy",strategyToString(reform.getStrategy())); keyValue.put("strategy", strategyToString(reform.getStrategy()));
keyValue.put("rto", RtoEnum.getByCode(reform.getRto()).getName()); keyValue.put("rto", RtoEnum.getByCode(reform.getRto()).getName());
keyValue.put("rpo", RpoEnum.getByCode(reform.getRpo()).getName()); keyValue.put("rpo", RpoEnum.getByCode(reform.getRpo()).getName());
keyValue.put("unitName",reform.getUnitName()); keyValue.put("unitName", reform.getUnitName());
keyValue.put("unitPhone",reform.getUnitPhone()); keyValue.put("unitPhone", reform.getUnitPhone());
keyValue.put("unitContent",reform.getUnitContent()); keyValue.put("unitContent", reform.getUnitContent());
keyValue.put("gradeProtection",flipYesOrNo(reform.getGradeProtection())); keyValue.put("gradeProtection", flipYesOrNo(reform.getGradeProtection()));
keyValue.put("cycle",String.valueOf(reform.getCycle())); keyValue.put("cycle", String.valueOf(reform.getCycle()));
SystemStructure systemStructure = reform.getSystemStructure(); SystemStructure systemStructure = reform.getSystemStructure();
Details application = systemStructure.getApplication(); Details application = systemStructure.getApplication();
getSys("application",application,keyValue); getSys("application", application, keyValue);
Details database = systemStructure.getDatabase(); Details database = systemStructure.getDatabase();
getSys("database",database,keyValue); getSys("database", database, keyValue);
Details nas = systemStructure.getNas(); Details nas = systemStructure.getNas();
getSys("nas",nas,keyValue); getSys("nas", nas, keyValue);
Details slb = systemStructure.getSlb(); Details slb = systemStructure.getSlb();
getSys("slb",slb,keyValue); getSys("slb", slb, keyValue);
Details cdn = systemStructure.getCdn(); Details cdn = systemStructure.getCdn();
getSys("cdn",cdn,keyValue); getSys("cdn", cdn, keyValue);
Details vps = systemStructure.getVps(); Details vps = systemStructure.getVps();
getSys("vps",vps,keyValue); getSys("vps", vps, keyValue);
Browser browser = reform.getBrowser(); Browser browser = reform.getBrowser();
repairMap("compatibleBrowsers", 13, browser.getCompatibleBrowsers(), keyValue); repairMap("compatibleBrowsers", 13, browser.getCompatibleBrowsers(), keyValue);
repairMap("browserPlugs",13,browser.getBrowserPlugs(),keyValue); repairMap("browserPlugs", 13, browser.getBrowserPlugs(), keyValue);
repairMap("middleware",13,reform.getMiddleware().getMiddlewareEnums(),keyValue); repairMap("middleware", 13, reform.getMiddleware().getMiddlewareEnums(), keyValue);
Middleware middleware = reform.getMiddleware(); Middleware middleware = reform.getMiddleware();
List<OtherApi> otherApis = middleware.getOtherApis(); List<OtherApi> otherApis = middleware.getOtherApis();
for (int i = 0; i < 13; i++) { for (int i = 0; i < 13; i++) {
int i1 = i + 1; int i1 = i + 1;
if(i>=otherApis.size()){ if (i >= otherApis.size()) {
keyValue.put("otherApi"+i1, "无"); keyValue.put("otherApi" + i1, "无");
continue; continue;
} }
keyValue.put("otherApi"+i1, otherApis.get(i).getApiName()); keyValue.put("otherApi" + i1, otherApis.get(i).getApiName());
} }
repairMap("microService",13,middleware.getMicroServices(),keyValue); repairMap("microService", 13, middleware.getMicroServices(), keyValue);
Database database1 = reform.getDatabase(); Database database1 = reform.getDatabase();
for (int i = 0; i < 13; i++) { for (int i = 0; i < 13; i++) {
int i1 = i + 1; int i1 = i + 1;
if(i>=database1.getDatabaseType().size()){ if (i >= database1.getDatabaseType().size()) {
keyValue.put("database"+i1, "无"); keyValue.put("database" + i1, "无");
continue; continue;
} }
keyValue.put("database"+i1, database1.getDatabaseType().get(i).getName()); keyValue.put("database" + i1, database1.getDatabaseType().get(i).getName());
} }
...@@ -111,20 +110,20 @@ public class WpsUtil { ...@@ -111,20 +110,20 @@ public class WpsUtil {
keyValue.put("databaseDisasterTolerance", flipYesOrNo(database1.getDisasterTolerance())); keyValue.put("databaseDisasterTolerance", flipYesOrNo(database1.getDisasterTolerance()));
keyValue.put("databaseSeparate", flipYesOrNo(database1.getSeparate())); keyValue.put("databaseSeparate", flipYesOrNo(database1.getSeparate()));
keyValue.put("databasePerformance", flipYesOrNo(database1.getPerformance())); keyValue.put("databasePerformance", flipYesOrNo(database1.getPerformance()));
keyValue.put("databaseOtherContent",database1.getOtherContent()); keyValue.put("databaseOtherContent", database1.getOtherContent());
Apply apply = reform.getApply(); Apply apply = reform.getApply();
keyValue.put("applyCost",String.valueOf(apply.getCost())); keyValue.put("applyCost", String.valueOf(apply.getCost()));
keyValue.put("applyReason",apply.getReason()); keyValue.put("applyReason", apply.getReason());
DevelopLanguageSystem developLanguageSystem = reform.getDevelopLanguageSystem(); DevelopLanguageSystem developLanguageSystem = reform.getDevelopLanguageSystem();
keyValue.put("language",developLanguageSystem.getName()); keyValue.put("language", developLanguageSystem.getName());
repairMap("devFrameworks",13,developLanguageSystem.getDevFrameworks(),keyValue); repairMap("devFrameworks", 13, developLanguageSystem.getDevFrameworks(), keyValue);
repairMap("fontDevTechnologies",13,developLanguageSystem.getFontDevTechnologies(),keyValue); repairMap("fontDevTechnologies", 13, developLanguageSystem.getFontDevTechnologies(), keyValue);
repairMap("csDevTechnologies",13,developLanguageSystem.getCsDevTechnologies(),keyValue); repairMap("csDevTechnologies", 13, developLanguageSystem.getCsDevTechnologies(), keyValue);
repairMap("opGAs",13,developLanguageSystem.getOpGAs(),keyValue); repairMap("opGAs", 13, developLanguageSystem.getOpGAs(), keyValue);
repairMap("devLanguages",13,developLanguageSystem.getDevLanguages(),keyValue); repairMap("devLanguages", 13, developLanguageSystem.getDevLanguages(), keyValue);
LocalSystemDep localSystemDep = reform.getLocalSystemDep(); LocalSystemDep localSystemDep = reform.getLocalSystemDep();
...@@ -135,147 +134,148 @@ public class WpsUtil { ...@@ -135,147 +134,148 @@ public class WpsUtil {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String format = simpleDateFormat.format(assessmentReport.getTime()); String format = simpleDateFormat.format(assessmentReport.getTime());
keyValue.put("inspectTime", format); keyValue.put("inspectTime", format);
keyValue.put("createTime", System.currentTimeMillis()+""); keyValue.put("createTime", System.currentTimeMillis() + "");
keyValue.put("difficulty",String.valueOf(assessmentReport.getDifficulty())); keyValue.put("difficulty", String.valueOf(assessmentReport.getDifficulty()));
keyValue.put("budget",assessmentReport.getBudget()); keyValue.put("budget", assessmentReport.getBudget());
SysScale sysScale = assessmentReport.getSysScale(); SysScale sysScale = assessmentReport.getSysScale();
keyValue.put("sysScaleCodeNum",sysScale.getCode().getNum().toString()); keyValue.put("sysScaleCodeNum", sysScale.getCode().getNum().toString());
keyValue.put("sysScaleCodeDes",sysScale.getCode().getDes()); keyValue.put("sysScaleCodeDes", sysScale.getCode().getDes());
keyValue.put("sysScaleFileNum",sysScale.getFile().getNum().toString()); keyValue.put("sysScaleFileNum", sysScale.getFile().getNum().toString());
keyValue.put("sysScaleFileDes",sysScale.getFile().getDes()); keyValue.put("sysScaleFileDes", sysScale.getFile().getDes());
keyValue.put("sysScaleModeNum",sysScale.getMode().getNum().toString()); keyValue.put("sysScaleModeNum", sysScale.getMode().getNum().toString());
keyValue.put("sysScaleModeDes",sysScale.getMode().getDes()); keyValue.put("sysScaleModeDes", sysScale.getMode().getDes());
TechnologyList technologyList = assessmentReport.getTechnologyList(); TechnologyList technologyList = assessmentReport.getTechnologyList();
keyValue.put("technologyDes",technologyList.getDes()); keyValue.put("technologyDes", technologyList.getDes());
List<TechnologyReport> technologyReports = technologyList.getTechnologyReports(); List<TechnologyReport> technologyReports = technologyList.getTechnologyReports();
for (int i = 0; i < technologyList.getTechnologyReports().size(); i++) { for (int i = 0; i < technologyList.getTechnologyReports().size(); i++) {
int i2 = i + 1; int i2 = i + 1;
keyValue.put("technology"+i2, technologyReports.get(i).getTechnology()); keyValue.put("technology" + i2, technologyReports.get(i).getTechnology());
for (int i1 = 0; i1 < technologyReports.get(i).getTechnologyContents().size(); i1++) { for (int i1 = 0; i1 < technologyReports.get(i).getTechnologyContents().size(); i1++) {
int i3 = i1 + 1; int i3 = i1 + 1;
TechnologyContent technologyContent = technologyReports.get(i).getTechnologyContents().get(i1); TechnologyContent technologyContent = technologyReports.get(i).getTechnologyContents().get(i1);
keyValue.put("technologyContentLocal"+i2+"-"+i3, technologyContent.getLocal()); keyValue.put("technologyContentLocal" + i2 + "-" + i3, technologyContent.getLocal());
keyValue.put("technologyContentKeyWord"+i2+"-"+i3, technologyContent.getKeyWord()); keyValue.put("technologyContentKeyWord" + i2 + "-" + i3, technologyContent.getKeyWord());
keyValue.put("technologyContentFile"+i2+"-"+i3, technologyContent.getFile()); keyValue.put("technologyContentFile" + i2 + "-" + i3, technologyContent.getFile());
keyValue.put("technologyContentPosition"+i2+"-"+i3, technologyContent.getPosition()); keyValue.put("technologyContentPosition" + i2 + "-" + i3, technologyContent.getPosition());
keyValue.put("technologyContentStrategy"+i2+"-"+i3, getMode(technologyContent.getStrategy())); keyValue.put("technologyContentStrategy" + i2 + "-" + i3, getMode(technologyContent.getStrategy()));
} }
} }
for (TechnologyReport technologyReport : technologyReports) { for (TechnologyReport technologyReport : technologyReports) {
teMap.put(technologyReport.getTechnology(),technologyReport.getTechnologyContents()); teMap.put(technologyReport.getTechnology(), technologyReport.getTechnologyContents());
} }
Set<String> strings = teMap.keySet(); Set<String> strings = teMap.keySet();
StringBuilder youhua=new StringBuilder(); StringBuilder youhua = new StringBuilder();
StringBuilder xiugai=new StringBuilder(); StringBuilder xiugai = new StringBuilder();
StringBuilder weizhi=new StringBuilder(); StringBuilder weizhi = new StringBuilder();
for (String string : strings) { for (String string : strings) {
if(string.contains("优化")){ if (string.contains("优化")) {
List<TechnologyContent> technologyContents = teMap.get(string); List<TechnologyContent> technologyContents = teMap.get(string);
String str = DocumentWordUtil.getTableString(technologyContents, string, "优化"); String str = DocumentWordUtil.getTableString(technologyContents, string, "优化");
youhua.append(str); youhua.append(str);
}else if(string.contains("不支持")){ } else if (string.contains("不支持")) {
List<TechnologyContent> technologyContents = teMap.get(string); List<TechnologyContent> technologyContents = teMap.get(string);
String str = DocumentWordUtil.getTableString(technologyContents, string, "重新开发"); String str = DocumentWordUtil.getTableString(technologyContents, string, "重新开发");
xiugai.append(str); xiugai.append(str);
}else if(string.contains("未知")){ } else if (string.contains("未知")) {
List<TechnologyContent> technologyContents = teMap.get(string); List<TechnologyContent> technologyContents = teMap.get(string);
String str = DocumentWordUtil.getTableString(technologyContents, string, "验证修改或重新开发"); String str = DocumentWordUtil.getTableString(technologyContents, string, "验证修改或重新开发");
weizhi.append(str); weizhi.append(str);
} }
} }
keyValue.put("teyouhua",youhua.toString()); keyValue.put("teyouhua", youhua.toString());
keyValue.put("texiugai",xiugai.toString()); keyValue.put("texiugai", xiugai.toString());
keyValue.put("teweizhi",weizhi.toString()); keyValue.put("teweizhi", weizhi.toString());
Workload workload = assessmentReport.getWorkload(); Workload workload = assessmentReport.getWorkload();
keyValue.put("workloadDes",workload.getDes()); keyValue.put("workloadDes", workload.getDes());
keyValue.put("workloadCost",String.valueOf(workload.getCost())); keyValue.put("workloadCost", String.valueOf(workload.getCost()));
keyValue.put("workloadMode",String.valueOf(workload.getMode())); keyValue.put("workloadMode", String.valueOf(workload.getMode()));
Basis development = workload.getDevelopment(); Basis development = workload.getDevelopment();
keyValue.put("workloadDevelopmentVolume",String.valueOf(development.getDevelopmentVolume())); keyValue.put("workloadDevelopmentVolume", String.valueOf(development.getDevelopmentVolume()));
keyValue.put("workloadDevelopmentCorrectionFactor",String.valueOf(development.getCorrectionFactor())); keyValue.put("workloadDevelopmentCorrectionFactor", String.valueOf(development.getCorrectionFactor()));
Basis test = workload.getTest(); Basis test = workload.getTest();
keyValue.put("workloadTestVolume",String.valueOf(test.getDevelopmentVolume())); keyValue.put("workloadTestVolume", String.valueOf(test.getDevelopmentVolume()));
keyValue.put("workloadTestCorrectionFactor",String.valueOf(test.getCorrectionFactor())); keyValue.put("workloadTestCorrectionFactor", String.valueOf(test.getCorrectionFactor()));
Basis deploy = workload.getDeploy(); Basis deploy = workload.getDeploy();
keyValue.put("workloadDeployVolume",String.valueOf(deploy.getDevelopmentVolume())); keyValue.put("workloadDeployVolume", String.valueOf(deploy.getDevelopmentVolume()));
keyValue.put("workloadDeployCorrectionFactor",String.valueOf(deploy.getCorrectionFactor())); keyValue.put("workloadDeployCorrectionFactor", String.valueOf(deploy.getCorrectionFactor()));
Basis total = workload.getTotal(); Basis total = workload.getTotal();
keyValue.put("workloadTotalVolume",String.valueOf(total.getDevelopmentVolume())); keyValue.put("workloadTotalVolume", String.valueOf(total.getDevelopmentVolume()));
keyValue.put("workloadTotalCorrectionFactor",String.valueOf(total.getCorrectionFactor())); keyValue.put("workloadTotalCorrectionFactor", String.valueOf(total.getCorrectionFactor()));
DifficultyAssessment difficultyAssessment = assessmentReport.getDifficultyAssessment(); DifficultyAssessment difficultyAssessment = assessmentReport.getDifficultyAssessment();
keyValue.put("difficultyAssessmentDes",difficultyAssessment.getDes()); keyValue.put("difficultyAssessmentDes", difficultyAssessment.getDes());
FrameDifficulty frameDifficulty = difficultyAssessment.getFrameDifficulty(); FrameDifficulty frameDifficulty = difficultyAssessment.getFrameDifficulty();
keyValue.put("difficultyDifficultySystemEvaluation",String.valueOf(frameDifficulty.getSystemEvaluation())); keyValue.put("difficultyDifficultySystemEvaluation", String.valueOf(frameDifficulty.getSystemEvaluation()));
keyValue.put("difficultyDifficultyMessage",String.valueOf(frameDifficulty.getMessage())); keyValue.put("difficultyDifficultyMessage", String.valueOf(frameDifficulty.getMessage()));
keyValue.put("difficultyDifficultyDifficulty",String.valueOf(frameDifficulty.getDifficulty())); keyValue.put("difficultyDifficultyDifficulty", String.valueOf(frameDifficulty.getDifficulty()));
keyValue.put("difficultyDifficultyLoad",String.valueOf(frameDifficulty.getLoad())); keyValue.put("difficultyDifficultyLoad", String.valueOf(frameDifficulty.getLoad()));
keyValue.put("difficultyDifficultyDetails",Framework.getByCode(frameDifficulty.getDetails()).getName()); keyValue.put("difficultyDifficultyDetails", Framework.getByCode(frameDifficulty.getDetails()).getName());
keyValue.put("difficultyDifficultyDistributed",flipYesOrNo(frameDifficulty.getDistributed())); keyValue.put("difficultyDifficultyDistributed", flipYesOrNo(frameDifficulty.getDistributed()));
keyValue.put("difficultyDifficultyLoadBalance",flipYesOrNo(frameDifficulty.getLoadBalance())); keyValue.put("difficultyDifficultyLoadBalance", flipYesOrNo(frameDifficulty.getLoadBalance()));
keyValue.put("difficultyDifficultyDisaster",flipYesOrNo(frameDifficulty.getDisaster())); keyValue.put("difficultyDifficultyDisaster", flipYesOrNo(frameDifficulty.getDisaster()));
keyValue.put("difficultyDifficultyOtherDemand",frameDifficulty.getOtherDemand()); keyValue.put("difficultyDifficultyOtherDemand", frameDifficulty.getOtherDemand());
BrowserDifficulty browserDifficulty = difficultyAssessment.getBrowserDifficulty(); BrowserDifficulty browserDifficulty = difficultyAssessment.getBrowserDifficulty();
keyValue.put("browserDifficultySystemEvaluation",String.valueOf(browserDifficulty.getSystemEvaluation())); keyValue.put("browserDifficultySystemEvaluation", String.valueOf(browserDifficulty.getSystemEvaluation()));
keyValue.put("browserDifficultyMessage",String.valueOf(browserDifficulty.getMessage())); keyValue.put("browserDifficultyMessage", String.valueOf(browserDifficulty.getMessage()));
keyValue.put("browserDifficultyDifficulty",String.valueOf(browserDifficulty.getDifficulty())); keyValue.put("browserDifficultyDifficulty", String.valueOf(browserDifficulty.getDifficulty()));
keyValue.put("browserDifficultyLoad",String.valueOf(browserDifficulty.getLoad())); keyValue.put("browserDifficultyLoad", String.valueOf(browserDifficulty.getLoad()));
keyValue.put("browserDifficultyStyle",flipYesOrNo(browserDifficulty.getStyle())); keyValue.put("browserDifficultyStyle", flipYesOrNo(browserDifficulty.getStyle()));
keyValue.put("browserDifficultyApi",flipYesOrNo(browserDifficulty.getApi())); keyValue.put("browserDifficultyApi", flipYesOrNo(browserDifficulty.getApi()));
keyValue.put("browserDifficultyPlugInUnit",flipYesOrNo(browserDifficulty.getPlugInUnit())); keyValue.put("browserDifficultyPlugInUnit", flipYesOrNo(browserDifficulty.getPlugInUnit()));
keyValue.put("browserDifficultyGeography",flipYesOrNo(browserDifficulty.getGeography())); keyValue.put("browserDifficultyGeography", flipYesOrNo(browserDifficulty.getGeography()));
keyValue.put("browserDifficultyPeripheral",flipYesOrNo(browserDifficulty.getPeripheral())); keyValue.put("browserDifficultyPeripheral", flipYesOrNo(browserDifficulty.getPeripheral()));
keyValue.put("browserDifficultyAnimation",flipYesOrNo(browserDifficulty.getAnimation())); keyValue.put("browserDifficultyAnimation", flipYesOrNo(browserDifficulty.getAnimation()));
keyValue.put("browserDifficultyThreeD",flipYesOrNo(browserDifficulty.getThreeD())); keyValue.put("browserDifficultyThreeD", flipYesOrNo(browserDifficulty.getThreeD()));
keyValue.put("browserDifficultyDocument",flipYesOrNo(browserDifficulty.getDocument())); keyValue.put("browserDifficultyDocument", flipYesOrNo(browserDifficulty.getDocument()));
keyValue.put("browserDifficultyMedia",flipYesOrNo(browserDifficulty.getMedia())); keyValue.put("browserDifficultyMedia", flipYesOrNo(browserDifficulty.getMedia()));
keyValue.put("browserDifficultyFlash",flipYesOrNo(browserDifficulty.getFlash())); keyValue.put("browserDifficultyFlash", flipYesOrNo(browserDifficulty.getFlash()));
keyValue.put("browserDifficultyOtherDemand",flipYesOrNo(browserDifficulty.getOtherDemand())); keyValue.put("browserDifficultyOtherDemand", flipYesOrNo(browserDifficulty.getOtherDemand()));
MiddlewareDifficulty middlewareDifficulty = difficultyAssessment.getMiddlewareDifficulty(); MiddlewareDifficulty middlewareDifficulty = difficultyAssessment.getMiddlewareDifficulty();
keyValue.put("middlewareDifficultySystemEvaluation",String.valueOf(middlewareDifficulty.getSystemEvaluation())); keyValue.put("middlewareDifficultySystemEvaluation", String.valueOf(middlewareDifficulty.getSystemEvaluation()));
keyValue.put("middlewareDifficultyMessage",String.valueOf(middlewareDifficulty.getMessage())); keyValue.put("middlewareDifficultyMessage", String.valueOf(middlewareDifficulty.getMessage()));
keyValue.put("middlewareDifficultyDifficulty",String.valueOf(middlewareDifficulty.getDifficulty())); keyValue.put("middlewareDifficultyDifficulty", String.valueOf(middlewareDifficulty.getDifficulty()));
keyValue.put("middlewareDifficultyLoad",String.valueOf(middlewareDifficulty.getLoad())); keyValue.put("middlewareDifficultyLoad", String.valueOf(middlewareDifficulty.getLoad()));
keyValue.put("middlewareDifficultyNumber",String.valueOf(middlewareDifficulty.getNumber())); keyValue.put("middlewareDifficultyNumber", String.valueOf(middlewareDifficulty.getNumber()));
keyValue.put("middlewareDifficultyWeb",flipYesOrNo(middlewareDifficulty.getWeb())); keyValue.put("middlewareDifficultyWeb", flipYesOrNo(middlewareDifficulty.getWeb()));
keyValue.put("middlewareDifficultyJndi",flipYesOrNo(middlewareDifficulty.getJndi())); keyValue.put("middlewareDifficultyJndi", flipYesOrNo(middlewareDifficulty.getJndi()));
keyValue.put("middlewareDifficultyJms",flipYesOrNo(middlewareDifficulty.getJms())); keyValue.put("middlewareDifficultyJms", flipYesOrNo(middlewareDifficulty.getJms()));
keyValue.put("middlewareDifficultyRoute",flipYesOrNo(middlewareDifficulty.getRoute())); keyValue.put("middlewareDifficultyRoute", flipYesOrNo(middlewareDifficulty.getRoute()));
DatabaseDifficulty databaseDifficulty = difficultyAssessment.getDatabaseDifficulty(); DatabaseDifficulty databaseDifficulty = difficultyAssessment.getDatabaseDifficulty();
keyValue.put("databaseDifficultyDifficulty",String.valueOf(databaseDifficulty.getDifficulty())); keyValue.put("databaseDifficultyDifficulty", String.valueOf(databaseDifficulty.getDifficulty()));
keyValue.put("databaseDifficultyLoad",String.valueOf(databaseDifficulty.getLoad())); keyValue.put("databaseDifficultyLoad", String.valueOf(databaseDifficulty.getLoad()));
keyValue.put("databaseDisasterTolerance",getDis(databaseDifficulty.getDisasterTolerance())); keyValue.put("databaseDisasterTolerance", getDis(databaseDifficulty.getDisasterTolerance()));
keyValue.put("databaseDifficultySafe",flipYesOrNo(databaseDifficulty.getSafe())); keyValue.put("databaseDifficultySafe", flipYesOrNo(databaseDifficulty.getSafe()));
keyValue.put("databaseDifficultySeparate",flipYesOrNo(databaseDifficulty.getSeparate())); keyValue.put("databaseDifficultySeparate", flipYesOrNo(databaseDifficulty.getSeparate()));
keyValue.put("databaseDifficultyPerformance",flipYesOrNo(databaseDifficulty.getPerformance())); keyValue.put("databaseDifficultyPerformance", flipYesOrNo(databaseDifficulty.getPerformance()));
ProgramDifficulty programDifficulty = difficultyAssessment.getProgramDifficulty(); ProgramDifficulty programDifficulty = difficultyAssessment.getProgramDifficulty();
keyValue.put("programDifficultyDifficulty",String.valueOf(programDifficulty.getDifficulty())); keyValue.put("programDifficultyDifficulty", String.valueOf(programDifficulty.getDifficulty()));
keyValue.put("programDifficultyLoad",String.valueOf(programDifficulty.getLoad())); keyValue.put("programDifficultyLoad", String.valueOf(programDifficulty.getLoad()));
return keyValue; return keyValue;
} }
public static DocumentContent setDocumentTable(List<String> data,int col){ public static DocumentContent setDocumentTable(List<String> data, int col) {
// String tableString = DocumentWordUtil.getTableString(data, col); // String tableString = DocumentWordUtil.getTableString(data, col);
// DocumentContent documentContent = new DocumentContent(); // DocumentContent documentContent = new DocumentContent();
// 设置进head标题下面的表格中 // 设置进head标题下面的表格中
// documentContent.setDocumentTable(tableString); // documentContent.setDocumentTable(tableString);
return null; return null;
} }
public static List<DocumentContent> setDocumentContents(DocumentContent documentContent){
public static List<DocumentContent> setDocumentContents(DocumentContent documentContent) {
ArrayList<DocumentContent> documentContents = new ArrayList<>(); ArrayList<DocumentContent> documentContents = new ArrayList<>();
documentContents.add(documentContent); documentContents.add(documentContent);
return documentContents; return documentContents;
...@@ -294,6 +294,7 @@ public class WpsUtil { ...@@ -294,6 +294,7 @@ public class WpsUtil {
} }
return -1; return -1;
} }
private static String getFilpFramework(int construction) { private static String getFilpFramework(int construction) {
switch (construction) { switch (construction) {
case 1: case 1:
...@@ -319,6 +320,7 @@ public class WpsUtil { ...@@ -319,6 +320,7 @@ public class WpsUtil {
return -1; return -1;
} }
} }
private static int SpecialYesOrNo(String target) { private static int SpecialYesOrNo(String target) {
if ("是".equals(target)) { if ("是".equals(target)) {
return 4; return 4;
...@@ -328,6 +330,7 @@ public class WpsUtil { ...@@ -328,6 +330,7 @@ public class WpsUtil {
return -1; return -1;
} }
} }
private static String flipYesOrNo(Integer target) { private static String flipYesOrNo(Integer target) {
if (target == 1) { if (target == 1) {
return "是"; return "是";
...@@ -337,8 +340,9 @@ public class WpsUtil { ...@@ -337,8 +340,9 @@ public class WpsUtil {
return "我不清楚"; return "我不清楚";
} }
} }
private static String flipSafeYesOrNo(Integer target) { private static String flipSafeYesOrNo(Integer target) {
if(target==null){ if (target == null) {
return "否"; return "否";
} }
if (target == 4) { if (target == 4) {
...@@ -349,6 +353,7 @@ public class WpsUtil { ...@@ -349,6 +353,7 @@ public class WpsUtil {
return "我不清楚"; return "我不清楚";
} }
} }
private static String flipSpecialYesOrNo(Integer target) { private static String flipSpecialYesOrNo(Integer target) {
if (target == 4) { if (target == 4) {
return "是"; return "是";
...@@ -360,7 +365,7 @@ public class WpsUtil { ...@@ -360,7 +365,7 @@ public class WpsUtil {
} }
private static String getMode(Integer target) { private static String getMode(Integer target) {
if(target==null){ if (target == null) {
return "我不清楚"; return "我不清楚";
} }
if (target == 1) { if (target == 1) {
...@@ -373,7 +378,7 @@ public class WpsUtil { ...@@ -373,7 +378,7 @@ public class WpsUtil {
} }
private static String flipSafeStrong(Integer target) { private static String flipSafeStrong(Integer target) {
if(target==null || target==1){ if (target == null || target == 1) {
return "无"; return "无";
} }
if (target == 3) { if (target == 3) {
...@@ -384,71 +389,74 @@ public class WpsUtil { ...@@ -384,71 +389,74 @@ public class WpsUtil {
return "我不清楚"; return "我不清楚";
} }
} }
private static String strategyToString(Integer target){
if(target == 1){ private static String strategyToString(Integer target) {
if (target == 1) {
return "休息日或晚间切换"; return "休息日或晚间切换";
}else if(target == 2){ } else if (target == 2) {
return "暂停服务"; return "暂停服务";
}else if(target == 3){ } else if (target == 3) {
return "平滑过渡"; return "平滑过渡";
}else{ } else {
return "不清楚"; return "不清楚";
} }
} }
private static String localOrCloud(Integer deploy){ private static String localOrCloud(Integer deploy) {
if(deploy==1){ if (deploy == 1) {
return "本地"; return "本地";
}else if(deploy==2){ } else if (deploy == 2) {
return "政务云"; return "政务云";
}else{ } else {
return "不清楚"; return "不清楚";
} }
} }
private static String getDis(Integer dis){
if(dis==1){ private static String getDis(Integer dis) {
if (dis == 1) {
return "否"; return "否";
}else if(dis==2){ } else if (dis == 2) {
return "主备"; return "主备";
}else if(dis==3){ } else if (dis == 3) {
return "分布式"; return "分布式";
}else{ } else {
return "不清楚"; return "不清楚";
} }
} }
private static void getSys(String sysName,Details application, Map<String,String> keyValue){
keyValue.put(sysName+"Deploy",localOrCloud(application.getDeploy())); private static void getSys(String sysName, Details application, Map<String, String> keyValue) {
keyValue.put(sysName+"OperateSystem",application.getOperateSystem().getName()); keyValue.put(sysName + "Deploy", localOrCloud(application.getDeploy()));
keyValue.put(sysName+"Code",String.valueOf(application.getOperateSystem().getCode())); keyValue.put(sysName + "OperateSystem", application.getOperateSystem().getName());
keyValue.put(sysName+"Num",application.getNum()); keyValue.put(sysName + "Code", String.valueOf(application.getOperateSystem().getCode()));
keyValue.put(sysName+"CpuNum",application.getCpuNum()); keyValue.put(sysName + "Num", application.getNum());
keyValue.put(sysName+"Ghz",application.getGhz()); keyValue.put(sysName + "CpuNum", application.getCpuNum());
keyValue.put(sysName+"Space",application.getSpace()); keyValue.put(sysName + "Ghz", application.getGhz());
keyValue.put(sysName+"Other",application.getSpace()); keyValue.put(sysName + "Space", application.getSpace());
keyValue.put(sysName+"Edition",application.getEdition()); keyValue.put(sysName + "Other", application.getSpace());
keyValue.put(sysName+"Memory",application.getMemory()); 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){ private static void repairMap(String name, int size, List<BaseDes> list, Map<String, String> keyValue) {
if(list!=null&&list.size()>0){ if (list != null && list.size() > 0) {
int len=list.size(); int len = list.size();
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
int i1 = i + 1; int i1 = i + 1;
if(len>i){ if (len > i) {
if(!StringUtils.isEmpty(list.get(i).getName())) { if (!StringUtils.isEmpty(list.get(i).getName())) {
keyValue.put(name+ i1,list.get(i).getName()); keyValue.put(name + i1, list.get(i).getName());
}else{ } else {
keyValue.put(name + i1,"无" ); keyValue.put(name + i1, "无");
} }
}else { } else {
keyValue.put(name+i1, "无"); keyValue.put(name + i1, "无");
} }
} }
}else{ } else {
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
int i1 = i + 1; int i1 = i + 1;
keyValue.put(name+i1, "无"); keyValue.put(name + i1, "无");
} }
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论