提交日志总量获取,由于目前接口不可用,所以后台直接造的数据。超时直接显示超时

This commit is contained in:
wangxin
2018-06-14 17:49:58 +08:00
parent 5ec2264e1e
commit 74fac2333f
6 changed files with 32 additions and 13 deletions

View File

@@ -9,8 +9,11 @@
package com.nis.web.controller.log.ntc;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
@@ -38,7 +41,8 @@ import com.nis.web.controller.BaseController;
public class NtcPzReportController extends BaseController{
@RequestMapping(value="ajaxGetLogTotal",method=RequestMethod.POST)
@ResponseBody
public String ajaxGetLogTotal(Model model,long endTime,int action,Integer functionId,Integer compileId){
public Map<String, Object> ajaxGetLogTotal(Model model,long endTime,int action,Integer functionId,Integer compileId){
Map<String, Object> data=new HashMap<String, Object>();
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
int interval=Constants.LOG_TIME_RANGE;
Date endDate=new Date(endTime);
@@ -51,10 +55,18 @@ public class NtcPzReportController extends BaseController{
break;
}
}
ReportResultLog result=ConfigServiceUtil.getReport(Constants.BUSINESSTYPE_CONFIG, String.valueOf(compileId), String.valueOf(serviceId), sdf.format(startDate), sdf.format(endDate));
if(result.getData()!=null&&result.getData().getList()!=null){
model.addAttribute("data", result.getData().getList());
}
return "success";
// ReportResultLog result=ConfigServiceUtil.getReport(Constants.BUSINESSTYPE_CONFIG, String.valueOf(compileId), String.valueOf(serviceId), sdf.format(startDate), sdf.format(endDate));
// if(result.getData()!=null&&result.getData().getList()!=null){
// model.addAttribute("data", result.getData().getList());
// }
data.put("compileId", compileId.intValue());
data.put("sum", 1000l);
// try {
// Thread.sleep(10000);
// } catch (InterruptedException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
return data;
}
}

View File

@@ -11,6 +11,7 @@
data.compileId=$(this).attr("compileId");
data.action=$(this).attr("action");
data.functionId=$(this).attr("functionId");
data.obj=$(this)
GetLogTotal('${ctx}',data);
});
//$("#loadingModal").modal("show");

View File

@@ -47,6 +47,7 @@
over4: "6over4",
all: "all",
ip_subnet: "Subnet",
ip_range: "ip Range"
ip_range: "ip Range",
timeout:"timeout"
});
}(jQuery));

View File

@@ -45,6 +45,7 @@
over4: "6over4",
all: "all",
ip_subnet: "Subnet",
ip_range: "ip Range"
ip_range: "ip Range",
timeout:"timeout"
});
}(jQuery));

View File

@@ -49,6 +49,7 @@
all: "全部",
ip_subnet: "Subnet",
ip_subnet: "Subnet",
ip_range: "ip Range"
ip_range: "ip Range",
timeout:"超时"
});
}(jQuery));

View File

@@ -619,31 +619,34 @@ var viewAreaInfo=function(path,areaEffectiveIds,compileId){
}
var GetLogTotal=function(path,data){
console.log(data);
var timeStamp=0;
if(data.date){
timeStamp=data.date.valueOf();
}else{
timeStamp=(new Date()).valueOf();
}
$.ajax({
var totalTr=$(data.obj);
var timeout=$.validator.messages.timeout;
var request=$.ajax({
type:'post',
timeout:10000,//超时时间设置,查询接口时间过长超时
timeout:1000,//超时时间设置,查询接口时间过长超时
url:path+'/logs/ajaxGetLogTotal',
data:{"endTime":timeStamp,"action":data.action,"functionId":data.functionId,"compileId":data.compileId},
dataType:'json',
async:true,
success:function(data,textStatus){//处理返回结果
if(textStatus=="success"){
totalTr.html(data.sum);
}
},
complete:function(XMLHttpRequest,status){//超时设置
if(status=="timeout"){
GetLogTotal.about();
totalTr.html(timeout);
}
}
});
}
//删除区域IP
function delAreaIp(obj){
var thisObj=$(obj);