提交 cc866ccb authored 作者: 马晨俊's avatar 马晨俊

mcj:

修复websocket输送问题,文件上传问题
上级 67b1e5a5
...@@ -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,23 +387,58 @@ public class InspectController { ...@@ -381,23 +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){
// OSSInformation ossInformation = ossInformationService.queryOne();
// 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: 当前块上传失败,会取消整个文件上传。
// 其他状态码: 出错了,但是会自动重试上传。
try { try {
HashMap<String, String> map = new HashMap<>(); /**
map.put("unzip","获取压缩文件"); * 判断前端Form表单格式是否支持文件上传
File file = FileUtil.saveToLocal(multfile); */
map.put("unzip","压缩文件解压完毕"); boolean isMultipart = ServletFileUpload.isMultipartContent(request);
asyncTask.sendMessageToAll(map); if(!isMultipart){
String name = file.getName(); //这里是我向前端发送数据的代码,可理解为 return 数据; 具体的就不贴了
String path = file.getCanonicalPath(); System.out.println("不支持的表单格式");
return ServerResponse.ok(new com.zjty.inspect.entity.File(name, path)); return ServerResponse.badRequest();
} catch (IOException e) { }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 {
...@@ -412,7 +453,6 @@ public class InspectController { ...@@ -412,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);
} }
......
...@@ -156,10 +156,10 @@ public class Inspector { ...@@ -156,10 +156,10 @@ public class Inspector {
initData(); initData();
//扫描文件,进行文件分类 //扫描文件,进行文件分类
HashMap<String, String> map = new HashMap<>(); HashMap<String, String> map = new HashMap<>();
map.put("file","开始扫描文件"); map.put("msg","开始扫描文件");
asyncTask.sendMessageToAll(map); asyncTask.sendMessageToAll(map);
scanFiles(); scanFiles();
map.put("file","文件扫描结束"); map.put("msg","文件扫描结束");
asyncTask.sendMessageToAll(map); asyncTask.sendMessageToAll(map);
//配置参数 //配置参数
inspectParameter.setCodeSize((int) codeSize); inspectParameter.setCodeSize((int) codeSize);
...@@ -171,10 +171,10 @@ public class Inspector { ...@@ -171,10 +171,10 @@ public class Inspector {
//根据扫描结果以及用户配置得出需要使用的规则及技术 //根据扫描结果以及用户配置得出需要使用的规则及技术
ruleTransform(inspectParameter.getRecastMethod()); ruleTransform(inspectParameter.getRecastMethod());
//扫描源代码文件 //扫描源代码文件
map.put("file","开始扫描源代码文件"); map.put("msg","开始扫描源代码文件");
asyncTask.sendMessageToAll(map); asyncTask.sendMessageToAll(map);
forEachFilesMap(); forEachFilesMap();
map.put("file","源代码文件扫描结束"); map.put("msg","源代码文件扫描结束");
asyncTask.sendMessageToAll(map); 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());
...@@ -256,7 +256,7 @@ public class Inspector { ...@@ -256,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);
} }
......
...@@ -311,9 +311,14 @@ public class ExcelUtil { ...@@ -311,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);
......
...@@ -17,86 +17,89 @@ import java.util.*; ...@@ -17,86 +17,89 @@ 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;
}
if(otherApis.get(i).getOther()==1){
keyValue.put("otherApi" + i1, otherApis.get(i).getDes());
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,21 +114,20 @@ public class WpsUtil { ...@@ -111,21 +114,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("fontDevTechnologies",13,developLanguageSystem.getFontDevTechnologies(),keyValue);
repairMap("csDevTechnologies",13,developLanguageSystem.getCsDevTechnologies(),keyValue);
repairMap("opGAs",13,developLanguageSystem.getOpGAs(),keyValue);
repairMap("devLanguages",13,developLanguageSystem.getDevLanguages(),keyValue);
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(); LocalSystemDep localSystemDep = reform.getLocalSystemDep();
keyValue.put("localSystemDepName", localSystemDep.getName()); keyValue.put("localSystemDepName", localSystemDep.getName());
...@@ -135,147 +137,148 @@ public class WpsUtil { ...@@ -135,147 +137,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 +297,7 @@ public class WpsUtil { ...@@ -294,6 +297,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 +323,7 @@ public class WpsUtil { ...@@ -319,6 +323,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 +333,7 @@ public class WpsUtil { ...@@ -328,6 +333,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 +343,9 @@ public class WpsUtil { ...@@ -337,8 +343,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 +356,7 @@ public class WpsUtil { ...@@ -349,6 +356,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 +368,7 @@ public class WpsUtil { ...@@ -360,7 +368,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 +381,7 @@ public class WpsUtil { ...@@ -373,7 +381,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 +392,74 @@ public class WpsUtil { ...@@ -384,71 +392,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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论