dns关键字组配置审核功能
This commit is contained in:
@@ -1,39 +1,27 @@
|
||||
package com.nis.web.controller.basics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import jersey.repackaged.com.google.common.collect.Lists;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
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.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.AsnGroupInfo;
|
||||
import com.nis.domain.basics.AsnIpCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.configuration.DnsKeywordCfg;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
//import com.nis.util.AsnCacheUtils;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
@@ -119,7 +107,7 @@ public class DnsKeywordController extends BaseController{
|
||||
,HttpServletResponse response
|
||||
,RedirectAttributes redirectAttributes) {
|
||||
//选中配置审核
|
||||
/*if(!StringUtil.isEmpty(ids)) {
|
||||
if(!StringUtil.isEmpty(ids)) {
|
||||
List<DnsKeywordCfg> infoList=dnsKeywordCfgService.getByIds(ids);
|
||||
Map<Long,List<DnsKeywordCfg>> dnsKeywordMap=Maps.newHashMap();
|
||||
for(DnsKeywordCfg entity:infoList) {
|
||||
@@ -136,10 +124,10 @@ public class DnsKeywordController extends BaseController{
|
||||
dnsKeywordMap.put(Long.parseLong(entity.getUserRegion1()), keywords);
|
||||
}
|
||||
}
|
||||
*//********************每次下发一个组的region,保证事物********************//*
|
||||
//********************每次下发一个组的region,保证事物********************//*
|
||||
for (Long groupId : dnsKeywordMap.keySet()) {
|
||||
try {
|
||||
dnsKeywordCfgService.auditDnsKeywordBatch(dnsKeywordMap.get(groupId),groupId,isValid);
|
||||
dnsKeywordCfgService.auditDnsKeywordBatch(dnsKeywordMap.get(groupId),groupId,isAudit,isValid);
|
||||
} catch (Exception e) {
|
||||
logger.error("配置下发失败:",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
@@ -150,7 +138,7 @@ public class DnsKeywordController extends BaseController{
|
||||
|
||||
}
|
||||
}
|
||||
}else {
|
||||
}/*else {
|
||||
//条件下所有配置审核
|
||||
Page<AsnIpCfg> searchPage=new Page<AsnIpCfg>(request,response,"a");
|
||||
Page<AsnIpCfg> auditPage=new Page<AsnIpCfg>(request,response,"a");
|
||||
|
||||
@@ -27,4 +27,6 @@ public interface PolicyGroupInfoDao extends CrudDao<PolicyGroupInfo> {
|
||||
|
||||
List<PolicyGroupInfo> findPolicyByGroupInfoList(@Param("ids")String ids);
|
||||
List<PolicyGroupInfo> findPolicyGroupInfosByTypeForUD(@Param("groupType")Integer groupType,@Param("flag")Integer flag);
|
||||
List<PolicyGroupInfo> getInfoByServiceGroupId(@Param("serviceGroupId")Long serviceGroupId);
|
||||
int updateUdFlag(PolicyGroupInfo policyGroupInfo);
|
||||
}
|
||||
@@ -178,7 +178,30 @@
|
||||
</if>
|
||||
</where>
|
||||
</update>
|
||||
|
||||
<update id="updateUdFlag" parameterType="com.nis.domain.basics.PolicyGroupInfo" >
|
||||
update policy_group_info
|
||||
<set >
|
||||
<trim suffixOverrides=",">
|
||||
<if test="udFlag != null " >
|
||||
ud_flag = #{udFlag,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>
|
||||
</trim>
|
||||
</set>
|
||||
<where>
|
||||
<if test="groupId != null" >
|
||||
and group_id = #{groupId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="serviceGroupId != null" >
|
||||
and service_group_id = #{serviceGroupId,jdbcType=INTEGER}
|
||||
</if>
|
||||
</where>
|
||||
</update>
|
||||
<select id="getById" resultType="com.nis.domain.basics.PolicyGroupInfo">
|
||||
select <include refid="PolicyGroupInfoColumns"/>
|
||||
from policy_group_info r
|
||||
@@ -204,7 +227,11 @@
|
||||
</if>
|
||||
</trim>
|
||||
</select>
|
||||
|
||||
<select id="getInfoByServiceGroupId" resultType="com.nis.domain.basics.PolicyGroupInfo">
|
||||
select <include refid="PolicyGroupInfoColumns"/>,ud_flag
|
||||
from policy_group_info r
|
||||
where r.service_group_id =#{serviceGroupId}
|
||||
</select>
|
||||
<select id="getHasAreaPolicyGroups" resultType="com.nis.domain.basics.PolicyGroupInfo">
|
||||
SELECT
|
||||
<include refid="PolicyGroupInfoColumns"/>
|
||||
|
||||
@@ -23,5 +23,6 @@ public interface DnsKeywordCfgDao extends CrudDao<DnsKeywordCfg>{
|
||||
public void saveDnsKeywordsCfg(ComplexkeywordCfg entity);
|
||||
public List<DnsKeywordCfg> findPage(DnsKeywordCfg entity);
|
||||
public List<DnsKeywordCfg> getByIds(@Param("ids")String ids);
|
||||
public int hasValidDnsKeyword(@Param("groupId")Long groupId);
|
||||
public void delete(@Param("ids")String ids);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?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.DnsKeywordCfgDao" >
|
||||
<mapper namespace="com.nis.web.dao.configuration.DnsKeywordCfgDao">
|
||||
|
||||
<resultMap id="CfgIndexInfoMap" type="com.nis.domain.configuration.CfgIndexInfo" >
|
||||
<resultMap id="CfgIndexInfoMap" type="com.nis.domain.configuration.CfgIndexInfo">
|
||||
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
|
||||
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
|
||||
<result column="action" property="action" jdbcType="INTEGER" />
|
||||
@@ -17,25 +17,31 @@
|
||||
<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="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="area_effective_ids" property="areaEffectiveIds"
|
||||
jdbcType="VARCHAR" />
|
||||
<result column="function_id" property="functionId" jdbcType="INTEGER" />
|
||||
<result column="dns_strategy_id" property="dnsStrategyId" jdbcType="INTEGER" />
|
||||
<result column="dns_strategy_name" property="dnsStrategyName" jdbcType="VARCHAR" />
|
||||
<result column="dns_strategy_id" property="dnsStrategyId"
|
||||
jdbcType="INTEGER" />
|
||||
<result column="dns_strategy_name" property="dnsStrategyName"
|
||||
jdbcType="VARCHAR" />
|
||||
<result column="do_log" property="doLog" jdbcType="INTEGER" />
|
||||
<result column="user_region1" property="userRegion1" jdbcType="VARCHAR" />
|
||||
<result column="user_region2" property="userRegion2" jdbcType="VARCHAR" />
|
||||
<result column="user_region3" property="userRegion3" jdbcType="VARCHAR" />
|
||||
<result column="user_region4" property="userRegion4" jdbcType="VARCHAR" />
|
||||
<result column="user_region5" property="userRegion5" jdbcType="VARCHAR" />
|
||||
<result column="source_compile_id" property="sourceCompileId" jdbcType="INTEGER" />
|
||||
<result column="cancel_request_id" property="cancelRequestId" jdbcType="INTEGER" />
|
||||
<result column="source_compile_id" property="sourceCompileId"
|
||||
jdbcType="INTEGER" />
|
||||
<result column="cancel_request_id" property="cancelRequestId"
|
||||
jdbcType="INTEGER" />
|
||||
<result column="do_blacklist" property="doBlackList" jdbcType="INTEGER" />
|
||||
</resultMap>
|
||||
<resultMap id="stringCfgMap" type="com.nis.domain.configuration.BaseStringCfg" >
|
||||
<resultMap id="stringCfgMap" type="com.nis.domain.configuration.BaseStringCfg">
|
||||
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
|
||||
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
|
||||
<result column="cfg_keywords" property="cfgKeywords" jdbcType="VARCHAR" />
|
||||
@@ -52,19 +58,22 @@
|
||||
<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="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="expr_type " property="exprType" jdbcType="INTEGER" />
|
||||
<result column="match_method" property="matchMethod" jdbcType="INTEGER" />
|
||||
<result column="is_hexbin" property="isHexbin" jdbcType="INTEGER" />
|
||||
<result column="area_effective_ids" property="areaEffectiveIds" 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_region_code" property="cfgRegionCode"
|
||||
jdbcType="INTEGER" />
|
||||
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
|
||||
</resultMap>
|
||||
<resultMap id="dnsKeywordCfgMap" type="com.nis.domain.configuration.DnsKeywordCfg" >
|
||||
<resultMap id="dnsKeywordCfgMap" type="com.nis.domain.configuration.DnsKeywordCfg">
|
||||
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
|
||||
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
|
||||
<result column="cfg_keywords" property="cfgKeywords" jdbcType="VARCHAR" />
|
||||
@@ -82,19 +91,22 @@
|
||||
<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="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="expr_type " property="exprType" jdbcType="INTEGER" />
|
||||
<result column="match_method" property="matchMethod" jdbcType="INTEGER" />
|
||||
<result column="is_hexbin" property="isHexbin" jdbcType="INTEGER" />
|
||||
<result column="area_effective_ids" property="areaEffectiveIds" 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_region_code" property="cfgRegionCode"
|
||||
jdbcType="INTEGER" />
|
||||
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
|
||||
</resultMap>
|
||||
<sql id="configIndexColumn" >
|
||||
<sql id="configIndexColumn">
|
||||
a.CFG_ID,a.CFG_DESC,a.ACTION,a.IS_VALID,a.IS_AUDIT,
|
||||
a.CREATOR_ID,a.CREATE_TIME,a.EDITOR_ID,a.EDIT_TIME,a.AUDITOR_ID,a.AUDIT_TIME,
|
||||
a.SERVICE_ID,a.REQUEST_ID,a.COMPILE_ID,a.IS_AREA_EFFECTIVE,a.CLASSIFY,
|
||||
@@ -102,7 +114,7 @@
|
||||
a.user_region2,a.user_region3,a.user_region4,a.user_region5,a.do_log,a.source_compile_id,a.cancel_request_id,
|
||||
a.do_blacklist
|
||||
</sql>
|
||||
<sql id="ipCfgColumn" >
|
||||
<sql id="ipCfgColumn">
|
||||
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port
|
||||
,a.protocol,a.protocol_id,a.direction,a.cfg_type,a.action,a.dest_port,a.dest_ip_address
|
||||
,a.is_valid,a.is_audit,a.creator_id,a.create_time,a.editor_id
|
||||
@@ -110,27 +122,31 @@
|
||||
a.compile_id,a.is_area_effective,a.classify,a.attribute,a.lable
|
||||
,a.area_effective_ids,a.function_id,a.cfg_region_code
|
||||
</sql>
|
||||
<sql id="strCfgColumn" >
|
||||
<sql id="strCfgColumn">
|
||||
a.cfg_id,a.cfg_desc,a.cfg_keywords,a.cfg_type,
|
||||
a.action,a.is_valid,a.is_audit,a.creator_id,a.create_time,a.editor_id,a.edit_time, a.auditor_id,
|
||||
a.action,a.is_valid,a.is_audit,a.creator_id,a.create_time,a.editor_id,a.edit_time,
|
||||
a.auditor_id,
|
||||
a.audit_time,a.service_id,a.request_id,a.compile_id,a.is_area_effective,a.classify,a.attribute,a.lable,
|
||||
a.expr_type,a.match_method,a.is_hexbin,a.area_effective_ids,a.function_id,a.cfg_region_code
|
||||
</sql>
|
||||
<sql id="complexCfgColumn" >
|
||||
<sql id="complexCfgColumn">
|
||||
a.cfg_id,a.cfg_desc,a.cfg_keywords,a.cfg_type,a.district,a.user_region1,
|
||||
a.action,a.is_valid,a.is_audit,a.creator_id,a.create_time,a.editor_id,a.edit_time, a.auditor_id,
|
||||
a.audit_time,a.service_id,a.request_id,a.compile_id,a.is_area_effective,a.classify,a.attribute,a.lable,
|
||||
a.action,a.is_valid,a.is_audit,a.creator_id,a.create_time,a.editor_id,a.edit_time,
|
||||
a.auditor_id,
|
||||
a.audit_time,a.service_id,a.request_id,a.compile_id,a.region_id,a.is_area_effective,a.classify,a.attribute,a.lable,
|
||||
a.expr_type,a.match_method,a.is_hexbin,a.area_effective_ids,a.function_id,a.cfg_region_code
|
||||
</sql>
|
||||
|
||||
<!-- dns域名查询 -->
|
||||
<select id="findPage" resultMap="dnsKeywordCfgMap" parameterType="com.nis.domain.configuration.DnsKeywordCfg">
|
||||
<select id="findPage" resultMap="dnsKeywordCfgMap"
|
||||
parameterType="com.nis.domain.configuration.DnsKeywordCfg">
|
||||
SELECT
|
||||
<include refid="complexCfgColumn" />
|
||||
,s.name as creator_name,e.name as editor_name,u.name as auditor_name
|
||||
FROM dns_domain_cfg a
|
||||
left join sys_user s on a.creator_id=s.id
|
||||
left join sys_user e on a.editor_id=e.id
|
||||
left join sys_user e on
|
||||
a.editor_id=e.id
|
||||
left join sys_user u on a.auditor_id=u.id
|
||||
where service_id=-2 and function_id=#{functionId}
|
||||
<if test="cfgType != null and cfgType != ''">
|
||||
@@ -147,7 +163,19 @@
|
||||
select
|
||||
<include refid="complexCfgColumn"></include>
|
||||
from dns_domain_cfg a
|
||||
where a.cfg_id in (${ids}) and is_valid !=-1
|
||||
where a.cfg_id in (${ids}) and a.is_valid !=-1
|
||||
</select>
|
||||
<!-- 查询审核通过的域配置数量 -->
|
||||
<select id="hasValidDnsKeyword" resultType="java.lang.Integer">
|
||||
select count(1) from
|
||||
dns_domain_cfg where is_valid=1 and is_audit=1 and
|
||||
user_region1=#{groupId}
|
||||
</select>
|
||||
<!-- 查询引用dns组的maat配置数量 -->
|
||||
<select id="hasDnsMaatPz" resultType="java.lang.Integer">
|
||||
select count(1) from
|
||||
dns_domain_cfg where is_valid=1 and is_audit=1 and
|
||||
user_region1=#{groupId}
|
||||
</select>
|
||||
<update id="updateCfgValid" parameterType="com.nis.domain.configuration.BaseCfg">
|
||||
update ${tableName} set is_valid = #{isValid,jdbcType=INTEGER},
|
||||
@@ -170,7 +198,7 @@
|
||||
update ${tableName} set is_audit = #{isAudit,jdbcType=INTEGER},
|
||||
auditor_id = #{auditorId,jdbcType=INTEGER},
|
||||
audit_time = #{auditTime,jdbcType=TIMESTAMP}
|
||||
<if test="isValid != null" >
|
||||
<if test="isValid != null">
|
||||
,is_valid = #{isValid,jdbcType=INTEGER}
|
||||
</if>
|
||||
<trim prefix="WHERE" prefixOverrides="AND |OR ">
|
||||
@@ -185,7 +213,7 @@
|
||||
|
||||
</update>
|
||||
<!-- insert dns_domain_cfg表信息 -->
|
||||
<insert id="saveDnsKeywordsCfg" parameterType="com.nis.domain.configuration.DnsKeywordCfg" >
|
||||
<insert id="saveDnsKeywordsCfg" parameterType="com.nis.domain.configuration.DnsKeywordCfg">
|
||||
insert into dns_domain_cfg (
|
||||
CFG_DESC,
|
||||
ACTION,
|
||||
@@ -200,6 +228,7 @@
|
||||
SERVICE_ID,
|
||||
REQUEST_ID,
|
||||
COMPILE_ID,
|
||||
REGION_ID,
|
||||
IS_AREA_EFFECTIVE,
|
||||
CLASSIFY,
|
||||
ATTRIBUTE,
|
||||
@@ -228,6 +257,7 @@
|
||||
#{serviceId,jdbcType=INTEGER},
|
||||
#{requestId,jdbcType=INTEGER},
|
||||
#{compileId,jdbcType=INTEGER},
|
||||
#{regionId,jdbcType=INTEGER},
|
||||
#{isAreaEffective,jdbcType=INTEGER},
|
||||
#{classify,jdbcType=VARCHAR},
|
||||
#{attribute,jdbcType=VARCHAR},
|
||||
@@ -246,88 +276,89 @@
|
||||
</insert>
|
||||
<!-- 删除dns公共组域名配置 -->
|
||||
<delete id="deleteDnsDomainCfg">
|
||||
delete from dns_domain_cfg where compile_id=#{compileId} and function_id=#{functionId}
|
||||
delete from dns_domain_cfg where compile_id=#{compileId} and
|
||||
function_id=#{functionId}
|
||||
</delete>
|
||||
<delete id="delete" parameterType="java.lang.String" >
|
||||
<delete id="delete" parameterType="java.lang.String">
|
||||
delete from dns_domain_cfg where cfg_id in (${ids})
|
||||
</delete>
|
||||
<update id="update" parameterType="com.nis.domain.configuration.DnsKeywordCfg" >
|
||||
<update id="update" parameterType="com.nis.domain.configuration.DnsKeywordCfg">
|
||||
update dns_domain_cfg
|
||||
<set >
|
||||
<set>
|
||||
<trim suffixOverrides=",">
|
||||
<if test="cfgDesc != null and cfgDesc != ''" >
|
||||
<if test="cfgDesc != null and cfgDesc != ''">
|
||||
cfg_desc = #{cfgDesc,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="action != null" >
|
||||
<if test="action != null">
|
||||
action = #{action,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="isValid != null" >
|
||||
<if test="isValid != null">
|
||||
is_valid = #{isValid,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="isAudit != null" >
|
||||
<if test="isAudit != null">
|
||||
is_audit = #{isAudit,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="editorId != null" >
|
||||
<if test="editorId != null">
|
||||
editor_id = #{editorId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="editTime != null and editTime != ''" >
|
||||
<if test="editTime != null and editTime != ''">
|
||||
edit_time = #{editTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="auditorId != null" >
|
||||
<if test="auditorId != null">
|
||||
AUDITOR_ID = #{auditorId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="auditTime != null and auditTime != ''" >
|
||||
<if test="auditTime != null and auditTime != ''">
|
||||
AUDIT_TIME = #{auditTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="serviceId != null" >
|
||||
<if test="serviceId != null">
|
||||
service_id = #{serviceId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="requestId != null" >
|
||||
<if test="requestId != null">
|
||||
request_id = #{requestId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="isAreaEffective != null" >
|
||||
<if test="isAreaEffective != null">
|
||||
is_area_effective = #{isAreaEffective,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="classify != null and classify != ''" >
|
||||
<if test="classify != null and classify != ''">
|
||||
classify = #{classify,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="attribute != null and attribute != ''" >
|
||||
<if test="attribute != null and attribute != ''">
|
||||
attribute = #{attribute,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="lable != null and lable != ''" >
|
||||
<if test="lable != null and lable != ''">
|
||||
lable = #{lable,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="areaEffectiveIds != null" >
|
||||
<if test="areaEffectiveIds != null">
|
||||
area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="functionId != null" >
|
||||
<if test="functionId != null">
|
||||
function_id = #{functionId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="district != null" >
|
||||
<if test="district != null">
|
||||
district = #{district,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="cfgKeywords != null and cfgKeywords != ''" >
|
||||
<if test="cfgKeywords != null and cfgKeywords != ''">
|
||||
cfg_keywords = #{cfgKeywords,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="cfgType != null" >
|
||||
<if test="cfgType != null">
|
||||
cfg_type = #{cfgType,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="cfgRegionCode != null" >
|
||||
<if test="cfgRegionCode != null">
|
||||
cfg_region_code = #{cfgRegionCode,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="exprType != null and exprType != ''" >
|
||||
<if test="exprType != null and exprType != ''">
|
||||
expr_type = #{exprType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="matchMethod != null" >
|
||||
<if test="matchMethod != null">
|
||||
match_method = #{matchMethod,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="isHexbin != null" >
|
||||
<if test="isHexbin != null">
|
||||
is_hexbin = #{isHexbin,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="userRegion1 != null and userRegion1 != ''" >
|
||||
<if test="userRegion1 != null and userRegion1 != ''">
|
||||
user_region1 = #{userRegion1,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="compileId != null and compileId != ''" >
|
||||
<if test="compileId != null and compileId != ''">
|
||||
compile_id = #{compileId,jdbcType=INTEGER},
|
||||
</if>
|
||||
</trim>
|
||||
|
||||
@@ -14,6 +14,9 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import javax.ws.rs.client.Entity;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
import org.apache.ibatis.session.ExecutorType;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
@@ -66,6 +69,7 @@ import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.configuration.DdosIpCfg;
|
||||
import com.nis.domain.configuration.DnsIpCfg;
|
||||
import com.nis.domain.configuration.DnsKeywordCfg;
|
||||
import com.nis.domain.configuration.DnsResStrategy;
|
||||
import com.nis.domain.configuration.FileDigestCfg;
|
||||
import com.nis.domain.configuration.IpReusePolicyCfg;
|
||||
@@ -2954,6 +2958,63 @@ public abstract class BaseService {
|
||||
logger.warn("asnIPRegionSendToMaat finish,cost:"+(end-start));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @Description: 公共组域配置 下发 修改 删除
|
||||
* @author(zdx)
|
||||
* @date 2019年2月19日 上午11:37:37
|
||||
* @param regionList
|
||||
* @param action
|
||||
*/
|
||||
public void commonGroupRegionSendToMaat(List<?> regionList,Integer action) {
|
||||
logger.warn("commonGroupRegionSendToMaat start");
|
||||
long start=System.currentTimeMillis();
|
||||
GroupReuseAddBean maatBean = new GroupReuseAddBean();
|
||||
List<GroupReuseCfg> groupReuseList=new ArrayList<>();
|
||||
GroupReuseCfg groupReuseCfg=new GroupReuseCfg();
|
||||
List<IpCfg> ipRegionList = new ArrayList<>();
|
||||
List<StringCfg> strRegionList = new ArrayList<>();
|
||||
List<NumBoundaryCfg> numRegionList = new ArrayList<>();
|
||||
if (!StringUtil.isEmpty(regionList)&®ionList.get(0) instanceof BaseIpCfg) {
|
||||
ipRegionList = (List<IpCfg>) regionList;
|
||||
}
|
||||
if (!StringUtil.isEmpty(regionList)&®ionList.get(0) instanceof StringCfg) {
|
||||
strRegionList = (List<StringCfg>) regionList;
|
||||
}
|
||||
if (!StringUtil.isEmpty(regionList)&®ionList.get(0) instanceof NumBoundaryCfg) {
|
||||
numRegionList = (List<NumBoundaryCfg>) regionList;
|
||||
}
|
||||
groupReuseCfg.setIpRegionList(ipRegionList);
|
||||
groupReuseCfg.setStrRegionList(strRegionList);
|
||||
groupReuseCfg.setNumRegionList(numRegionList);
|
||||
groupReuseList.add(groupReuseCfg);
|
||||
maatBean.setGroupReuseCfgList(groupReuseList);
|
||||
maatBean.setAuditTime(new Date());
|
||||
maatBean.setCreatorName(UserUtils.getUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
//公共组域删除接口的访问方式为PUT,所以在配置取消时 应该把opAction设置为2;
|
||||
maatBean.setOpAction(Constants.OPACTION_DELETE==Integer.valueOf(action)?Constants.OPACTION_PUT:action);
|
||||
//调用服务接口下发配置数据
|
||||
String json=gsonToJson(maatBean);
|
||||
String optionStr = "添加";
|
||||
if(action.equals(Constants.OPACTION_PUT)){
|
||||
optionStr = "修改";
|
||||
}
|
||||
if(action.equals(Constants.OPACTION_DELETE)){
|
||||
optionStr = "删除";
|
||||
}
|
||||
if(regionList.size()<=100) {
|
||||
logger.info("公共组域配置 "+optionStr+"操作,参数:"+json);
|
||||
}else {
|
||||
logger.info("公共组域配置"+optionStr+"操作数据条数:"+regionList.size());
|
||||
}
|
||||
//调用服务接口下发配置
|
||||
ToMaatResult result =ConfigServiceUtil.auditCommonGroupRegionSources(json,action);
|
||||
//logger.info("asn ip复用域 "+action+" 配置响应信息:"+result.getMsg());
|
||||
logger.info("公共组域配置 "+optionStr+"操作,响应信息:");
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("commonGroupRegionSendToMaat finish,cost:"+(end-start));
|
||||
}
|
||||
/**
|
||||
* ASN关键字配置处理
|
||||
* @param asnList
|
||||
|
||||
@@ -5,8 +5,6 @@ import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.ibatis.session.ExecutorType;
|
||||
@@ -17,28 +15,16 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.beust.jcommander.internal.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.AsnGroupInfo;
|
||||
import com.nis.domain.basics.AsnIpCfg;
|
||||
import com.nis.domain.basics.PolicyGroupInfo;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.configuration.DnsKeywordCfg;
|
||||
import com.nis.domain.maat.GroupReuseAddBean;
|
||||
import com.nis.domain.maat.GroupReuseCfg;
|
||||
import com.nis.domain.maat.MaatCfg;
|
||||
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.domain.maat.ToMaatBean;
|
||||
import com.nis.domain.maat.ToMaatResult;
|
||||
import com.nis.domain.specific.ConfigGroupInfo;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.StringUtil;
|
||||
@@ -77,7 +63,7 @@ public class DnsKeywordCfgService extends CrudService<CrudDao<DnsKeywordCfg>, Dn
|
||||
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r"));
|
||||
entity.setPage(page);
|
||||
List<DnsKeywordCfg> list=dnsKeywordCfgDao.findPage(entity);
|
||||
List<PolicyGroupInfo> policyGroupInfos = policyGroupInfoDao.findPolicyGroupInfosByTypeForUD(12,1);
|
||||
List<PolicyGroupInfo> policyGroupInfos = policyGroupInfoDao.findPolicyGroupInfosByTypeForUD(12,null);
|
||||
Map<String, String> policyGroupMap = new HashMap<String, String>();
|
||||
for (PolicyGroupInfo policyGroupInfo : policyGroupInfos) {
|
||||
if (!StringUtil.isEmpty(policyGroupInfo.getServiceGroupId())) {
|
||||
@@ -159,12 +145,15 @@ public class DnsKeywordCfgService extends CrudService<CrudDao<DnsKeywordCfg>, Dn
|
||||
entity.setCreateTime(new Date());
|
||||
entity.setCreatorId(entity.getCurrentUser().getId());
|
||||
if (!StringUtil.isEmpty(entity.getDomainList())) {
|
||||
for(ComplexkeywordCfg cfg:entity.getDomainList()){
|
||||
List<Integer> regionIdList = ConfigServiceUtil.getId(3, entity.getDomainList().size());
|
||||
for (int i = 0; i < entity.getDomainList().size(); i++) {
|
||||
ComplexkeywordCfg cfg = entity.getDomainList().get(i);
|
||||
if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
|
||||
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
|
||||
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode"});
|
||||
if(StringUtils.isNoneBlank(cfg.getDistrictShowName()) && cfg.getDistrict().equals("others")){
|
||||
cfg.setDistrict(cfg.getDistrictShowName());
|
||||
}
|
||||
cfg.setRegionId(regionIdList.get(i));
|
||||
dnsKeywordCfgDao.saveDnsKeywordsCfg(cfg);
|
||||
}
|
||||
}
|
||||
@@ -197,6 +186,74 @@ public class DnsKeywordCfgService extends CrudService<CrudDao<DnsKeywordCfg>, Dn
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @Description:Dns 关键字公共组配置审核功能
|
||||
* @author(zdx)
|
||||
* @date 2019年2月21日 下午6:44:11
|
||||
* @param infoList
|
||||
* @param serviceGroupId
|
||||
* @param isValid
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void auditDnsKeywordBatch(List<DnsKeywordCfg> infoList,Long serviceGroupId,Integer isAudit,Integer isValid) {
|
||||
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||
final SqlSession batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
try{
|
||||
if(!StringUtil.isEmpty(infoList)){
|
||||
List regionList = new ArrayList();
|
||||
for(int index = 0; index < infoList.size();index++){
|
||||
DnsKeywordCfg t = infoList.get(index);
|
||||
BaseStringCfg baseStrCfg=new BaseStringCfg();
|
||||
StringCfg strCfg = new StringCfg();
|
||||
BeanUtils.copyProperties(t, baseStrCfg);
|
||||
BeanUtils.copyProperties(t, strCfg);
|
||||
strCfg.setGroupId(Integer.valueOf(t.getUserRegion1()));
|
||||
baseStrCfg.setTableName(DnsKeywordCfg.getTablename());
|
||||
regionList.add(strCfg);
|
||||
((StringCfgDao) batchSqlSession.getMapper(StringCfgDao.class)).audit(baseStrCfg);
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
if (isAudit!=Constants.AUDIT_NO) {//审核未通过 跳过
|
||||
PolicyGroupInfo dnsGroupInfo = null;
|
||||
List<PolicyGroupInfo> dnsGroupInfoList=policyGroupInfoDao.getInfoByServiceGroupId(serviceGroupId);
|
||||
if (!StringUtil.isEmpty(dnsGroupInfoList)) {
|
||||
dnsGroupInfo = dnsGroupInfoList.get(0);
|
||||
}
|
||||
List<IpCfg> ipRegionList = new ArrayList();
|
||||
List<StringCfg> strRegionList = new ArrayList();
|
||||
List<NumBoundaryCfg> numRegionList = new ArrayList();
|
||||
if(isValid==Constants.VALID_YES) {//审核通过
|
||||
if (Integer.valueOf(dnsGroupInfo.getUdFlag())==0) {
|
||||
dnsGroupInfo.setEditorId(UserUtils.getUser().getId());
|
||||
dnsGroupInfo.setEditTime(new Date());
|
||||
dnsGroupInfo.setUdFlag(1);
|
||||
policyGroupInfoDao.updateUdFlag(dnsGroupInfo);
|
||||
}
|
||||
commonGroupRegionSendToMaat(regionList,Constants.OPACTION_POST);
|
||||
}else if(isValid==Constants.VALID_NO) {//取消审核通过
|
||||
|
||||
//如果一个dns组下没有域了,需要把policy的udFlag设置为0(如果还有dns配置未取消提示需要先取消配置才能取消最后一个域)
|
||||
if(!hasValidDnsKeyword(serviceGroupId)) {
|
||||
//需要先判断是否有生效配置引用该组
|
||||
dnsGroupInfo.setEditorId(UserUtils.getUser().getId());
|
||||
dnsGroupInfo.setEditTime(new Date());
|
||||
dnsGroupInfo.setUdFlag(0);
|
||||
policyGroupInfoDao.updateUdFlag(dnsGroupInfo);
|
||||
}
|
||||
commonGroupRegionSendToMaat(regionList,Constants.OPACTION_DELETE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
batchSqlSession.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
public boolean hasValidDnsKeyword(Long maatGroupId) {
|
||||
return dnsKeywordCfgDao.hasValidDnsKeyword(maatGroupId)>0;
|
||||
}
|
||||
public List<DnsKeywordCfg> getByIds(String ids) {
|
||||
if(ids==null) {
|
||||
throw new RuntimeException("ids is null!");
|
||||
|
||||
@@ -157,7 +157,7 @@
|
||||
</div>
|
||||
|
||||
<shiro:hasPermission name="dns:keyword:config">
|
||||
<div class="btn-group hidden">
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
||||
<i class="fa fa-wrench"></i> <spring:message code="examine"></spring:message>
|
||||
<i class="fa fa-angle-down"></i>
|
||||
|
||||
Reference in New Issue
Block a user