diff --git a/src/main/java/com/nis/domain/configuration/AppComplexKeywordCfg.java b/src/main/java/com/nis/domain/configuration/AppComplexKeywordCfg.java new file mode 100644 index 000000000..eb3266010 --- /dev/null +++ b/src/main/java/com/nis/domain/configuration/AppComplexKeywordCfg.java @@ -0,0 +1,54 @@ +/** + *@Title: BaseEnhancedStringConfig.java + *@Package com.nis.domain.restful + *@Description TODO + *@author dell + *@date 2018年2月5日 下午5:42:52 + *@version 版本号 + */ +package com.nis.domain.configuration; + +import org.apache.commons.lang3.StringUtils; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +/** + * @ClassName: BaseEnhancedStringConfig.java + * @Description: APP增强字符串类配置 + * @author (zhangwei) + * @date 2018年4月3日 下午5:42:52 + * @version V1.0 + */ +public class AppComplexKeywordCfg extends ComplexkeywordCfg{ + /** + * @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么) + * + * @since 1.0.0 + */ + + /** + * + */ + private static final long serialVersionUID = -8058690163147881374L; + @Expose + private Integer compileId; + + public Integer getCompileId() { + return compileId; + } + public void setCompileId(Integer compileId) { + this.compileId = compileId; + } + /* (non-Javadoc) + * @see com.nis.domain.configuration.BaseCfg#initDefaultValue() + */ + @Override + public void initDefaultValue() { + // TODO Auto-generated method stub + super.initDefaultValue(); + this.exprType=0; + this.isHexbin = 0 ; + this.matchMethod=3; + } +} diff --git a/src/main/java/com/nis/domain/configuration/AppIdCfg.java b/src/main/java/com/nis/domain/configuration/AppIdCfg.java index 3d3a64483..a287f2e4d 100644 --- a/src/main/java/com/nis/domain/configuration/AppIdCfg.java +++ b/src/main/java/com/nis/domain/configuration/AppIdCfg.java @@ -32,7 +32,7 @@ public class AppIdCfg extends BaseCfg { /** * 应用协议id */ - private Long appId; + private Integer appId; /** * 编译id @@ -42,12 +42,17 @@ public class AppIdCfg extends BaseCfg { /** * 协议字符串特征表信息列表 */ - private List complexFeaturesList; + private List complexFeaturesList; /** * 协议增强字符串特征配置信息列表 */ - private List strFeaturesCfgList; + private List strFeaturesCfgList; + + /** + * 协议服务器IP配置信息列表 + */ + private List ipCfgList; private List featuresList; @@ -111,14 +116,14 @@ public class AppIdCfg extends BaseCfg { * @return appId */ - public Long getAppId() { + public Integer getAppId() { return appId; } /** * @param appId the appId to set */ - public void setAppId(Long appId) { + public void setAppId(Integer appId) { this.appId = appId; } @@ -149,19 +154,19 @@ public class AppIdCfg extends BaseCfg { } - public List getComplexFeaturesList() { + public List getComplexFeaturesList() { return complexFeaturesList; } - public void setComplexFeaturesList(List complexFeaturesList) { + public void setComplexFeaturesList(List complexFeaturesList) { this.complexFeaturesList = complexFeaturesList; } - public List getStrFeaturesCfgList() { + public List getStrFeaturesCfgList() { return strFeaturesCfgList; } - public void setStrFeaturesCfgList(List strFeaturesCfgList) { + public void setStrFeaturesCfgList(List strFeaturesCfgList) { this.strFeaturesCfgList = strFeaturesCfgList; } @@ -172,5 +177,13 @@ public class AppIdCfg extends BaseCfg { public void setFeaturesList(List featuresList) { this.featuresList = featuresList; } + + public List getIpCfgList() { + return ipCfgList; + } + + public void setIpCfgList(List ipCfgList) { + this.ipCfgList = ipCfgList; + } } diff --git a/src/main/java/com/nis/domain/configuration/AppStringCfg.java b/src/main/java/com/nis/domain/configuration/AppStringCfg.java new file mode 100644 index 000000000..6c95b5e23 --- /dev/null +++ b/src/main/java/com/nis/domain/configuration/AppStringCfg.java @@ -0,0 +1,50 @@ +/** + *@Title: BaseStringConfig.java + *@Package com.nis.domain.restful + *@Description TODO + *@author dell + *@date 2018年2月5日 下午5:26:02 + *@version 版本号 + */ +package com.nis.domain.configuration; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +/** + * @ClassName: BaseStringConfig.java + * @Description: 基础字符串类配置 + * @author (dell) + * @date 2018年2月5日 下午5:26:02 + * @version V1.0 + */ +public class AppStringCfg extends BaseStringCfg { + + + /** + * @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么) + * + * @since 1.0.0 + */ + private static final long serialVersionUID = 4938724489988587634L; + @Expose + private Integer compileId; + + /* (non-Javadoc) + * @see com.nis.domain.configuration.BaseCfg#initDefaultValue() + */ + @Override + public void initDefaultValue() { + // TODO Auto-generated method stub + super.initDefaultValue(); + this.isHexbin = 0; + } + + public Integer getCompileId() { + return compileId; + } + public void setCompileId(Integer compileId) { + this.compileId = compileId; + } + +} diff --git a/src/main/java/com/nis/domain/configuration/MultipleCfg.java b/src/main/java/com/nis/domain/configuration/MultipleCfg.java index a7c04354c..12875394a 100644 --- a/src/main/java/com/nis/domain/configuration/MultipleCfg.java +++ b/src/main/java/com/nis/domain/configuration/MultipleCfg.java @@ -29,6 +29,7 @@ public class MultipleCfg extends BaseCfg { private static final long serialVersionUID = -8369567908781421920L; private String mainTable; private String mainTableType; + private String mainTableDesc; private List otherTables;//key 表名,value 类型 // private BaseCfg mainCfg; //ip配置 @@ -153,4 +154,18 @@ public class MultipleCfg extends BaseCfg { public void setOtherTables(List otherTables) { this.otherTables = otherTables; } + /** + * mainTableDesc + * @return mainTableDesc + */ + + public String getMainTableDesc() { + return mainTableDesc; + } + /** + * @param mainTableDesc the mainTableDesc to set + */ + public void setMainTableDesc(String mainTableDesc) { + this.mainTableDesc = mainTableDesc; + } } diff --git a/src/main/java/com/nis/domain/configuration/MultipleSearchCfg.java b/src/main/java/com/nis/domain/configuration/MultipleSearchCfg.java index 76500dcbc..88c32f330 100644 --- a/src/main/java/com/nis/domain/configuration/MultipleSearchCfg.java +++ b/src/main/java/com/nis/domain/configuration/MultipleSearchCfg.java @@ -28,6 +28,7 @@ public class MultipleSearchCfg extends BaseCfg { private static final long serialVersionUID = -8369567908781421920L; private String mainTable;//主表名 private String mainTableType;//主表类型 + private String mainTableDesc;//主表类型 private String ipTable;//查询条件IP表名,界面限制查询条件除了共用属性之外只能查一个条件 private String stringTable;//查询条件字符串表名,界面限制查询条件除了共用属性之外只能查一个条件 private String complexTable;//查询条件增强字符串串表名,界面限制查询条件除了共用属性之外只能查一个条件 @@ -196,5 +197,18 @@ public class MultipleSearchCfg extends BaseCfg { public void setComplexTable(String complexTable) { this.complexTable = complexTable; } + /** + * mainTableDesc + * @return mainTableDesc + */ + public String getMainTableDesc() { + return mainTableDesc; + } + /** + * @param mainTableDesc the mainTableDesc to set + */ + public void setMainTableDesc(String mainTableDesc) { + this.mainTableDesc = mainTableDesc; + } } diff --git a/src/main/java/com/nis/domain/configuration/TableBean.java b/src/main/java/com/nis/domain/configuration/TableBean.java index 62ad3ba8f..17eafe742 100644 --- a/src/main/java/com/nis/domain/configuration/TableBean.java +++ b/src/main/java/com/nis/domain/configuration/TableBean.java @@ -27,13 +27,15 @@ public class TableBean implements Serializable{ private static final long serialVersionUID = -7276874824312210708L; private String tableName; private String tableType; + private String tableDesc; private boolean canEmpty; public TableBean(){ } - public TableBean(String tableName,String tableType){ + public TableBean(String tableName,String tableType,String tableDesc){ this.tableName=tableName; this.tableType=tableType; + this.tableDesc=tableDesc; } /** * tableName @@ -77,4 +79,19 @@ public class TableBean implements Serializable{ public void setCanEmpty(boolean canEmpty) { this.canEmpty = canEmpty; } + /** + * tableDesc + * @return tableDesc + */ + + public String getTableDesc() { + return tableDesc; + } + /** + * @param tableDesc the tableDesc to set + */ + public void setTableDesc(String tableDesc) { + this.tableDesc = tableDesc; + } + } diff --git a/src/main/java/com/nis/domain/maat/AppMaatCfg.java b/src/main/java/com/nis/domain/maat/AppMaatCfg.java new file mode 100644 index 000000000..a4c47484b --- /dev/null +++ b/src/main/java/com/nis/domain/maat/AppMaatCfg.java @@ -0,0 +1,200 @@ +/** + *@Title: MaatCfg.java + *@Package com.nis.domain.maat + *@Description TODO + *@author dell + *@date 2018年3月1日 上午10:29:29 + *@version 版本号 + */ +package com.nis.domain.maat; + +import java.io.Serializable; +import java.util.List; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; +import com.nis.domain.configuration.AppComplexKeywordCfg; +import com.nis.domain.configuration.AppStringCfg; +import com.nis.domain.configuration.AreaIpCfg; +import com.nis.domain.configuration.BaseIpCfg; +import com.nis.domain.configuration.BaseStringCfg; +import com.nis.domain.configuration.ComplexkeywordCfg; +import com.nis.domain.configuration.NumBoundaryCfg; +import com.nis.domain.specific.SpecificServiceHostCfg; + +/** + * @ClassName: MaatCfg.java + * @Description: TODO + * @author (dell) + * @date 2018年3月1日 上午10:29:29 + * @version V1.0 + */ +public class AppMaatCfg implements Serializable { + + /** + * @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么) + * + * @since 1.0.0 + */ + + private static final long serialVersionUID = -7745084076394247318L; + /** + * APP字符串特征配置 + */ + @Expose + @SerializedName("strFeaturesCfg") + private List strCfg; + /** + * APP服务器IP配置 + */ + @Expose + @SerializedName("specificServiceIpCfg") + private List ipCfg; + /** + * APP服务器IP生效区域配置 + */ + @Expose + @SerializedName("areaCfg") + private List areaCfg; + /** + * APP增强字符串特征配置 + */ + @Expose + @SerializedName("complexStrFeaturesCfg") + private List complexStrCfg; + + @Expose + @SerializedName("action") + private Integer action; + @Expose + @SerializedName("areaEffectiveIds") + private String areaEffectiveIds; + @Expose + @SerializedName("attribute") + private String attribute; + @Expose + @SerializedName("classify") + private String classify; + @Expose + @SerializedName("lable") + private String lable; + @Expose + @SerializedName("compileId") + private Integer compileId; + @Expose + @SerializedName("isAreaEffective") + private Integer isAreaEffective; + @Expose + @SerializedName("isValid") + private Integer isValid; + @Expose + @SerializedName("requestId") + private Integer requestId; + @Expose + @SerializedName("serviceId") + private Integer serviceId; + @Expose + @SerializedName("specificServiceId") + private Integer specificServiceId; + + @Expose + private String maatTable; + + public List getStrCfg() { + return strCfg; + } + public void setStrCfg(List strCfg) { + this.strCfg = strCfg; + } + public List getIpCfg() { + return ipCfg; + } + public void setIpCfg(List ipCfg) { + this.ipCfg = ipCfg; + } + public List getComplexStrCfg() { + return complexStrCfg; + } + public void setComplexStrCfg(List complexStrCfg) { + this.complexStrCfg = complexStrCfg; + } + public List getAreaCfg() { + return areaCfg; + } + public void setAreaCfg(List areaCfg) { + this.areaCfg = areaCfg; + } + public Integer getAction() { + return action; + } + public void setAction(Integer action) { + this.action = action; + } + public String getAreaEffectiveIds() { + return areaEffectiveIds; + } + public void setAreaEffectiveIds(String areaEffectiveIds) { + this.areaEffectiveIds = areaEffectiveIds; + } + public String getAttribute() { + return attribute; + } + public void setAttribute(String attribute) { + this.attribute = attribute; + } + public String getClassify() { + return classify; + } + public void setClassify(String classify) { + this.classify = classify; + } + public String getLable() { + return lable; + } + public void setLable(String lable) { + this.lable = lable; + } + public Integer getCompileId() { + return compileId; + } + public void setCompileId(Integer compileId) { + this.compileId = compileId; + } + public Integer getIsAreaEffective() { + return isAreaEffective; + } + public void setIsAreaEffective(Integer isAreaEffective) { + this.isAreaEffective = isAreaEffective; + } + public Integer getIsValid() { + return isValid; + } + public void setIsValid(Integer isValid) { + this.isValid = isValid; + } + public Integer getRequestId() { + return requestId; + } + public void setRequestId(Integer requestId) { + this.requestId = requestId; + } + public Integer getServiceId() { + return serviceId; + } + public void setServiceId(Integer serviceId) { + this.serviceId = serviceId; + } + public Integer getSpecificServiceId() { + return specificServiceId; + } + public void setSpecificServiceId(Integer specificServiceId) { + this.specificServiceId = specificServiceId; + } + public String getMaatTable() { + return maatTable; + } + public void setMaatTable(String maatTable) { + this.maatTable = maatTable; + } + +} diff --git a/src/main/java/com/nis/domain/specific/ConfigGroupInfo.java b/src/main/java/com/nis/domain/specific/ConfigGroupInfo.java new file mode 100644 index 000000000..e51dc5bd9 --- /dev/null +++ b/src/main/java/com/nis/domain/specific/ConfigGroupInfo.java @@ -0,0 +1,56 @@ +package com.nis.domain.specific; + +import java.util.Date; + +public class ConfigGroupInfo { + private Integer id; + private Integer groupId; + private String groupName; + private Integer isIssued; + private Date insertTime; + private Date updateTime; + private Integer groupType; + public Integer getId() { + return id; + } + public void setId(Integer id) { + this.id = id; + } + public Integer getGroupId() { + return groupId; + } + public void setGroupId(Integer groupId) { + this.groupId = groupId; + } + public String getGroupName() { + return groupName; + } + public void setGroupName(String groupName) { + this.groupName = groupName; + } + public Integer getIsIssued() { + return isIssued; + } + public void setIsIssued(Integer isIssued) { + this.isIssued = isIssued; + } + public Date getInsertTime() { + return insertTime; + } + public void setInsertTime(Date insertTime) { + this.insertTime = insertTime; + } + public Date getUpdateTime() { + return updateTime; + } + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + public Integer getGroupType() { + return groupType; + } + public void setGroupType(Integer groupType) { + this.groupType = groupType; + } + +} diff --git a/src/main/java/com/nis/domain/specific/SpecificServiceHostCfg.java b/src/main/java/com/nis/domain/specific/SpecificServiceHostCfg.java index 3446c93db..7369c57f4 100644 --- a/src/main/java/com/nis/domain/specific/SpecificServiceHostCfg.java +++ b/src/main/java/com/nis/domain/specific/SpecificServiceHostCfg.java @@ -4,6 +4,8 @@ import java.util.Date; import java.util.List; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; import com.nis.domain.BaseEntity; import com.nis.domain.SysUser; @@ -15,21 +17,34 @@ import com.nis.domain.SysUser; public class SpecificServiceHostCfg extends BaseEntity{ private static final long serialVersionUID = -301627652860717175L; - + @Expose + @SerializedName("cfgId") private Integer hostId; //host_id 配置ID bigint N 主键,自增 private Integer specServiceId; //spec_service_id 协议id int N protocol_info_cfg.protocol_id + @Expose private Integer ipType; //ip地址类型 ipV4=4 ipV6=6 + @Expose private String srcIp; //src_ip 源IP地址 varchar(64) N 缺省0.0.0.0值表示任意 + @Expose private String srcIpMask; //src_ip_mask 源地址掩码 varchar(64) N IPV4:255.255.255.255表示无掩码,即精确IP匹配,0.0.0.0值表示任意; //IPV6:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF表示无掩码,::(两个半角冒号)表示任意。非0掩码值必须是2的指数幂,下同。 + @Expose private String srcPort; //src_port 源端口 varchar(6) N 0表示任意值 + @Expose private String srcPortMask; //src_port_mask 源端口掩码 varchar(6) N 65535表示无掩码,即精确端口匹配,0表示任意 + @Expose private String dstIp; //dst_ip 目的IP地址 varchar(64) N 缺省0.0.0.0值表示任意 + @Expose private String dstIpMask; //dst_ip_mask 目的地址掩码 varchar(64) N 同源ip地址掩码 + @Expose private String dstPort; //dst_port 目的端口 varchar(6) N 目的端口,0表示任意值 + @Expose private String dstPortMask; //dst_port_mask 目的端口掩码 varchar(6) N 同源端口掩码 + @Expose private Integer direction;; //direction 方向 int N 0双向,1单向,默认缺省为双向。 + @Expose private Integer protocol; //protocol 协议 int N 6表示tcp,17表示udp,0表示任意 + private Integer isValid; //is_valid 有效标识 int N 0无效,1有效 private Integer isAudit; //is_audit 是否审核 int N 0未审核,1审核通过,2审核未通过,3取消审核通过(即删除) private SysUser creator; //creator_id 创建人员 int N 取自sys_user.id @@ -38,9 +53,12 @@ public class SpecificServiceHostCfg extends BaseEntity{ private Date editTime; //edit_time 修改时间 date Y private SysUser auditor; //auditor_id 审核人员 int Y 取自sys_user.id private Date auditTime; //audit_time 审核时间 date Y - - - + @Expose + private Integer protocolId;//配置转json下发时使用 + @Expose + private String maatTable;//配置转json下发时使用 + @Expose + private Integer groupId;//配置转json下发时使用 private Date beginDate; private Date endDate; @@ -226,11 +244,23 @@ public class SpecificServiceHostCfg extends BaseEntity{ public static void sort(List list, List sourceList, Integer ParentId, boolean cascade){ } - - - - - - + public Integer getProtocolId() { + return protocolId; + } + public void setProtocolId(Integer protocolId) { + this.protocolId = protocolId; + } + public String getMaatTable() { + return maatTable; + } + public void setMaatTable(String maatTable) { + this.maatTable = maatTable; + } + public Integer getGroupId() { + return groupId; + } + public void setGroupId(Integer groupId) { + this.groupId = groupId; + } } diff --git a/src/main/java/com/nis/util/Constants.java b/src/main/java/com/nis/util/Constants.java index f8145f9d9..c9994e0e5 100644 --- a/src/main/java/com/nis/util/Constants.java +++ b/src/main/java/com/nis/util/Constants.java @@ -5,7 +5,18 @@ import java.util.Date; import com.google.gson.GsonBuilder; public final class Constants { - + /** + * 字典表地域运营商 + */ + public static final int ITEM_TYPE_AREA = 1; + public static final int ITEM_TYPE_ISP = 2; + /** + * action值 + */ + public static final int ACTION_DF = 1; + public static final int ACTION_DJ = 2; + public static final int ACTION_BMD = 5; + public static final int ACTION_HMD = 8; public static final int CFG_PAGE = 0; public static final int AUDIT_PAGE = 1; public static final String DEFAULT_CAPTCHA_PARAM = "captcha"; 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 a8b78fa1d..25f798537 100644 --- a/src/main/java/com/nis/web/controller/configuration/AppCfgController.java +++ b/src/main/java/com/nis/web/controller/configuration/AppCfgController.java @@ -102,6 +102,14 @@ public class AppCfgController extends BaseController { //协议特征配置 List featuresList = serviceConfigInfoService.findList(serviceId); model.addAttribute("featuresList",featuresList); + if(featuresList!=null){ + for(ServiceConfigInfo s:featuresList){ + if(s.getTableType()==2 || s.getTableType()==4){ + model.addAttribute("isContainFeaturesCfg", true); + break; + } + } + } //特征作用域信息 /*SysDictInfo sysDictInfo = new SysDictInfo(); sysDictInfo.setItemType(3); @@ -247,7 +255,13 @@ public class AppCfgController extends BaseController { }else if(cfg.getIsAudit()==Constants.AUDIT_YES){//审核通过,设置有效标志为1 cfg.setIsValid(Constants.VALID_YES); } - int result=appCfgService.auditAppCfg(cfg); + try { + int result=appCfgService.auditAppCfg(cfg); + } catch (Exception e) { + e.printStackTrace(); + logger.error("配置下发maat失败,"+e.getMessage()); + addMessage(model,"配置审核下发失败!"); + } model.addAttribute("serviceId", cfg.getServiceId()); model.addAttribute("action", cfg.getAction()); } @@ -264,11 +278,11 @@ public class AppCfgController extends BaseController { * @since 1.0.0 */ @RequestMapping(value = {"deleteCfg"}) - public String deleteAppCfg(int action,long cfgId,String cfgName,Integer serviceId,Model model) { + public String deleteAppCfg(int action,long cfgId,Integer compileId,String cfgName,Integer serviceId,Model model) { model.addAttribute("serviceId", serviceId); model.addAttribute("cfgName", cfgName); model.addAttribute("action", action); - model.addAttribute("cfgType","complex"); + model.addAttribute("cfgType","app"); model.addAttribute("audit", Constants.CFG_PAGE); int audit=appCfgService.getIsAudit(cfgId); //未审核时可删除 @@ -278,6 +292,7 @@ public class AppCfgController extends BaseController { cfg.setEditorId(cfg.getCurrentUser().getId()); cfg.setEditTime(new Date()); cfg.setIsValid(Constants.VALID_DEL); + cfg.setCompileId(compileId); int result=appCfgService.deleteAppCfg(cfg); addMessage(model,"删除成功,正在为您跳转页面..."); }else{ diff --git a/src/main/java/com/nis/web/controller/configuration/MultipleCfgController.java b/src/main/java/com/nis/web/controller/configuration/MultipleCfgController.java index 6ef86fd4c..792532733 100644 --- a/src/main/java/com/nis/web/controller/configuration/MultipleCfgController.java +++ b/src/main/java/com/nis/web/controller/configuration/MultipleCfgController.java @@ -20,7 +20,6 @@ import org.springframework.web.bind.annotation.RequestMapping; import com.nis.domain.Page; import com.nis.domain.ServiceConfigInfo; import com.nis.domain.basics.ServiceDictInfo; -import com.nis.domain.basics.SysDictInfo; import com.nis.domain.configuration.BaseCfg; import com.nis.domain.configuration.BaseIpCfg; import com.nis.domain.configuration.BaseStringCfg; @@ -93,7 +92,9 @@ public class MultipleCfgController extends BaseController{ String tableName=info.getTableName(); if(mainTable.equals(tableName)){ model.addAttribute("mainTableType", String.valueOf(info.getTableType())); + model.addAttribute("mainTableDesc", info.getTableDesc()); cfg.setMainTableType(String.valueOf(type)); + cfg.setMainTableDesc(info.getTableDesc()); if(Constants.TABLE_TYPE_COMPLEX==type){//增强字符串类型 ComplexkeywordCfg _cfg=cfg.getComplexCfg()==null?new ComplexkeywordCfg():cfg.getComplexCfg(); _cfg.setTableName(mainTable); @@ -209,7 +210,7 @@ public class MultipleCfgController extends BaseController{ } for(ServiceConfigInfo info:serviceConfigInfos){ int type=info.getTableType(); - TableBean tableBean=new TableBean(info.getTableName(),String.valueOf(type)); + TableBean tableBean=new TableBean(info.getTableName(),String.valueOf(type),info.getTableDesc()); if(!mainTable.equals(info.getTableName())){ otherTables.add(tableBean); if(Constants.TABLE_TYPE_COMPLEX==type){//增强字符串类型 @@ -347,7 +348,7 @@ public class MultipleCfgController extends BaseController{ }else{ for(ServiceConfigInfo info:serviceConfigInfos){ int type=info.getTableType(); - TableBean tableBean=new TableBean(info.getTableName(),String.valueOf(type)); + TableBean tableBean=new TableBean(info.getTableName(),String.valueOf(type),info.getTableDesc()); if(!mainTable.equals(info.getTableName())){ otherTables.add(tableBean); } @@ -356,6 +357,7 @@ public class MultipleCfgController extends BaseController{ } } model.addAttribute("mainTableType", cfg.getMainTableType()); + model.addAttribute("mainTableDesc", cfg.getMainTableDesc()); model.addAttribute("action", cfg.getAction()); model.addAttribute("page", resultPage); List requestInfos=requestInfoService.getAllRequestInfo(); @@ -386,10 +388,12 @@ public class MultipleCfgController extends BaseController{ cfg.setOtherTables(otherTables); for(ServiceConfigInfo info:serviceConfigInfos){ int type=info.getTableType(); - TableBean tableBean=new TableBean(info.getTableName(), String.valueOf(type)); + TableBean tableBean=new TableBean(info.getTableName(), String.valueOf(type),info.getTableDesc()); if(mainTable.equals(info.getTableName())){ cfg.setMainTableType(String.valueOf(type)); + cfg.setMainTableDesc(info.getTableDesc()); model.addAttribute("mainTableType", String.valueOf(type)); + model.addAttribute("mainTableDesc", info.getTableDesc()); }else{ otherTables.add(tableBean); } @@ -436,8 +440,8 @@ public class MultipleCfgController extends BaseController{ Map map=cfg.getComplexCfg(); map.put(tableName,complexCfg); } - List districts=sysDictInfoService.getDistrictDict(tableName); - model.addAttribute("districts", districts); +// List districts=sysDictInfoService.getDistrictDict(tableName); +// model.addAttribute("districts", districts); } } cfg.setAction(action); @@ -467,7 +471,9 @@ public class MultipleCfgController extends BaseController{ resultCfg.setMainTable(mainTable); String mainTableType=cfg.getMainTableType(); model.addAttribute("mainTableType", mainTableType); + model.addAttribute("mainTableDesc", cfg.getMainTableDesc()); resultCfg.setMainTableType(mainTableType); + resultCfg.setMainTableDesc(cfg.getMainTableDesc()); resultCfg.setAction(cfg.getAction()); int serviceId=cfg.getServiceId(); cfg.setServiceId(serviceId); @@ -480,7 +486,7 @@ public class MultipleCfgController extends BaseController{ String tableName=info.getTableName(); int type=info.getTableType(); if(!tableName.equals(mainTable)){ - TableBean bean=new TableBean(tableName,String.valueOf(type)); + TableBean bean=new TableBean(tableName,String.valueOf(type),info.getTableDesc()); if(Constants.TABLE_TYPE_IP==type){ bean.setCanEmpty(true); } @@ -573,6 +579,8 @@ public class MultipleCfgController extends BaseController{ this.setPropertiesToMultipleCfg(resultCfg, resultComplexCfg,"update"); } } +// List districts=sysDictInfoService.getDistrictDict(tableName); +// model.addAttribute("districts", districts); } } model.addAttribute("_cfg", resultCfg); @@ -601,7 +609,9 @@ public class MultipleCfgController extends BaseController{ resultCfg.setMainTable(mainTable); String mainTableType=cfg.getMainTableType(); model.addAttribute("mainTableType", mainTableType); + model.addAttribute("mainTableDesc", cfg.getMainTableDesc()); resultCfg.setMainTableType(mainTableType); + resultCfg.setMainTableDesc(cfg.getMainTableDesc()); resultCfg.setAction(cfg.getAction()); int serviceId=cfg.getServiceId(); cfg.setServiceId(serviceId); @@ -760,7 +770,7 @@ public class MultipleCfgController extends BaseController{ if(cfg.getNumCfg()!=null){ for(Entry numCfg:cfg.getNumCfg().entrySet()){ if(!isNull(numCfg.getValue())){ - numCfg.getValue().setTableName(info.getTableName()); + numCfg.getValue().setTableName(numCfg.getKey()); numCfg.getValue().setIsValid(Constants.VALID_NO); numCfg.getValue().setIsAudit(Constants.AUDIT_NOT_YET); numCfg.getValue().setCompileId(compileId); @@ -779,7 +789,7 @@ public class MultipleCfgController extends BaseController{ if(cfg.getComplexCfg()!=null){ for(Entry complexCfg:cfg.getComplexCfg().entrySet()){ if(!isNull(complexCfg.getValue())){ - complexCfg.getValue().setTableName(info.getTableName()); + complexCfg.getValue().setTableName(complexCfg.getKey()); complexCfg.getValue().setIsValid(Constants.VALID_NO); complexCfg.getValue().setIsAudit(Constants.AUDIT_NOT_YET); complexCfg.getValue().setCompileId(compileId); @@ -841,6 +851,7 @@ public class MultipleCfgController extends BaseController{ String tableName=info.getTableName(); if(cfg.getMainTable().equals(tableName)){ model.addAttribute("mainTableType", String.valueOf(type)); + model.addAttribute("mainTableDesc", info.getTableDesc()); } if(Constants.TABLE_TYPE_IP==type){ BaseIpCfg searchIpCfg=new BaseIpCfg(); diff --git a/src/main/java/com/nis/web/dao/configuration/AppCfgDao.java b/src/main/java/com/nis/web/dao/configuration/AppCfgDao.java index 9fe92589f..5e2fe35e1 100644 --- a/src/main/java/com/nis/web/dao/configuration/AppCfgDao.java +++ b/src/main/java/com/nis/web/dao/configuration/AppCfgDao.java @@ -1,11 +1,14 @@ package com.nis.web.dao.configuration; +import java.util.Date; import java.util.List; import org.apache.ibatis.annotations.Param; +import com.nis.domain.configuration.AppComplexKeywordCfg; import com.nis.domain.configuration.AppIdCfg; import com.nis.domain.configuration.AppIdCfg.AppFeaturesIndex; +import com.nis.domain.configuration.AppStringCfg; import com.nis.domain.configuration.BaseStringCfg; import com.nis.domain.configuration.ComplexkeywordCfg; import com.nis.web.dao.CrudDao; @@ -26,16 +29,19 @@ public interface AppCfgDao extends CrudDao { public int updateByPrimaryKeySelective(AppIdCfg entity) ; public int updateValid(AppIdCfg entity) ; public int audit(AppIdCfg entity) ; -// public int getIsValid(@Param("tableName")String tableName,@Param("cfgId")Long id); + public int updateFeaturesTableValid(@Param("tableName")String tableName,@Param("compileId")Integer compileId, + @Param("isValid")Integer isValid,@Param("editorId")Long editorId,@Param("editTime")Date editTime) ; + public int auditFeaturesTable(@Param("tableName")String tableName,@Param("compileId")Integer compileId, + @Param("isValid")Integer isValid,@Param("isAudit")Integer isAudit, + @Param("auditorId")Long auditorId,@Param("auditTime")Date auditTime) ; + public int getIsValid(@Param("tableName")String tableName,@Param("cfgId")Long id); public int getIsValid(@Param("cfgId")Long id); -// public int getIsAudit(@Param("tableName")String tableName,@Param("cfgId")Long id); + public int getIsAudit(@Param("tableName")String tableName,@Param("cfgId")Long id); public int getIsAudit(@Param("cfgId")Long id); - public List getComplexkeywordCfgList(); public List getFeaturesTableListByAppCompileId(@Param("appCompileId")Integer appCompileId) ; - public List getFeaturesCfgListByCompileId(@Param("compileId")Integer compileId) ; public int insertFeatures(AppFeaturesIndex entity) ; public int updateFeaturesByAppId(AppFeaturesIndex entity) ; public int deleteFeaturesByAppId(AppFeaturesIndex entity) ; - public List getComplexkeywordFeaturesCfgListByCompileId(@Param("featuresTable") String featuresTable,@Param("compileId")Integer compileId); - public List getStrFeaturesCfgListByCompileId(@Param("featuresTable") String featuresTable,@Param("compileId")Integer compileId); + public List getComplexkeywordFeaturesCfgListByCompileId(@Param("featuresTable") String featuresTable,@Param("compileId")Integer compileId); + public List getStrFeaturesCfgListByCompileId(@Param("featuresTable") String featuresTable,@Param("compileId")Integer compileId); } diff --git a/src/main/java/com/nis/web/dao/configuration/AppCfgDao.xml b/src/main/java/com/nis/web/dao/configuration/AppCfgDao.xml index 5264a2e00..0a61ec8b0 100644 --- a/src/main/java/com/nis/web/dao/configuration/AppCfgDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/AppCfgDao.xml @@ -38,7 +38,7 @@ - + @@ -64,7 +64,7 @@ - + @@ -504,6 +504,16 @@ where cfg_id = #{cfgId,jdbcType=BIGINT} + + update ${tableName} set is_valid = #{isValid,jdbcType=INTEGER}, editor_id = #{editorId,jdbcType=INTEGER} , edit_time = #{editTime,jdbcType=TIMESTAMP} where compile_id = #{compileId,jdbcType=INTEGER} + + + update ${tableName} set is_audit = #{isAudit,jdbcType=INTEGER}, auditor_id = #{auditorId,jdbcType=INTEGER}, audit_time = #{auditTime,jdbcType=TIMESTAMP} + + ,is_valid = #{isValid,jdbcType=INTEGER} + + where compile_id = #{compileId,jdbcType=INTEGER} + SELECT * FROM specific_service_cfg s WHERE s.is_valid = 1 and s.parent_id = #{specServiceId} + + + + + + + UPDATE config_group_info set is_issued = #{isIssued},update_time=now() where group_id = #{groupId} + + + + + insert into config_group_info (id,group_id,group_name,is_issued,insert_time,group_type) + values(#{id},#{groupId},#{groupName},#{isIssued},now(),#{groupType}) + \ No newline at end of file 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 afff26429..95581b21f 100644 --- a/src/main/java/com/nis/web/service/configuration/AppCfgService.java +++ b/src/main/java/com/nis/web/service/configuration/AppCfgService.java @@ -1,25 +1,40 @@ package com.nis.web.service.configuration; +import java.lang.annotation.Annotation; +import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.Map; import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import com.nis.domain.Page; import com.nis.domain.ServiceConfigInfo; +import com.nis.domain.configuration.AppComplexKeywordCfg; import com.nis.domain.configuration.AppIdCfg; -import com.nis.domain.configuration.BaseStringCfg; +import com.nis.domain.configuration.AppStringCfg; +import com.nis.domain.configuration.AreaIpCfg; +import com.nis.domain.configuration.BaseIpCfg; import com.nis.domain.configuration.AppIdCfg.AppFeaturesIndex; -import com.nis.domain.configuration.ComplexkeywordCfg; +import com.nis.domain.maat.AppMaatCfg; +import com.nis.domain.specific.ConfigGroupInfo; +import com.nis.domain.specific.SpecificServiceCfg; +import com.nis.domain.specific.SpecificServiceHostCfg; import com.nis.main.ConvertTool; +import com.nis.util.Constants; import com.nis.util.StringUtil; import com.nis.web.dao.configuration.AppCfgDao; import com.nis.web.dao.configuration.ComplexStringCfgDao; +import com.nis.web.dao.configuration.IpCfgDao; import com.nis.web.dao.configuration.StringCfgDao; +import com.nis.web.dao.specific.SpecificServiceCfgDao; +import com.nis.web.dao.specific.SpecificServiceHostCfgDao; import com.nis.web.dao.systemService.ServiceConfigInfoDao; import com.nis.web.service.CrudService; @@ -39,6 +54,12 @@ public class AppCfgService extends CrudService { protected StringCfgDao stringCfgDao; @Autowired protected ComplexStringCfgDao complexStringCfgDao; + @Autowired + private SpecificServiceCfgDao specificServiceCfgDao; + @Autowired + private SpecificServiceHostCfgDao specificServiceHostCfgDao; + @Autowired + protected IpCfgDao ipCfgDao; public Page findPage(Page page, AppIdCfg entity) { entity.setPage(page); @@ -49,18 +70,18 @@ public class AppCfgService extends CrudService { public AppIdCfg findAppIdCfg(AppIdCfg entity) { //查询协议关联特征表 List featuresTableList = appCfgDao.getFeaturesTableListByAppCompileId(entity.getCompileId()); - List complexList = new ArrayList(); - List strList = new ArrayList(); + List complexList = new ArrayList(); + List strList = new ArrayList(); if(!StringUtil.isEmpty(featuresTableList)){ for(AppFeaturesIndex features:featuresTableList){ if(features.getFeaturesTableType().equals(4)){//增强字符串特征配置 - List complexFeaturesList = appCfgDao.getComplexkeywordFeaturesCfgListByCompileId( + List complexFeaturesList = appCfgDao.getComplexkeywordFeaturesCfgListByCompileId( features.getFeaturesTable(),features.getFeaturesCompileId()); complexList.addAll(complexFeaturesList); }else if(features.getFeaturesTableType().equals(2)){//普通字符串特征配置 - List strFeaturesCfgList = appCfgDao.getStrFeaturesCfgListByCompileId( + List strFeaturesCfgList = appCfgDao.getStrFeaturesCfgListByCompileId( features.getFeaturesTable(),features.getFeaturesCompileId()); strList.addAll(strFeaturesCfgList); } @@ -90,7 +111,7 @@ public class AppCfgService extends CrudService { cfg.setCompileId(appCompileId); cfgId = appCfgDao.insert(cfg); if(cfg.getComplexFeaturesList()!=null){ - for(ComplexkeywordCfg c:cfg.getComplexFeaturesList()){ + for(AppComplexKeywordCfg c:cfg.getComplexFeaturesList()){ Integer featuresCompileId = new ConvertTool().getCompileId(); AppFeaturesIndex f = new AppFeaturesIndex(); f.setAppCompileId(cfg.getCompileId()); @@ -119,7 +140,7 @@ public class AppCfgService extends CrudService { } } if(cfg.getStrFeaturesCfgList()!=null){ - for(BaseStringCfg s:cfg.getStrFeaturesCfgList()){ + for(AppStringCfg s:cfg.getStrFeaturesCfgList()){ Integer featuresCompileId = new ConvertTool().getCompileId(); AppFeaturesIndex f = new AppFeaturesIndex(); f.setAppCompileId(cfg.getCompileId()); @@ -162,7 +183,7 @@ public class AppCfgService extends CrudService { @Transactional(readOnly=false,rollbackFor=RuntimeException.class) public int updateAppCfg(AppIdCfg cfg) throws Exception{ if(cfg.getComplexFeaturesList()!=null){ - for(ComplexkeywordCfg c:cfg.getComplexFeaturesList()){ + for(AppComplexKeywordCfg c:cfg.getComplexFeaturesList()){ Integer featuresCompileId = 0; c.setIsAreaEffective(cfg.getIsAreaEffective()); c.setAreaEffectiveIds(cfg.getAreaEffectiveIds()); @@ -191,14 +212,14 @@ public class AppCfgService extends CrudService { c.setIsValid(cfg.getIsValid()); complexStringCfgDao.insert(c); }else{ - complexStringCfgDao.update(c); + complexStringCfgDao.updateByPrimaryKeySelective(c); } } } if(cfg.getStrFeaturesCfgList()!=null){ - for(BaseStringCfg s:cfg.getStrFeaturesCfgList()){ + for(AppStringCfg s:cfg.getStrFeaturesCfgList()){ Integer featuresCompileId = 0; s.setIsAreaEffective(cfg.getIsAreaEffective()); s.setAreaEffectiveIds(cfg.getAreaEffectiveIds()); @@ -227,7 +248,7 @@ public class AppCfgService extends CrudService { s.setIsValid(cfg.getIsValid()); stringCfgDao.insert(s); }else{ - stringCfgDao.update(s); + stringCfgDao.updateByPrimaryKeySelective(s); } } @@ -241,12 +262,235 @@ public class AppCfgService extends CrudService { * @param cfg * @return *int + * @throws Exception * @exception * @since 1.0.0 */ @Transactional(readOnly=false,rollbackFor=RuntimeException.class) - public int auditAppCfg(AppIdCfg cfg){ - return appCfgDao.audit(cfg); + public int auditAppCfg(AppIdCfg entity) throws Exception{ + boolean sendFlag = false; + AppIdCfg appCfg = appCfgDao.getById(entity.getCfgId()); + List featuresTableList = appCfgDao.getFeaturesTableListByAppCompileId(appCfg.getCompileId()); + List strList = new ArrayList(); + List complexList = new ArrayList(); + List hostList =new ArrayList(); + List areaList = new ArrayList(); + ConfigGroupInfo group = null; + + + Gson gson=new GsonBuilder().disableHtmlEscaping() + .excludeFieldsWithoutExposeAnnotation() + .create(); + + //配置审核状态即将改变后的状态 + if(Constants.AUDIT_NOT_YES==entity.getIsAudit().intValue()|| + Constants.AUDIT_YES==entity.getIsAudit().intValue()){//审核通过,取消审核通过需要发到maat + + if(Constants.AUDIT_YES==entity.getIsAudit().intValue()){//审核通过 + if(StringUtil.isEmpty(featuresTableList)){ + SpecificServiceCfg protocol = specificServiceCfgDao.getBySpecServiceId(appCfg.getAppId().intValue()); + group = specificServiceCfgDao.getConfigGroupInfoByGroupId(protocol.getGroupId()); + //featuresTableList为空的时候,该service只有特定服务IP一个配置表 + ServiceConfigInfo serviceCfg=serviceConfigInfoDao.findSysServiceConfigInfo(appCfg.getServiceId()); + if(group==null){ + throw new RuntimeException("配置审核失败,未获取社交应用服务器IP所属分组信息"); + }else{ + if(group.getIsIssued()==0){ + //如果分组信息尚未下发,则下发IP + group.setGroupId(protocol.getGroupId()); + group.setIsIssued(1); + SpecificServiceHostCfg hostCfg = new SpecificServiceHostCfg(); + hostCfg.setSpecServiceId(protocol.getSpecServiceId()); + hostList = specificServiceHostCfgDao.findSpecHostList(hostCfg); + + for(SpecificServiceHostCfg host:hostList){ + SpecificServiceCfg specServiceCfg = specificServiceCfgDao.getBySpecServiceId(host.getSpecServiceId()); + host.setProtocolId(0); + host.setGroupId(specServiceCfg.getGroupId()); + if(StringUtil.isEmpty(serviceCfg)){ + host.setMaatTable("DF_PROTOCOL_APP"); + }else{ + host.setMaatTable(serviceCfg.getMaatTable()); + } + } + }else{ + SpecificServiceHostCfg host = new SpecificServiceHostCfg(); + host.setGroupId(protocol.getGroupId()); + hostList.add(host); + } + } + + + //生效区域列表信息 + if(appCfg.getIsAreaEffective()==1){ + if(StringUtil.isEmpty(appCfg.getAreaEffectiveIds())){ + BaseIpCfg ipCfg = new BaseIpCfg(); + ipCfg.setCompileId(appCfg.getCompileId()); + ipCfg.setTableName("area_ip_cfg"); + areaList = ipCfgDao.findList(ipCfg); + } + } + }else{ + for(AppFeaturesIndex featuresCfg:featuresTableList){ + if(featuresCfg.getFeaturesTableType()==2){ + List list =appCfgDao.getStrFeaturesCfgListByCompileId(featuresCfg.getFeaturesTable(), featuresCfg.getFeaturesCompileId()); + for(AppStringCfg cfg:list){ + List cList = serviceConfigInfoDao.findList(appCfg.getServiceId()); + if(!StringUtil.isEmpty(cList)){ + for(ServiceConfigInfo c:cList){ + if(c.getTableName().equals(featuresCfg.getFeaturesTable())){ + cfg.setMaatTable(c.getMaatTable()); + } + } + + } + cfg.setCompileId(featuresCfg.getFeaturesCompileId()); + strList.add(cfg); + } + } + if(featuresCfg.getFeaturesTableType()==4){ + List list = appCfgDao.getComplexkeywordFeaturesCfgListByCompileId(featuresCfg.getFeaturesTable(), featuresCfg.getFeaturesCompileId()); + for(AppComplexKeywordCfg cfg:list){ + List cList = serviceConfigInfoDao.findList(appCfg.getServiceId()); + if(!StringUtil.isEmpty(cList)){ + for(ServiceConfigInfo c:cList){ + if(c.getTableName().equals(featuresCfg.getFeaturesTable())){ + cfg.setMaatTable(c.getMaatTable()); + } + } + } + + cfg.setCompileId(featuresCfg.getFeaturesCompileId()); + complexList.add(cfg); + } + } + } + } + AppMaatCfg maatCfg = new AppMaatCfg(); + if(StringUtil.isEmpty(featuresTableList)){ + maatCfg.setIpCfg(hostList); + maatCfg.setAreaCfg(areaList); + if(appCfg.getCompileId()==0){ + throw new RuntimeException("转换出错,未获取到正确的compileId"); + }else{ + maatCfg.setCompileId(appCfg.getCompileId()); + } + }else{//特征配置 + maatCfg.setStrCfg(strList); + maatCfg.setComplexStrCfg(complexList); + } + + if(appCfg.getAction()==null){ + throw new RuntimeException("转换出错,未获取到正确的action"); + }else{ + maatCfg.setAction(appCfg.getAction()); + } + if(appCfg.getIsAreaEffective()==null){ + throw new RuntimeException("转换出错,未获取到正确的isAreaEffective"); + }else{ + maatCfg.setIsAreaEffective(appCfg.getIsAreaEffective()); + } + if(appCfg.getIsValid()==null){ + throw new RuntimeException("转换出错,未获取到正确的isValid"); + }else{ + maatCfg.setIsValid(appCfg.getIsValid()); + } + if(appCfg.getRequestId()==null){ + throw new RuntimeException("转换出错,未获取到正确的requestId"); + }else{ + maatCfg.setRequestId(appCfg.getRequestId()); + } + if(appCfg.getServiceId()==null){ + throw new RuntimeException("转换出错,未获取到正确的serviceId"); + }else{ + maatCfg.setServiceId(appCfg.getServiceId()); + } + maatCfg.setSpecificServiceId(appCfg.getAppId()); + maatCfg.setAreaEffectiveIds(appCfg.getAreaEffectiveIds()==null?"":appCfg.getAreaEffectiveIds()); + maatCfg.setAttribute(appCfg.getAttribute()==null?"":appCfg.getAttribute()); + maatCfg.setClassify(appCfg.getClassify()==null?"":appCfg.getClassify()); + maatCfg.setLable(appCfg.getLable()==null?"":appCfg.getLable()); + String json=gson.toJson(maatCfg); + //下发maat +// new ConvertTool().saveAppConfig(json); + sendFlag = true; + + }else{//取消审核通过 + AppMaatCfg maatCfg = new AppMaatCfg(); + if(StringUtil.isEmpty(featuresTableList)){ + ServiceConfigInfo serviceCfg=serviceConfigInfoDao.findSysServiceConfigInfo(appCfg.getServiceId()); + maatCfg.setMaatTable(serviceCfg.getMaatTable()); + if(appCfg.getCompileId()==0){ + throw new RuntimeException("转换出错,未获取到正确的compileId"); + }else{ + maatCfg.setCompileId(appCfg.getCompileId()); + } + }else{//特征配置 + for(AppFeaturesIndex featuresCfg:featuresTableList){ + if(featuresCfg.getFeaturesTableType()==2){ + List list =appCfgDao.getStrFeaturesCfgListByCompileId(featuresCfg.getFeaturesTable(), featuresCfg.getFeaturesCompileId()); + for(AppStringCfg cfg:list){ + AppStringCfg strCfg = new AppStringCfg(); + List cList = serviceConfigInfoDao.findList(appCfg.getServiceId()); + if(!StringUtil.isEmpty(cList)){ + for(ServiceConfigInfo c:cList){ + if(c.getTableName().equals(featuresCfg.getFeaturesTable())){ + strCfg.setMaatTable(c.getMaatTable()); + } + } + + } + strCfg.setCompileId(featuresCfg.getFeaturesCompileId()); + strList.add(strCfg); + } + } + if(featuresCfg.getFeaturesTableType()==4){ + List list = appCfgDao.getComplexkeywordFeaturesCfgListByCompileId(featuresCfg.getFeaturesTable(), featuresCfg.getFeaturesCompileId()); + for(AppComplexKeywordCfg cfg:list){ + AppComplexKeywordCfg complexCfg = new AppComplexKeywordCfg(); + List cList = serviceConfigInfoDao.findList(appCfg.getServiceId()); + if(!StringUtil.isEmpty(cList)){ + for(ServiceConfigInfo c:cList){ + if(c.getTableName().equals(featuresCfg.getFeaturesTable())){ + complexCfg.setMaatTable(c.getMaatTable()); + } + } + } + + complexCfg.setCompileId(featuresCfg.getFeaturesCompileId()); + complexList.add(complexCfg); + } + } + } + maatCfg.setStrCfg(strList); + maatCfg.setComplexStrCfg(complexList); + } + + String json=gson.toJson(maatCfg); + //下发maat +// new ConvertTool().saveAppConfig(json); + sendFlag = true; + } + + }else{ + sendFlag = false; + } + + if(sendFlag){ + //修改appId配置审核下发状态 + appCfgDao.audit(entity); + //修改特定服务IP分组下发状态 + specificServiceCfgDao.updateConfigGroupInfobyGroupId(group); + //修改特征表配置审核下发状态 + for(AppFeaturesIndex cfg:featuresTableList){ + appCfgDao.auditFeaturesTable(cfg.getFeaturesTable(), cfg.getFeaturesCompileId(), entity.getIsValid(), + entity.getIsAudit(), entity.getAuditorId(), entity.getAuditTime()); + + } + return 1; + }else{ + return 0; + } } /** * @@ -259,8 +503,22 @@ public class AppCfgService extends CrudService { * @since 1.0.0 */ @Transactional(readOnly=false,rollbackFor=RuntimeException.class) - public int deleteAppCfg(AppIdCfg cfg){ - return appCfgDao.updateValid(cfg); + public int deleteAppCfg(AppIdCfg entity){ + Integer status = appCfgDao.updateValid(entity); + if(status==1){ + List featuresTableList = appCfgDao.getFeaturesTableListByAppCompileId(entity.getCompileId()); + for(AppFeaturesIndex cfg:featuresTableList){ + status = appCfgDao.updateFeaturesTableValid(cfg.getFeaturesTable(), cfg.getFeaturesCompileId(), + entity.getIsValid(), entity.getEditorId(), entity.getEditTime()); + if(status==0){ + return 0; + } + } + return status; + }else{ + return status; + } +// return appCfgDao.updateValid(cfg); } /** * @@ -288,18 +546,18 @@ public class AppCfgService extends CrudService { public AppIdCfg getAppCfgById(AppIdCfg cfg){ cfg = appCfgDao.get(cfg); List featuresTableList = appCfgDao.getFeaturesTableListByAppCompileId(cfg.getCompileId()); - List complexList = new ArrayList(); - List strList = new ArrayList(); + List complexList = new ArrayList(); + List strList = new ArrayList(); if(!StringUtil.isEmpty(featuresTableList)){ for(AppFeaturesIndex features:featuresTableList){ if(features.getFeaturesTableType().equals(4)){//增强字符串特征配置 - List complexFeaturesList = appCfgDao.getComplexkeywordFeaturesCfgListByCompileId( + List complexFeaturesList = appCfgDao.getComplexkeywordFeaturesCfgListByCompileId( features.getFeaturesTable(),features.getFeaturesCompileId()); complexList.addAll(complexFeaturesList); }else if(features.getFeaturesTableType().equals(2)){//普通字符串特征配置 - List strFeaturesCfgList = appCfgDao.getStrFeaturesCfgListByCompileId( + List strFeaturesCfgList = appCfgDao.getStrFeaturesCfgListByCompileId( features.getFeaturesTable(),features.getFeaturesCompileId()); strList.addAll(strFeaturesCfgList); } @@ -313,13 +571,13 @@ public class AppCfgService extends CrudService { public Integer getIsValid(Long cfgId){ return appCfgDao.getIsValid(cfgId); } - /*public Integer getIsValid(String tableName, long id){ + public Integer getIsValid(String tableName, long id){ return appCfgDao.getIsValid(tableName,id); - }*/ + } public Integer getIsAudit(Long cfgId){ return appCfgDao.getIsAudit(cfgId); } - /*public Integer getIsAudit(String tableName, long id){ + public Integer getIsAudit(String tableName, long id){ return appCfgDao.getIsAudit(tableName,id); - }*/ + } } diff --git a/src/main/java/com/nis/web/service/configuration/MultipleCfgService.java b/src/main/java/com/nis/web/service/configuration/MultipleCfgService.java index b0c17840e..5dab64ead 100644 --- a/src/main/java/com/nis/web/service/configuration/MultipleCfgService.java +++ b/src/main/java/com/nis/web/service/configuration/MultipleCfgService.java @@ -158,7 +158,6 @@ public class MultipleCfgService extends CrudService cfgs=new ArrayList(); if(sendCfg.getIpCfg()!=null){ diff --git a/src/main/java/com/nis/web/service/specific/SpecificServiceCfgService.java b/src/main/java/com/nis/web/service/specific/SpecificServiceCfgService.java index 4e94fdd51..1877e9795 100644 --- a/src/main/java/com/nis/web/service/specific/SpecificServiceCfgService.java +++ b/src/main/java/com/nis/web/service/specific/SpecificServiceCfgService.java @@ -10,7 +10,9 @@ import org.springframework.transaction.annotation.Transactional; import com.beust.jcommander.internal.Lists; import com.nis.domain.Page; +import com.nis.domain.specific.ConfigGroupInfo; import com.nis.domain.specific.SpecificServiceCfg; +import com.nis.main.ConvertTool; import com.nis.util.StringUtil; import com.nis.web.dao.specific.SpecificServiceCfgDao; import com.nis.web.service.BaseService; @@ -60,11 +62,22 @@ public class SpecificServiceCfgService extends BaseService{ /** * 保存或修改 * @param specificServiceCfg + * @throws Exception */ @Transactional(readOnly=false,rollbackFor=RuntimeException.class) - public void saveOrUpdate(SpecificServiceCfg specificServiceCfg, Integer oldId) { - if(specificServiceCfg.getGroupId()==null){ - specificServiceCfg.setGroupId(0); + public void saveOrUpdate(SpecificServiceCfg specificServiceCfg, Integer oldId) throws Exception { + if(specificServiceCfg.getGroupId()==null || specificServiceCfg.getGroupId()==0){ + specificServiceCfg.setGroupId(new ConvertTool().getGroupId()); + } + //新增协议分组 + ConfigGroupInfo group = specificServiceCfgDao.getConfigGroupInfoByGroupId(specificServiceCfg.getGroupId()); + if(group==null){ + group = new ConfigGroupInfo(); + group.setGroupId(specificServiceCfg.getGroupId()); + group.setGroupName(specificServiceCfg.getSpecServiceName()); + group.setIsIssued(0); + group.setGroupType(1); + specificServiceCfgDao.insertConfigGroupInfo(group); } if(oldId==null){//新增 specificServiceCfg.setIsValid(1); diff --git a/src/main/webapp/WEB-INF/include/form/basicInfo.jsp b/src/main/webapp/WEB-INF/include/form/basicInfo.jsp index a464d89c9..5531d927f 100644 --- a/src/main/webapp/WEB-INF/include/form/basicInfo.jsp +++ b/src/main/webapp/WEB-INF/include/form/basicInfo.jsp @@ -31,19 +31,13 @@ - + - - - diff --git a/src/main/webapp/WEB-INF/include/form/complexInfo.jsp b/src/main/webapp/WEB-INF/include/form/complexInfo.jsp index ba8b76628..1ccb46e35 100644 --- a/src/main/webapp/WEB-INF/include/form/complexInfo.jsp +++ b/src/main/webapp/WEB-INF/include/form/complexInfo.jsp @@ -87,14 +87,18 @@ - <%-- --%> + + +
diff --git a/src/main/webapp/WEB-INF/include/form/multiple/basicInfo.jsp b/src/main/webapp/WEB-INF/include/form/multiple/basicInfo.jsp index 21a3995d3..6ab3cf775 100644 --- a/src/main/webapp/WEB-INF/include/form/multiple/basicInfo.jsp +++ b/src/main/webapp/WEB-INF/include/form/multiple/basicInfo.jsp @@ -53,25 +53,18 @@
- - + +
-
+ + +
+
+ +
+
+
-
+
@@ -60,7 +93,14 @@
-
+ + +
+
+ +
+
+
@@ -94,11 +134,18 @@
-
+ + +
+
+ +
+
+
-
+
@@ -124,7 +171,14 @@
-
+ + +
+
+ +
+
+
@@ -150,6 +204,14 @@
+ + +
+
+ +
+
+
diff --git a/src/main/webapp/WEB-INF/include/form/multiple/ipInfo.jsp b/src/main/webapp/WEB-INF/include/form/multiple/ipInfo.jsp index abb9069f1..843cf021a 100644 --- a/src/main/webapp/WEB-INF/include/form/multiple/ipInfo.jsp +++ b/src/main/webapp/WEB-INF/include/form/multiple/ipInfo.jsp @@ -1,11 +1,19 @@ <%@ page contentType="text/html;charset=UTF-8"%> <%@ include file="/WEB-INF/include/taglib.jsp"%> -

IP

+

+ + + + + + + + IP + + 可选

@@ -20,7 +28,6 @@
-
@@ -44,7 +51,14 @@
-
+ + +
+
+ +
+
+
@@ -62,7 +76,14 @@
-
+ + +
+
+ +
+
+
@@ -78,6 +99,14 @@
+ + +
+
+ +
+
+
@@ -96,7 +125,14 @@ -
+ + +
+
+ +
+
+
@@ -112,7 +148,14 @@
-
+ + +
+
+ +
+
+
@@ -130,7 +173,14 @@ -
+ + +
+
+ +
+
+
@@ -146,7 +196,14 @@
-
+ + +
+
+ +
+
+
@@ -164,7 +221,14 @@ -
+ + +
+
+ +
+
+
@@ -180,7 +244,14 @@
-
+ + +
+
+ +
+
+
@@ -207,7 +278,14 @@ <%-- --%> -
+ + +
+
+ +
+
+
@@ -233,7 +311,14 @@
-
+ + +
+
+ +
+
+
diff --git a/src/main/webapp/WEB-INF/include/form/multiple/numInfo.jsp b/src/main/webapp/WEB-INF/include/form/multiple/numInfo.jsp index 798105b55..abc3d47e2 100644 --- a/src/main/webapp/WEB-INF/include/form/multiple/numInfo.jsp +++ b/src/main/webapp/WEB-INF/include/form/multiple/numInfo.jsp @@ -1,6 +1,16 @@ <%@ page contentType="text/html;charset=UTF-8"%> <%@ include file="/WEB-INF/include/taglib.jsp"%> -

数值

+

+ + + + + + + + 数值 + +

diff --git a/src/main/webapp/WEB-INF/include/form/multiple/stringInfo.jsp b/src/main/webapp/WEB-INF/include/form/multiple/stringInfo.jsp index 4ef9f0ba7..f6da8b254 100644 --- a/src/main/webapp/WEB-INF/include/form/multiple/stringInfo.jsp +++ b/src/main/webapp/WEB-INF/include/form/multiple/stringInfo.jsp @@ -1,7 +1,17 @@ <%@ page contentType="text/html;charset=UTF-8"%> <%@ include file="/WEB-INF/include/taglib.jsp"%> -

字符串

-
+

+ + + + + + + + 字符串 + +

+
@@ -15,7 +25,6 @@
-
@@ -31,11 +40,18 @@
-
+ + +
+
+ +
+
+
-
+
@@ -66,9 +82,15 @@ -
-
+ + +
+
+ +
+
+
@@ -96,11 +118,18 @@
-
+ + +
+
+ +
+
+
-
+
@@ -124,7 +153,14 @@
-
+ + +
+
+ +
+
+
diff --git a/src/main/webapp/WEB-INF/views/cfg/appCfgForm.jsp b/src/main/webapp/WEB-INF/views/cfg/appCfgForm.jsp index a762ff797..414d181b8 100644 --- a/src/main/webapp/WEB-INF/views/cfg/appCfgForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/appCfgForm.jsp @@ -6,6 +6,45 @@ @@ -189,6 +434,10 @@ $(function(){ <%@include file="/WEB-INF/include/form/multiple/stringInfo.jsp" %> + + + + <%@include file="/WEB-INF/include/form/multiple/ipInfo.jsp" %> diff --git a/src/main/webapp/WEB-INF/views/cfg/multipleCfgList.jsp b/src/main/webapp/WEB-INF/views/cfg/multipleCfgList.jsp index 6ff627a5c..f41d0e001 100644 --- a/src/main/webapp/WEB-INF/views/cfg/multipleCfgList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/multipleCfgList.jsp @@ -72,6 +72,7 @@ + @@ -269,24 +270,24 @@ <%--增强字符串 --%> - 增强字符串 + <%--数值 --%> - + <%--字符串 --%> - 字符串 + <%--IP --%> - ip + ip @@ -304,21 +305,21 @@ <%--遍历子表属性 --%> - 增强字符串 + - + - 字符串 + - ip + ip @@ -524,22 +525,22 @@ -
  • +
  • -
  • -
  • +
  • +
  • -
  • +
  • -
  • -
  • +
  • +
  • diff --git a/src/main/webapp/WEB-INF/views/systemService/form.jsp b/src/main/webapp/WEB-INF/views/systemService/form.jsp index 1bfdc3b0e..1ac306f52 100644 --- a/src/main/webapp/WEB-INF/views/systemService/form.jsp +++ b/src/main/webapp/WEB-INF/views/systemService/form.jsp @@ -159,10 +159,10 @@ $("#addBtn").attr("disabled", false); } else if ($(obj).val() == '3') { if ($(".table-list").length > 1) { - alert(''); - $(obj).val(v); + //alert(''); + //$(obj).val(v); } else if ($(".table-list").length == 1) { - $("#addBtn").attr("disabled", true); + //$("#addBtn").attr("disabled", true); } else if ($(".table-list").length == 0) { $("#addBtn").attr("disabled", false); } @@ -241,7 +241,7 @@ '
    ' ); $("[name=tableType]").selectpicker('refresh'); - if ($("#serviceType").val() == '1' || $("#serviceType").val() == '3') { + if ($("#serviceType").val() == '1') { $("#addBtn").attr("disabled", true); } diff --git a/src/main/webapp/static/global/plugins/jquery-validation/1.14.0/jquery.validate.min.js b/src/main/webapp/static/global/plugins/jquery-validation/1.14.0/jquery.validate.min.js new file mode 100644 index 000000000..643837b90 --- /dev/null +++ b/src/main/webapp/static/global/plugins/jquery-validation/1.14.0/jquery.validate.min.js @@ -0,0 +1,4 @@ +/*! jQuery Validation Plugin - v1.14.0 - 6/30/2015 + * http://jqueryvalidation.org/ + * Copyright (c) 2015 Jörn Zaefferer; Licensed MIT */ +!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a(jQuery)}(function(a){a.extend(a.fn,{validate:function(b){if(!this.length)return void(b&&b.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing."));var c=a.data(this[0],"validator");return c?c:(this.attr("novalidate","novalidate"),c=new a.validator(b,this[0]),a.data(this[0],"validator",c),c.settings.onsubmit&&(this.on("click.validate",":submit",function(b){c.settings.submitHandler&&(c.submitButton=b.target),a(this).hasClass("cancel")&&(c.cancelSubmit=!0),void 0!==a(this).attr("formnovalidate")&&(c.cancelSubmit=!0)}),this.on("submit.validate",function(b){function d(){var d,e;return c.settings.submitHandler?(c.submitButton&&(d=a("").attr("name",c.submitButton.name).val(a(c.submitButton).val()).appendTo(c.currentForm)),e=c.settings.submitHandler.call(c,c.currentForm,b),c.submitButton&&d.remove(),void 0!==e?e:!1):!0}return c.settings.debug&&b.preventDefault(),c.cancelSubmit?(c.cancelSubmit=!1,d()):c.form()?c.pendingRequest?(c.formSubmitted=!0,!1):d():(c.focusInvalid(),!1)})),c)},valid:function(){var b,c,d;return a(this[0]).is("form")?b=this.validate().form():(d=[],b=!0,c=a(this[0].form).validate(),this.each(function(){b=c.element(this)&&b,d=d.concat(c.errorList)}),c.errorList=d),b},rules:function(b,c){var d,e,f,g,h,i,j=this[0];if(b)switch(d=a.data(j.form,"validator").settings,e=d.rules,f=a.validator.staticRules(j),b){case"add":a.extend(f,a.validator.normalizeRule(c)),delete f.messages,e[j.name]=f,c.messages&&(d.messages[j.name]=a.extend(d.messages[j.name],c.messages));break;case"remove":return c?(i={},a.each(c.split(/\s/),function(b,c){i[c]=f[c],delete f[c],"required"===c&&a(j).removeAttr("aria-required")}),i):(delete e[j.name],f)}return g=a.validator.normalizeRules(a.extend({},a.validator.classRules(j),a.validator.attributeRules(j),a.validator.dataRules(j),a.validator.staticRules(j)),j),g.required&&(h=g.required,delete g.required,g=a.extend({required:h},g),a(j).attr("aria-required","true")),g.remote&&(h=g.remote,delete g.remote,g=a.extend(g,{remote:h})),g}}),a.extend(a.expr[":"],{blank:function(b){return!a.trim(""+a(b).val())},filled:function(b){return!!a.trim(""+a(b).val())},unchecked:function(b){return!a(b).prop("checked")}}),a.validator=function(b,c){this.settings=a.extend(!0,{},a.validator.defaults,b),this.currentForm=c,this.init()},a.validator.format=function(b,c){return 1===arguments.length?function(){var c=a.makeArray(arguments);return c.unshift(b),a.validator.format.apply(this,c)}:(arguments.length>2&&c.constructor!==Array&&(c=a.makeArray(arguments).slice(1)),c.constructor!==Array&&(c=[c]),a.each(c,function(a,c){b=b.replace(new RegExp("\\{"+a+"\\}","g"),function(){return c})}),b)},a.extend(a.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusCleanup:!1,focusInvalid:!0,errorContainer:a([]),errorLabelContainer:a([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(a){this.lastActive=a,this.settings.focusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,a,this.settings.errorClass,this.settings.validClass),this.hideThese(this.errorsFor(a)))},onfocusout:function(a){this.checkable(a)||!(a.name in this.submitted)&&this.optional(a)||this.element(a)},onkeyup:function(b,c){var d=[16,17,18,20,35,36,37,38,39,40,45,144,225];9===c.which&&""===this.elementValue(b)||-1!==a.inArray(c.keyCode,d)||(b.name in this.submitted||b===this.lastElement)&&this.element(b)},onclick:function(a){a.name in this.submitted?this.element(a):a.parentNode.name in this.submitted&&this.element(a.parentNode)},highlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).addClass(c).removeClass(d):a(b).addClass(c).removeClass(d)},unhighlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).removeClass(c).addClass(d):a(b).removeClass(c).addClass(d)}},setDefaults:function(b){a.extend(a.validator.defaults,b)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date ( ISO ).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",maxlength:a.validator.format("Please enter no more than {0} characters."),minlength:a.validator.format("Please enter at least {0} characters."),rangelength:a.validator.format("Please enter a value between {0} and {1} characters long."),range:a.validator.format("Please enter a value between {0} and {1}."),max:a.validator.format("Please enter a value less than or equal to {0}."),min:a.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:!1,prototype:{init:function(){function b(b){var c=a.data(this.form,"validator"),d="on"+b.type.replace(/^validate/,""),e=c.settings;e[d]&&!a(this).is(e.ignore)&&e[d].call(c,this,b)}this.labelContainer=a(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||a(this.currentForm),this.containers=a(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var c,d=this.groups={};a.each(this.settings.groups,function(b,c){"string"==typeof c&&(c=c.split(/\s/)),a.each(c,function(a,c){d[c]=b})}),c=this.settings.rules,a.each(c,function(b,d){c[b]=a.validator.normalizeRule(d)}),a(this.currentForm).on("focusin.validate focusout.validate keyup.validate",":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'], [type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], [type='radio'], [type='checkbox']",b).on("click.validate","select, option, [type='radio'], [type='checkbox']",b),this.settings.invalidHandler&&a(this.currentForm).on("invalid-form.validate",this.settings.invalidHandler),a(this.currentForm).find("[required], [data-rule-required], .required").attr("aria-required","true")},form:function(){return this.checkForm(),a.extend(this.submitted,this.errorMap),this.invalid=a.extend({},this.errorMap),this.valid()||a(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var a=0,b=this.currentElements=this.elements();b[a];a++)this.check(b[a]);return this.valid()},element:function(b){var c=this.clean(b),d=this.validationTargetFor(c),e=!0;return this.lastElement=d,void 0===d?delete this.invalid[c.name]:(this.prepareElement(d),this.currentElements=a(d),e=this.check(d)!==!1,e?delete this.invalid[d.name]:this.invalid[d.name]=!0),a(b).attr("aria-invalid",!e),this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),e},showErrors:function(b){if(b){a.extend(this.errorMap,b),this.errorList=[];for(var c in b)this.errorList.push({message:b[c],element:this.findByName(c)[0]});this.successList=a.grep(this.successList,function(a){return!(a.name in b)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){a.fn.resetForm&&a(this.currentForm).resetForm(),this.submitted={},this.lastElement=null,this.prepareForm(),this.hideErrors();var b,c=this.elements().removeData("previousValue").removeAttr("aria-invalid");if(this.settings.unhighlight)for(b=0;c[b];b++)this.settings.unhighlight.call(this,c[b],this.settings.errorClass,"");else c.removeClass(this.settings.errorClass)},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(a){var b,c=0;for(b in a)c++;return c},hideErrors:function(){this.hideThese(this.toHide)},hideThese:function(a){a.not(this.containers).text(""),this.addWrapper(a).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{a(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(b){}},findLastActive:function(){var b=this.lastActive;return b&&1===a.grep(this.errorList,function(a){return a.element.name===b.name}).length&&b},elements:function(){var b=this,c={};return a(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, :disabled").not(this.settings.ignore).filter(function(){return!this.name&&b.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.name in c||!b.objectLength(a(this).rules())?!1:(c[this.name]=!0,!0)})},clean:function(b){return a(b)[0]},errors:function(){var b=this.settings.errorClass.split(" ").join(".");return a(this.settings.errorElement+"."+b,this.errorContext)},reset:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=a([]),this.toHide=a([]),this.currentElements=a([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(a){this.reset(),this.toHide=this.errorsFor(a)},elementValue:function(b){var c,d=a(b),e=b.type;return"radio"===e||"checkbox"===e?this.findByName(b.name).filter(":checked").val():"number"===e&&"undefined"!=typeof b.validity?b.validity.badInput?!1:d.val():(c=d.val(),"string"==typeof c?c.replace(/\r/g,""):c)},check:function(b){b=this.validationTargetFor(this.clean(b));var c,d,e,f=a(b).rules(),g=a.map(f,function(a,b){return b}).length,h=!1,i=this.elementValue(b);for(d in f){e={method:d,parameters:f[d]};try{if(c=a.validator.methods[d].call(this,i,b,e.parameters),"dependency-mismatch"===c&&1===g){h=!0;continue}if(h=!1,"pending"===c)return void(this.toHide=this.toHide.not(this.errorsFor(b)));if(!c)return this.formatAndAdd(b,e),!1}catch(j){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+b.id+", check the '"+e.method+"' method.",j),j instanceof TypeError&&(j.message+=". Exception occurred when checking element "+b.id+", check the '"+e.method+"' method."),j}}if(!h)return this.objectLength(f)&&this.successList.push(b),!0},customDataMessage:function(b,c){return a(b).data("msg"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase())||a(b).data("msg")},customMessage:function(a,b){var c=this.settings.messages[a];return c&&(c.constructor===String?c:c[b])},findDefined:function(){for(var a=0;aWarning: No message defined for "+b.name+"")},formatAndAdd:function(b,c){var d=this.defaultMessage(b,c.method),e=/\$?\{(\d+)\}/g;"function"==typeof d?d=d.call(this,c.parameters,b):e.test(d)&&(d=a.validator.format(d.replace(e,"{$1}"),c.parameters)),this.errorList.push({message:d,element:b,method:c.method}),this.errorMap[b.name]=d,this.submitted[b.name]=d},addWrapper:function(a){return this.settings.wrapper&&(a=a.add(a.parent(this.settings.wrapper))),a},defaultShowErrors:function(){var a,b,c;for(a=0;this.errorList[a];a++)c=this.errorList[a],this.settings.highlight&&this.settings.highlight.call(this,c.element,this.settings.errorClass,this.settings.validClass),this.showLabel(c.element,c.message);if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(a=0;this.successList[a];a++)this.showLabel(this.successList[a]);if(this.settings.unhighlight)for(a=0,b=this.validElements();b[a];a++)this.settings.unhighlight.call(this,b[a],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return a(this.errorList).map(function(){return this.element})},showLabel:function(b,c){var d,e,f,g=this.errorsFor(b),h=this.idOrName(b),i=a(b).attr("aria-describedby");g.length?(g.removeClass(this.settings.validClass).addClass(this.settings.errorClass),g.html(c)):(g=a("<"+this.settings.errorElement+">").attr("id",h+"-error").addClass(this.settings.errorClass).html(c||""),d=g,this.settings.wrapper&&(d=g.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.length?this.labelContainer.append(d):this.settings.errorPlacement?this.settings.errorPlacement(d,a(b)):d.insertAfter(b),g.is("label")?g.attr("for",h):0===g.parents("label[for='"+h+"']").length&&(f=g.attr("id").replace(/(:|\.|\[|\]|\$)/g,"\\$1"),i?i.match(new RegExp("\\b"+f+"\\b"))||(i+=" "+f):i=f,a(b).attr("aria-describedby",i),e=this.groups[b.name],e&&a.each(this.groups,function(b,c){c===e&&a("[name='"+b+"']",this.currentForm).attr("aria-describedby",g.attr("id"))}))),!c&&this.settings.success&&(g.text(""),"string"==typeof this.settings.success?g.addClass(this.settings.success):this.settings.success(g,b)),this.toShow=this.toShow.add(g)},errorsFor:function(b){var c=this.idOrName(b),d=a(b).attr("aria-describedby"),e="label[for='"+c+"'], label[for='"+c+"'] *";return d&&(e=e+", #"+d.replace(/\s+/g,", #")),this.errors().filter(e)},idOrName:function(a){return this.groups[a.name]||(this.checkable(a)?a.name:a.id||a.name)},validationTargetFor:function(b){return this.checkable(b)&&(b=this.findByName(b.name)),a(b).not(this.settings.ignore)[0]},checkable:function(a){return/radio|checkbox/i.test(a.type)},findByName:function(b){return a(this.currentForm).find("[name='"+b+"']")},getLength:function(b,c){switch(c.nodeName.toLowerCase()){case"select":return a("option:selected",c).length;case"input":if(this.checkable(c))return this.findByName(c.name).filter(":checked").length}return b.length},depend:function(a,b){return this.dependTypes[typeof a]?this.dependTypes[typeof a](a,b):!0},dependTypes:{"boolean":function(a){return a},string:function(b,c){return!!a(b,c.form).length},"function":function(a,b){return a(b)}},optional:function(b){var c=this.elementValue(b);return!a.validator.methods.required.call(this,c,b)&&"dependency-mismatch"},startRequest:function(a){this.pending[a.name]||(this.pendingRequest++,this.pending[a.name]=!0)},stopRequest:function(b,c){this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[b.name],c&&0===this.pendingRequest&&this.formSubmitted&&this.form()?(a(this.currentForm).submit(),this.formSubmitted=!1):!c&&0===this.pendingRequest&&this.formSubmitted&&(a(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(b){return a.data(b,"previousValue")||a.data(b,"previousValue",{old:null,valid:!0,message:this.defaultMessage(b,"remote")})},destroy:function(){this.resetForm(),a(this.currentForm).off(".validate").removeData("validator")}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(b,c){b.constructor===String?this.classRuleSettings[b]=c:a.extend(this.classRuleSettings,b)},classRules:function(b){var c={},d=a(b).attr("class");return d&&a.each(d.split(" "),function(){this in a.validator.classRuleSettings&&a.extend(c,a.validator.classRuleSettings[this])}),c},normalizeAttributeRule:function(a,b,c,d){/min|max/.test(c)&&(null===b||/number|range|text/.test(b))&&(d=Number(d),isNaN(d)&&(d=void 0)),d||0===d?a[c]=d:b===c&&"range"!==b&&(a[c]=!0)},attributeRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)"required"===c?(d=b.getAttribute(c),""===d&&(d=!0),d=!!d):d=f.attr(c),this.normalizeAttributeRule(e,g,c,d);return e.maxlength&&/-1|2147483647|524288/.test(e.maxlength)&&delete e.maxlength,e},dataRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)d=f.data("rule"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase()),this.normalizeAttributeRule(e,g,c,d);return e},staticRules:function(b){var c={},d=a.data(b.form,"validator");return d.settings.rules&&(c=a.validator.normalizeRule(d.settings.rules[b.name])||{}),c},normalizeRules:function(b,c){return a.each(b,function(d,e){if(e===!1)return void delete b[d];if(e.param||e.depends){var f=!0;switch(typeof e.depends){case"string":f=!!a(e.depends,c.form).length;break;case"function":f=e.depends.call(c,c)}f?b[d]=void 0!==e.param?e.param:!0:delete b[d]}}),a.each(b,function(d,e){b[d]=a.isFunction(e)?e(c):e}),a.each(["minlength","maxlength"],function(){b[this]&&(b[this]=Number(b[this]))}),a.each(["rangelength","range"],function(){var c;b[this]&&(a.isArray(b[this])?b[this]=[Number(b[this][0]),Number(b[this][1])]:"string"==typeof b[this]&&(c=b[this].replace(/[\[\]]/g,"").split(/[\s,]+/),b[this]=[Number(c[0]),Number(c[1])]))}),a.validator.autoCreateRanges&&(null!=b.min&&null!=b.max&&(b.range=[b.min,b.max],delete b.min,delete b.max),null!=b.minlength&&null!=b.maxlength&&(b.rangelength=[b.minlength,b.maxlength],delete b.minlength,delete b.maxlength)),b},normalizeRule:function(b){if("string"==typeof b){var c={};a.each(b.split(/\s/),function(){c[this]=!0}),b=c}return b},addMethod:function(b,c,d){a.validator.methods[b]=c,a.validator.messages[b]=void 0!==d?d:a.validator.messages[b],c.length<3&&a.validator.addClassRules(b,a.validator.normalizeRule(b))},methods:{required:function(b,c,d){if(!this.depend(d,c))return"dependency-mismatch";if("select"===c.nodeName.toLowerCase()){var e=a(c).val();return e&&e.length>0}return this.checkable(c)?this.getLength(b,c)>0:b.length>0},email:function(a,b){return this.optional(b)||/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(a)},url:function(a,b){return this.optional(b)||/^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})).?)(?::\d{2,5})?(?:[/?#]\S*)?$/i.test(a)},date:function(a,b){return this.optional(b)||!/Invalid|NaN/.test(new Date(a).toString())},dateISO:function(a,b){return this.optional(b)||/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(a)},number:function(a,b){return this.optional(b)||/^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(a)},digits:function(a,b){return this.optional(b)||/^\d+$/.test(a)},creditcard:function(a,b){if(this.optional(b))return"dependency-mismatch";if(/[^0-9 \-]+/.test(a))return!1;var c,d,e=0,f=0,g=!1;if(a=a.replace(/\D/g,""),a.length<13||a.length>19)return!1;for(c=a.length-1;c>=0;c--)d=a.charAt(c),f=parseInt(d,10),g&&(f*=2)>9&&(f-=9),e+=f,g=!g;return e%10===0},minlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e>=d},maxlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||d>=e},rangelength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e>=d[0]&&e<=d[1]},min:function(a,b,c){return this.optional(b)||a>=c},max:function(a,b,c){return this.optional(b)||c>=a},range:function(a,b,c){return this.optional(b)||a>=c[0]&&a<=c[1]},equalTo:function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.off(".validate-equalTo").on("blur.validate-equalTo",function(){a(c).valid()}),b===e.val()},remote:function(b,c,d){if(this.optional(c))return"dependency-mismatch";var e,f,g=this.previousValue(c);return this.settings.messages[c.name]||(this.settings.messages[c.name]={}),g.originalMessage=this.settings.messages[c.name].remote,this.settings.messages[c.name].remote=g.message,d="string"==typeof d&&{url:d}||d,g.old===b?g.valid:(g.old=b,e=this,this.startRequest(c),f={},f[c.name]=b,a.ajax(a.extend(!0,{mode:"abort",port:"validate"+c.name,dataType:"json",data:f,context:e.currentForm,success:function(d){var f,h,i,j=d===!0||"true"===d;e.settings.messages[c.name].remote=g.originalMessage,j?(i=e.formSubmitted,e.prepareElement(c),e.formSubmitted=i,e.successList.push(c),delete e.invalid[c.name],e.showErrors()):(f={},h=d||e.defaultMessage(c,"remote"),f[c.name]=g.message=a.isFunction(h)?h(b):h,e.invalid[c.name]=!0,e.showErrors(f)),g.valid=j,e.stopRequest(c,j)}},d)),"pending")}}});var b,c={};a.ajaxPrefilter?a.ajaxPrefilter(function(a,b,d){var e=a.port;"abort"===a.mode&&(c[e]&&c[e].abort(),c[e]=d)}):(b=a.ajax,a.ajax=function(d){var e=("mode"in d?d:a.ajaxSettings).mode,f=("port"in d?d:a.ajaxSettings).port;return"abort"===e?(c[f]&&c[f].abort(),c[f]=b.apply(this,arguments),c[f]):b.apply(this,arguments)})}); \ No newline at end of file