|
@@ -357,6 +357,8 @@ public class MaliciousIpServiceImpl implements MaliciousIpService { |
|
@@ -357,6 +357,8 @@ public class MaliciousIpServiceImpl implements MaliciousIpService { |
357
|
//组装数据
|
357
|
//组装数据
|
358
|
List<MaliciousIp> listMaliciousIp = new ArrayList<MaliciousIp>();
|
358
|
List<MaliciousIp> listMaliciousIp = new ArrayList<MaliciousIp>();
|
359
|
long ts=0l;
|
359
|
long ts=0l;
|
|
|
360
|
+ String insertTime="";
|
|
|
361
|
+ String insertTime2="";
|
360
|
for(String mipKey : mipKeys){
|
362
|
for(String mipKey : mipKeys){
|
361
|
MaliciousIp mip = new MaliciousIp();
|
363
|
MaliciousIp mip = new MaliciousIp();
|
362
|
mip.setIp(mipKey);
|
364
|
mip.setIp(mipKey);
|
|
@@ -366,6 +368,7 @@ public class MaliciousIpServiceImpl implements MaliciousIpService { |
|
@@ -366,6 +368,7 @@ public class MaliciousIpServiceImpl implements MaliciousIpService { |
366
|
if( awsIpInfo.get(mipKey) != null){
|
368
|
if( awsIpInfo.get(mipKey) != null){
|
367
|
Map<String,String> awsInfo = awsIpInfo.get(mipKey);
|
369
|
Map<String,String> awsInfo = awsIpInfo.get(mipKey);
|
368
|
String reason=awsInfo.get("reason");
|
370
|
String reason=awsInfo.get("reason");
|
|
|
371
|
+ insertTime=awsInfo.get("time");
|
369
|
try{
|
372
|
try{
|
370
|
MaliciousIpModel model=JSON.parseObject(reason,MaliciousIpModel.class);
|
373
|
MaliciousIpModel model=JSON.parseObject(reason,MaliciousIpModel.class);
|
371
|
reason=model.toHtmlString();
|
374
|
reason=model.toHtmlString();
|
|
@@ -383,6 +386,7 @@ public class MaliciousIpServiceImpl implements MaliciousIpService { |
|
@@ -383,6 +386,7 @@ public class MaliciousIpServiceImpl implements MaliciousIpService { |
383
|
reasonDur += "</br>";
|
386
|
reasonDur += "</br>";
|
384
|
}
|
387
|
}
|
385
|
String reason=qcloudInfo.get("reason");
|
388
|
String reason=qcloudInfo.get("reason");
|
|
|
389
|
+ insertTime2=qcloudInfo.get("time");
|
386
|
try{
|
390
|
try{
|
387
|
MaliciousIpModel model=JSON.parseObject(reason,MaliciousIpModel.class);
|
391
|
MaliciousIpModel model=JSON.parseObject(reason,MaliciousIpModel.class);
|
388
|
reason=model.toHtmlString();
|
392
|
reason=model.toHtmlString();
|
|
@@ -399,7 +403,7 @@ public class MaliciousIpServiceImpl implements MaliciousIpService { |
|
@@ -399,7 +403,7 @@ public class MaliciousIpServiceImpl implements MaliciousIpService { |
399
|
//reasonDur += "qcloud: " + qcloudInfo.get("dur")+ " -- "+ qcloudInfo.get("reason") ;
|
403
|
//reasonDur += "qcloud: " + qcloudInfo.get("dur")+ " -- "+ qcloudInfo.get("reason") ;
|
400
|
}
|
404
|
}
|
401
|
mip.setReasonDur(reasonDur);
|
405
|
mip.setReasonDur(reasonDur);
|
402
|
- if(ts>0){
|
406
|
+ /*if(ts>0){
|
403
|
String time="";
|
407
|
String time="";
|
404
|
try{
|
408
|
try{
|
405
|
time=new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" ).format(new Date(ts));
|
409
|
time=new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" ).format(new Date(ts));
|
|
@@ -407,18 +411,42 @@ public class MaliciousIpServiceImpl implements MaliciousIpService { |
|
@@ -407,18 +411,42 @@ public class MaliciousIpServiceImpl implements MaliciousIpService { |
407
|
|
411
|
|
408
|
}
|
412
|
}
|
409
|
mip.setTime(time);
|
413
|
mip.setTime(time);
|
410
|
- }
|
414
|
+ }*/
|
411
|
mip.setTs(ts);
|
415
|
mip.setTs(ts);
|
|
|
416
|
+ if(StringUtils.isNotBlank(insertTime)&&StringUtils.isNotBlank(insertTime2)){
|
|
|
417
|
+ try{
|
|
|
418
|
+ if(insertTime.compareTo(insertTime2)>0){
|
|
|
419
|
+ mip.setTime(insertTime.substring(0,10)+" "+insertTime.substring(11,19));
|
|
|
420
|
+ }else{
|
|
|
421
|
+ mip.setTime(insertTime2.substring(0,10)+" "+insertTime2.substring(11,19));
|
|
|
422
|
+ }
|
|
|
423
|
+ }catch (Exception e){
|
|
|
424
|
+
|
|
|
425
|
+ }
|
|
|
426
|
+ }
|
|
|
427
|
+
|
412
|
listMaliciousIp.add(mip);
|
428
|
listMaliciousIp.add(mip);
|
413
|
}
|
429
|
}
|
414
|
//排序
|
430
|
//排序
|
415
|
Collections.sort(listMaliciousIp,new Comparator<MaliciousIp>(){
|
431
|
Collections.sort(listMaliciousIp,new Comparator<MaliciousIp>(){
|
416
|
public int compare(MaliciousIp arg0, MaliciousIp arg1) {
|
432
|
public int compare(MaliciousIp arg0, MaliciousIp arg1) {
|
417
|
- long compare= arg0.getTs() - arg1.getTs();
|
433
|
+ /*long compare= arg0.getTs() - arg1.getTs();
|
418
|
if(compare<0L){
|
434
|
if(compare<0L){
|
419
|
return 1;
|
435
|
return 1;
|
420
|
}else{
|
436
|
}else{
|
421
|
return -1;
|
437
|
return -1;
|
|
|
438
|
+ }*/
|
|
|
439
|
+ if(StringUtils.isBlank(arg0.getTime())){
|
|
|
440
|
+ return 1;
|
|
|
441
|
+ }else if(StringUtils.isBlank(arg1.getTime())){
|
|
|
442
|
+ return 1;
|
|
|
443
|
+ }else{
|
|
|
444
|
+ int i= arg0.getTime().compareTo(arg1.getTime());
|
|
|
445
|
+ if(i<0){
|
|
|
446
|
+ return 1;
|
|
|
447
|
+ }else{
|
|
|
448
|
+ return -1;
|
|
|
449
|
+ }
|
422
|
}
|
450
|
}
|
423
|
|
451
|
|
424
|
}
|
452
|
}
|