日志趋势添加servicID查询条件

This commit is contained in:
leijun
2019-01-15 18:51:49 +08:00
parent 90a56b5e83
commit 0a8f96dce0
3 changed files with 20 additions and 13 deletions

View File

@@ -57,7 +57,7 @@ public class LogSearchController extends BaseController{
@RequestMapping(value = {"logTrend",""}) @RequestMapping(value = {"logTrend",""})
public String logTrend(Model model,BaseLogEntity<Object> entity,String cfgId,RedirectAttributes attr, HttpServletRequest request, public String logTrend(Model model,BaseLogEntity<Object> entity,String cfgId,String serviceId,RedirectAttributes attr, HttpServletRequest request,
HttpServletResponse response) { HttpServletResponse response) {
Calendar cal = Calendar. getInstance (); Calendar cal = Calendar. getInstance ();
cal.setTime(new Date()); cal.setTime(new Date());
@@ -67,16 +67,20 @@ public class LogSearchController extends BaseController{
model.addAttribute("beginDate", oneHoursAgo); model.addAttribute("beginDate", oneHoursAgo);
model.addAttribute("endDate", now); model.addAttribute("endDate", now);
model.addAttribute("cfgId", cfgId); model.addAttribute("cfgId", cfgId);
model.addAttribute("serviceId", serviceId);
return "/cfg/logCfgTrendList"; return "/cfg/logCfgTrendList";
} }
@RequestMapping(value="actionLogTrend") @RequestMapping(value="actionLogTrend")
@ResponseBody @ResponseBody
public List actionTrans(String cfgId,String beginDate,String endDate){ public List actionTrans(String cfgId,String beginDate,String endDate,String serviceId){
Map<String, Object> fromJsonList = new HashMap<String, Object>(); Map<String, Object> fromJsonList = new HashMap<String, Object>();
List resultList = new ArrayList(); List resultList = new ArrayList();
String url = Constants.LOG_BASE_URL+Constants.NTC_PZ_REPORT; String url = Constants.LOG_BASE_URL+Constants.NTC_PZ_REPORT;
url=url+"?searchBusinessType=2&searchCfgId="+cfgId; url=url+"?searchBusinessType=2&searchCfgId="+cfgId;
if(!StringUtil.isEmpty(serviceId)){
url=url+"&searchService="+serviceId;
}
try { try {
//String url="http://192.168.10.204:9999/galaxy-service/service/log/v1/ntcPzReport?searchBusinessType=2&searchReportStartTime=2018-12-29%2000:00:00&searchReportEndTime=2018-12-30%2000:00:00"; //String url="http://192.168.10.204:9999/galaxy-service/service/log/v1/ntcPzReport?searchBusinessType=2&searchReportStartTime=2018-12-29%2000:00:00&searchReportEndTime=2018-12-30%2000:00:00";
url = urlAddDate(url,beginDate,endDate); url = urlAddDate(url,beginDate,endDate);

View File

@@ -47,13 +47,14 @@
<!-- 搜索内容与操作按钮栏 --> <!-- 搜索内容与操作按钮栏 -->
</form:form> </form:form>
</div> </div>
<br>
<div id="chart" style="width:97%;height:480px;"></div> <div id="chart" style="width:97%;height:90%;margin-top: 35px;"></div>
<%-- <input id="searchAction" name="searchAction" type="hidden" value="${searchAction}"/> --%> <%-- <input id="searchAction" name="searchAction" type="hidden" value="${searchAction}"/> --%>
<input id="beginDateh" type="hidden" value="${beginDate}"/> <input id="beginDateh" type="hidden" value="${beginDate}"/>
<input id="endDateh" type="hidden" value="${endDate}"/> <input id="endDateh" type="hidden" value="${endDate}"/>
<input id="cfgId" type="hidden" value="${cfgId}"/> <input id="cfgId" type="hidden" value="${cfgId}"/>
<input id="serviceId" type="hidden" value="${serviceId}"/>
<input id="total" type="hidden"/> <input id="total" type="hidden"/>
</div> </div>
<script src="${pageContext.request.contextPath}/static/global/plugins/highcharts/js/highcharts.js"></script> <script src="${pageContext.request.contextPath}/static/global/plugins/highcharts/js/highcharts.js"></script>
@@ -73,10 +74,11 @@ $(document).ready(function(){
var starth=$("#beginDateh").val(); var starth=$("#beginDateh").val();
var endh=$("#endDateh").val(); var endh=$("#endDateh").val();
var cfgId=$("#cfgId").val(); var cfgId=$("#cfgId").val();
var serviceId=$("#serviceId").val();
excfgid=cfgId; excfgid=cfgId;
$("#beginDate").val(starth); $("#beginDate").val(starth);
$("#endDate").val(endh); $("#endDate").val(endh);
actionTransAjax(logTltle,starth,endh,cfgId); actionTransAjax(logTltle,starth,endh,cfgId,serviceId);
//筛选功能初始化 //筛选功能初始化
$("#resetBtn").on("click",function(){ $("#resetBtn").on("click",function(){
$("select.selectpicker").each(function(){ $("select.selectpicker").each(function(){
@@ -97,13 +99,13 @@ function searchList(){
var start=$("#beginDate").val(); var start=$("#beginDate").val();
var end=$("#endDate").val(); var end=$("#endDate").val();
var cfgId=$("#cfgId").val(); var cfgId=$("#cfgId").val();
var serviceId=$("#serviceId").val();
$("#beginDateh").val(start); $("#beginDateh").val(start);
$("#endDateh").val(end); $("#endDateh").val(end);
if(start==''||end==''||end==null||start==null){ if(start==''||end==''||end==null||start==null){
window.location.reload(); window.location.reload();
}else{ }else{
actionTransAjax(logTltle,start,end,cfgId); actionTransAjax(logTltle,start,end,cfgId,serviceId);
} }
} }
// 局点信息 // 局点信息
@@ -119,7 +121,7 @@ function showActionTransChart(xData,series){
filename:logTltle+"_"+nowDate.getFullYear()+(nowDate.getMonth()+1)+nowDate.getDate()+nowDate.getHours()+nowDate.getMinutes()+nowDate.getSeconds(), filename:logTltle+"_"+nowDate.getFullYear()+(nowDate.getMonth()+1)+nowDate.getDate()+nowDate.getHours()+nowDate.getMinutes()+nowDate.getSeconds(),
scale:1, scale:1,
sourceWidth: 1280, sourceWidth: 1280,
sourceHeight: 500, sourceHeight: 600,
buttons: { buttons: {
contextButton: { contextButton: {
menuItems: [ menuItems: [
@@ -204,10 +206,10 @@ function showActionTransChart(xData,series){
}); });
} }
// 动作一小时,间隔五分钟统计数据 // 动作一小时,间隔五分钟统计数据
function actionTransAjax(searchAction,beginDate,endDate,cfgId){ function actionTransAjax(searchAction,beginDate,endDate,cfgId,serviceId){
loading(); loading();
$.ajax({ $.ajax({
url: "${ctx}/toLogSearch/actionLogTrend?cfgId="+cfgId+"&searchAction="+searchAction+"&beginDate="+beginDate+"&endDate="+endDate, url: "${ctx}/toLogSearch/actionLogTrend?cfgId="+cfgId+"&searchAction="+searchAction+"&beginDate="+beginDate+"&endDate="+endDate+"&serviceId="+serviceId,
type : "get" , type : "get" ,
dataType:"json", dataType:"json",
async:true, async:true,

View File

@@ -172,9 +172,10 @@ var GetLogTotal=function(_data){
var hasLog=false; var hasLog=false;
for(var i=0;i<data.length;i++){ for(var i=0;i<data.length;i++){
if($(this).attr("compileId")==data[i].compileId){ if($(this).attr("compileId")==data[i].compileId){
var serviceId= $(this).attr("serviceId");
$(this).attr("id",i+"logTotal"); $(this).attr("id",i+"logTotal");
//$(this).html(data[i].sum); //$(this).html(data[i].sum);
$(this).html("<a href='javascript:;' onclick='logSearch(\""+data[i].compileId+"\")'>"+data[i].sum+"<a>"); $(this).html("<a href='javascript:;' onclick='logSearch(\""+data[i].compileId+"\",\""+serviceId+"\")'>"+data[i].sum+"<a>");
$(this).parent("tr").find("td:eq(1)").html("<a href='javascript:;' onclick='toLogSearch("+i+")'>"+data[i].compileId+"<a>"); $(this).parent("tr").find("td:eq(1)").html("<a href='javascript:;' onclick='toLogSearch("+i+")'>"+data[i].compileId+"<a>");
hasLog=true; hasLog=true;
} }
@@ -652,10 +653,10 @@ function setStartTimeByFormat(startTimeSelector,endTimeSelector,granule,unit,for
$(endTimeSelector).val(dateFtt(formatParm,endTime)+endStr); $(endTimeSelector).val(dateFtt(formatParm,endTime)+endStr);
} }
function logSearch(cfgId){ function logSearch(cfgId,serviceId){
var title=$.validator.messages.log_trend; var title=$.validator.messages.log_trend;
var url=$("#jbox_cfg_url",parent.document).val(); var url=$("#jbox_cfg_url",parent.document).val();
url=url+"?cfgId="+cfgId; url=url+"?cfgId="+cfgId+"&serviceId="+serviceId;
top.$.jBox("iframe:"+url, { top.$.jBox("iframe:"+url, {
title: title, title: title,
width: $(document).width()*0.8, width: $(document).width()*0.8,