diff --git a/src/main/java/com/nis/domain/configuration/AppPolicyCfg.java b/src/main/java/com/nis/domain/configuration/AppPolicyCfg.java index 38ac364d0..398556343 100644 --- a/src/main/java/com/nis/domain/configuration/AppPolicyCfg.java +++ b/src/main/java/com/nis/domain/configuration/AppPolicyCfg.java @@ -35,12 +35,21 @@ public class AppPolicyCfg extends BaseCfg { private Integer behavCode;//specific_service_cfg表二级节点的spec_service_code private Integer specServiceId; private String appName; + private String behavName; private String cfgKeywords; private String userRegion1; private String userRegion2; private String userRegion3; private String userRegion4; private String userRegion5; + public String getBehavName() { + return behavName; + } + + public void setBehavName(String behavName) { + this.behavName = behavName; + } + @Expose @ExcelField(title="expression_type") @SerializedName("exprType") diff --git a/src/main/java/com/nis/util/Constants.java b/src/main/java/com/nis/util/Constants.java index 4a173c9d8..67d2c945a 100644 --- a/src/main/java/com/nis/util/Constants.java +++ b/src/main/java/com/nis/util/Constants.java @@ -7,6 +7,11 @@ import java.util.Map; import com.google.gson.GsonBuilder; public final class Constants { + /** + * + */ + public static String SPECIFIC_SERVICE_CFG_TYPE_APP=Configurations.getStringProperty("specific_service_cfg_type_app", "social_app"); + public static String SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_PROTPCOL=Configurations.getStringProperty("specific_service_cfg_type_encrypted_tunnel_protpcol", "encrypted_tunnel_protpcol"); /** * 报表去重连接符 */ @@ -391,6 +396,8 @@ public final class Constants { public static final Integer CLIENT_CONNECT_TIMEOUT = Configurations.getIntProperty("client_connect_timeout",1000); public static final Integer CLIENT_READ_TIMEOUT = Configurations.getIntProperty("client_read_timeout",1000); public static final Integer CLIENT_SOCKET_TIMEOUT = Configurations.getIntProperty("client_socket_timeout",1000); + public static final String BEHAV_ID_REGION = Configurations.getStringProperty("behav_id_region","BEHAV_ID"); + public static final String RATE_LIMIT_REGION = Configurations.getStringProperty("rate_limit_region","RATE_LIMIT"); public static final String AREA_REGION = Configurations.getStringProperty("area_region","area_ip"); public static final String HTTP_IP_REGION = Configurations.getStringProperty("http_ip_region","http_ip"); public static final String HTTP_REQ_HEAD_REGION = Configurations.getStringProperty("http_req_hdr_region","http_req_hdr"); diff --git a/src/main/java/com/nis/web/controller/configuration/AppCfgController.java b/src/main/java/com/nis/web/controller/configuration/AppCfgController.java index 498aa7618..e8cfae07a 100644 --- a/src/main/java/com/nis/web/controller/configuration/AppCfgController.java +++ b/src/main/java/com/nis/web/controller/configuration/AppCfgController.java @@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import com.nis.domain.Page; +import com.nis.domain.SysDataDictionaryItem; import com.nis.domain.configuration.AppByteCfg; import com.nis.domain.configuration.AppDomainCfg; import com.nis.domain.configuration.AppHttpCfg; @@ -24,6 +25,8 @@ import com.nis.domain.configuration.AppPolicyCfg; import com.nis.domain.configuration.IpPortCfg; import com.nis.domain.specific.SpecificServiceCfg; import com.nis.exceptions.MaatConvertException; +import com.nis.util.Constants; +import com.nis.util.DictUtils; import com.nis.web.controller.BaseController; import com.nis.web.security.UserUtils; @@ -51,6 +54,28 @@ public class AppCfgController extends BaseController { SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(entity.getSpecServiceId()); entity.setAppName(app.getSpecServiceName()); } + //查找社交应用的所有有效二级特定服务 + SpecificServiceCfg second=new SpecificServiceCfg(); + for(SysDataDictionaryItem dict:DictUtils.getDictList("SPECIFIC_SERVICE_CFG_TYPE")) { + if(Constants.SPECIFIC_SERVICE_CFG_TYPE_APP.equals(dict.getItemValue())) { + second.setCfgType(Integer.parseInt(dict.getItemCode())); + break; + } + } + second.setIsValid(Constants.VALID_YES); + second.setIsLeaf(1); + List secondList=specificServiceCfgService.findAllSpecificServiceCfg(second, null); + //遍历,找到匹配项后将行为设置进去 + for(SpecificServiceCfg secondCfg:secondList) { + if(secondCfg.getSpecServiceCode()==null) continue; + for(AppPolicyCfg entity:page.getList()){ + if(entity.getBehavCode()==null) continue; + if(secondCfg.getSpecServiceCode().intValue()==entity.getBehavCode().intValue()) { + entity.setBehavName(secondCfg.getSpecServiceName()); + break; + } + } + } model.addAttribute("page", page); initPageCondition(model,cfg); return "/cfg/app/appPolicyCfgList"; diff --git a/src/main/java/com/nis/web/dao/specific/SpecificServiceCfgDao.xml b/src/main/java/com/nis/web/dao/specific/SpecificServiceCfgDao.xml index 4ba609c2c..8d0cfed6d 100644 --- a/src/main/java/com/nis/web/dao/specific/SpecificServiceCfgDao.xml +++ b/src/main/java/com/nis/web/dao/specific/SpecificServiceCfgDao.xml @@ -120,6 +120,9 @@ AND cfg_type = #{specificServiceCfg.cfgType} + + AND is_leaf = #{specificServiceCfg.isLeaf} + AND op_time > #{specificServiceCfg.beginDate} diff --git a/src/main/java/com/nis/web/service/configuration/AppCfgService.java b/src/main/java/com/nis/web/service/configuration/AppCfgService.java index 11718b5c8..d09ac8ce1 100644 --- a/src/main/java/com/nis/web/service/configuration/AppCfgService.java +++ b/src/main/java/com/nis/web/service/configuration/AppCfgService.java @@ -5,6 +5,7 @@ import java.util.Date; import java.util.List; import java.util.Map; +import org.apache.commons.lang.StringUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -476,10 +477,12 @@ public class AppCfgService extends BaseService { String actionCode = DictUtils.getDictCode("SERVICE_ACTION", "action_ratelimit"); if(!actionCode.equals("默认")){ if(entity.getAction().equals(Integer.parseInt(actionCode))){ - userRegion += Constants.USER_REGION_SPLIT+"RATE_LIMIT="+entity.getRatelimit(); + userRegion += Constants.USER_REGION_SPLIT+Constants.RATE_LIMIT_REGION+"="+entity.getRatelimit(); } } - + if(entity.getBehavCode()!=null) { + userRegion += Constants.USER_REGION_SPLIT+Constants.BEHAV_ID_REGION+"="+entity.getBehavCode(); + } maatCfg.setUserRegion(userRegion); configCompileList.add(maatCfg); maatBean.setConfigCompileList(configCompileList); diff --git a/src/main/resources/nis.properties b/src/main/resources/nis.properties index e026df15c..8055627b4 100644 --- a/src/main/resources/nis.properties +++ b/src/main/resources/nis.properties @@ -310,6 +310,8 @@ ssl_san_region=ssl_san ssl_ca_region=ssl_ca ssl_ip_region=ssl_ip bgp_ip_region=bgp_ip +behav_id_region=BEHAV_ID +rate_limit_region=RATE_LIMIT #存在与表达式的关键字特殊分隔符 keyword_expr=***and*** #时区 @@ -390,4 +392,7 @@ picture_sample_proc_param_is_translation=false http_header_user_region_key=HTTP_HEADER http_header_dict_module=HTTP_HEADER_DISTRICT #dns自定义域参数key -dns_strategy_user_region_key=DNS_STRATEGY \ No newline at end of file +dns_strategy_user_region_key=DNS_STRATEGY +#特定服务类别 +specific_service_cfg_type_app=social_app +specific_service_cfg_type_encrypted_tunnel_protpcol=encrypted_tunnel_protpcol \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/cfg/app/appByteCfgList.jsp b/src/main/webapp/WEB-INF/views/cfg/app/appByteCfgList.jsp index 856a6d167..feee82863 100644 --- a/src/main/webapp/WEB-INF/views/cfg/app/appByteCfgList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/app/appByteCfgList.jsp @@ -41,6 +41,9 @@
+ + +
diff --git a/src/main/webapp/WEB-INF/views/cfg/app/appDomainCfgList.jsp b/src/main/webapp/WEB-INF/views/cfg/app/appDomainCfgList.jsp index 56d065618..489143ea8 100644 --- a/src/main/webapp/WEB-INF/views/cfg/app/appDomainCfgList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/app/appDomainCfgList.jsp @@ -41,6 +41,9 @@
+ + +
diff --git a/src/main/webapp/WEB-INF/views/cfg/app/appHttpCfgList.jsp b/src/main/webapp/WEB-INF/views/cfg/app/appHttpCfgList.jsp index ceaec9d2d..1d0302101 100644 --- a/src/main/webapp/WEB-INF/views/cfg/app/appHttpCfgList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/app/appHttpCfgList.jsp @@ -41,6 +41,9 @@
+ + +
diff --git a/src/main/webapp/WEB-INF/views/cfg/app/appIpCfgList.jsp b/src/main/webapp/WEB-INF/views/cfg/app/appIpCfgList.jsp index 7dbf9bd1e..428eb1ebf 100644 --- a/src/main/webapp/WEB-INF/views/cfg/app/appIpCfgList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/app/appIpCfgList.jsp @@ -44,6 +44,9 @@
+ + +
diff --git a/src/main/webapp/WEB-INF/views/cfg/app/appPolicyCfgForm.jsp b/src/main/webapp/WEB-INF/views/cfg/app/appPolicyCfgForm.jsp index 99e926114..445e96abe 100644 --- a/src/main/webapp/WEB-INF/views/cfg/app/appPolicyCfgForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/app/appPolicyCfgForm.jsp @@ -57,7 +57,7 @@ $(function(){ }, errorContainer: "#messageBox", }); - if('${_cfg.userRegion1}'){ + if('${_cfg.behavCode}'){ ajaxBehaviour($("#specServiceIdId").val()); } $("#specServiceIdId").on("change",function(){ @@ -75,11 +75,11 @@ var ajaxBehaviour=function(val){ success:function(data,textStatus){//处理返回结果 if(textStatus=="success"){ if(data.length>0){ - var html='' +''; for(i=0;i'; @@ -87,8 +87,8 @@ var ajaxBehaviour=function(val){ html+=''; $("#behaviour").prev("label").removeClass("hidden"); $("#behaviour").html(html); - $("[name='userRegion1']").selectpicker("refresh"); - $("[name='userRegion1']").selectpicker("render"); + $("[name='behavCode']").selectpicker("refresh"); + $("[name='behavCode']").selectpicker("render"); }else{ if($("#behaviour").prev("label").is(":visible")){ $("#behaviour").prev("label").addClass("hidden"); @@ -150,9 +150,9 @@ var delContent = function(contentClassName, addBtnClassName) { <%-- --%> - + <%-- --%> - +
diff --git a/src/main/webapp/WEB-INF/views/cfg/app/appPolicyCfgList.jsp b/src/main/webapp/WEB-INF/views/cfg/app/appPolicyCfgList.jsp index 0ae7b8ea8..1a7769bb5 100644 --- a/src/main/webapp/WEB-INF/views/cfg/app/appPolicyCfgList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/app/appPolicyCfgList.jsp @@ -84,6 +84,9 @@
+ + +
@@ -338,7 +341,7 @@ ${cfg.cfgDesc } ${cfg.appName } - ${cfg.userRegion1 } + ${cfg.behavName } ${cfg.ratelimit }