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

mcj:修改数据库类型为oracle时反序列化问题

上级 810e38d7
...@@ -7,7 +7,7 @@ package com.zjty.inspect.enums; ...@@ -7,7 +7,7 @@ package com.zjty.inspect.enums;
* @Date : 2020-03-05 18:02 * @Date : 2020-03-05 18:02
*/ */
public enum DatabaseType { public enum DatabaseType {
ORCLE, ORACLE,
SQLSERVER, SQLSERVER,
DB2, DB2,
MYSQL, MYSQL,
......
...@@ -192,7 +192,7 @@ public class Inspector { ...@@ -192,7 +192,7 @@ public class Inspector {
if (path1.toAbsolutePath().toString().endsWith("jar") || path1.toAbsolutePath().toString().endsWith("class")) { if (path1.toAbsolutePath().toString().endsWith("jar") || path1.toAbsolutePath().toString().endsWith("class")) {
continue; continue;
} }
valiWarn(rules, path1, path1.getFileName().toString(), -1); valiWarn(rules, path1, path1.getFileName().toString(), 0);
//将文件的每一行都与规则匹配 //将文件的每一行都与规则匹配
List<String> strings = Files.readAllLines(path1); List<String> strings = Files.readAllLines(path1);
for (int i = 0; i < strings.size(); i++) { for (int i = 0; i < strings.size(); i++) {
...@@ -265,17 +265,24 @@ public class Inspector { ...@@ -265,17 +265,24 @@ public class Inspector {
/** /**
* rule所需要数据装配 * rule所需要数据装配
* @param status 状态
* 1:改造
* 2:适配
*/ */
private void ruleTransform(Integer status) { private void ruleTransform(Integer status) {
//如果需要改造则查询所有规则
if (status == 1) { if (status == 1) {
this.ruleList = ruleDao.findAll(); this.ruleList = ruleDao.findAll();
} else { } else {
//只查询前端技术
List<Technology> front = technologyDao.findAllByBackorfrontEquals(1); List<Technology> front = technologyDao.findAllByBackorfrontEquals(1);
List<String> ids = front.stream().map(Technology::getId).collect(Collectors.toList()); List<String> technologyIds = front.stream().map(Technology::getId).collect(Collectors.toList());
this.ruleList = ruleDao.findAllByTechnologyIdIn(ids); this.ruleList = ruleDao.findAllByTechnologyIdIn(technologyIds);
} }
Set<String> id = ruleList.stream().map(Rule::getTechnologyId).collect(Collectors.toSet()); //得到目前适用的技术id
List<Technology> technologies = technologyDao.findAllByIdIn(new ArrayList<>(id)); Set<String> technologyIds = ruleList.stream().map(Rule::getTechnologyId).collect(Collectors.toSet());
List<Technology> technologies = technologyDao.findAllByIdIn(new ArrayList<>(technologyIds));
for (Technology technology : technologies) { for (Technology technology : technologies) {
technologyHashMap.put(technology.getId(), technology); technologyHashMap.put(technology.getId(), technology);
} }
...@@ -289,13 +296,13 @@ public class Inspector { ...@@ -289,13 +296,13 @@ public class Inspector {
} }
} }
ArrayList<String> ruleSuffixKeys = new ArrayList<>(); ArrayList<String> ruleSuffixKeys = new ArrayList<>();
for (String s : ruleSuffixFilePathMap.keySet()) { for (String suffix : ruleSuffixFilePathMap.keySet()) {
if (!ruleSuffixMap.containsKey(s)) { if (!ruleSuffixMap.containsKey(suffix)) {
ruleSuffixKeys.add(s); ruleSuffixKeys.add(suffix);
} }
} }
for (String key : ruleSuffixKeys) { for (String suffix : ruleSuffixKeys) {
ruleSuffixFilePathMap.remove(key); ruleSuffixFilePathMap.remove(suffix);
} }
} }
...@@ -497,6 +504,10 @@ public class Inspector { ...@@ -497,6 +504,10 @@ public class Inspector {
return supportStatus; return supportStatus;
} }
/**
* 扫描源文件
* @throws IOException
*/
public void scanFiles() throws IOException { public void scanFiles() throws IOException {
//以下为计算文件名称匹配正则表达式 //以下为计算文件名称匹配正则表达式
FileSystem aDefault = FileSystems.getDefault(); FileSystem aDefault = FileSystems.getDefault();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论