...
|
...
|
@@ -200,6 +200,11 @@ public class MaliciousIpServiceImpl implements MaliciousIpService { |
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 比例排序
|
|
|
* @author hui.xu
|
|
|
*
|
|
|
*/
|
|
|
class ComparatorIpBL implements Comparator<MaliciousIpBL> {
|
|
|
public int compare(MaliciousIpBL e1, MaliciousIpBL e2) {
|
|
|
int count1 = e1.getPercent();
|
...
|
...
|
@@ -214,6 +219,25 @@ public class MaliciousIpServiceImpl implements MaliciousIpService { |
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 次数排序
|
|
|
* @author hui.xu
|
|
|
*
|
|
|
*/
|
|
|
class ComparatorIpCS implements Comparator<MaliciousIpCS> {
|
|
|
public int compare(MaliciousIpCS e1, MaliciousIpCS e2) {
|
|
|
int count1 = e1.getCount();
|
|
|
int count2 = e2.getCount();
|
|
|
if (count1 < count2) {
|
|
|
return 1;
|
|
|
} else if (count1 > count2) {
|
|
|
return -1;
|
|
|
} else {
|
|
|
return 0;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
class ComparatorDetailIp implements Comparator<MaliciousDetailIp> {
|
|
|
public int compare(MaliciousDetailIp e1, MaliciousDetailIp e2) {
|
|
|
int count1 = e1.getCount();
|
...
|
...
|
@@ -316,8 +340,8 @@ public class MaliciousIpServiceImpl implements MaliciousIpService { |
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
Date date;
|
|
|
for (MaliciousIpCS maliciousIp : listMaliciousIp) {
|
|
|
if(StringUtils.isNotBlank(yoho_ip) && StringUtils.isNoneBlank(maliciousIp.getIp())){
|
|
|
String []arrIp = StringUtils.split(maliciousIp.getIp(),'.');
|
|
|
if(StringUtils.isNotBlank(yoho_ip) && StringUtils.isNoneBlank(maliciousIp.getUserIP())){
|
|
|
String []arrIp = StringUtils.split(maliciousIp.getUserIP(),'.');
|
|
|
String inIp = arrIp[0] + "." + arrIp[1];
|
|
|
if(yoho_ip.indexOf(inIp) >= 0){
|
|
|
continue;
|
...
|
...
|
@@ -333,7 +357,7 @@ public class MaliciousIpServiceImpl implements MaliciousIpService { |
|
|
newlistMaliciousIp.add(maliciousIp);
|
|
|
}
|
|
|
}
|
|
|
Comparator comp = new ComparatorIp();
|
|
|
Comparator comp = new ComparatorIpCS();
|
|
|
Collections.sort(newlistMaliciousIp, comp);
|
|
|
response.setData(newlistMaliciousIp);
|
|
|
}catch(Exception e){
|
...
|
...
|
|