1.用户多角色菜单重复bug修改 2.配置界面日志总量链接查询

This commit is contained in:
zhangwenqing
2018-08-29 21:58:56 +08:00
parent db37557139
commit dd59389e0a
10 changed files with 111 additions and 5 deletions

View File

@@ -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<String,Object> REQUEST_HEADER = new HashMap<String,Object>();
public static final Integer CLIENT_CONNECT_TIMEOUT = Configurations.getIntProperty("client_connect_timeout",1000);

View File

@@ -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<Object> 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;
}
}

View File

@@ -20,4 +20,8 @@ public interface SysMenuDao extends CrudDao<SysMenu>{
void updateSort(SysMenu menu);
String getLogUrl(@Param("functionId")Integer function,@Param("logSearchId")Integer logSearchId);
Integer getServiceId(@Param("functionId")Integer functionId, @Param("action")Integer action);
}

View File

@@ -50,7 +50,7 @@
</select>
<select id="findSysMenuByUserId" resultType="sysMenu">
SELECT
SELECT DISTINCT
<include refid="menuColumns"/>
FROM sys_menu a
LEFT JOIN sys_menu p ON p.id = a.parent_id
@@ -165,6 +165,21 @@
<if test="dbName == 'mysql'">CONCAT('%,', #{id}, ',%')</if>
</update>
<select id="getLogUrl" resultType="String">
SELECT
m.href
FROM
sys_menu m
WHERE
m.function_id = #{functionId} AND m.parent_ids LIKE '%${logSearchId}%'
</select>
<select id="getServiceId" resultType="Integer">
SELECT
s.service_id
FROM
function_service_dict s
WHERE
s.function_id = #{functionId} AND s.action = #{action}
</select>
</mapper>

View File

@@ -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;
@@ -94,4 +95,14 @@ 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);
}
}

View File

@@ -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

View File

@@ -28,6 +28,8 @@ $(document).ready(function(){
<body>
<div class="page-content">
<div class="theme-panel hidden-xs hidden-sm">
</div>
<h3 class="page-title">
<spring:message code="ftp_control"/>
</h3>
@@ -42,6 +44,7 @@ $(document).ready(function(){
<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
<input id="functionId" name="functionId" type="hidden" value="${log.functionId}"/>
<input id="cfgId" name="cfgId" type="hidden" value="${log.cfgId}"/>
<!-- 筛选按钮展开状态-->
<input id="isFilterAction" name="isFilterAction" type="hidden" value="${log.isFilterAction }"/>

View File

@@ -43,6 +43,7 @@
<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
<input id="functionId" name="functionId" type="hidden" value="${log.functionId}"/>
<input id="cfgId" name="cfgId" type="hidden" value="${log.cfgId}"/>
<!-- 筛选按钮展开状态-->
<input id="isFilterAction" name="isFilterAction" type="hidden" value="${log.isFilterAction }"/>
<!-- 搜索内容与操作按钮栏 -->

View File

@@ -1222,7 +1222,8 @@ var GetLogTotal=function(_data){
totalTrs.each(function(){
for(var i=0;i<data.length;i++){
if($(this).attr("compileId")==data[i].compileId){
$(this).html(data[i].sum);
$(this).attr("id",i+"logTotal");
$(this).html("<a href='javascript:;' onclick='toLogSearch("+i+")'>"+data[i].sum+"<a>");
}
}
})
@@ -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);

View File

@@ -48,8 +48,13 @@ $(document).ready(function() {
this.setAttribute('width',tdPx+'px');
}
});
});
// 添加由配置界面跳转到日志查询界面后的返回按钮
var cfgId = $("#cfgId").val();
if(cfgId != undefined && cfgId != ''){
$(".theme-panel").html("<button type='button' onclick='back()' class='btn btn-primary'>cancel</button>");
}
});
// 获取字符串对等的像素值
function getPixelsCount(str, strFontSize){
@@ -77,3 +82,8 @@ function getPixelsCount(str, strFontSize){
return stringPixelsCount;
}
function back(){
// 获取配置界面URl并跳转
var url = sessionStorage.getItem('cfgUrl');
window.location.href = url;
}