提取查询时间范围到页面控制

This commit is contained in:
dongxiaoyan
2018-12-22 16:34:22 +08:00
parent d8b0a7cb34
commit 2c07e183eb
2 changed files with 14 additions and 9 deletions

View File

@@ -42,9 +42,14 @@ public class DynamicIndexController extends BaseController {
public String dynamicIndex(HttpServletRequest request){ public String dynamicIndex(HttpServletRequest request){
String serviceIds = request.getParameter("sid"); String serviceIds = request.getParameter("sid");
String baseNum = request.getParameter("baseNum"); String baseNum = request.getParameter("baseNum");
Object trafficAreaStat = trafficAreaStat(null, Integer.parseInt(baseNum)); String hourStr = request.getParameter("hour");
Object dropStat = dropStat(null, Integer.parseInt(baseNum)); Integer hour = null;
Object logStat = logStat(null, serviceIds, Integer.parseInt(baseNum)); if(hourStr!=null &&!"".equals(hourStr)){
hour = Integer.parseInt(hourStr);
}
Object trafficAreaStat = trafficAreaStat(hour, Integer.parseInt(baseNum));
Object dropStat = dropStat(hour, Integer.parseInt(baseNum));
Object logStat = logStat(hour, serviceIds, Integer.parseInt(baseNum));
Gson gson = new GsonBuilder().create(); Gson gson = new GsonBuilder().create();
String trafficJson = gson.toJson(trafficAreaStat); String trafficJson = gson.toJson(trafficAreaStat);
String dropJson = gson.toJson(dropStat); String dropJson = gson.toJson(dropStat);
@@ -93,12 +98,12 @@ public class DynamicIndexController extends BaseController {
List<Map> results = new ArrayList<>(); List<Map> results = new ArrayList<>();
if (hour == null || hour <= 0) { if (hour == null || hour <= 0) {
hour = 24; hour = 1;
} }
Date now = new Date(); Date now = new Date();
Date start = new Date(now.getTime()-(hour*60*60*1000)); Date start = new Date(now.getTime()-(hour*60*60*1000)-(5*60*1000));
now = new Date(now.getTime()-5*60*1000);
String nowString = DateUtils.formatDate(now, "yyyy-MM-dd HH:mm:ss"); String nowString = DateUtils.formatDate(now, "yyyy-MM-dd HH:mm:ss");
String startString = DateUtils.formatDate(start, "yyyy-MM-dd HH:mm:ss"); String startString = DateUtils.formatDate(start, "yyyy-MM-dd HH:mm:ss");
/*nowString = "2018-12-05 00:00:00"; /*nowString = "2018-12-05 00:00:00";

View File

@@ -1136,7 +1136,7 @@
$.ajax({ $.ajax({
type:'get', type:'get',
dataType: 'json', dataType: 'json',
url:"${pageContext.request.contextPath}/nis/dynamicpage/indexTraffic?baseNum=" + top.baseNum, url:"${pageContext.request.contextPath}/nis/dynamicpage/indexTraffic?hour=2&baseNum=" + top.baseNum,
success:function(res){//处理返回结果 success:function(res){//处理返回结果
if(res) { if(res) {
data = res; data = res;
@@ -1189,7 +1189,7 @@
$.ajax({ $.ajax({
type:'get', type:'get',
dataType: 'json', dataType: 'json',
url:'${pageContext.request.contextPath}/nis/dynamicpage/indexLog?sid=' + top.indexLogServiceId + "&baseNum=" + top.baseNum, url:'${pageContext.request.contextPath}/nis/dynamicpage/indexLog?hour=24&sid=' + top.indexLogServiceId + "&baseNum=" + top.baseNum,
success:function(res){//处理返回结果 success:function(res){//处理返回结果
logData = res; logData = res;
_logData = logData.shift(); _logData = logData.shift();
@@ -1241,7 +1241,7 @@
$.ajax({ $.ajax({
type:'get', type:'get',
dataType: 'json', dataType: 'json',
url:'${pageContext.request.contextPath}/nis/dynamicpage/indexDrop' + "?baseNum=" + top.dropBaseNum, url:'${pageContext.request.contextPath}/nis/dynamicpage/indexDrop?hour=24' + "&baseNum=" + top.dropBaseNum,
success:function(res){//处理返回结果 success:function(res){//处理返回结果
if(res) { if(res) {
dropData = res; dropData = res;