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

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

......@@ -7,6 +7,7 @@ import com.zjty.inspect.enums.Framework;
import com.zjty.inspect.enums.LanguageEnum;
import com.zjty.inspect.enums.RecastMethod;
import com.zjty.inspect.service.RuleService;
import com.zjty.inspect.thread.task.AsyncTask;
import com.zjty.inspect.utils.*;
import lombok.AllArgsConstructor;
import lombok.Data;
......@@ -41,6 +42,9 @@ import static java.util.concurrent.CompletableFuture.runAsync;
@Transactional(rollbackFor = Exception.class)
public class Inspector {
@Autowired
private AsyncTask asyncTask;
private AnalysisFile analysisFile;
private BudgetUitl budgetUitl;
......@@ -203,7 +207,6 @@ public class Inspector {
* 配置文件的一个类型,xml文件
*/
if ("xml".equals(entry.getKey())) {
List<Path> value = entry.getValue();
for (Path path : entry.getValue()) {
......@@ -230,8 +233,16 @@ public class Inspector {
}
}
HashMap<String, String> map = new HashMap<>();
//指定后缀到文件匹配关键字
int fileNum = 0;
int fileSize = 0;
List<Integer> collect = ruleSuffixFilePathMap.entrySet().stream().map(Map.Entry::getValue).map(List::size).collect(Collectors.toList());
for (Integer integer : collect) {
fileSize=fileSize+integer;
}
for (Map.Entry<String, List<Path>> entry : ruleSuffixFilePathMap.entrySet()) {
//entry,key为后缀,value为文件列表
String key = entry.getKey();
......@@ -252,6 +263,10 @@ public class Inspector {
} catch (IOException e) {
log.error("解析{}出错,异常信息为{}", path1.toAbsolutePath().toString(), e.getMessage());
}
fileNum=fileNum + 1;
map.put("totalFile",fileNum+"/"+fileSize);
System.out.println(fileNum+"/"+fileSize);
asyncTask.sendMessageToAll(map);
}
}
}
......@@ -307,7 +322,7 @@ public class Inspector {
private void ruleTransform(Integer status) {
//如果需要改造则查询所有规则
if (status == 1) {
this.ruleList = ruleService.findRules();
this.ruleList = ruleService.mcjAllRule();
} else {
//只查询前端技术
List<Technology> front = technologyDao.findAllByBackorfrontEquals(1);
......
......@@ -149,7 +149,21 @@ public class RuleServiceImpl implements RuleService {
@Override
public List<Rule> findAllByTechnologyIdIn(List<String> technologyIds) {
return ruleDao.findAllByTechnologyIdIn(technologyIds);
List<Rule> rules = ruleDao.findAllByTechnologyIdIn(technologyIds);
List<Rule> ruleList = new ArrayList<>();
if (rules != null && rules.size() > 0) {
for (Rule rule : rules) {
String suffix = rule.getSuffix();
String[] split = suffix.split(",");
for (String s : split) {
Rule rule1 = new Rule();
BeanUtils.copyProperties(rule, rule1);
rule1.setSuffix(s);
ruleList.add(rule1);
}
}
}
return ruleList;
}
......
......@@ -25,7 +25,7 @@ public class AsyncTask {
* @Date: 2019/5/20
*/
@Async("myTaskAsyncPool")
public void sendMessageToAll(Map<String,String> map) throws Exception{
public void sendMessageToAll(Map<String,String> map) {
webSocketServer.sendMessageToAll(map);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论