Authored by qinchao

增加恶意ip详情的排序功能

... ... @@ -26,6 +26,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
/**
... ... @@ -366,6 +368,21 @@ public class MaliciousIpController {
}
}
//排序
// 如果同时有自然排序和比较器排序,以比较器排序为主
Collections.sort(recodList, new Comparator<MaliciousHbaseLog>() {
@Override
public int compare(MaliciousHbaseLog s1, MaliciousHbaseLog s2) {
if(StringUtils.isBlank(s1.getCurrDateStr())){
return -1;
}else if(StringUtils.isBlank(s2.getCurrDateStr())){
return 1;
}else{
return s1.getCurrDateStr().compareTo(s2.getCurrDateStr());
}
}
});
}
}
}
\ No newline at end of file
... ...