导出配置域关键字处理

This commit is contained in:
leijun
2018-10-18 16:03:08 +08:00
parent fce51498ae
commit 286d1fb122
5 changed files with 65 additions and 21 deletions

View File

@@ -1,3 +1,4 @@
package com.nis.web.controller.configuration.ntc;
import java.io.File;
@@ -15,6 +16,7 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.taglibs.standard.functions.Functions;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.FileCopyUtils;
@@ -26,7 +28,6 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.nis.domain.Page;
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.IpPortCfg;
import com.nis.domain.configuration.NtcSubscribeIdCfg;
@@ -528,7 +529,8 @@ public class FileTransferCfgController extends BaseController{
ipList.addAll(maps.get("NTC_UNIVERSAL_IP"));
subscribeInfoList.addAll(maps.get("NTC_SUBSCRIBE_ID"));
}
ftpkeyList=replaceList(ftpkeyList);
ftpurlList=replaceList(ftpurlList);
dataMap.put(entity.getMenuNameCode(), page.getList());
dataMap.put("NTC_IP", ipList);
dataMap.put("NTC_FTP_URL", ftpurlList);
@@ -542,5 +544,13 @@ public class FileTransferCfgController extends BaseController{
}
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
}
public static List<BaseStringCfg> replaceList(List<BaseStringCfg> list){
for (int i = 0; i < list.size(); i++) {
BaseStringCfg base=(BaseStringCfg)list.get(i);
base.setCfgKeywords(Functions.replace(base.getCfgKeywords(), "***and***"," "));
}
return list;
}
}

View File

@@ -11,6 +11,7 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.taglibs.standard.functions.Functions;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
@@ -605,11 +606,11 @@ public class WebsiteController extends BaseController{
noExportMap.put("NTC_UNIVERSAL_IP", ipPortCfgNoExport);
noExportMap.put("NTC_SUBSCRIBE_ID", ntcSubscribeIdCfgNoExport);
List<HttpUrlCfg> httpUrlList = new ArrayList<>();
List<HttpReqHeadCfg> httpReqHdrList = new ArrayList<>();
List<HttpResHeadCfg> httpResHdrList = new ArrayList<>();
List<HttpBodyCfg> httpReqBodyList = new ArrayList<>();
List<HttpBodyCfg> httpResBodyList = new ArrayList<>();
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<NtcSubscribeIdCfg> subscribeIdList = new ArrayList<>();
for (CfgIndexInfo cfg : page.getList()) {
@@ -622,7 +623,11 @@ public class WebsiteController extends BaseController{
ipPortList.addAll(maps.get("NTC_UNIVERSAL_IP"));
subscribeIdList.addAll(maps.get("NTC_SUBSCRIBE_ID"));
}
httpUrlList=replaceBaseList(httpUrlList);
httpReqHdrList=replaceComplexList(httpReqHdrList);
httpResHdrList=replaceComplexList(httpResHdrList);
httpReqBodyList=replaceBaseList(httpReqBodyList);
httpResBodyList=replaceBaseList(httpResBodyList);
dataMap.put(entity.getMenuNameCode(), page.getList());
dataMap.put("NTC_HTTP_URL", httpUrlList);
dataMap.put("NTC_HTTP_REQ_HDR", httpReqHdrList);
@@ -719,4 +724,19 @@ public class WebsiteController extends BaseController{
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
}
public static List<BaseStringCfg> replaceBaseList(List<BaseStringCfg> list){
for (int i = 0; i < list.size(); i++) {
BaseStringCfg base=(BaseStringCfg)list.get(i);
base.setCfgKeywords(Functions.replace(base.getCfgKeywords(), "***and***"," "));
}
return list;
}
public static List<ComplexkeywordCfg> replaceComplexList(List<ComplexkeywordCfg> list){
for (int i = 0; i < list.size(); i++) {
ComplexkeywordCfg base=(ComplexkeywordCfg)list.get(i);
base.setCfgKeywords(Functions.replace(base.getCfgKeywords(), "***and***"," "));
}
return list;
}
}

View File

@@ -11,6 +11,7 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.taglibs.standard.functions.Functions;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
@@ -354,6 +355,12 @@ public class WhiteListController extends CommonController{
CfgIndexInfo cfgIndexInfo=domainService.exportDomainInfo(cfg);
httpurlList.addAll(cfgIndexInfo.getHttpUrlList());
}
if(httpurlList.size()>0){
for (int i = 0; i < httpurlList.size(); i++) {
BaseStringCfg base=(BaseStringCfg)httpurlList.get(i);
base.setCfgKeywords(Functions.replace(base.getCfgKeywords(), "***and***"," "));
}
}
dataMap.put(entity.getMenuNameCode(), page.getList());
dataMap.put("NTC_HTTP_URL", httpurlList);
/*}*/

View File

@@ -11,6 +11,7 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.taglibs.standard.functions.Functions;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
@@ -217,11 +218,11 @@ public class InterceptController extends CommonController{
}
Page<CfgIndexInfo> page = ipCfgService.getIpCfgList(pageInfo, entity);
titleList.add(entity.getMenuNameCode());
titleList.add("ip_addrs");
titleList.add("intercept_pkt");
titleList.add("PXY_INTERCEPT_IP");
titleList.add("PXY_INTERCEPT_PKT_BIN");
classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class);
classMap.put("ip_addrs", IpPortCfg.class);
classMap.put("intercept_pkt", InterceptPktBin.class);
classMap.put("PXY_INTERCEPT_IP", IpPortCfg.class);
classMap.put("PXY_INTERCEPT_PKT_BIN", InterceptPktBin.class);
String cfgIndexInfoNoExport=",group_name,userregion4,userregion5,";
String ipPortInfoNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
+ ",config_time,editor,edit_time,auditor,audit_time"
@@ -232,8 +233,8 @@ public class InterceptController extends CommonController{
+",letter,whether_area_block,classification,attribute,label"
+",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
noExportMap.put("ip_addrs", ipPortInfoNoExport);
noExportMap.put("intercept_pkt", interceptNoExport);
noExportMap.put("PXY_INTERCEPT_IP", ipPortInfoNoExport);
noExportMap.put("PXY_INTERCEPT_PKT_BIN", interceptNoExport);
List<IpPortCfg> ipList=new ArrayList<IpPortCfg>();
List<InterceptPktBin> interInfoList=new ArrayList<InterceptPktBin>();
for (CfgIndexInfo cfg : page.getList()) {
@@ -241,9 +242,15 @@ public class InterceptController extends CommonController{
ipList.addAll(cfgIndexInfo.getIpPortList());
interInfoList.addAll(cfgIndexInfo.getInterceptPktBinList());
}
if(interInfoList.size()>0){
for (int i = 0; i < interInfoList.size(); i++) {
BaseStringCfg base=(BaseStringCfg)interInfoList.get(i);
base.setCfgKeywords(Functions.replace(base.getCfgKeywords(), "***and***"," "));
}
}
dataMap.put(entity.getMenuNameCode(), page.getList());
dataMap.put("ip_addrs", ipList);
dataMap.put("intercept_pkt", interInfoList);
dataMap.put("PXY_INTERCEPT_IP", ipList);
dataMap.put("PXY_INTERCEPT_PKT_BIN", interInfoList);
/*}*/
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);