diff --git a/src/main/java/com/nis/domain/configuration/HttpBodyCfg.java b/src/main/java/com/nis/domain/configuration/HttpBodyCfg.java index bc47c52a4..504811ca2 100644 --- a/src/main/java/com/nis/domain/configuration/HttpBodyCfg.java +++ b/src/main/java/com/nis/domain/configuration/HttpBodyCfg.java @@ -35,5 +35,12 @@ public class HttpBodyCfg extends BaseStringCfg { public static String getTablename() { return tableName; } + private String replaceContent; + public String getReplaceContent() { + return replaceContent; + } + public void setReplaceContent(String replaceContent) { + this.replaceContent = replaceContent; + } } diff --git a/src/main/java/com/nis/web/controller/BaseController.java b/src/main/java/com/nis/web/controller/BaseController.java index 782ebd05b..4278db7e4 100644 --- a/src/main/java/com/nis/web/controller/BaseController.java +++ b/src/main/java/com/nis/web/controller/BaseController.java @@ -60,6 +60,7 @@ 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.ComplexStringCfgService; +import com.nis.web.service.configuration.ControlPolicyService; import com.nis.web.service.configuration.DnsIpCfgService; import com.nis.web.service.configuration.DnsResStrategyService; import com.nis.web.service.configuration.FileTransferCfgService; @@ -117,6 +118,8 @@ public class BaseController { @Autowired protected AppCfgService appCfgService; + @Autowired + protected ControlPolicyService controlPolicyService; @Autowired diff --git a/src/main/java/com/nis/web/controller/configuration/proxy/DnsIpCfgController.java b/src/main/java/com/nis/web/controller/configuration/maintenance/DnsIpCfgController.java similarity index 95% rename from src/main/java/com/nis/web/controller/configuration/proxy/DnsIpCfgController.java rename to src/main/java/com/nis/web/controller/configuration/maintenance/DnsIpCfgController.java index 5253c2305..46fdd27b4 100644 --- a/src/main/java/com/nis/web/controller/configuration/proxy/DnsIpCfgController.java +++ b/src/main/java/com/nis/web/controller/configuration/maintenance/DnsIpCfgController.java @@ -1,4 +1,4 @@ -package com.nis.web.controller.configuration.proxy; +package com.nis.web.controller.configuration.maintenance; import java.util.Date; import java.util.List; diff --git a/src/main/java/com/nis/web/controller/configuration/proxy/DnsResStrategyController.java b/src/main/java/com/nis/web/controller/configuration/maintenance/DnsResStrategyController.java similarity index 96% rename from src/main/java/com/nis/web/controller/configuration/proxy/DnsResStrategyController.java rename to src/main/java/com/nis/web/controller/configuration/maintenance/DnsResStrategyController.java index 6b3843f46..fc019d312 100644 --- a/src/main/java/com/nis/web/controller/configuration/proxy/DnsResStrategyController.java +++ b/src/main/java/com/nis/web/controller/configuration/maintenance/DnsResStrategyController.java @@ -1,4 +1,4 @@ -package com.nis.web.controller.configuration.proxy; +package com.nis.web.controller.configuration.maintenance; import java.util.ArrayList; import java.util.Date; diff --git a/src/main/java/com/nis/web/controller/configuration/proxy/ControlPolicyController.java b/src/main/java/com/nis/web/controller/configuration/proxy/ControlPolicyController.java new file mode 100644 index 000000000..a7c4358fa --- /dev/null +++ b/src/main/java/com/nis/web/controller/configuration/proxy/ControlPolicyController.java @@ -0,0 +1,158 @@ +package com.nis.web.controller.configuration.proxy; + +import java.util.Date; +import java.util.List; + +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.servlet.mvc.support.RedirectAttributes; + +import com.nis.domain.Page; +import com.nis.domain.configuration.AreaIpCfg; +import com.nis.domain.configuration.BaseIpCfg; +import com.nis.domain.configuration.BaseStringCfg; +import com.nis.domain.configuration.HttpBodyCfg; +import com.nis.domain.configuration.HttpUrlCfg; +import com.nis.domain.configuration.IpPortCfg; +import com.nis.exceptions.MaatConvertException; +import com.nis.util.Constants; +import com.nis.util.StringUtil; +import com.nis.web.controller.BaseController; + +/** + * 控制策略 + * @author ddm + * + */ +@Controller +@RequestMapping("${adminPath}/proxy/control") +public class ControlPolicyController extends BaseController{ + @RequestMapping(value = {"httpReqReplace/list"}) + public String reqList(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")HttpBodyCfg entity){ + Page page = controlPolicyService.findPage(new Page(request, response,"r"), entity); + model.addAttribute("page", page); + initPageCondition(model); + return "/cfg/proxy/control/httpReqReplaceList"; + } + @RequestMapping(value = {"httpReqReplace/form"}) + @RequiresPermissions(value={"proxy:contol:httpReqReplace:config"}) + public String reqForm(Model model,HttpServletRequest request,HttpServletResponse response,String ids,@ModelAttribute("cfg")HttpBodyCfg cfg){ + if(!StringUtil.isEmpty(ids)){ + cfg = controlPolicyService.getHttpBodyCfgById(Long.valueOf(ids)); + initUpdateFormCondition(model, cfg); + }else{ + initFormCondition(model,cfg); + } + model.addAttribute("_cfg", cfg); + return "/cfg/proxy/control/httpReqReplaceForm"; + } + + @RequestMapping(value = {"httpReqReplace/saveOrUpdate"}) + public String reqSaveOrUpdate(Model model,HttpServletRequest request,HttpServletResponse response, + @ModelAttribute("cfg")HttpBodyCfg cfg, + @ModelAttribute("areaCfgIds")String areaCfgIds){ + try{ + controlPolicyService.saveOrUpdate(cfg,areaCfgIds); + addMessage(model,"save_success"); + }catch(Exception e){ + logger.error("信息保存失败",e); + e.printStackTrace(); + addMessage(model,"save_failed"); + } + + return "redirect:" + adminPath +"/proxy/control/httpReqReplace/list?functionId="+cfg.getFunctionId(); + } + + @RequestMapping(value = {"httpReqReplace/delete"}) + @RequiresPermissions(value={"proxy:contol:httpReqReplace:config"}) + public String reqDelete(Integer isAudit,Integer isValid,String ids,Integer functionId){ + controlPolicyService.update(isAudit,isValid,ids,functionId); + return "redirect:" + adminPath +"/proxy/control/httpReqReplace/list?functionId="+functionId; + } + @RequestMapping(value = {"httpReqReplace/audit"}) + public String reqAudit(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes) { + if(!StringUtil.isEmpty(ids)){ + String[] idArray = ids.split(","); + Date auditTime=new Date(); + for(String id :idArray){ + try { + controlPolicyService.audit(isAudit,isValid,functionId,id,auditTime); + } catch (MaatConvertException e) { + e.printStackTrace(); + logger.info("配置下发失败:"+e.getMessage()); + addMessage(redirectAttributes, e.getMessage()); + } + } + + } + return "redirect:" + adminPath +"/proxy/control/httpReqReplace/list?functionId="+functionId; + } + @RequestMapping(value = {"httpResReplace/list"}) + public String reslist(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")HttpBodyCfg entity){ + Page page = controlPolicyService.findPage(new Page(request, response,"r"), entity); + model.addAttribute("page", page); + initPageCondition(model); + return "/cfg/proxy/control/httpResReplaceList"; + } + @RequestMapping(value = {"httpResReplace/form"}) + @RequiresPermissions(value={"proxy:contol:httpResReplace:config"}) + public String resForm(Model model,HttpServletRequest request,HttpServletResponse response,String ids,@ModelAttribute("cfg")HttpBodyCfg cfg){ + if(!StringUtil.isEmpty(ids)){ + cfg = controlPolicyService.getHttpBodyCfgById(Long.valueOf(ids)); + initUpdateFormCondition(model, cfg); + }else{ + initFormCondition(model,cfg); + } + model.addAttribute("_cfg", cfg); + return "/cfg/proxy/control/httpResReplaceForm"; + } + + @RequestMapping(value = {"httpResReplace/saveOrUpdate"}) + public String resSaveOrUpdate(Model model,HttpServletRequest request,HttpServletResponse response, + @ModelAttribute("cfg")HttpBodyCfg cfg, + @ModelAttribute("areaCfgIds")String areaCfgIds){ + try{ + controlPolicyService.saveOrUpdate(cfg,areaCfgIds); + addMessage(model,"save_success"); + }catch(Exception e){ + logger.error("信息保存失败",e); + e.printStackTrace(); + addMessage(model,"save_failed"); + } + + return "redirect:" + adminPath +"/proxy/control/httpResReplace/list?functionId="+cfg.getFunctionId(); + } + + @RequestMapping(value = {"httpResReplace/delete"}) + @RequiresPermissions(value={"proxy:contol:httpResReplace:config"}) + public String resDelete(Integer isAudit,Integer isValid,String ids,Integer functionId){ + controlPolicyService.update(isAudit,isValid,ids,functionId); + return "redirect:" + adminPath +"/proxy/control/httpResReplace/list?functionId="+functionId; + } + @RequestMapping(value = {"httpResReplace/audit"}) + public String resAudit(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes) { + if(!StringUtil.isEmpty(ids)){ + String[] idArray = ids.split(","); + Date auditTime=new Date(); + for(String id :idArray){ + try { + controlPolicyService.audit(isAudit,isValid,functionId,id,auditTime); + } catch (MaatConvertException e) { + e.printStackTrace(); + logger.info("配置下发失败:"+e.getMessage()); + addMessage(redirectAttributes, e.getMessage()); + } + } + + } + return "redirect:" + adminPath +"/proxy/control/httpResReplace/list?functionId="+functionId; + } +} diff --git a/src/main/java/com/nis/web/dao/configuration/ControlPolicyDao.java b/src/main/java/com/nis/web/dao/configuration/ControlPolicyDao.java new file mode 100644 index 000000000..46419b7c9 --- /dev/null +++ b/src/main/java/com/nis/web/dao/configuration/ControlPolicyDao.java @@ -0,0 +1,18 @@ +package com.nis.web.dao.configuration; + + +import java.util.List; + +import org.apache.ibatis.annotations.Param; + +import com.nis.domain.configuration.HttpBodyCfg; +import com.nis.web.dao.MyBatisDao; + + +@MyBatisDao +public interface ControlPolicyDao { + public List findPage(HttpBodyCfg entity) ; + public HttpBodyCfg getHttpBodyCfgById(@Param("cfgId")Long cfgId); + public void insert(HttpBodyCfg entity); + public void update(HttpBodyCfg entity); +} diff --git a/src/main/java/com/nis/web/dao/configuration/ControlPolicyDao.xml b/src/main/java/com/nis/web/dao/configuration/ControlPolicyDao.xml new file mode 100644 index 000000000..b65d4774b --- /dev/null +++ b/src/main/java/com/nis/web/dao/configuration/ControlPolicyDao.xml @@ -0,0 +1,285 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + r.cfg_id,r.cfg_desc,r.replace_content,r.cfg_keywords,r.cfg_type, + r.action,r.is_valid,r.is_audit,r.creator_id,r.create_time,r.editor_id,r.edit_time, r.auditor_id, + r.audit_time,r.service_id,r.request_id,r.compile_id,r.is_area_effective,r.classify,r.attribute,r.lable, + r.expr_type,r.match_method,r.is_hexbin,r.area_effective_ids,r.function_id,r.cfg_region_code + + + + + + + + + insert into http_body_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, + replace_content, + cfg_type, + cfg_region_code, + expr_type, + match_method, + is_hexbin + )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}, + #{replaceContent,jdbcType=VARCHAR}, + #{cfgType,jdbcType=VARCHAR}, + #{cfgRegionCode,jdbcType=INTEGER}, + #{exprType,jdbcType=INTEGER}, + #{matchMethod,jdbcType=INTEGER}, + #{isHexbin,jdbcType=INTEGER} + ) + + + + update http_body_cfg + + + + cfg_desc = #{cfgDesc,jdbcType=VARCHAR}, + + + action = #{action,jdbcType=INTEGER}, + + + is_valid = #{isValid,jdbcType=INTEGER}, + + + is_audit = #{isAudit,jdbcType=INTEGER}, + + + editor_id = #{editorId,jdbcType=INTEGER}, + + + edit_time = #{editTime,jdbcType=TIMESTAMP}, + + + AUDITOR_ID = #{auditorId,jdbcType=INTEGER}, + + + AUDIT_TIME = #{auditTime,jdbcType=TIMESTAMP}, + + + COMPILE_ID = #{compileId,jdbcType=TIMESTAMP}, + + + request_id = #{requestId,jdbcType=INTEGER}, + + + is_area_effective = #{isAreaEffective,jdbcType=INTEGER}, + + + classify = #{classify,jdbcType=VARCHAR}, + + + attribute = #{attribute,jdbcType=VARCHAR}, + + + lable = #{lable,jdbcType=VARCHAR}, + + + area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR}, + + + function_id = #{functionId,jdbcType=INTEGER}, + + + service_id = #{serviceId,jdbcType=INTEGER}, + + + cfg_keywords = #{cfgKeywords,jdbcType=VARCHAR}, + + replace_content = #{replaceContent,jdbcType=VARCHAR}, + + cfg_type = #{cfgType,jdbcType=VARCHAR}, + + + cfg_region_code = #{cfgRegionCode,jdbcType=INTEGER}, + + + expr_type = #{exprType,jdbcType=INTEGER}, + + + match_method = #{matchMethod,jdbcType=INTEGER}, + + + is_hexbin = #{isHexbin,jdbcType=INTEGER}, + + + + + + and cfg_id = #{cfgId,jdbcType=INTEGER} + + + + \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/configuration/CrontrolPolicyDao.xml b/src/main/java/com/nis/web/dao/configuration/CrontrolPolicyDao.xml new file mode 100644 index 000000000..5d7bb7ad0 --- /dev/null +++ b/src/main/java/com/nis/web/dao/configuration/CrontrolPolicyDao.xml @@ -0,0 +1,1443 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + r.CFG_ID,r.CFG_DESC,r.ACTION,r.IS_VALID,r.IS_AUDIT, + r.CREATOR_ID,r.CREATE_TIME,r.EDITOR_ID,r.EDIT_TIME,r.AUDITOR_ID,r.AUDIT_TIME, + r.SERVICE_ID,r.REQUEST_ID,r.COMPILE_ID,r.IS_AREA_EFFECTIVE,r.CLASSIFY, + r.ATTRIBUTE,r.LABLE,r.AREA_EFFECTIVE_IDS,r.function_id + + + r.cfg_id,r.cfg_desc,r.ip_type,r.src_ip_address,r.ip_pattern,r.port_pattern,r.src_port + ,r.protocol,r.protocol_id,r.direction,r.cfg_type,r.action,r.dest_port,r.dest_ip_address + ,r.is_valid,r.is_audit,r.creator_id,r.create_time,r.editor_id + ,r.edit_time,r.auditor_id,r.audit_time,r.service_id,r.request_id, + r.compile_id,r.is_area_effective,r.classify,r.attribute,r.lable + ,r.area_effective_ids,r.function_id,r.cfg_region_code + + + r.cfg_id,r.cfg_desc,r.cfg_keywords,r.cfg_type, + r.action,r.is_valid,r.is_audit,r.creator_id,r.create_time,r.editor_id,r.edit_time, r.auditor_id, + r.audit_time,r.service_id,r.request_id,r.compile_id,r.is_area_effective,r.classify,r.attribute,r.lable, + r.expr_type,r.match_method,r.is_hexbin,r.area_effective_ids,r.function_id,r.cfg_region_code + + + r.cfg_id,r.cfg_desc,r.ip_type,r.src_ip_address,r.ip_pattern,r.port_pattern,r.src_port + ,r.protocol,r.protocol_id,r.direction,r.cfg_type,r.action,r.dest_port,r.dest_ip_address + ,r.is_valid,r.is_audit,r.creator_id,r.create_time,r.editor_id + ,r.edit_time,r.auditor_id,r.audit_time,r.service_id,r.request_id, + r.compile_id,r.is_area_effective,r.classify,r.attribute,r.lable + ,r.area_effective_ids,r.function_id,r.cfg_region_code + + + r.cfg_id,r.cfg_desc,r.cfg_keywords,r.cfg_type, + r.action,r.is_valid,r.is_audit,r.creator_id,r.create_time,r.editor_id,r.edit_time, r.auditor_id, + r.audit_time,r.service_id,r.request_id,r.compile_id,r.is_area_effective,r.classify,r.attribute,r.lable, + r.expr_type,r.match_method,r.is_hexbin,r.area_effective_ids,r.function_id,r.cfg_region_code + + + + + + + + + + + + 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 + )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} + ) + + + + insert into av_voip_ip_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 + )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}, + #{voipIp.ipType,jdbcType=INTEGER}, + #{voipIp.srcIpAddress,jdbcType=VARCHAR}, + #{voipIp.ipPattern,jdbcType=INTEGER}, + #{voipIp.portPattern,jdbcType=INTEGER}, + #{voipIp.srcPort,jdbcType=VARCHAR}, + #{voipIp.protocol,jdbcType=INTEGER}, + #{voipIp.protocolId,jdbcType=INTEGER}, + #{voipIp.direction,jdbcType=INTEGER}, + #{voipIp.destPort,jdbcType=VARCHAR}, + #{voipIp.destIpAddress,jdbcType=VARCHAR}, + #{voipIp.cfgType,jdbcType=VARCHAR}, + #{voipIp.cfgRegionCode,jdbcType=INTEGER} + ) + + + + insert into av_voip_account_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 + )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}, + #{voipAccount.cfgKeywords,jdbcType=VARCHAR}, + #{voipAccount.cfgType,jdbcType=VARCHAR}, + #{voipAccount.cfgRegionCode,jdbcType=INTEGER}, + #{voipAccount.exprType,jdbcType=INTEGER}, + #{voipAccount.matchMethod,jdbcType=INTEGER}, + #{voipAccount.isHexbin,jdbcType=INTEGER} + ) + + + + update cfg_index_info + + + + cfg_desc = #{cfgDesc,jdbcType=VARCHAR}, + + + action = #{action,jdbcType=INTEGER}, + + + is_valid = #{isValid,jdbcType=INTEGER}, + + + is_audit = #{isAudit,jdbcType=INTEGER}, + + + editor_id = #{editorId,jdbcType=INTEGER}, + + + edit_time = #{editTime,jdbcType=TIMESTAMP}, + + + AUDITOR_ID = #{auditorId,jdbcType=INTEGER}, + + + AUDIT_TIME = #{auditTime,jdbcType=TIMESTAMP}, + + + COMPILE_ID = #{compileId,jdbcType=TIMESTAMP}, + + + request_id = #{requestId,jdbcType=INTEGER}, + + + is_area_effective = #{isAreaEffective,jdbcType=INTEGER}, + + + classify = #{classify,jdbcType=VARCHAR}, + + + attribute = #{attribute,jdbcType=VARCHAR}, + + + lable = #{lable,jdbcType=VARCHAR}, + + + area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR}, + + + function_id = #{functionId,jdbcType=INTEGER}, + + + service_id = #{serviceId,jdbcType=INTEGER}, + + + + + + and cfg_id = #{cfgId,jdbcType=INTEGER} + + + and compile_id = #{compileId,jdbcType=INTEGER} + + + and function_id = #{functionId,jdbcType=INTEGER} + + + + + + update av_voip_ip_cfg + + + + cfg_desc = #{cfgDesc,jdbcType=VARCHAR}, + + + action = #{action,jdbcType=INTEGER}, + + + is_valid = #{isValid,jdbcType=INTEGER}, + + + is_audit = #{isAudit,jdbcType=INTEGER}, + + + editor_id = #{editorId,jdbcType=INTEGER}, + + + edit_time = #{editTime,jdbcType=TIMESTAMP}, + + + AUDITOR_ID = #{auditorId,jdbcType=INTEGER}, + + + AUDIT_TIME = #{auditTime,jdbcType=TIMESTAMP}, + + + COMPILE_ID = #{compileId,jdbcType=TIMESTAMP}, + + + request_id = #{requestId,jdbcType=INTEGER}, + + + is_area_effective = #{isAreaEffective,jdbcType=INTEGER}, + + + classify = #{classify,jdbcType=VARCHAR}, + + + attribute = #{attribute,jdbcType=VARCHAR}, + + + lable = #{lable,jdbcType=VARCHAR}, + + + area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR}, + + + function_id = #{functionId,jdbcType=INTEGER}, + + + service_id = #{serviceId,jdbcType=INTEGER}, + + + ip_type = #{voipIp.ipType,jdbcType=INTEGER}, + + + src_ip_address = #{voipIp.srcIpAddress,jdbcType=VARCHAR}, + + + ip_pattern = #{voipIp.ipPattern,jdbcType=INTEGER}, + + + port_pattern = #{voipIp.portPattern,jdbcType=INTEGER}, + + + src_port = #{voipIp.srcPort,jdbcType=VARCHAR}, + + + protocol = #{voipIp.protocol,jdbcType=INTEGER}, + + + protocol_id = #{voipIp.protocolId,jdbcType=INTEGER}, + + + direction = #{voipIp.direction,jdbcType=INTEGER}, + + + dest_port = #{voipIp.destPort,jdbcType=VARCHAR}, + + + dest_ip_address = #{voipIp.destIpAddress,jdbcType=VARCHAR}, + + + cfg_type = #{voipIp.cfgType,jdbcType=VARCHAR}, + + + cfg_region_code = #{voipIp.cfgRegionCode,jdbcType=INTEGER}, + + + + + + and cfg_id = #{voipIp.cfgId,jdbcType=INTEGER} + + + and compile_id = #{compileId,jdbcType=INTEGER} + + + and function_id = #{functionId,jdbcType=INTEGER} + + + + + + update av_voip_account_cfg + + + + cfg_desc = #{cfgDesc,jdbcType=VARCHAR}, + + + action = #{action,jdbcType=INTEGER}, + + + is_valid = #{isValid,jdbcType=INTEGER}, + + + is_audit = #{isAudit,jdbcType=INTEGER}, + + + editor_id = #{editorId,jdbcType=INTEGER}, + + + edit_time = #{editTime,jdbcType=TIMESTAMP}, + + + AUDITOR_ID = #{auditorId,jdbcType=INTEGER}, + + + AUDIT_TIME = #{auditTime,jdbcType=TIMESTAMP}, + + + COMPILE_ID = #{compileId,jdbcType=TIMESTAMP}, + + + request_id = #{requestId,jdbcType=INTEGER}, + + + is_area_effective = #{isAreaEffective,jdbcType=INTEGER}, + + + classify = #{classify,jdbcType=VARCHAR}, + + + attribute = #{attribute,jdbcType=VARCHAR}, + + + lable = #{lable,jdbcType=VARCHAR}, + + + area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR}, + + + function_id = #{functionId,jdbcType=INTEGER}, + + + service_id = #{serviceId,jdbcType=INTEGER}, + + + cfg_keywords = #{voipAccount.cfgKeywords,jdbcType=VARCHAR}, + + + cfg_type = #{voipAccount.cfgType,jdbcType=VARCHAR}, + + + cfg_region_code = #{voipAccount.cfgRegionCode,jdbcType=INTEGER}, + + + expr_type = #{voipAccount.exprType,jdbcType=INTEGER}, + + + match_method = #{voipAccount.matchMethod,jdbcType=INTEGER}, + + + is_hexbin = #{voipAccount.isHexbin,jdbcType=INTEGER}, + + + + + + and cfg_id = #{voipAccount.cfgId,jdbcType=INTEGER} + + + and compile_id = #{compileId,jdbcType=INTEGER} + + + and function_id = #{functionId,jdbcType=INTEGER} + + + + + + delete from av_voip_ip_cfg + + + and cfg_id = #{voipAccount.cfgId,jdbcType=INTEGER} + + + and compile_id = #{compileId,jdbcType=INTEGER} + + + and function_id = #{functionId,jdbcType=INTEGER} + + + + + + delete from av_voip_account_cfg + + + and cfg_id = #{voipAccount.cfgId,jdbcType=INTEGER} + + + and compile_id = #{compileId,jdbcType=INTEGER} + + + and function_id = #{functionId,jdbcType=INTEGER} + + + + + + + + + + + insert into ${tableName} ( + 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 + )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} + ) + + + + update ${tableName} + + + + cfg_desc = #{cfgDesc,jdbcType=VARCHAR}, + + + action = #{action,jdbcType=INTEGER}, + + + is_valid = #{isValid,jdbcType=INTEGER}, + + + is_audit = #{isAudit,jdbcType=INTEGER}, + + + editor_id = #{editorId,jdbcType=INTEGER}, + + + edit_time = #{editTime,jdbcType=TIMESTAMP}, + + + AUDITOR_ID = #{auditorId,jdbcType=INTEGER}, + + + AUDIT_TIME = #{auditTime,jdbcType=TIMESTAMP}, + + + COMPILE_ID = #{compileId,jdbcType=TIMESTAMP}, + + + request_id = #{requestId,jdbcType=INTEGER}, + + + is_area_effective = #{isAreaEffective,jdbcType=INTEGER}, + + + classify = #{classify,jdbcType=VARCHAR}, + + + attribute = #{attribute,jdbcType=VARCHAR}, + + + lable = #{lable,jdbcType=VARCHAR}, + + + area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR}, + + + function_id = #{functionId,jdbcType=INTEGER}, + + + service_id = #{serviceId,jdbcType=INTEGER}, + + + ip_type = #{ipType,jdbcType=INTEGER}, + + + src_ip_address = #{srcIpAddress,jdbcType=VARCHAR}, + + + ip_pattern = #{ipPattern,jdbcType=INTEGER}, + + + port_pattern = #{portPattern,jdbcType=INTEGER}, + + + src_port = #{srcPort,jdbcType=VARCHAR}, + + + protocol = #{protocol,jdbcType=INTEGER}, + + + protocol_id = #{protocolId,jdbcType=INTEGER}, + + + direction = #{direction,jdbcType=INTEGER}, + + + dest_port = #{destPort,jdbcType=VARCHAR}, + + + dest_ip_address = #{destIpAddress,jdbcType=VARCHAR}, + + + cfg_type = #{cfgType,jdbcType=VARCHAR}, + + + cfg_region_code = #{cfgRegionCode,jdbcType=INTEGER}, + + + + + + and cfg_id = #{cfgId,jdbcType=INTEGER} + + + and compile_id = #{compileId,jdbcType=INTEGER} + + + and function_id = #{functionId,jdbcType=INTEGER} + + + + + + + + + + + + + + + + insert into ${tableName} ( + 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, + expr_type, + match_method, + is_hexbin, + cfg_type, + cfg_region_code + )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}, + #{exprType,jdbcType=INTEGER}, + #{matchMethod,jdbcType=INTEGER}, + #{isHexbin,jdbcType=INTEGER}, + #{cfgType,jdbcType=VARCHAR}, + #{cfgRegionCode,jdbcType=INTEGER} + ) + + + + + update ${tableName} + + + + cfg_desc = #{cfgDesc,jdbcType=VARCHAR}, + + + action = #{action,jdbcType=INTEGER}, + + + is_valid = #{isValid,jdbcType=INTEGER}, + + + is_audit = #{isAudit,jdbcType=INTEGER}, + + + editor_id = #{editorId,jdbcType=INTEGER}, + + + edit_time = #{editTime,jdbcType=TIMESTAMP}, + + + AUDITOR_ID = #{auditorId,jdbcType=INTEGER}, + + + AUDIT_TIME = #{auditTime,jdbcType=TIMESTAMP}, + + + COMPILE_ID = #{compileId,jdbcType=TIMESTAMP}, + + + request_id = #{requestId,jdbcType=INTEGER}, + + + is_area_effective = #{isAreaEffective,jdbcType=INTEGER}, + + + classify = #{classify,jdbcType=VARCHAR}, + + + attribute = #{attribute,jdbcType=VARCHAR}, + + + lable = #{lable,jdbcType=VARCHAR}, + + + area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR}, + + + function_id = #{functionId,jdbcType=INTEGER}, + + + service_id = #{serviceId,jdbcType=INTEGER}, + + + cfg_keywords = #{cfgKeywords,jdbcType=VARCHAR}, + + + expr_type = #{exprType,jdbcType=INTEGER}, + + + match_method = #{matchMethod,jdbcType=INTEGER}, + + + is_hexbin = #{isHexbin,jdbcType=INTEGER}, + + + cfg_type = #{cfgType,jdbcType=VARCHAR}, + + + cfg_region_code = #{cfgRegionCode,jdbcType=INTEGER}, + + + + + + and cfg_id = #{cfgId,jdbcType=INTEGER} + + + and compile_id = #{compileId,jdbcType=INTEGER} + + + and function_id = #{functionId,jdbcType=INTEGER} + + + + + \ No newline at end of file diff --git a/src/main/java/com/nis/web/service/configuration/ControlPolicyService.java b/src/main/java/com/nis/web/service/configuration/ControlPolicyService.java new file mode 100644 index 000000000..210325eee --- /dev/null +++ b/src/main/java/com/nis/web/service/configuration/ControlPolicyService.java @@ -0,0 +1,264 @@ +package com.nis.web.service.configuration; + + +import java.util.ArrayList; +import java.util.Date; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.nis.domain.Page; +import com.nis.domain.configuration.AreaBean; +import com.nis.domain.configuration.AreaIpCfg; +import com.nis.domain.configuration.AvVoipAccountCfg; +import com.nis.domain.configuration.AvVoipIpCfg; +import com.nis.domain.configuration.BaseIpCfg; +import com.nis.domain.configuration.BaseStringCfg; +import com.nis.domain.configuration.CfgIndexInfo; +import com.nis.domain.configuration.HttpBodyCfg; +import com.nis.domain.maat.MaatCfg; +import com.nis.domain.maat.ToMaatBean; +import com.nis.domain.maat.ToMaatResult; +import com.nis.domain.maat.MaatCfg.DigestCfg; +import com.nis.domain.maat.MaatCfg.GroupCfg; +import com.nis.domain.maat.MaatCfg.IpCfg; +import com.nis.domain.maat.MaatCfg.NumBoundaryCfg; +import com.nis.domain.maat.MaatCfg.StringCfg; +import com.nis.exceptions.MaatConvertException; +import com.nis.util.ConfigServiceUtil; +import com.nis.util.Constants; +import com.nis.util.StringUtil; +import com.nis.util.StringUtils; +import com.nis.web.dao.configuration.AreaIpCfgDao; +import com.nis.web.dao.configuration.ControlPolicyDao; +import com.nis.web.security.UserUtils; +import com.nis.web.service.BaseService; + + +@Service +public class ControlPolicyService extends BaseService{ + @Autowired + protected ControlPolicyDao controlPolicyDao; + @Autowired + protected AreaIpCfgDao areaIpCfgDao; + + + public Page findPage(Page page, HttpBodyCfg entity) { + entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r")); + entity.setPage(page); + List list=controlPolicyDao.findPage(entity); + page.setList(list); + return page; + } + + public HttpBodyCfg getHttpBodyCfgById(Long cfgId) { + return controlPolicyDao.getHttpBodyCfgById(cfgId); + } + @Transactional(readOnly=false,rollbackFor=RuntimeException.class) + public void saveOrUpdate(HttpBodyCfg entity,String areaCfgIds){ + Date createTime=new Date(); + //设置区域运营商信息 + setAreaEffectiveIds(entity); + //新增 + if(entity.getCfgId()==null){ + entity.setCreatorId(UserUtils.getUser().getId()); + entity.setCreateTime(createTime); + entity.setIsValid(0); + entity.setIsAudit(0); + //调用服务接口获取compileId + List compileIds = new ArrayList(); + try { + compileIds = ConfigServiceUtil.getId(1,1); + } catch (Exception e) { + e.printStackTrace(); + logger.info("获取编译ID出错"); + throw new MaatConvertException(":"+e.getMessage()); + } + if(compileIds != null && compileIds.size() >0 && compileIds.get(0) != 0){ + entity.setCompileId(compileIds.get(0)); + + //保存区域IP信息 + if(entity.getAreaCfg()!=null&&entity.getAreaCfg().size()>0){ + for (AreaIpCfg areaIpCfg : entity.getAreaCfg()) { + BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode" + ,"cfgType" + }); + areaIpCfgDao.saveAreaIpCfg(areaIpCfg); + } + } + + controlPolicyDao.insert(entity); + }else{ + throw new MaatConvertException(""); + } + + //修改 + }else{ + Date editTime=new Date(); + entity.setIsValid(0); + entity.setIsAudit(0); + + areaCfgIds=!StringUtil.isEmpty(areaCfgIds)? ","+areaCfgIds:""; + + if(!StringUtil.isEmpty(entity.getAreaCfg())){ + for (AreaIpCfg areaIpCfg : entity.getAreaCfg()) { + if(!StringUtil.isEmpty(areaIpCfg.getCfgId())){ + if(areaCfgIds.contains(","+areaIpCfg.getCfgId()+",")){ + areaCfgIds=areaCfgIds.replace(areaIpCfg.getCfgId()+",", ""); + } + //修改 + entity.setEditorId(UserUtils.getUser().getId()); + entity.setEditTime(editTime); + BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode" + ,"cfgType" + ,"cfgId" + }); + areaIpCfgDao.updateAreaIpCfg(areaIpCfg); + }else{ + //新增 + entity.setCreatorId(UserUtils.getUser().getId()); + entity.setCreateTime(createTime); + BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode" + ,"cfgType" + }); + areaIpCfgDao.saveAreaIpCfg(areaIpCfg); + } + } + } + //delete 真是删除areaIpCfg信息 + if(!StringUtil.isEmpty(areaCfgIds.replaceAll(",", ""))){ + areaCfgIds=areaCfgIds.substring(1,areaCfgIds.length()); + for (String cfgId : areaCfgIds.split(",")) { + AreaIpCfg areaIpCfg=new AreaIpCfg(); + areaIpCfg.setCfgId(Long.parseLong(cfgId)); + areaIpCfgDao.deleteAreaIpCfgByCfgId(areaIpCfg); + } + } + + entity.setEditorId(UserUtils.getUser().getId()); + entity.setEditTime(editTime); + controlPolicyDao.update(entity); + } + } + + @Transactional(readOnly=false,rollbackFor=RuntimeException.class) + public void update(Integer isAudit,Integer isValid,String ids,Integer functionId){ + HttpBodyCfg entity = new HttpBodyCfg(); + String[] idArray = ids.split(","); + for(String id :idArray){ + entity.setCfgId(Long.parseLong(id)); + entity.setFunctionId(functionId); + entity.setIsAudit(isAudit); + entity.setIsValid(isValid); + entity.setEditorId(UserUtils.getUser().getId()); + entity.setEditTime(new Date()); + controlPolicyDao.update(entity); + AreaIpCfg areaIpCfg=new AreaIpCfg(); + BeanUtils.copyProperties(entity, areaIpCfg); + areaIpCfgDao.updateAreaIpCfgValid(areaIpCfg); + } + } + @Transactional(readOnly=false,rollbackFor=RuntimeException.class) + public void audit(Integer isAudit,Integer isValid,Integer functionId,String id,Date auditTime){ + HttpBodyCfg entity = new HttpBodyCfg(); + List list = new ArrayList(); + List areaIpCfgList = new ArrayList(); + + entity = controlPolicyDao.getHttpBodyCfgById(Long.parseLong(id)); + entity.setIsAudit(isAudit); + entity.setIsValid(isValid); + entity.setAuditorId(UserUtils.getUser().getId()); + entity.setAuditTime(auditTime); + + + controlPolicyDao.update(entity); + + list.add(entity); + + AreaIpCfg areaIpCfg=new AreaIpCfg(); + BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode" + ,"cfgType" + ,"cfgId" + }); + areaIpCfgDao.updateAreaIpCfg(areaIpCfg); + + areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId()); + + ToMaatBean maatBean = new ToMaatBean(); + MaatCfg maatCfg = new MaatCfg(); + List configCompileList = new ArrayList(); + List groupRelationList = new ArrayList(); + List ipRegionList = new ArrayList(); + List strRegionList = new ArrayList(); + List numRegionList = new ArrayList(); + List digestRegionList = new ArrayList(); + List areaIpRegionList = new ArrayList(); + + if(isAudit==1){ + if(!StringUtil.isEmpty(list)){ + Map strMap = cfgConvert(strRegionList,list,2,entity,groupRelationList); + groupRelationList=strMap.get("groupList"); + strRegionList=strMap.get("dstList"); + } + if(!StringUtil.isEmpty(areaIpCfgList)){ + //TODO DELETE后期删除 + for (AreaIpCfg areaIpCfga : areaIpCfgList) { + areaIpCfga.setCfgType("NTC_IP_RANGE"); + } + Map areaMap = cfgConvert(areaIpRegionList,areaIpCfgList,1,entity,groupRelationList); + groupRelationList=areaMap.get("groupList"); + areaIpRegionList=areaMap.get("dstList"); + } + } + + //构造提交综合服务参数格式,一条配置提交一次综合服务 + if(isAudit==1){ + maatCfg.initDefaultValue(); + BeanUtils.copyProperties(entity, maatCfg); + maatCfg.setAction(entity.getAction()); + maatCfg.setAuditTime(auditTime); + maatCfg.setIpRegionList(ipRegionList); + maatCfg.setStrRegionList(strRegionList); + maatCfg.setNumRegionList(numRegionList); + maatCfg.setDigestRegionList(digestRegionList); + maatCfg.setGroupRelationList(groupRelationList); + maatCfg.setGroupNum(groupRelationList.size()); + maatCfg.setAreaIpRegionList(areaIpRegionList); + maatCfg.setIsValid(entity.getIsValid()); + configCompileList.add(maatCfg); + maatBean.setConfigCompileList(configCompileList); + maatBean.setAuditTime(auditTime); + maatBean.setCreatorName(entity.getCurrentUser().getName()); + maatBean.setVersion(Constants.MAAT_VERSION); + maatBean.setOpAction(Constants.INSERT_ACTION); + //调用服务接口下发配置数据 + String json=gsonToJson(maatBean); + logger.info("配置下发配置参数:"+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(auditTime); + 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()); + } + } +} diff --git a/src/main/java/com/nis/web/service/configuration/DnsResStrategyService.java b/src/main/java/com/nis/web/service/configuration/DnsResStrategyService.java index 17a3e0fca..9992bead6 100644 --- a/src/main/java/com/nis/web/service/configuration/DnsResStrategyService.java +++ b/src/main/java/com/nis/web/service/configuration/DnsResStrategyService.java @@ -3,27 +3,16 @@ package com.nis.web.service.configuration; import java.util.ArrayList; import java.util.Date; -import java.util.Iterator; import java.util.List; -import java.util.Map; -import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.nis.domain.Page; -import com.nis.domain.callback.InlineIp; import com.nis.domain.callback.NtcDnsResStrategy; import com.nis.domain.configuration.DnsResStrategy; -import com.nis.domain.maat.MaatCfg; -import com.nis.domain.maat.ToMaatBean; import com.nis.domain.maat.ToMaatResult; -import com.nis.domain.maat.MaatCfg.DigestCfg; -import com.nis.domain.maat.MaatCfg.GroupCfg; -import com.nis.domain.maat.MaatCfg.IpCfg; -import com.nis.domain.maat.MaatCfg.NumBoundaryCfg; -import com.nis.domain.maat.MaatCfg.StringCfg; import com.nis.exceptions.MaatConvertException; import com.nis.util.ConfigServiceUtil; import com.nis.web.dao.configuration.DnsResStrategyDao; @@ -136,8 +125,6 @@ public class DnsResStrategyService extends BaseService{ @Transactional(readOnly=false,rollbackFor=RuntimeException.class) public void audit(Integer isAudit,Integer isValid,Integer functionId,String id,Date auditTime){ DnsResStrategy cfg=new DnsResStrategy(); - List beans=new ArrayList<>(); - beans.add(cfg); cfg.setCfgId(Long.valueOf(id)); cfg.setIsValid(isValid); cfg.setIsAudit(isAudit); diff --git a/src/main/resources/nis.properties b/src/main/resources/nis.properties index a4d13ab73..9c744dee4 100644 --- a/src/main/resources/nis.properties +++ b/src/main/resources/nis.properties @@ -284,6 +284,6 @@ ssl_ca_region=ssl_ca ssl_ip_region=ssl_ip bgp_ip_region=bgp_ip #存在与表达式的关键字特殊分隔符 -keyword_expr=\\*\\*\\*and\\*\\*\\* +keyword_expr=***and*** #时区 time_zone=8 \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/include/form/stringInfo.jsp b/src/main/webapp/WEB-INF/include/form/stringInfo.jsp index 21d5ba775..f67acc0d2 100644 --- a/src/main/webapp/WEB-INF/include/form/stringInfo.jsp +++ b/src/main/webapp/WEB-INF/include/form/stringInfo.jsp @@ -1,6 +1,5 @@ <%@ page contentType="text/html;charset=UTF-8"%> <%@ include file="/WEB-INF/include/taglib.jsp"%> -

diff --git a/src/main/webapp/WEB-INF/views/cfg/proxy/control/httpReqReplaceForm.jsp b/src/main/webapp/WEB-INF/views/cfg/proxy/control/httpReqReplaceForm.jsp new file mode 100644 index 000000000..0555b6b45 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/cfg/proxy/control/httpReqReplaceForm.jsp @@ -0,0 +1,141 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + +<spring:message code="${cfgName}"></spring:message> + + + + +
+ + +
+
+
+
+
+ + + +
+
+
+ +
+ + + + + + + + + + + +
+ +
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+ +
+ + <%@include file="/WEB-INF/include/form/stringInfo.jsp" %> + <%@include file="/WEB-INF/include/form/areaInfo.jsp" %> + <%@include file="/WEB-INF/include/form/basicInfo.jsp" %> +
+
+
+
+
+
+ + +
+
+
+
+
+
+
+ +
+
+
+
+
+ + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/cfg/proxy/control/httpReqReplaceList.jsp b/src/main/webapp/WEB-INF/views/cfg/proxy/control/httpReqReplaceList.jsp new file mode 100644 index 000000000..1acfbf30c --- /dev/null +++ b/src/main/webapp/WEB-INF/views/cfg/proxy/control/httpReqReplaceList.jsp @@ -0,0 +1,414 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + +<spring:message code="${cfgName}"></spring:message> + + + + +
+ + +

+ +

+ +
+
+
+
+
+ + + + + + + + + +
+
+ + + + + + + <%-- --%> + +
+ +
+ +
+
+ + + + + + +
+ + + +
+
+
+ + + +
+
+ + + + +
+ + +
+ href="javascript:;"> + + +
+
+ + + +
+
+ +
+ +
+ + + + + + + + +
+ +
+ +
+ +
+ + + + + + + +
+ +
+ +
+ +
+ + + + + + + + +
+ +
+ +
+ +
+ + + + + + + +
+ +
+ +
+ +
+
+
+ + +
+
+ +
+
+ + " onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> + +
+
+ +
+
+ + " onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> + +
+
+ +
+
+ + " onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> + +
+
+ +
+
+ + " onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> + +
+
+ +
+
+ + " onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> + +
+
+
+ + +
+ + +
+
+
+ + + + + <%-- --%> + + + + + + + + + + + + + + + + + + + + + <%-- --%> + + + + + + + + + + + + + + + + + + + + <%-- --%> + + + + + + + + + + + + +
${cfg.cfgDesc }${cfg.replaceContent } + + ${fns:abbr(fn:replace(cfg.cfgKeywords, "***and***", " "),20)} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${cfg.requestName } + + + + + + + + + + + + + + + ${fns:abbr(classify,20)} + + + + + + + + + + + + + + + + + ${fns:abbr(attribute,20)} + + + + + + + + + + + + + + + + + ${fns:abbr(lableInfo,20)} + + ${cfg.areaEffectiveIds } + + + + ${cfg.creatorName }${cfg.editorName }${cfg.auditorName }
+
${page}
+
+ +
+
+
+ + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/cfg/proxy/control/httpResReplaceForm.jsp b/src/main/webapp/WEB-INF/views/cfg/proxy/control/httpResReplaceForm.jsp new file mode 100644 index 000000000..06920179f --- /dev/null +++ b/src/main/webapp/WEB-INF/views/cfg/proxy/control/httpResReplaceForm.jsp @@ -0,0 +1,141 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + +<spring:message code="${cfgName}"></spring:message> + + + + +
+ + +
+
+
+
+
+ + + +
+
+
+ +
+ + + + + + + + + + + +
+ +
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+ +
+ + <%@include file="/WEB-INF/include/form/stringInfo.jsp" %> + <%@include file="/WEB-INF/include/form/areaInfo.jsp" %> + <%@include file="/WEB-INF/include/form/basicInfo.jsp" %> +
+
+
+
+
+
+ + +
+
+
+
+
+
+
+ +
+
+
+
+
+ + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/cfg/proxy/control/httpResReplaceList.jsp b/src/main/webapp/WEB-INF/views/cfg/proxy/control/httpResReplaceList.jsp new file mode 100644 index 000000000..90a2d74d8 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/cfg/proxy/control/httpResReplaceList.jsp @@ -0,0 +1,414 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + +<spring:message code="${cfgName}"></spring:message> + + + + +
+ + +

+ +

+ +
+
+
+
+
+ + + + + + + + + +
+
+ + + + + + + <%-- --%> + +
+ +
+ +
+
+ + + + + + +
+ + + +
+
+
+ + + +
+
+ + + + +
+ + +
+ href="javascript:;"> + + +
+
+ + + +
+
+ +
+ +
+ + + + + + + + +
+ +
+ +
+ +
+ + + + + + + +
+ +
+ +
+ +
+ + + + + + + + +
+ +
+ +
+ +
+ + + + + + + +
+ +
+ +
+ +
+
+
+ + +
+
+ +
+
+ + " onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> + +
+
+ +
+
+ + " onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> + +
+
+ +
+
+ + " onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> + +
+
+ +
+
+ + " onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> + +
+
+ +
+
+ + " onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> + +
+
+
+ + +
+ + +
+
+
+ + + + + <%-- --%> + + + + + + + + + + + + + + + + + + + + + <%-- --%> + + + + + + + + + + + + + + + + + + + + <%-- --%> + + + + + + + + + + + + +
${cfg.cfgDesc }${cfg.replaceContent } + + ${fns:abbr(fn:replace(cfg.cfgKeywords, "***and***", " "),20)} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${cfg.requestName } + + + + + + + + + + + + + + + ${fns:abbr(classify,20)} + + + + + + + + + + + + + + + + + ${fns:abbr(attribute,20)} + + + + + + + + + + + + + + + + + ${fns:abbr(lableInfo,20)} + + ${cfg.areaEffectiveIds } + + + + ${cfg.creatorName }${cfg.editorName }${cfg.auditorName }
+
${page}
+
+ +
+
+
+ + + \ No newline at end of file