From fc8a9e4a57acd54a79ffec365196e6c75fa1889c Mon Sep 17 00:00:00 2001 From: zhangwei Date: Thu, 11 Oct 2018 18:39:40 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E8=A1=8C=E4=B8=BA?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E8=AE=B0=E5=BD=95=E5=8A=9F=E8=83=BD=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/nis/util/LogUtils.java | 72 +++++++++++++++++++++--- 1 file changed, 64 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/nis/util/LogUtils.java b/src/main/java/com/nis/util/LogUtils.java index 0ffc9e61f..1ce245243 100644 --- a/src/main/java/com/nis/util/LogUtils.java +++ b/src/main/java/com/nis/util/LogUtils.java @@ -1,9 +1,11 @@ package com.nis.util; +import java.io.IOException; import java.lang.reflect.Method; import java.util.Date; import java.util.List; import java.util.Map; +import java.util.Properties; import javax.servlet.http.HttpServletRequest; @@ -26,6 +28,7 @@ import com.sun.corba.se.impl.orbutil.closure.Constant; public class LogUtils { public static final String CACHE_MENU_NAME_PATH_MAP = "menuNamePathMap"; + public static final String CACHE_MENU_NAME_PATH_MAP2 = "menuNamePathMap2"; private static SysLogDao logDao = SpringContextHolder.getBean(SysLogDao.class); private static SysMenuDao menuDao = SpringContextHolder.getBean(SysMenuDao.class); @@ -59,6 +62,12 @@ public class LogUtils { log.setMethod(request.getMethod()); log.setCreateBy(user.getName()); log.setCreateDate(new Date()); + if(StringUtil.isEmpty(request.getParameter("functionId"))){ + log.setFunctionId(0); + }else{ + log.setFunctionId(Integer.parseInt(request.getParameter("functionId"))); + } + // 异步保存日志 new SaveLogThread(log, handler, ex).start(); } @@ -90,7 +99,8 @@ public class LogUtils { RequiresPermissions rp = m.getAnnotation(RequiresPermissions.class); permission = (rp != null ? StringUtils.join(rp.value(), ",") : ""); } - log.setTitle(getMenuNamePath(log.getRequestUri(), permission)); + Integer functionId = log.getFunctionId(); + log.setTitle(getMenuNamePath(log.getRequestUri(), permission,functionId)); } // 如果有异常,设置异常信息 log.setException(Exceptions.getStackTraceAsString(ex)); @@ -132,12 +142,21 @@ public class LogUtils { /** * 获取菜单名称路径(如:系统设置-机构用户-用户管理-编辑) */ - public static String getMenuNamePath(String requestUri, String permission){ + public static String getMenuNamePath(String requestUri, String permission,Integer functionId){ String href = StringUtils.substringAfter(requestUri, Configurations.getStringProperty("adminPath", "/nis")); @SuppressWarnings("unchecked") Map menuMap = (Map)CacheUtils.get(CACHE_MENU_NAME_PATH_MAP); + //用于记录功能按钮的操作日志【新增,修改,删除,审核等】 + Map menuMap2 = (Map)CacheUtils.get(CACHE_MENU_NAME_PATH_MAP2); if (menuMap == null){ menuMap = Maps.newHashMap(); + menuMap2 = Maps.newHashMap(); + Properties msgProp = new Properties(); + try { + msgProp.load(Configurations.class.getResourceAsStream("/messages/message_en.properties")); + } catch (IOException e) { + e.printStackTrace(); + } List menuList = menuDao.findAllList(new SysMenu()); for (SysMenu menu : menuList){ // 获取菜单名称路径(如:系统设置-机构用户-用户管理-编辑) @@ -152,30 +171,66 @@ public class LogUtils { } for (SysMenu m : menuList){ if (m.getId().equals(Long.valueOf(id))){ - namePathList.add(m.getName()); +// namePathList.add(m.getName()); + namePathList.add(msgProp.getProperty(m.getCode())==null?m.getCode():msgProp.getProperty(m.getCode())); break; } } } - namePathList.add(menu.getName()); +// namePathList.add(menu.getName()); + namePathList.add(msgProp.getProperty(menu.getCode())==null?menu.getCode():msgProp.getProperty(menu.getCode())); namePath = StringUtils.join(namePathList, "-"); } // 设置菜单名称路径 if (StringUtils.isNotBlank(menu.getHref())){ - menuMap.put(menu.getHref(), namePath); + if(!StringUtil.isEmpty(menu.getFunctionId())&&menu.getFunctionId()!=0){ + menuMap.put(menu.getHref()+"?functionId"+menu.getFunctionId(), namePath); + menuMap2.put("functionId"+menu.getFunctionId(), namePath);//用于记录功能按钮的操作日志 + }else{ + menuMap.put(menu.getHref(), namePath); + } }else if (StringUtils.isNotBlank(menu.getPermission())){ for (String p : StringUtils.split(menu.getPermission())){ - menuMap.put(p, namePath); + if(!StringUtil.isEmpty(menu.getFunctionId())&&menu.getFunctionId()!=0){ + menuMap.put(p+"?functionId"+menu.getFunctionId(), namePath); + menuMap2.put("functionId"+menu.getFunctionId(), namePath);//用于记录功能按钮的操作日志 + }else{ + menuMap.put(p, namePath); + } + } } - } + CacheUtils.put(CACHE_MENU_NAME_PATH_MAP, menuMap); + CacheUtils.put(CACHE_MENU_NAME_PATH_MAP2, menuMap2); + } + String menuNamePath = null; + if(functionId==0){ + menuNamePath = menuMap.get(href); + }else{ + menuNamePath = menuMap.get(href+"?functionId"+functionId); + if(menuNamePath==null){ + menuNamePath = menuMap2.get("functionId"+functionId); + /*String methodName = href.substring(href.lastIndexOf("/")+1).toLowerCase(); + if(!StringUtil.isEmpty(methodName)){ + if(methodName.contains("insert")||methodName.contains("save")||methodName.contains("update")||methodName.contains("edit")){ + menuNamePath +="-"+"Save or Update"; + }else if(methodName.contains("valid")){ + menuNamePath +="-"+"Delete"; + }else if(methodName.contains("audit")){ + menuNamePath +="-"+"Confirmation"; + } + + }*/ + } } - String menuNamePath = menuMap.get(href); if (menuNamePath == null){ for (String p : StringUtils.split(permission)){ + if(functionId!=0){ + p += "?functionId"+functionId; + } menuNamePath = menuMap.get(p); if (StringUtils.isNotBlank(menuNamePath)){ break; @@ -185,6 +240,7 @@ public class LogUtils { return ""; } } + System.out.println(menuNamePath); return menuNamePath; } From 905a3a3821df57c8a9a25a43b431e97a0198dd56 Mon Sep 17 00:00:00 2001 From: leijun Date: Thu, 11 Oct 2018 18:54:05 +0800 Subject: [PATCH 2/3] =?UTF-8?q?ip=20=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/nis/domain/configuration/BaseStringCfg.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/com/nis/domain/configuration/BaseStringCfg.java b/src/main/java/com/nis/domain/configuration/BaseStringCfg.java index 075f64547..c7954007f 100644 --- a/src/main/java/com/nis/domain/configuration/BaseStringCfg.java +++ b/src/main/java/com/nis/domain/configuration/BaseStringCfg.java @@ -69,7 +69,15 @@ public class BaseStringCfg extends BaseCfg { private List ntcSubscribeIdCfgList; private NtcSubscribeIdCfg ntcSubscribeIdCfg; + private IpPortCfg ipPort; + + public IpPortCfg getIpPort() { + return ipPort; + } + public void setIpPort(IpPortCfg ipPort) { + this.ipPort = ipPort; + } /** * exprType * @return exprType From ef6d793d6b7477b2b0796be9958cc1aec5c401b8 Mon Sep 17 00:00:00 2001 From: wangxin Date: Thu, 11 Oct 2018 19:09:28 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=EF=BC=881=EF=BC=89=E8=B0=83=E6=95=B4ip?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E7=95=8C=E9=9D=A2=20=EF=BC=882=EF=BC=89ip?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E7=95=8C=E9=9D=A2ip=E9=99=90=E9=80=9F?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E7=94=A8=E6=88=B7=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E5=9F=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/configuration/IpCfgService.java | 17 ++ .../resources/messages/message_en.properties | 3 +- .../resources/messages/message_ru.properties | 3 +- .../messages/message_zh_CN.properties | 3 +- .../sql/20181011/extend_region_type.sql | 2 + .../WEB-INF/views/cfg/ipaddr/asnForm.jsp | 32 ++++ .../WEB-INF/views/cfg/ipaddr/ipForm.jsp | 152 ++++++++++-------- 7 files changed, 139 insertions(+), 73 deletions(-) create mode 100644 src/main/resources/sql/20181011/extend_region_type.sql create mode 100644 src/main/webapp/WEB-INF/views/cfg/ipaddr/asnForm.jsp diff --git a/src/main/java/com/nis/web/service/configuration/IpCfgService.java b/src/main/java/com/nis/web/service/configuration/IpCfgService.java index c736b03c7..570f13d22 100644 --- a/src/main/java/com/nis/web/service/configuration/IpCfgService.java +++ b/src/main/java/com/nis/web/service/configuration/IpCfgService.java @@ -562,6 +562,13 @@ public class IpCfgService extends CrudService { if(map.get("numRegionList")!=null){ numRegionList.addAll(map.get("numRegionList")); } + if(Constants.SERVICE_IP_MULITIPLEX==cfg.getServiceId().intValue()){ + String region=Constants.USERREGION_IR_STRATEGY+"="+cfg.getDnsStrategyId()+Constants.USER_REGION_SPLIT + +Constants.USERREGION_IR_TYPE+"="+cfg.getIrType(); + maatCfg.setUserRegion(region); + }else if(Constants.SERVICE_IP_RATELIMIT==cfg.getServiceId().intValue()){ + maatCfg.setUserRegion(Constants.USERREGION_RATE_LIMIT+"="+cfg.getRatelimit()); + } } } if(entity.getNtcSubscribeIdCfgList()!=null && entity.getNtcSubscribeIdCfgList().size()>0){ @@ -630,6 +637,16 @@ public class IpCfgService extends CrudService { maatBean.setCreatorName(entity.getCurrentUser().getName()); maatBean.setVersion(Constants.MAAT_VERSION); maatBean.setOpAction(Constants.INSERT_ACTION); + //限速需要发Droprate=0.001 ,暂不支持Bandwidth=200kbps + if(entity.getAction().equals(Constants.RATELIMIT_ACTION)){ + if(entity.getUserRegion1().equals("0")){//丢包率 + entity.setUserRegion2(StringUtil.isEmpty(entity.getUserRegion2()) ? "":entity.getUserRegion2()); + maatCfg.setUserRegion(Constants.INTERCEPT_IP_RATELIMIT_DROPRATE_USER_REGION_KEY+"="+entity.getUserRegion2()); + }else if(entity.getUserRegion1().equals("1")){//带宽 + entity.setUserRegion3(StringUtil.isEmpty(entity.getUserRegion3()) ? "":entity.getUserRegion3()); + maatCfg.setUserRegion(Constants.INTERCEPT_IP_RATELIMIT_BANDWITH_USER_REGION_KEY+"="+entity.getUserRegion3()); + } + } //调用服务接口下发配置数据 String json=gsonToJson(maatBean); logger.info("ip配置下发配置参数:"+json); diff --git a/src/main/resources/messages/message_en.properties b/src/main/resources/messages/message_en.properties index baf0668e5..e55581c34 100644 --- a/src/main/resources/messages/message_en.properties +++ b/src/main/resources/messages/message_en.properties @@ -1212,4 +1212,5 @@ stream=Stream protocol_menu=Protocol advanced=Advanced protocol_identify=Protocol Identify -MM_FILE_DIGEST=File Digest Configuration \ No newline at end of file +MM_FILE_DIGEST=File Digest Configuration +NTC_ASN_IP=ASN \ No newline at end of file diff --git a/src/main/resources/messages/message_ru.properties b/src/main/resources/messages/message_ru.properties index d14105682..a10e1b41c 100644 --- a/src/main/resources/messages/message_ru.properties +++ b/src/main/resources/messages/message_ru.properties @@ -1212,4 +1212,5 @@ label_app_source=APP Source packet=Packet stream=Stream protocol_menu=Protocol -protocol_identify=Protocol Identify \ No newline at end of file +protocol_identify=Protocol Identify +NTC_ASN_IP=ASN \ No newline at end of file diff --git a/src/main/resources/messages/message_zh_CN.properties b/src/main/resources/messages/message_zh_CN.properties index b079ab5e7..cd53aae60 100644 --- a/src/main/resources/messages/message_zh_CN.properties +++ b/src/main/resources/messages/message_zh_CN.properties @@ -1206,4 +1206,5 @@ stream=Stream protocol_menu=Protocol advanced=Advanced protocol_identify=Protocol Identify -MM_FILE_DIGEST=\u6587\u4EF6\u6458\u8981\u914D\u7F6E \ No newline at end of file +MM_FILE_DIGEST=\u6587\u4EF6\u6458\u8981\u914D\u7F6E +NTC_ASN_IP=ASN \ No newline at end of file diff --git a/src/main/resources/sql/20181011/extend_region_type.sql b/src/main/resources/sql/20181011/extend_region_type.sql new file mode 100644 index 000000000..cf8475fbb --- /dev/null +++ b/src/main/resources/sql/20181011/extend_region_type.sql @@ -0,0 +1,2 @@ +ALTER TABLE function_region_dict MODIFY COLUMN region_type INT(1) NOT NULL COMMENT '1IP类,2字符串类,3增强字符串类,4数值类,5摘要类,6回调类,7 ASN'; +UPDATE function_region_dict SET region_type=7 WHERE config_region_value='NTC_ASN_IP' AND function_id=5; \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/cfg/ipaddr/asnForm.jsp b/src/main/webapp/WEB-INF/views/cfg/ipaddr/asnForm.jsp new file mode 100644 index 000000000..030dbd4f7 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/cfg/ipaddr/asnForm.jsp @@ -0,0 +1,32 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + + + + +
+
+ +
+
+
+
+
+
+ +
+ +
+
+
+
+
+
+ \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/cfg/ipaddr/ipForm.jsp b/src/main/webapp/WEB-INF/views/cfg/ipaddr/ipForm.jsp index 5cdd5e4fe..60fa48ed1 100644 --- a/src/main/webapp/WEB-INF/views/cfg/ipaddr/ipForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/ipaddr/ipForm.jsp @@ -13,50 +13,29 @@ $(document) .ready( function() { - /*initCommIpVal(); - $("#cancel").on("click", function() { - window.history.back(); - });*/ - var asnRegionCode,configType; + var asnRegionCode,isAsn=0; + var regionCodes=$(".action:checked").attr("regionCode").split(","); $("input[id^='cfgRegionCode']").each(function(){ - var regionCode=$(this).val(); - if("asn"==$(this).attr("servicetype")){ + if(7==$(this).attr("regionType")){ asnRegionCode=$(this).val(); } }); - $(".configType a").on("click",function(){ - if($(this).attr("id")=="ipCfgTab"){ - configType="ip"; - $(".glyphicon-plus").first().click(); - $(".ipPortList").find(".glyphicon-remove").addClass("hidden") - hideAction(1,asnRegionCode); - }else{ - configType="asn"; - hideAction(0,asnRegionCode); + for(var ind in regionCodes){ + if(regionCodes[ind]==asnRegionCode){ + isAsn=1; + break; } - var region = ($(this).attr("for")); - if(region=="ipaddr"){ - $(".asn").addClass("hidden").addClass("disabled"); - $(".ipaddr").removeClass("hidden").removeClass("disabled"); - }else{ - $(".ipaddr").addClass("hidden").addClass("disabled"); - $(".asn").removeClass("hidden").removeClass("disabled"); - } - }); - //切换tab - if("${_cfg.cfgId}"==''){ - configType='ip'; - $("#ipCfgTab").click(); - }else if("${_cfg.userRegion4}"==""){ - configType='ip'; - $("#ipCfgTab").click(); - }else{ - configType='asn'; - $("#ansCfgTab").click(); } - if(configType!='asn'){ - $(".glyphicon-plus").first().click(); - $(".ipPortList").find(".glyphicon-remove").addClass("hidden") + //hide actions + if(isAsn==1){ + hideAction(0,asnRegionCode); + }else{ + hideAction(1,asnRegionCode); + } + + if(isAsn==0){ + $("[class~='glyphicon-plus'][class~='ipPortList']").click(); + $("[class~='boxSolid'][class~='asn']").find(".glyphicon-remove").click(); /*if(action==32){ $(".subscribeId").find(".glyphicon-remove").click(); $(".subscribeId").prev("h4").addClass("hidden"); @@ -73,8 +52,24 @@ $(this).addClass("hidden"); } }); - processAction(configType,$(".ipPortList")); + processAction(isAsn,$(".ipPortList")); + }else{ + $("[class~='glyphicon-plus'][class~='asn']").click(); + $("[class~='boxSolid'][class~='ipPortList']").find(".glyphicon-remove").click(); + processAction(isAsn,$(".asn")); } + $(".glyphicon-plus").on("click",function(){ + if($(this).hasClass("ipPortList")){ + isAsn=0; + hideAction(1,asnRegionCode); + $("[class~='boxSolid'][class~='asn']").find(".glyphicon-remove").click(); + } + if($(this).hasClass("asn")){ + isAsn=1; + hideAction(0,asnRegionCode); + $("[class~='boxSolid'][class~='ipPortList']").find(".glyphicon-remove").click(); + } + }); $(".action").on("change", function() { $("#serviceId").val($(this).attr("serviceId")); $("#protocolId").val($(this).attr("protocolId")); @@ -109,10 +104,10 @@ tabInfo.find("[name$='cfgType']").val(cfgType); tabInfo.find("[name$='cfgRegionCode']").val(cfgRegionCode); } - if(configType!='asn'){ + if(isAsn==0){ changeIPVal(tabInfo); } - processAction(configType,tabInfo); + processAction(isAsn,tabInfo); /* if(tabInfo){ tabInfo.find("[name$='cfgType']").val(cfgType); tabInfo.find("[name$='cfgRegionCode']").val(cfgRegionCode); @@ -206,7 +201,7 @@ flag=flag1; } if(flag){ - if(configType!='asn'){ + if(isAsn==0){ $("input[name='userRegion4']").attr("disabled",true); } $("input[name$='userRegion1']").attr("disabled",false); @@ -306,7 +301,7 @@ var hideAction=function(isHide,regionCode){ } var processAction=function(configType,obj){ var action=$(".action:checked").val(); - if(configType!='asn'){ + if(configType!=1){ var o=$(obj) if(o){ /*处理协议*/ @@ -429,9 +424,9 @@ var processAction=function(configType,obj){
-
+ <%--
--%> - --%>
@@ -550,19 +545,19 @@ var processAction=function(configType,obj){
--%>
- + + -

@@ -585,12 +580,10 @@ var processAction=function(configType,obj){ -
-

@@ -637,26 +630,45 @@ var processAction=function(configType,obj){ -

+
+ + +

+ + +

+ + + + ${_cfg.cfgType} + + +
+ <%@include file="/WEB-INF/views/cfg/ipaddr/asnForm.jsp"%> +
+ + +
+
+
+ + + + +
+ + + + +
-
-
-
-
- -
- -
-
-
-
-
-

<%@include file="/WEB-INF/include/form/areaInfo.jsp"%>
@@ -679,7 +691,7 @@ var processAction=function(configType,obj){
-
+ <%--
--%>