|
@@ -241,6 +241,7 @@ public class MaliciousIpServiceImpl implements MaliciousIpService { |
|
@@ -241,6 +241,7 @@ public class MaliciousIpServiceImpl implements MaliciousIpService { |
241
|
|
241
|
|
242
|
//组装数据
|
242
|
//组装数据
|
243
|
List<MaliciousIp> listMaliciousIp = new ArrayList<MaliciousIp>();
|
243
|
List<MaliciousIp> listMaliciousIp = new ArrayList<MaliciousIp>();
|
|
|
244
|
+ long ts=0l;
|
244
|
for(String mipKey : mipKeys){
|
245
|
for(String mipKey : mipKeys){
|
245
|
MaliciousIp mip = new MaliciousIp();
|
246
|
MaliciousIp mip = new MaliciousIp();
|
246
|
mip.setIp(mipKey);
|
247
|
mip.setIp(mipKey);
|
|
@@ -253,6 +254,7 @@ public class MaliciousIpServiceImpl implements MaliciousIpService { |
|
@@ -253,6 +254,7 @@ public class MaliciousIpServiceImpl implements MaliciousIpService { |
253
|
try{
|
254
|
try{
|
254
|
MaliciousIpModel model=JSON.parseObject(reason,MaliciousIpModel.class);
|
255
|
MaliciousIpModel model=JSON.parseObject(reason,MaliciousIpModel.class);
|
255
|
reason=model.toHtmlString();
|
256
|
reason=model.toHtmlString();
|
|
|
257
|
+ ts=model.getTimestamp();
|
256
|
}catch (Exception e){
|
258
|
}catch (Exception e){
|
257
|
//
|
259
|
//
|
258
|
}
|
260
|
}
|
|
@@ -271,6 +273,9 @@ public class MaliciousIpServiceImpl implements MaliciousIpService { |
|
@@ -271,6 +273,9 @@ public class MaliciousIpServiceImpl implements MaliciousIpService { |
271
|
try{
|
273
|
try{
|
272
|
MaliciousIpModel model=JSON.parseObject(reason,MaliciousIpModel.class);
|
274
|
MaliciousIpModel model=JSON.parseObject(reason,MaliciousIpModel.class);
|
273
|
reason=model.toHtmlString();
|
275
|
reason=model.toHtmlString();
|
|
|
276
|
+ if(ts<model.getTimestamp()){
|
|
|
277
|
+ ts=model.getTimestamp();
|
|
|
278
|
+ }
|
274
|
}catch (Exception e){
|
279
|
}catch (Exception e){
|
275
|
//
|
280
|
//
|
276
|
}
|
281
|
}
|
|
@@ -281,8 +286,21 @@ public class MaliciousIpServiceImpl implements MaliciousIpService { |
|
@@ -281,8 +286,21 @@ public class MaliciousIpServiceImpl implements MaliciousIpService { |
281
|
//reasonDur += "qcloud: " + qcloudInfo.get("dur")+ " -- "+ qcloudInfo.get("reason") ;
|
286
|
//reasonDur += "qcloud: " + qcloudInfo.get("dur")+ " -- "+ qcloudInfo.get("reason") ;
|
282
|
}
|
287
|
}
|
283
|
mip.setReasonDur(reasonDur);
|
288
|
mip.setReasonDur(reasonDur);
|
|
|
289
|
+ mip.setTs(ts);
|
284
|
listMaliciousIp.add(mip);
|
290
|
listMaliciousIp.add(mip);
|
285
|
}
|
291
|
}
|
|
|
292
|
+ //排序
|
|
|
293
|
+ Collections.sort(listMaliciousIp,new Comparator<MaliciousIp>(){
|
|
|
294
|
+ public int compare(MaliciousIp arg0, MaliciousIp arg1) {
|
|
|
295
|
+ long compare= arg0.getTs() - arg1.getTs();
|
|
|
296
|
+ if(compare<0L){
|
|
|
297
|
+ return -1;
|
|
|
298
|
+ }else{
|
|
|
299
|
+ return 1;
|
|
|
300
|
+ }
|
|
|
301
|
+
|
|
|
302
|
+ }
|
|
|
303
|
+ });
|
286
|
response.setData(listMaliciousIp);
|
304
|
response.setData(listMaliciousIp);
|
287
|
return response;
|
305
|
return response;
|
288
|
}
|
306
|
}
|