develop

Conflicts:
	src/main/resources/messages/message_ru.properties
	src/main/resources/messages/message_zh_CN.properties
This commit is contained in:
DuanDongmei
2018-11-14 13:15:11 +08:00
38 changed files with 6959 additions and 1596 deletions

View File

@@ -1,6 +1,8 @@
package com.nis.domain.configuration;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import com.nis.util.excel.ExcelField;
@@ -251,5 +253,20 @@ public class AppIpCfg extends BaseCfg<AppIpCfg> {
public void setBehavCode(Integer behavCode) {
this.behavCode = behavCode;
}
@Override
public String toString() {
return "AppIpCfg [compileId=" + compileId + ", ratelimit=" + ratelimit + ", appCode=" + appCode + ", behavCode="
+ behavCode + ", specServiceId=" + specServiceId + ", appName=" + appName + ", ipType=" + ipType
+ ", ipPattern=" + ipPattern + ", srcIpAddress=" + srcIpAddress + ", destIpAddress=" + destIpAddress
+ ", portPattern=" + portPattern + ", srcPort=" + srcPort + ", destPort=" + destPort + ", direction="
+ direction + ", protocol=" + protocol + ", userRegion1=" + userRegion1 + ", userRegion2=" + userRegion2
+ ", userRegion3=" + userRegion3 + ", userRegion4=" + userRegion4 + ", userRegion5=" + userRegion5
+ ", cfgId=" + cfgId + ", cfgDesc=" + cfgDesc + ", action=" + action + ", isValid=" + isValid
+ ", isAudit=" + isAudit + ", creatorId=" + creatorId + ", createTime=" + createTime + ", editorId="
+ editorId + ", editTime=" + editTime + ", auditorId=" + auditorId + ", auditTime=" + auditTime
+ ", serviceId=" + serviceId + ", requestId=" + requestId + ", cancelRequestId=" + cancelRequestId
+ ", isAreaEffective=" + isAreaEffective + ", classify=" + classify + ", attribute=" + attribute
+ ", lable=" + lable + ", areaEffectiveIds=" + areaEffectiveIds + ", cfgRegionCode=" + cfgRegionCode
+ ", cfgType=" + cfgType + ", functionId=" + functionId + ", doLog=" + doLog + "]";
}
}

View File

@@ -9,6 +9,9 @@
package com.nis.domain.configuration;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.cache.CacheKey;
import com.nis.domain.basics.AsnIpCfg;
import com.nis.util.excel.ExcelField;
@@ -60,6 +63,8 @@ public class CfgIndexInfo extends BaseCfg<CfgIndexInfo> {
private List<InterceptPktBin> interceptPktBinList;
private AvContUrlCfg avContUrlCfg;
private List<AvContUrlCfg> avContUrlCfgList;
private BaseStringCfg strCfg;
private ComplexkeywordCfg complexCfg;
private Long dnsStrategyId;
@ExcelField(title="policy_name",sort=21)
@@ -74,6 +79,18 @@ public class CfgIndexInfo extends BaseCfg<CfgIndexInfo> {
private Integer sourceCompileId;
private String searchKeywords;// 列表关键字查询字段
private Map<String,Object> userRegion;
/*private CachePolicyUserRegion cachePolicyUserRegion;//缓存策略用户自定义域参数
public static class CachePolicyUserRegion{
private CacheKey cache_key;
public static class CecheKey{
}
}*/
public Integer getSourceCompileId() {
return sourceCompileId;
}
@@ -331,5 +348,24 @@ public class CfgIndexInfo extends BaseCfg<CfgIndexInfo> {
public void setSearchKeywords(String searchKeywords) {
this.searchKeywords = searchKeywords;
}
public Map<String, Object> getUserRegion() {
return userRegion;
}
public void setUserRegion(Map<String, Object> userRegion) {
this.userRegion = userRegion;
}
public BaseStringCfg getStrCfg() {
return strCfg;
}
public void setStrCfg(BaseStringCfg strCfg) {
this.strCfg = strCfg;
}
public ComplexkeywordCfg getComplexCfg() {
return complexCfg;
}
public void setComplexCfg(ComplexkeywordCfg complexCfg) {
this.complexCfg = complexCfg;
}
}

View File

@@ -0,0 +1,46 @@
/**
*@Title: HttpDomainConfig.java
*@Package com.nis.domain.restful
*@Description TODO
*@author dell
*@date 2018年2月5日 下午5:33:05
*@version 版本号
*/
package com.nis.domain.configuration;
/**
* @ClassName: CommonStringConfig.java
* @Description: 通用字符串配置对象类[后期业务扩展使用]
* @author (zhangwei)
* @date 2018年11月8日 下午1:58:05
* @version V1.0
*/
public class CommonStringCfg extends BaseStringCfg<CommonStringCfg> {
/**
* @Fields serialVersionUID:TODO用一句话描述这个变量表示什么 *
* @since 1.0.0
*/
private static final long serialVersionUID = -5912532490412412005L;
private static final String tableName="common_keyword_cfg";
/* (non-Javadoc)
* @see com.nis.domain.configuration.BaseStringCfg#initDefaultValue()
*/
@Override
public void initDefaultValue() {
// TODO Auto-generated method stub
super.initDefaultValue();
this.matchMethod=0;
}
public static String getTablename() {
return tableName;
}
private String replaceContent;
public String getReplaceContent() {
return replaceContent;
}
public void setReplaceContent(String replaceContent) {
this.replaceContent = replaceContent;
}
}

View File

@@ -0,0 +1,41 @@
/**
*@Title: HttpDomainConfig.java
*@Package com.nis.domain.restful
*@Description TODO
*@author dell
*@date 2018年2月5日 下午5:33:05
*@version 版本号
*/
package com.nis.domain.configuration;
/**
* @ClassName: ComplexStringCfg.java
* @Description: 通用增强字符串类配置[后期业务扩展使用]
* @author (zhangwei)
* @date 2018年11月8日 下午2:00:52
* @version V1.0
*/
public class ComplexStringCfg extends ComplexkeywordCfg {
/**
* @Fields serialVersionUID:TODO用一句话描述这个变量表示什么
*
* @since 1.0.0
*/
private static final long serialVersionUID = -2248641720522865575L;
private static final String tableName="complex_keyword_cfg";
/* (non-Javadoc)
* @see com.nis.domain.configuration.ComplexkeywordCfg#initDefaultValue()
*/
@Override
public void initDefaultValue() {
// TODO Auto-generated method stub
super.initDefaultValue();
this.exprType=0;
this.matchMethod=0;
this.isHexbin=0;
}
public static String getTablename() {
return tableName;
}
}

View File

@@ -113,6 +113,7 @@ import com.nis.web.service.configuration.AsnPolicyCfgService;
import com.nis.web.service.configuration.AvCfgService;
import com.nis.web.service.configuration.AvContentCfgService;
import com.nis.web.service.configuration.BgpCfgService;
import com.nis.web.service.configuration.CachePolicyService;
import com.nis.web.service.configuration.ComplexStringCfgService;
import com.nis.web.service.configuration.ControlPolicyService;
import com.nis.web.service.configuration.DdosCfgService;
@@ -248,6 +249,8 @@ public class BaseController {
protected GroupAreaService groupAreaService;// 分组区域管理 service
//@Autowired
//protected ConfigGroupInfoService configGroupInfoService;
@Autowired
protected CachePolicyService cachePolicyService;
/**
* 管理基础路径
*/
@@ -979,7 +982,7 @@ public class BaseController {
* @throws ServiceException
*/
public BlockingQueue<DnsResStrategy> checkDnsResStrategyCfgMulity(FunctionServiceDict serviceDict, FunctionRegionDict regionDict,BlockingQueue<? extends Object> list) throws InterruptedException, ExecutionException, ServiceException{
logger.warn("start checkComplexStringCfgMulity ,size "+list.size());
logger.warn("start checkDnsResStrategyCfgMulity ,size "+list.size());
long start=System.currentTimeMillis();
BlockingQueue<DnsResStrategy> queue=new ArrayBlockingQueue<>(list.size());
ExecutorService service=Executors.newFixedThreadPool(Constants.MULITY_THREAD_SIZE);
@@ -1006,7 +1009,7 @@ public class BaseController {
}
}
long end=System.currentTimeMillis();
logger.warn("checkComplexStringCfgMulity finish,cost:"+(end-start)+",size:"+queue.size());
logger.warn("checkDnsResStrategyCfgMulity finish,cost:"+(end-start)+",size:"+queue.size());
return queue;
}

View File

@@ -0,0 +1,367 @@
package com.nis.web.controller.configuration.proxy;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.nis.domain.FunctionRegionDict;
import com.nis.domain.FunctionServiceDict;
import com.nis.domain.Page;
import com.nis.domain.callback.ProxyFileStrategyCfg;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.ComplexkeywordCfg;
import com.nis.domain.configuration.FileDigestCfg;
import com.nis.domain.configuration.HttpBodyCfg;
import com.nis.domain.configuration.HttpReqHeadCfg;
import com.nis.domain.configuration.HttpResHeadCfg;
import com.nis.domain.configuration.HttpUrlCfg;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.configuration.NtcSubscribeIdCfg;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.StringUtil;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
import jersey.repackaged.com.google.common.collect.Lists;
/**
* http重定向策略
* @author zhangwei
*
*/
@Controller
@RequestMapping("${adminPath}/proxy/cache")
public class CachePolicyController extends BaseController{
@RequestMapping(value = {"list"})
public String list(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")CfgIndexInfo cfg){
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
Page<CfgIndexInfo> page = cachePolicyService.getCachePolicyList(searchPage, cfg);
model.addAttribute("page", page);
initPageCondition(model,cfg);
return "/cfg/proxy/cache/list";
}
@RequestMapping(value = {"form"})
@RequiresPermissions(value={"cache:policy:config"})
public String form(Model model,HttpServletRequest request,HttpServletResponse response,String ids,CfgIndexInfo entity){
if(StringUtils.isNotBlank(ids)){
entity = cachePolicyService.getCachePolicy(Long.parseLong(ids));
initUpdateFormCondition(model,entity);
}else{
initFormCondition(model,entity);
}
model.addAttribute("_cfg", entity);
return "/cfg/proxy/cache/form";
}
@RequestMapping(value = {"saveOrUpdate"})
@RequiresPermissions(value={"cache:policy:config"})
public String saveOrUpdate(Model model,HttpServletRequest request,HttpServletResponse response,
@ModelAttribute("cfg")CfgIndexInfo cfg,RedirectAttributes redirectAttributes){
try{
if(cfg.getAction().equals(128)){//不为白名单时保存自定义域
cfg.setUserRegion(null);
}else{
String ignore_qs = request.getParameter("ignore_qs");
String hdrs = request.getParameter("hdrs");
String cookie = request.getParameter("cookie");
Map<String,Object> map = new HashMap();
if(!StringUtil.isBlank(ignore_qs)){
map.put("ignore_qs", ignore_qs.split(","));
}
if(!StringUtil.isBlank(hdrs)){
map.put("hdrs",hdrs.trim());
}
if(!StringUtil.isBlank(cookie)){
map.put("cookie", cookie.trim());
}
cfg.getUserRegion().put("cache_key", map);
if(!StringUtil.isEmpty(cfg.getUserRegion().get("min_use"))){
cfg.getUserRegion().put("min_use",Integer.parseInt(cfg.getUserRegion().get("no_revalidate").toString()));
}
if(!StringUtil.isEmpty(cfg.getUserRegion().get("cache_dyn_url"))){
cfg.getUserRegion().put("cache_dyn_url",Integer.parseInt(cfg.getUserRegion().get("cache_dyn_url").toString()));
}
if(!StringUtil.isEmpty(cfg.getUserRegion().get("cache_cookied_cont"))){
cfg.getUserRegion().put("cache_cookied_cont",Integer.parseInt(cfg.getUserRegion().get("cache_cookied_cont").toString()));
}
if(!StringUtil.isEmpty(cfg.getUserRegion().get("ignore_req_nocache"))){
cfg.getUserRegion().put("ignore_req_nocache",Integer.parseInt(cfg.getUserRegion().get("ignore_req_nocache").toString()));
}
if(!StringUtil.isEmpty(cfg.getUserRegion().get("ignore_res_nocache"))){
cfg.getUserRegion().put("ignore_res_nocache",Integer.parseInt(cfg.getUserRegion().get("ignore_res_nocache").toString()));
}
if(!StringUtil.isEmpty(cfg.getUserRegion().get("force_caching"))){
cfg.getUserRegion().put("force_caching",Integer.parseInt(cfg.getUserRegion().get("force_caching").toString()));
}
if(!StringUtil.isEmpty(cfg.getUserRegion().get("min_use"))){
cfg.getUserRegion().put("min_use",Integer.parseInt(cfg.getUserRegion().get("min_use").toString()));
}
}
cachePolicyService.saveCachePolicy(cfg);
addMessage(redirectAttributes,"success","save_success");
}catch(Exception e){
logger.error("信息保存失败",e);
e.printStackTrace();
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error","request_service_failed");
}else {
addMessage(redirectAttributes,"error","save_failed");
}
}
return "redirect:" + adminPath +"/proxy/cache/list?functionId="+cfg.getFunctionId();
}
@RequestMapping(value = {"ajaxCacheSubList"})
public String ajaxCacheSubList(Model model,Long cfgId,Integer index) {
CfgIndexInfo cfg = cachePolicyService.getCachePolicy(cfgId);
List<String[]> tabList = new ArrayList();
if(cfg.getIpPortList()!=null){
String cfgType = null;
for(IpPortCfg ip:cfg.getIpPortList()){
if(!ip.getCfgType().equals(cfgType)){
tabList.add(new String[]{"1",ip.getCfgType()});
cfgType = ip.getCfgType();
}
}
}
if(cfg.getComplexList()!=null){
String cfgType = null;
for(ComplexkeywordCfg keyword:cfg.getComplexList()){
if(!keyword.getCfgType().equals(cfgType)){
tabList.add(new String[]{"3",keyword.getCfgType()});
cfgType = keyword.getCfgType();
}
}
}
if(cfg.getStringList()!=null){
String cfgType = null;
for(BaseStringCfg strCfg:cfg.getStringList()){
if(!strCfg.getCfgType().equals(cfgType)){
tabList.add(new String[]{"2",strCfg.getCfgType()});
cfgType = strCfg.getCfgType();
}
}
}
model.addAttribute("_cfg", cfg);
model.addAttribute("index", index);
model.addAttribute("tabList", tabList);
return "/cfg/proxy/cache/cachePolicySubList";
}
@RequestMapping(value = {"delete"})
@RequiresPermissions(value={"cache:policy:config"})
public String delete(Integer isAudit,Integer isValid,String ids,Integer functionId){
cachePolicyService.updateCachePolicyValid(isValid,ids,functionId);
return "redirect:" + adminPath +"/proxy/cache/list?functionId="+functionId;
}
@RequestMapping(value = {"audit"})
@RequiresPermissions(value={"cache:policy:confirm"})
public String audit(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes) {
CfgIndexInfo entity = new CfgIndexInfo();
String[] idArray = ids.split(",");
for(String id :idArray){
entity = cachePolicyService.getCachePolicy(Long.parseLong(id));
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
entity.setFunctionId(functionId);
try {
cachePolicyService.auditCachePolicy(entity,isAudit);
} catch ( Exception e) {
e.printStackTrace();
logger.info("代理缓存策略下发失败:"+e.getMessage());
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error","request_service_failed");
}else {
addMessage(redirectAttributes,"error","audit_failed");
}
}
}
return "redirect:" + adminPath +"/proxy/cache/list?functionId="+functionId;
}
//http配置导出
/*@RequestMapping(value = "exportHttp")
public String exportHttp(Model model,HttpServletRequest request,HttpServletResponse response,
@ModelAttribute("cfg")CfgIndexInfo entity,String ids,RedirectAttributes redirectAttributes){
try {
//export data info
List<String> titleList=new ArrayList<String>();
Map<String, Class<?>> classMap=new HashMap<String, Class<?>>();
Map<String, List> dataMap=new HashMap<String, List>();
Map<String, String> noExportMap=new HashMap<String, String>();
List<FunctionRegionDict> regionList = DictUtils.getFunctionRegionDictList(entity.getFunctionId());
//导出选中记录
if(!StringUtil.isEmpty(ids)){
for(String id:ids.split(",")){
Long.parseLong(id);
}
//List<CfgIndexInfo> list=ipCfgService.getListByCfgIdWithName(IpPortCfg.getTablename(), entity.getFunctionId(), ids);
}else{
//条件导出数据大于最大导出数,只导出最大导出条数
Page<CfgIndexInfo> pageInfo=new Page<CfgIndexInfo>(request, response,"a");
if(pageInfo.getCount()>Constants.MAX_EXPORT_SIZE){
pageInfo.setPageNo(1);
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
}else{
pageInfo.setPageNo(1);
pageInfo.setPageSize(-1);
}
Page<CfgIndexInfo> page = cachePolicyService.getCachePolicyList(pageInfo, entity);
Properties prop = getMsgProp();
for (CfgIndexInfo str : page.getList()) {
if(entity.getFunctionId()!=210 && entity.getFunctionId()!=211){
String type="RESPONSE_CODE";
if(entity.getFunctionId()==207){
type="RESPONSE_CODE";
}else if(entity.getFunctionId()==208){
type="REDIRECT_RESPONSE_CODE";
}else if(entity.getFunctionId()==209){
type="CONTROL_REPLACE_ZONE";
}
String dictlabel= DictUtils.getDictLabel(type, str.getUserRegion1());
str.setUserRegion1(prop.getProperty(dictlabel));
if(entity.getFunctionId()==207 || entity.getFunctionId()==208){
if(StringUtil.isEmpty(str.getUserRegion2())){
if(!StringUtil.isEmpty(str.getUserRegion3())){
ProxyFileStrategyCfg file= new ProxyFileStrategyCfg();
file.setCompileId(Integer.valueOf(str.getUserRegion3()));
List<ProxyFileStrategyCfg> allProxyFileStrategys = proxyFileStrategyService.getProxyFileStrategyCfgList(file);
if(allProxyFileStrategys!=null && allProxyFileStrategys.size()>0){
str.setUserRegion2(allProxyFileStrategys.get(0).getCfgDesc());
}
}
}
}
}
}
String cfgIndexInfoNoExport=",policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
if(entity.getFunctionId()==207){
cfgIndexInfoNoExport=",policy_name,group_name,userregion3,userregion4,userregion5,&userregion1:response_code-userregion2:response_content-";
}else if(entity.getFunctionId()==208){
cfgIndexInfoNoExport=",policy_name,group_name,userregion3,userregion4,userregion5,&userregion1:redirect_response_code-userregion2:redirect_url-";
}else if(entity.getFunctionId()==209){
cfgIndexInfoNoExport=",policy_name,group_name,userregion3,userregion4,userregion5,&userregion1:replace_zone-userregion2:replaced_content-userregion3:replace_content-";
}else if(entity.getFunctionId()==211){
cfgIndexInfoNoExport=",do_log,log_total,policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
}
String httpUrlCfgNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
+ ",config_time,editor,edit_time,auditor,audit_time"
+",letter,whether_area_block,classification,attribute,label"
+",userregion1,userregion2,userregion3,userregion4,userregion5,";
String httpReqHeadCfgNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
+ ",config_time,editor,edit_time,auditor,audit_time"
+",letter,whether_area_block,classification,attribute,label"
+",userregion1,userregion2,userregion3,userregion4,userregion5,";
String httpResHeadCfgNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
+ ",config_time,editor,edit_time,auditor,audit_time"
+",letter,whether_area_block,classification,attribute,label"
+",userregion1,userregion2,userregion3,userregion4,userregion5,";
String httpReqBodyCfgNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
+ ",config_time,editor,edit_time,auditor,audit_time"
+",letter,whether_area_block,classification,attribute,label"
+",userregion1,userregion2,userregion3,userregion4,userregion5,";
String httpResBodyCfgNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
+ ",config_time,editor,edit_time,auditor,audit_time"
+",letter,whether_area_block,classification,attribute,label"
+",userregion1,userregion2,userregion3,userregion4,userregion5,";
String ipPortCfgNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
+ ",config_time,editor,edit_time,auditor,audit_time"
+",letter,whether_area_block,classification,attribute,label"
+",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
String ntcSubscribeIdCfgNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
+ ",config_time,editor,edit_time,auditor,audit_time"
+",letter,whether_area_block,classification,attribute,label"
+",userregion1,userregion2,userregion3,userregion4,userregion5,";
List<BaseStringCfg> httpUrlList = new ArrayList<>();
List<ComplexkeywordCfg> httpReqHdrList = new ArrayList<>();
List<ComplexkeywordCfg> httpResHdrList = new ArrayList<>();
List<BaseStringCfg> httpReqBodyList = new ArrayList<>();
List<BaseStringCfg> httpResBodyList = new ArrayList<>();
List<IpPortCfg> ipPortList = new ArrayList<>();
List<BaseStringCfg> subscribeIdList = new ArrayList<>();
for (CfgIndexInfo cfg : page.getList()) {
Map<String, List> maps=cachePolicyService.exportCachePolicy(cfg);
httpUrlList.addAll(maps.get("NTC_HTTP_URL"));
httpReqHdrList.addAll(maps.get("NTC_HTTP_REQ_HDR"));
httpResHdrList.addAll(maps.get("NTC_HTTP_RES_HDR"));
httpReqBodyList.addAll(maps.get("NTC_HTTP_REQ_BODY"));
httpResBodyList.addAll(maps.get("NTC_HTTP_RES_BODY"));
ipPortList.addAll(maps.get("NTC_UNIVERSAL_IP"));
subscribeIdList.addAll(maps.get("NTC_SUBSCRIBE_ID"));
}
httpUrlList=BaseStringCfg.replaceBaseKeyList(httpUrlList);
httpReqHdrList=ComplexkeywordCfg.replaceComplexKeyList(httpReqHdrList);
httpResHdrList=ComplexkeywordCfg.replaceComplexKeyList(httpResHdrList);
httpReqBodyList=BaseStringCfg.replaceBaseKeyList(httpReqBodyList);
httpResBodyList=BaseStringCfg.replaceBaseKeyList(httpResBodyList);
subscribeIdList=BaseStringCfg.baseHexList(subscribeIdList);
titleList.add(entity.getMenuNameCode());
titleList.add("NTC_HTTP_URL");
titleList.add("NTC_HTTP_REQ_HDR");
classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class);
classMap.put("NTC_HTTP_URL", HttpUrlCfg.class);
classMap.put("NTC_HTTP_REQ_HDR", HttpReqHeadCfg.class);
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
noExportMap.put("NTC_HTTP_URL", httpUrlCfgNoExport);
noExportMap.put("NTC_HTTP_REQ_HDR", httpReqHeadCfgNoExport);
dataMap.put(entity.getMenuNameCode(), page.getList());
dataMap.put("NTC_HTTP_URL", httpUrlList);
dataMap.put("NTC_HTTP_REQ_HDR", httpReqHdrList);
if(entity.getFunctionId()!=208 && entity.getFunctionId()!=211){
titleList.add("NTC_HTTP_RES_BODY");
classMap.put("NTC_HTTP_RES_BODY", HttpBodyCfg.class);
noExportMap.put("NTC_HTTP_RES_BODY", httpResBodyCfgNoExport);
dataMap.put("NTC_HTTP_RES_BODY", httpResBodyList);
}else if(entity.getFunctionId()!=211){
titleList.add("NTC_HTTP_RES_HDR");
titleList.add("NTC_HTTP_REQ_BODY");
classMap.put("NTC_HTTP_RES_HDR", HttpResHeadCfg.class);
classMap.put("NTC_HTTP_REQ_BODY", HttpBodyCfg.class);
noExportMap.put("NTC_HTTP_RES_HDR", httpResHeadCfgNoExport);
noExportMap.put("NTC_HTTP_REQ_BODY", httpReqBodyCfgNoExport);
dataMap.put("NTC_HTTP_RES_HDR", httpResHdrList);
dataMap.put("NTC_HTTP_REQ_BODY", httpReqBodyList);
}
titleList.add("NTC_UNIVERSAL_IP");
titleList.add("NTC_SUBSCRIBE_ID");
classMap.put("NTC_UNIVERSAL_IP", IpPortCfg.class);
classMap.put("NTC_SUBSCRIBE_ID", NtcSubscribeIdCfg.class);
noExportMap.put("NTC_UNIVERSAL_IP", ipPortCfgNoExport);
noExportMap.put("NTC_SUBSCRIBE_ID", ntcSubscribeIdCfgNoExport);
dataMap.put("NTC_UNIVERSAL_IP", ipPortList);
dataMap.put("NTC_SUBSCRIBE_ID",subscribeIdList);
}
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
} catch (Exception e) {
logger.error("http export failed",e);
addMessage(redirectAttributes, "export_failed");
}
return "redirect:" + adminPath +"/ntc/website/httpList?functionId="+entity.getFunctionId();
}*/
}

View File

@@ -1,15 +1,35 @@
package com.nis.web.controller.dashboard;
import java.awt.Color;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.StringReader;
import java.lang.reflect.Type;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.batik.transcoder.SVGAbstractTranscoder;
import org.apache.batik.transcoder.TranscoderException;
import org.apache.batik.transcoder.TranscoderInput;
import org.apache.batik.transcoder.TranscoderOutput;
import org.apache.batik.transcoder.image.ImageTranscoder;
import org.apache.batik.transcoder.image.JPEGTranscoder;
import org.apache.batik.transcoder.image.PNGTranscoder;
import org.jcodings.transcode.Transcoder;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
@@ -32,6 +52,8 @@ import com.nis.domain.SysDataDictionaryItem;
import com.nis.domain.configuration.WebsiteDomainTopic;
import com.nis.util.CodeDicUtils;
import com.nis.util.Constants;
import com.nis.util.DateUtil;
import com.nis.util.DateUtils;
import com.nis.util.DictUtils;
import com.nis.util.StringUtil;
import com.nis.util.httpclient.HttpClientUtil;
@@ -767,4 +789,78 @@ public class DashboardController extends BaseController{
System.out.println(map2.get("c"));
}
/**
* HighCharts导出图片
* @param response
* @param request
* @param page
* @throws ServletException, IOException
*/
@RequestMapping(value="saveAsImage")
public void toSaveAsImage(HttpServletResponse response,HttpServletRequest request) throws ServletException, IOException{
request.setCharacterEncoding("utf-8"); //设置UTF-8编码解决乱码问题
String type = request.getParameter("type");
String svg = request.getParameter("svg");
String filename = request.getParameter("filename");
filename = filename==null?"chart":filename;
ServletOutputStream out = response.getOutputStream();
if (null != type && null != svg) {
svg = svg.replaceAll(":rect", "rect");
String ext = "";
PNGTranscoder t = null;
JPEGTranscoder t1=null;
if (type.equals("image/png")) {
ext = "png";
t = new PNGTranscoder();
t.addTranscodingHint( ImageTranscoder.KEY_BACKGROUND_COLOR, Color.black);
} else if (type.equals("image/jpeg")) {
ext = "jpg";
t1 = new JPEGTranscoder();
t1.addTranscodingHint( ImageTranscoder.KEY_BACKGROUND_COLOR, Color.black);
} /*else if (type.equals("application/pdf")) {
ext = "pdf";
t = new PDFTranscoder();
}*/ else if(type.equals("image/svg+xml"))
ext = "svg";
String dateTime = DateUtils.getDateTime();
response.addHeader("Content-Disposition", "attachment; filename="+ filename+"-"+dateTime + "."+ext);
response.addHeader("Content-Type", type);
if (null != t) {
TranscoderInput input = new TranscoderInput(new StringReader(svg));
TranscoderOutput output = new TranscoderOutput(out);
try {
((SVGAbstractTranscoder) t).transcode(input, output);
} catch (TranscoderException e) {
out.print("Problem transcoding stream. See the web logs for more details.");
e.printStackTrace();
}
} else if (null != t1) {
TranscoderInput input = new TranscoderInput(new StringReader(svg));
TranscoderOutput output = new TranscoderOutput(out);
try {
((SVGAbstractTranscoder) t1).transcode(input, output);
} catch (TranscoderException e) {
out.print("Problem transcoding stream. See the web logs for more details.");
e.printStackTrace();
}
} else if (ext.equals("svg")) {
// out.print(svg);
OutputStreamWriter writer = new OutputStreamWriter(out, "UTF-8");
writer.append(svg);
writer.close();
} else
out.print("Invalid type: " + type);
} else {
response.addHeader("Content-Type", "text/html");
out.println("Usage:\n\tParameter [svg]: The DOM Element to be converted." +
"\n\tParameter [type]: The destination MIME type for the elment to be transcoded.");
}
out.flush();
out.close();
}
}

View File

@@ -101,7 +101,10 @@ public class CollectVoipLogController extends BaseController{
params.put("searchRtpDIp", entry.getRtpDIp());
}
if (StringUtils.isNotBlank(entry.getCapIp())) {
params.put("searchRtpSIp", entry.getCapIp());
params.put("searchCapIp", entry.getCapIp());
}
if (StringUtils.isNotBlank(entry.getRtpSIp())) {
params.put("searchRtpSIp", entry.getRtpSIp());
}
if (StringUtils.isNotBlank(entry.getSipDIp())) {
params.put("searchSipDIp", entry.getSipDIp());

View File

@@ -55,12 +55,12 @@ public class DdosLogController extends BaseController{
Map<String, Object> params=new HashMap<>();
params.put("pageSize", page.getPageSize());
params.put("pageNo", page.getPageNo());
if(entry!=null&&entry.getIsBlock()!=null) {
/*if(entry!=null&&entry.getIsBlock()!=null) {
params.put("searchIsBlock", entry.getIsBlock());
}else {
entry.setIsBlock(1);//默认保护ddos日志
params.put("searchIsBlock", entry.getIsBlock());
}
}*/
//查询值判断
initLogSearchValue(entry,params);

View File

@@ -49,6 +49,7 @@ public interface AppCfgDao {
public List<AppIpCfg> findAppIpList(AppIpCfg entity) ;
public AppIpCfg getAppIpCfg(Long cfgId) ;
public int insertAppIpCfg(AppIpCfg entity);
public int insertAppIpCfgBatch(List<AppIpCfg> list);
public int updateAppIpCfg(AppIpCfg entity);
//app http特征增删改查
public List<AppHttpCfg> findAppHttpList(AppHttpCfg entity) ;

View File

@@ -1709,6 +1709,33 @@
,#{userRegion3,jdbcType=VARCHAR},#{userRegion4,jdbcType=VARCHAR},#{userRegion5,jdbcType=VARCHAR}
)
</insert>
<insert id="insertAppIpCfgBatch" parameterType="com.nis.domain.configuration.AppIpCfg" >
insert into app_ip_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,RATELIMIT,FUNCTION_ID,CFG_TYPE,CFG_REGION_CODE,
IP_TYPE, IP_PATTERN, SRC_IP_ADDRESS,DEST_IP_ADDRESS, PORT_PATTERN,SRC_PORT,DEST_PORT,
DIRECTION,PROTOCOL,DO_LOG,user_region1,user_region2,user_region3,user_region4,user_region5
)values
<foreach collection ="list" item="appIp" separator =",">
(
#{appIp.appCode,jdbcType=INTEGER},#{appIp.behavCode,jdbcType=INTEGER},#{appIp.specServiceId,jdbcType=INTEGER},
#{appIp.cfgDesc,jdbcType=VARCHAR},#{appIp.action,jdbcType=INTEGER},
#{appIp.isValid,jdbcType=INTEGER},#{appIp.isAudit,jdbcType=INTEGER},#{appIp.creatorId,jdbcType=INTEGER},
#{appIp.createTime,jdbcType=TIMESTAMP},#{appIp.editorId,jdbcType=INTEGER},#{appIp.editTime,jdbcType=TIMESTAMP},
#{appIp.auditorId,jdbcType=INTEGER},#{appIp.auditTime,jdbcType=TIMESTAMP},#{appIp.serviceId,jdbcType=INTEGER},
#{appIp.requestId,jdbcType=INTEGER},#{appIp.compileId,jdbcType=INTEGER},#{appIp.isAreaEffective,jdbcType=INTEGER},
#{appIp.classify,jdbcType=VARCHAR},#{appIp.attribute,jdbcType=VARCHAR},#{appIp.lable,jdbcType=VARCHAR},
#{appIp.areaEffectiveIds,jdbcType=VARCHAR},#{appIp.ratelimit,jdbcType=VARCHAR},#{appIp.functionId,jdbcType=INTEGER},
#{appIp.cfgType,jdbcType=VARCHAR},#{appIp.cfgRegionCode,jdbcType=INTEGER},
#{appIp.ipType,jdbcType=INTEGER}, #{appIp.ipPattern,jdbcType=INTEGER},#{appIp.srcIpAddress,jdbcType=VARCHAR},#{appIp.destIpAddress,jdbcType=VARCHAR},
#{appIp.portPattern,jdbcType=INTEGER},#{appIp.srcPort,jdbcType=VARCHAR},#{appIp.destPort,jdbcType=VARCHAR},#{appIp.direction,jdbcType=INTEGER},
#{appIp.protocol,jdbcType=INTEGER},#{appIp.doLog,jdbcType=INTEGER},#{appIp.userRegion1,jdbcType=VARCHAR},#{appIp.userRegion2,jdbcType=VARCHAR}
,#{appIp.userRegion3,jdbcType=VARCHAR},#{appIp.userRegion4,jdbcType=VARCHAR},#{appIp.userRegion5,jdbcType=VARCHAR}
)
</foreach>
</insert>
<insert id="insertAppHttpCfg" parameterType="com.nis.domain.configuration.AppHttpCfg" >
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
SELECT LAST_INSERT_ID()

View File

@@ -0,0 +1,31 @@
package com.nis.web.dao.configuration;
import java.util.List;
import com.nis.domain.configuration.BaseCfg;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.ComplexkeywordCfg;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.web.dao.MyBatisDao;
@MyBatisDao
public interface CommonPolicyDao {
public List<CfgIndexInfo> getPolicyList(CfgIndexInfo entity);
public CfgIndexInfo getPolicyById(Long cfgId);
public List<IpPortCfg> getIpPortList(CfgIndexInfo entity);
public List<BaseStringCfg> getCommonStringList(CfgIndexInfo entity);
public List<ComplexkeywordCfg> getComplexStringList(CfgIndexInfo entity);
public void saveCfgIndex(CfgIndexInfo entity);
public void saveIpPortCfg(IpPortCfg entity);
public void saveCommonStringCfg(BaseStringCfg entity);
public void saveComplexStringCfg(ComplexkeywordCfg entity);
public void updateCfgIndex(CfgIndexInfo entity);
public void deleteIpPortCfg(CfgIndexInfo entity);
public void deleteCommonStringCfg(CfgIndexInfo entity);
public void deleteComplexStringCfg(CfgIndexInfo entity);
public void updateCfgValid(BaseCfg entity);
public void auditCfg(BaseCfg entity);
}

View File

@@ -0,0 +1,736 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.nis.web.dao.configuration.CommonPolicyDao" >
<resultMap id="CfgIndexInfoMap" type="com.nis.domain.configuration.CfgIndexInfo" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="action" property="action" jdbcType="INTEGER" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
<result column="request_id" property="requestId" jdbcType="INTEGER" />
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
<result column="classify" property="classify" jdbcType="VARCHAR" />
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="dns_strategy_id" property="dnsStrategyId" jdbcType="INTEGER" />
<result column="dns_strategy_name" property="dnsStrategyName" jdbcType="VARCHAR" />
<result column="do_log" property="doLog" jdbcType="INTEGER" />
<result column="user_region1" property="userRegion1" jdbcType="VARCHAR" />
<result column="user_region2" property="userRegion2" jdbcType="VARCHAR" />
<result column="user_region3" property="userRegion3" jdbcType="VARCHAR" />
<result column="user_region4" property="userRegion4" jdbcType="VARCHAR" />
<result column="user_region5" property="userRegion5" jdbcType="VARCHAR" />
<result column="source_compile_id" property="sourceCompileId" jdbcType="INTEGER" />
<result column="cancel_request_id" property="cancelRequestId" jdbcType="INTEGER" />
</resultMap>
<resultMap id="ipPortMap" type="com.nis.domain.configuration.IpPortCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="ip_type" property="ipType" jdbcType="INTEGER" />
<result column="ip_pattern" property="ipPattern" jdbcType="INTEGER" />
<result column="dest_ip_address" property="destIpAddress" jdbcType="VARCHAR" />
<result column="src_ip_address" property="srcIpAddress" jdbcType="VARCHAR" />
<result column="dest_port" property="destPort" jdbcType="VARCHAR" />
<result column="src_port" property="srcPort" jdbcType="VARCHAR" />
<result column="port_pattern" property="portPattern" jdbcType="INTEGER" />
<result column="direction" property="direction" jdbcType="INTEGER" />
<result column="protocol" property="protocol" jdbcType="INTEGER" />
<result column="protocol_id" property="protocolId" jdbcType="INTEGER" />
<result column="action" property="action" jdbcType="INTEGER" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
<result column="request_id" property="requestId" jdbcType="INTEGER" />
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
<result column="classify" property="classify" jdbcType="VARCHAR" />
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
</resultMap>
<resultMap id="stringCfgMap" type="com.nis.domain.configuration.BaseStringCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="cfg_keywords" property="cfgKeywords" jdbcType="VARCHAR" />
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
<result column="action" property="action" jdbcType="INTEGER" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
<result column="request_id" property="requestId" jdbcType="INTEGER" />
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
<result column="classify" property="classify" jdbcType="VARCHAR" />
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="expr_type " property="exprType" jdbcType="INTEGER" />
<result column="match_method" property="matchMethod" jdbcType="INTEGER" />
<result column="is_hexbin" property="isHexbin" jdbcType="INTEGER" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
</resultMap>
<resultMap id="complexCfgMap" type="com.nis.domain.configuration.ComplexkeywordCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="cfg_keywords" property="cfgKeywords" jdbcType="VARCHAR" />
<result column="district" property="district" jdbcType="VARCHAR" />
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
<result column="action" property="action" jdbcType="INTEGER" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
<result column="request_id" property="requestId" jdbcType="INTEGER" />
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
<result column="classify" property="classify" jdbcType="VARCHAR" />
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="expr_type " property="exprType" jdbcType="INTEGER" />
<result column="match_method" property="matchMethod" jdbcType="INTEGER" />
<result column="is_hexbin" property="isHexbin" jdbcType="INTEGER" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
</resultMap>
<sql id="ConfigIndex_Column" >
a.CFG_ID,a.CFG_DESC,a.ACTION,a.IS_VALID,a.IS_AUDIT,
a.CREATOR_ID,a.CREATE_TIME,a.EDITOR_ID,a.EDIT_TIME,a.AUDITOR_ID,a.AUDIT_TIME,
a.SERVICE_ID,a.REQUEST_ID,a.COMPILE_ID,a.IS_AREA_EFFECTIVE,a.CLASSIFY,
a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id,a.dns_strategy_id,a.user_region1,
a.user_region2,a.user_region3,a.user_region4,a.user_region5,a.do_log,a.source_compile_id,a.cancel_request_id
</sql>
<sql id="IpCfg_Column" >
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port
,a.protocol,a.protocol_id,a.direction,a.cfg_type,a.action,a.dest_port,a.dest_ip_address
,a.is_valid,a.is_audit,a.creator_id,a.create_time,a.editor_id
,a.edit_time,a.auditor_id,a.audit_time,a.service_id,a.request_id,
a.compile_id,a.is_area_effective,a.classify,a.attribute,a.lable
,a.area_effective_ids,a.function_id,a.cfg_region_code
</sql>
<sql id="StrCfg_Column" >
a.cfg_id,a.cfg_desc,a.cfg_keywords,a.cfg_type,
a.action,a.is_valid,a.is_audit,a.creator_id,a.create_time,a.editor_id,a.edit_time, a.auditor_id,
a.audit_time,a.service_id,a.request_id,a.compile_id,a.is_area_effective,a.classify,a.attribute,a.lable,
a.expr_type,a.match_method,a.is_hexbin,a.area_effective_ids,a.function_id,a.cfg_region_code
</sql>
<sql id="ComplexCfg_Column" >
a.cfg_id,a.cfg_desc,a.cfg_keywords,a.cfg_type,a.district,
a.action,a.is_valid,a.is_audit,a.creator_id,a.create_time,a.editor_id,a.edit_time, a.auditor_id,
a.audit_time,a.service_id,a.request_id,a.compile_id,a.is_area_effective,a.classify,a.attribute,a.lable,
a.expr_type,a.match_method,a.is_hexbin,a.area_effective_ids,a.function_id,a.cfg_region_code
</sql>
<select id="getPolicyList" resultMap="CfgIndexInfoMap" parameterType="com.nis.domain.configuration.CfgIndexInfo" >
SELECT
<include refid="ConfigIndex_Column" />
<trim prefix="," prefixOverrides=",">
, s.name as creator_name,e.name as editor_name,u.name as auditor_name
,ri.request_title as requestName
</trim>
FROM cfg_index_info a
left join sys_user s on a.creator_id=s.id
left join sys_user e on a.editor_id=e.id
left join sys_user u on a.auditor_id=u.id
left join request_info ri on a.request_id=ri.id
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="page !=null and page.where != null and page.where != ''">
AND ${page.where}
</if>
<if test="cfgId != null">
AND a.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND a.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="action != null">
AND a.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="isValid != null">
AND a.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND a.IS_VALID != -1
</if>
<if test="isAudit != null">
AND a.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
<if test="creatorName != null and creatorName != ''">
AND CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
</if>
<if test="editorName != null and editorName != ''">
AND EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
</if>
<if test="auditorName != null and auditorName != ''">
AND AUDITOR_NAME like concat(concat('%',#{auditorName,jdbcType=VARCHAR}),'%')
</if>
<if test="serviceId != null">
AND a.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
AND a.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="compileId != null">
AND a.COMPILE_ID=#{compileId,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND a.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null and classify != ''">
AND a.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null and attribute != ''">
AND a.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null and lable != ''">
AND a.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="areaEffectiveIds != null and areaEffectiveIds != ''">
AND a.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<if test="functionId != null">
AND a.function_id=#{functionId,jdbcType=INTEGER}
</if>
<if test="ipPort!=null">
AND a.compile_id in (select t.compile_id from ip_port_cfg t
<where>
<if test="functionId != null">
AND t.function_id=#{functionId,jdbcType=INTEGER}
</if>
<if test="ipPort.srcIpAddress != null and ipPort.srcIpAddress != ''">
and t.src_ip_address =#{ipPort.srcIpAddress,jdbcType=VARCHAR}
</if>
<if test="ipPort.srcPort != null and ipPort.srcPort != ''">
and t.src_port =#{ipPort.srcPort,jdbcType=VARCHAR}
</if>
<if test="ipPort.destIpAddress != null and ipPort.destIpAddress != ''">
and t.dest_ip_address =#{ipPort.destIpAddress,jdbcType=VARCHAR}
</if>
<if test="ipPort.destPort != null and ipPort.destPort != ''">
and t.dest_port =#{ipPort.destPort,jdbcType=VARCHAR}
</if>
</where>
)
</if>
<if test="strCfg!=null">
AND a.compile_id in (select f.compile_id from common_keyword_cfg f
<where>
<if test="strCfg.cfgKeywords != null and strCfg.cfgKeywords != ''">
AND REPLACE(f.cfg_keywords,'***and***','|') like concat(concat('%',#{strCfg.cfgKeywords,jdbcType=VARCHAR}),'%')
</if>
</where>
)
</if>
<if test="complexCfg!=null">
AND a.compile_id in (select f.compile_id from complex_keyword_cfg f
<where>
<if test="complexCfg.cfgKeywords != null and complexCfg.cfgKeywords != ''">
AND REPLACE(f.cfg_keywords,'***and***','|') like concat(concat('%',#{complexCfg.cfgKeywords,jdbcType=VARCHAR}),'%')
</if>
</where>
)
</if>
<!-- 数据范围过滤 -->
${sqlMap.dsf}
</trim>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY a.CFG_ID desc
</otherwise>
</choose>
</select>
<select id="getPolicyById" resultMap="CfgIndexInfoMap" parameterType="java.lang.Long">
SELECT
<include refid="ConfigIndex_Column" />
FROM cfg_index_info a where cfg_id=#{cfgId}
</select>
<!-- <select id="getCfgIndexList" resultMap="CfgIndexInfoMap" parameterType="com.nis.domain.configuration.CfgIndexInfo">
SELECT
<include refid="ConfigIndex_Column" />
FROM cfg_index_info a
<where>
<if test="cfgId != null">
and cfg_id=#{cfgId}
</if>
<if test="compileId != null">
and compileId=#{compileId}
</if>
<if test="functionId != null">
and function_id=#{functionId}
</if>
</where>
</select> -->
<select id="getIpPortList" resultMap="ipPortMap" parameterType="com.nis.domain.configuration.CfgIndexInfo">
SELECT
<include refid="IpCfg_Column" />
FROM ip_port_cfg a where compile_id=#{compileId} and function_id=#{functionId}
</select>
<select id="getCommonStringList" resultMap="stringCfgMap" parameterType="com.nis.domain.configuration.CfgIndexInfo">
SELECT
<include refid="StrCfg_Column" />
FROM common_keyword_cfg a
<where>
<if test="compileId != null">
AND a.compile_id =#{compileId}
</if>
<if test="functionId != null">
AND a.function_id =#{functionId}
</if>
<if test="cfgType != null and cfgType !='' ">
AND a.cfg_type =#{cfgType}
</if>
</where>
</select>
<select id="getComplexStringList" resultMap="complexCfgMap" parameterType="com.nis.domain.configuration.CfgIndexInfo">
SELECT
<include refid="ComplexCfg_Column" />
FROM complex_keyword_cfg a
<where>
<if test="compileId != null">
AND a.compile_id =#{compileId}
</if>
<if test="functionId != null">
AND a.function_id =#{functionId}
</if>
<if test="cfgType != null and cfgType !='' ">
AND a.cfg_type =#{cfgType}
</if>
</where>
</select>
<insert id="saveCfgIndex" parameterType="com.nis.domain.configuration.CfgIndexInfo" >
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
SELECT LAST_INSERT_ID()
</selectKey>
insert into cfg_index_info(
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,
dns_strategy_id,
user_region1,
user_region2,
user_region3,
user_region4,
user_region5,
do_log,
source_compile_id
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
0,
0,
#{creatorId,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP},
#{editorId,jdbcType=INTEGER},
#{editTime,jdbcType=TIMESTAMP},
#{auditorId,jdbcType=INTEGER},
#{auditTime,jdbcType=TIMESTAMP},
#{serviceId,jdbcType=INTEGER},
#{requestId,jdbcType=INTEGER},
#{compileId,jdbcType=INTEGER},
#{isAreaEffective,jdbcType=INTEGER},
#{classify,jdbcType=VARCHAR},
#{attribute,jdbcType=VARCHAR},
#{lable,jdbcType=VARCHAR},
#{areaEffectiveIds,jdbcType=VARCHAR},
#{functionId,jdbcType=INTEGER},
#{dnsStrategyId,jdbcType=INTEGER},
#{userRegion1,jdbcType=VARCHAR},
#{userRegion2,jdbcType=VARCHAR},
#{userRegion3,jdbcType=VARCHAR},
#{userRegion4,jdbcType=VARCHAR},
#{userRegion5,jdbcType=VARCHAR},
#{doLog,jdbcType=INTEGER},
#{sourceCompileId,jdbcType=INTEGER}
)
</insert>
<!-- insert ip_port_cfg表信息 -->
<insert id="saveIpPortCfg" parameterType="com.nis.domain.configuration.IpPortCfg" >
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
SELECT LAST_INSERT_ID()
</selectKey>
insert into ip_port_cfg (
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,
ip_type,
src_ip_address,
ip_pattern,
port_pattern,
src_port,
protocol,
protocol_id,
direction,
dest_port,
dest_ip_address,
cfg_type,
cfg_region_code,
user_region1,
user_region2,
user_region3,
user_region4,
user_region5
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
0,
0,
#{creatorId,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP},
#{editorId,jdbcType=INTEGER},
#{editTime,jdbcType=TIMESTAMP},
#{auditorId,jdbcType=INTEGER},
#{auditTime,jdbcType=TIMESTAMP},
#{serviceId,jdbcType=INTEGER},
#{requestId,jdbcType=INTEGER},
#{compileId,jdbcType=INTEGER},
#{isAreaEffective,jdbcType=INTEGER},
#{classify,jdbcType=VARCHAR},
#{attribute,jdbcType=VARCHAR},
#{lable,jdbcType=VARCHAR},
#{areaEffectiveIds,jdbcType=VARCHAR},
#{functionId,jdbcType=INTEGER},
#{ipType,jdbcType=INTEGER},
#{srcIpAddress,jdbcType=VARCHAR},
#{ipPattern,jdbcType=INTEGER},
#{portPattern,jdbcType=INTEGER},
#{srcPort,jdbcType=VARCHAR},
#{protocol,jdbcType=INTEGER},
#{protocolId,jdbcType=INTEGER},
#{direction,jdbcType=INTEGER},
#{destPort,jdbcType=VARCHAR},
#{destIpAddress,jdbcType=VARCHAR},
#{cfgType,jdbcType=VARCHAR},
#{cfgRegionCode,jdbcType=INTEGER},
#{userRegion1,jdbcType=VARCHAR},
#{userRegion2,jdbcType=VARCHAR},
#{userRegion3,jdbcType=VARCHAR},
#{userRegion4,jdbcType=VARCHAR},
#{userRegion5,jdbcType=VARCHAR}
)
</insert>
<insert id="saveCommonStringCfg" parameterType="com.nis.domain.configuration.CommonStringCfg" >
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
SELECT LAST_INSERT_ID()
</selectKey>
insert into common_keyword_cfg (
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_keywords,
cfg_type,
cfg_region_code,
expr_type,
match_method,
is_hexbin,
user_region1,
user_region2,
user_region3,
user_region4,
user_region5
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
0,
0,
#{creatorId,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP},
#{editorId,jdbcType=INTEGER},
#{editTime,jdbcType=TIMESTAMP},
#{auditorId,jdbcType=INTEGER},
#{auditTime,jdbcType=TIMESTAMP},
#{serviceId,jdbcType=INTEGER},
#{requestId,jdbcType=INTEGER},
#{compileId,jdbcType=INTEGER},
#{isAreaEffective,jdbcType=INTEGER},
#{classify,jdbcType=VARCHAR},
#{attribute,jdbcType=VARCHAR},
#{lable,jdbcType=VARCHAR},
#{areaEffectiveIds,jdbcType=VARCHAR},
#{functionId,jdbcType=INTEGER},
#{cfgKeywords,jdbcType=VARCHAR},
#{cfgType,jdbcType=VARCHAR},
#{cfgRegionCode,jdbcType=INTEGER},
#{exprType,jdbcType=INTEGER},
#{matchMethod,jdbcType=INTEGER},
#{isHexbin,jdbcType=INTEGER},
#{userRegion1,jdbcType=VARCHAR},
#{userRegion2,jdbcType=VARCHAR},
#{userRegion3,jdbcType=VARCHAR},
#{userRegion4,jdbcType=VARCHAR},
#{userRegion5,jdbcType=VARCHAR}
)
</insert>
<!-- insert http_res_hdr_cfg表信息 -->
<insert id="saveComplexStringCfg" parameterType="com.nis.domain.configuration.ComplexStringCfg" >
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
SELECT LAST_INSERT_ID()
</selectKey>
insert into complex_keyword_cfg (
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,
district,
cfg_keywords,
cfg_type,
cfg_region_code,
expr_type,
match_method,
is_hexbin,
user_region1,
user_region2,
user_region3,
user_region4,
user_region5
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
0,
0,
#{creatorId,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP},
#{editorId,jdbcType=INTEGER},
#{editTime,jdbcType=TIMESTAMP},
#{auditorId,jdbcType=INTEGER},
#{auditTime,jdbcType=TIMESTAMP},
#{serviceId,jdbcType=INTEGER},
#{requestId,jdbcType=INTEGER},
#{compileId,jdbcType=INTEGER},
#{isAreaEffective,jdbcType=INTEGER},
#{classify,jdbcType=VARCHAR},
#{attribute,jdbcType=VARCHAR},
#{lable,jdbcType=VARCHAR},
#{areaEffectiveIds,jdbcType=VARCHAR},
#{functionId,jdbcType=INTEGER},
#{district,jdbcType=VARCHAR},
#{cfgKeywords,jdbcType=VARCHAR},
#{cfgType,jdbcType=VARCHAR},
#{cfgRegionCode,jdbcType=INTEGER},
#{exprType,jdbcType=INTEGER},
#{matchMethod,jdbcType=INTEGER},
#{isHexbin,jdbcType=INTEGER},
#{userRegion1,jdbcType=VARCHAR},
#{userRegion2,jdbcType=VARCHAR},
#{userRegion3,jdbcType=VARCHAR},
#{userRegion4,jdbcType=VARCHAR},
#{userRegion5,jdbcType=VARCHAR}
)
</insert>
<update id="updateCfgIndex" parameterType="com.nis.domain.configuration.CfgIndexInfo" >
update cfg_index_info
<set >
<trim suffixOverrides=",">
<if test="cfgDesc != null and cfgDesc != ''" >
cfg_desc = #{cfgDesc,jdbcType=VARCHAR},
</if>
<if test="action != null" >
action = #{action,jdbcType=INTEGER},
</if>
<if test="doLog != null" >
do_log = #{doLog,jdbcType=INTEGER},
</if>
<if test="isValid != null" >
is_valid = #{isValid,jdbcType=INTEGER},
</if>
<if test="isAudit != null" >
is_audit = #{isAudit,jdbcType=INTEGER},
</if>
<if test="creatorId != null" >
creator_id = #{creatorId,jdbcType=INTEGER},
</if>
<if test="createTime != null and createTime != ''" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="editorId != null" >
editor_id = #{editorId,jdbcType=INTEGER},
</if>
edit_time = #{editTime,jdbcType=TIMESTAMP},
<if test="serviceId != null" >
service_id = #{serviceId,jdbcType=INTEGER},
</if>
<if test="requestId != null" >
request_id = #{requestId,jdbcType=INTEGER},
</if>
<if test="isAreaEffective != null" >
is_area_effective = #{isAreaEffective,jdbcType=INTEGER},
</if>
<if test="classify != null and classify != ''" >
classify = #{classify,jdbcType=VARCHAR},
</if>
<if test="attribute != null and attribute != ''" >
attribute = #{attribute,jdbcType=VARCHAR},
</if>
<if test="lable != null and lable != ''" >
lable = #{lable,jdbcType=VARCHAR},
</if>
<if test="areaEffectiveIds != null" >
area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR},
</if>
<if test="functionId != null" >
function_id = #{functionId,jdbcType=INTEGER},
</if>
user_region1 = #{userRegion1,jdbcType=VARCHAR},
user_region2 = #{userRegion2,jdbcType=VARCHAR},
user_region3 = #{userRegion3,jdbcType=VARCHAR},
user_region4 = #{userRegion4,jdbcType=VARCHAR},
user_region5 = #{userRegion5,jdbcType=VARCHAR},
</trim>
</set>
where cfg_id = #{cfgId,jdbcType=BIGINT}
</update>
<!-- 删除子配置 -->
<delete id="deleteIpPortCfg" >
delete from ip_port_cfg where compile_id=#{compileId} and function_id=#{functionId}
</delete>
<delete id="deleteCommonStringCfg">
delete from common_keyword_cfg where compile_id=#{compileId} and function_id=#{functionId}
</delete>
<delete id="deleteComplexStringCfg">
delete from complex_keyword_cfg where compile_id=#{compileId} and function_id=#{functionId}
</delete>
<update id="updateCfgValid" parameterType="com.nis.domain.configuration.BaseCfg">
update ${tableName} set is_valid = #{isValid,jdbcType=INTEGER},
editor_id = #{editorId,jdbcType=INTEGER} ,
edit_time = #{editTime,jdbcType=TIMESTAMP}
<if test="isAudit !=null ">
,is_audit = #{isAudit,jdbcType=BIGINT}
</if>
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="cfgId !=null ">
AND cfg_id = #{cfgId,jdbcType=BIGINT}
</if>
<if test="compileId !=null ">
AND compile_id = #{compileId,jdbcType=INTEGER}
</if>
and function_id=#{functionId,jdbcType=INTEGER}
</trim>
</update>
<update id="auditCfg" parameterType="com.nis.domain.configuration.BaseCfg">
update ${tableName} set is_audit = #{isAudit,jdbcType=INTEGER},
auditor_id = #{auditorId,jdbcType=INTEGER},
audit_time = #{auditTime,jdbcType=TIMESTAMP}
<if test="isValid != null" >
,is_valid = #{isValid,jdbcType=INTEGER}
</if>
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="cfgId !=null ">
AND cfg_id = #{cfgId,jdbcType=BIGINT}
</if>
<if test="compileId !=null ">
AND compile_id = #{compileId,jdbcType=INTEGER}
</if>
and function_id=#{functionId,jdbcType=INTEGER}
</trim>
</update>
</mapper>

View File

@@ -1,10 +1,13 @@
package com.nis.web.service;
import java.io.IOException;
import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -20,6 +23,12 @@ import com.google.gson.JsonElement;
import com.google.gson.JsonPrimitive;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import com.google.gson.TypeAdapter;
import com.google.gson.internal.LinkedTreeMap;
import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import com.google.gson.stream.JsonWriter;
import com.googlecode.ipv6.IPv6Address;
import com.googlecode.ipv6.IPv6Network;
import com.nis.domain.SysRole;
@@ -248,7 +257,66 @@ public abstract class BaseService {
return Configurations.getStringProperty(tableName, null);
}
public static class MapTypeAdapter extends TypeAdapter<Object> {
@Override
public Object read(JsonReader in) throws IOException {
JsonToken token = in.peek();
switch (token) {
case BEGIN_ARRAY:
List<Object> list = new ArrayList<Object>();
in.beginArray();
while (in.hasNext()) {
list.add(read(in));
}
in.endArray();
return list;
case BEGIN_OBJECT:
Map<String, Object> map = new LinkedTreeMap<String, Object>();
in.beginObject();
while (in.hasNext()) {
map.put(in.nextName(), read(in));
}
in.endObject();
return map;
case STRING:
return in.nextString();
case NUMBER:
String temp = in.nextString();
BigDecimal dbNum = new BigDecimal(temp);
BigDecimal maxLong = new BigDecimal(Long.MAX_VALUE);
BigDecimal maxInteger = new BigDecimal(Integer.MAX_VALUE);
// 数字超过long的最大值返回BigDecimal类型
if (dbNum.compareTo(maxLong)==1) {
return dbNum;
}else if(dbNum.compareTo(maxInteger)==1){
long lngNum = Long.parseLong(temp);
return lngNum;
}else{
int lngNum = Integer.parseInt(temp);
return lngNum;
}
case BOOLEAN:
return in.nextBoolean();
case NULL:
in.nextNull();
return null;
default:
throw new IllegalStateException();
}
}
@Override
public void write(JsonWriter out, Object value) throws IOException {
// 序列化无需实现
}
}
/**
* 转换成字符串
* @param obj
@@ -269,6 +337,19 @@ public abstract class BaseService {
}).create();
return gson.toJson(obj);
}
/**
* 字符串转成对象
* @param jsonString
* @param cls
* @return
*/
public static <T> T gsonFromJson(String jsonString,Class<T> cls){
Gson gson = new GsonBuilder()
.registerTypeAdapter(new TypeToken<Map>() {}.getType(), new MapTypeAdapter())
.registerTypeAdapter(new TypeToken<List>() {}.getType(), new MapTypeAdapter())
.create();
return gson.fromJson(jsonString, cls);
}
/**
* 界面配置list转换为服务接口端的list
* @param <T>

View File

@@ -235,7 +235,6 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
public void saveAsnIpBatch(List<AsnIpCfg> cfgs){
//需要通过新增域接口新增的ip集合
List<AsnIpCfg> toAddRegionAsnIpCfgs=Lists.newArrayList();
logger.warn("process configGroupInfo and delete IP start");
long start=System.currentTimeMillis();
for(AsnIpCfg cfg:cfgs) {
if(Constants.VALID_YES==cfg.getIsValid().intValue()) {
@@ -243,10 +242,9 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
}
}
long end=System.currentTimeMillis();
logger.warn("process configGroupInfo and delete IP finish,cost:"+(end-start));
this.save(cfgs);
cfgs.clear();
splitAndSend(toAddRegionAsnIpCfgs,Constants.VALID_YES);
cfgs.clear();
toAddRegionAsnIpCfgs.clear();
}
/**

View File

@@ -1,5 +1,6 @@
package com.nis.web.service.configuration;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -13,7 +14,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.google.common.collect.Lists;
import com.nis.domain.Page;
import com.nis.domain.basics.AsnIpCfg;
import com.nis.domain.basics.Varibles;
import com.nis.domain.configuration.AppByteCfg;
import com.nis.domain.configuration.AppDomainCfg;
import com.nis.domain.configuration.AppHeaderCfg;
@@ -48,6 +52,7 @@ import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.StringUtil;
import com.nis.util.StringUtils;
import com.nis.web.dao.basics.AsnIpCfgDao;
import com.nis.web.dao.configuration.AppCfgDao;
import com.nis.web.dao.configuration.AreaIpCfgDao;
import com.nis.web.dao.configuration.IpCfgDao;
@@ -78,6 +83,8 @@ public class AppCfgService extends BaseService {
protected SpecificServiceCfgDao specificServiceCfgDao;
@Autowired
protected ConfigGroupInfoDao configGroupInfoDao;
@Autowired
protected AsnIpCfgDao asnIpCfgDao;
public Page<AppPolicyCfg> findAppPolicyList(Page<AppPolicyCfg> page, AppPolicyCfg entity) {
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(), "r"));
@@ -326,6 +333,8 @@ public class AppCfgService extends BaseService {
*/
@Transactional(readOnly = false, rollbackFor = RuntimeException.class)
public void saveAppIpCfg(List<BaseIpCfg> cfgs,SpecificServiceCfg specificServiceCfg){
logger.warn("Start to save IP");
long start=System.currentTimeMillis();
ConfigGroupInfo configGroupInfo=configGroupInfoDao.getConfigGroupInfoByGroupId(specificServiceCfg.getGroupId());
if(configGroupInfo==null) {//一般特定服务的组号是新增之后就有的,不会进入这一步。
Integer groupId = ConfigServiceUtil.getId(2, 1).get(0);
@@ -343,12 +352,31 @@ public class AppCfgService extends BaseService {
specificServiceCfgDao.update(specificServiceCfg);
}
Integer compileId = configGroupInfo.getCompileId();
Varibles maxPacket=asnIpCfgDao.getVaribles("max_allowed_packet");
List<AppIpCfg> tempList=Lists.newArrayList();
int len=0;
for(BaseIpCfg cfg:cfgs) {
AppIpCfg entity=new AppIpCfg();
BeanUtils.copyProperties(cfg, entity);
entity.setCompileId(compileId);
appCfgDao.insertAppIpCfg(entity);
int tempLen=entity.toString().getBytes(Charset.forName("UTF-8")).length;
if((len+tempLen)<maxPacket.getValue().longValue()) {
tempList.add(entity);
len+=tempLen;
}else {
appCfgDao.insertAppIpCfgBatch(tempList);
tempList.clear();
tempList.add(entity);
len=tempLen;
}
}
if(tempList.size()>0) {
logger.warn("save ip size:"+tempList.size());
appCfgDao.insertAppIpCfgBatch(tempList);
tempList.clear();
}
long end=System.currentTimeMillis();
logger.warn("Save IP finish,cost:"+(end-start));
}
@Transactional(readOnly = false, rollbackFor = RuntimeException.class)
public void saveOrUpdateAppIpCfg(AppIpCfg entity) throws Exception {

View File

@@ -0,0 +1,339 @@
package com.nis.web.service.configuration;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import net.sf.json.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.nis.domain.Page;
import com.nis.domain.configuration.AreaIpCfg;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.CommonStringCfg;
import com.nis.domain.configuration.HttpBodyCfg;
import com.nis.domain.configuration.HttpReqHeadCfg;
import com.nis.domain.configuration.HttpResHeadCfg;
import com.nis.domain.configuration.HttpUrlCfg;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.configuration.NtcSubscribeIdCfg;
import com.nis.domain.maat.MaatCfg;
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.ToMaatBean;
import com.nis.domain.maat.ToMaatResult;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.StringUtil;
import com.nis.web.dao.configuration.AreaIpCfgDao;
import com.nis.web.dao.configuration.CommonPolicyDao;
import com.nis.web.dao.configuration.StringCfgDao;
import com.nis.web.dao.configuration.WebsiteCfgDao;
import com.nis.web.security.UserUtils;
import com.nis.web.service.BaseService;
import com.nis.web.service.CrudService;
/**
* 代理缓存相关配置事务类
* @author zhangwei
*
*/
@Service
public class CachePolicyService extends CrudService<WebsiteCfgDao,CfgIndexInfo> {
@Autowired
protected CommonPolicyDao commonPolicyDao;
@Autowired
protected AreaIpCfgDao areaIpCfgDao;
@Autowired
protected StringCfgDao stringCfgDao;
public CfgIndexInfo getCachePolicy(Long cfgId){
CfgIndexInfo entity = commonPolicyDao.getPolicyById(cfgId);
entity.setUserRegion((Map<String,Object>)this.gsonFromJson(entity.getUserRegion1(),Map.class));
List<BaseStringCfg> stringList = commonPolicyDao.getCommonStringList(entity);
entity.setStringList(stringList);
return entity;
}
/*public Map<String, List> exportCachePolicy(CfgIndexInfo entity){
Map<String, List> dataMap=new HashMap<String, List>();
List<HttpUrlCfg> httpUrlList = commonPolicyDao.getHttpUrlList(entity);
List<HttpReqHeadCfg> httpReqHdrList = commonPolicyDao.getHttpReqHdrList(entity);
List<HttpResHeadCfg> httpResHdrList = commonPolicyDao.getHttpResHdrList(entity);
List<IpPortCfg> ipPortCfgList = commonPolicyDao.getIpPortList(entity);
entity.setCfgType(Constants.HTTP_REDIRECT_REQ_BODY_REGION);
List<HttpBodyCfg> httpReqBodyList = commonPolicyDao.getHttpReqBodyList(entity);
entity.setCfgType(Constants.HTTP_REDIRECT_RES_BODY_REGION);
List<HttpBodyCfg> httpResBodyList = commonPolicyDao.getHttpResBodyList(entity);
List<NtcSubscribeIdCfg> subscribeIdList = stringCfgDao.findSubscribeIdCfgListByCfgIndexInfo(entity);
dataMap.put("NTC_UNIVERSAL_IP", ipPortCfgList);
dataMap.put("NTC_CACHE_URL", httpUrlList);
dataMap.put("NTC_HTTP_REQ_HDR", httpReqHdrList);
dataMap.put("NTC_HTTP_RES_HDR", httpResHdrList);
dataMap.put("NTC_HTTP_REQ_BODY", httpReqBodyList);
dataMap.put("NTC_HTTP_RES_BODY", httpResBodyList);
dataMap.put("NTC_SUBSCRIBE_ID", subscribeIdList);
return dataMap;
}*/
public Page<CfgIndexInfo> getCachePolicyList(Page<CfgIndexInfo> page, CfgIndexInfo entity){
// 生成数据权限过滤条件dsf为dataScopeFilter的简写在xml中使用 ${sqlMap.dsf}调用权限SQL
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"a"));
entity.setPage(page);
List<CfgIndexInfo> list = commonPolicyDao.getPolicyList(entity);
for(CfgIndexInfo c:list){
c.setUserRegion((Map<String,Object>)this.gsonFromJson(c.getUserRegion1(),Map.class));
}
page.setList(list);
return page;
}
public void saveCachePolicy(CfgIndexInfo entity){
//设置区域运营商信息
setAreaEffectiveIds(entity);
if(entity.getCfgId()==null){
Integer compileId = 0;
try {
//处理复杂用户自定义域
if(!StringUtil.isEmpty(entity.getUserRegion())){
entity.setUserRegion1(gsonToJson(entity.getUserRegion()));
}
System.out.println(entity.getUserRegion1());
List<Integer> idList = ConfigServiceUtil.getId(1, 1);
if(idList!=null && idList.size()>0){
compileId = idList.get(0);
}
entity.setCompileId(compileId);
entity.setCreateTime(new Date());
entity.setCreatorId(entity.getCurrentUser().getId());
commonPolicyDao.saveCfgIndex(entity);
if(entity.getStringList()!=null){
for(BaseStringCfg cfg:entity.getStringList()){
if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
commonPolicyDao.saveCommonStringCfg(cfg);
}
}
}
//保存区域IP信息
if(entity.getAreaCfg()!=null){
for(AreaIpCfg cfg:entity.getAreaCfg()){
cfg.initDefaultValue();
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
areaIpCfgDao.saveAreaIpCfg(cfg);
}
}
} catch (Exception e) {
e.printStackTrace();
logger.info("数据保存出错");
throw e;
}
}else{
//处理复杂用户自定义域
if(!StringUtil.isEmpty(entity.getUserRegion())){
entity.setUserRegion1(gsonToJson(entity.getUserRegion()));
}
System.out.println(entity.getUserRegion1());
// 审核未通过状态的配置 修改后状态改为未审核
entity.setIsValid(0);
entity.setIsAudit(0);
entity.setEditorId(UserUtils.getUser().getId());
entity.setEditTime(new Date());
commonPolicyDao.updateCfgIndex(entity);
//无效子配置后,再新增子配置
commonPolicyDao.deleteCommonStringCfg(entity);
AreaIpCfg area = new AreaIpCfg();
area.setCompileId(entity.getCompileId());
area.setFunctionId(entity.getFunctionId());
areaIpCfgDao.deleteAreaIpCfg(area);
entity.setCreateTime(new Date());
entity.setCreatorId(entity.getCurrentUser().getId());
if(entity.getStringList()!=null){
for(BaseStringCfg cfg:entity.getStringList()){
if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
commonPolicyDao.saveCommonStringCfg(cfg);
}
}
}
//保存区域IP信息
if(entity.getAreaCfg()!=null){
for(AreaIpCfg cfg:entity.getAreaCfg()){
cfg.initDefaultValue();
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgDesc","cfgRegionCode","cfgType"});
areaIpCfgDao.saveAreaIpCfg(cfg);
}
}
}
}
public void updateCachePolicyValid(Integer isValid,String ids,Integer functionId){
String[] idArray = ids.split(",");
for(String id :idArray){
CfgIndexInfo entity = new CfgIndexInfo();
entity.setCfgId(Long.parseLong(id));
entity.setIsValid(isValid);
entity.setEditorId(UserUtils.getUser().getId());
entity.setEditTime(new Date());
entity.setTableName(CfgIndexInfo.getTablename());
entity.setFunctionId(functionId);
commonPolicyDao.updateCfgValid(entity);
//查询子配置
entity = this.getCachePolicy(Long.parseLong(id));
if(entity.getStringList()!=null && entity.getStringList().size()>0){
CommonStringCfg cfg = new CommonStringCfg();
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
cfg.setTableName(CommonStringCfg.getTablename());
commonPolicyDao.updateCfgValid(cfg);
}
//保存区域IP信息
if(entity.getAreaCfg()!=null && entity.getAreaCfg().size()>0){
AreaIpCfg cfg = new AreaIpCfg();
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
cfg.setTableName(AreaIpCfg.getTablename());
commonPolicyDao.updateCfgValid(cfg);
}
}
}
public void auditCachePolicy(CfgIndexInfo entity,Integer isAudit) throws MaatConvertException{
//修改数据库审核状态信息
entity.setTableName(CfgIndexInfo.getTablename());
commonPolicyDao.auditCfg(entity);
ToMaatBean maatBean = new ToMaatBean();
MaatCfg maatCfg = new MaatCfg();
List<MaatCfg> configCompileList = new ArrayList();
List<GroupCfg> groupRelationList = new ArrayList();
List<IpCfg> ipRegionList = new ArrayList();
List<StringCfg> strRegionList = new ArrayList();
List<NumBoundaryCfg> numRegionList = new ArrayList();
List<DigestCfg> digestRegionList = new ArrayList();
List<IpCfg> areaIpRegionList = new ArrayList();
//查询子配置并修改审核状态
entity = this.getCachePolicy(entity.getCfgId());
if(entity.getIpPortList()!=null && entity.getIpPortList().size()>0){
IpPortCfg cfg = new IpPortCfg();
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
cfg.setTableName(IpPortCfg.getTablename());
commonPolicyDao.auditCfg(cfg);
if(isAudit==1){
Map<String,List> map = cfgConvert(ipRegionList,entity.getIpPortList(),1,entity,groupRelationList);
groupRelationList=map.get("groupList");
ipRegionList=map.get("dstList");
if(map.get("numRegionList")!=null){
numRegionList.addAll(map.get("numRegionList"));
}
}
}
if(entity.getStringList()!=null && entity.getStringList().size()>0){
CommonStringCfg cfg = new CommonStringCfg();
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
cfg.setTableName(CommonStringCfg.getTablename());
commonPolicyDao.auditCfg(cfg);
if(isAudit==1){
Map<String,List> map = cfgConvert(strRegionList,entity.getStringList(),2,entity,groupRelationList);
groupRelationList=map.get("groupList");
strRegionList=map.get("dstList");
}
}
//保存区域IP信息
List<AreaIpCfg> areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId());
if(!StringUtil.isEmpty(areaIpCfgList)){
AreaIpCfg cfg = new AreaIpCfg();
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
cfg.setTableName(AreaIpCfg.getTablename());
commonPolicyDao.auditCfg(cfg);
if(isAudit==1){
Map<String,List> map = cfgConvert(areaIpRegionList,areaIpCfgList,1,entity,groupRelationList);
groupRelationList=map.get("groupList");
areaIpRegionList=map.get("dstList");
}
}
//构造提交综合服务参数格式,一条配置提交一次综合服务
if(isAudit==1){
maatCfg.initDefaultValue();
BeanUtils.copyProperties(entity, maatCfg);
maatCfg.setAction(entity.getAction());
maatCfg.setAuditTime(entity.getAuditTime());
maatCfg.setIpRegionList(ipRegionList);
maatCfg.setStrRegionList(strRegionList);
maatCfg.setNumRegionList(numRegionList);
maatCfg.setDigestRegionList(digestRegionList);
maatCfg.setGroupRelationList(groupRelationList);
maatCfg.setGroupNum(groupRelationList.size());
maatCfg.setAreaIpRegionList(areaIpRegionList);
maatCfg.setIsValid(entity.getIsValid());
//判断代理缓存策略是否需要设置自定义域参数
/*String userRegion = "";
userRegion=Constants.REPLACE_ZONE_KEY+"="+entity.getUserRegion1();
String substitute="";
String userRegion2=StringUtil.isEmpty(entity.getUserRegion2()) ? "":entity.getUserRegion2();
substitute="/";
userRegion2 = BaseService.replaceContentEscape(userRegion2);
substitute=substitute+userRegion2;
String userRegion3=StringUtil.isEmpty(entity.getUserRegion3()) ? "":entity.getUserRegion3();
userRegion3 = BaseService.replaceContentEscape(userRegion3);
substitute=substitute+"/"+userRegion3;
userRegion=userRegion+";"+Constants.REPLACE_SUBSTITUTE_KEY+"="+substitute;
if(StringUtil.isEmpty(userRegion)){
userRegion=Constants.USER_REGION_PLACEHOLDER;
}*/
maatCfg.setUserRegion(entity.getUserRegion1());
configCompileList.add(maatCfg);
maatBean.setConfigCompileList(configCompileList);
maatBean.setAuditTime(entity.getAuditTime());
maatBean.setCreatorName(entity.getCurrentUser().getName());
maatBean.setVersion(Constants.MAAT_VERSION);
maatBean.setOpAction(Constants.INSERT_ACTION);
//调用服务接口下发配置数据
String json=gsonToJson(maatBean);
logger.info("代理缓存策略下发配置参数:"+json);
//调用服务接口下发配置
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
logger.info("代理缓存策略下发响应信息:"+result.getMsg());
}else if(isAudit==3){
maatCfg.setCompileId(entity.getCompileId());
maatCfg.setServiceId(entity.getServiceId());
maatCfg.setIsValid(0);//无效
configCompileList.add(maatCfg);
maatBean.setConfigCompileList(configCompileList);
maatBean.setAuditTime(entity.getAuditTime());
maatBean.setCreatorName(entity.getCurrentUser().getName());
maatBean.setVersion(Constants.MAAT_VERSION);
maatBean.setOpAction(Constants.UPDATE_ACTION);
//调用服务接口取消配置
String json=gsonToJson(maatBean);
logger.info("代理缓存策略下发配置参数:"+json);
//调用服务接口下发配置
ToMaatResult result = ConfigServiceUtil.put(json,1);
logger.info("代理缓存策略取消配置响应信息:"+result.getMsg());
}
}
}

View File

@@ -18,9 +18,17 @@ import com.nis.domain.callback.InlineIp;
import com.nis.domain.configuration.BaseIpCfg;
import com.nis.domain.configuration.DdosIpCfg;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.maat.MaatCfg;
import com.nis.domain.maat.ToMaatBean;
import com.nis.domain.maat.ToMaatResult;
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.exceptions.MaatConvertException;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.StringUtil;
import com.nis.web.dao.configuration.DdosCfgDao;
import com.nis.web.security.UserUtils;
@@ -141,7 +149,7 @@ public class DdosCfgService extends BaseService{
* @param ids cfgId
* @param functionId
*/
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
/* @Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void audit(Integer isAudit,Integer isValid,Integer functionId,String id,Date auditTime){
DdosIpCfg entity = new DdosIpCfg();
@@ -211,5 +219,111 @@ public class DdosCfgService extends BaseService{
}
}
}*/
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void audit(Integer isAudit,Integer isValid,Integer functionId,String id,Date auditTime) throws Exception{
DdosIpCfg entity = new DdosIpCfg();
entity=ddosCfgDao.getDdosIpCfg(Long.valueOf(id));
List<DdosIpCfg> list = new ArrayList();
entity.setCfgId(Long.valueOf(id));
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(auditTime);
ddosCfgDao.update(entity);
String antiddosProtocol = entity.getAntiddosProtocol();
Long bpsThreadshold = entity.getBpsThreadshold();
Long ppsThreadshold = entity.getPpsThreadshold();
Map umap= new HashMap();
if(StringUtil.isBlank(antiddosProtocol)) {
antiddosProtocol="";
}
if(bpsThreadshold==null) {
bpsThreadshold=0l;
}
if(ppsThreadshold==null) {
ppsThreadshold=0l;
}
umap.put("protocol", antiddosProtocol);
umap.put("bps_threadshold", bpsThreadshold);
umap.put("pps_threadshold", ppsThreadshold);
String userRegion = new Gson().toJson(umap);
ToMaatBean maatBean = new ToMaatBean();
MaatCfg maatCfg = new MaatCfg();
List<MaatCfg> configCompileList = new ArrayList();
List<GroupCfg> groupRelationList = new ArrayList();
List<IpCfg> ipRegionList = new ArrayList();
List<StringCfg> strRegionList = new ArrayList();
List<NumBoundaryCfg> numRegionList = new ArrayList();
List<DigestCfg> digestRegionList = new ArrayList();
List<IpCfg> areaIpRegionList = new ArrayList();
entity=this.getDdosIpCfg(entity.getCfgId());
if(entity.getIsAudit()==1){
List<DdosIpCfg> ipList=new ArrayList<DdosIpCfg>();
ipList.add(entity);
if(!StringUtil.isEmpty(ipList)){
Map<String,List> ipMap = cfgConvert(ipRegionList,ipList,1,entity,groupRelationList);
groupRelationList=ipMap.get("groupList");
ipRegionList=ipMap.get("dstList");
if(ipMap.get("numRegionList")!=null){
numRegionList.addAll(ipMap.get("numRegionList"));
}
}
//调用服务接口下发配置数据
maatCfg.initDefaultValue();
BeanUtils.copyProperties(entity, maatCfg);
maatCfg.setAction(entity.getAction());
maatCfg.setAuditTime(auditTime);
maatCfg.setIpRegionList(ipRegionList);
maatCfg.setStrRegionList(strRegionList);
maatCfg.setNumRegionList(numRegionList);
maatCfg.setDigestRegionList(digestRegionList);
maatCfg.setGroupRelationList(groupRelationList);
maatCfg.setGroupNum(groupRelationList.size());
maatCfg.setAreaIpRegionList(areaIpRegionList);
maatCfg.setIsValid(entity.getIsValid());
maatCfg.setUserRegion(userRegion);// 自定义域
configCompileList.add(maatCfg);
maatBean.setConfigCompileList(configCompileList);
maatBean.setAuditTime(auditTime);
maatBean.setCreatorName(entity.getCurrentUser().getName());
maatBean.setVersion(Constants.MAAT_VERSION);
maatBean.setOpAction(Constants.INSERT_ACTION);
//调用服务接口下发配置数据
String json=gsonToJson(maatBean);
logger.info("ddos 配置下发配置参数:"+json);
//调用服务接口下发配置
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
logger.info("ddos 配置下发响应信息:"+result.getMsg());
}else if(entity.getIsAudit()==3){
maatCfg.setCompileId(entity.getCompileId());
maatCfg.setServiceId(entity.getServiceId());
maatCfg.setIsValid(0);//无效
configCompileList.add(maatCfg);
maatBean.setConfigCompileList(configCompileList);
maatBean.setAuditTime(auditTime);
maatBean.setCreatorName(entity.getCurrentUser().getName());
maatBean.setVersion(Constants.MAAT_VERSION);
maatBean.setOpAction(Constants.UPDATE_ACTION);
//调用服务接口取消配置
String json=gsonToJson(maatBean);
logger.info("ddos 配置下发配置参数:"+json);
//调用服务接口下发配置
ToMaatResult result = ConfigServiceUtil.put(json,1);
logger.info("ddos 配置取消配置响应信息:"+result.getMsg());
}
}
}

View File

@@ -22,25 +22,25 @@ choose=Choose
onloading=Loading...
requestInfo=Official Letter
configuration_manage=Policies
text_control=Text Routine Control
text_control=Text Routine Block
text_monitor=Text Routine Monitor
text_enhance_manage=Text Enhance Control
text_enhance_manage=Text Enhance Block
text_enhance_monitor=Text Enhance Monitor
plaintext_manage=Plaintext Control
plaintext_manage=Plaintext Block
control_white=White List
ip_control_white=Ip White List
control_grey=Grey List
social_app_grey=Application Grey List
encryption_control=Encrypted Text Control
specific_agreement_control=Specific Protocol Control
encryption_control=Encrypted Text Block
specific_agreement_control=Specific Protocol Block
social_app_control=App Identify
online_media_control=Media Addr
sip_ip_control=SIP IP Control
sip_ip_control=SIP IP Block
domain_control_white=Domain White List
ip_address_control=IP
ip_control=IP Address
ip_redirect=IP Redirect
domain_control=Domain Control
domain_control=Domain Block
dns_control=DNS
basic_configuration=Basic Configuration
Request_from=Letter Office
@@ -54,20 +54,20 @@ effect_range=Effective Range
agreement_ip_configuration=Protocol IP
ip_spoofing_configuration=Spoofing IP
website_control=Website
host_control=HOST Control
url_control=URL Control
website_keyword_control=Website Keyword Control
host_control=HOST Block
url_control=URL Block
website_keyword_control=Website Keyword Block
mail_control=Mail
recipient_control=Recipient Control
sender_control=Sender Control
subject_control=Subject Control
mail_keyword_control=Mail Keyword Control
mail_attachment_name_control=Mail Attachment Name Control
mail_attachment_content_control=Mail Attachment Content Control
recipient_control=Recipient Block
sender_control=Sender Block
subject_control=Subject Block
mail_keyword_control=Mail Keyword Block
mail_attachment_name_control=Mail Attachment Name Block
mail_attachment_content_control=Mail Attachment Content Block
file_transfer_control=File Transfer
ftp_address_control=FTP Url Control
ftp_name_control=FTP Filename Control
ftp_content_control=FTP File Content Control
ftp_address_control=FTP Url Block
ftp_name_control=FTP Filename Block
ftp_content_control=FTP File Content Block
http_app_feature=Application HTTP Feature
ssl_app_feature=Application SSL Feature
tunnel_protocol_control=Tunnel Protocol
@@ -80,15 +80,15 @@ ike_control=IKE
ipsec_control=IPSEC
ssh_control=SSH
ssl_control=SSL
ssl_feature_control=SSL Cert Control
ssl_sni_control=SSL SNI Control
ssl_address_control=SSL IP Control
ssl_feature_control=SSL Cert Block
ssl_sni_control=SSL SNI Block
ssl_address_control=SSL IP Block
HTTP(s)_website_content_replace=HTTPS Website Replace
https_website_control=HTTP(s) Website Replace
rtp_ip_control=RTP IP Control
mms_ip_control=MMS IP Control
rtsp_ip_control=RTSP IP Control
rtmp_ip_control=RTMP IP Control
rtp_ip_control=RTP IP Block
mms_ip_control=MMS IP Block
rtsp_ip_control=RTSP IP Block
rtmp_ip_control=RTMP IP Block
examine_manage=Confirmation
audit_manage=Audit
log_search=Logs
@@ -98,11 +98,11 @@ system_service_manage=System Service
features_area=Feature Area
attribute_manage=Attribute
isp_manage=ISP
ip_multiple_control=IP Multiple Control
ip_port_control=IP+PORT Control
website_multiple_control=Website Multiple Control
ip_multiple_control=IP Multiple Block
ip_port_control=IP+PORT Block
website_multiple_control=Website Multiple Block
mail_multiple_control=Mail Advanced
request_header_control=Http Request Header Control
request_header_control=Http Request Header Block
plaintext_monitor=Plaintext Monitor
ip_address_monitor=IP Monitor
ip_port_monitor=IP+Port Monitor
@@ -148,20 +148,20 @@ ftp_multi_monitor=FTP Multiple Monitor
ssl_multi_monitor=SSL Multiple Monitor
dns_request_monitor=DNS Request Monitor
dns_server_monitor=DNS Host Monitor
request_header_keyword_control=Request Header Keyword Control
response_header_keyword_control=Response Header Keyword Control
mail_key_control=Mail Keyword Control
ftp_multi_control=FTP Multiple Control
request_header_keyword_control=Request Header Keyword Block
response_header_keyword_control=Response Header Keyword Block
mail_key_control=Mail Keyword Block
ftp_multi_control=FTP Multiple Block
ftp_control=FTP
p2p_control=P2P
tunnel_protocol_multi_control=Tunnel Multiple Control
l2tp_protocol_control=L2TP Control
pptp_protocol_control=PPTP Control
ssl_multi_control=SSL Multiple Control
ssl_certificate_control=SSL Cert Control
tunnel_protocol_multi_control=Tunnel Multiple Block
l2tp_protocol_control=L2TP Block
pptp_protocol_control=PPTP Block
ssl_multi_control=SSL Multiple Block
ssl_certificate_control=SSL Cert Block
ssl_certificate_monitor=SSL Cert Monitor
response_header_control=Response Header Control
ip_website_text_control=IP+Website Keyword Control
response_header_control=Response Header Block
ip_website_text_control=IP+Website Keyword Block
request_task=Letter and Task
realtime_report=Statistics
protocol_and_app=Protocol And App
@@ -327,8 +327,8 @@ client_address_mask=Client IP Mask
server_port=Server Port
server_port_mask=Server Port Mask
server_address_mask=Server IP Mask
block_addr=Ip Control
block_domain=Domain Control
block_addr=Ip Block
block_domain=Domain Block
block_url=Block URL
configuration=Configuration
direction=Direction
@@ -440,7 +440,7 @@ icon=Icon
is_top_menu_info=Whether This Menu Is The Top Navigation Menu
sort_info=Sort Asc
is_show_sysmenu=Whether This Menu Is Display On The System Menu
control_permission_info=Permission Identity Defined In The Controller,Such As\:@RequiresPermissions("Permission Identity")
control_permission_info=Permission Identity Defined In The Blockler,Such As\:@RequiresPermissions("Permission Identity")
role_name=Role Name
data_range=Data Scope
allot=Allot
@@ -469,16 +469,16 @@ area_control_type=Effective Range Type
whitelist=White List
ip_whitelist=IP White List
domain_whitelist=Domain White List
dns_ip_control=DNS IP Control
dns_domain_control=DNS Domain Control
http_req_control=HTTP Request Control
http_ip_control=HTTP IP Control
http_url_control=HTTP URL Control
http_req_hdr_control=HTTP Request Header Control
http_req_body_control=HTTP Request Body Control
http_res_control=HTTP Response Control
http_res_hdr_control=HTTP Response Header Control
http_res_body_control=HTTP Response Header Control
dns_ip_control=DNS IP Block
dns_domain_control=DNS Domain Block
http_req_control=HTTP Request Block
http_ip_control=HTTP IP Block
http_url_control=HTTP URL Block
http_req_hdr_control=HTTP Request Header Block
http_req_body_control=HTTP Request Body Block
http_res_control=HTTP Response Block
http_res_hdr_control=HTTP Response Header Block
http_res_body_control=HTTP Response Header Block
av_control=Media Addr
av_content_ip_control=Audio/Video IP
av_picture_ip_control=Picture IP
@@ -640,9 +640,9 @@ mail_to=Recipient
subject=Subject
eml_file=EML File
eml_key=EML File Key
contrl_tunnel=Control Tunnel
contrl_tunnel=Block Tunnel
data_tunnel=Data Tunnel
contrl_message=Control Message
contrl_message=Block Message
data_message=Data Message
user_name=User Name
attack_type=Attack Type
@@ -687,7 +687,7 @@ behavior_protocol=Behavior Protocol
intercept_policy=Intercept Policy
ip_intercept=IP Intercept
domain_intercept=Domain Intercept
control_policy=Control Policy
control_policy=Block Policy
domain_forward=Domain Forward
http_redirect=HTTP(s) Redirect
http_req_replace=Http Request Body Replace
@@ -773,7 +773,7 @@ PXY_CTRL_HTTP_REQ_BODY=Request Body Configuration
PXY_CTRL_HTTP_RES_BODY=Response Body Configuration
dns_fake_ip=DNS Spoofing IP Configuration
APP_POLICY=APP Policy Configuration
PXY_CTRL_IP=IP Control Configuration
PXY_CTRL_IP=IP Block Configuration
APP_STATIC_SEV_IP=App Identify IP Configuration
APP_HTTP=APP HTTP Feature Configuration
APP_DOMAIN=APP Domain Feature Configuration
@@ -1282,7 +1282,7 @@ cache_whitelist=Cache Bypass
cache_key=Cache key
ignore_query_string=Ignore Query String in URL
include_cookie=Include Cookie Values
no_revalidate=No Revalidate
no_revalidate=Disable Revalidate
cache_dyn_url=Cache Dynamic Content
cache_cookied_cont=Cache Cookied Content
ignore_req_nocache=Ignore Request no-cache Headers

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,121 @@
drop table IF EXISTS `common_keyword_cfg` ;
CREATE TABLE `common_keyword_cfg` (
`cfg_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键,自增',
`cfg_desc` varchar(128) DEFAULT NULL,
`replace_content` varchar(500) DEFAULT NULL COMMENT '替换内容, action为replace时填写',
`cfg_keywords` varchar(2048) NOT NULL COMMENT '对应maat规范的字符串表keywords字段',
`action` int(11) NOT NULL COMMENT '1:阻断2监测 5 FD 白名单6监测白名单7: FD 监测都白名单应与业务ID所代表的逻辑相匹配8-灰名单',
`is_valid` int(11) NOT NULL COMMENT '0无效1有效-1删除;1 未审核时配置可删除;2 审核通过此字段置1;3 取消审核通过此字段置0',
`is_audit` int(11) NOT NULL COMMENT '0未审核1审核通过2审核未通过3取消审核通过;1 审核未通过,配置可修改;2 审核通过,配置不可删除,只能取消审核通过',
`creator_id` int(11) NOT NULL COMMENT '取自sys_user.id',
`create_time` datetime NOT NULL,
`editor_id` int(11) DEFAULT NULL COMMENT '取自sys_user.id',
`edit_time` datetime DEFAULT NULL,
`auditor_id` int(11) DEFAULT NULL COMMENT '取自sys_user.id',
`audit_time` datetime DEFAULT NULL,
`service_id` int(11) NOT NULL COMMENT '参考系统业务类型管理表',
`request_id` int(11) NOT NULL COMMENT '取自request_info.id',
`compile_id` int(11) NOT NULL COMMENT '取自服务接口返回的maat配置的编译id配置初始入库时获取。',
`is_area_effective` int(11) NOT NULL COMMENT '0否1是',
`classify` varchar(128) DEFAULT NULL COMMENT '分类id多个用英文逗号分隔',
`attribute` varchar(128) DEFAULT NULL COMMENT '性质id多个用英文逗号分隔',
`lable` varchar(128) DEFAULT NULL COMMENT '标签id,多个用英文逗号分隔',
`expr_type` int(11) NOT NULL COMMENT '0无表达式1与表达式',
`match_method` int(11) NOT NULL COMMENT 'expr_type:0时有意义其它情况必须置0。0子串匹配1右匹配2左匹配3完全匹配',
`is_hexbin` int(11) NOT NULL COMMENT '默认为0:大小写不敏感且非HEX;1:HEX格式二进制;2:大小写敏感且非HEX',
`area_effective_ids` varchar(1024) DEFAULT NULL COMMENT '多个英文逗号分隔',
`function_id` int(11) DEFAULT NULL,
`cfg_region_code` int(11) DEFAULT NULL,
`cfg_type` varchar(64) DEFAULT NULL,
`user_region1` varchar(1024) DEFAULT NULL COMMENT '预留自定义域1',
`user_region2` varchar(1024) DEFAULT NULL COMMENT '预留自定义域2',
`user_region3` varchar(1024) DEFAULT NULL COMMENT '预留自定义域3',
`user_region4` varchar(1024) DEFAULT NULL COMMENT '预留自定义域4',
`user_region5` varchar(1024) DEFAULT NULL COMMENT '预留自定义域5',
PRIMARY KEY (`cfg_id`),
UNIQUE KEY `pk_cfg_index_id` (`cfg_id`) USING BTREE,
KEY `cfg_index_compileId` (`compile_id`) USING BTREE,
KEY `cfg_index_functionId` (`function_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8mb4 COMMENT='通用字符串类配置';
drop table IF EXISTS `complex_keyword_cfg`;
CREATE TABLE `complex_keyword_cfg` (
`cfg_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键,自增',
`cfg_desc` varchar(128) DEFAULT NULL,
`district` varchar(128) DEFAULT NULL,
`keywords` varchar(2048) NOT NULL,
`action` int(11) NOT NULL COMMENT '1:阻断2监测 5 FD 白名单6监测白名单7: FD 监测都白名单应与业务ID所代表的逻辑相匹配8-灰名单',
`is_valid` int(11) NOT NULL COMMENT '0无效1有效-1删除;1 未审核时配置可删除;2 审核通过此字段置1;3 取消审核通过此字段置0',
`is_audit` int(11) NOT NULL COMMENT '0未审核1审核通过2审核未通过3取消审核通过;1 审核未通过,配置可修改;2 审核通过,配置不可删除,只能取消审核通过',
`creator_id` int(11) NOT NULL COMMENT '取自sys_user.id',
`create_time` datetime NOT NULL,
`editor_id` int(11) DEFAULT NULL COMMENT '取自sys_user.id',
`edit_time` datetime DEFAULT NULL,
`auditor_id` int(11) DEFAULT NULL COMMENT '取自sys_user.id',
`audit_time` datetime DEFAULT NULL,
`service_id` int(11) NOT NULL COMMENT '参考系统业务类型管理表',
`request_id` int(11) NOT NULL COMMENT '取自request_info.id',
`compile_id` int(11) NOT NULL COMMENT '取自服务接口返回的maat配置的编译id配置初始入库时获取。',
`is_area_effective` int(11) NOT NULL COMMENT '0否1是',
`classify` varchar(128) DEFAULT NULL COMMENT '分类id多个用英文逗号分隔',
`attribute` varchar(128) DEFAULT NULL COMMENT '性质id多个用英文逗号分隔',
`lable` varchar(128) DEFAULT NULL COMMENT '标签id,多个用英文逗号分隔',
`expr_type` int(11) NOT NULL COMMENT '0无表达式1与表达式',
`match_method` int(11) NOT NULL COMMENT 'expr_type:0时有意义其它情况必须置0。0子串匹配1右匹配2左匹配3完全匹配',
`is_hexbin` int(11) NOT NULL COMMENT '默认为0:大小写不敏感且非HEX;1:HEX格式二进制;2:大小写敏感且非HEX',
`area_effective_ids` varchar(1024) DEFAULT NULL COMMENT '多个英文逗号分隔',
`cfg_type` varbinary(64) DEFAULT NULL COMMENT '内容类型',
`function_id` int(11) NOT NULL COMMENT '菜单ID',
`cfg_region_code` int(11) DEFAULT NULL,
`user_region1` varchar(1024) DEFAULT '' COMMENT '预留自定义域1',
`user_region2` varchar(1024) DEFAULT '' COMMENT '预留自定义域2',
`user_region3` varchar(1024) DEFAULT '' COMMENT '预留自定义域3',
`user_region4` varchar(1024) DEFAULT '' COMMENT '预留自定义域4',
`user_region5` varchar(1024) DEFAULT '' COMMENT '预留自定义域5',
PRIMARY KEY (`cfg_id`),
UNIQUE KEY `pk_cfg_index_id` (`cfg_id`) USING BTREE,
KEY `cfg_index_compileId` (`compile_id`) USING BTREE,
KEY `cfg_index_functionId` (`function_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='通用增强字符串配置';
#增加缓存相关字典
INSERT INTO `sys_data_dictionary_name` (`id`, `module_name`, `mark`, `remark`, `revision`, `create_time`, `modify_time`, `status`) VALUES ('130', '缓存算法', 'CACHE_KEY', '', '', '2018-11-12 10:25:57', '2018-11-12 10:25:57', '1');
INSERT INTO `sys_data_dictionary_name` (`id`, `module_name`, `mark`, `remark`, `revision`, `create_time`, `modify_time`, `status`) VALUES ('131', '缓存验证', 'CACHE_NO_REVALIDATE', '', '', '2018-11-12 11:12:55', '2018-11-12 11:12:55', '1');
INSERT INTO `sys_data_dictionary_name` (`id`, `module_name`, `mark`, `remark`, `revision`, `create_time`, `modify_time`, `status`) VALUES ('132', '缓存动态URL', 'CACHE_DYN_URL', '', '', '2018-11-12 11:14:35', '2018-11-12 11:14:35', '1');
INSERT INTO `sys_data_dictionary_name` (`id`, `module_name`, `mark`, `remark`, `revision`, `create_time`, `modify_time`, `status`) VALUES ('133', '缓存cookie内容', 'CACHE_COOKIED_CONT', '', 'user:管理员,2018-11-12 11:16:04edit', '2018-11-12 11:15:46', '2018-11-12 11:16:04', '1');
INSERT INTO `sys_data_dictionary_name` (`id`, `module_name`, `mark`, `remark`, `revision`, `create_time`, `modify_time`, `status`) VALUES ('134', '忽略请求头不缓存', 'IGNORE_REQ_NOCACHE', '', '', '2018-11-12 11:18:09', '2018-11-12 11:18:09', '1');
INSERT INTO `sys_data_dictionary_name` (`id`, `module_name`, `mark`, `remark`, `revision`, `create_time`, `modify_time`, `status`) VALUES ('135', '忽略响应头不缓存', 'IGNORE_RES_NOCACHE', '', '', '2018-11-12 11:22:42', '2018-11-12 11:22:42', '1');
INSERT INTO `sys_data_dictionary_name` (`id`, `module_name`, `mark`, `remark`, `revision`, `create_time`, `modify_time`, `status`) VALUES ('136', '强制缓存', 'FORCE_CACHING', '', '', '2018-11-12 11:23:51', '2018-11-12 11:23:51', '1');
INSERT INTO `sys_data_dictionary_item` (`id`, `item_code`, `item_value`, `item_desc`, `item_sort`, `status`, `type`, `dictionary_id`) VALUES ('2992', 'ignore_query_string', 'ignore_query_string', '', '0', '1', '1', '130');
INSERT INTO `sys_data_dictionary_item` (`id`, `item_code`, `item_value`, `item_desc`, `item_sort`, `status`, `type`, `dictionary_id`) VALUES ('2993', 'include_cookie', 'include_cookie', '', '0', '1', '1', '130');
INSERT INTO `sys_data_dictionary_item` (`id`, `item_code`, `item_value`, `item_desc`, `item_sort`, `status`, `type`, `dictionary_id`) VALUES ('2994', '0', 'no', '', '0', '1', '1', '131');
INSERT INTO `sys_data_dictionary_item` (`id`, `item_code`, `item_value`, `item_desc`, `item_sort`, `status`, `type`, `dictionary_id`) VALUES ('2995', '1', 'yes', '', '0', '1', '1', '131');
INSERT INTO `sys_data_dictionary_item` (`id`, `item_code`, `item_value`, `item_desc`, `item_sort`, `status`, `type`, `dictionary_id`) VALUES ('2996', '0', 'no', '', '0', '1', '1', '132');
INSERT INTO `sys_data_dictionary_item` (`id`, `item_code`, `item_value`, `item_desc`, `item_sort`, `status`, `type`, `dictionary_id`) VALUES ('2997', '1', 'yes', '', '0', '1', '1', '132');
INSERT INTO `sys_data_dictionary_item` (`id`, `item_code`, `item_value`, `item_desc`, `item_sort`, `status`, `type`, `dictionary_id`) VALUES ('3000', '0', 'no', '', '0', '1', '1', '133');
INSERT INTO `sys_data_dictionary_item` (`id`, `item_code`, `item_value`, `item_desc`, `item_sort`, `status`, `type`, `dictionary_id`) VALUES ('3001', '1', 'yes', '', '0', '1', '1', '133');
INSERT INTO `sys_data_dictionary_item` (`id`, `item_code`, `item_value`, `item_desc`, `item_sort`, `status`, `type`, `dictionary_id`) VALUES ('3002', '0', 'no', '', '0', '1', '1', '134');
INSERT INTO `sys_data_dictionary_item` (`id`, `item_code`, `item_value`, `item_desc`, `item_sort`, `status`, `type`, `dictionary_id`) VALUES ('3003', '1', 'yes', '', '0', '1', '1', '134');
INSERT INTO `sys_data_dictionary_item` (`id`, `item_code`, `item_value`, `item_desc`, `item_sort`, `status`, `type`, `dictionary_id`) VALUES ('3004', '0', 'no', '', '0', '1', '1', '135');
INSERT INTO `sys_data_dictionary_item` (`id`, `item_code`, `item_value`, `item_desc`, `item_sort`, `status`, `type`, `dictionary_id`) VALUES ('3005', '1', 'yes', '', '0', '1', '1', '135');
INSERT INTO `sys_data_dictionary_item` (`id`, `item_code`, `item_value`, `item_desc`, `item_sort`, `status`, `type`, `dictionary_id`) VALUES ('3006', '0', 'no', '', '0', '1', '1', '136');
INSERT INTO `sys_data_dictionary_item` (`id`, `item_code`, `item_value`, `item_desc`, `item_sort`, `status`, `type`, `dictionary_id`) VALUES ('3007', '1', 'yes', '', '0', '1', '1', '136');
#增加缓存功能业务字典
INSERT INTO `function_service_dict` (`dict_id`, `function_id`, `protocol_id`, `action`, `action_code`, `service_id`, `service_name`, `service_desc`, `is_valid`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `region_code`, `is_import`) VALUES ('154', '213', '0', '48', 'cache', '625', 'proxy_cache_policy_redirect', NULL, '1', NULL, '2018-11-08 11:14:30', NULL, '2018-11-08 11:14:33', '2', '0');
INSERT INTO `function_service_dict` (`dict_id`, `function_id`, `protocol_id`, `action`, `action_code`, `service_id`, `service_name`, `service_desc`, `is_valid`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `region_code`, `is_import`) VALUES ('155', '213', '0', '128', 'cache_whitelist', '624', 'proxy_cache_policy_whitelist', NULL, '1', NULL, '2018-11-08 11:16:18', NULL, '2018-11-08 11:16:23', NULL, '0');
INSERT INTO `function_region_dict` (`dict_id`, `function_id`, `config_district`, `config_region_code`, `config_region_value`, `config_desc`, `is_valid`, `is_maat`, `region_type`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `config_service_type`, `config_expr_type`, `config_match_method`, `config_ip_type`, `config_hex`, `config_multi_keywords`, `config_ip_pattern`, `config_port_pattern`, `config_direction`, `config_protocol`, `config_ip_port_show`, `config_region_sort`, `is_import`) VALUES ('604', '213', NULL, '1', 'PXY_CACHE_HTTP_URL', '代理缓存URL配置', '1', '1', '2', NULL, '2018-11-08 11:20:31', NULL, '2018-11-08 11:20:33', '', '0,1', '0,1,2,3', NULL, '0,1,2', '1', NULL, NULL, NULL, NULL, NULL, '1', '0');
INSERT INTO `function_region_dict` (`dict_id`, `function_id`, `config_district`, `config_region_code`, `config_region_value`, `config_desc`, `is_valid`, `is_maat`, `region_type`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `config_service_type`, `config_expr_type`, `config_match_method`, `config_ip_type`, `config_hex`, `config_multi_keywords`, `config_ip_pattern`, `config_port_pattern`, `config_direction`, `config_protocol`, `config_ip_port_show`, `config_region_sort`, `is_import`) VALUES ('605', '213', NULL, '2', 'PXY_CACHE_HTTP_COOKIE', '代理缓存cookie配置', '1', '1', '2', NULL, '2018-11-08 11:22:00', NULL, '2018-11-08 11:22:04', '', '0,1', '0,1,2,3', NULL, '0,1,2', '1', NULL, NULL, NULL, NULL, NULL, '2', '0');
#增加缓存功能菜单
INSERT INTO `sys_menu` (`id`, `parent_id`, `parent_ids`, `code`, `name`, `sort`, `href`, `target`, `icon`, `is_show`, `permission`, `create_by`, `create_date`, `update_by`, `update_date`, `remarks`, `del_flag`, `menu_bg`, `quick_action`, `is_top`, `function_id`) VALUES ('1161', '719', '0,1,86,719,', 'cache_policy', '缓存策略', '90', '/proxy/cache/list', '', '', '1', 'cache:policy:config', '1', '2018-11-08 11:27:45', '1', '2018-11-08 11:27:45', '', '1', NULL, '0', '0', '213');
INSERT INTO `sys_menu` (`id`, `parent_id`, `parent_ids`, `code`, `name`, `sort`, `href`, `target`, `icon`, `is_show`, `permission`, `create_by`, `create_date`, `update_by`, `update_date`, `remarks`, `del_flag`, `menu_bg`, `quick_action`, `is_top`, `function_id`) VALUES ('1162', '748', '0,1,150,748,', 'cache_policy', '缓存策略', '90', '/proxy/cache/list', '', '', '1', 'cache:policy:confirm', '1', '2018-11-08 11:28:43', '1', '2018-11-08 11:28:43', '', '1', NULL, '0', '0', '213');
INSERT INTO `sys_menu` (`id`, `parent_id`, `parent_ids`, `code`, `name`, `sort`, `href`, `target`, `icon`, `is_show`, `permission`, `create_by`, `create_date`, `update_by`, `update_date`, `remarks`, `del_flag`, `menu_bg`, `quick_action`, `is_top`, `function_id`) VALUES ('1163', '850', '0,1,151,850,', 'cache_policy', '缓存策略', '90', '/proxy/cache/list', '', '', '1', '', '1', '2018-11-08 11:29:26', '1', '2018-11-08 11:29:26', '', '1', NULL, '0', '0', '213');
INSERT INTO `sys_data_dictionary_name` (`id`, `module_name`, `mark`, `remark`, `revision`, `create_time`, `modify_time`, `status`) VALUES ('137', '缓存时间单位', 'CACHE_TIME_UNIT', '', '', '2018-11-12 19:29:17', '2018-11-12 19:29:17', '1');
INSERT INTO `sys_data_dictionary_name` (`id`, `module_name`, `mark`, `remark`, `revision`, `create_time`, `modify_time`, `status`) VALUES ('138', '缓存文件大小', 'CACHE_SIZE_UNIT', '', '', '2018-11-12 19:30:07', '2018-11-12 19:30:07', '1');
INSERT INTO `sys_data_dictionary_item` (`id`, `item_code`, `item_value`, `item_desc`, `item_sort`, `status`, `type`, `dictionary_id`) VALUES ('3008', 'h', 'Hour', '', '0', '1', '1', '137');
INSERT INTO `sys_data_dictionary_item` (`id`, `item_code`, `item_value`, `item_desc`, `item_sort`, `status`, `type`, `dictionary_id`) VALUES ('3009', 'm', 'Minute', '', '0', '1', '1', '137');
INSERT INTO `sys_data_dictionary_item` (`id`, `item_code`, `item_value`, `item_desc`, `item_sort`, `status`, `type`, `dictionary_id`) VALUES ('3010', 's', 'Seconde', '', '0', '1', '1', '137');
INSERT INTO `sys_data_dictionary_item` (`id`, `item_code`, `item_value`, `item_desc`, `item_sort`, `status`, `type`, `dictionary_id`) VALUES ('3011', 'm', 'MB', '', '0', '1', '1', '138');
INSERT INTO `sys_data_dictionary_item` (`id`, `item_code`, `item_value`, `item_desc`, `item_sort`, `status`, `type`, `dictionary_id`) VALUES ('3012', 'g', 'GB', '', '0', '1', '1', '138');
INSERT INTO `sys_data_dictionary_item` (`id`, `item_code`, `item_value`, `item_desc`, `item_sort`, `status`, `type`, `dictionary_id`) VALUES ('3013', 't', 'TB', '', '0', '1', '1', '138');

View File

@@ -0,0 +1,3 @@
#修改ddos动作为回流配置表为NTC_DDOS_PROTECT_TARGET_IP
UPDATE function_region_dict SET config_region_value='NTC_DDOS_PROTECT_TARGET_IP' WHERE dict_id=74;
UPDATE function_service_dict SET `action`=96 , action_code='loop' WHERE dict_id=82;

View File

@@ -0,0 +1,4 @@
#修改日志ddos 为一个菜单
UPDATE sys_menu SET href='/log/ntc/ntcDdosLogs/list' WHERE id=1138;
UPDATE sys_menu SET is_show=0 WHERE id=1139;

View File

@@ -30,6 +30,20 @@
<div for="ipType"></div>
</div>
</div>
<div class="col-md-6">
<div class="form-group ">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="protocol"/></label>
<div class="col-md-6">
<select name="protocol" class="selectpicker show-tick form-control required">
<c:forEach items="${fns:getDictList('PROTOCOL')}" var="protocolC">
<option value="${protocolC.itemCode}" <c:if test="${_cfg.protocol==protocolC.itemCode || (_cfg.protocol==null && protocolC.itemCode==0)}">selected</c:if>><spring:message code="${protocolC.itemValue}"/></option>
</c:forEach>
</select>
<input type="hidden" name="protocolId" value="0">
</div>
<div for="protocol"></div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
@@ -94,20 +108,7 @@
<div class="row destPort">
</c:otherwise>
</c:choose>
<div class="col-md-6">
<div class="form-group ">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="protocol"/></label>
<div class="col-md-6">
<select name="protocol" class="selectpicker show-tick form-control required">
<c:forEach items="${fns:getDictList('PROTOCOL')}" var="protocolC">
<option value="${protocolC.itemCode}" <c:if test="${_cfg.protocol==protocolC.itemCode || (_cfg.protocol==null && protocolC.itemCode==0)}">selected</c:if>><spring:message code="${protocolC.itemValue}"/></option>
</c:forEach>
</select>
<input type="hidden" name="protocolId" value="0">
</div>
<div for="protocol"></div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="direction"/></label>

View File

@@ -37,6 +37,7 @@
<mapping path="/nis/ntc/iplist/ajax*" exclue="true"/>
<mapping path="/nis/ntc/whitelist/ajax*" exclue="true"/>
<mapping path="/nis/app/feature/ajax*" exclue="true"/>
<mapping path="/nis/proxy/cache/ajax*" exclue="true"/>
<!-- 对同一路径,启用多个装饰器 -->
<mapping>
<path>/articles/*</path>

View File

@@ -91,23 +91,27 @@ $(function(){
</div>
</div>
</div>
<div class="col-md-6 hidden">
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-3"><spring:message code="action"/></label>
<div class="col-md-6">
<c:forEach items="${serviceList}" var="service"
varStatus="satus">
<label class="radio-inline"> <c:if
test="${_cfg.functionId eq service.functionId}">
<input type="radio" name="action"
serviceId="${service.serviceId }"
protocolId="${service.protocolId }"
regionCode="${service.regionCode }"
value="${service.action }" class="required action"
<c:if test="${_cfg.action==service.action || (_cfg.action==null && satus.index==0)}">checked</c:if>>
<spring:message code="${service.actionCode }" />
</c:if>
</label>
<label class="radio-inline"> <c:if
test="${_cfg.functionId eq service.functionId}">
<input type="radio" name="action"
serviceId="${service.serviceId }"
protocolId="${service.protocolId }"
regionCode="${service.regionCode }"
value="${service.action }" class="required action"
<c:if test="${_cfg.serviceId==service.serviceId || (_cfg.serviceId==null && satus.index==0)}">checked</c:if>>
<c:forEach items="${fns:getDictList('SERVICE_ACTION') }" var="dict">
<c:if test="${dict.itemCode eq service.action }">
<spring:message code="${dict.itemValue }"/>
</c:if>
</c:forEach>
</c:if>
</label>
</c:forEach>
</div>
<div for="action"></div>

View File

@@ -0,0 +1,222 @@
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/include/taglib.jsp"%>
<html>
<head>
<script>
$(document).ready(function() {
//$("div[name='tabTitle"+index+"']").get(0).click();
})
</script>
<style type="text/css">
</style>
</head>
<c:forEach items="${tabList}" var="region" varStatus="regionStatus">
<div id="${region[1]}Title${index}" onclick="switchSubCfgTabInfo('${region[1]}',${index})"
class="col-md-1 tabInfo" name="tabTitle${index }">
<spring:message code='${region[1]}' />
<i id="${region[1]}${index}" class="fa" name="tabFlag${index}"></i>
</div>
</c:forEach>
</div>
<c:forEach items="${tabList}" var="region">
<c:if test="${region[0] eq 1 }">
<c:forEach items="${_cfg.ipPortList}" var="cfg">
<c:if test="${region[1] eq cfg.cfgType }">
<div id="${region[1]}Info${index}" class="content" name="subCfg${index}">
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label><spring:message code='ip_type'/>:</label>
<label>
<c:forEach items="${fns:getDictList('IP_TYPE')}" var="ipTypeC">
<c:if test="${cfg.ipType==ipTypeC.itemCode}"><spring:message code="${ipTypeC.itemValue }"/></c:if>
</c:forEach>
</label>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label><spring:message code='ip_pattern'/>:</label>
<label>
<c:forEach items="${fns:getDictList('IP_PATTERN')}" var="ipPatternC">
<c:if test="${cfg.ipPattern==ipPatternC.itemCode}"><spring:message code="${ipPatternC.itemValue }"/></c:if>
</c:forEach>
</label>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label><spring:message code='client_ip'/>:</label>
<label>
${cfg.srcIpAddress}
</label>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label><spring:message code='port_pattern'/>:</label>
<label>
<c:forEach items="${fns:getDictList('PORT_PATTERN')}" var="portPatternC">
<c:if test="${cfg.portPattern eq portPatternC.itemCode}"><spring:message code="${portPatternC.itemValue }"/></c:if>
</c:forEach>
</label>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label><spring:message code='client_port'/>:</label><label>${cfg.srcPort }</label>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label><spring:message code='server_ip'/>:</label><label>${cfg.destIpAddress }</label>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label><spring:message code='server_port'/>:</label><label>${cfg.destPort }</label>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label><spring:message code='direction'/>:</label>
<label>
<c:forEach items="${fns:getDictList('DIRECTION')}" var="directionC">
<c:if test="${cfg.direction eq directionC.itemCode}"><spring:message code="${directionC.itemValue }"/></c:if>
</c:forEach>
</label>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label><spring:message code='protocol'/>:</label>
<label>
<c:forEach items="${fns:getDictList('PROTOCOL')}" var="protocolC">
<c:if test="${cfg.protocol eq protocolC.itemCode}"><spring:message code="${protocolC.itemValue }"/></c:if>
</c:forEach>
</label>
</div>
</div>
</div>
</div>
</c:if>
</c:forEach>
</c:if>
<c:if test="${(region[0] eq 2) && (fn:length(_cfg.stringList) >0)}">
<c:forEach items="${_cfg.stringList}" var="cfg">
<c:if test="${region[1] eq cfg.cfgType }">
<div id="${region[1]}Info${index}" class="content content${region[0]}" name="subCfg${index}">
<div class="row">
<div class="col-md-8">
<div class="form-group">
<label><spring:message code='keywords' />: ${fn:replace(cfg.cfgKeywords, "***and***", " ")}</label>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label><spring:message code='expression_type' />:</label>
<label>
<c:choose>
<c:when test="${cfg.exprType eq 1}"><spring:message code='and_expression'/></c:when>
<c:when test="${cfg.exprType eq 0}"><spring:message code='null_expression'/></c:when>
</c:choose>
</label>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label><spring:message code='match_method' />:</label>
<label>
<c:forEach items="${fns:getDictList('MATCH_METHOD')}" var="matchMethodC">
<c:if test="${cfg.matchMethod==matchMethodC.itemCode }"><spring:message code="${matchMethodC.itemValue}"/></c:if>
</c:forEach>
</label>
</div>
</div>
</div>
<c:if test="${cfg.isHexbin==0 }">
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label><spring:message code="is_hex"/>:</label>
<label>
<spring:message code="not_hex"/>
</label>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label><spring:message code="is_case_insenstive"/>:</label>
<label>
<spring:message code="case_insenstive"/>
</label>
</div>
</div>
</div>
</c:if>
<c:if test="${cfg.isHexbin==1 }">
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label><spring:message code="is_hex"/>:</label>
<label>
<spring:message code="hex"/>
</label>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label><spring:message code="is_case_insenstive"/>:</label>
<label>
<spring:message code="case_insenstive"/>
</label>
</div>
</div>
</div>
</c:if>
<c:if test="${cfg.isHexbin==2 }">
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label><spring:message code="is_hex"/>:</label>
<label>
<spring:message code="not_hex"/>
</label>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label><spring:message code="is_case_insenstive"/>:</label>
<label>
<spring:message code="case_senstive"/>
</label>
</div>
</div>
</div>
</c:if>
</div>
</c:if>
</c:forEach>
</c:if>
</c:forEach>
</html>

View File

@@ -0,0 +1,746 @@
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/include/taglib.jsp"%>
<html>
<head>
<title><spring:message code="${cfgName}"></spring:message></title>
<style type="text/css">
.boxSolid {
border: 1px solid #eeeeee
}
</style>
<script type="text/javascript">
$(document)
.ready(
function() {
$("#ignore_qs").tagsInput({
width:$("#ignore_qs").find(".form-control").width(),
defaultText:'please input ignore query string in URL',
'delimiter':',',//特殊字符串分隔与表达式的多关键词
maxCount:0,
onAddTag:function(tag,size){
var reg = new RegExp(/\t|\r|\n|,/);
if (tag.match(reg)) {
$(this).parents(".col-md-6").next("div").html("<label class='error'><spring:message code='ignore_qs_error'/></label>");
}else{
$(this).parents(".col-md-6").next("div").html("");
}
},
onRemoveTag:function(tag,size){
$(this).parents(".col-md-6").next("div").html("");
}
});
$(".tagsinput").popover({
animation:true,
container:'body',
placement:'right',
html:true,
trigger:"hover",
title:"",
content:function(){
var content = $("#tagsinputTip").text();
return content;
}
});
//initCommIpVal();
/* $("#cancel").on("click", function() {
window.history.back();
});*/
$(".action").on("change", function() {
$("#serviceId").val($(this).attr("serviceId"));
$("#protocolId").val($(this).attr("protocolId"));
if($(this).val()==128){
$("#doLog").val(0);
$("input:radio[name='doLog']").attr("disabled",true);
$(".cacheAction").hide();
}else{
$("input:radio[name='doLog']").attr("disabled",false);
$(".cacheAction").show();
}
});
$(".action:checked").change();
$("#serviceId").val($(".action:checked").attr("serviceId"));
$("#protocolId").val($(".action:checked").attr("protocolId"));
$(".cache_key").on("click",function(){
if($(this).val()=="include_cookie"){
if($(this).is(":checked")){
$(".cookie").removeClass("hidden");
}else{
$(".cookie").addClass("hidden");
}
}else if($(this).val()=="ignore_query_string"){
if($(this).is(":checked")){
$(".ignore_qs").removeClass("hidden");
}else{
$(".ignore_qs").addClass("hidden");
}
}
});
//$(".cache_key").click();
$("#cfgFrom").validate(
{
errorPlacement : function(error, element) {
if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
error.appendTo(element.parent().parent());
} else {
if($(element).parents().hasClass("tagsinput")){
$(element).parents(".col-md-6").next("div").append(error);
}else{
$(element).parents(".form-group").find(
"div[for='"
+ element.attr("id")
+ "']").append(error);
}
}
},
submitHandler : function(form) {
var flag = true;
var subscribeId=0;
if($("#ignore_qs").parents(".col-md-6").next("div").html()!=''){
$("#ignore_qs").parents(".col-md-6").next("div").html("<label class='error'><spring:message code='ignore_qs_error'/></label>");
return;
}
if($("#pinning_time_unit").val()=='h'){
if(parseInt($("#pinning_time").val())>24){
$("div[for='pinning_time']").append("<label class='error'><spring:message code='cache_time_error'/></label>");
return ;
}
}else if($("#pinning_time_unit").val()=='m'){
if(parseInt($("#pinning_time").val())>1440){
$("div[for='pinning_time']").append("<label class='error'><spring:message code='cache_time_error'/></label>");
return ;
}
}else if($("#pinning_time_unit").val()=='s'){
if(parseInt($("#pinning_time").val())>86400){
$("div[for='pinning_time']").append("<label class='error'><spring:message code='cache_time_error'/></label>");
return ;
}
}
if($("#inactive_time_unit").val()=='h'){
if(parseInt($("#inactive_time").val())>24){
$("div[for='inactive_time']").append("<label class='error'><spring:message code='cache_time_error'/></label>");
return ;
}
}else if($("#inactive_time_unit").val()=='m'){
if(parseInt($("#inactive_time").val())>1440){
$("div[for='inactive_time']").append("<label class='error'><spring:message code='cache_time_error'/></label>");
return ;
}
}else if($("#inactive_time_unit").val()=='s'){
if(parseInt($("#inactive_time").val())>86400){
$("div[for='inactive_time']").append("<label class='error'><spring:message code='cache_time_error'/></label>");
return ;
}
}
if($("#max_cache_size_unit").val()=='t'){
if(parseInt($("#max_cache_size").val())>1024){
$("div[for='max_cache_size']").append("<label class='error'><spring:message code='cache_size_error'/></label>");
return ;
}
}else if($("#max_cache_size_unit").val()=='g'){
if(parseInt($("#max_cache_size").val())>1048576){
$("div[for='max_cache_size']").append("<label class='error'><spring:message code='cache_size_error'/></label>");
return ;
}
}else if($("#max_cache_size_unit").val()=='m'){
if(parseInt($("#max_cache_size").val())>1073741824){
$("div[for='max_cache_size']").append("<label class='error'><spring:message code='cache_size_error'/></label>");
return ;
}
}
if($("#max_cache_obj_size_unit").val()=='t'){
if(parseInt($("#max_cache_obj_size").val())>1024){
$("div[for='max_cache_obj_size']").append("<label class='error'><spring:message code='cache_size_error'/></label>");
return ;
}
}else if($("#max_cache_obj_size_unit").val()=='g'){
if(parseInt($("#max_cache_obj_size").val())>1048576){
$("div[for='max_cache_obj_size']").append("<label class='error'><spring:message code='cache_size_error'/></label>");
return ;
}
}else if($("#max_cache_obj_size_unit").val()=='m'){
if(parseInt($("#max_cache_obj_size").val())>1073741824){
$("div[for='max_cache_obj_size']").append("<label class='error'><spring:message code='cache_size_error'/></label>");
return ;
}
}
//存在隐藏的subscribeId不算进域配置
if($(".boxSolid.hidden").hasClass("subscribeId")){
subscribeId=1;
}
var boxSolidLenth=$(".boxSolid").length;
if($(".boxSolid").hasClass("subscribeId")){
boxSolidLenth=boxSolidLenth-1;
}
//代表所有业务都隐藏了,提示必须增加一种业务数据
if(boxSolidLenth ==($(".boxSolid.hidden").length-subscribeId)){
top.$.jBox.tip("<spring:message code='one_more'/>", "<spring:message code='info'/>");
return;
}
//代表所有区域都隐藏了,提示必须增加个区域信息
if($("input[name='isAreaEffective']:checked").val()==1 && $(".container-fluid:visible").size()==0){
if($("#areaIsp").hasClass("hidden")) $("#areaIp").find(".glyphicon-plus").click();
if($("#areaIp").hasClass("hidden")) $("#areaIsp").find(".glyphicon-plus").click();
top.$.jBox.tip("<spring:message code='one_more_area'/>", "<spring:message code='info'/>");
return;
}
$(".boxSolid:visible").find("input[name$='cfgKeywords']").each(function(){
if($(this).val()==''){
$(this).parents(".form-group").find(
"div[for='"
+ $(this).attr("name")
+ "']").html("<label id=\"cfgKeywordsError\" class=\"error\">"+$("#keywordError").text()+"</label>");
flag = false;
}
});
//keywords非空校验完成校验二进制字符串
$(".boxSolid:visible").find("select[name$='isHexbin']").each(function(){
var isHexbin=$(this).val();
if(isHexbin == 1){ //十六进制
var keywords=$("input[name$='"+$(this).attr("name").replace("isHexbin","cfgKeywords")+"']").val();
keywords=keywords.replace("***and***","")
if(keywords != ''){
if(!(/^([0-9|a-f|A-F]*)$/.test(keywords))){
$(this).parents(".boxSolid").find(
"div[for='"
+ $(this).attr("name").replace("isHexbin","cfgKeywords")
+ "']").html("<label id=\"cfgKeywordsError\" class=\"error\">"+$.validator.messages.hexCheck+"</label>");
flag = false;
}
}
}
});
var flag1=validateInvisibleCharTag();
if(flag){
flag=flag1;
}
if(flag){
//将disable属性的元素删除
$(".disabled").each(function(){
$(this).remove();
});
$("input[name$='exprType']").attr("disabled",false);
$("#pinning_time").val($("#pinning_time").val()+$("#pinning_time_unit").val());
$("#inactive_time").val($("#inactive_time").val()+$("#inactive_time_unit").val());
$("#max_cache_size").val($("#max_cache_size").val()+$("#max_cache_size_unit").val());
$("#max_cache_obj_size").val($("#max_cache_obj_size").val()+$("#max_cache_obj_size_unit").val());
loading('onloading...');
form.submit();
}else{
return;
}
},
errorContainer : "#messageBox",
});
//业务内容增加
/* $("span[title='add']").on("click", function() {
$(".ipPort0").removeClass("hidden");
}); */
});
//业务窗口打开
var addContent = function(obj, contentClassName) {
var showDiv = $(obj).parent().parent().next();
$(showDiv).removeClass("hidden").removeClass(
"disabled");
$(obj).addClass("hidden");
}
//业务窗口关闭
var delContent = function(contentClassName, addBtnClassName) {
$("." + contentClassName).addClass("hidden").addClass("disabled");
$("." + addBtnClassName).removeClass("hidden");
}
</script>
</head>
<body>
<span id="keywordError" style="display:none"><spring:message code="required"></spring:message></span>
<span id="tagsinputTip" style="display:none"><spring:message code="multiple_keywords_tip"></spring:message></span>
<div class="page-content">
<h3 class="page-title">
<spring:message code="${_cfg.menuNameCode }"></spring:message>
</h3>
<div class="row">
<div class="col-md-12">
<div class="portlet box blue">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-gift"></i>
<c:if test="${empty _cfg.cfgId}">
<spring:message code="add"></spring:message>
</c:if>
<c:if test="${not empty _cfg.cfgId}">
<spring:message code="edit"></spring:message>
</c:if>
</div>
</div>
<div class="portlet-body form">
<!-- BEGIN FORM-->
<form id="cfgFrom" action="${ctx}/proxy/cache/saveOrUpdate"
method="post" class="form-horizontal">
<input type="hidden" name="cfgId" id="cfgId" value="${_cfg.cfgId}">
<input type="hidden" name="compileId" value="${_cfg.compileId}">
<input type="hidden" name="functionId" value="${_cfg.functionId}">
<input type="hidden" id="serviceId" name="serviceId"
value="${_cfg.serviceId}">
<div class="form-body">
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-3"><spring:message
code="config_describe" /></label>
<div class="col-md-6">
<input class="form-control" type="text" name="cfgDesc"
value="${_cfg.cfgDesc}">
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-3"><spring:message
code="action" /></label>
<div class="col-md-6">
<c:forEach items="${serviceList}" var="service"
varStatus="satus">
<label class="radio-inline"> <c:if
test="${_cfg.functionId eq service.functionId}">
<input type="radio" name="action"
serviceId="${service.serviceId }"
protocolId="${service.protocolId }"
regionCode="${service.regionCode }"
value="${service.action }" class="required action"
<c:if test="${_cfg.action==service.action || (_cfg.action==null && satus.index==0)}">checked</c:if>>
<spring:message code="${service.actionCode }"/>
<%-- <c:forEach items="${fns:getDictList('SERVICE_ACTION') }" var="dict">
<c:if test="${dict.itemCode eq service.action }">
<c:set var="action" value="${dict.itemCode }"></c:set>
<spring:message code="${dict.itemValue }"/>
</c:if>
</c:forEach> --%>
</c:if>
</label>
</c:forEach>
</div>
<div for="action"></div>
</div>
</div>
</div>
<!-- 记录日志begin -->
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-3"><spring:message code="do_log" /></label>
<c:forEach items="${fns:getDictList('DO_LOG') }" var="dict">
<c:choose>
<c:when test="${dict.itemCode eq _cfg.doLog}">
<label class="radio-inline">
<input type="radio" id="doLog" name="doLog" checked value="${dict.itemCode}" ><spring:message code="${dict.itemValue}"/>
</label>
</c:when>
<c:otherwise>
<label class="radio-inline">
<input type="radio" id="doLog" name="doLog" value="${dict.itemCode}" ><spring:message code="${dict.itemValue}"/>
</label>
</c:otherwise>
</c:choose>
</c:forEach>
</div>
</div>
</div>
<!-- 记录日志end -->
<h4 class="form-section cacheAction">
<spring:message code="action_region" />
<small></small>
</h4>
<div class="row cacheAction">
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-3">
<spring:message code="cache_key" />
</label>
<div class="col-md-6">
<%-- <select name="userRegion['cache_key']" id="cache_key"
class="selectpicker show-tick form-control" multiple>
<c:forEach items="${fns:getDictList('CACHE_KEY')}" var="cacheKey">
<option value="${cacheKey.itemCode}" <c:if test="${_cfg.userRegion.cacke_key eq cacheKey.itemCode || (empty _cfg.userRegion.cache_key && cacheKey.itemCode eq 'ignore_qs')}">selected</c:if>><spring:message code="${cacheKey.itemCode}"/></option>
</c:forEach>
</select> --%>
<div class="mt-checkbox-inline">
<c:forEach items="${fns:getDictList('CACHE_KEY')}" var="dict">
<label class="mt-checkbox">
<input type="checkbox" class="cache_key"
<c:if test="${!empty _cfg.userRegion.cache_key.cookie and dict.itemCode eq 'include_cookie' }"> checked</c:if>
<c:if test="${!empty _cfg.userRegion.cache_key.ignore_qs and dict.itemCode eq 'ignore_query_string' }"> checked</c:if>
value="${dict.itemCode }" />
<spring:message code="${dict.itemValue }" />
<span></span>
</label>
</c:forEach>
</div>
</div>
</div>
</div>
</div>
<div class="row cacheAction">
<div class="col-md-6 cookie <c:if test='${empty _cfg.userRegion.cache_key.cookie }'>hidden</c:if>">
<div class="form-group">
<label class="control-label col-md-3">
<spring:message code="include_cookie" />
</label>
<div class="col-md-6">
<input id="cookie" name="cookie" class="form-control invisibleChar" type="text" value="${_cfg.userRegion.cache_key.cookie}">
</div>
<div for="cookie"></div>
</div>
</div>
<%-- <c:set var="propertyName" >ignore_qs</c:set> --%>
<div class="col-md-6 ignore_qs <c:if test='${empty _cfg.userRegion.cache_key.ignore_qs }'>hidden</c:if>">
<div class="form-group">
<label class="control-label col-md-3">
<spring:message code="ignore_query_string" />
</label>
<div class="col-md-6">
<input id="ignore_qs" name="ignore_qs" class="form-control tags" type="text"
value="${fn:replace(fn:replace(_cfg.userRegion.cache_key.ignore_qs, '[',''),']','')}">
</div>
<div for="ignore_qs"></div>
</div>
</div>
</div>
<div class="row cacheAction">
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-3">
<spring:message code="no_revalidate" />
</label>
<div class="col-md-6">
<select name="userRegion['no_revalidate']" id="no_revalidate"
class="selectpicker show-tick form-control">
<c:forEach items="${fns:getDictList('CACHE_NO_REVALIDATE')}" var="dict">
<option value="${dict.itemCode}"
<c:if test="${_cfg.userRegion.no_revalidate eq dict.itemCode
|| (empty _cfg.userRegion.no_revalidate && dict.itemCode eq 0)}">selected</c:if>>
<spring:message code="${dict.itemValue}"/></option>
</c:forEach>
</select>
<%-- <input id="revalidate" name="userRegion['no_revalidate']" class="form-control" type="text" value="${_cfg.userRegion.no_revalidate}"> --%>
</div>
<div for="no_revalidate"></div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-3">
<spring:message code="cache_dyn_url" />
</label>
<div class="col-md-6">
<select name="userRegion['cache_dyn_url']" id="cache_dyn_url"
class="selectpicker show-tick form-control">
<c:forEach items="${fns:getDictList('CACHE_DYN_URL')}" var="dict">
<option value="${dict.itemCode}" <c:if test="${_cfg.userRegion.cache_dyn_url eq dict.itemCode || (empty _cfg.userRegion.cache_dyn_url && dict.itemCode eq 0)}">selected</c:if>><spring:message code="${dict.itemValue}"/></option>
</c:forEach>
</select>
<%-- <input id="cache_dyn_url" name="userRegion['cache_dyn_url']" class="form-control" type="text" value="${_cfg.userRegion.cache_dyn_url}"> --%>
</div>
<div for="userRegion['cache_dyn_url']"></div>
</div>
</div>
</div>
<div class="row cacheAction">
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-3">
<spring:message code="cache_cookied_cont" />
</label>
<div class="col-md-6">
<select name="userRegion['cache_cookied_cont']" id="cache_cookied_cont"
class="selectpicker show-tick form-control">
<c:forEach items="${fns:getDictList('CACHE_COOKIED_CONT')}" var="dict">
<option value="${dict.itemCode}" <c:if test="${_cfg.userRegion.cache_cookied_cont eq dict.itemCode || (empty _cfg.userRegion.cache_cookied_cont && dict.itemCode eq 0)}">selected</c:if>><spring:message code="${dict.itemValue}"/></option>
</c:forEach>
</select>
<%-- <input id="cache_cookied_cont" name="userRegion['cache_cookied_cont']" class="form-control" type="text" value="${_cfg.userRegion.cache_cookied_cont}"> --%>
</div>
<div for="cache_cookied_cont"></div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-3">
<spring:message code="ignore_req_nocache" />
</label>
<div class="col-md-6">
<select name="userRegion['ignore_req_nocache']" id="ignore_req_nocache"
class="selectpicker show-tick form-control">
<c:forEach items="${fns:getDictList('IGNORE_REQ_NOCACHE')}" var="dict">
<option value="${dict.itemCode}" <c:if test="${_cfg.userRegion.ignore_req_nocache eq dict.itemCode || (empty _cfg.userRegion.ignore_req_nocache && dict.itemCode eq 0)}">selected</c:if>><spring:message code="${dict.itemValue}"/></option>
</c:forEach>
</select>
<%-- <input id="ignore_req_nocache" name="userRegion['ignore_req_nocache']" class="form-control" type="text" value="${_cfg.userRegion.ignore_req_nocache}"> --%>
</div>
<div for="ignore_req_nocache"></div>
</div>
</div>
</div>
<div class="row cacheAction">
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-3">
<spring:message code="ignore_res_nocache" />
</label>
<div class="col-md-6">
<select name="userRegion['ignore_res_nocache']" id="ignore_res_nocache"
class="selectpicker show-tick form-control">
<c:forEach items="${fns:getDictList('IGNORE_REQ_NOCACHE')}" var="dict">
<option value="${dict.itemCode}" <c:if test="${_cfg.userRegion.ignore_res_nocache eq dict.itemCode || (empty _cfg.userRegion.ignore_res_nocache && dict.itemCode eq 0)}">selected</c:if>><spring:message code="${dict.itemValue}"/></option>
</c:forEach>
</select>
<%-- <input id="ignore_res_nocache" name="userRegion['ignore_res_nocache']" class="form-control" type="text" value="${_cfg.userRegion.ignore_res_nocache}"> --%>
</div>
<div for="ignore_res_nocache"></div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-3">
<spring:message code="force_caching" />
</label>
<div class="col-md-6">
<select name="userRegion['force_caching']" id="force_caching"
class="selectpicker show-tick form-control">
<c:forEach items="${fns:getDictList('FORCE_CACHING')}" var="dict">
<option value="${dict.itemCode}" <c:if test="${_cfg.userRegion.force_caching eq dict.itemCode || (empty _cfg.userRegion.force_caching && dict.itemCode eq 0)}">selected</c:if>><spring:message code="${dict.itemValue}"/></option>
</c:forEach>
</select>
<%-- <input id="force_caching" name="userRegion['force_caching']" class="form-control" type="text" value="${_cfg.userRegion.force_caching}"> --%>
</div>
<div for="force_caching"></div>
</div>
</div>
</div>
<div class="row cacheAction">
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-3">
<spring:message code="min_use" />
</label>
<div class="col-md-6">
<input id="min_use" name="userRegion['min_use']" class="form-control digits" type="text" value="${_cfg.userRegion.min_use}">
</div><div for="min_use"></div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-3">
<spring:message code="pinning_time" />
</label>
<div class="col-md-6">
<div class="input-group">
<input type="input" id="pinning_time" class="form-control input-small digits" name="userRegion['pinning_time']"
value="${fn:substring(_cfg.userRegion.pinning_time,0, fn:length(_cfg.userRegion.pinning_time)-1) }" />
<select id="pinning_time_unit"
class="selectpicker show-tick form-control input-small">
<c:forEach items="${fns:getDictList('CACHE_TIME_UNIT')}" var="dict">
<option value="${dict.itemCode}" <c:if test="${fns:endsWith(_cfg.userRegion.pinning_time,dict.itemCode)}">selected</c:if>><spring:message code="${dict.itemValue}"/></option>
</c:forEach>
</select>
</div>
<div for="pinning_time"></div>
<%-- <div class="input-group">
<input id="pinning_time_hour" class="form-control input-xsmall" type="text" />
<span class="input-group-btn">
<button class="btn" type="button">h</button>
</span>
<input id="pinning_time_min" class="form-control input-xsmall" type="text" />
<span class="input-group-btn">
<button class="btn" type="button">m</button>
</span>
<input id="pinning_time_sec" class="form-control input-xsmall" type="text" value="${fn:replace(_cfg.userRegion.pinning_time, 's', '') }" />
<span class="input-group-btn">
<button class="btn" type="button">s</button>
</span>
</div> --%>
</div>
</div>
</div>
</div>
<div class="row cacheAction">
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-3">
<spring:message code="max_cache_size" />
</label>
<div class="col-md-6">
<div class="input-group">
<input type="input" id="max_cache_size" class="form-control input-small digits" name="userRegion['max_cache_size']"
value="${fn:substring(_cfg.userRegion.max_cache_size,0, fn:length(_cfg.userRegion.max_cache_size)-1) }" />
<select id="max_cache_size_unit"
class="selectpicker show-tick form-control input-small">
<c:forEach items="${fns:getDictList('CACHE_SIZE_UNIT')}" var="dict">
<option value="${dict.itemCode}" <c:if test="${fns:endsWith(_cfg.userRegion.max_cache_size,dict.itemCode)}">selected</c:if>><spring:message code="${dict.itemValue}"/></option>
</c:forEach>
</select>
</div>
<div for="max_cache_size"></div>
<%-- <div class="input-group">
<input id="max_cache_size_g" class="form-control input-small" type="text" />
<span class="input-group-btn">
<button class="btn" type="button">G</button>
</span>
<input id="max_cache_size_m" class="form-control input-small" type="text" value="${fn:replace(_cfg.userRegion.max_cache_size, 'm', '')}" /> <span class="input-group-btn">
<button class="btn" type="button">M</button>
</span>
</div> --%>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-3">
<spring:message code="inactive_time" />
</label>
<div class="col-md-6">
<div class="input-group">
<input type="input" id="inactive_time" class="form-control input-small digits" name="userRegion['inactive_time']"
value="${fn:substring(_cfg.userRegion.inactive_time,0, fn:length(_cfg.userRegion.inactive_time)-1) }" />
<select id="inactive_time_unit"
class="selectpicker show-tick form-control input-small">
<c:forEach items="${fns:getDictList('CACHE_TIME_UNIT')}" var="dict">
<option value="${dict.itemCode}" <c:if test="${fns:endsWith(_cfg.userRegion.inactive_time,dict.itemCode)}">selected</c:if>><spring:message code="${dict.itemValue}"/></option>
</c:forEach>
</select>
</div>
<div for="inactive_time"></div>
<%-- <div class="input-group">
<input id="inactive_time_hour" class="form-control input-xsmall" type="text" />
<span class="input-group-btn">
<button class="btn" type="button">h</button>
</span>
<input id="inactive_time_min" class="form-control input-xsmall" type="text" />
<span class="input-group-btn">
<button class="btn" type="button">m</button>
</span>
<input id="inactive_time_sec" class="form-control input-xsmall" type="text" value="${fn:replace(_cfg.userRegion.inactive_time, 's','')}" />
<span class="input-group-btn">
<button class="btn" type="button">s</button>
</span>
</div> --%>
<%-- <input id="inactive_time" name="userRegion['inactive_time']" class="form-control" type="text" value="${_cfg.userRegion.inactive_time}"> --%>
</div>
</div>
</div>
</div>
<div class="row cacheAction">
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-3">
<spring:message code="max_cache_obj_size" />
</label>
<div class="col-md-6">
<div class="input-group">
<input type="input" id="max_cache_obj_size" class="form-control input-small digits"
name="userRegion['max_cache_obj_size']"
value="${fn:substring(_cfg.userRegion.max_cache_obj_size, 0,fn:length(_cfg.userRegion.max_cache_obj_size)-1) }" />
<select id="max_cache_obj_size_unit"
class="selectpicker show-tick form-control input-small">
<c:forEach items="${fns:getDictList('CACHE_SIZE_UNIT')}" var="dict">
<option value="${dict.itemCode}" <c:if test="${fns:endsWith(_cfg.userRegion.max_cache_obj_size,dict.itemCode)}">selected</c:if>><spring:message code="${dict.itemValue}"/></option>
</c:forEach>
</select>
</div>
<div for="max_cache_obj_size"></div>
</div>
</div>
</div>
</div>
<br>
<c:set var="strCfgIndex" value="0"></c:set>
<c:forEach items="${regionList}" var="region" varStatus="status">
<c:if test="${region.regionType eq 2 }">
<c:set var="tabName" value="${region.configRegionValue}Tab"></c:set>
<h4 class="form-section">
<spring:message code="${region.configRegionValue}" />
<small> <span
class="glyphicon glyphicon-plus ${tabName}Add"
onClick="addContent(this,'${tabName}')" title="add"></span></small>
</h4>
<c:set var="cfgName" value="stringList[${strCfgIndex}]"></c:set>
<c:choose>
<c:when test="${fn:length(_cfg.stringList)>0}">
<c:set var="isBreak" value="false" ></c:set>
<c:forEach items="${_cfg.stringList}" var="cfg">
<c:choose>
<c:when test="${region.configRegionValue eq cfg.cfgType and !isBreak}">
<div class="row boxSolid ${tabName}${status.index}">
<%@include file="/WEB-INF/views/cfg/complexCfgForm.jsp"%>
</div>
<c:set var="isBreak" value="true" ></c:set>
<c:set var="strCfgIndex" value="${strCfgIndex+1 }"></c:set>
</c:when>
</c:choose>
</c:forEach>
<c:if test="${!isBreak}">
<div class="row boxSolid ${tabName}${status.index} hidden disabled">
<%@include file="/WEB-INF/views/cfg/complexCfgForm.jsp"%>
</div>
<c:set var="strCfgIndex" value="${strCfgIndex+1 }"></c:set>
</c:if>
</c:when>
<c:otherwise>
<div class="row boxSolid ${tabName}${status.index} hidden disabled">
<%@include file="/WEB-INF/views/cfg/complexCfgForm.jsp"%>
</div>
<c:set var="strCfgIndex" value="${strCfgIndex+1 }"></c:set>
</c:otherwise>
</c:choose>
</c:if>
</c:forEach>
<%@include file="/WEB-INF/include/form/areaInfo.jsp"%>
<br>
<%@include file="/WEB-INF/include/form/basicInfo.jsp"%>
<div class="form-actions">
<div class="row">
<div class="col-md-6">
<div class="row">
<div class="col-md-offset-3 col-md-8">
<button id="save" type="submit" class="btn green">
<spring:message code="submit" />
</button>
<button id="cancel" type="button" class="btn default">
<spring:message code="cancel" />
</button>
</div>
</div>
</div>
<div class="col-md-6"></div>
</div>
</div>
</div>
</form>
<!-- END FORM-->
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,553 @@
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/include/taglib.jsp"%>
<html>
<head>
<title><spring:message code="${cfgName}"></spring:message></title>
<script>
$(document).ready(function() {
//搜索框提示语初始化
if("${cfg.cfgDesc}"){
$("#intype").val("${cfg.cfgDesc}");
}else if("${cfg.compileId}"){
$("#intype").val("${cfg.compileId}");
}else if("${cfg.strCfg.cfgKeywords}"){
$("#intype").val("${cfg.strCfg.cfgKeywords}");
}else{
$("#intype").attr("placeholder","<spring:message code='input'/> "+$("#seltype").find("option:selected").text());
}
$("#seltype").change(function(){
$("#intype").attr("placeholder","<spring:message code='input'/> "+$(this).find("option:selected").text());
});
//筛选功能初始化
filterActionInit();
$("#isAudit").change(function(){
page();
});
//reset
$("#resetBtn").on("click",function(){
$("select.selectpicker").each(function(){
$(this).selectpicker('val',$(this).find('option:first').val());
$(this).find("option").attr("selected",false);
$(this).find("option:first").attr("selected",true);
});
$(".Wdate").attr("value",'');
$("#level").attr("value",'');
$("#searchForm")[0].reset();
});
//异步获取子配置相关信息
$("span[id^=open]").click(function(){
var openId=$(this).attr("id");
var closeId=$(this).attr("id").replace("open","close");
var index=$(this).attr("id").replace("open","");
$("#"+openId).hide();
$("#"+closeId).show();
//var compileId=$(this).attr("compileId");
var cfgId=$(this).attr("cfgId");
if($("#"+openId).parent().parent().next("tr").hasClass("child")){
$("#"+openId).parent().parent().next("tr").show();
}else{
$.ajax({
type:'post',
async:false,
url:'${ctx}/proxy/cache/ajaxCacheSubList',
data:{"cfgId":cfgId,"index":index},
dataType:"html",
success:function(data){
var subTab="<tr class='child'>"+
"<td style='border-right: 1px solid #FFFFFF;'>"+
"<input type='checkbox' hidden='hidden'/>"+
"</td>"+
"<td colspan='"+($(".table tr").eq(0).children("th").length-1)+"'>";
var html="";
html+="<div class='row'>";
html = html+data;
subTab=subTab+html;
subTab+="</td>";
subTab+="</tr>";
$("#"+openId).parent().parent().after(subTab);
$("div[name='tabTitle"+index+"']").get(0).click();
}
});
}
});
$("span[id^=close]").on("click",function(){
var closeId=$(this).attr("id");
var openId=$(this).attr("id").replace("close","open");
$("#"+closeId).hide();
$("#"+openId).show();
$("#"+closeId).parent().parent().next("tr").hide();
});
$(".action").on("change", function() {
$("#serviceId").val($(this).attr("serviceId"));
$("#protocolId").val($(this).attr("protocolId"));
});
});
</script>
</head>
<body>
<div class="page-content">
<c:forEach items="${serviceList }" var="serviceDict">
<c:if test="${serviceDict.functionId== cfg.functionId}">
<c:set var="serviceName1" value="${serviceDict.serviceName }"/>
<c:set var="action" value="${serviceDict.action }"/>
</c:if>
</c:forEach>
<div class="theme-panel hidden-xs hidden-sm">
<c:set var="configPermissionName" value="cache:policy:config"/>
<c:set var="confirmPermissionName" value="cache:policy:confirm"/>
<c:set var="actionPath" value="${ctx}/proxy/cache/list?functionId=${cfg.functionId}"></c:set>
<shiro:hasPermission name="${configPermissionName }">
<button type="button" class="btn btn-primary"
onClick="javascript:window.location='${ctx}/proxy/cache/form?functionId=${cfg.functionId}'">
<i class="fa fa-plus"></i>
<spring:message code="add"></spring:message></button>
</shiro:hasPermission>
</div>
<h3 class="page-title">
<spring:message code="${cfg.menuNameCode }"></spring:message>
</h3>
<h5 class="page-header"></h5>
<div class="col-md-12">
<div class="portlet">
<div class="portlet-body">
<div class="row" >
<form:form id="searchForm" modelAttribute="cfg" action="${actionPath }" method="post" class="form-search">
<input id="functionId" name="functionId" type="hidden" value="${cfg.functionId}"/>
<input id="audit" name="audit" type="hidden" value="${audit}"/>
<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
<sys:tableSort id="orderBy" name="orderBy" value="${page.orderBy}"
callback="page();" />
<!-- 筛选按钮展开状态-->
<input id="isFilterAction" name="isFilterAction" type="hidden" value="${cfg.isFilterAction }"/>
<!-- 搜索内容与操作按钮栏 -->
<div class="col-md-12">
<div class="pull-left">
<c:set var="state"><spring:message code='state'/></c:set>
<form:select path="isAudit" class="selectpicker select2 input-small">
<form:option value=""><spring:message code="all_states"/></form:option>
<form:option value="0"><spring:message code="created"></spring:message></form:option>
<form:option value="1"><spring:message code="approved"></spring:message></form:option>
<form:option value="2"><spring:message code="unapproved"></spring:message></form:option>
</form:select>
</div>
<div class="pull-left">
<div class="input-group">
<div class="input-group-btn">
<form:select path="seltype" class="selectpicker select2 input-small" >
<form:option value="cfgDesc"><spring:message code="config_describe"></spring:message></form:option>
<form:option value="compileId"><spring:message code="cfg_id"></spring:message></form:option>
<form:option value="strCfg.cfgKeywords"><spring:message code="keywords"></spring:message></form:option>
<form:option value="action"><spring:message code="block_type"></spring:message></form:option>
<form:option value="isValid"><spring:message code="valid_identifier"></spring:message></form:option>
</form:select>
</div>
<input id="intype" class="form-control input-medium" type="text" value="">
<div class="input-group-btn">
<form:select id="actionSelect" path="action" class="selectpicker select2 input-small" >
<form:option value=""><spring:message code="select"/></form:option>
<c:forEach items="${serviceList}" var="service">
<form:option value="${service.action }"><spring:message code="action_${service.actionCode }"/></form:option>
</c:forEach>
</form:select>
<form:select path="isValid" class="selectpicker select2 input-small" >
<form:option value=""><spring:message code="select"/></form:option>
<form:option value="1"><spring:message code="yes"/></form:option>
<form:option value="0"><spring:message code="no"/></form:option>
</form:select>
</div>
</div>
</div>
<div class="pull-left">
<button type="button" class="btn blue" onClick="return page()"> <i class="fa fa-search"></i> <spring:message code="search"/> </button>
<button type="button" class="btn btn-default" id="resetBtn"> <i class="fa fa-refresh"></i> <spring:message code="reset"/> </button>
<button type="button" class="btn btn-default" id="filter-btn"> <spring:message code="filter"/> <i class="fa fa-angle-double-down"></i></button>
</div>
<div class="pull-right">
<shiro:hasPermission name="${configPermissionName }">
<sys:delRow url="${ctx}/proxy/cache/form" id="contentTable" label="update"></sys:delRow>
<sys:delRow url="${ctx}/proxy/cache/delete?isValid=-1&functionId=${cfg.functionId }" id="contentTable" label="delete"></sys:delRow>
<sys:delRow url="${ctx}/proxy/cache/exportHttp?functionId=${cfg.functionId }&audit=${audit}" id="contentTable" searchUrl="${actionPath }" label="export"></sys:delRow>
</shiro:hasPermission>
<shiro:hasPermission name="${confirmPermissionName }">
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-wrench"></i> <spring:message code="examine"></spring:message>
<i class="fa fa-angle-down"></i>
</button>
<ul class="dropdown-menu pull-right">
<li><sys:delRow url="${ctx}/proxy/cache/audit?isAudit=1&isValid=1&functionId=${cfg.functionId }" id="contentTable" label="approved"></sys:delRow></li>
<li><sys:delRow url="${ctx}/proxy/cache/audit?isAudit=2&isValid=0&functionId=${cfg.functionId }" id="contentTable" label="unapproved"></sys:delRow></li>
<li><sys:delRow url="${ctx}/proxy/cache/audit?isAudit=3&isValid=0&functionId=${cfg.functionId }" id="contentTable" label="cancelPass"></sys:delRow></li>
</ul>
</div>
</shiro:hasPermission>
<a class="btn btn-icon-only btn-default setfields tooltips"
data-container="body" data-placement="top" data-original-title=<spring:message code="custom_columns"/> href="javascript:;">
<i class="icon-wrench"></i>
</a>
</div>
</div>
<!-- /搜索内容与操作按钮栏 -->
<!-- 筛选搜索内容栏默认隐藏-->
<div class="col-md-12 filter-action-select-panle hide" >
<div class="row">
<div class="col-md-3">
<div class="form-group">
<label class="control-label"><spring:message code='letter'/></label>
<c:set var="select"><spring:message code='select'/></c:set>
<form:select path="requestId" class="selectpicker form-control" data-live-search="true" data-live-search-placeholder="search">
<form:option value=""><spring:message code="select"/></form:option>
<c:forEach items="${requestInfos}" var="requestInfo" >
<form:option value="${requestInfo.id}"><spring:message code="${requestInfo.requestTitle}"></spring:message></form:option>
</c:forEach>
</form:select>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label class="control-label"><spring:message code='classification'/></label>
<form:select path="classify" class="selectpicker form-control" data-live-search="true" data-live-search-placeholder="search">
<form:option value=""><spring:message code="select"/></form:option>
<c:forEach items="${fls}" var="fl" >
<form:option value="${fl.serviceDictId}"><spring:message code="${fl.itemValue}"></spring:message></form:option>
</c:forEach>
</form:select>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label class="control-label"><spring:message code='attribute'/></label>
<c:set var="select"><spring:message code='select'/></c:set>
<form:select path="attribute" class="selectpicker form-control" data-live-search="true" data-live-search-placeholder="search">
<form:option value=""><spring:message code="select"/></form:option>
<c:forEach items="${xzs}" var="xz" >
<form:option value="${xz.serviceDictId}"><spring:message code="${xz.itemValue}"></spring:message></form:option>
</c:forEach>
</form:select>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label class="control-label"><spring:message code='label'/></label>
<form:select path="lable" class="selectpicker form-control" data-live-search="true" data-live-search-placeholder="search">
<form:option value=""><spring:message code="select"/></form:option>
<c:forEach items="${lables}" var="lable" >
<form:option value="${lable.serviceDictId}"><spring:message code="${lable.itemValue}"></spring:message></form:option>
</c:forEach>
</form:select>
</div>
</div>
</div>
<div class="row">
<div class="col-md-2">
<div class="form-group">
<label><spring:message code="config_time"/></label>
<input name="search_create_time_start" type="text" readonly="readonly" maxlength="20" class="form-control Wdate"
value="<fmt:formatDate value='${cfg.search_create_time_start}' pattern='yyyy-MM-dd HH:mm:ss'/>" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<label>&nbsp;</label>
<input name="search_create_time_end" type="text" readonly="readonly" maxlength="20" class="form-control Wdate"
value="<fmt:formatDate value="${cfg.search_create_time_end}" pattern="yyyy-MM-dd HH:mm:ss"/>" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<label><spring:message code="edit_time"/></label>
<input name="search_edit_time_start" type="text" readonly="readonly" maxlength="20" class="form-control Wdate"
value="<fmt:formatDate value="${cfg.search_edit_time_start}" pattern="yyyy-MM-dd HH:mm:ss"/>" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<label>&nbsp;</label>
<input name="search_edit_time_end" type="text" readonly="readonly" maxlength="20" class="form-control Wdate"
value="<fmt:formatDate value="${cfg.search_edit_time_end}" pattern="yyyy-MM-dd HH:mm:ss"/>" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<label><spring:message code="audit_time"/></label>
<input name="search_audit_time_start" type="text" readonly="readonly" maxlength="20" class="form-control Wdate"
value="<fmt:formatDate value="${cfg.search_audit_time_start}" pattern="yyyy-MM-dd HH:mm:ss"/>" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<label>&nbsp;</label>
<input name="search_audit_time_end" type="text" readonly="readonly" maxlength="20" class="form-control Wdate"
value="<fmt:formatDate value="${cfg.search_audit_time_end}" pattern="yyyy-MM-dd HH:mm:ss"/>" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/>
</div>
</div>
</div>
</div>
<c:forEach items="${serviceList}" var="service"
varStatus="satus">
<c:if
test="${cfg.functionId eq service.functionId}">
<c:set var="action" value="${service.action }"></c:set>
</c:if>
</c:forEach>
<!-- /筛选搜索内容栏 结束-->
</form:form>
</div>
<sys:message content="${message}"/>
<div class="table-responsive">
<table id="contentTable" class="table table-striped table-bordered table-condensed text-nowrap">
<thead>
<tr>
<th><input type="checkbox" class="i-checks" id="checkAll"></th>
<th class="sort-column a.compile_id" style="display: none"><spring:message code="cfg_id"/></th>
<th class="sort-column a.cfg_desc cfgDesc"><spring:message code="config_describe"/></th>
<th class="sort-column a.action"><spring:message code="block_type"/></th>
<th><spring:message code="ignore_query_string"/></th>
<th><spring:message code="include_cookie"/></th>
<th><spring:message code="no_revalidate"/></th>
<th><spring:message code="cache_dyn_url"/></th>
<th><spring:message code="cache_cookied_cont"/></th>
<th><spring:message code="ignore_req_nocache"/></th>
<th><spring:message code="ignore_res_nocache"/></th>
<th><spring:message code="force_caching"/></th>
<th><spring:message code="min_use"/></th>
<th><spring:message code="pinning_time"/></th>
<th><spring:message code="max_cache_size"/></th>
<th><spring:message code="inactive_time"/></th>
<th><spring:message code="max_cache_obj_size"/></th>
<th class="sort-column a.is_audit"><spring:message code="is_audit"/></th>
<th><spring:message code="whether_area_block"/></th>
<th><spring:message code="letter"/></th>
<th><spring:message code="classification"/></th>
<th><spring:message code="attribute"/></th>
<th><spring:message code="label"/></th>
<th class="sort-column a.is_valid"><spring:message code="valid_identifier"/></th>
<th><spring:message code="creator"/></th>
<th class="sort-column a.create_time"><spring:message code="config_time"/></th>
<th><spring:message code="editor"/></th>
<th class="sort-column a.edit_time"><spring:message code="edit_time"/></th>
<th><spring:message code="auditor"/></th>
<th class="sort-column a.audit_time"><spring:message code="audit_time"/></th>
</tr>
</thead>
<tbody>
<c:forEach items="${page.list }" var="indexCfg" varStatus="status" step="1">
<tr>
<td>
<span id="open${status.index}" class="" compileId="${indexCfg.compileId}" cfgId="${indexCfg.cfgId}"> ▷ </span><span style="display: none" id="close${status.index}" > ▼ </span>
<input type="checkbox" class="i-checks child-checks" id="${indexCfg.cfgId}" value="${indexCfg.isAudit}">
</td>
<td>${indexCfg.compileId }</td>
<td>${indexCfg.cfgDesc }</td>
<td>
<c:forEach items="${serviceList}" var="service"
varStatus="satus">
<c:if test="${indexCfg.functionId eq service.functionId}">
<c:if test="${indexCfg.action==service.action}"><spring:message code="${service.actionCode }"/></c:if>
</c:if>
</c:forEach>
</td>
<td>
${indexCfg.userRegion.cache_key.ignore_qs}
</td>
<td>
${indexCfg.userRegion.cache_key.cookie}
</td>
<td>
<c:forEach items="${fns:getDictList('CACHE_NO_REVALIDATE') }" var="dict">
<c:if test="${dict.itemCode eq indexCfg.userRegion.no_revalidate }">
<spring:message code="${dict.itemValue }"/>
</c:if>
</c:forEach>
</td>
<td>
<c:forEach items="${fns:getDictList('CACHE_DYN_URL') }" var="dict">
<c:if test="${dict.itemCode eq indexCfg.userRegion.cache_dyn_url }">
<spring:message code="${dict.itemValue }"/>
</c:if>
</c:forEach>
</td>
<td>
<c:forEach items="${fns:getDictList('CACHE_COOKIED_CONT') }" var="dict">
<c:if test="${dict.itemCode eq indexCfg.userRegion.cache_cookied_cont }">
<spring:message code="${dict.itemValue }"/>
</c:if>
</c:forEach>
</td>
<td>
<c:forEach items="${fns:getDictList('IGNORE_REQ_NOCACHE') }" var="dict">
<c:if test="${dict.itemCode eq indexCfg.userRegion.ignore_req_nocache }">
<spring:message code="${dict.itemValue }"/>
</c:if>
</c:forEach>
</td>
<td>
<c:forEach items="${fns:getDictList('IGNORE_RES_NOCACHE') }" var="dict">
<c:if test="${dict.itemCode eq indexCfg.userRegion.ignore_res_nocache }">
<spring:message code="${dict.itemValue }"/>
</c:if>
</c:forEach>
</td>
<td>
<c:forEach items="${fns:getDictList('FORCE_CACHING') }" var="dict">
<c:if test="${dict.itemCode eq indexCfg.userRegion.force_caching }">
<spring:message code="${dict.itemValue }"/>
</c:if>
</c:forEach>
</td>
<td>
${indexCfg.userRegion.min_use}
</td>
<td>
${indexCfg.userRegion.pinning_time}
</td>
<td>
${indexCfg.userRegion.max_cache_size}
</td>
<td>
${indexCfg.userRegion.inactive_time}
</td>
<td>
${indexCfg.userRegion.max_cache_obj_size}
</td>
<td>
<c:choose>
<c:when test="${indexCfg.isAudit eq '0'}"><span class="label label-danger"><spring:message code="created"></spring:message></span></c:when>
<c:when test="${indexCfg.isAudit eq '1'}"><span class="label label-success"><spring:message code="approved"></spring:message></span></c:when>
<c:when test="${indexCfg.isAudit eq '2'}"><span class="label label-warning"><spring:message code="unapproved"></spring:message></span></c:when>
<c:when test="${indexCfg.isAudit eq '3'}"><span indexTable="${indexCfg.indexTable}" data-placement="right" data-original-title="<spring:message code='letter_cancel_info'/>: " class="label le-ca-fo label-warning tooltips" data-icon="&#xe01e;"> <spring:message code="cancel_approved"/></span></c:when>
</c:choose>
</td>
<td>
<c:if test="${indexCfg.isAreaEffective==0}"><spring:message code="all"/></c:if>
<c:if test="${indexCfg.isAreaEffective==1}">
<a href="javascript:viewAreaInfo('${ctx}','${indexCfg.areaEffectiveIds }','${indexCfg.compileId }')" >
<spring:message code="selective"/>
</a>
</c:if>
</td>
<td>${indexCfg.requestName }</td>
<td>
<c:set var="classify"></c:set>
<c:forEach items="${fn:split(indexCfg.classify,',')}" var="classifyId" varStatus="status">
<c:forEach items="${fls}" var="fl">
<c:if test="${classifyId eq fn:trim(fl.serviceDictId)}">
<c:if test="${status.index+1 eq 1}">
<c:set var="classify" value="${fl.itemValue}"></c:set>
</c:if>
<c:if test="${status.index+1 ne 1}">
<c:set var="classify" value="${classify},${fl.itemValue}"></c:set>
</c:if>
</c:if>
</c:forEach>
</c:forEach>
<a href="javascript:;" data-original-title="${classify}"
class="tooltips" data-flag="false" data-html="true" data-placement="top">
${fns:abbr(classify,20)}
</a>
</td>
<td>
<c:set var="attribute"></c:set>
<c:forEach items="${fn:split(indexCfg.attribute,',')}" var="attributeId" varStatus="status">
<c:forEach items="${xzs}" var="xz">
<c:if test="${attributeId eq fn:trim(xz.serviceDictId)}">
<c:if test="${status.index+1 eq 1}">
<c:set var="attribute" value="${xz.itemValue}"></c:set>
</c:if>
<c:if test="${status.index+1 ne 1}">
<c:set var="attribute" value="${attribute},${xz.itemValue}"></c:set>
</c:if>
</c:if>
</c:forEach>
</c:forEach>
<a href="javascript:;" data-original-title="${attribute}"
class="tooltips" data-flag="false" data-html="true" data-placement="top">
${fns:abbr(attribute,20)}
</a>
</td>
<td>
<c:set var="lableInfo"></c:set>
<c:forEach items="${fn:split(indexCfg.lable,',')}" var="lableId" varStatus="status">
<c:forEach items="${lables}" var="lable">
<c:if test="${lableId eq fn:trim(lable.serviceDictId)}">
<c:if test="${status.index+1 eq 1}">
<c:set var="lableInfo" value="${lable.itemValue}"></c:set>
</c:if>
<c:if test="${status.index+1 ne 1}">
<c:set var="lableInfo" value="${lableInfo},${lable.itemValue}"></c:set>
</c:if>
</c:if>
</c:forEach>
</c:forEach>
<a href="javascript:;" data-original-title="${lableInfo}"
class="tooltips" data-flag="false" data-html="true" data-placement="top">
${fns:abbr(lableInfo,20)}
</a>
</td>
<td>
<c:if test="${indexCfg.isValid==0}"><spring:message code="no"/></c:if>
<c:if test="${indexCfg.isValid==1}"><spring:message code="yes"/></c:if>
<c:if test="${indexCfg.isValid==-1}"><spring:message code="deleted"/></c:if>
</td>
<td>${indexCfg.creatorName }</td>
<td><fmt:formatDate value="${indexCfg.createTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
<td>${indexCfg.editorName }</td>
<td><fmt:formatDate value="${indexCfg.editTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
<td>${indexCfg.auditorName }</td>
<td><fmt:formatDate value="${indexCfg.auditTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
</tr>
</c:forEach>
</tbody>
</table>
<div class="page" >${page}</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@@ -373,6 +373,7 @@
<script src="${pageContext.request.contextPath}/static/global/plugins/highcharts/js/drilldown.js"></script>
<script src="${pageContext.request.contextPath}/static/global/plugins/highcharts/js/no-data-to-display.js"></script>
<script src="${pageContext.request.contextPath}/static/global/plugins/highcharts/js/sunburst.js"></script>
<script src="${pageContext.request.contextPath}/static/global/plugins/highcharts/js/exporting.js"></script>
<script src="${pageContext.request.contextPath}/static/pages/scripts/echart.js"></script>
<%-- <script src="${pageContext.request.contextPath}/static/global/plugins/highcharts/themes/grid.js"></script> --%>

View File

@@ -70,6 +70,7 @@
</div>
</div>
<script src="${pageContext.request.contextPath}/static/global/plugins/highcharts/js/highcharts.js"></script>
<script src="${pageContext.request.contextPath}/static/global/plugins/highcharts/js/exporting.js"></script>
<%-- <script src="${pageContext.request.contextPath}/static/global/plugins/highcharts/themes/grid.js"></script> --%>
<script type="text/javascript">
$(document).ready(function(){
@@ -78,7 +79,6 @@ $(document).ready(function(){
});
function showIpActiveChart(rs){
console.log(rs)
var data=new Array();
var xData=new Array();
xData=rs[0].statTime;
@@ -90,6 +90,21 @@ function showIpActiveChart(rs){
});
})
var chart = Highcharts.chart('chart', {
exporting: {
allowHTML:true,
url:'saveAsImage',
filename:'Active-IP',
chartOptions: {
plotOptions: {
series: {
dataLabels: {
enabled: true,
allowOverlap: true, // 允许数据标签重叠
},
},
}
}
},
title: {
text: null
},

View File

@@ -31,8 +31,8 @@ $(document).ready(function(){
<div class="theme-panel hidden-xs hidden-sm">
</div>
<h3 class="page-title">
<c:if test="${log.isBlock eq 1 }"><spring:message code="protected_ddos"/></c:if>
<c:if test="${log.isBlock eq 0 }"><spring:message code="usual_ddos"/></c:if>
<spring:message code="protected_ddos"/>
<%-- <c:if test="${log.isBlock eq 0 }"><spring:message code="usual_ddos"/></c:if> --%>
</h3>
<h5 class="page-header"></h5>
@@ -142,13 +142,15 @@ $(document).ready(function(){
<input id="dIp" name="dIp" class="form-control" type="text" value="${log.dIp}"/>
</div>
</div>
</div>
<div class="row">
<div class="col-md-2">
<label><spring:message code="cfg_id"></spring:message></label>
<input name="cfgId" type="text" class="form-control logCfgId number" value="${log.cfgId }"/>
</div>
</div>
</div>
<!-- /筛选搜索内容栏 结束-->
</form:form>

View File

@@ -6839,7 +6839,7 @@ Portlets
/* Basic portlet */
.portlet {
margin-top: 0px;
margin-bottom: 25px;
/* margin-bottom: 25px; */
padding: 0px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
@@ -22290,7 +22290,7 @@ Color library demo
/*閿熸枻鎷烽敓鏂ゆ嫹閿熸枻鎷峰紡*/
/*闁跨喐鏋婚幏鐑芥晸閺傘倖瀚归柨鐔告灮閹峰嘲绱<EFBFBD>*/
.sort-column {
@@ -22562,7 +22562,7 @@ transition: background-color .1s ease-in-out;
/* END SHOW MORE CSS**/
/**閻庢稒鍔欓崢銈囩磾椤曪拷閿熻棄顦甸妴宥夊础閳╁啰澹夌<EFBFBD>顕嗘嫹**/
/**闁诲孩绋掗崝娆撳储閵堝洨纾炬い鏇嫹闁跨喕妫勯ˇ鐢稿Υ瀹ュ纭<EFBFBD>闁斥晛鍟版竟澶岋拷椤曞棙瀚<EFBFBD>**/
.tabInfo {
border: 1px solid #c2cad8;
padding: 5px;

View File

@@ -0,0 +1,26 @@
/*
Highcharts JS v6.1.0 (2018-04-13)
Exporting module
(c) 2010-2017 Torstein Honsi
License: www.highcharts.com/license
*/
(function(h){"object"===typeof module&&module.exports?module.exports=h:h(Highcharts)})(function(h){(function(f){var h=f.defaultOptions,z=f.doc,A=f.Chart,w=f.addEvent,H=f.removeEvent,D=f.fireEvent,q=f.createElement,B=f.discardElement,u=f.css,p=f.merge,r=f.pick,k=f.each,E=f.objectEach,t=f.extend,I=f.isTouchDevice,C=f.win,F=C.navigator.userAgent,J=f.Renderer.prototype.symbols;/Edge\/|Trident\/|MSIE /.test(F);/firefox/i.test(F);t(h.lang,{/*printChart:"Print chart",*/downloadPNG:"Download PNG image",downloadJPEG:"Download JPEG image",
/*downloadPDF:"Download PDF document",*/downloadSVG:"Download SVG vector image",contextButtonTitle:"Chart context menu"});h.navigation={buttonOptions:{theme:{},symbolSize:14,symbolX:12.5,symbolY:10.5,align:"right",buttonSpacing:3,height:22,verticalAlign:"top",width:24}};p(!0,h.navigation,{menuStyle:{border:"1px solid #999999",background:"#ffffff",padding:"5px 0"},menuItemStyle:{padding:"0.5em 1em",background:"none",color:"#333333",fontSize:I?"14px":"11px",transition:"background 250ms, color 250ms"},menuItemHoverStyle:{background:"#335cad",
color:"#ffffff"},buttonOptions:{symbolFill:"#666666",symbolStroke:"#666666",symbolStrokeWidth:3,theme:{fill:"#ffffff",stroke:"none",padding:5}}});h.exporting={type:"image/png",url:"${pageContext.request.contextPath}/",printMaxWidth:780,scale:2,buttons:{contextButton:{className:"highcharts-contextbutton",menuClassName:"highcharts-contextmenu",symbol:"menu",_titleKey:"contextButtonTitle",menuItems:"printChart separator downloadPNG downloadJPEG downloadPDF downloadSVG".split(" ")}},menuItemDefinitions:{/*printChart:{textKey:"printChart",
onclick:function(){this.print()}},*/separator:{separator:!0},downloadPNG:{textKey:"downloadPNG",onclick:function(){this.exportChart()}},downloadJPEG:{textKey:"downloadJPEG",onclick:function(){this.exportChart({type:"image/jpeg"})}},/*downloadPDF:{textKey:"downloadPDF",onclick:function(){this.exportChart({type:"application/pdf"})}},*/downloadSVG:{textKey:"downloadSVG",onclick:function(){this.exportChart({type:"image/svg+xml"})}}}};f.post=function(a,b,e){var c=q("form",p({method:"post",action:a,enctype:"multipart/form-data"},
e),{display:"none"},z.body);E(b,function(a,b){q("input",{type:"hidden",name:b,value:a},null,c)});c.submit();B(c)};t(A.prototype,{sanitizeSVG:function(a,b){if(b&&b.exporting&&b.exporting.allowHTML){var e=a.match(/<\/svg>(.*?$)/);e&&e[1]&&(e='\x3cforeignObject x\x3d"0" y\x3d"0" width\x3d"'+b.chart.width+'" height\x3d"'+b.chart.height+'"\x3e\x3cbody xmlns\x3d"http://www.w3.org/1999/xhtml"\x3e'+e[1]+"\x3c/body\x3e\x3c/foreignObject\x3e",a=a.replace("\x3c/svg\x3e",e+"\x3c/svg\x3e"))}a=a.replace(/zIndex="[^"]+"/g,
"").replace(/isShadow="[^"]+"/g,"").replace(/symbolName="[^"]+"/g,"").replace(/jQuery[0-9]+="[^"]+"/g,"").replace(/url\(("|&quot;)(\S+)("|&quot;)\)/g,"url($2)").replace(/url\([^#]+#/g,"url(#").replace(/<svg /,'\x3csvg xmlns:xlink\x3d"http://www.w3.org/1999/xlink" ').replace(/ (|NS[0-9]+\:)href=/g," xlink:href\x3d").replace(/\n/," ").replace(/<\/svg>.*?$/,"\x3c/svg\x3e").replace(/(fill|stroke)="rgba\(([ 0-9]+,[ 0-9]+,[ 0-9]+),([ 0-9\.]+)\)"/g,'$1\x3d"rgb($2)" $1-opacity\x3d"$3"').replace(/&nbsp;/g,
"\u00a0").replace(/&shy;/g,"\u00ad");this.ieSanitizeSVG&&(a=this.ieSanitizeSVG(a));return a},getChartHTML:function(){return this.container.innerHTML},getSVG:function(a){var b,e,c,v,m,g=p(this.options,a);e=q("div",null,{position:"absolute",top:"-9999em",width:this.chartWidth+"px",height:this.chartHeight+"px"},z.body);c=this.renderTo.style.width;m=this.renderTo.style.height;c=g.exporting.sourceWidth||g.chart.width||/px$/.test(c)&&parseInt(c,10)||600;m=g.exporting.sourceHeight||g.chart.height||/px$/.test(m)&&
parseInt(m,10)||400;t(g.chart,{animation:!1,renderTo:e,forExport:!0,renderer:"SVGRenderer",width:c,height:m});g.exporting.enabled=!1;delete g.data;g.series=[];k(this.series,function(a){v=p(a.userOptions,{animation:!1,enableMouseTracking:!1,showCheckbox:!1,visible:a.visible});v.isInternal||g.series.push(v)});k(this.axes,function(a){a.userOptions.internalKey||(a.userOptions.internalKey=f.uniqueKey())});b=new f.Chart(g,this.callback);a&&k(["xAxis","yAxis","series"],function(c){var d={};a[c]&&(d[c]=a[c],
b.update(d))});k(this.axes,function(a){var c=f.find(b.axes,function(b){return b.options.internalKey===a.userOptions.internalKey}),d=a.getExtremes(),e=d.userMin,d=d.userMax;!c||void 0===e&&void 0===d||c.setExtremes(e,d,!0,!1)});c=b.getChartHTML();c=this.sanitizeSVG(c,g);g=null;b.destroy();B(e);return c},getSVGForExport:function(a,b){var e=this.options.exporting;return this.getSVG(p({chart:{borderRadius:0}},e.chartOptions,b,{exporting:{sourceWidth:a&&a.sourceWidth||e.sourceWidth,sourceHeight:a&&a.sourceHeight||
e.sourceHeight}}))},exportChart:function(a,b){b=this.getSVGForExport(a,b);a=p(this.options.exporting,a);f.post(a.url,{filename:a.filename||"chart",type:a.type,width:a.width||0,scale:a.scale,svg:b},a.formAttributes)},print:function(){var a=this,b=a.container,e=[],c=b.parentNode,f=z.body,m=f.childNodes,g=a.options.exporting.printMaxWidth,d,n;if(!a.isPrinting){a.isPrinting=!0;a.pointer.reset(null,0);D(a,"beforePrint");if(n=g&&a.chartWidth>g)d=[a.options.chart.width,void 0,!1],a.setSize(g,void 0,!1);
k(m,function(a,b){1===a.nodeType&&(e[b]=a.style.display,a.style.display="none")});f.appendChild(b);C.focus();C.print();setTimeout(function(){c.appendChild(b);k(m,function(a,b){1===a.nodeType&&(a.style.display=e[b])});a.isPrinting=!1;n&&a.setSize.apply(a,d);D(a,"afterPrint")},1E3)}},contextMenu:function(a,b,e,c,v,m,g){var d=this,n=d.options.navigation,h=d.chartWidth,G=d.chartHeight,p="cache-"+a,l=d[p],x=Math.max(v,m),y,r;l||(d[p]=l=q("div",{className:a},{position:"absolute",zIndex:1E3,padding:x+"px"},
d.container),y=q("div",{className:"highcharts-menu"},null,l),u(y,t({MozBoxShadow:"3px 3px 10px #888",WebkitBoxShadow:"3px 3px 10px #888",boxShadow:"3px 3px 10px #888"},n.menuStyle)),r=function(){u(l,{display:"none"});g&&g.setState(0);d.openMenu=!1},d.exportEvents.push(w(l,"mouseleave",function(){l.hideTimer=setTimeout(r,500)}),w(l,"mouseenter",function(){f.clearTimeout(l.hideTimer)}),w(z,"mouseup",function(b){d.pointer.inClass(b.target,a)||r()})),k(b,function(a){"string"===typeof a&&(a=d.options.exporting.menuItemDefinitions[a]);
if(f.isObject(a,!0)){var b;a.separator?b=q("hr",null,null,y):(b=q("div",{className:"highcharts-menu-item",onclick:function(b){b&&b.stopPropagation();r();a.onclick&&a.onclick.apply(d,arguments)},innerHTML:a.text||d.options.lang[a.textKey]},null,y),b.onmouseover=function(){u(this,n.menuItemHoverStyle)},b.onmouseout=function(){u(this,n.menuItemStyle)},u(b,t({cursor:"pointer"},n.menuItemStyle)));d.exportDivElements.push(b)}}),d.exportDivElements.push(y,l),d.exportMenuWidth=l.offsetWidth,d.exportMenuHeight=
l.offsetHeight);b={display:"block"};e+d.exportMenuWidth>h?b.right=h-e-v-x+"px":b.left=e-x+"px";c+m+d.exportMenuHeight>G&&"top"!==g.alignOptions.verticalAlign?b.bottom=G-c-x+"px":b.top=c+m-x+"px";u(l,b);d.openMenu=!0},addButton:function(a){var b=this,e=b.renderer,c=p(b.options.navigation.buttonOptions,a),f=c.onclick,m=c.menuItems,g,d,n=c.symbolSize||12;b.btnCount||(b.btnCount=0);b.exportDivElements||(b.exportDivElements=[],b.exportSVGElements=[]);if(!1!==c.enabled){var h=c.theme,k=h.states,q=k&&k.hover,
k=k&&k.select,l;delete h.states;f?l=function(a){a.stopPropagation();f.call(b,a)}:m&&(l=function(){b.contextMenu(d.menuClassName,m,d.translateX,d.translateY,d.width,d.height,d);d.setState(2)});c.text&&c.symbol?h.paddingLeft=r(h.paddingLeft,25):c.text||t(h,{width:c.width,height:c.height,padding:0});d=e.button(c.text,0,0,l,h,q,k).addClass(a.className).attr({"stroke-linecap":"round",title:r(b.options.lang[c._titleKey],""),zIndex:3});d.menuClassName=a.menuClassName||"highcharts-menu-"+b.btnCount++;c.symbol&&
(g=e.symbol(c.symbol,c.symbolX-n/2,c.symbolY-n/2,n,n,{width:n,height:n}).addClass("highcharts-button-symbol").attr({zIndex:1}).add(d),g.attr({stroke:c.symbolStroke,fill:c.symbolFill,"stroke-width":c.symbolStrokeWidth||1}));d.add().align(t(c,{width:d.width,x:r(c.x,b.buttonOffset)}),!0,"spacingBox");b.buttonOffset+=(d.width+c.buttonSpacing)*("right"===c.align?-1:1);b.exportSVGElements.push(d,g)}},destroyExport:function(a){var b=a?a.target:this;a=b.exportSVGElements;var e=b.exportDivElements,c=b.exportEvents,
h;a&&(k(a,function(a,c){a&&(a.onclick=a.ontouchstart=null,h="cache-"+a.menuClassName,b[h]&&delete b[h],b.exportSVGElements[c]=a.destroy())}),a.length=0);e&&(k(e,function(a,c){f.clearTimeout(a.hideTimer);H(a,"mouseleave");b.exportDivElements[c]=a.onmouseout=a.onmouseover=a.ontouchstart=a.onclick=null;B(a)}),e.length=0);c&&(k(c,function(a){a()}),c.length=0)}});J.menu=function(a,b,e,c){return["M",a,b+2.5,"L",a+e,b+2.5,"M",a,b+c/2+.5,"L",a+e,b+c/2+.5,"M",a,b+c-1.5,"L",a+e,b+c-1.5]};A.prototype.renderExporting=
function(){var a=this,b=a.options.exporting,e=b.buttons,c=a.isDirtyExporting||!a.exportSVGElements;a.buttonOffset=0;a.isDirtyExporting&&a.destroyExport();c&&!1!==b.enabled&&(a.exportEvents=[],E(e,function(b){a.addButton(b)}),a.isDirtyExporting=!1);w(a,"destroy",a.destroyExport)};A.prototype.callbacks.push(function(a){a.renderExporting();w(a,"redraw",a.renderExporting);k(["exporting","navigation"],function(b){a[b]={update:function(e,c){a.isDirtyExporting=!0;p(!0,a.options[b],e);r(c,!0)&&a.redraw()}}})})})(h)});

View File

@@ -37,11 +37,11 @@ $(function(){
//获取td当前对象的文本,如果长度大于25;
if($(this).text().trim().length>28){
//给td设置title属性,并且设置td的完整值.给title属性.
var strTitle = $(this).text().trim();
var strTitle = $(this).text().trim().replace(/[\r\n]/g,"").replace(/\s+/g, " ");
//解决火狐title不能自动换行
var count = Math.floor(strTitle.length/64);
var count = Math.floor(strTitle.length/62);
for(var i=1;i<=count;i++){
strTitle=strTitle.substring(0,i*64-1)+"\n"+strTitle.substring(i*64-1);
strTitle=strTitle.substring(0,i*62-1)+"\n"+strTitle.substring(i*62-1);
}
$(this).attr("title",strTitle);
//获取td的值,进行截取。赋值给text变量保存.

View File

@@ -39,6 +39,21 @@
// margin:10,
},
exporting: {
allowHTML:true,
url:'saveAsImage',
filename:'Protocol-Type',
chartOptions: {
plotOptions: {
series: {
dataLabels: {
enabled: true,
allowOverlap: true, // 允许数据标签重叠
},
},
}
}
},
noData:{
style: {//设置字体颜色
color: '#fff',
@@ -203,6 +218,21 @@
marginTop:50,
inverted: true,
},
exporting: {
allowHTML:true,
url:'saveAsImage',
filename:'Active-IP',
chartOptions: {
plotOptions: {
series: {
dataLabels: {
enabled: true,
allowOverlap: true, // 允许数据标签重叠
},
},
}
}
},
noData:{
style: {//设置字体颜色
color: '#fff',
@@ -346,6 +376,21 @@
marginBottom:60,
},
exporting: {
allowHTML:true,
url:'saveAsImage',
filename:'App',
chartOptions: {
plotOptions: {
series: {
dataLabels: {
enabled: true,
allowOverlap: true, // 允许数据标签重叠
},
},
}
}
},
noData:{
style: {//设置字体颜色
color: '#fff',
@@ -485,6 +530,21 @@ function echart_2(rs){
plotShadow:false,
type: 'pie'
},
exporting: {
allowHTML:true,
url:'saveAsImage',
filename:'BS',
chartOptions: {
plotOptions: {
series: {
dataLabels: {
enabled: true,
allowOverlap: true, // 允许数据标签重叠
},
},
}
}
},
noData:{
style: {//设置字体颜色
color: '#fff',
@@ -609,6 +669,21 @@ function echart_5(rs){
plotShadow:false,
type: 'pie'
},
exporting: {
allowHTML:true,
url:'saveAsImage',
filename:'BS',
chartOptions: {
plotOptions: {
series: {
dataLabels: {
enabled: true,
allowOverlap: true, // 允许数据标签重叠
},
},
}
}
},
legend:{
width:480,
x:40,
@@ -734,7 +809,21 @@ function echart_4(rs){
plotShadow:false,
type: 'pie'
},
exporting: {
allowHTML:true,
url:'saveAsImage',
filename:'Website',
chartOptions: {
plotOptions: {
series: {
dataLabels: {
enabled: true,
allowOverlap: true, // 允许数据标签重叠
},
},
}
}
},
colors:[ '#44A9A8', '#f36f8a','#25f3e6','#ffff43','#964CEC','#32B0ED','#2b6ed7','#7278DD','#2DA9D8','#C66FE6'],
title: {
text: null,
@@ -853,6 +942,21 @@ function echart_6(rs){
plotShadow:false,
type: 'pie'
},
exporting: {
allowHTML:true,
url:'saveAsImage',
filename:'Website',
chartOptions: {
plotOptions: {
series: {
dataLabels: {
enabled: true,
allowOverlap: true, // 允许数据标签重叠
},
},
}
}
},
noData:{
style: {//设置字体颜色
color: '#fff',
@@ -976,6 +1080,21 @@ function echart_topic_domain(rs){
marginTop:50,
marginBottom:10,
},
exporting: {
allowHTML:true,
url:'saveAsImage',
filename:'Topic',
chartOptions: {
plotOptions: {
series: {
dataLabels: {
enabled: true,
allowOverlap: true, // 允许数据标签重叠
},
},
}
}
},
colors:[ '#44A9A8', '#f36f8a','#25f3e6','#ffff43','#964CEC','#32B0ED','#2b6ed7','#7278DD','#2DA9D8','#C66FE6','#0099cc','#cc0033','#ff6633','#99cccc','#d9f9d0'],
noData:{
style: {//设置字体颜色

View File

@@ -135,7 +135,7 @@ var importCfg=function(){
$error.addClass("show");
return false;
}else if(fileName.lastIndexOf("\.")==-1||fileName.substring(fileName.lastIndexOf("\.")+1).toLowerCase()!='xls' &&fileName.substring(fileName.lastIndexOf("\.")+1).toLowerCase()!='xlsx'){
}else if(fileName.lastIndexOf("\.")==-1/*||fileName.substring(fileName.lastIndexOf("\.")+1).toLowerCase()!='xls'*/ ||fileName.substring(fileName.lastIndexOf("\.")+1).toLowerCase()!='xlsx'){
$("span",$error).html($("#importTip").val());
$error.removeClass("hide");
$error.addClass("show");