增加APP策略,APP多域特征的批量下发数据处理逻辑

This commit is contained in:
zhangwei
2018-11-28 19:58:34 +08:00
parent 1fbc899269
commit 3983ad4658
3 changed files with 990 additions and 60 deletions

View File

@@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mappea.dtd" >
<mapper namespace="com.nis.web.dao.configuration.ConfigSynchronizationDao" >
<!-- <resultMap id="AppPolicyCfgMap" type="com.nis.domain.configuration.AppPolicyCfg" >
<resultMap id="AppPolicyCfgMap" type="com.nis.domain.configuration.AppPolicyCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="spec_service_id" property="specServiceId" jdbcType="INTEGER" />
<result column="app_code" property="appCode" jdbcType="INTEGER" />
@@ -37,6 +37,41 @@
<result column="user_region5" property="userRegion5" jdbcType="VARCHAR" />
<result column="do_log" property="doLog" jdbcType="INTEGER" />
</resultMap>
<resultMap id="AppFeatureIndexMap" type="com.nis.domain.configuration.AppFeatureIndex" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<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="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="spec_service_id" property="specServiceId" jdbcType="INTEGER" />
<result column="app_code" property="appCode" jdbcType="INTEGER" />
<result column="behav_code" property="behavCode" jdbcType="INTEGER" />
<result column="cfg_region_type" property="cfgRegionType" jdbcType="VARCHAR" />
<result column="cfg_region_value" property="cfgRegionValue" jdbcType="VARCHAR" />
<result column="cfg_region_code" property="cfgRegionCode1" jdbcType="VARCHAR" />
</resultMap>
<!--
<resultMap id="AppIpCfgMap" type="com.nis.domain.configuration.AppIpCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
@@ -402,6 +437,9 @@
<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="spec_service_id" property="specServiceId" jdbcType="INTEGER" />
<result column="app_code" property="appCode" jdbcType="INTEGER" />
<result column="behav_code" property="behavCode" jdbcType="INTEGER" />
</resultMap>
<resultMap id="complexCfgMap" type="com.nis.domain.configuration.ComplexkeywordCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
@@ -432,6 +470,9 @@
<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="spec_service_id" property="specServiceId" jdbcType="INTEGER" />
<result column="app_code" property="appCode" jdbcType="INTEGER" />
<result column="behav_code" property="behavCode" jdbcType="INTEGER" />
</resultMap>
<resultMap id="digestCfgMap" type="com.nis.domain.configuration.FileDigestCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
@@ -712,11 +753,11 @@
a.user_region1
</sql>
<sql id="StrCfg_Column" >
a.cfg_desc,a.cfg_keywords,a.cfg_type,
a.cfg_keywords,a.cfg_type,
a.expr_type,a.match_method,a.is_hexbin,a.compile_id
</sql>
<sql id="ComplexCfg_Column" >
a.cfg_desc,a.cfg_keywords,a.district,a.cfg_type,
a.cfg_keywords,a.district,a.cfg_type,
a.expr_type,a.match_method,a.is_hexbin,a.compile_id
</sql>
<sql id="DigestCfg_Column" >
@@ -795,10 +836,7 @@
a.compile_id,a.is_area_effective,a.classify,a.attribute,a.lable
,a.area_effective_ids,a.function_id,a.cfg_region_code,a.dns_strategy_id
</sql>
<!-- <sql id="WebsiteDomainTopic_Column">
id,website_service_id websiteServiceId,domain,topic_id topicId,create_time createTime,creator_id creatorId,is_valid isValid
</sql>
<sql id="AppPolicyCfg_Column" >
<sql id="AppPolicyCfg_Column" >
a.CFG_ID, a.APP_CODE,a.BEHAV_CODE,a.SPEC_SERVICE_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,
@@ -806,6 +844,22 @@
a.CFG_TYPE,a.CFG_REGION_CODE,a.EXPR_TYPE,a.MATCH_METHOD,a.IS_HEXBIN,a.USER_REGION1,a.USER_REGION2,
a.USER_REGION3,a.USER_REGION4,a.USER_REGION5,a.DO_LOG
</sql>
<sql id="AppFeatureIndex_Column" >
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,
a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id,a.CFG_REGION_TYPE,a.CFG_REGION_VALUE,a.user_region1,
a.user_region2,a.user_region3,a.user_region4,a.user_region5,a.do_log,a.feature_table,
a.feature_table_type,a.app_code,a.spec_service_id,a.cfg_region_code
</sql>
<sql id="AppIpCfg_Column" >
a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port
,a.protocol,a.direction,a.dest_port,a.dest_ip_address,a.cfg_type,a.compile_id
</sql>
<!-- <sql id="WebsiteDomainTopic_Column">
id,website_service_id websiteServiceId,domain,topic_id topicId,create_time createTime,creator_id creatorId,is_valid isValid
</sql>
<sql id="AppIpCfg_Column" >
a.CFG_ID, a.APP_CODE,a.BEHAV_CODE,a.SPEC_SERVICE_ID, a.CFG_DESC,a.ACTION,a.IS_VALID,a.IS_AUDIT,
@@ -837,7 +891,52 @@
a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.RATELIMIT,a.FUNCTION_ID,a.CFG_TYPE,a.CFG_REGION_CODE,
a.BYTES,a.EXPR_TYPE,a.MATCH_METHOD,a.IS_HEXBIN,a.DO_LOG
</sql> -->
<select id="getAppPolicyList" resultMap="AppPolicyCfgMap" parameterType="com.nis.domain.configuration.AppPolicyCfg" >
select
<include refid="AppPolicyCfg_Column"/>
<trim prefix="," prefixOverrides=",">
, s.name as creator_name,u.name as auditor_name
</trim>
from app_policy_cfg a
left join sys_user s on a.creator_id=s.id
left join sys_user u on a.auditor_id=u.id
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="serviceId != null">
AND a.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="functionId != null">
AND a.function_id=#{functionId,jdbcType=INTEGER}
</if>
<if test="action != null">
AND a.action=#{action,jdbcType=INTEGER}
</if>
and a.is_valid=#{isValid} and a.is_audit=#{isAudit} and a.is_valid!=-1
</trim>
ORDER BY a.CFG_ID
</select>
<select id="getAppFeatureIndexList" resultMap="AppFeatureIndexMap">
select
<include refid="AppFeatureIndex_Column"/>
<trim prefix="," prefixOverrides=",">
, s.name as creator_name,u.name as auditor_name
</trim>
from app_feature_index a
left join sys_user s on a.creator_id=s.id
left join sys_user u on a.auditor_id=u.id
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="serviceId != null">
AND a.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="functionId != null">
AND a.function_id=#{functionId,jdbcType=INTEGER}
</if>
<if test="action != null">
AND a.action=#{action,jdbcType=INTEGER}
</if>
and a.is_valid=#{isValid} and a.is_audit=#{isAudit} and a.is_valid!=-1
</trim>
ORDER BY a.CFG_ID
</select>
<select id="getCfgIndexList" resultMap="CfgIndexInfoMap" parameterType="com.nis.domain.configuration.CfgIndexInfo" >
SELECT
<include refid="BaseCfg_Column" />
@@ -871,22 +970,24 @@
</select>
<select id="getIpPortList" resultMap="ipPortMap" parameterType="com.nis.domain.configuration.CfgIndexInfo">
SELECT
<include refid="IpCfg_Column" />
<include refid="IpCfg_Column" />
FROM ${tableName} a
<where>
and a.compile_id in
<foreach collection="compileIds" index="index" item="compileId" open="(" separator="," close=")">
#{compileId}
</foreach>
</where>
</select>
<select id="getAppIpPortList" resultMap="ipPortMap" parameterType="com.nis.domain.configuration.CfgIndexInfo">
SELECT
<include refid="AppIpCfg_Column" />
FROM ${tableName} a
<where>
and a.compile_id in
<foreach collection="compileIds" index="index" item="compileId" open="(" separator="," close=")">
#{compileId}
</foreach>
<!-- <if test="compileId != null">
AND a.compile_id =#{compileId}
</if>
<if test="functionId != null">
AND a.function_id =#{functionId}
</if>
<if test="serviceId!= null">
AND a.service_id =#{serviceId}
</if> -->
</where>
</select>
<select id="getAsnIpList" resultType="com.nis.domain.basics.AsnIpCfg">
@@ -1117,11 +1218,15 @@
<select id="getIpPortListByService" resultMap="ipPortMap" >
select
<include refid="BaseCfg_Column"></include>,
<include refid="IpCfg_Column"></include>
<trim prefix="," prefixOverrides=",">
,s.name as creator_name,u.name as auditor_name
<if test="serviceId=1028">
,a.app_code,a.spec_service_id,a.behav_code
</if>
</trim>
from ip_port_cfg a
from ${tableName} a
left join sys_user s on a.creator_id=s.id
left join sys_user u on a.auditor_id=u.id
<trim prefix="WHERE" prefixOverrides="AND |OR ">
@@ -1163,6 +1268,62 @@
</trim>
ORDER BY a.CFG_ID
</select>
<select id="getStrListByService" resultMap="stringCfgMap" >
select
<include refid="BaseCfg_Column"></include>,
<include refid="StrCfg_Column"></include>
<trim prefix="," prefixOverrides=",">
,s.name as creator_name,u.name as auditor_name
<if test="serviceId=1024 or serviceId=1026 or serviceId=1029">
,a.app_code,a.spec_service_id,a.behav_code
</if>
</trim>
from ${tableName} a
left join sys_user s on a.creator_id=s.id
left join sys_user u on a.auditor_id=u.id
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="serviceId != null">
AND a.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="functionId != null">
AND a.function_id=#{functionId,jdbcType=INTEGER}
</if>
<if test="action != null">
AND a.action=#{action,jdbcType=INTEGER}
</if>
and a.is_valid=#{isValid} and a.is_audit=#{isAudit}
and a.is_valid!=-1
</trim>
ORDER BY a.CFG_ID
</select>
<select id="getComplexStrListByService" resultMap="complexCfgMap" >
select
<include refid="BaseCfg_Column"></include>,
<include refid="ComplexCfg_Column"></include>
<trim prefix="," prefixOverrides=",">
,s.name as creator_name,u.name as auditor_name
<if test="serviceId=1024 or serviceId=1026 or serviceId=1029">
,a.app_code,a.spec_service_id,a.behav_code
</if>
</trim>
from ${tableName} a
left join sys_user s on a.creator_id=s.id
left join sys_user u on a.auditor_id=u.id
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="serviceId != null">
AND a.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="functionId != null">
AND a.function_id=#{functionId,jdbcType=INTEGER}
</if>
<if test="action != null">
AND a.action=#{action,jdbcType=INTEGER}
</if>
and a.is_valid=#{isValid} and a.is_audit=#{isAudit}
and a.is_valid!=-1
</trim>
ORDER BY a.CFG_ID
</select>
<!-- <select id="findAppPolicyList" resultMap="AppPolicyCfgMap" parameterType="com.nis.domain.configuration.AppPolicyCfg" >
select
<include refid="AppPolicyCfg_Column"/>