diff --git a/src/main/java/com/nis/util/Constants.java b/src/main/java/com/nis/util/Constants.java index c54e7724d..fb49860ac 100644 --- a/src/main/java/com/nis/util/Constants.java +++ b/src/main/java/com/nis/util/Constants.java @@ -435,6 +435,8 @@ public final class Constants { public static final Integer BUSINESSTYPE_REPORT=Configurations.getIntProperty("businesstype_report", 2); //默认日志查询时长(ms) public static final Integer LOG_TIME_RANGE = Configurations.getIntProperty("log_time_range", 300000); + //日志检索菜单ID + public static final Integer LOGSEARCH_MENU_ID = Configurations.getIntProperty("logsearch_menu_id", 152); /**请求头参数*/ public static final Map REQUEST_HEADER = new HashMap(); public static final Integer CLIENT_CONNECT_TIMEOUT = Configurations.getIntProperty("client_connect_timeout",1000); diff --git a/src/main/java/com/nis/web/controller/configuration/LogSearchController.java b/src/main/java/com/nis/web/controller/configuration/LogSearchController.java new file mode 100644 index 000000000..77902cd29 --- /dev/null +++ b/src/main/java/com/nis/web/controller/configuration/LogSearchController.java @@ -0,0 +1,35 @@ +package com.nis.web.controller.configuration; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.servlet.mvc.support.RedirectAttributes; + +import com.nis.domain.log.BaseLogEntity; +import com.nis.web.controller.BaseController; + +@Controller +@RequestMapping("${adminPath}/toLogSearch") +public class LogSearchController extends BaseController{ + + @RequestMapping(value = {"list",""}) + public String LogSearch(BaseLogEntity entity, Integer compileId,RedirectAttributes attr, + HttpServletRequest request, HttpServletResponse response) { + /** + * url: logUrl + * searchCfgId: compileId + * searchService: serviceId + */ + // 获取相应日志检索菜单URL + String logUrl = menuService.getLogUrl(entity.getFunctionId()); + Integer serviceId = menuService.getServiceId(entity.getFunctionId(),entity.getAction()); + + attr.addAttribute("cfgId", compileId); + attr.addAttribute("service", serviceId); + attr.addAttribute("functionId", entity.getFunctionId()); + + return "redirect:"+adminPath+logUrl; + } +} diff --git a/src/main/java/com/nis/web/dao/SysMenuDao.java b/src/main/java/com/nis/web/dao/SysMenuDao.java index 3e90c6dea..9d9185231 100644 --- a/src/main/java/com/nis/web/dao/SysMenuDao.java +++ b/src/main/java/com/nis/web/dao/SysMenuDao.java @@ -19,5 +19,9 @@ public interface SysMenuDao extends CrudDao{ void updateParentIds(SysMenu e); void updateSort(SysMenu menu); + + String getLogUrl(@Param("functionId")Integer function,@Param("logSearchId")Integer logSearchId); + + Integer getServiceId(@Param("functionId")Integer functionId, @Param("action")Integer action); } \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/SysMenuDao.xml b/src/main/java/com/nis/web/dao/SysMenuDao.xml index bb22f942d..534c39ad8 100644 --- a/src/main/java/com/nis/web/dao/SysMenuDao.xml +++ b/src/main/java/com/nis/web/dao/SysMenuDao.xml @@ -50,7 +50,7 @@ + SELECT + m.href + FROM + sys_menu m + WHERE + m.function_id = #{functionId} AND m.parent_ids LIKE '%${logSearchId}%' + + + \ No newline at end of file diff --git a/src/main/java/com/nis/web/service/MenuService.java b/src/main/java/com/nis/web/service/MenuService.java index 935b7cc5f..5ac775c36 100644 --- a/src/main/java/com/nis/web/service/MenuService.java +++ b/src/main/java/com/nis/web/service/MenuService.java @@ -9,6 +9,7 @@ import org.springframework.stereotype.Service; import com.nis.domain.SysMenu; import com.nis.domain.SysUser; import com.nis.util.CacheUtils; +import com.nis.util.Constants; import com.nis.util.LogUtils; import com.nis.util.StringUtil; import com.nis.web.dao.SysMenuDao; @@ -93,5 +94,15 @@ public class MenuService extends BaseService { // 清除日志相关缓存 CacheUtils.remove(LogUtils.CACHE_MENU_NAME_PATH_MAP); } + + // 根据functionId查找日志检索的URL + public String getLogUrl(Integer function) { + Integer logSearchId = Constants.LOGSEARCH_MENU_ID; + return menuDao.getLogUrl(function,logSearchId); + } + // 根据functionId,action查找日志检索条件ServiceId + public Integer getServiceId(Integer functionId, Integer action) { + return menuDao.getServiceId(functionId,action); + } } diff --git a/src/main/resources/nis.properties b/src/main/resources/nis.properties index 136dd7a50..45cc906e4 100644 --- a/src/main/resources/nis.properties +++ b/src/main/resources/nis.properties @@ -281,6 +281,7 @@ trafficWebTypeChart=trafficWebTypeChart client_connect_timeout=300000 client_read_timeout=300000 log_time_range=300000 +logsearch_menu_id=152 #use elasticsearch or not# isUseES=false diff --git a/src/main/webapp/WEB-INF/views/log/ntc/ftpList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/ftpList.jsp index 7ba95a03c..139ab22b2 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/ftpList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/ftpList.jsp @@ -28,6 +28,8 @@ $(document).ready(function(){
+

@@ -42,6 +44,7 @@ $(document).ready(function(){ + diff --git a/src/main/webapp/WEB-INF/views/log/ntc/p2pList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/p2pList.jsp index ce3134ee0..0e70c7873 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/p2pList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/p2pList.jsp @@ -43,6 +43,7 @@ + diff --git a/src/main/webapp/static/global/scripts/common.js b/src/main/webapp/static/global/scripts/common.js index 4457460d7..143d12743 100644 --- a/src/main/webapp/static/global/scripts/common.js +++ b/src/main/webapp/static/global/scripts/common.js @@ -1222,7 +1222,8 @@ var GetLogTotal=function(_data){ totalTrs.each(function(){ for(var i=0;i"+data[i].sum+""); } } }) @@ -1242,6 +1243,29 @@ var GetLogTotal=function(_data){ }); } +var toLogSearch = function(index){ + // 保存配置界面URL + $("#searchForm").each(function(){ + var cfgUrl = $(this).attr("action"); + sessionStorage.removeItem('cfgUrl'); + sessionStorage.setItem('cfgUrl',cfgUrl); + }); + + var td = document.getElementById(index+"logTotal"); + $("td[compileId]").each(function(){ + if($(this).attr("id") == index+"logTotal"){ + // 获取检索日志参数 + var action=$(this).attr("action"); + var compileId=$(this).attr("compileId"); + var functionId=$(this).attr("functionId"); + var pathName=window.document.location.pathname.substring(0,window.document.location.pathname.indexOf("/nis")+4); + + window.location.href = pathName+"/toLogSearch?action="+action+"&functionId="+functionId+"&compileId="+compileId; + } + }); + +} + //删除区域IP function delAreaIp(obj){ var thisObj=$(obj); diff --git a/src/main/webapp/static/pages/scripts/pageLogs.js b/src/main/webapp/static/pages/scripts/pageLogs.js index 0fb0c97da..7c0affadd 100644 --- a/src/main/webapp/static/pages/scripts/pageLogs.js +++ b/src/main/webapp/static/pages/scripts/pageLogs.js @@ -48,8 +48,13 @@ $(document).ready(function() { this.setAttribute('width',tdPx+'px'); } }); -}); + // 添加由配置界面跳转到日志查询界面后的返回按钮 + var cfgId = $("#cfgId").val(); + if(cfgId != undefined && cfgId != ''){ + $(".theme-panel").html(""); + } +}); // 获取字符串对等的像素值 function getPixelsCount(str, strFontSize){ @@ -76,4 +81,9 @@ function getPixelsCount(str, strFontSize){ } return stringPixelsCount; +} +function back(){ + // 获取配置界面URl并跳转 + var url = sessionStorage.getItem('cfgUrl'); + window.location.href = url; } \ No newline at end of file