策略分组功能
dns响应策略功能 dns欺骗ip列表功能
This commit is contained in:
@@ -61,6 +61,7 @@ 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.DnsIpCfgService;
|
||||
import com.nis.web.service.configuration.DnsResStrategyService;
|
||||
import com.nis.web.service.configuration.FileTransferCfgService;
|
||||
import com.nis.web.service.configuration.IpCfgService;
|
||||
import com.nis.web.service.configuration.MailCfgService;
|
||||
@@ -153,6 +154,8 @@ public class BaseController {
|
||||
protected XmppCfgService xmppCfgService;
|
||||
@Autowired
|
||||
protected PolicyGroupInfoService policyGroupInfoService;
|
||||
@Autowired
|
||||
protected DnsResStrategyService dnsResStrategyService;
|
||||
/**
|
||||
* 管理基础路径
|
||||
*/
|
||||
|
||||
@@ -16,101 +16,85 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.ServiceDictInfo;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.DnsIpCfg;
|
||||
import com.nis.domain.configuration.DnsResStrategy;
|
||||
import com.nis.domain.configuration.DnsIpCfg;
|
||||
import com.nis.domain.configuration.RequestInfo;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.configuration.DnsIpCfgService;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/cfg/dnsIp")
|
||||
public class DnsIpCfgController extends BaseController {
|
||||
|
||||
@ModelAttribute
|
||||
public DnsIpCfg get(Long cfgId) {
|
||||
if (!StringUtil.isEmpty(cfgId)){
|
||||
return dnsIpCfgService.get(cfgId);
|
||||
}else{
|
||||
return new DnsIpCfg();
|
||||
}
|
||||
}
|
||||
|
||||
@RequiresPermissions("cfg:ip:view")
|
||||
@RequestMapping("list")
|
||||
public String list(Model model, HttpServletRequest request, HttpServletResponse response, DnsIpCfg dnsIpCfg) {
|
||||
Page<DnsIpCfg> page = dnsIpCfgService.findPage(new Page<DnsIpCfg>(request, response, 30), dnsIpCfg);
|
||||
@RequestMapping(value = {"/list"})
|
||||
public String list(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")DnsIpCfg entity){
|
||||
Page<DnsIpCfg> page = dnsIpCfgService.findPage(new Page<DnsIpCfg>(request, response,"r"), entity);
|
||||
model.addAttribute("page", page);
|
||||
|
||||
addRequestAndServiceDictToModel(model);
|
||||
initPageCondition(model);
|
||||
return "/cfg/dnsIpCfgList";
|
||||
}
|
||||
|
||||
@RequiresPermissions("cfg:ip:edit")
|
||||
@RequestMapping("form")
|
||||
public String form(Model model, DnsIpCfg dnsIpCfg) {
|
||||
addRequestAndServiceDictToModel(model);
|
||||
@RequestMapping(value = {"/form"})
|
||||
@RequiresPermissions(value={"dns:fake:ip:config"})
|
||||
public String form(Model model,HttpServletRequest request,HttpServletResponse response,String ids,@ModelAttribute("cfg")DnsIpCfg cfg){
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
cfg = dnsIpCfgService.getDnsIpCfg(Long.parseLong(ids));
|
||||
initUpdateFormCondition(model, cfg);
|
||||
}else{
|
||||
initFormCondition(model,cfg);
|
||||
}
|
||||
//获取所有响应策略信息
|
||||
List<DnsResStrategy> resStrategys=dnsResStrategyService.findDnsResStrategys(null, -1);
|
||||
model.addAttribute("dnsResStrategys", resStrategys);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
return "/cfg/dnsIpCfgForm";
|
||||
}
|
||||
|
||||
@RequiresPermissions("cfg:ip:edit")
|
||||
@RequestMapping("save")
|
||||
public String save(Model model, DnsIpCfg dnsIpCfg, RedirectAttributes redirectAttributes) {
|
||||
Date now = new Date();
|
||||
|
||||
if (dnsIpCfg.getCfgId() == null) {//新增
|
||||
dnsIpCfg.setFakeId(0);
|
||||
dnsIpCfg.setIsValid(1);
|
||||
dnsIpCfg.setCreateTime(now);
|
||||
dnsIpCfg.setCreator(UserUtils.getUser());
|
||||
dnsIpCfg.setIsAudit(1);
|
||||
} else {//修改
|
||||
dnsIpCfg.setEditor(UserUtils.getUser());
|
||||
dnsIpCfg.setEditTime(now);
|
||||
}
|
||||
|
||||
try {
|
||||
dnsIpCfgService.save(dnsIpCfg);
|
||||
addMessage(redirectAttributes, "save_success");
|
||||
} catch (Exception e) {
|
||||
@RequestMapping(value = {"/saveOrUpdate"})
|
||||
@RequiresPermissions(value={"dns:fake:ip:config"})
|
||||
public String saveOrUpdate(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")DnsIpCfg cfg){
|
||||
try{
|
||||
dnsIpCfgService.saveOrUpdate(cfg);
|
||||
addMessage(model,"save_success");
|
||||
}catch(Exception e){
|
||||
logger.error("信息保存失败",e);
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes, "save_failed");
|
||||
addMessage(model,"save_failed");
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath + "/cfg/dnsIp/list";
|
||||
return "redirect:" + adminPath +"/cfg/dnsIp/list?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
|
||||
@RequiresPermissions("cfg:ip:edit")
|
||||
@RequestMapping("delete")
|
||||
public String delete(Model model, HttpServletRequest request,
|
||||
HttpServletResponse response, DnsIpCfg dnsIpCfg) {
|
||||
String fakeIds = dnsIpCfg.getFakeIds();
|
||||
if (!StringUtils.isEmpty(fakeIds)) {
|
||||
try {
|
||||
dnsIpCfgService.delete(fakeIds);
|
||||
addMessage(model, "delete_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("删除失败", e);
|
||||
addMessage(model, "delete_failed");
|
||||
@RequestMapping(value = {"/delete"})
|
||||
@RequiresPermissions(value={"dns:fake:ip:config"})
|
||||
public String delete(Integer isAudit,Integer isValid,String ids,Integer functionId){
|
||||
dnsIpCfgService.delete(isAudit,isValid,ids,functionId);
|
||||
return "redirect:" + adminPath +"/cfg/dnsIp/list?functionId="+functionId;
|
||||
}
|
||||
@RequestMapping(value = {"/audit"})
|
||||
@RequiresPermissions(value={"dns:fake:ip:audit"})
|
||||
public String audit(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 {
|
||||
dnsIpCfgService.audit(isAudit,isValid,functionId,id,auditTime);
|
||||
} catch (MaatConvertException e) {
|
||||
e.printStackTrace();
|
||||
logger.info("dns fake ip配置下发失败:"+e.getMessage());
|
||||
addMessage(redirectAttributes, e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
addMessage(model, "delete_failed");
|
||||
|
||||
}
|
||||
|
||||
Page<DnsIpCfg> page = dnsIpCfgService.findPage(new Page<DnsIpCfg>(request, response, 30), dnsIpCfg);
|
||||
model.addAttribute("page", page);
|
||||
|
||||
addRequestAndServiceDictToModel(model);
|
||||
return "/cfg/dnsIpCfgList";
|
||||
return "redirect:" + adminPath +"/cfg/dnsIp/list?functionId="+functionId;
|
||||
}
|
||||
|
||||
private void addRequestAndServiceDictToModel(Model model) {
|
||||
List<RequestInfo> requestInfos = requestInfoService.getAllRequestInfo();
|
||||
model.addAttribute("requestInfos", requestInfos);
|
||||
List<ServiceDictInfo> fls = serviceDictInfoService.findAllFlDict();
|
||||
model.addAttribute("fls", fls);
|
||||
List<ServiceDictInfo> xzs = serviceDictInfoService.findAllXzDict();
|
||||
model.addAttribute("xzs", xzs);
|
||||
List<ServiceDictInfo> lables = serviceDictInfoService.findAllLableDict();
|
||||
model.addAttribute("lables", lables);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
package com.nis.web.controller.configuration.ntc;
|
||||
|
||||
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.RequiresPermissions;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
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.ResponseBody;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.SysUser;
|
||||
import com.nis.domain.basics.PolicyGroupInfo;
|
||||
import com.nis.domain.basics.ServiceDictInfo;
|
||||
import com.nis.domain.basics.SysDictInfo;
|
||||
import com.nis.domain.configuration.AreaBean;
|
||||
import com.nis.domain.configuration.AreaIpCfg;
|
||||
import com.nis.domain.configuration.AvContIpCfg;
|
||||
import com.nis.domain.configuration.AvVoipAccountCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.DnsResStrategy;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.domain.configuration.AvVoipIpCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.util.Configurations;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DateUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.excel.ExportExcel;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
/**
|
||||
* dns响应策略
|
||||
* @author ddm
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/maintenance/dnsResStrategy")
|
||||
public class DnsResStrategyController extends BaseController {
|
||||
|
||||
@RequestMapping(value = {"/form"})
|
||||
@RequiresPermissions(value={"dns:res:strategy:config"})
|
||||
public String from(Model model,
|
||||
HttpServletRequest request,
|
||||
HttpServletResponse response,
|
||||
String ids,
|
||||
@ModelAttribute("cfg")DnsResStrategy cfg){
|
||||
if(cfg == null){
|
||||
cfg=new DnsResStrategy();
|
||||
}
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
cfg = dnsResStrategyService.getDnsResStrategy(Long.valueOf(ids),-1);
|
||||
initFormCondition(model, cfg);
|
||||
model.addAttribute("isAdd", false);
|
||||
}else{
|
||||
//不存在响应策略为0的配置,则新策略时,cfgId默认为0
|
||||
DnsResStrategy dns0=dnsResStrategyService.getDnsResStrategy(0l,null);
|
||||
if(dns0 == null){
|
||||
cfg.setCfgId(0l);
|
||||
}
|
||||
initFormCondition(model, cfg);
|
||||
model.addAttribute("isAdd", true);
|
||||
}
|
||||
|
||||
//查询policyGroup列表,供响应策略选择
|
||||
List<PolicyGroupInfo> policyGroups=policyGroupInfoService.findPolicyGroupInfos();
|
||||
model.addAttribute("policyGroups", policyGroups);
|
||||
|
||||
model.addAttribute("_cfg", cfg);
|
||||
return "/cfg/maintenance/dnsResStrategy/form";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/saveOrUpdate"})
|
||||
@RequiresPermissions(value={"dns:res:strategy:config"})
|
||||
public String saveOrUpdate(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")DnsResStrategy cfg){
|
||||
try{
|
||||
|
||||
dnsResStrategyService.saveOrUpdate(cfg);
|
||||
|
||||
addMessage(model,"save_success");
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
addMessage(model,"save_failed");
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/maintenance/dnsResStrategy/list?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/list"})
|
||||
public String list(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")DnsResStrategy entity){
|
||||
//查询时left join policyGroup
|
||||
Page<DnsResStrategy> page = dnsResStrategyService.findPage(new Page<DnsResStrategy>(request, response,"r"), entity);
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model);
|
||||
return "/cfg/maintenance/dnsResStrategy/list";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/delete"})
|
||||
@RequiresPermissions(value={"dns:res:strategy:config"})
|
||||
public String delete(Integer isAudit,Integer isValid,String ids,Integer functionId,Model model,HttpServletRequest request,HttpServletResponse response){
|
||||
try{
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
dnsResStrategyService.delete(isAudit,isValid,ids,functionId);
|
||||
}
|
||||
addMessage(model,"delete_success");
|
||||
}catch(Exception e){
|
||||
addMessage(model,"delete_failed");
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/maintenance/dnsResStrategy/list?functionId="+functionId;
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/audit"})
|
||||
//@RequiresPermissions(value={"dns:res:strategy:audit"})
|
||||
public String audit(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 {
|
||||
dnsResStrategyService.audit(isAudit,isValid,functionId,id,auditTime);
|
||||
} catch (MaatConvertException e) {
|
||||
e.printStackTrace();
|
||||
logger.info("VOIP配置下发失败:"+e.getMessage());
|
||||
addMessage(redirectAttributes, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath +"/maintenance/dnsResStrategy/list?functionId="+functionId;
|
||||
}
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/validCfgId")
|
||||
public boolean validCfgId(Long cfgId) {
|
||||
DnsResStrategy dns=dnsResStrategyService.getDnsResStrategy(cfgId,null);
|
||||
if(dns == null ){
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import com.nis.web.dao.MyBatisDao;
|
||||
@MyBatisDao
|
||||
public interface PolicyGroupInfoDao extends CrudDao<PolicyGroupInfo> {
|
||||
List<PolicyGroupInfo> findPolicyGroupInfoList(PolicyGroupInfo policyGroupInfo);
|
||||
List<PolicyGroupInfo> findPolicyGroupInfos();
|
||||
PolicyGroupInfo getById(int id);
|
||||
|
||||
}
|
||||
@@ -59,6 +59,13 @@
|
||||
</choose>
|
||||
|
||||
</select>
|
||||
<!-- 查出所有 有效数据-->
|
||||
<select id="findPolicyGroupInfos" resultMap="PolicyGroupInfoMap">
|
||||
SELECT
|
||||
<include refid="PolicyGroupInfoColumns"/>
|
||||
FROM policy_group_info r
|
||||
where r.is_valid=1
|
||||
</select>
|
||||
<insert id="insert" parameterType="com.nis.domain.basics.PolicyGroupInfo" >
|
||||
insert into policy_group_info(
|
||||
IS_VALID,
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.nis.web.dao.configuration;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.nis.domain.configuration.DnsIpCfg;
|
||||
@@ -8,5 +10,6 @@ import com.nis.web.dao.MyBatisDao;
|
||||
|
||||
@MyBatisDao
|
||||
public interface DnsIpCfgDao extends CrudDao<DnsIpCfg> {
|
||||
public int deleteByFakeId(@Param("fakeId") String fakeIds);
|
||||
List<DnsIpCfg> findPage(DnsIpCfg dnsIpCfg);
|
||||
DnsIpCfg getDnsIpCfg(Long cfgId);
|
||||
}
|
||||
|
||||
@@ -2,151 +2,346 @@
|
||||
<!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.DnsIpCfgDao">
|
||||
<resultMap id="dnsIpCfgMap" type="com.nis.domain.configuration.DnsIpCfg">
|
||||
<id column="cfg_id" property="cfgId"/>
|
||||
<result column="cfg_desc" property="cfgDesc"/>
|
||||
<result column="ip_type" property="ipType"/>
|
||||
<result column="src_ip" property="srcIp"/>
|
||||
<result column="src_ip_mask" property="srcIpMask"/>
|
||||
<result column="src_port" property="srcPort"/>
|
||||
<result column="src_port_mask" property="srcPortMask"/>
|
||||
<result column="dst_ip" property="dstIp"/>
|
||||
<result column="dst_ip_mask" property="dstIpMask"/>
|
||||
<result column="dst_port" property="dstPort"/>
|
||||
<result column="dst_port_mask" property="dstPortMask"/>
|
||||
<result column="direction" property="direction"/>
|
||||
<result column="protocol" property="protocol"/>
|
||||
<result column="is_valid" property="isValid"/>
|
||||
<result column="is_audit" property="isAudit"/>
|
||||
<result column="creator_id" property="creator.id"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="editor_id" property="editor.id"/>
|
||||
<result column="edit_time" property="editTime"/>
|
||||
<result column="auditor_id" property="auditor.id"/>
|
||||
<result column="audit_time" property="auditTime"/>
|
||||
<result column="request_id" property="request.id"/>
|
||||
<result column="fake_id" property="fakeId"/>
|
||||
<result column="classify" property="classify"/>
|
||||
<result column="attribute" property="attribute"/>
|
||||
<result column="label" property="label"/>
|
||||
<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" />
|
||||
<result column="dns_strategy_id" property="dnsStrategyId" jdbcType="VARCHAR" />
|
||||
<result column="dns_strategy_name" property="dnsStrategyName" jdbcType="VARCHAR" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="columns">
|
||||
dic.CFG_ID, dic.CFG_DESC, dic.IP_TYPE, dic.SRC_IP, dic.SRC_IP_MASK, dic.SRC_PORT,
|
||||
dic.SRC_PORT_MASK, dic.DST_IP, dic.DST_IP_MASK, dic.DST_PORT, dic.DST_PORT_MASK,
|
||||
dic.DIRECTION, dic.PROTOCOL, dic.IS_VALID, dic.IS_AUDIT, dic.CREATOR_ID,
|
||||
dic.CREATE_TIME, dic.EDITOR_ID, dic.EDIT_TIME, dic.AUDITOR_ID, dic.AUDIT_TIME,
|
||||
dic.REQUEST_ID, dic.FAKE_ID, dic.CLASSIFY, dic.ATTRIBUTE, dic.LABLE
|
||||
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.dns_strategy_id
|
||||
</sql>
|
||||
|
||||
<select id="findList" resultMap="dnsIpCfgMap">
|
||||
<select id="findPage" resultMap="dnsIpCfgMap">
|
||||
select
|
||||
<include refid="columns"></include>,
|
||||
c.name as "creator.name",
|
||||
e.name as "editor.name",
|
||||
a.name as "auditor.name",
|
||||
ri.request_title as "request.requestTitle"
|
||||
from dns_ip_cfg dic
|
||||
left join sys_user c on dic.creator_id=c.id
|
||||
left join sys_user e on dic.creator_id=e.id
|
||||
left join sys_user a on dic.creator_id=a.id
|
||||
left join request_info ri on dic.request_id=ri.id
|
||||
where dic.is_valid=1
|
||||
<if test="searchCreateTimeStart != null">
|
||||
and dic.create_time >= #{searchCreateTimeStart}
|
||||
</if>
|
||||
<if test="searchCreateTimeEnd != null">
|
||||
and dic.create_time <= #{searchCreateTimeEnd}
|
||||
</if>
|
||||
<!-- <if test="searchEditTimeStart != null">
|
||||
and dic.create_time >= #{searchEditTimeStart}
|
||||
</if>
|
||||
<if test="searchEditTimeEnd != null">
|
||||
and dic.create_time <= #{searchEditTimeEnd}
|
||||
</if>
|
||||
<if test="searchAuditTimeStart != null">
|
||||
and dic.create_time >= #{searchAuditTimeStart}
|
||||
</if>
|
||||
<if test="searchAuditTimeEnd != null">
|
||||
and dic.create_time <= #{searchAuditTimeEnd}
|
||||
</if>
|
||||
<if test="isAudit != null">
|
||||
and dic.is_audit = #{isAudit}
|
||||
</if> -->
|
||||
<if test="request != null and request.id != null">
|
||||
and dic.request_id = #{request.id}
|
||||
</if>
|
||||
<if test="classify != null and classify != ''">
|
||||
and concat(",", dic.classify, ",") like concat("%,", #{classify}, ",%")
|
||||
</if>
|
||||
<if test="attribute != null and attribute != ''">
|
||||
and concat(",", dic.attribute, ",") like concat("%,", #{attribute}, ",%")
|
||||
</if>
|
||||
<if test="lable != null and lable != ''">
|
||||
and concat(",", dic.lable, ",") like concat("%,", #{lable}, ",%")
|
||||
</if>
|
||||
<if test="cfgDesc != null and cfgDesc != ''">
|
||||
and dic.cfg_desc like concat("%", #{cfgDesc}, "%")
|
||||
</if>
|
||||
<include refid="columns"></include>
|
||||
<trim prefix="," prefixOverrides=",">
|
||||
,s.name as creator_name,e.name as editor_name,u.name as auditor_name
|
||||
,ri.request_title as requestName,dns.cfg_Desc as dns_strategy_name
|
||||
</trim>
|
||||
from dns_ip_cfg r
|
||||
left join dns_res_strategy dns on dns.cfg_Id=r.dns_strategy_id
|
||||
left join sys_user s on r.creator_id=s.id
|
||||
left join sys_user e on r.editor_id=e.id
|
||||
left join sys_user u on r.auditor_id=u.id
|
||||
left join request_info ri on r.request_id=ri.id
|
||||
<where>
|
||||
<if test="cfgId != null">
|
||||
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
|
||||
</if>
|
||||
<if test="cfgDesc != null and cfgDesc != ''">
|
||||
AND r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="dnsStrategyName != null and dnsStrategyName != ''">
|
||||
AND dns.cfg_desc like concat(concat('%',#{dnsStrategyName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="cfgRegionCode != null">
|
||||
AND r.CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="cfgType != null and cfgType != ''">
|
||||
AND r.CFG_TYPE like concat(concat('%',#{CFG_TYPE,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="ipType != null">
|
||||
AND r.IP_TYPE=#{ipType,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="ipPattern != null">
|
||||
AND r.IP_PATTERN=#{ipPattern,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="srcIpAddress != null and srcIpAddress != ''">
|
||||
AND r.SRC_IP_ADDRESS=#{srcIpAddress,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="destIpAddress != null and destIpAddress != ''">
|
||||
AND r.DEST_IP_ADDRESS=#{destIpAddress,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="portPattern != null">
|
||||
AND r.PORT_PATTERN=#{portPattern,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="srcPort != null and srcPort !=''">
|
||||
AND r.SRC_PORT=#{srcPort,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="destPort != null and destPort !=''">
|
||||
AND r.DEST_PORT=#{destPort,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="direction != null">
|
||||
AND r.DIRECTION=#{direction,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="protocol != null">
|
||||
AND r.PROTOCOL=#{protocol,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="protocolId != null">
|
||||
AND r.PROTOCOL_ID=#{protocolId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="action != null">
|
||||
AND r.ACTION=#{action,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isValid != null">
|
||||
AND r.IS_VALID=#{isValid,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isValid == null">
|
||||
AND r.IS_VALID != -1
|
||||
</if>
|
||||
<if test="isAudit != null">
|
||||
AND r.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="creatorName != null and creatorName !=''">
|
||||
AND CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="createTime != null and createTime !=''">
|
||||
AND r.CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="editorName != null and editorName !=''">
|
||||
AND EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="editTime != null and editTime !='' ">
|
||||
AND r.EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="auditorName != null and auditorName !=''">
|
||||
AND AUDITOR_NAME like concat(concat('%',#{auditorName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="auditTime != null and auditTime !=''">
|
||||
AND r.AUDIT_TIME=#{auditTime,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="serviceId != null">
|
||||
AND r.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="requestId != null">
|
||||
AND r.REQUEST_ID=#{requestId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="compileId != null">
|
||||
AND r.COMPILE_ID=#{compileId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isAreaEffective != null">
|
||||
AND r.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="classify != null and classify !=''">
|
||||
AND r.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="attribute != null and attribute !=''">
|
||||
AND r.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="lable != null and lable !=''">
|
||||
AND r.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="areaEffectiveIds != null and areaEffectiveIds !=''">
|
||||
AND r.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="functionId != null">
|
||||
AND r.FUNCTION_ID=#{functionId,jdbcType=INTEGER}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="get" resultMap="dnsIpCfgMap">
|
||||
<select id="getDnsIpCfg" resultMap="dnsIpCfgMap">
|
||||
select
|
||||
<include refid="columns"></include>,
|
||||
c.name as "creator.name",
|
||||
e.name as "editor.name",
|
||||
a.name as "auditor.name",
|
||||
ri.request_title as "request.requestTitle"
|
||||
from dns_ip_cfg dic
|
||||
left join sys_user c on dic.creator_id=c.id
|
||||
left join sys_user e on dic.creator_id=e.id
|
||||
left join sys_user a on dic.creator_id=a.id
|
||||
left join request_info ri on dic.request_id=ri.id
|
||||
where dic.cfg_id=#{id}
|
||||
where dic.cfg_id=#{cfgId}
|
||||
</select>
|
||||
|
||||
<insert id="insert">
|
||||
insert into dns_ip_cfg (
|
||||
cfg_desc, ip_type, src_ip, src_ip_mask, src_port,
|
||||
src_port_mask, dst_ip, dst_ip_mask, dst_port, dst_port_mask,
|
||||
direction, protocol, is_valid, is_audit, creator_id,
|
||||
create_time, request_id, fake_id, classify, attribute, lable
|
||||
) values (
|
||||
#{cfgDesc}, #{ipType}, #{srcIp}, #{srcIpMask}, #{srcPort}, #{srcPortMask},
|
||||
#{dstIp}, #{dstIpMask}, #{dstPort}, #{dstPortMask}, #{direction}, #{protocol},
|
||||
#{isValid}, #{isAudit}, #{creator.id}, #{createTime}, #{request.id}, #{fakeId},
|
||||
#{classify}, #{attribute}, #{lable}
|
||||
)
|
||||
<selectKey keyProperty="cfgId" resultType="java.lang.Long">
|
||||
select LAST_INSERT_ID() as cfg_id
|
||||
</selectKey>
|
||||
</insert>
|
||||
<insert id="insert" parameterType="com.nis.domain.configuration.DnsIpCfg" >
|
||||
insert into dns_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,
|
||||
dns_strategy_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},
|
||||
#{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},
|
||||
#{dnsStrategyId,jdbcType=INTEGER}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="update">
|
||||
update
|
||||
dns_ip_cfg
|
||||
set
|
||||
cfg_desc=#{cfgDesc}, ip_type=#{ipType}, src_ip=#{srcIp}, src_ip_mask=#{srcIpMask},
|
||||
src_port=#{srcPort}, src_port_mask=#{srcPortMask}, dst_ip=#{dstIp},
|
||||
dst_ip_mask=#{dstIpMask}, dst_port=#{dstPort}, dst_port_mask=#{dstPortMask},
|
||||
direction=#{direction}, protocol=#{protocol}, request_id=#{request.id},
|
||||
fake_id=#{fakeId}, classify=#{classify}, attribute=#{attribute}, lable=#{lable},
|
||||
editor_id=#{editor.id}, edit_time=#{editTime}
|
||||
where cfg_id=#{cfgId}
|
||||
</update>
|
||||
|
||||
<update id="delete">
|
||||
update
|
||||
dns_ip_cfg
|
||||
set
|
||||
is_valid=0
|
||||
where cfg_id=#{cfgId}
|
||||
</update>
|
||||
<update id="deleteByFakeId">
|
||||
update
|
||||
dns_ip_cfg
|
||||
set
|
||||
is_valid=0
|
||||
where fake_id =#{fakeId}
|
||||
</update>
|
||||
<update id="update" parameterType="com.nis.domain.configuration.DnsIpCfg" >
|
||||
update dns_ip_cfg
|
||||
<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="isValid != null" >
|
||||
is_valid = #{isValid,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="isAudit != null" >
|
||||
is_audit = #{isAudit,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="editorId != null" >
|
||||
editor_id = #{editorId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="editTime != null and editTime != ''" >
|
||||
edit_time = #{editTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="auditorId != null" >
|
||||
AUDITOR_ID = #{auditorId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="auditTime != null and auditTime != ''" >
|
||||
AUDIT_TIME = #{auditTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="compileId != null" >
|
||||
COMPILE_ID = #{compileId,jdbcType=TIMESTAMP},
|
||||
</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>
|
||||
<if test="serviceId != null" >
|
||||
service_id = #{serviceId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="ipType != null" >
|
||||
ip_type = #{ipType,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="srcIpAddress != null and srcIpAddress != ''" >
|
||||
src_ip_address = #{srcIpAddress,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="ipPattern != null" >
|
||||
ip_pattern = #{ipPattern,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="portPattern != null" >
|
||||
port_pattern = #{portPattern,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="srcPort != null and srcPort != ''" >
|
||||
src_port = #{srcPort,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="protocol != null" >
|
||||
protocol = #{protocol,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="protocolId != null" >
|
||||
protocol_id = #{protocolId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="direction != null" >
|
||||
direction = #{direction,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="destPort != null and destPort != ''" >
|
||||
dest_port = #{destPort,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="destIpAddress != null and destIpAddress != ''" >
|
||||
dest_ip_address = #{destIpAddress,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="cfgType != null and cfgType != ''" >
|
||||
cfg_type = #{cfgType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="cfgRegionCode != null " >
|
||||
cfg_region_code = #{cfgRegionCode,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="dnsStrategyId != null " >
|
||||
dns_strategy_id = #{dnsStrategyId,jdbcType=INTEGER},
|
||||
</if>
|
||||
</trim>
|
||||
</set>
|
||||
<where>
|
||||
and cfg_id = #{cfgId,jdbcType=INTEGER}
|
||||
</where>
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.nis.web.dao.configuration;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.nis.domain.configuration.DnsResStrategy;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.MyBatisDao;
|
||||
|
||||
@MyBatisDao
|
||||
public interface DnsResStrategyDao extends CrudDao<DnsResStrategy> {
|
||||
List<DnsResStrategy> findPage(DnsResStrategy dnsResStrategy);
|
||||
List<DnsResStrategy> findList(@Param("cfgId")Long cfgId,@Param("isValid")Integer isValid);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,333 @@
|
||||
<?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.DnsResStrategyDao" >
|
||||
|
||||
<resultMap id="DnsResStrategyMap" type="com.nis.domain.configuration.DnsResStrategy" >
|
||||
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
|
||||
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
|
||||
<result column="res_group_1_id" property="resGroup1Id" jdbcType="INTEGER" />
|
||||
<result column="res_group_1_num" property="resGroup1Num" jdbcType="INTEGER" />
|
||||
<result column="res_group_2_id" property="resGroup2Id" jdbcType="INTEGER" />
|
||||
<result column="res_group_2_num" property="resGroup2Num" jdbcType="INTEGER" />
|
||||
<result column="res_group_3_id" property="resGroup3Id" jdbcType="INTEGER" />
|
||||
<result column="res_group_3_num" property="resGroup3Num" jdbcType="INTEGER" />
|
||||
<result column="res_group_4_id" property="resGroup4Id" jdbcType="INTEGER" />
|
||||
<result column="res_group_4_num" property="resGroup4Num" jdbcType="INTEGER" />
|
||||
<result column="res_group_5_id" property="resGroup5Id" jdbcType="INTEGER" />
|
||||
<result column="res_group_5_num" property="resGroup5Num" jdbcType="INTEGER" />
|
||||
<result column="min_ttl" property="minTtl" jdbcType="INTEGER" />
|
||||
<result column="max_ttl" property="maxTtl" 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="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" />
|
||||
<result column="group_1_name" property="group1Name" jdbcType="VARCHAR" />
|
||||
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
|
||||
</resultMap>
|
||||
<sql id="DnsResStrategyColumns">
|
||||
r.cfg_id,r.cfg_desc,r.res_group_1_id,
|
||||
r.res_group_1_num,r.res_group_2_id,r.res_group_2_num,r.res_group_3_id
|
||||
,r.res_group_3_num,r.res_group_4_id,r.res_group_4_num
|
||||
,r.res_group_5_id,r.res_group_5_num,r.min_ttl
|
||||
,r.max_ttl,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.is_area_effective,r.classify,r.attribute,r.lable
|
||||
,r.area_effective_ids,r.function_id,r.cfg_region_code,r.compile_id
|
||||
</sql>
|
||||
|
||||
<!-- 查出所有 有效数据-->
|
||||
<select id="findPage" resultMap="DnsResStrategyMap">
|
||||
SELECT
|
||||
<include refid="DnsResStrategyColumns"/>
|
||||
<trim prefix="," prefixOverrides=",">
|
||||
, a.group_name group_1_name,s.name as creator_name,e.name as editor_name,u.name as auditor_name
|
||||
,ri.request_title as requestName
|
||||
</trim>
|
||||
FROM dns_res_strategy r
|
||||
left join policy_group_info a on r.res_group_1_id=a.group_Id
|
||||
left join sys_user s on r.creator_id=s.id
|
||||
left join sys_user e on r.editor_id=e.id
|
||||
left join sys_user u on r.auditor_id=u.id
|
||||
left join request_info ri on r.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 r.CFG_ID=#{cfgId,jdbcType=BIGINT}
|
||||
</if>
|
||||
<if test="compileId != null">
|
||||
AND r.compile_id=#{compileId,jdbcType=BIGINT}
|
||||
</if>
|
||||
<if test="cfgDesc != null and cfgDesc != ''">
|
||||
AND r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="group1Name != null and group1Name != ''">
|
||||
AND a.group_name like concat(concat('%',#{group1Name,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="action != null">
|
||||
AND r.ACTION=#{action,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isValid != null">
|
||||
AND r.IS_VALID=#{isValid,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isValid == null">
|
||||
AND r.IS_VALID != -1
|
||||
</if>
|
||||
<if test="isAudit != null">
|
||||
AND r.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 r.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 r.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="requestId != null">
|
||||
AND r.REQUEST_ID=#{requestId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isAreaEffective != null">
|
||||
AND r.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="classify != null and classify != ''">
|
||||
AND r.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="attribute != null and attribute != ''">
|
||||
AND r.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="lable != null and lable != ''">
|
||||
AND r.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="functionId != null">
|
||||
AND r.function_id=#{functionId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<!-- 数据范围过滤 -->
|
||||
${sqlMap.dsf}
|
||||
</trim>
|
||||
<choose>
|
||||
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
||||
ORDER BY ${page.orderBy}
|
||||
</when>
|
||||
<otherwise>
|
||||
ORDER BY r.CFG_ID desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
<!-- 查出所有 有效数据-->
|
||||
<select id="findList" resultMap="DnsResStrategyMap">
|
||||
SELECT
|
||||
<include refid="DnsResStrategyColumns"/>
|
||||
FROM dns_res_strategy r
|
||||
<where>
|
||||
<if test="isValid == -1">
|
||||
AND r.is_valid !=-1
|
||||
</if>
|
||||
<if test="isValid == 1">
|
||||
AND r.is_valid ==1
|
||||
</if>
|
||||
<if test="isValid == 0">
|
||||
AND r.is_valid ==0
|
||||
</if>
|
||||
<if test="cfgId != null">
|
||||
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<insert id="insert" parameterType="com.nis.domain.configuration.DnsResStrategy" >
|
||||
insert into dns_res_strategy (
|
||||
CFG_ID,
|
||||
CFG_DESC,
|
||||
ACTION,
|
||||
IS_VALID,
|
||||
IS_AUDIT,
|
||||
CREATOR_ID,
|
||||
CREATE_TIME,
|
||||
EDITOR_ID,
|
||||
EDIT_TIME,
|
||||
AUDITOR_ID,
|
||||
AUDIT_TIME,
|
||||
SERVICE_ID,
|
||||
REQUEST_ID,
|
||||
IS_AREA_EFFECTIVE,
|
||||
CLASSIFY,
|
||||
ATTRIBUTE,
|
||||
LABLE,
|
||||
AREA_EFFECTIVE_IDS,
|
||||
function_id,
|
||||
res_group_1_id,
|
||||
res_group_1_num,
|
||||
res_group_2_id,
|
||||
res_group_2_num,
|
||||
res_group_3_id,
|
||||
res_group_3_num,
|
||||
res_group_4_id,
|
||||
res_group_4_num,
|
||||
res_group_5_id,
|
||||
res_group_5_num,
|
||||
min_ttl,
|
||||
max_ttl,
|
||||
cfg_type,
|
||||
compile_Id,
|
||||
cfg_region_code
|
||||
)values (
|
||||
#{cfgId,jdbcType=VARCHAR},
|
||||
#{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},
|
||||
#{isAreaEffective,jdbcType=INTEGER},
|
||||
#{classify,jdbcType=VARCHAR},
|
||||
#{attribute,jdbcType=VARCHAR},
|
||||
#{lable,jdbcType=VARCHAR},
|
||||
#{areaEffectiveIds,jdbcType=VARCHAR},
|
||||
#{functionId,jdbcType=INTEGER},
|
||||
#{resGroup1Id,jdbcType=INTEGER},
|
||||
#{resGroup1Num,jdbcType=INTEGER},
|
||||
#{resGroup2Id,jdbcType=INTEGER},
|
||||
#{resGroup2Num,jdbcType=INTEGER},
|
||||
#{resGroup3Id,jdbcType=INTEGER},
|
||||
#{resGroup3Num,jdbcType=INTEGER},
|
||||
#{resGroup4Id,jdbcType=INTEGER},
|
||||
#{resGroup4Num,jdbcType=INTEGER},
|
||||
#{resGroup5Id,jdbcType=INTEGER},
|
||||
#{resGroup5Num,jdbcType=INTEGER},
|
||||
#{minTtl,jdbcType=INTEGER},
|
||||
#{maxTtl,jdbcType=INTEGER},
|
||||
#{cfgType,jdbcType=VARCHAR},
|
||||
#{compileId,jdbcType=INTEGER},
|
||||
#{cfgRegionCode,jdbcType=INTEGER}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="com.nis.domain.configuration.DnsResStrategy" >
|
||||
update dns_res_strategy
|
||||
<set >
|
||||
<trim suffixOverrides=",">
|
||||
<if test="cfgDesc != null and cfgDesc != ''" >
|
||||
cfg_desc = #{cfgDesc,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="compileId != null " >
|
||||
compile_Id = #{compileId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="action != null" >
|
||||
action = #{action,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="editorId != null" >
|
||||
editor_id = #{editorId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="editTime != null and editTime != ''" >
|
||||
edit_time = #{editTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="auditorId != null" >
|
||||
AUDITOR_ID = #{auditorId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="auditTime != null and auditTime != ''" >
|
||||
AUDIT_TIME = #{auditTime,jdbcType=TIMESTAMP},
|
||||
</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>
|
||||
<if test="serviceId != null" >
|
||||
service_id = #{serviceId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="resGroup1Id != null" >
|
||||
res_group_1_id = #{resGroup1Id,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="resGroup1Num != null" >
|
||||
res_group_1_num = #{resGroup1Num,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="resGroup2Id != null" >
|
||||
res_group_2_id = #{resGroup2Id,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="resGroup2Num != null" >
|
||||
res_group_2_num = #{resGroup2Num,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="resGroup3Id != null" >
|
||||
res_group_3_id = #{resGroup3Id,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="resGroup3Num != null" >
|
||||
res_group_3_num = #{resGroup3Num,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="resGroup4Id != null" >
|
||||
res_group_4_id = #{resGroup4Id,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="resGroup4Num != null" >
|
||||
res_group_4_num = #{resGroup4Num,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="resGroup5Id != null" >
|
||||
res_group_5_id = #{resGroup5Id,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="resGroup5Num != null" >
|
||||
res_group_5_num = #{resGroup5Num,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="minTtl != null" >
|
||||
min_ttl = #{minTtl,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="maxTtl != null" >
|
||||
max_ttl = #{maxTtl,jdbcType=INTEGER},
|
||||
</if>
|
||||
</trim>
|
||||
</set>
|
||||
<where>
|
||||
and cfg_id = #{cfgId,jdbcType=INTEGER}
|
||||
<if test="functionId != null" >
|
||||
and function_id = #{functionId,jdbcType=INTEGER}
|
||||
</if>
|
||||
</where>
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
@@ -40,6 +40,10 @@ public class PolicyGroupInfoService extends BaseService{
|
||||
page.setList(list);
|
||||
return page;
|
||||
}
|
||||
public List<PolicyGroupInfo> findPolicyGroupInfos() {
|
||||
List<PolicyGroupInfo> list=policyGroupInfoDao.findPolicyGroupInfos();
|
||||
return list;
|
||||
}
|
||||
|
||||
public PolicyGroupInfo getById(int id) {
|
||||
PolicyGroupInfo policyGroupInfo=policyGroupInfoDao.getById(id);
|
||||
|
||||
@@ -1,109 +1,184 @@
|
||||
package com.nis.web.service.configuration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
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.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.callback.NtcDnsResStrategy;
|
||||
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.DnsIpCfg;
|
||||
import com.nis.domain.maat.DnsIpRecvData;
|
||||
import com.nis.domain.maat.FromMaatBean;
|
||||
import com.nis.domain.maat.MaatDnsIpCfg;
|
||||
import com.nis.domain.maat.ToMaatDnsIpBean;
|
||||
import com.nis.main.ConvertTool;
|
||||
import com.nis.util.Collections3;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.DnsIpCfg;
|
||||
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.DnsIpCfgDao;
|
||||
import com.nis.web.service.CrudService;
|
||||
import com.nis.web.test.DnsIpTest;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.BaseService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 音视频文本
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
@Service
|
||||
public class DnsIpCfgService extends CrudService<DnsIpCfgDao, DnsIpCfg>{
|
||||
public class DnsIpCfgService extends BaseService{
|
||||
@Autowired
|
||||
private DnsIpCfgDao dnsIpCfgDao;
|
||||
@Override
|
||||
protected DnsIpCfgDao dnsIpCfgDao;
|
||||
|
||||
|
||||
public Page<DnsIpCfg> findPage(Page page, DnsIpCfg entity) {
|
||||
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r"));
|
||||
entity.setPage(page);
|
||||
List<DnsIpCfg> list=dnsIpCfgDao.findPage(entity);
|
||||
page.setList(list);
|
||||
return page;
|
||||
}
|
||||
|
||||
public DnsIpCfg getDnsIpCfg(Long cfgId) {
|
||||
return dnsIpCfgDao.getDnsIpCfg(cfgId);
|
||||
}
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void save(DnsIpCfg dnsIpCfg) {
|
||||
dao.insert(dnsIpCfg);
|
||||
|
||||
Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
|
||||
|
||||
//组织要发送的json
|
||||
List<ToMaatDnsIpBean> toMaatData = new ArrayList<ToMaatDnsIpBean>();
|
||||
ToMaatDnsIpBean toMaatBean = new ToMaatDnsIpBean();
|
||||
List<MaatDnsIpCfg> ipCfgList = new ArrayList<MaatDnsIpCfg>();
|
||||
MaatDnsIpCfg ipCfg = new MaatDnsIpCfg();
|
||||
List<DnsIpCfg> d1 = new ArrayList<DnsIpCfg>();
|
||||
d1.add(dnsIpCfg);
|
||||
ipCfg.setIpCfg(d1);
|
||||
ipCfgList.add(ipCfg);
|
||||
toMaatBean.setServiceCfg(ipCfgList);
|
||||
toMaatBean.setAttribute(dnsIpCfg.getAttribute());
|
||||
toMaatBean.setClassify(dnsIpCfg.getClassify());
|
||||
toMaatBean.setLable(dnsIpCfg.getLable());
|
||||
toMaatBean.setIsValid(1);
|
||||
toMaatBean.setRequestId(dnsIpCfg.getRequest().getId());
|
||||
|
||||
toMaatData.add(toMaatBean);
|
||||
|
||||
String sendJson = gson.toJson(toMaatData);
|
||||
|
||||
logger.info("准备下发配置:" + sendJson);
|
||||
//下发配置、接收结果
|
||||
String recvJson = "";
|
||||
try {
|
||||
//recvJson = new ConvertTool().saveDNSIPConfig(sendJson);
|
||||
recvJson = DnsIpTest.examine(sendJson);
|
||||
logger.info("收到结果:" + recvJson);
|
||||
} catch (Throwable e) {
|
||||
logger.error("欺骗ip配置新增下发失败,cfgId=" + dnsIpCfg.getCfgId(), e);
|
||||
throw new RuntimeException("欺骗ip配置新增下发失败:通讯异常");
|
||||
}
|
||||
|
||||
if (StringUtils.isBlank(recvJson)) {
|
||||
logger.error("新增欺骗ip配置失败:收到空的返回结果,cfgId:" + dnsIpCfg.getCfgId());
|
||||
throw new RuntimeException("新增欺骗ip配置失败:收到空的返回结果");
|
||||
}
|
||||
logger.info("结果接收成功");
|
||||
|
||||
FromMaatBean fromMaatBean = gson.fromJson(recvJson, FromMaatBean.class);
|
||||
List<DnsIpRecvData> data = fromMaatBean.getData();
|
||||
if (!Collections3.isEmpty(data)) {
|
||||
DnsIpRecvData dnsIpRecvData = data.get(0);
|
||||
if (dnsIpRecvData.getFakeId() != null && dnsIpRecvData.getCfgId() != null
|
||||
&& dnsIpRecvData.getCfgId().longValue() == dnsIpCfg.getCfgId().longValue()) {
|
||||
dnsIpCfg.setFakeId(dnsIpRecvData.getFakeId());
|
||||
dao.update(dnsIpCfg);
|
||||
public void saveOrUpdate(DnsIpCfg entity){
|
||||
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<Integer> compileIds = new ArrayList<Integer>();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,1);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
} else {
|
||||
logger.error("新增欺骗ip配置失败:收到空的返回结果,cfgId:" + dnsIpCfg.getCfgId());
|
||||
throw new RuntimeException("新增欺骗ip配置失败:收到空的返回结果");
|
||||
if(compileIds != null && compileIds.size() >0 && compileIds.get(0) != 0){
|
||||
entity.setCompileId(compileIds.get(0));
|
||||
dnsIpCfgDao.insert(entity);
|
||||
}else{
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
||||
}
|
||||
|
||||
//修改
|
||||
}else{
|
||||
Date editTime=new Date();
|
||||
entity.setIsValid(0);
|
||||
entity.setIsAudit(0);
|
||||
entity.setEditorId(UserUtils.getUser().getId());
|
||||
entity.setEditTime(editTime);
|
||||
dnsIpCfgDao.update(entity);
|
||||
}
|
||||
}
|
||||
|
||||
public void delete(String fakeIds) {
|
||||
if(fakeIds.endsWith(","))fakeIds=fakeIds.substring(0,fakeIds.lastIndexOf(","));
|
||||
String[] fakeIdsArr = fakeIds.split(",");
|
||||
for (String fakeId : fakeIdsArr) {
|
||||
dnsIpCfgDao.deleteByFakeId(fakeId);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param isAudit
|
||||
* @param isValid
|
||||
* @param ids compileIds
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void delete(Integer isAudit,Integer isValid,String ids,Integer functionId){
|
||||
DnsIpCfg entity = new DnsIpCfg();
|
||||
String[] idArray = ids.split(",");
|
||||
for(String id :idArray){
|
||||
entity.setCfgId(Long.valueOf(id));
|
||||
entity.setFunctionId(functionId);
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setEditorId(UserUtils.getUser().getId());
|
||||
entity.setEditTime(new Date());
|
||||
dnsIpCfgDao.update(entity);
|
||||
}
|
||||
//给配置转换层发送、接收结果
|
||||
String sendJson = "{\"fakeId\":[" + fakeIds + "]}";
|
||||
logger.info("准备下发配置:" + sendJson);
|
||||
Boolean recv = true;
|
||||
try {
|
||||
recv = new ConvertTool().invalidDNSIPConfig(sendJson);
|
||||
} catch (Throwable e) {
|
||||
logger.error("欺骗ip配置删除失败:通讯异常,fakeIds:" + fakeIds, e);
|
||||
throw new RuntimeException("欺骗ip配置删除失败:通讯失败");
|
||||
}
|
||||
if (!recv) {
|
||||
logger.error("欺骗ip配置删除失败,收到结果 " + recv + " ,fakeIds:" + fakeIds);
|
||||
throw new RuntimeException("欺骗ip配置删除失败");
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param isAudit
|
||||
* @param isValid
|
||||
* @param ids cfgId
|
||||
* @param functionId
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void audit(Integer isAudit,Integer isValid,Integer functionId,String id,Date auditTime){
|
||||
DnsIpCfg entity = new DnsIpCfg();
|
||||
|
||||
List<DnsIpCfg> list = new ArrayList();
|
||||
|
||||
entity.setCfgId(Long.valueOf(id));
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(auditTime);
|
||||
|
||||
dnsIpCfgDao.update(entity);
|
||||
|
||||
entity=dnsIpCfgDao.getDnsIpCfg(Long.valueOf(id));
|
||||
|
||||
String json="";
|
||||
if(entity.getIsAudit()==1){
|
||||
List<NtcDnsResStrategy> resStrategyList=new ArrayList<NtcDnsResStrategy>();
|
||||
//NtcDnsResStrategy resStrategy=convertCallBackIp(entity);
|
||||
//resStrategyList.add(resStrategy);
|
||||
//调用服务接口下发配置数据
|
||||
json=gsonToJson(resStrategyList);
|
||||
logger.info("DNS响应策略配置下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
try {
|
||||
ToMaatResult result = ConfigServiceUtil.postCallbackCfg(json);
|
||||
if(result!=null){
|
||||
logger.info("DNS响应策略配置下发响应信息:"+result.getMsg());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("DNS响应策略配置配置下发失败",e);
|
||||
throw e;
|
||||
}
|
||||
}else if(entity.getIsAudit()==3){
|
||||
List<NtcDnsResStrategy> resStrategyList=new ArrayList<>();
|
||||
//NtcDnsResStrategy ntcDnsResStrategy=convertCallBackDnsResStrategy(cfg);
|
||||
//resStrategyList.add(ntcDnsResStrategy);
|
||||
//调用服务接口取消配置
|
||||
json=gsonToJson(resStrategyList);
|
||||
logger.info("DNS响应策略配置配置参数:"+json);
|
||||
//调用服务接口取消配置
|
||||
try {
|
||||
ToMaatResult result = ConfigServiceUtil.put(json, 2);
|
||||
logger.info("DNS响应策略配置响应信息:"+result.getMsg());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("DNS响应策略配置配置失败");
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,188 @@
|
||||
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;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.BaseService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 音视频文本
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
@Service
|
||||
public class DnsResStrategyService extends BaseService{
|
||||
@Autowired
|
||||
protected DnsResStrategyDao dnsResStrategyDao;
|
||||
|
||||
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public Page<DnsResStrategy> findPage(Page<DnsResStrategy> page, DnsResStrategy entity) {
|
||||
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r"));
|
||||
entity.setPage(page);
|
||||
List<DnsResStrategy> list=dnsResStrategyDao.findPage(entity);
|
||||
page.setList(list);
|
||||
return page;
|
||||
}
|
||||
public List<DnsResStrategy> findDnsResStrategys(Long cfgId,Integer isValid) {
|
||||
List<DnsResStrategy> list=dnsResStrategyDao.findList(cfgId,isValid);
|
||||
return list;
|
||||
}
|
||||
|
||||
public DnsResStrategy getDnsResStrategy(Long id,Integer isValid) {
|
||||
List<DnsResStrategy> list=dnsResStrategyDao.findList(id,isValid);
|
||||
DnsResStrategy dnsResStrategy=null;
|
||||
if(list != null && list.size()>0){
|
||||
dnsResStrategy=list.get(0);
|
||||
}
|
||||
return dnsResStrategy;
|
||||
}
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void saveOrUpdate(DnsResStrategy entity){
|
||||
Date createTime=new Date();
|
||||
setAreaEffectiveIds(entity);
|
||||
List<DnsResStrategy> list=dnsResStrategyDao.findList(entity.getCfgId(),null);
|
||||
//新增
|
||||
if(list==null || list.size()==0){
|
||||
entity.initDefaultValue();
|
||||
entity.setCreatorId(UserUtils.getUser().getId());
|
||||
entity.setCreateTime(createTime);
|
||||
entity.setIsValid(0);
|
||||
entity.setIsAudit(0);
|
||||
//调用服务接口获取compileId
|
||||
List<Integer> compileIds = new ArrayList<Integer>();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,1);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
if(compileIds != null && compileIds.size() >0 && compileIds.get(0) != 0){
|
||||
entity.setCompileId(compileIds.get(0));
|
||||
}
|
||||
dnsResStrategyDao.insert(entity);
|
||||
//修改
|
||||
}else{
|
||||
Date editTime=new Date();
|
||||
entity.setIsValid(0);
|
||||
entity.setIsAudit(0);
|
||||
entity.setEditorId(UserUtils.getUser().getId());
|
||||
entity.setEditTime(editTime);
|
||||
|
||||
dnsResStrategyDao.update(entity);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param isAudit
|
||||
* @param isValid
|
||||
* @param ids compileIds
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void delete(Integer isAudit,Integer isValid,String ids,Integer functionId){
|
||||
DnsResStrategy entity = new DnsResStrategy();
|
||||
String[] idArray = ids.split(",");
|
||||
for(String id :idArray){
|
||||
entity.setCfgId(Long.valueOf(id));
|
||||
entity.setFunctionId(functionId);
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setEditorId(UserUtils.getUser().getId());
|
||||
entity.setEditTime(new Date());
|
||||
dnsResStrategyDao.update(entity);
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param isAudit
|
||||
* @param isValid
|
||||
* @param ids cfgId
|
||||
* @param functionId
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void audit(Integer isAudit,Integer isValid,Integer functionId,String id,Date auditTime){
|
||||
DnsResStrategy cfg=new DnsResStrategy();
|
||||
List<DnsResStrategy> beans=new ArrayList<>();
|
||||
beans.add(cfg);
|
||||
cfg.setCfgId(Long.valueOf(id));
|
||||
cfg.setIsValid(isValid);
|
||||
cfg.setIsAudit(isAudit);
|
||||
cfg.setEditTime(auditTime);
|
||||
cfg.setEditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(auditTime);
|
||||
dnsResStrategyDao.update(cfg);
|
||||
cfg=getDnsResStrategy(cfg.getCfgId(), null);
|
||||
String json="";
|
||||
if(cfg.getIsAudit()==1){
|
||||
List<NtcDnsResStrategy> resStrategyList=new ArrayList<NtcDnsResStrategy>();
|
||||
NtcDnsResStrategy resStrategy=convertCallBackDnsResStrategy(cfg);
|
||||
resStrategyList.add(resStrategy);
|
||||
//调用服务接口下发配置数据
|
||||
json=gsonToJson(resStrategyList);
|
||||
logger.info("DNS响应策略配置下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
try {
|
||||
ToMaatResult result = ConfigServiceUtil.postCallbackCfg(json);
|
||||
if(result!=null){
|
||||
logger.info("DNS响应策略配置下发响应信息:"+result.getMsg());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("DNS响应策略配置配置下发失败",e);
|
||||
throw e;
|
||||
}
|
||||
}else if(cfg.getIsAudit()==3){
|
||||
List<NtcDnsResStrategy> resStrategyList=new ArrayList<>();
|
||||
NtcDnsResStrategy ntcDnsResStrategy=convertCallBackDnsResStrategy(cfg);
|
||||
resStrategyList.add(ntcDnsResStrategy);
|
||||
//调用服务接口取消配置
|
||||
json=gsonToJson(resStrategyList);
|
||||
logger.info("DNS响应策略配置配置参数:"+json);
|
||||
//调用服务接口取消配置
|
||||
try {
|
||||
ToMaatResult result = ConfigServiceUtil.put(json, 2);
|
||||
logger.info("DNS响应策略配置响应信息:"+result.getMsg());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("DNS响应策略配置配置失败");
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user