补充操控配置导出缺少的action、response code列.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package com.nis.domain.configuration;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
public class ManipulatCfgExport extends CfgIndexInfo {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -842585769617969577L;
|
||||
|
||||
@ExcelField(title="action_export",dictType="SERVICE_ACTION",sort=2)
|
||||
private String actionExport;
|
||||
|
||||
@ExcelField(title="response_code",sort=2)
|
||||
private String responseCode;
|
||||
|
||||
public String getResponseCode() {
|
||||
return responseCode;
|
||||
}
|
||||
public void setResponseCode(String responseCode) {
|
||||
this.responseCode = responseCode;
|
||||
}
|
||||
public String getActionExport() {
|
||||
return actionExport;
|
||||
}
|
||||
public void setActionExport(String actionExport) {
|
||||
this.actionExport = actionExport;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -33,6 +33,7 @@ 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.ManipulatCfgExport;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.Constants;
|
||||
@@ -284,7 +285,7 @@ public class ManipulatPolicyController extends BaseController {
|
||||
return "redirect:" + adminPath + "/proxy/control/manipulatPolicy/list?functionId=" + functionId;
|
||||
}
|
||||
|
||||
// http配置导出
|
||||
// 配置导出
|
||||
@RequestMapping(value = "exportPolicy")
|
||||
public void exportPolicy(Model model,@ModelAttribute("cfg") CfgIndexInfo entity, String ids, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response) {
|
||||
@@ -309,7 +310,6 @@ public class ManipulatPolicyController extends BaseController {
|
||||
ipLists = page.getList();
|
||||
}
|
||||
|
||||
|
||||
//日志总量
|
||||
List<Map<String,Object>> logTotals=new ArrayList<Map<String,Object>>();
|
||||
StringBuilder compileIds=new StringBuilder(",");//配置ids
|
||||
@@ -320,8 +320,18 @@ public class ManipulatPolicyController extends BaseController {
|
||||
Map<String, String> replaceDict = DictUtils.getDictMap("CONTROL_REPLACE_ZONE"); // Replace
|
||||
|
||||
Properties prop = getMsgProp();
|
||||
for (CfgIndexInfo str : ipLists) {
|
||||
//str.setAction(Integer.valueOf(str.getUserRegion5()));
|
||||
List<ManipulatCfgExport> baseLists = new ArrayList<ManipulatCfgExport>();
|
||||
for (CfgIndexInfo source : ipLists) {
|
||||
ManipulatCfgExport str = new ManipulatCfgExport();
|
||||
BeanUtils.copyProperties(source, str);
|
||||
|
||||
if(str.getUserRegion5().equals("85")) {
|
||||
str.setActionExport("Hijack");
|
||||
}else if(str.getUserRegion5().equals("90")) {
|
||||
str.setActionExport("Insert");
|
||||
}else {
|
||||
str.setActionExport(str.getUserRegion5());
|
||||
}
|
||||
|
||||
if(str.getIsAudit()!=0){
|
||||
set.add(str.getServiceId());
|
||||
@@ -334,26 +344,16 @@ public class ManipulatPolicyController extends BaseController {
|
||||
}
|
||||
|
||||
if (!str.getUserRegion5().equals("85") && !str.getUserRegion5().equals("90")) {
|
||||
|
||||
/*String type = "RESPONSE_CODE";
|
||||
if (entity.getFunctionId() == 207) { // Block
|
||||
type = "RESPONSE_CODE";
|
||||
} else if (entity.getFunctionId() == 208) { // Redirect
|
||||
type = "REDIRECT_RESPONSE_CODE";
|
||||
} else if (entity.getFunctionId() == 209) { // Replace
|
||||
type = "CONTROL_REPLACE_ZONE";
|
||||
}*/
|
||||
|
||||
String value = "";
|
||||
if(str.getUserRegion5().equals("16")) {// Block
|
||||
value = blockDict.get(str.getUserRegion1());
|
||||
str.setDetail(prop.getProperty(value));
|
||||
str.setResponseCode(prop.getProperty(value));
|
||||
str.setUserRegion1(str.getUserRegion2());
|
||||
str.setUserRegion2(null);
|
||||
|
||||
}else if(str.getUserRegion5().equals("48")) {// Redirect
|
||||
value = redirectDict.get(str.getUserRegion1());
|
||||
str.setDetail(prop.getProperty(value));
|
||||
str.setResponseCode(prop.getProperty(value));
|
||||
str.setUserRegion1(null);
|
||||
|
||||
}else if(str.getUserRegion5().equals("80")) {// Replace
|
||||
@@ -388,6 +388,7 @@ public class ManipulatPolicyController extends BaseController {
|
||||
}
|
||||
str.setUserRegion5(null);
|
||||
}
|
||||
baseLists.add(str);
|
||||
}
|
||||
|
||||
//获取日志总量
|
||||
@@ -404,16 +405,8 @@ public class ManipulatPolicyController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
String cfgIndexInfoNoExport = ",block_type,policy_name,group_name,&detail:response_code-userregion1:response_content-userregion2:redirect_url-userregion3:replace_zone-userregion4:replaced_content-userregion5:replace_content-";
|
||||
/*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,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 cfgIndexInfoNoExport = ",block_type,policy_name,group_name,&action_export:block_type-responseCode:response_code-userregion1:response_content-userregion2:redirect_url-userregion3:replace_zone-userregion4:replaced_content-userregion5:replace_content-";
|
||||
|
||||
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"
|
||||
@@ -464,7 +457,7 @@ public class ManipulatPolicyController extends BaseController {
|
||||
List<BaseStringCfg> httpResBodyList = new ArrayList<>();
|
||||
List<IpPortCfg> ipPortList = new ArrayList<>();
|
||||
List<BaseStringCfg> subscribeIdList = new ArrayList<>();
|
||||
for (CfgIndexInfo cfg : ipLists) {
|
||||
for (ManipulatCfgExport cfg : baseLists) {
|
||||
Map<String, List> maps = manipulatPolicyService.exportHttpCfg(cfg);
|
||||
httpUrlList.addAll(maps.get("NTC_HTTP_URL"));
|
||||
httpReqHdrList.addAll(maps.get("NTC_HTTP_REQ_HDR"));
|
||||
@@ -491,13 +484,13 @@ public class ManipulatPolicyController extends BaseController {
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
titleList.add("NTC_HTTP_URL");
|
||||
titleList.add("NTC_HTTP_REQ_HDR");
|
||||
classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class);
|
||||
classMap.put(entity.getMenuNameCode(), ManipulatCfgExport.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(), ipLists);
|
||||
dataMap.put(entity.getMenuNameCode(), baseLists);
|
||||
dataMap.put("NTC_HTTP_URL", httpUrlList);
|
||||
dataMap.put("NTC_HTTP_REQ_HDR", httpReqHdrList);
|
||||
if (entity.getFunctionId() != 208 && entity.getFunctionId() != 211) {
|
||||
@@ -524,8 +517,6 @@ public class ManipulatPolicyController extends BaseController {
|
||||
dataMap.put("NTC_UNIVERSAL_IP", ipPortList);
|
||||
dataMap.put("NTC_SUBSCRIBE_ID", subscribeIdList);
|
||||
|
||||
/* } */
|
||||
|
||||
String timeRange = initTimeMap(entity);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(entity.getExType())) {
|
||||
@@ -540,10 +531,7 @@ public class ManipulatPolicyController extends BaseController {
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
/*
|
||||
* return "redirect:" + adminPath
|
||||
* +"/ntc/website/httpList?functionId="+entity.getFunctionId();
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
|
||||
Reference in New Issue
Block a user