diff --git a/src/main/java/com/nis/domain/configuration/template/AppPayloadTemplate.java b/src/main/java/com/nis/domain/configuration/template/AppPayloadTemplate.java new file mode 100644 index 000000000..4b1bde10d --- /dev/null +++ b/src/main/java/com/nis/domain/configuration/template/AppPayloadTemplate.java @@ -0,0 +1,113 @@ +package com.nis.domain.configuration.template; + +import com.nis.util.excel.ExcelField; + +/** + * APP Payload 导入模板类 + * @author dell + * + */ +public class AppPayloadTemplate extends ComplexStringAllTemplate{ + + // APP PAYLOAD L3_HEADER的特殊属性 + private String ver; + private String ihl; + private String tos; + private String totalLength; + private String flags; + private String fragmentOffset; + private String protocol; + private String icmpType; + private String icmpCode; + private String icmpIdentifier; + private String headerType; + + @ExcelField(title="headerType",align=2,sort=17) + public String getHeaderType() { + return headerType; + } + public void setHeaderType(String headerType) { + this.headerType = headerType; + } + + @ExcelField(title="VER",align=2,sort=18) + public String getVer() { + return ver; + } + public void setVer(String ver) { + this.ver = ver; + } + + @ExcelField(title="IHL",align=2,sort=19) + public String getIhl() { + return ihl; + } + public void setIhl(String ihl) { + this.ihl = ihl; + } + + @ExcelField(title="TOS",align=2,sort=20) + public String getTos() { + return tos; + } + public void setTos(String tos) { + this.tos = tos; + } + + @ExcelField(title="Total Length",align=2,sort=21) + public String getTotalLength() { + return totalLength; + } + public void setTotalLength(String totalLength) { + this.totalLength = totalLength; + } + + @ExcelField(title="Flags",align=2,sort=22) + public String getFlags() { + return flags; + } + public void setFlags(String flags) { + this.flags = flags; + } + + @ExcelField(title="fragment offset",align=2,sort=23) + public String getFragmentOffset() { + return fragmentOffset; + } + public void setFragmentOffset(String fragmentOffset) { + this.fragmentOffset = fragmentOffset; + } + + @ExcelField(title="Protocol",align=2,sort=24) + public String getProtocol() { + return protocol; + } + public void setProtocol(String protocol) { + this.protocol = protocol; + } + + @ExcelField(title="ICMP type",align=2,sort=25) + public String getIcmpType() { + return icmpType; + } + public void setIcmpType(String icmpType) { + this.icmpType = icmpType; + } + + @ExcelField(title="ICMP code",align=2,sort=26) + public String getIcmpCode() { + return icmpCode; + } + public void setIcmpCode(String icmpCode) { + this.icmpCode = icmpCode; + } + + @ExcelField(title="ICMP identifier",align=2,sort=27) + public String getIcmpIdentifier() { + return icmpIdentifier; + } + public void setIcmpIdentifier(String icmpIdentifier) { + this.icmpIdentifier = icmpIdentifier; + } + +} diff --git a/src/main/java/com/nis/domain/maat/ToUpdateMaatBeanStatus.java b/src/main/java/com/nis/domain/maat/ToUpdateMaatBeanStatus.java new file mode 100644 index 000000000..869d7e249 --- /dev/null +++ b/src/main/java/com/nis/domain/maat/ToUpdateMaatBeanStatus.java @@ -0,0 +1,122 @@ +/** + *@Title: ToMaatBean.java + *@Package com.nis.domain.configuration + *@Description TODO + *@author dell + *@date 2018年2月28日 下午2:03:08 + *@version 版本号 + */ +package com.nis.domain.maat; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +/** + * 修改maat类配置状态 + * @ClassName: ToUpdateStatusMaatBean.java + * @Description: TODO + * @author (dell) + * @date 2019年1月2日 下午3:08:08 + * @version V1.0 + */ +public class ToUpdateMaatBeanStatus implements Serializable{ + + /** + * + */ + private static final long serialVersionUID = -3468862666445104490L; + /** + * @Fields serialVersionUID:TODO(转换为maat格式的java bean) + * + * @since 1.0.0 + */ + @Expose + private String version; + @Expose + @SerializedName("operator") + private String creatorName; + @Expose + @SerializedName("opTime") + private Date auditTime; + @Expose + private Integer opAction; + @Expose + private List configCompileStartStopList; + + public static class UpdateMaatCfgStatus{ + @Expose + private Integer compileId; + @Expose + private Integer isValid; + @Expose + @SerializedName("opTime") + private Date auditTime; + public Integer getCompileId() { + return compileId; + } + public void setCompileId(Integer compileId) { + this.compileId = compileId; + } + public Integer getIsValid() { + return isValid; + } + public void setIsValid(Integer isValid) { + this.isValid = isValid; + } + public Date getAuditTime() { + return auditTime; + } + public void setAuditTime(Date auditTime) { + this.auditTime = auditTime; + } + + } + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getCreatorName() { + return creatorName; + } + + public void setCreatorName(String creatorName) { + this.creatorName = creatorName; + } + + public Date getAuditTime() { + return auditTime; + } + + public void setAuditTime(Date auditTime) { + this.auditTime = auditTime; + } + + public List getConfigCompileStartStopList() { + return configCompileStartStopList; + } + + public void setConfigCompileStartStopList(List configCompileStartStopList) { + this.configCompileStartStopList = configCompileStartStopList; + } + + public Integer getOpAction() { + return opAction; + } + + public void setOpAction(Integer opAction) { + this.opAction = opAction; + } + + public static void main(String[] args) { + + } +} diff --git a/src/main/java/com/nis/util/ConfigServiceUtil.java b/src/main/java/com/nis/util/ConfigServiceUtil.java index c29b8b35f..8779f74ff 100644 --- a/src/main/java/com/nis/util/ConfigServiceUtil.java +++ b/src/main/java/com/nis/util/ConfigServiceUtil.java @@ -814,6 +814,42 @@ public class ConfigServiceUtil { return bean; } + /** + * maat配置停启用 + * @param params + * @return + */ + public static String configStatusUpdate(String params) throws MaatConvertException{ + String result = null; + ToMaatResult bean = null; + Response response=null; + try { + String url = Constants.SERVICE_URL+Constants.CONFIG_START_STOP_UPDATE; + //创建连接 + WebTarget wt = ClientUtil.getWebTarger(url); + logger.info("put url:"+url); + //获取响应结果 + Builder header = wt.request(MediaType.APPLICATION_JSON).header("Content-Type", MediaType.APPLICATION_JSON); + try { + response= header.put(Entity.entity(params, MediaType.APPLICATION_JSON)); + if(response != null) { + result=response.readEntity(String.class); + } + } catch (Exception e) { + throw new MaatConvertException(""); + } + if(response !=null && response.getStatus() == 200){ + JSONObject resObject = JSONObject.fromObject(result); + bean = (ToMaatResult) JSONObject.toBean(resObject,ToMaatResult.class); + }else{ + throw new MaatConvertException(":"+result); + } + } catch (Exception e) { + throw e; + } + + return result; + } public static void main(String[] args) { try { // getId(1,1); diff --git a/src/main/java/com/nis/util/Constants.java b/src/main/java/com/nis/util/Constants.java index a473f80ba..c8a5836d5 100644 --- a/src/main/java/com/nis/util/Constants.java +++ b/src/main/java/com/nis/util/Constants.java @@ -799,4 +799,7 @@ public final class Constants { public static final String NTC_EVENT_MONITOR_OR_BLOCK_Report =Configurations.getStringProperty("ntcEventsMonitorOrBlock",""); public static final String NTC_EVENT_KEYPROTECTION_Report =Configurations.getStringProperty("ntcEventKeyProtection",""); + + //配置启停服务接口方法 + public static final String CONFIG_START_STOP_UPDATE=Configurations.getStringProperty("configStartStop", "configStartStop"); } diff --git a/src/main/java/com/nis/util/SchedulerTaskUtil.java b/src/main/java/com/nis/util/SchedulerTaskUtil.java index e79e9432c..52baa0ca0 100644 --- a/src/main/java/com/nis/util/SchedulerTaskUtil.java +++ b/src/main/java/com/nis/util/SchedulerTaskUtil.java @@ -1,20 +1,36 @@ package com.nis.util; import java.util.ArrayList; +import java.util.Date; import java.util.List; import java.util.Map; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.google.common.collect.Lists; +import com.nis.domain.configuration.AppPolicyCfg; import com.nis.domain.configuration.AvFileSampleCfg; import com.nis.domain.configuration.AvSignSampleCfg; import com.nis.domain.configuration.BaseCfg; import com.nis.domain.configuration.CfgIndexInfo; import com.nis.domain.configuration.DnsIpCfg; import com.nis.domain.configuration.DnsResStrategy; +import com.nis.domain.configuration.FileDigestCfg; import com.nis.domain.configuration.IpPortCfg; import com.nis.domain.configuration.PxyObjKeyring; import com.nis.domain.configuration.PxyObjTrustedCaCert; import com.nis.domain.configuration.PxyObjTrustedCaCrl; +import com.nis.domain.maat.MaatCfg; +import com.nis.domain.maat.ToMaatBean; +import com.nis.domain.maat.ToMaatResult; +import com.nis.domain.maat.ToUpdateMaatBeanStatus; +import com.nis.domain.maat.MaatCfg.DigestCfg; +import com.nis.domain.maat.MaatCfg.GroupCfg; +import com.nis.domain.maat.MaatCfg.IpCfg; +import com.nis.domain.maat.MaatCfg.NumBoundaryCfg; +import com.nis.domain.maat.MaatCfg.StringCfg; +import com.nis.domain.maat.ToUpdateMaatBeanStatus.UpdateMaatCfgStatus; import com.nis.web.dao.configuration.ConfigSynchronizationDao; import com.nis.web.service.BaseService; import com.nis.web.service.SpringContextHolder; @@ -29,6 +45,7 @@ public class SchedulerTaskUtil { //调度任务的配置信息,复用配置同步DAO private static ConfigSynchronizationDao configSynchronizationDao = SpringContextHolder.getBean(ConfigSynchronizationDao.class); + private Logger logger = LoggerFactory.getLogger(getClass()); /** * 根据业务与编译ID查询配置,修改失效或生效状态,并下发至综合服务 @@ -49,141 +66,280 @@ public class SchedulerTaskUtil { String className = service.get("className").toString(); BaseCfg entity = new BaseCfg(); entity.setServiceId(serviceId); - entity.setCompileId(compileId); entity.setTableName(tableName); List list = Lists.newArrayList(); + List callBackCfgList = Lists.newArrayList(); + boolean isUpdateContent = false; + /** + * 根据编译ID查询配置,如果配置当前审核状态为未审核(is_audit=0),并且newIsValid=1需要查询详细的域配置信息,下发配置详细内容, + * 如果已审核(is_audit=1),则只查询配置主表,更新配置状态即可, + * 如果审核取消(is_audit=3)则删除定时任务,表示配置已最终删除,此状态处理原则上在配置修改拦截器中处理 + */ if("1".equals(serviceType)){//maat类配置 - //查询配置 - if("cfg_index_info".equals(tableName)){ - list = configSynchronizationDao.getCfgIndexList(entity); - - }else if("file_digest_cfg".equals(tableName)){ - list = configSynchronizationDao.getFileDigestListByService(entity); - - }else if("app_policy_cfg".equals(tableName)){ - list = configSynchronizationDao.getAppPolicyList(entity); - - }else if("app_feature_index".equals(tableName)){ - list = configSynchronizationDao.getAppFeatureIndexList(entity); - - } - if(newIsValid.equals(1)){//生效 - //调用综合服务配置生效启用接口 - - }else if(newIsValid.equals(0)){//失效 - //调用综合服务配置失效停用接口 - - } - }else if("2".equals(serviceType)){//回调类配置 - List newList = Lists.newArrayList(); - List ids = Lists.newArrayList(); - //查询配置 - if(entity.getServiceId().equals(3)){//ip drop回调类配置用了主表和子表关系 - list = configSynchronizationDao.getCfgIndexList(entity); - if(!StringUtil.isEmpty(list)){ - List compileIds = Lists.newArrayList(); + Date updateTime = new Date(); + //下发并修改配置状态的参数类 + ToUpdateMaatBeanStatus maatStatusBean = new ToUpdateMaatBeanStatus(); + UpdateMaatCfgStatus updateCfg = new UpdateMaatCfgStatus(); + List configCompileStartStopList = new ArrayList(); + maatStatusBean.setVersion(Constants.MAAT_VERSION); + maatStatusBean.setOpAction(Constants.INSERT_ACTION); + maatStatusBean.setAuditTime(updateTime); + maatStatusBean.setCreatorName("TaskScheduler");//任务调度定时修改状态 + + //下发带有配置内容的参数对象 + ToMaatBean maatBean = new ToMaatBean(); + MaatCfg maatCfg = new MaatCfg(); + List configCompileList = new ArrayList(); + List groupRelationList = new ArrayList(); + List ipRegionList = new ArrayList(); + List strRegionList = new ArrayList(); + List numRegionList = new ArrayList(); + List digestRegionList = new ArrayList(); + List areaIpRegionList = new ArrayList(); + +// for(Integer compileId:compileIds){ + entity.setCompileId(compileId); + //查询配置 + if("cfg_index_info".equals(tableName)){ + list = configSynchronizationDao.getCfgIndexList(entity); + List> cfgList = (List>) service.get("cfgList"); for(int i=0;i m:cfgList){ + String regionTableName = m.get("tableName").toString(); + config.setTableName(regionTableName); + configSynchronizationDao.updateCfgStatus(cfg);//修改界面数据库配置状态 + } + } + } } - List subList = configSynchronizationDao.getIpDropList("ip_port_cfg", compileIds); - for(int i=0;i> cfgList = (List>) service.get("cfgList"); for(int i=0;i m:cfgList){ + String regionTableName = m.get("tableName").toString(); + config.setTableName(regionTableName); + configSynchronizationDao.updateCfgStatus(cfg);//修改界面数据库配置状态 + } + } + } } - - }else if(className.equals("AvSignSampleCfg")){//音视频场景配置 - list = configSynchronizationDao.getAvSignCfgList(entity); + + }else if("app_policy_cfg".equals(tableName)){ + list = configSynchronizationDao.getAppPolicyList(entity); + List> cfgList = (List>) service.get("cfgList"); for(int i=0;i(); - list=configSynchronizationDao.getPxyObjTrustedCrlCfgListByCertId(ids); - for(int i=0;i m:cfgList){ + String regionTableName = m.get("tableName").toString(); + config.setTableName(regionTableName); + configSynchronizationDao.updateCfgStatus(cfg);//修改界面数据库配置状态 + } + } + } } - }else if(className.equals("PxyObjTrustedCaCrl")){ - ids=new ArrayList<>(); - //只允许单独下发certId为空或0的crl配置 - list = configSynchronizationDao.getPxyObjTrustedCrlCfgList(entity); - for(int i=0;i compileIdArray = Lists.newArrayList(); + for(int i=0;i{ + private Logger logger=Logger.getLogger(CheckAppFeatureComplexStringFormatThread.class); + private BlockingQueue srcQueue; + private BlockingQueue destQueue; + private Properties prop; + private FunctionServiceDict serviceDict; + private FunctionRegionDict regionDict; + + public CheckAppFeatureComplexStringFormatThread(FunctionServiceDict serviceDict,FunctionRegionDict regionDict,Properties prop,BlockingQueue srcQueue,BlockingQueue destQueue) { + this.serviceDict=serviceDict; + this.regionDict=regionDict; + this.srcQueue=srcQueue; + this.destQueue=destQueue; + this.prop=prop; + + } + @Override + public String call() throws Exception { + List dataList=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE); + StringBuffer msg=new StringBuffer(); + while(!srcQueue.isEmpty()) { + int size=srcQueue.drainTo(dataList,Constants.MAAT_JSON_SEND_SIZE); + if(regionDict.getRegionType().intValue()==3) { + try { + List cfgs=this.checkAppComplexFeatureCfg(msg,dataList); + destQueue.addAll(cfgs); + }catch (Exception e) { + logger.error("checkComplexStringCfg error,",e); + // TODO: handle exception + //msg=e.getMessage(); + //msg.append(e.getMessage()); + //break; + } + } + dataList.clear(); + } + return msg.toString(); + } + public List checkAppComplexFeatureCfg(StringBuffer msg, + List list) throws ServiceException { + logger.warn("start to validate appfeaturecomplexString data..."); + long start=System.currentTimeMillis(); + List stringList = new ArrayList(); + String exprTypeP = regionDict.getConfigExprType(); + if (StringUtils.isBlank(exprTypeP)) { + throw new RuntimeException("Found String region,but exprType is Empty"); + } + String matchMethodP = regionDict.getConfigMatchMethod(); + if (StringUtils.isBlank(matchMethodP)) { + throw new RuntimeException("Found String region,but matchMethod is Empty"); + } + String hexP = regionDict.getConfigHex(); + if (StringUtils.isBlank(hexP)) { + throw new RuntimeException("Found String region,but hex is Empty"); + } + String mulityKeywordsP = regionDict.getConfigMultiKeywords(); + if (StringUtils.isBlank(mulityKeywordsP)) { + throw new RuntimeException("Found String region,but mulityKeywords is Empty"); + } + String dirtrictP = regionDict.getConfigDistrict(); + StringBuffer errTip = new StringBuffer(); + Pattern pattern = Pattern.compile("\t|\r|\n|\b|\f"); + AppMultiFeatureCfgService appMultiFeatureCfgService = SpringContextHolder.getBean(AppMultiFeatureCfgService.class); + for (int i = 0; i < list.size(); i++) { + StringBuffer errInfo = new StringBuffer(); + AppComplexFeatureCfg baseStringCfg = new AppComplexFeatureCfg(); + BeanUtils.copyProperties(list.get(i), baseStringCfg); + // 配置描述、关键字长度限制 + if(baseStringCfg.getCfgDesc().length() > 128) { + errInfo.append(prop.getProperty("config_describe")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("max_length")+":128") + ";"); + } + if(baseStringCfg.getCfgKeywords().length() < 4 || baseStringCfg.getCfgKeywords().length() > 1024){ + errInfo.append(prop.getProperty("key_word")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("min_length")+":4,"+prop.getProperty("max_length")+":1024") + ";"); + } + + if (regionDict.getRegionType().equals(3)) { + String keyword = baseStringCfg.getCfgKeywords(); + String district = baseStringCfg.getDistrict(); + if (StringUtils.isBlank(keyword)) { + errInfo.append( + String.format(prop.getProperty("can_not_null"), prop.getProperty("key_word") + " ") + ";"); + } + if (StringUtils.isNotBlank(dirtrictP)) { + if (StringUtils.isBlank(district)) { + if (dirtrictP.indexOf(",") == -1) { + baseStringCfg.setDistrict(dirtrictP); + } else { + // baseStringCfg.setDistrict(dirtrictP.split(",")[0]); + errInfo.append( + String.format(prop.getProperty("can_not_null"), prop.getProperty("district") + " ") + + ";"); + } + } else if (dirtrictP.indexOf(district) == -1) { + errInfo.append( + String.format(prop.getProperty("is_incorrect"), prop.getProperty("district") + " ") + + ";"); + } else if (dirtrictP.indexOf("others")>-1&&district.equals("others")) { + //不允许自定义匹配区域导入 + errInfo.append(prop.getProperty("district")+" "+ + String.format(prop.getProperty("can_not_be"), " 'others'")+ ";"); + } + } + if (mulityKeywordsP.equals("0")) { + if (keyword.indexOf("\n") > -1) { + errInfo.append( + String.format(prop.getProperty("not_multiple"), prop.getProperty("key_word")) + ";"); + } + Matcher m = pattern.matcher(keyword); + if (m.find()) { + errInfo.append(String.format(prop.getProperty("has_invisible_char"), + prop.getProperty("key_word") + " '" + keyword + "'") + ";"); + } + } else { + boolean has = false; + Set keywordSet=Sets.newHashSet(); + + for (String key : keyword.split("\n")) { + Matcher m = pattern.matcher(key); + if (m.find()) { + has = true; + errInfo.append(String.format(prop.getProperty("has_invisible_char"), + prop.getProperty("key_word") + " '" + key + "'") + ";"); + break; + } + if(!keywordSet.contains(key)) { + keywordSet.add(key); + }else { + errInfo.append(prop.getProperty("key_word") + " '" + key + "'"+" "+prop.getProperty("repeat") + ";"); + } + } + if (!has) { + if(keyword.replaceAll("\n","").length()>1024) { + errInfo.append(String.format(prop.getProperty("most_keywords"), + prop.getProperty("key_word")) + ";"); + }else { + String reWord = keyword.replaceAll("\n", Constants.KEYWORD_EXPR); + baseStringCfg.setCfgKeywords(reWord); + } + } + } + Integer exprType = baseStringCfg.getExprType(); + boolean has = false; + if (exprType == null) { + if (exprTypeP.indexOf(",") == -1) { + if (mulityKeywordsP.equals("0") && exprTypeP.equals("1")) { + throw new RuntimeException("region dict config error,dict id is " + regionDict.getDictId()); + } + baseStringCfg.setExprType(Integer.parseInt(exprTypeP)); + } else if (exprTypeP.indexOf("0") > -1 && mulityKeywordsP.equals("0")) { + baseStringCfg.setExprType(0); + } else if (exprTypeP.indexOf("1") > -1 && mulityKeywordsP.equals("1") + && keyword.indexOf("\n") > -1) { + baseStringCfg.setExprType(1); + } else if (exprTypeP.indexOf("0") > -1 && mulityKeywordsP.equals("1") + && keyword.indexOf("\n") == -1) { + baseStringCfg.setExprType(0); + } else { + baseStringCfg.setExprType(Integer.parseInt(exprTypeP.split(",")[0])); + } + // errInfo.append(String.format(prop.getProperty("can_not_null"), + // prop.getProperty("expression_type"))+";"); + } else { + for (String exp : exprTypeP.split(",")) { + if (exp.equals(exprType.toString())) { + has = true; + break; + } + } + if (!has) { + errInfo.append( + String.format(prop.getProperty("is_incorrect"), prop.getProperty("expression_type")) + + ";"); + } + has = false; + } + exprType = baseStringCfg.getExprType(); + Integer matchMethod = baseStringCfg.getMatchMethod(); + if (matchMethod == null) { + if (matchMethodP.indexOf(",") == -1) { + if (exprTypeP.equals("1") && !matchMethodP.equals("0")) { + throw new RuntimeException("region dict config error,dict id is " + regionDict.getDictId()); + } + baseStringCfg.setMatchMethod(Integer.parseInt(matchMethodP)); + } else if (exprType != null && exprType.intValue() == 1) { + if (matchMethodP.indexOf("0") > -1) { + baseStringCfg.setMatchMethod(0); + } else { + throw new RuntimeException("region dict config error,dict id is " + regionDict.getDictId()); + } + + } else { + baseStringCfg.setMatchMethod(Integer.parseInt(matchMethodP.split(",")[0])); + } + // errInfo.append(String.format(prop.getProperty("can_not_null"), + // prop.getProperty("match_method"))+";"); + } else { + for (String exp : matchMethodP.split(",")) { + if (exp.equals(matchMethod.toString())) { + has = true; + break; + } + } + if (!has) { + errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("match_method")) + + ";"); + } + } + Integer isHex = baseStringCfg.getIsHex(); + Integer isCaseInsenstive = baseStringCfg.getIsCaseInsenstive(); + if (isHex == null || isCaseInsenstive == null) { + if (isHex == null) { + if (hexP.indexOf("0")>-1 || hexP.indexOf("2")>-1) { + baseStringCfg.setIsHex(0); + } else if (hexP.indexOf("1")>-1) { + baseStringCfg.setIsHex(1); + } else { + errInfo.append( + String.format(prop.getProperty("can_not_null"), prop.getProperty("is_hex")) + ";"); + } + } + if (isCaseInsenstive == null) { + if (hexP.indexOf("0")>-1 || hexP.indexOf("1")>-1) { + baseStringCfg.setIsCaseInsenstive(0); + } else if (hexP.indexOf("2")>-1) { + baseStringCfg.setIsCaseInsenstive(1); + } else { + errInfo.append(String.format(prop.getProperty("can_not_null"), + prop.getProperty("is_case_insenstive")) + ";"); + } + } + } else { + if (isHex.intValue() != 0 && isHex.intValue() != 1) { + errInfo.append( + String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex")) + ";"); + } + if (isCaseInsenstive.intValue() != 0 && isCaseInsenstive.intValue() != 1) { + errInfo.append( + String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive")) + + ";"); + } + if (hexP.indexOf("1") == -1 && isHex.intValue() == 1) { + errInfo.append( + String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex")) + ";"); + } + if (hexP.equals("1") && isHex.intValue() == 0) { + errInfo.append( + String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex")) + ";"); + } + if (hexP.indexOf("2") == -1 && isCaseInsenstive.intValue() == 1) { + errInfo.append( + String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive")) + + ";"); + } + if (hexP.equals("2") && isCaseInsenstive.intValue() == 0) { + errInfo.append( + String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive")) + + ";"); + } + // 关键字十六进制校验 + if (hexP.indexOf("1") != -1 && isHex.intValue() == 1) { + boolean bl = Pattern.compile("^([0-9|a-f|A-F]*)$").matcher(keyword).matches(); + if(!bl) { + errInfo.append( + prop.getProperty("key_word") + " '" + keyword + "' "+String.format(prop.getProperty("contains_non_hex_char")) + ";"); + } + } + } + isHex = baseStringCfg.getIsHex(); + isCaseInsenstive = baseStringCfg.getIsCaseInsenstive(); + if (isHex != null && isCaseInsenstive != null) { + if (isHex.intValue() == 0 && isCaseInsenstive.intValue() == 0) { + baseStringCfg.setIsHexbin(0); + } else if (isHex.intValue() == 1 && isCaseInsenstive.intValue() == 0) { + baseStringCfg.setIsHexbin(1); + } else if (isHex.intValue() == 0 && isCaseInsenstive.intValue() == 1) { + baseStringCfg.setIsHexbin(2); + } else if (hexP.indexOf("1") != -1 && isHex.intValue() == 1 && isCaseInsenstive.intValue() == 1) {// 只有是十六进制且取值正确的时候, 才进行(十六进制)与(大小写敏感)的校验 + errInfo.append(prop.getProperty("hex_case_insensitive")+ ";"); + } + } + + // APP Payload L3_HEADER的特殊属性限制 + if(baseStringCfg.getDistrict().equals("L3_header")) { + String headerType = baseStringCfg.getHeaderType(); + if(StringUtils.isBlank(headerType)) { + errInfo.append( + String.format(prop.getProperty("can_not_null"), "headerType") + ";"); + }else if((!"IP_header".equals(headerType)) && (!"ICMP_header".equals(headerType))) { + errInfo.append( + String.format(prop.getProperty("is_incorrect"), "headerType") + ";"); + }else{ + appMultiFeatureCfgService.checkImportAppPayload(baseStringCfg, errInfo, prop); + } + appMultiFeatureCfgService.setL3HeaderKeyword(baseStringCfg); + }else { + baseStringCfg.setHeaderType(null); + baseStringCfg.setVer(null); + baseStringCfg.setIhl(null); + baseStringCfg.setTos(null); + baseStringCfg.setTotalLength(null); + baseStringCfg.setFlags(null); + baseStringCfg.setFragmentOffset(null); + baseStringCfg.setProtocol(null); + baseStringCfg.setIcmpType(null); + baseStringCfg.setIcmpCode(null); + baseStringCfg.setIcmpIdentifier(null); + } + } + if (errInfo.toString().length() > 0) { + errTip.append(String.format(prop.getProperty("line"), baseStringCfg.getIndex()) + ","); + errTip.append(errInfo); + errTip.append("
"); + }else { + stringList.add(baseStringCfg); + } + } + if (errTip.toString().length() > 0) { + msg.append(errTip); + //throw new ServiceException(errTip.toString()); + } + long end=System.currentTimeMillis(); + logger.warn("validate appfeaturecomplexString data finish,cost:"+(end-start)); + return stringList; + } +} diff --git a/src/main/java/com/nis/web/controller/BaseController.java b/src/main/java/com/nis/web/controller/BaseController.java index 2b6984f04..9a60e7d2c 100644 --- a/src/main/java/com/nis/web/controller/BaseController.java +++ b/src/main/java/com/nis/web/controller/BaseController.java @@ -47,6 +47,7 @@ import com.nis.domain.SysDataDictionaryItem; import com.nis.domain.basics.AsnIpCfg; import com.nis.domain.basics.ServiceDictInfo; import com.nis.domain.basics.SysDictInfo; +import com.nis.domain.configuration.AppComplexFeatureCfg; import com.nis.domain.configuration.AppDomainCfg; import com.nis.domain.configuration.AppFeatureIndex; import com.nis.domain.configuration.AppHttpCfg; @@ -75,6 +76,7 @@ import com.nis.domain.configuration.PxyObjTrustedCaCrl; import com.nis.domain.configuration.RequestInfo; import com.nis.domain.configuration.StringCfgTemplate; import com.nis.domain.configuration.template.AppDomainTemplate; +import com.nis.domain.configuration.template.AppPayloadTemplate; import com.nis.domain.configuration.template.AsnIpTemplate; import com.nis.domain.configuration.template.ComplexStringAllTemplate; import com.nis.domain.configuration.template.DdosIpTemplate; @@ -127,6 +129,7 @@ import com.nis.util.StringUtil; import com.nis.util.excel.ExcelCsv; import com.nis.util.excel.ExportExcel; import com.nis.util.excel.ImportBigExcel; +import com.nis.util.excel.thread.CheckAppFeatureComplexStringFormatThread; import com.nis.util.excel.thread.CheckComplexStringFormatThread; import com.nis.util.excel.thread.CheckDnsResStrategyFormatThread; import com.nis.util.excel.thread.CheckIpFormatThread; @@ -1093,6 +1096,48 @@ public class BaseController { return queue; } + /** + * 多线程验证 + * @param _msg + * @param serviceDict + * @param regionDict + * @param list + * @return + * @throws InterruptedException + * @throws ExecutionException + * @throws ServiceException + */ + public BlockingQueue checkAppComplexFeatureStringCfgMulity(StringBuffer _msg,FunctionServiceDict serviceDict, FunctionRegionDict regionDict,BlockingQueue list) throws InterruptedException, ExecutionException, ServiceException{ + logger.warn("start checkAppComplexFeatureStringCfgMulity ,size "+list.size()); + long start=System.currentTimeMillis(); + BlockingQueue queue=new ArrayBlockingQueue<>(list.size()); + ExecutorService service=Executors.newFixedThreadPool(Constants.MULITY_THREAD_SIZE); + List> futures=new ArrayList<>(); + for(int i=0;i future:futures) { + String msg = future.get(); + if(StringUtils.isNotBlank(msg)) { + _msg.append(msg); + //throw new ServiceException(msg); + } + } + long end=System.currentTimeMillis(); + logger.warn("checkAppComplexFeatureStringCfgMulity finish,cost:"+(end-start)+",size:"+queue.size()); + return queue; + } + /** * * setReportSearchTime(报表查询设置开始时间与结束时间) (这里描述这个方法适用条件 – 可选) @@ -1229,6 +1274,7 @@ public class BaseController { BlockingQueue> stringCfgs =null; BlockingQueue complexkeywordCfgs =null; BlockingQueue dnsResStrategies=null; + BlockingQueue appComplexFeatureCfgs=null; List cfgIndexInfos = new ArrayList(); List appPolicyCfgs = new ArrayList(); List appFeatureIndexs= new ArrayList(); @@ -1361,6 +1407,9 @@ public class BaseController { } else if(regionDict.getFunctionId().equals(209)){// HTTP(s)替换 BlockingQueue list = ei.getDataList(HttpsReplaceComplexTemplate.class); complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list); + } else if(regionDict.getFunctionId().equals(563)){// APP Payload + BlockingQueue list = ei.getDataList(AppPayloadTemplate.class); + appComplexFeatureCfgs = this.checkAppComplexFeatureStringCfgMulity(errTip,serviceDict, regionDict, list); } else { BlockingQueue list = ei.getDataList(ComplexStringAllTemplate.class ); @@ -1673,7 +1722,7 @@ public class BaseController { } if(regionDict.getFunctionId().intValue()==565 || regionDict.getFunctionId().intValue()==566 || regionDict.getFunctionId().intValue()==563){ AppFeatureIndex appfeature = new AppFeatureIndex(); - if(appFeatureRegion!=null){ + if(regionDict!=null){ appfeature.setCfgRegionCode1(String.valueOf(regionDict.getConfigRegionCode())); appfeature.setCfgRegionValue(regionDict.getConfigRegionValue()); appfeature.setCfgRegionType(String.valueOf(regionDict.getRegionType())); @@ -1816,114 +1865,199 @@ public class BaseController { _stringCfgs.clear(); } } else if (regionDict.getRegionType().equals(3)) { - List _complexkeywordCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE); - while(!complexkeywordCfgs.isEmpty()) { - complexkeywordCfgs.drainTo(_complexkeywordCfgs, Constants.MAAT_JSON_SEND_SIZE); - List compileIds=Lists.newArrayList(); - List groupIds=Lists.newArrayList(); - List regionIds=Lists.newArrayList(); - try { - compileIds = ConfigServiceUtil.getId(1,_complexkeywordCfgs.size()); - if(isSend.equals("1")) { - groupIds = ConfigServiceUtil.getId(2,_complexkeywordCfgs.size()); - regionIds = ConfigServiceUtil.getId(3,_complexkeywordCfgs.size()); - } - } catch (Exception e) { - e.printStackTrace(); - logger.info("获取编译ID出错"); - throw new MaatConvertException(":"+e.getMessage()); - } - int ind=0; - for (ComplexkeywordCfg cfg : _complexkeywordCfgs) { - cfg.setAction(serviceDict.getAction()); - /*cfg.setAuditorId(UserUtils.getUser().getId()); + if(!regionDict.getFunctionId().equals(563)) { + List _complexkeywordCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE); + while(!complexkeywordCfgs.isEmpty()) { + complexkeywordCfgs.drainTo(_complexkeywordCfgs, Constants.MAAT_JSON_SEND_SIZE); + List compileIds=Lists.newArrayList(); + List groupIds=Lists.newArrayList(); + List regionIds=Lists.newArrayList(); + try { + compileIds = ConfigServiceUtil.getId(1,_complexkeywordCfgs.size()); + if(isSend.equals("1")) { + groupIds = ConfigServiceUtil.getId(2,_complexkeywordCfgs.size()); + regionIds = ConfigServiceUtil.getId(3,_complexkeywordCfgs.size()); + } + } catch (Exception e) { + e.printStackTrace(); + logger.info("获取编译ID出错"); + throw new MaatConvertException(":"+e.getMessage()); + } + int ind=0; + for (ComplexkeywordCfg cfg : _complexkeywordCfgs) { + cfg.setAction(serviceDict.getAction()); + /*cfg.setAuditorId(UserUtils.getUser().getId()); cfg.setAuditTime(date);*/ - cfg.setCfgRegionCode(regionDict.getConfigRegionCode()); - cfg.setCfgType(regionDict.getConfigRegionValue()); - cfg.setCreateTime(date); - cfg.setCreatorId(UserUtils.getUser().getId()); - cfg.setDoLog(2); - cfg.setFunctionId(regionDict.getFunctionId()); - if(isSend.equals("1")) { - cfg.setIsAudit(Constants.AUDIT_YES); - cfg.setIsValid(Constants.VALID_YES); - cfg.setAuditorId(UserUtils.getUser().getId()); - cfg.setAuditTime(date); - if(groupIds!=null&&groupIds.size()==_complexkeywordCfgs.size()) { - cfg.setGroupId(groupIds.get(ind)); - } - if(regionIds!=null&®ionIds.size()==_complexkeywordCfgs.size()) { - cfg.setRegionId(regionIds.get(ind)); - } - }else { - cfg.setIsAudit(Constants.AUDIT_NOT_YET); - cfg.setIsValid(Constants.VALID_NO); - } - //cfg.setIsAudit(0); - //cfg.setIsValid(0); - cfg.setIsAreaEffective(0); - cfg.setLable("0"); - cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId); - cfg.setAttribute(attribute); - cfg.setClassify(classify); - cfg.setServiceId(serviceDict.getServiceId()); - if(compileIds!=null&&compileIds.size()==_complexkeywordCfgs.size()) { - cfg.setCompileId(compileIds.get(ind)); - } - if(specificServiceCfg!=null) { - cfg.setAppCode(specificServiceCfg.getSpecServiceCode()); - cfg.setSpecServiceId(specificServiceCfg.getSpecServiceId()); - if(StringUtils.isNotBlank(behaviorId)) - cfg.setBehavCode(Integer.parseInt(behaviorId)); - } - if (serviceDict.getServiceId().intValue() == 33 - || serviceDict.getServiceId().intValue() == 145 - || serviceDict.getServiceId().intValue() == 35 - || serviceDict.getServiceId().intValue() == 147 - || serviceDict.getServiceId().intValue() == 36 - || serviceDict.getServiceId().intValue() == 148) { - if (appRegion != null) { - AppPolicyCfg appPolicyCfg = new AppPolicyCfg(); - BeanUtils.copyProperties(cfg, appPolicyCfg,new String[] {"cfgId"}); - //appPolicyCfg.setSpecServiceId(specificServiceCfg.getSpecServiceId()); - //appPolicyCfg.setAppCode(specificServiceCfg.getSpecServiceCode()); - appPolicyCfg.setMatchMethod(0); - appPolicyCfg.setIsHexbin(0); - appPolicyCfg.setCfgType(appRegion.getConfigRegionValue()); - appPolicyCfg.setCfgRegionCode(appRegion.getConfigRegionCode()); - if (StringUtils.isNotBlank(behaviorId)) { - //appPolicyCfg.setBehavCode(Integer.parseInt(behaviorId)); - appPolicyCfg.setExprType(1); - } else { - appPolicyCfg.setExprType(0); + cfg.setCfgRegionCode(regionDict.getConfigRegionCode()); + cfg.setCfgType(regionDict.getConfigRegionValue()); + cfg.setCreateTime(date); + cfg.setCreatorId(UserUtils.getUser().getId()); + cfg.setDoLog(2); + cfg.setFunctionId(regionDict.getFunctionId()); + if(isSend.equals("1")) { + cfg.setIsAudit(Constants.AUDIT_YES); + cfg.setIsValid(Constants.VALID_YES); + cfg.setAuditorId(UserUtils.getUser().getId()); + cfg.setAuditTime(date); + if(groupIds!=null&&groupIds.size()==_complexkeywordCfgs.size()) { + cfg.setGroupId(groupIds.get(ind)); } - appPolicyCfgs.add(appPolicyCfg); - } - } else { - if(!regionDict.getFunctionId().equals(402) && !regionDict.getFunctionId().equals(565) - && !regionDict.getFunctionId().equals(566) && !regionDict.getFunctionId().equals(564)) { - CfgIndexInfo cfgIndexInfo = new CfgIndexInfo(); - BeanUtils.copyProperties(cfg, cfgIndexInfo,new String[] {"cfgId"}); - cfgIndexInfos.add(cfgIndexInfo); - } - if(regionDict.getFunctionId().intValue()==565 || regionDict.getFunctionId().intValue()==566 - || regionDict.getFunctionId().intValue()==564){ - AppFeatureIndex appfeature = new AppFeatureIndex(); - BeanUtils.copyProperties(cfg, appfeature,new String[] {"cfgId"}); - if(appFeatureRegion!=null){ - appfeature.setCfgRegionCode1(String.valueOf(appFeatureRegion.getConfigRegionCode())); - appfeature.setCfgRegionValue(appFeatureRegion.getConfigRegionValue()); - appfeature.setCfgRegionType(String.valueOf(appFeatureRegion.getRegionType())); + if(regionIds!=null&®ionIds.size()==_complexkeywordCfgs.size()) { + cfg.setRegionId(regionIds.get(ind)); } - appFeatureIndexs.add(appfeature); + }else { + cfg.setIsAudit(Constants.AUDIT_NOT_YET); + cfg.setIsValid(Constants.VALID_NO); } + //cfg.setIsAudit(0); + //cfg.setIsValid(0); + cfg.setIsAreaEffective(0); + cfg.setLable("0"); + cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId); + cfg.setAttribute(attribute); + cfg.setClassify(classify); + cfg.setServiceId(serviceDict.getServiceId()); + if(compileIds!=null&&compileIds.size()==_complexkeywordCfgs.size()) { + cfg.setCompileId(compileIds.get(ind)); + } + if(specificServiceCfg!=null) { + cfg.setAppCode(specificServiceCfg.getSpecServiceCode()); + cfg.setSpecServiceId(specificServiceCfg.getSpecServiceId()); + if(StringUtils.isNotBlank(behaviorId)) + cfg.setBehavCode(Integer.parseInt(behaviorId)); + } + if (serviceDict.getServiceId().intValue() == 33 + || serviceDict.getServiceId().intValue() == 145 + || serviceDict.getServiceId().intValue() == 35 + || serviceDict.getServiceId().intValue() == 147 + || serviceDict.getServiceId().intValue() == 36 + || serviceDict.getServiceId().intValue() == 148) { + if (appRegion != null) { + AppPolicyCfg appPolicyCfg = new AppPolicyCfg(); + BeanUtils.copyProperties(cfg, appPolicyCfg,new String[] {"cfgId"}); + //appPolicyCfg.setSpecServiceId(specificServiceCfg.getSpecServiceId()); + //appPolicyCfg.setAppCode(specificServiceCfg.getSpecServiceCode()); + appPolicyCfg.setMatchMethod(0); + appPolicyCfg.setIsHexbin(0); + appPolicyCfg.setCfgType(appRegion.getConfigRegionValue()); + appPolicyCfg.setCfgRegionCode(appRegion.getConfigRegionCode()); + if (StringUtils.isNotBlank(behaviorId)) { + //appPolicyCfg.setBehavCode(Integer.parseInt(behaviorId)); + appPolicyCfg.setExprType(1); + } else { + appPolicyCfg.setExprType(0); + } + appPolicyCfgs.add(appPolicyCfg); + } + } else { + if(!regionDict.getFunctionId().equals(402) && !regionDict.getFunctionId().equals(565) + && !regionDict.getFunctionId().equals(566) && !regionDict.getFunctionId().equals(564)) { + CfgIndexInfo cfgIndexInfo = new CfgIndexInfo(); + BeanUtils.copyProperties(cfg, cfgIndexInfo,new String[] {"cfgId"}); + cfgIndexInfos.add(cfgIndexInfo); + } + if(regionDict.getFunctionId().intValue()==565 || regionDict.getFunctionId().intValue()==566 + || regionDict.getFunctionId().intValue()==564){ + AppFeatureIndex appfeature = new AppFeatureIndex(); + BeanUtils.copyProperties(cfg, appfeature,new String[] {"cfgId"}); + if(regionDict!=null){ + appfeature.setCfgRegionCode1(String.valueOf(regionDict.getConfigRegionCode())); + appfeature.setCfgRegionValue(regionDict.getConfigRegionValue()); + appfeature.setCfgRegionType(String.valueOf(regionDict.getRegionType())); + } + appFeatureIndexs.add(appfeature); + } + } + ind++; } - ind++; + ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, _complexkeywordCfgs, cfgIndexInfos, appPolicyCfgs,appFeatureIndexs,isSend.equals("1")); + cfgIndexInfos.clear(); + appPolicyCfgs.clear(); + _complexkeywordCfgs.clear(); + appFeatureIndexs.clear(); + } + + }else { + // APP Payload处理 + List _complexkeywordCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE); + while(!appComplexFeatureCfgs.isEmpty()) { + appComplexFeatureCfgs.drainTo(_complexkeywordCfgs, Constants.MAAT_JSON_SEND_SIZE); + List compileIds=Lists.newArrayList(); + List groupIds=Lists.newArrayList(); + List regionIds=Lists.newArrayList(); + try { + compileIds = ConfigServiceUtil.getId(1,_complexkeywordCfgs.size()); + if(isSend.equals("1")) { + groupIds = ConfigServiceUtil.getId(2,_complexkeywordCfgs.size()); + regionIds = ConfigServiceUtil.getId(3,_complexkeywordCfgs.size()); + } + } catch (Exception e) { + e.printStackTrace(); + logger.info("获取编译ID出错"); + throw new MaatConvertException(":"+e.getMessage()); + } + int ind=0; + for (AppComplexFeatureCfg cfg : _complexkeywordCfgs) { + cfg.setAction(serviceDict.getAction()); + /*cfg.setAuditorId(UserUtils.getUser().getId()); + cfg.setAuditTime(date);*/ + cfg.setCfgRegionCode(regionDict.getConfigRegionCode()); + cfg.setCfgType(regionDict.getConfigRegionValue()); + cfg.setCreateTime(date); + cfg.setCreatorId(UserUtils.getUser().getId()); + cfg.setDoLog(2); + cfg.setFunctionId(regionDict.getFunctionId()); + if(isSend.equals("1")) { + cfg.setIsAudit(Constants.AUDIT_YES); + cfg.setIsValid(Constants.VALID_YES); + cfg.setAuditorId(UserUtils.getUser().getId()); + cfg.setAuditTime(date); + if(groupIds!=null&&groupIds.size()==_complexkeywordCfgs.size()) { + cfg.setGroupId(groupIds.get(ind)); + } + if(regionIds!=null&®ionIds.size()==_complexkeywordCfgs.size()) { + cfg.setRegionId(regionIds.get(ind)); + } + }else { + cfg.setIsAudit(Constants.AUDIT_NOT_YET); + cfg.setIsValid(Constants.VALID_NO); + } + //cfg.setIsAudit(0); + //cfg.setIsValid(0); + cfg.setIsAreaEffective(0); + cfg.setLable("0"); + cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId); + cfg.setAttribute(attribute); + cfg.setClassify(classify); + cfg.setServiceId(serviceDict.getServiceId()); + if(compileIds!=null&&compileIds.size()==_complexkeywordCfgs.size()) { + cfg.setCompileId(compileIds.get(ind)); + } + if(specificServiceCfg!=null) { + cfg.setAppCode(specificServiceCfg.getSpecServiceCode()); + cfg.setSpecServiceId(specificServiceCfg.getSpecServiceId()); + if(StringUtils.isNotBlank(behaviorId)) + cfg.setBehavCode(Integer.parseInt(behaviorId)); + } + + + AppFeatureIndex appfeature = new AppFeatureIndex(); + BeanUtils.copyProperties(cfg, appfeature,new String[] {"cfgId"}); + if(regionDict!=null){ + appfeature.setCfgRegionCode1(String.valueOf(regionDict.getConfigRegionCode())); + appfeature.setCfgRegionValue(regionDict.getConfigRegionValue()); + appfeature.setCfgRegionType(String.valueOf(regionDict.getRegionType())); + } + appFeatureIndexs.add(appfeature); + + ind++; + } + ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, _complexkeywordCfgs, cfgIndexInfos, appPolicyCfgs,appFeatureIndexs,isSend.equals("1")); + cfgIndexInfos.clear(); + appPolicyCfgs.clear(); + _complexkeywordCfgs.clear(); + appFeatureIndexs.clear(); } - ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, _complexkeywordCfgs, cfgIndexInfos, appPolicyCfgs,appFeatureIndexs,isSend.equals("1")); - cfgIndexInfos.clear(); - appPolicyCfgs.clear(); - _complexkeywordCfgs.clear(); } }else if(regionDict.getRegionType().equals(6)) { if(regionDict.getFunctionId().equals(400)) { @@ -2061,6 +2195,8 @@ public class BaseController { ei.loadInitParams(HttpsRedirectComplexTemplate.class, this.getMsgProp(), regionDict, serviceDict); }else if(regionDict.getFunctionId().equals(209)){// HTTP(s)替换 ei.loadInitParams(HttpsReplaceComplexTemplate.class, this.getMsgProp(), regionDict, serviceDict); + }else if(regionDict.getFunctionId().equals(563)) {// APP Payload + ei.loadInitParams(AppPayloadTemplate.class, this.getMsgProp(), regionDict, serviceDict); } else { ei.loadInitParams(ComplexStringAllTemplate.class, msgProp, regionDict, serviceDict); } diff --git a/src/main/java/com/nis/web/controller/configuration/ntc/IpController.java b/src/main/java/com/nis/web/controller/configuration/ntc/IpController.java index 79daef1d3..801831700 100644 --- a/src/main/java/com/nis/web/controller/configuration/ntc/IpController.java +++ b/src/main/java/com/nis/web/controller/configuration/ntc/IpController.java @@ -30,6 +30,7 @@ import com.nis.domain.configuration.CfgIndexInfo; import com.nis.domain.configuration.IpPortCfg; import com.nis.domain.configuration.NtcSubscribeIdCfg; import com.nis.domain.configuration.template.AppDomainTemplate; +import com.nis.domain.configuration.template.AppPayloadTemplate; import com.nis.domain.configuration.template.AsnIpTemplate; import com.nis.domain.configuration.template.ComplexStringAllTemplate; import com.nis.domain.configuration.template.DdosIpTemplate; @@ -460,6 +461,11 @@ public class IpController extends BaseController{ ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsReplaceComplexTemplate.class, 2); excel.setDataList(this.getMsgProp(),classList,null). write(request,response, fileName).dispose(); + }else if(regionDict.getFunctionId().equals(563)) {// APP Payload + List classList=new ArrayList(); + ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, AppPayloadTemplate.class, 2); + excel.setDataList(this.getMsgProp(),classList,null). + write(request,response, fileName).dispose(); }else{ List classList=new ArrayList(); ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, ComplexStringAllTemplate.class, 2); diff --git a/src/main/java/com/nis/web/controller/dashboard/TrafficStatisticsReportController.java b/src/main/java/com/nis/web/controller/dashboard/TrafficStatisticsReportController.java index 2ea116e9f..affcc53fd 100644 --- a/src/main/java/com/nis/web/controller/dashboard/TrafficStatisticsReportController.java +++ b/src/main/java/com/nis/web/controller/dashboard/TrafficStatisticsReportController.java @@ -70,7 +70,7 @@ public class TrafficStatisticsReportController extends BaseController { if ("3".endsWith(searchBusinessType)) { model.addAttribute("searchBusinessType", 3);// IP查询 } - String url = Configurations.getStringProperty("dashboardUrlV2","dashboardUrlV2") + Constants.NTC_RADIUS_REPORT; + String url = Constants.DASHBOARD_URL + Constants.NTC_RADIUS_REPORT; String statTime = bean.getSearchFoundStartTime(); String endTime = bean.getSearchFoundEndTime(); String account = bean.getAccount(); @@ -222,7 +222,7 @@ public class TrafficStatisticsReportController extends BaseController { if ("3".endsWith(searchBusinessType)) { model.addAttribute("searchBusinessType", 3);// IP查询 } - String url = Configurations.getStringProperty("dashboardUrlV2","dashboardUrlV2")+ Constants.NTC_RADIUS_REPORT; + String url = Constants.DASHBOARD_URL+ Constants.NTC_RADIUS_REPORT; String statTime = bean.getSearchFoundStartTime(); String endTime = bean.getSearchFoundEndTime(); String account = bean.getAccount(); diff --git a/src/main/java/com/nis/web/dao/configuration/AppMultiFeatureCfgDao.java b/src/main/java/com/nis/web/dao/configuration/AppMultiFeatureCfgDao.java index 544cedd5f..37beaed0c 100644 --- a/src/main/java/com/nis/web/dao/configuration/AppMultiFeatureCfgDao.java +++ b/src/main/java/com/nis/web/dao/configuration/AppMultiFeatureCfgDao.java @@ -63,6 +63,7 @@ public interface AppMultiFeatureCfgDao { public void deleteAppTcpCfg(BaseCfg entity); public int insertAppComplexFeatureCfg(AppComplexFeatureCfg entity); + public int insertAppComplexFeatureCfgBatch(AppComplexFeatureCfg entity); public void deleteAppComplexFeatureCfg(BaseCfg entity); //IP RANGE配置 public List getAppIpRangeCfg(@Param("compileId")Integer compileId,@Param("functionId")Integer functionId) ; diff --git a/src/main/java/com/nis/web/dao/configuration/AppMultiFeatureCfgDao.xml b/src/main/java/com/nis/web/dao/configuration/AppMultiFeatureCfgDao.xml index a0987faa1..0997b2ee1 100644 --- a/src/main/java/com/nis/web/dao/configuration/AppMultiFeatureCfgDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/AppMultiFeatureCfgDao.xml @@ -553,6 +553,29 @@ #{icmpCode,jdbcType=VARCHAR},#{icmpIdentifier,jdbcType=VARCHAR},#{headerType,jdbcType=VARCHAR} ) + + + + insert into app_complex_feature_cfg ( + APP_CODE,BEHAV_CODE,SPEC_SERVICE_ID,CFG_DESC,ACTION,IS_VALID,IS_AUDIT, + CREATOR_ID,CREATE_TIME,EDITOR_ID,EDIT_TIME,AUDITOR_ID,AUDIT_TIME, + SERVICE_ID,REQUEST_ID,COMPILE_ID,IS_AREA_EFFECTIVE,CLASSIFY, + ATTRIBUTE,LABLE,AREA_EFFECTIVE_IDS,FUNCTION_ID,CFG_TYPE,CFG_REGION_CODE, + DISTRICT,CFG_KEYWORDS,EXPR_TYPE,MATCH_METHOD,IS_HEXBIN,DO_LOG,user_region1,user_region2,user_region3,user_region4,user_region5, + ver,ihl,tos,total_length,flags,fragment_offset,protocol,icmp_type,icmp_code,icmp_identifier,header_type + )values ( + , + #{cfgType,jdbcType=VARCHAR},#{cfgRegionCode,jdbcType=INTEGER}, + #{district,jdbcType=VARCHAR},#{cfgKeywords,jdbcType=VARCHAR}, + #{exprType,jdbcType=INTEGER},#{matchMethod,jdbcType=INTEGER},#{isHexbin,jdbcType=INTEGER}, + #{doLog,jdbcType=INTEGER},#{userRegion1,jdbcType=VARCHAR},#{userRegion2,jdbcType=VARCHAR}, + #{userRegion3,jdbcType=VARCHAR},#{userRegion4,jdbcType=VARCHAR},#{userRegion5,jdbcType=VARCHAR}, + #{ver,jdbcType=VARCHAR},#{ihl,jdbcType=VARCHAR},#{tos,jdbcType=VARCHAR},#{totalLength,jdbcType=VARCHAR}, + #{flags,jdbcType=VARCHAR},#{fragmentOffset,jdbcType=VARCHAR},#{protocol,jdbcType=VARCHAR},#{icmpType,jdbcType=VARCHAR}, + #{icmpCode,jdbcType=VARCHAR},#{icmpIdentifier,jdbcType=VARCHAR},#{headerType,jdbcType=VARCHAR} + ) + + diff --git a/src/main/java/com/nis/web/dao/configuration/ConfigSynchronizationDao.java b/src/main/java/com/nis/web/dao/configuration/ConfigSynchronizationDao.java index d86651de7..887173001 100644 --- a/src/main/java/com/nis/web/dao/configuration/ConfigSynchronizationDao.java +++ b/src/main/java/com/nis/web/dao/configuration/ConfigSynchronizationDao.java @@ -97,4 +97,6 @@ public interface ConfigSynchronizationDao { public List getComplexStrListByService(BaseCfg entity); public List getAppIpPortList(@Param("tableName")String tableName,@Param("compileIds")List compileIds); public List getAppIpFeatureList(BaseCfg entity); + + public void updateCfgStatus(BaseCfg entity); } diff --git a/src/main/java/com/nis/web/dao/configuration/ConfigSynchronizationDao.xml b/src/main/java/com/nis/web/dao/configuration/ConfigSynchronizationDao.xml index 05ff5b85d..9b76df62b 100644 --- a/src/main/java/com/nis/web/dao/configuration/ConfigSynchronizationDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/ConfigSynchronizationDao.xml @@ -1582,6 +1582,26 @@ AND a.CFG_ID!=#{cfgId,jdbcType=BIGINT} + + + + + update ${tableName} set is_valid = #{isValid,jdbcType=INTEGER}, + edit_time = #{editTime,jdbcType=TIMESTAMP} + + ,is_audit = #{isAudit,jdbcType=INTEGER} + ,audit_time=#{auditTime,jdbcType=TIMESTAMP} + + + + AND cfg_id = #{cfgId,jdbcType=BIGINT} + + + AND compile_id = #{compileId,jdbcType=INTEGER} + + and function_id=#{functionId,jdbcType=INTEGER} + + - + +
@@ -45,10 +45,12 @@
- + onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true,minDate:'#F{$dp.$D(\'beginDate\')}',maxDate:'#F{$dp.$D(\'beginDate\',{d:7})}'});" /> --> + @@ -76,7 +78,7 @@ - +<%-- --%> @@ -118,10 +120,11 @@ // 局点信息 function showActionTransChart(xData,series) { var nowDate=new Date(); + Highcharts.setOptions({ global: { useUTC: false } }); var chart = Highcharts.chart('chart', { chart : { - // type: 'area', + type: 'area', zoomType : 'x' }, noData:{ @@ -163,8 +166,16 @@ }, }, */ xAxis: { - type:'category', - categories: xData, + type:'datetime', + dateTimeLabelFormats: { + second: '%H:%M:%S', + minute: '%H:%M', + hour: '%H:%M', + day: '%m-%d', + week: '%m-%d', + month: '%Y-%m', + year: '%Y' + }, title: { text: 'time', align:'high', @@ -216,16 +227,19 @@ var series = new Array(); var total = 0; if(rs!=null){ - $(rs.sum).each(function(i,d) { + /* $(rs.sum).each(function(i,d) { total+=d }) - xData = rs.statTime; - data =rs.sum; + xData = rs.statTime; */ + data =rs.result; } - $("#total").val(JSON.stringify(total)); + $("#total").val(JSON.stringify(rs.sum)); series.push({ name: 'sum', - data: data + data: data, + marker: { + enabled: false + } }); showActionTransChart(xData,series); closeTip(); @@ -291,9 +305,9 @@ H.Chart.prototype.downloadCSV = function() { var rows = this.getDataRows(true); var data=new Array(); - var total = total = JSON.parse($("#total").val()); + var total = JSON.parse($("#total").val()); $(rows).each(function (i,d){ - if(d!=null){ + if(d!=null&&i>0){ data.push({ num1:d[0], num2:d[1] diff --git a/src/main/webapp/WEB-INF/views/dashboard/trafficActionTransList.jsp b/src/main/webapp/WEB-INF/views/dashboard/trafficActionTransList.jsp index c56cee2b8..b8ba528ed 100644 --- a/src/main/webapp/WEB-INF/views/dashboard/trafficActionTransList.jsp +++ b/src/main/webapp/WEB-INF/views/dashboard/trafficActionTransList.jsp @@ -27,8 +27,10 @@
- + +
@@ -36,8 +38,10 @@
- + +
@@ -58,7 +62,7 @@ - +<%-- --%> <%-- --%> @@ -100,9 +104,10 @@ function searchList(){ // 局点信息 function showActionTransChart(xData,series){ var nowDate=new Date(); + Highcharts.setOptions({ global: { useUTC: false } }); var chart = Highcharts.chart('chart', { chart:{ -// type: 'area', + type: 'area', zoomType: 'x' }, exporting: { @@ -133,15 +138,23 @@ function showActionTransChart(xData,series){ text: null }, xAxis: { - type:'category', - categories: xData, + type:'datetime', + dateTimeLabelFormats: { + second: '%H:%M:%S', + minute: '%H:%M', + hour: '%H:%M', + day: '%m-%d', + week: '%m-%d', + month: '%Y-%m', + year: '%Y' + }, title: { text: 'time', align:'high', }, labels: { rotation: -45, //倾斜的角度 - }, + } }, yAxis: { title: { @@ -185,10 +198,9 @@ function showActionTransChart(xData,series){ var series=new Array(); var total=[]; if(rs!=null&&rs.length>0){ - xData=rs[0].statTime; $(rs).each(function(i, d) { total.push( - sum(d.count) + d.sum ) var entrance=""; if(d!=null&&d.entranceId==1){ @@ -199,7 +211,10 @@ function showActionTransChart(xData,series){ } series.push({ name: entrance, - data: d.count + data: d.result, + marker: { + enabled: false + } }); }) }else{ diff --git a/src/main/webapp/WEB-INF/views/dashboard/trafficAppTypeList.jsp b/src/main/webapp/WEB-INF/views/dashboard/trafficAppTypeList.jsp index 2e4a1b06e..f35b6cc27 100644 --- a/src/main/webapp/WEB-INF/views/dashboard/trafficAppTypeList.jsp +++ b/src/main/webapp/WEB-INF/views/dashboard/trafficAppTypeList.jsp @@ -42,8 +42,12 @@
- + <%-- --%> +
@@ -52,7 +56,7 @@
+ value="" onclick="WdatePicker({el:'endDate',dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'#F{$dp.$D(\'beginDate\')}',maxDate:getMaxDate(7) })"/>
@@ -115,7 +119,7 @@
- +<%-- --%> diff --git a/src/main/webapp/WEB-INF/views/dashboard/trafficBandwidthList.jsp b/src/main/webapp/WEB-INF/views/dashboard/trafficBandwidthList.jsp index 3c3c9de09..c2974aa8d 100644 --- a/src/main/webapp/WEB-INF/views/dashboard/trafficBandwidthList.jsp +++ b/src/main/webapp/WEB-INF/views/dashboard/trafficBandwidthList.jsp @@ -263,8 +263,8 @@ function changeBandwidth(unitType,beginDate,endDate){ /* 网络带宽时间维度趋势图 */ function showBandwidthChart(id,unitType,xdata,ydata,title){ - var nowDate=new Date(); - Highcharts.setOptions({ global: { useUTC: false } }); + var nowDate=new Date(); + Highcharts.setOptions({ global: { useUTC: false } }); var chart = Highcharts.chart(id, { chart:{ type: 'area', @@ -386,7 +386,7 @@ function showBandwidthChart(id,unitType,xdata,ydata,title){ } }, */ series:ydata - }); + }); } (function(H) { H.Chart.prototype.downloadXLS = function() { diff --git a/src/main/webapp/WEB-INF/views/dashboard/trafficHttpStatisticList.jsp b/src/main/webapp/WEB-INF/views/dashboard/trafficHttpStatisticList.jsp index 40e87c59e..988fbbea9 100644 --- a/src/main/webapp/WEB-INF/views/dashboard/trafficHttpStatisticList.jsp +++ b/src/main/webapp/WEB-INF/views/dashboard/trafficHttpStatisticList.jsp @@ -32,8 +32,10 @@
- +
@@ -42,7 +44,7 @@
+ value="" onclick="WdatePicker({el:'endDate',dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'#F{$dp.$D(\'beginDate\')}',maxDate:getMaxDate(7) })"/> @@ -92,7 +94,7 @@ - +<%-- --%> - +<%-- --%> <%-- --%> @@ -179,9 +187,10 @@ function searchList(){ function showIpActiveChart(xData,series){ var nowDate=new Date(); + Highcharts.setOptions({ global: { useUTC: false } }); var chart = Highcharts.chart('chart', { chart:{ - //type: 'area', + type: 'area', zoomType: 'x' }, exporting: { @@ -206,12 +215,20 @@ function showIpActiveChart(xData,series){ }, xAxis: { //tickInterval:tickInterval, - type:'category', - categories: xData, + type:'datetime', + dateTimeLabelFormats: { + second: '%H:%M:%S', + minute: '%H:%M', + hour: '%H:%M', + day: '%m-%d', + week: '%m-%d', + month: '%Y-%m', + year: '%Y' + }, title: { text: 'time', align:'high', - }, + } }, noData:{ style: {//设置字体颜色 @@ -266,16 +283,17 @@ function showIpActiveChart(xData,series){ var xData=new Array(); var series=new Array(); if(rs!=null&&rs.length>0){ - xData=rs[0].statTime; $(rs).each(function(i, d) { - total.push( - sum(d.linkNum) - ) - series.push({ - name: d.ipAddr, - data: d.linkNum - }); - }) + total.push(d.sum) + series.push({ + name: d.ipAddr, + data: d.result, + marker: { + enabled: false + } + }); + }) + console.log(rs) }else{ series.push({ name: " ", diff --git a/src/main/webapp/WEB-INF/views/dashboard/trafficPortActiveList.jsp b/src/main/webapp/WEB-INF/views/dashboard/trafficPortActiveList.jsp index 2b9c6f5cf..3e1f1f877 100644 --- a/src/main/webapp/WEB-INF/views/dashboard/trafficPortActiveList.jsp +++ b/src/main/webapp/WEB-INF/views/dashboard/trafficPortActiveList.jsp @@ -28,18 +28,25 @@
- - + --> + +
- -
+ + +
@@ -57,7 +64,7 @@ - +<%-- --%> <%-- --%> @@ -111,9 +118,10 @@ function searchList(){ function showPortActiveChart(xData,series){ var nowDate=new Date(); + Highcharts.setOptions({ global: { useUTC: false } }); var chart = Highcharts.chart('chart', { chart:{ -// type: 'area', + type: 'area', zoomType: 'x' }, exporting: { @@ -160,8 +168,16 @@ function showPortActiveChart(xData,series){ text: null }, xAxis: { - type:'category', - categories: xData, + type:'datetime', + dateTimeLabelFormats: { + second: '%H:%M:%S', + minute: '%H:%M', + hour: '%H:%M', + day: '%m-%d', + week: '%m-%d', + month: '%Y-%m', + year: '%Y' + }, title: { text: 'time', align:'high', @@ -199,14 +215,16 @@ function showPortActiveChart(xData,series){ var series=new Array(); var total = []; if(rs!=null&&rs.length>0){ - xData=rs[0].statTime; $(rs).each(function(i, d) { total.push( - sum(d.sum) + d.sum ) series.push({ name: d.port, - data: d.sum + data: d.result, + marker: { + enabled: false + } }); }) }else{ diff --git a/src/main/webapp/WEB-INF/views/dashboard/trafficProtocolTypeList.jsp b/src/main/webapp/WEB-INF/views/dashboard/trafficProtocolTypeList.jsp index b9dfa4692..4a4ad76a8 100644 --- a/src/main/webapp/WEB-INF/views/dashboard/trafficProtocolTypeList.jsp +++ b/src/main/webapp/WEB-INF/views/dashboard/trafficProtocolTypeList.jsp @@ -32,8 +32,10 @@
- +
@@ -42,7 +44,7 @@
+ value="" onclick="WdatePicker({el:'endDate',dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'#F{$dp.$D(\'beginDate\')}',maxDate:getMaxDate(7) })"/>
@@ -105,7 +107,7 @@
- +<%-- --%> diff --git a/src/main/webapp/WEB-INF/views/dashboard/trafficWebTypeList.jsp b/src/main/webapp/WEB-INF/views/dashboard/trafficWebTypeList.jsp index 2c3e08c2d..61b103f9a 100644 --- a/src/main/webapp/WEB-INF/views/dashboard/trafficWebTypeList.jsp +++ b/src/main/webapp/WEB-INF/views/dashboard/trafficWebTypeList.jsp @@ -46,10 +46,14 @@ - + onclick="WdatePicker({onpicked:setTime,dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true,maxDate:'#F{$dp.$D(\'endDate\')}'});"/> --> +
@@ -58,9 +62,11 @@
- + onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true,minDate:'#F{$dp.$D(\'beginDate\')}',maxDate:'#F{$dp.$D(\'beginDate\',{d:7})}'});"/> --> + @@ -162,7 +168,7 @@ - +<%-- --%> diff --git a/src/main/webapp/static/global/plugins/highcharts/js/offline-exporting.js b/src/main/webapp/static/global/plugins/highcharts/js/offline-exporting.js index aee446312..622210fc4 100644 --- a/src/main/webapp/static/global/plugins/highcharts/js/offline-exporting.js +++ b/src/main/webapp/static/global/plugins/highcharts/js/offline-exporting.js @@ -278,6 +278,7 @@ License: www.highcharts.com/license textKey: "downloadPNG", onclick: function () { console.log(this) + console.log(chart_main) this.legend.itemStyle.color='#000000' this.exportChartLocal() this.legend.itemStyle.color='#ffffff' diff --git a/src/main/webapp/static/global/scripts/pzLog.js b/src/main/webapp/static/global/scripts/pzLog.js index 4ad93aea6..95e22cd68 100644 --- a/src/main/webapp/static/global/scripts/pzLog.js +++ b/src/main/webapp/static/global/scripts/pzLog.js @@ -6,13 +6,26 @@ $(function(){ getTotalLog(); }); -function setTime(){ +/*function setTime(){ var chooseDate=new Date($('#beginDate').val()); chooseDate=chooseDate.setDate(chooseDate.getDate()+7); var modifyTime=new Date(chooseDate); $('#endDate').val(modifyTime.getFullYear()+"-"+((modifyTime.getMonth()+1)>=10?(modifyTime.getMonth()+1):"0"+(modifyTime.getMonth()+1))+"-"+(modifyTime.getDate()>=10?modifyTime.getDate():'0'+modifyTime.getDate())+' '+(modifyTime.getHours()>=10?modifyTime.getHours():'0'+modifyTime.getHours())+':'+(modifyTime.getMinutes()>=10?modifyTime.getMinutes():'0'+modifyTime.getMinutes())+':'+(modifyTime.getSeconds()>=10?modifyTime.getSeconds():'0'+modifyTime.getSeconds())); +}*/ +function setTime(dayData){ + var useTime=$('#beginDate').val(); + if(useTime==''){ + return; + } + var chooseDate=new Date(useTime); + chooseDate=chooseDate.setDate(chooseDate.getDate()+dayData); + var now =new Date(); + if(now.getTime()=10?(modifyTime.getMonth()+1):"0"+(modifyTime.getMonth()+1))+"-"+(modifyTime.getDate()>=10?modifyTime.getDate():'0'+modifyTime.getDate())+' '+(modifyTime.getHours()>=10?modifyTime.getHours():'0'+modifyTime.getHours())+':'+(modifyTime.getMinutes()>=10?modifyTime.getMinutes():'0'+modifyTime.getMinutes())+':'+(modifyTime.getSeconds()>=10?modifyTime.getSeconds():'0'+modifyTime.getSeconds())); } - function setTimee(){ var chooseDate=new Date($('#searchFoundStartTime').val()); chooseDate=chooseDate.setDate(chooseDate.getDate()+1); @@ -21,6 +34,68 @@ function setTimee(){ } +function currentTime() { + var now = new Date(); + + var year = now.getFullYear(); + var month = now.getMonth() + 1; + var day = now.getDate(); + + var hh = now.getHours(); + var mm = now.getMinutes(); + + var clock = year + "-"; + + if (month < 10) clock += "0"; + clock += month + "-"; + + if (day < 10) clock += "0"; + clock += day + " "; + + if (hh < 10) clock += "0"; + clock += hh + ":"; + + if (mm < 10) clock += '0'; + clock += mm; + return (clock); +} +function getMaxDate(day){ + var clock=currentTime(); + var dt; + var times=0; + dt=$("#beginDate").val(); + if(dt!=''){ + times =Date.parse(dt.replace(/-/g,'/'))+day*24*60*60*1000;//时间间隔为10天 + + if(times-Date.parse(clock.replace(/-/g,'/'))<0){ + var d1 = new Date(times); + var year = d1.getFullYear(); + var month = d1.getMonth() + 1; //月份以0开头 + var day = d1.getDate(); + + var hh = d1.getHours(); + var mm = d1.getMinutes(); + + var clock = year + "-"; + + if (month < 10) clock += "0"; + clock += month + "-"; + + if (day < 10) clock += "0"; + clock += day + " "; + + if (hh < 10) clock += "0"; + clock += hh + ":"; + + if (mm < 10) clock += '0'; + clock += mm; + + } + } + return clock; +} + + var getTotalLog=function(){ /* td需要配置属性有,audit,functionId,compileId,action diff --git a/src/main/webapp/static/pages/scripts/echart.js b/src/main/webapp/static/pages/scripts/echart.js index 9cd32e2f4..b751f0b05 100644 --- a/src/main/webapp/static/pages/scripts/echart.js +++ b/src/main/webapp/static/pages/scripts/echart.js @@ -292,7 +292,14 @@ fill: '#51586f' } } - } + }, + menuItems: [ + Highcharts.getOptions().exporting.buttons.contextButton.menuItems[0],// 打印 + Highcharts.getOptions().exporting.buttons.contextButton.menuItems[1],// jpeg + 'downloadPNG','downloadPDF', + Highcharts.getOptions().exporting.buttons.contextButton.menuItems[4],// excel + Highcharts.getOptions().exporting.buttons.contextButton.menuItems[3],// cvs + ] } } }, diff --git a/src/main/webapp/static/pages/scripts/importExcel.js b/src/main/webapp/static/pages/scripts/importExcel.js index 35b6645b4..1a0cab3cb 100644 --- a/src/main/webapp/static/pages/scripts/importExcel.js +++ b/src/main/webapp/static/pages/scripts/importExcel.js @@ -133,9 +133,10 @@ var importCfg=function(){ } var appFlag=true; if(($("#functionId").val() == 63)||($("#functionId").val() == 408)||($("#functionId").val() == 407)|| - ($("#functionId").val() == 402)||($("#functionId").val() == 403)||($("#functionId").val() == 405)){ + ($("#functionId").val() == 402)||($("#functionId").val() == 403)||($("#functionId").val() == 405) + ||($("#functionId").val() == 563)||($("#functionId").val() == 565)||($("#functionId").val() == 564)||($("#functionId").val() == 566)){ var appIdValue=$("#appIdName").val(); - if(appIdValue == null || appIdValue ==''){ + if(appIdValue == null || appIdValue =='' || typeof(appIdValue) == "undefined"){ appFlag=false; } }