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

mcj:

修复导入excel问题
上级 17667656
...@@ -384,8 +384,11 @@ public class InspectController { ...@@ -384,8 +384,11 @@ public class InspectController {
@PostMapping("/uploads") @PostMapping("/uploads")
private ServerResponse uploads(@RequestParam(value = "file") MultipartFile multfile) { private ServerResponse uploads(@RequestParam(value = "file") MultipartFile multfile) {
try { try {
HashMap<String, String> map = new HashMap<>();
map.put("unzip","获取压缩文件");
File file = FileUtil.saveToLocal(multfile); File file = FileUtil.saveToLocal(multfile);
map.put("unzip","压缩文件解压完毕");
asyncTask.sendMessageToAll(map);
String name = file.getName(); String name = file.getName();
String path = file.getCanonicalPath(); String path = file.getCanonicalPath();
return ServerResponse.ok(new com.zjty.inspect.entity.File(name, path)); return ServerResponse.ok(new com.zjty.inspect.entity.File(name, path));
......
...@@ -155,7 +155,12 @@ public class Inspector { ...@@ -155,7 +155,12 @@ public class Inspector {
//初始化成员变量 //初始化成员变量
initData(); initData();
//扫描文件,进行文件分类 //扫描文件,进行文件分类
HashMap<String, String> map = new HashMap<>();
map.put("file","开始扫描文件");
asyncTask.sendMessageToAll(map);
scanFiles(); scanFiles();
map.put("file","文件扫描结束");
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("file","开始扫描源代码文件");
asyncTask.sendMessageToAll(map);
forEachFilesMap(); forEachFilesMap();
map.put("file","源代码文件扫描结束");
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);
......
...@@ -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(remark);
}else{
font.setName(fontTechnologyEnum.getName()); 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(remark);
}else{
cs.setName(csTechnologyEnum.getName()); 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(remark);
}else{
opGA.setName(framework); 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(remark);
}else{
baseDes.setName(middlewareEnum.name()); 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(remark);
}else{
otherApi.setApiName(api); 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(remark);
}else{
microService.setName(microServiceEnum.getName()); microService.setName(microServiceEnum.getName());
}
microService.setCode(microServiceEnum.getCode()); microService.setCode(microServiceEnum.getCode());
microService.setDes(remark); microService.setDes(remark);
microService.setVersion(version); microService.setVersion(version);
...@@ -389,11 +359,7 @@ public class ExcelUtil { ...@@ -389,11 +359,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(remark);
}else{
baseDes.setName(compatibleBrowser.getName()); 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 +379,7 @@ public class ExcelUtil { ...@@ -413,11 +379,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(remark);
}else{
browserPlug.setName(browserPlugEnum.getName()); browserPlug.setName(browserPlugEnum.getName());
}
browserPlug.setCode(browserPlugEnum.getCode()); browserPlug.setCode(browserPlugEnum.getCode());
switch (plugin) { switch (plugin) {
case "在线文本编辑类:请在备注中填写插件名和版本": case "在线文本编辑类:请在备注中填写插件名和版本":
...@@ -442,7 +404,7 @@ public class ExcelUtil { ...@@ -442,7 +404,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 +446,11 @@ public class ExcelUtil { ...@@ -484,11 +446,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 +458,6 @@ public class ExcelUtil { ...@@ -496,7 +458,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 +466,14 @@ public class ExcelUtil { ...@@ -505,14 +466,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 +608,7 @@ public class ExcelUtil { ...@@ -647,6 +608,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 +634,7 @@ public class ExcelUtil { ...@@ -672,6 +634,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 +644,7 @@ public class ExcelUtil { ...@@ -681,6 +644,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 +654,9 @@ public class ExcelUtil { ...@@ -690,8 +654,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 +667,7 @@ public class ExcelUtil { ...@@ -702,6 +667,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 "是";
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论