(1)调整拦截action 为2

(2)修复导出bug
This commit is contained in:
wangxin
2019-05-23 19:12:37 +08:00
parent 672d76b046
commit 8261647a35
10 changed files with 66 additions and 56 deletions

View File

@@ -198,8 +198,7 @@ public class IpController extends BaseController{
*
* @param model
* @param cfg
* @param auditType 审核类型 批量审核时使用1批量生效0批量失效
* @param isAudit
* @param isAudit 审核类型 批量审核时使用1批量生效0批量失效
* @param isValid
* @param ids
* @param functionId
@@ -481,7 +480,7 @@ public class IpController extends BaseController{
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, IpRateLimitTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else if(serviceDict.getServiceId().equals(512)){
}else if(serviceDict.getAction().equals(2)){//forward
List<InterceptIpTemplate> classList=new ArrayList<InterceptIpTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, InterceptIpTemplate.class, 2);
excel.setDataList(pro,classList,null).
@@ -528,7 +527,7 @@ public class IpController extends BaseController{
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else if(regionDict.getFunctionId().equals(200)){// 拦截策略(域名)
if(serviceDict.getAction().equals(1)){// 监测
if(serviceDict.getAction().equals(2)){// forward
List<InterceptDomainTemplate> classList=new ArrayList<InterceptDomainTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, InterceptDomainTemplate.class, 2);
excel.setDataList(pro,classList,null).

View File

@@ -122,7 +122,7 @@ public class InterceptController extends CommonController {
public String saveInterceptIpCfg(RedirectAttributes redirectAttributes, Model model, HttpServletRequest request,
HttpServletResponse response, String ids, CfgIndexInfo entity) {
try {
if(!entity.getAction().equals(1)||!entity.getServiceId().equals(512)) {
if(!entity.getAction().equals(2)||!entity.getServiceId().equals(512)) {
entity.setUserRegion(null);
}else {
if(entity.getUserRegion()==null) {
@@ -476,6 +476,7 @@ public class InterceptController extends CommonController {
}
// 获取证书信息
List<PxyObjKeyring> certificateList = new ArrayList<PxyObjKeyring>();
//获取镜像相关信息
List<ProxyFileTrafficMirrorCfg> mirrorProfileList=new ArrayList<>();
if (entity.getFunctionId().equals(200)) {
certificateList = pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "ip");
@@ -494,7 +495,7 @@ public class InterceptController extends CommonController {
}
str.setUserRegion(new HashMap<String,Object>());
if (certificateList != null) {
if (entity.getFunctionId() == 200 ) {
if (entity.getFunctionId().equals(200) ) {
if (!StringUtil.isEmpty(str.getUserRegion1())&&str.getUserRegion1().startsWith("{")) {
Map<String,Object> userregion=BaseService.gsonFromJson(str.getUserRegion1(), Map.class);
@@ -576,16 +577,16 @@ public class InterceptController extends CommonController {
String cfgIndexInfoNoExport = "";
String ipPortInfoNoExport = ",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"
+ ",letter,whether_area_block,classification,attribute,label,block_type,"
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
String interceptNoExport = ",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"
+ ",letter,whether_area_block,classification,attribute,label,block_type,"
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
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,";
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,block_type,";
List<IpPortCfg> ipList = new ArrayList<IpPortCfg>();
List<BaseStringCfg> httpUrlList = new ArrayList<BaseStringCfg>();
@@ -607,26 +608,31 @@ public class InterceptController extends CommonController {
pktBinList.addAll(maps.get("PXY_INTERCEPT_PKT_BIN"));
if (entity.getFunctionId() == 200){
Properties msgProp = getMsgProp();
if(cfg.getAction().equals(1)) {
cfg.setUserRegion5(msgProp.getProperty("intercept"));
if(cfg.getAction().equals(2)) {
pxyInterceptCfgs.get(index).setUserRegion5(msgProp.getProperty("intercept"));
}else if(cfg.getAction().equals(48)) {
cfg.setUserRegion5(msgProp.getProperty("action_spoofing"));
pxyInterceptCfgs.get(index).setUserRegion5(msgProp.getProperty("action_spoofing"));
}else if(cfg.getAction().equals(128)) {
cfg.setUserRegion5(msgProp.getProperty("bypass"));
pxyInterceptCfgs.get(index).setUserRegion5(msgProp.getProperty("bypass"));
}else {
cfg.setUserRegion5(msgProp.getProperty(DictUtils.getDictLabels("SERVICE_ACTION", cfg.getAction().toString(), cfg.getAction().toString())));
pxyInterceptCfgs.get(index).setUserRegion5(msgProp.getProperty(DictUtils.getDictLabels("SERVICE_ACTION", cfg.getAction().toString(), cfg.getAction().toString())));
}
}
if (214==entity.getFunctionId()) {
if (!StringUtil.isBlank(cfg.getUserRegion1())) {
cfg.setUserRegion1(DictUtils.getDictLabels("SPOOFING_IP_TYPE", cfg.getUserRegion1(),cfg.getUserRegion1()));
}
}
index++;
}
if (214==entity.getFunctionId()) {
//为何多循环一次???
/*if (214==entity.getFunctionId()) {
for (CfgIndexInfo cfg : ipLists) {
if (!StringUtil.isBlank(cfg.getUserRegion1())) {
cfg.setUserRegion1(DictUtils.getDictLabels("SPOOFING_IP_TYPE", cfg.getUserRegion1(),cfg.getUserRegion1()));
}
}
}
}*/
pktBinList = BaseStringCfg.replaceBaseKeyList(pktBinList);
httpUrlList = BaseStringCfg.baseHexList(httpUrlList);
@@ -647,11 +653,15 @@ public class InterceptController extends CommonController {
dataMap.put("PXY_INTERCEPT_IP", ipList);
dataMap.put("PXY_INTERCEPT_PKT_BIN", pktBinList);
} else if (entity.getFunctionId() == 200) {// IP拦截
cfgIndexInfoNoExport = ",policy_name,group_name,userregion3,userregion4,block_type,&userregion1:intercept_file_strategy-userregion2:ratelimit-userregion5:block_type";
cfgIndexInfoNoExport = ",userRegion1,userRegion5,do_log,policy_name,group_name,userregion3,userregion4,block_type,&userregion2:ratelimit-userregion5:block_type";
titleList.add("PXY_INTERCEPT_IP");
classMap.put("PXY_INTERCEPT_IP", IpPortCfg.class);
noExportMap.put("PXY_INTERCEPT_IP", ipPortInfoNoExport);
dataMap.put("PXY_INTERCEPT_IP", ipList);
titleList.add("PXY_INTERCEPT_DOMAIN");
classMap.put("PXY_INTERCEPT_DOMAIN", HttpUrlCfg.class);
noExportMap.put("PXY_INTERCEPT_DOMAIN", httpUrlCfgNoExport);
dataMap.put("PXY_INTERCEPT_DOMAIN", httpUrlList);
} else if (entity.getFunctionId() == 201) {// 域名拦截
cfgIndexInfoNoExport = ",policy_name,group_name,userregion3,userregion4,&userregion2:ratelimit-userregion1:intercept_file_strategy-userregion5:intercept_intensity-";
titleList.add("NTC_HTTP_URL");