缓存策略配置提交

Signed-off-by: zhangwei <zhangwei2@iie.ac.cn>
This commit is contained in:
zhangwei
2018-11-12 18:39:57 +08:00
parent b915a53f9b
commit 644570ccc4
16 changed files with 5335 additions and 2222 deletions

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;
/**
* 管理基础路径
*/

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").trim();
String hdrs = request.getParameter("hdrs").trim();
String cookie = request.getParameter("cookie").trim();
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);
}
if(!StringUtil.isBlank(cookie)){
map.put("cookie", cookie);
}
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

@@ -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

@@ -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

@@ -1309,10 +1309,6 @@ exception_info=Exception Infomation
no_tc_udp_port_comment_tip=Port must between 0
website_advanced_reject=HTTP Advanced Block
website_advanced_monit=HTTP Advanced Monit
snat_ip_reuse_adress_pool_loop=SNAT Address Pool Loop
dnat_ip_reuse_adress_pool_loop=DNAT Address Pool Loop
dnat_ip_complex_loop=DNAT Reuse Policy Loop
snat_ip_complex_loop=SNAT Reuse Policy Loop
encap_type=Encap Type
link_id=Link Id
inner_smac=Inner SMAC
@@ -1346,4 +1342,21 @@ sip_s_ip=SIP Client IP
sip_d_port=SIP Server Port
sip_s_port=SIP Client Port
call_id=SIP Call ID
request_uri=SIP Request URI
request_uri=SIP Request URIcache_policy=Cache Policy
PXY_CACHE_HTTP_URL=URL
PXY_CACHE_HTTP_COOKIE=Cookie
cache=Cache
cache_whitelist=Cache Bypass
cache_key=Cache key
ignore_query_string=Ignore Query String in URL
include_cookie=Include HTTP Header Fields
no_revalidate=Cache Revalidate
cache_dyn_url=Cache Dynamic Content
cache_cookied_cont=Cache Cookied Content
ignore_req_nocache=Ignore Request no-cache Headers
ignore_res_nocache=Ignore Response no-cache Headers
force_caching=Forcing Object Caching
min_use=Minimum Use
pinning_time=Cache Pinning Time
max_cache_size=Max Cache Size
inactive_time=Inactive Time

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

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

@@ -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,623 @@
<%@ 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() {
//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($(".action:checked").attr("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("name")
+ "']").append(error);
}
}
},
submitHandler : function(form) {
var flag = true;
var subscribeId=0;
var pinning_time=0;
var max_cache_size=0;
var inactive_time=0
if($("#pinning_time_hour").val()!=''){
pinning_time =pinning_time+parseInt($("#pinning_time_hour").val())*3600;
}
if($("#pinning_time_min").val()!=''){
pinning_time =pinning_time+parseInt($("#pinning_time_min").val())*60;
}
if($("#pinning_time_sec").val()!=''){
pinning_time =pinning_time+parseInt($("#pinning_time_sec").val());
}
if($("#inactive_time_hour").val()!=''){
inactive_time =inactive_time+parseInt($("#inactive_time_hour").val())*3600;
}
if($("#inactive_time_min").val()!=''){
inactive_time =inactive_time+parseInt($("#inactive_time_min").val())*60;
}
if($("#inactive_time_sec").val()!=''){
inactive_time =inactive_time+parseInt($("#inactive_time_sec").val());
}
if($("#max_cache_size_g").val()!=''){
max_cache_size =max_cache_size+parseInt($("#max_cache_size_g").val())*1024;
}
if($("#max_cache_size_m").val()!=''){
max_cache_size =max_cache_size+parseInt($("#max_cache_size_m").val());
}
alert(max_cache_size);
$("#pinning_time").val(pinning_time+"s");
$("#max_cache_size").val(max_cache_size+"m");
$("#inactive_time").val(inactive_time+"s");
//存在隐藏的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);
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">
<%-- <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 invisibleChar" type="text" value="${fn:replace(fn:replace(_cfg.userRegion.cache_key.ignore_qs, '[',''),']','')}">
</div>
<div for="ignore_qs"></div>
</div>
</div>
<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>
</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 1)}">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="userRegion['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="userRegion['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="userRegion['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="userRegion['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="userRegion['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" type="text" value="${_cfg.userRegion.min_use}">
</div><div for="userRegion.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">
<input type="hidden" id="pinning_time" name="userRegion['pinning_time']" value="${_cfg.userRegion.pinning_time }" />
<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">
<input type="hidden" id="max_cache_size" name="userRegion['max_cache_size']" value="${_cfg.userRegion.max_cache_size }" />
<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>
<!-- <input id="max_cache_size_k" class="form-control input-xsmall" type="text" >
<span class="input-group-btn">
<button class="btn" type="button">K</button>
</span> -->
</div>
<%-- <input id="max_cache_size" name="userRegion['max_cache_size']" class="form-control" type="text" value="${_cfg.userRegion.max_cache_size}"> --%>
</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">
<input type="hidden" id="inactive_time" name="userRegion['inactive_time']" value="${_cfg.userRegion.inactive_time }" />
<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>
<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,549 @@
<%@ 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 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>
<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>