Authored by Xu

读redis改成api接口

优化界面
package com.ui.ctrl;
package com.ui.ctrl;
import java.util.List;
... ... @@ -36,19 +36,21 @@ public class MaliciousIpCtrl {
}
@RequestMapping("/showDetail")
public ModelAndView showDetail(Model model, String ip, String count, String type) {
public ModelAndView showDetail(Model model, String ip, String count, String type, String timeType, String timestamp) {
ModelAndView mdv = new ModelAndView("malicious/maliciousIpDetail");
mdv.addObject("type", type);
mdv.addObject("ip", ip);
mdv.addObject("count", count);
mdv.addObject("timeType", timeType);
mdv.addObject("timestamp", timestamp);
return mdv;
}
@SuppressWarnings("unchecked")
@RequestMapping("/getIps")
@ResponseBody
public BaseResponse<List<Object>> getIps(Model model) {
BaseResponse<List<Object>> response = httpClient.defaultPost(HttpUriContants.GET_MALICIOUS_IP, null,
public BaseResponse<List<Object>> getIps(Model model,String timeType) {
BaseResponse<List<Object>> response = httpClient.defaultPost(HttpUriContants.GET_MALICIOUS_IP+"?timeType="+timeType, null,
BaseResponse.class);
return response;
}
... ... @@ -56,8 +58,8 @@ public class MaliciousIpCtrl {
@SuppressWarnings("unchecked")
@RequestMapping("/getDetail")
@ResponseBody
public BaseResponse<List<Object>> getDetail(Model model, String ip, String count) {
BaseResponse<List<Object>> response = httpClient.defaultGet(HttpUriContants.GET_MALICIOUS_DETAIL + "?ip=" + ip + "&count=" + count,
public BaseResponse<List<Object>> getDetail(Model model, String ip, String count,String timeType, String timestamp) {
BaseResponse<List<Object>> response = httpClient.defaultGet(HttpUriContants.GET_MALICIOUS_DETAIL + "?ip=" + ip + "&count=" + count + "&timeType=" + timeType + "&timestamp=" + timestamp,
BaseResponse.class);
return response;
}
... ... @@ -107,8 +109,8 @@ public class MaliciousIpCtrl {
@SuppressWarnings("unchecked")
@RequestMapping("/getIpsBL")
@ResponseBody
public BaseResponse<List<Object>> getIpsBL(Model model) {
BaseResponse<List<Object>> response = httpClient.defaultPost(HttpUriContants.GET_MALICIOUS_IP_BL, null,
public BaseResponse<List<Object>> getIpsBL(Model model,String timeType) {
BaseResponse<List<Object>> response = httpClient.defaultPost(HttpUriContants.GET_MALICIOUS_IP_BL+"?timeType="+timeType, null,
BaseResponse.class);
return response;
}
... ... @@ -121,8 +123,8 @@ public class MaliciousIpCtrl {
@SuppressWarnings("unchecked")
@RequestMapping("/getIpsCS")
@ResponseBody
public BaseResponse<List<Object>> getIpsCS(Model model) {
BaseResponse<List<Object>> response = httpClient.defaultPost(HttpUriContants.GET_MALICIOUS_IP_CS, null,
public BaseResponse<List<Object>> getIpsCS(Model model,String timeType) {
BaseResponse<List<Object>> response = httpClient.defaultPost(HttpUriContants.GET_MALICIOUS_IP_CS+"?timeType="+timeType, null,
BaseResponse.class);
return response;
}
... ...
$(function () {
refreshTable();
refreshTableDetail();
});
function refreshTable() {
function refreshTableDetail() {
$("#detailTable").table({
url: contextPath + "maliciousIp/getDetail?ip="+$("#ip").val() + "&count="+$("#count").val(),
url: contextPath + "maliciousIp/getDetail?ip="+$("#ip").val() + "&count="+$("#count").val() + "&timeType="+$("#timeType").val() + "&timestamp="+$("#timestamp").val(),
dataType: 'json',
striped: true,
panelClass: "panel-success",
... ...
... ... @@ -4,7 +4,7 @@ $(function () {
function refreshTable() {
$("#ipTable").table({
url: contextPath + "maliciousIp/getIps",
url: contextPath + "maliciousIp/getIps?timeType="+$("#timeType").val(),
dataType: 'json',
striped: true,
sortName: 'count', // 设置默认排序为 name
... ... @@ -81,7 +81,7 @@ function refreshTable() {
//详情
var editBtn = $("<button data-target='#updateModal' data-toggle='modal'>").addClass("btn btn-xs btn-success").html("详情").appendTo(div);
editBtn.click(function () {
getDetail(rowData.ip, rowData.count);
getDetail(rowData.ip, rowData.allCount, rowData.timestamp);
});
return div;
}
... ... @@ -90,16 +90,22 @@ function refreshTable() {
}
//显示ip的详情
function getDetail(ip, count){
function getDetail(ip, count, timestamp){
var dialog = $("<div>").appendTo($("body"));
dialog.dialog({
size : "modal-lg",
title : "详情",
backdrop : "static",
href : "showDetail?type=li_malicious_ips&ip=" + ip + "&count=" + count
href : "showDetail?type=li_malicious_ips&ip=" + ip + "&count=" + count + "&timeType="+$("#timeType").val() + "&timestamp=" + timestamp
});
}
//根据5s和30s取数据
function queryDataByTime(){
refreshTable();
}
//全选
function checkAll(){
$("#ipTable input[type='checkbox']").each(function(){
if($("#checkAll").is(':checked'))
... ...
... ... @@ -4,7 +4,7 @@ $(function () {
function refreshTable() {
$("#ipTable").table({
url: contextPath + "maliciousIp/getIpsBL",
url: contextPath + "maliciousIp/getIpsBL?timeType="+$("#timeType").val(),
dataType: 'json',
striped: true,
sortName: 'count', // 设置默认排序为 name
... ... @@ -66,7 +66,7 @@ function refreshTable() {
//详情
var editBtn = $("<button data-target='#updateModal' data-toggle='modal'>").addClass("btn btn-xs btn-success").html("详情").appendTo(div);
editBtn.click(function () {
getDetail(rowData.ip, rowData.allCount);
getDetail(rowData.ip, rowData.allCount, rowData.timestamp);
});
return div;
}
... ... @@ -75,16 +75,22 @@ function refreshTable() {
}
//显示ip的详情
function getDetail(ip, count){
function getDetail(ip, count, timestamp){
var dialog = $("<div>").appendTo($("body"));
dialog.dialog({
size : "modal-lg",
title : "详情",
backdrop : "static",
href : "showDetail?type=li_malicious_ips_bl&ip=" + ip + "&count=" + count
href : "showDetail?type=li_malicious_ips_bl&ip=" + ip + "&count=" + count + "&timeType="+$("#timeType").val() + "&timestamp=" + timestamp
});
}
//根据5s和30s取数据
function queryDataByTime(){
refreshTable();
}
//全选
function checkAll(){
$("#ipTable input[type='checkbox']").each(function(){
if($("#checkAll").is(':checked'))
... ...
... ... @@ -4,7 +4,7 @@ $(function () {
function refreshTable() {
$("#ipTable").table({
url: contextPath + "maliciousIp/getIpsCS",
url: contextPath + "maliciousIp/getIpsCS?timeType="+$("#timeType").val(),
dataType: 'json',
striped: true,
sortName: 'count', // 设置默认排序为 name
... ... @@ -68,7 +68,7 @@ function refreshTable() {
//详情
var editBtn = $("<button data-target='#updateModal' data-toggle='modal'>").addClass("btn btn-xs btn-success").html("详情").appendTo(div);
editBtn.click(function () {
getDetail(rowData.ip, rowData.allCount);
getDetail(rowData.ip, rowData.allCount, rowData.timestamp);
});
return div;
}
... ... @@ -77,16 +77,22 @@ function refreshTable() {
}
//显示ip的详情
function getDetail(ip, count){
function getDetail(ip, count, timestamp){
var dialog = $("<div>").appendTo($("body"));
dialog.dialog({
size : "modal-lg",
title : "详情",
backdrop : "static",
href : "showDetail?type=li_malicious_ips_cs&ip=" + ip + "&count=" + count
href : "showDetail?type=li_malicious_ips_cs&ip=" + ip + "&count=" + count + "&timeType="+$("#timeType").val() + "&timestamp=" + timestamp
});
}
//根据5s和30s取数据
function queryDataByTime(){
refreshTable();
}
//全选
function checkAll(){
$("#ipTable input[type='checkbox']").each(function(){
if($("#checkAll").is(':checked'))
... ...
... ... @@ -64,6 +64,8 @@
<input type="hidden" id="ip" value='${ip}'>
<input type="hidden" id="count" value='${count}'>
<input type="hidden" id="type" value='${type}'>
<input type="hidden" id="timeType" value='${timeType}'>
<input type="hidden" id="timestamp" value='${timestamp}'>
<!-- 右侧具体内容 -->
<div id="detailTable" style="overflow-y: auto; overflow-x:hidden;max-height: 500px" />
</body>
... ...
... ... @@ -76,14 +76,21 @@
<h5>恶意ip top</h5>
</div>
<div class="widget-title" style="height: 43px;">
<div class="widget-title" style="height: 56px;">
<div>
<div class="form-inline" role="form" id="inBoxQueryDiv" style=" margin-top: 12px;margin-left: 25px;float: left;">
<div class="input-group" style="float: left; margin-left: 20px">
<span class="input-group-addon">全选:</span>
<input type="checkbox" id="checkAll" style="margin-left:5px;width:20px;height:20px;" onclick="checkAll()">
</div>
<div class="input-group" style="float: left">
<span class="input-group-addon">按时间查看:</span>
<select id="timeType" name="timeType" class="form-control" onchange="queryDataByTime()">
<option value="2" selected = "selected">2s</option>
<option value="30">30s</option>
</select>
</div>
<div class="input-group" style="float: left">
<span class="input-group-addon" style="height:34px;">全选:</span>
<span class="input-group-addon" style="height:34px;width:40px;"></span>
<input type="checkbox" id="checkAll" class="form-control" style="margin-top:7px;margin-left:-30px;width:20px;height:20px;" onclick="checkAll()" />
</div>
<button id="uploadIps" class="btn-primary" style="margin-left: 80px;" onclick="uploadIps()">上 传
</button>
<button id="lookIps" class="btn-primary" style="margin-left: 10px;" onclick="lookIps()">查 看
... ...
... ... @@ -76,14 +76,21 @@
<h5>恶意ip top</h5>
</div>
<div class="widget-title" style="height: 43px;">
<div class="widget-title" style="height: 56px;">
<div>
<div class="form-inline" role="form" id="inBoxQueryDiv" style=" margin-top: 12px;margin-left: 25px;float: left;">
<div class="input-group" style="float: left; margin-left: 20px">
<span class="input-group-addon">全选:</span>
<input type="checkbox" id="checkAll" style="margin-left:5px;width:20px;height:20px;" onclick="checkAll()">
</div>
<div class="input-group" style="float: left">
<span class="input-group-addon">按时间查看:</span>
<select id="timeType" name="timeType" class="form-control" onchange="queryDataByTime()">
<option value="2" selected = "selected">2s</option>
<option value="30">30s</option>
</select>
</div>
<div class="input-group" style="float: left">
<span class="input-group-addon" style="height:34px;">全选:</span>
<span class="input-group-addon" style="height:34px;width:40px;"></span>
<input type="checkbox" id="checkAll" class="form-control" style="margin-top:7px;margin-left:-30px;width:20px;height:20px;" onclick="checkAll()" />
</div>
<button id="uploadIps" class="btn-primary" style="margin-left: 80px;" onclick="uploadIps()">上 传
</button>
<button id="lookIps" class="btn-primary" style="margin-left: 10px;" onclick="lookIps()">查 看
... ...
... ... @@ -76,14 +76,21 @@
<h5>恶意ip top</h5>
</div>
<div class="widget-title" style="height: 43px;">
<div class="widget-title" style="height: 56px;">
<div>
<div class="form-inline" role="form" id="inBoxQueryDiv" style=" margin-top: 12px;margin-left: 25px;float: left;">
<div class="input-group" style="float: left; margin-left: 20px">
<span class="input-group-addon">全选:</span>
<input type="checkbox" id="checkAll" style="margin-left:5px;width:20px;height:20px;" onclick="checkAll()">
</div>
<div class="input-group" style="float: left">
<span class="input-group-addon">按时间查看:</span>
<select id="timeType" name="timeType" class="form-control" onchange="queryDataByTime()">
<option value="2" selected = "selected">2s</option>
<option value="30">30s</option>
</select>
</div>
<div class="input-group" style="float: left">
<span class="input-group-addon" style="height:34px;">全选:</span>
<span class="input-group-addon" style="height:34px;width:40px;"></span>
<input type="checkbox" id="checkAll" class="form-control" style="margin-top:7px;margin-left:-30px;width:20px;height:20px;" onclick="checkAll()" />
</div>
<button id="uploadIps" class="btn-primary" style="margin-left: 80px;" onclick="uploadIps()">上 传
</button>
<button id="lookIps" class="btn-primary" style="margin-left: 10px;" onclick="lookIps()">查 看
... ...
... ... @@ -66,15 +66,14 @@
<!-- 右侧具体内容 -->
<div class="widget-box" style="margin-top: 0px">
<div class="widget-title" style="height: 53px;">
<div>
<div class="form-inline" role="form" id="inBoxQueryDiv" style=" margin-top: 12px;margin-left: 25px;float: left;">
<div class="input-group" style="float: left; margin-left: 20px">
<span class="input-group-addon">全选:</span>
<input type="checkbox" id="checkAllRemove" style="margin-left:5px;width:20px;height:20px;" onclick="checkAllRemove()">
</div>
<button id="uploadIps" class="btn-primary" style="margin-left: 80px;" onclick="remove()">移除选中的ip
<div class="form-inline" role="form" id="inBoxQueryDiv" style=" margin-top: 12px;margin-left: 25px;float: left;">
<div class="input-group" style="float: left">
<span class="input-group-addon" style="height:34px;">全选:</span>
<span class="input-group-addon" style="height:34px;width:40px;"></span>
<input type="checkbox" id="checkAllRemove" class="form-control" style="margin-top:7px;margin-left:-30px;width:20px;height:20px;" onclick="checkAllRemove()" />
<button id="uploadIps" class="btn-primary" style="margin-left: 80px;" onclick="remove()">移除选中的ip
</button>
</div>
</div>
</div>
</div>
<div id="lookTable" style="margin-top: 0px;overflow-y: auto; overflow-x:hidden;max-height: 500px" />
... ...