Merge branch 'develop' of https://git.mesalab.cn/K18_NTCS_WEB/NTC.git into develop

This commit is contained in:
lihaochen
2018-12-22 17:44:12 +08:00
64 changed files with 3491 additions and 2686 deletions

View File

@@ -261,18 +261,20 @@ public class BaseCfg<T> extends BaseEntity<T> implements Cloneable{
*/
@ExcelField(title="do_log",dictType="DO_LOG",sort=30)
protected Integer doLog = Constants.MAAT_CFG_DOLOG_DEFAULT;
@ExcelField(title="do_blacklist",dictType="DO_BLACKLIST",sort=31)
protected Integer doBlackList=Constants.MAAT_CFG_DOLOG_DOBLACKLIST_DEFAULT;
protected Integer groupId;//仅用于copy属性使用
protected Integer regionId;//仅用于copy属性使用
// protected Integer numberRegionGroupId;//仅用于copy属性使用
protected Integer numberRegionGroupId;//仅用于copy属性使用
protected Integer numberRegionRegionId;//仅用于copy属性使用
// public Integer getNumberRegionGroupId() {
// return numberRegionGroupId;
// }
// public void setNumberRegionGroupId(Integer numberRegionGroupId) {
// this.numberRegionGroupId = numberRegionGroupId;
// }
public Integer getNumberRegionGroupId() {
return numberRegionGroupId;
}
public void setNumberRegionGroupId(Integer numberRegionGroupId) {
this.numberRegionGroupId = numberRegionGroupId;
}
public Integer getNumberRegionRegionId() {
return numberRegionRegionId;
}
@@ -964,5 +966,11 @@ public class BaseCfg<T> extends BaseEntity<T> implements Cloneable{
public void setCancelRequestId(Integer cancelRequestId) {
this.cancelRequestId = cancelRequestId;
}
public Integer getDoBlackList() {
return doBlackList;
}
public void setDoBlackList(Integer doBlackList) {
this.doBlackList = doBlackList;
}
}

View File

@@ -69,7 +69,28 @@ public class BaseIpCfg extends BaseCfg<BaseIpCfg> {
protected Integer appCode;//仅用于copy属性使用
protected Integer behavCode;//仅用于copy属性使用
protected Integer specServiceId;//仅用于copy属性使用
protected String antiddosProtocol;//仅用于copy属性使用
protected Long bpsThreadshold;//仅用于copy属性使用
protected Long ppsThreadshold;//仅用于copy属性使用
public String getAntiddosProtocol() {
return antiddosProtocol;
}
public void setAntiddosProtocol(String antiddosProtocol) {
this.antiddosProtocol = antiddosProtocol;
}
public Long getBpsThreadshold() {
return bpsThreadshold;
}
public void setBpsThreadshold(Long bpsThreadshold) {
this.bpsThreadshold = bpsThreadshold;
}
public Long getPpsThreadshold() {
return ppsThreadshold;
}
public void setPpsThreadshold(Long ppsThreadshold) {
this.ppsThreadshold = ppsThreadshold;
}
public Integer getAppCode() {
return appCode;
}

View File

@@ -44,6 +44,14 @@ public class BaseStringCfg<T> extends BaseCfg<T> {
protected Integer behavCode;//仅用于copy属性使用
protected Integer specServiceId;//仅用于copy属性使用
protected String domain;//仅用于copy属性使用
protected Integer dnsStrategyId;//仅用作复制属性使用
public Integer getDnsStrategyId() {
return dnsStrategyId;
}
public void setDnsStrategyId(Integer dnsStrategyId) {
this.dnsStrategyId = dnsStrategyId;
}
public String getDomain() {
return domain;
}

View File

@@ -16,7 +16,7 @@ public class DnsResStrategy extends BaseCfg<DnsResStrategy> {
private static final long serialVersionUID = -2720862431960415564L;
private String indexTable="dns_res_strategy";
private Integer resGroup1Id;
@ExcelField(title="res_group_num",sort=3)
@ExcelField(title="res_group_num",sort=4)
private Integer resGroup1Num;
private Integer resGroup2Id;
private Integer resGroup2Num;
@@ -28,9 +28,9 @@ public class DnsResStrategy extends BaseCfg<DnsResStrategy> {
private Integer resGroup5Num;
private Integer minTtl;
private Integer maxTtl;
@ExcelField(title="group",sort=2)
@ExcelField(title="group",sort=3)
private String group1Name;
@ExcelField(title="min_ttl",sort=4)
@ExcelField(title="min_ttl",sort=5)
private String miTtlmax;
//仅作导入使用
private String ttl;

View File

@@ -561,6 +561,9 @@ public class MaatCfg implements Serializable {
this.areaEffectiveIds = areaEffectiveIds;
}
public Integer getDoBlackList() {
if(doBlackList==null){
doBlackList = 1;
}
return doBlackList;
}
public void setDoBlackList(Integer doBlackList) {
@@ -678,7 +681,7 @@ public class MaatCfg implements Serializable {
}
public void initDefaultValue() {
this.doLog=Constants.MAAT_CFG_DOLOG_DEFAULT;
this.doBlackList=Constants.MAAT_CFG_DOLOG_DOBLACKLIST_DEFAULT;
// this.doBlackList=Constants.MAAT_CFG_DOLOG_DOBLACKLIST_DEFAULT;
this.configPercent=Constants.MAAT_CFG_DOLOG_CONFIGPERCENT_DEFAULT;
this.configOption=Constants.MAAT_CFG_DOLOG_CONFIGOPTION_DEFAULT;
this.startTime=new Date();

View File

@@ -216,7 +216,14 @@ public class ExcelCsv {
}
if(!StringUtil.isEmpty(titleStr)){
//去掉不需要展示的header
if(!(noExportField.indexOf(","+titleStr+",") > -1)){
//去掉不需要展示的header
String noExport="";
if(noExportField.contains("&")){
noExport=noExportField.substring(0,noExportField.indexOf("&"));
}else{
noExport=noExportField;
}
if(!(noExport.indexOf(","+titleStr+",") > -1)){
//需要替换的header
boolean flag=true;
if(noExportField.contains("&")){

View File

@@ -2218,7 +2218,13 @@ public class ExportExcel {
}
if(!StringUtil.isEmpty(titleStr)){
//去掉不需要展示的header
if(!(noExportField.indexOf(","+titleStr+",") > -1)){
String noExport="";
if(noExportField.contains("&")){
noExport=noExportField.substring(0,noExportField.indexOf("&"));
}else{
noExport=noExportField;
}
if(!(noExport.indexOf(","+titleStr+",") > -1)){
//需要替换的header
boolean flag=true;
if(noExportField.contains("&")){

View File

@@ -1507,7 +1507,7 @@ public class BaseController {
List<Integer> compileIds=Lists.newArrayList();
List<Integer> regionIds=Lists.newArrayList();
List<Integer> groupIds=Lists.newArrayList();
// List<Integer> numRegionGroupIds=Lists.newArrayList();
List<Integer> numRegionGroupIds=Lists.newArrayList();
List<Integer> numRegionRegionIds=Lists.newArrayList();
if(!regionDict.getFunctionId().equals(405)) {//app ip compileId 从config_group_info中取
try {
@@ -1517,7 +1517,7 @@ public class BaseController {
regionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
//需要获取数值域的id
if(serviceDict!=null&&serviceDict.getProtocolId()!=null&&serviceDict.getProtocolId()>0) {
// numRegionGroupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
numRegionGroupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
numRegionRegionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
}
}
@@ -1558,9 +1558,9 @@ public class BaseController {
cfg.setRegionId(regionIds.get(ind));
}
if(serviceDict!=null&&serviceDict.getProtocolId()!=null) {
// if(numRegionGroupIds!=null&&numRegionGroupIds.size()==_ipPortCfgs.size()) {
// cfg.setNumberRegionGroupId(numRegionGroupIds.get(ind));
// }
if(numRegionGroupIds!=null&&numRegionGroupIds.size()==_ipPortCfgs.size()) {
cfg.setNumberRegionGroupId(numRegionGroupIds.get(ind));
}
if(numRegionRegionIds!=null&&numRegionRegionIds.size()==_ipPortCfgs.size()) {
cfg.setNumberRegionRegionId(numRegionRegionIds.get(ind));
}
@@ -1758,8 +1758,14 @@ public class BaseController {
while(!complexkeywordCfgs.isEmpty()) {
complexkeywordCfgs.drainTo(_complexkeywordCfgs, Constants.MAAT_JSON_SEND_SIZE);
List<Integer> compileIds=Lists.newArrayList();
List<Integer> groupIds=Lists.newArrayList();
List<Integer> regionIds=Lists.newArrayList();
try {
compileIds = ConfigServiceUtil.getId(1,_complexkeywordCfgs.size());
if(isSend.equals("1")) {
groupIds = ConfigServiceUtil.getId(2,_complexkeywordCfgs.size());
regionIds = ConfigServiceUtil.getId(3,_complexkeywordCfgs.size());
}
} catch (Exception e) {
e.printStackTrace();
logger.info("获取编译ID出错");
@@ -1776,8 +1782,23 @@ public class BaseController {
cfg.setCreatorId(UserUtils.getUser().getId());
cfg.setDoLog(2);
cfg.setFunctionId(regionDict.getFunctionId());
cfg.setIsAudit(0);
cfg.setIsValid(0);
if(isSend.equals("1")) {
cfg.setIsAudit(Constants.AUDIT_YES);
cfg.setIsValid(Constants.VALID_YES);
cfg.setAuditorId(UserUtils.getUser().getId());
cfg.setAuditTime(date);
if(groupIds!=null&&groupIds.size()==_complexkeywordCfgs.size()) {
cfg.setGroupId(groupIds.get(ind));
}
if(regionIds!=null&&regionIds.size()==_complexkeywordCfgs.size()) {
cfg.setRegionId(regionIds.get(ind));
}
}else {
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
cfg.setIsValid(Constants.VALID_NO);
}
//cfg.setIsAudit(0);
//cfg.setIsValid(0);
cfg.setIsAreaEffective(0);
cfg.setLable("0");
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);

View File

@@ -333,13 +333,13 @@ public class InterceptController extends CommonController {
dataMap.put("PXY_INTERCEPT_IP", ipList);
dataMap.put("PXY_INTERCEPT_PKT_BIN", pktBinList);
} else if (entity.getFunctionId() == 200) {// IP拦截
cfgIndexInfoNoExport = ",policy_name,group_name,userregion3,userregion4,userregion5,&userregion2:ratelimit-userregion1:certificate-";
cfgIndexInfoNoExport = ",policy_name,group_name,userregion3,userregion4,userregion5,userregion2,&userregion1:intercept_file_strategy-";
titleList.add("PXY_INTERCEPT_IP");
classMap.put("PXY_INTERCEPT_IP", IpPortCfg.class);
noExportMap.put("PXY_INTERCEPT_IP", ipPortInfoNoExport);
dataMap.put("PXY_INTERCEPT_IP", ipList);
} else if (entity.getFunctionId() == 201) {// 域名拦截
cfgIndexInfoNoExport = ",policy_name,group_name,userregion3,userregion4,&userregion2:ratelimit-userregion1:certificate-userregion5:intercept_intensity-";
cfgIndexInfoNoExport = ",policy_name,group_name,userregion3,userregion4,&userregion2:ratelimit-userregion1:intercept_file_strategy-userregion5:intercept_intensity-";
titleList.add("NTC_HTTP_URL");
classMap.put("NTC_HTTP_URL", HttpUrlCfg.class);
noExportMap.put("NTC_HTTP_URL", httpUrlCfgNoExport);
@@ -357,6 +357,10 @@ public class InterceptController extends CommonController {
if (entity.getSearch_audit_time_start() == null && entity.getSearch_audit_time_end() == null) {
cfgIndexInfoNoExport = ",audit_time" + cfgIndexInfoNoExport;
}
if (!StringUtil.isEmpty(entity.gethColumns())) {
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
}
noExportMap.put(entity.getMenuNameCode(), cfgIndexInfoNoExport);
/* } */

View File

@@ -301,12 +301,19 @@ public class TrafficStatisticsInfoController extends BaseController {
*/
@RequestMapping(value="protocolList")
@ResponseBody
public List protocolList(Model model,@RequestParam(required=false)String beginDate,@RequestParam(required=false)String endDate){
public List protocolList(Model model,Integer[] protoType,@RequestParam(required=false)String beginDate,@RequestParam(required=false)String endDate){
Map<String, Object> fromJsonList = new HashMap<String, Object>();
List list = new ArrayList();
String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_PROTOCOL_LIST;
try {
url=urlAddDate(url,beginDate,endDate);
if(protoType!=null){
for (Integer dom : protoType) {
if(dom!=null){
url=url+"&protoType="+dom;
}
}
}
String string = HttpClientUtil.get(url);
Gson gson = new GsonBuilder().create();
fromJsonList = gson.fromJson(string, new TypeToken<Map>(){}.getType());
@@ -372,14 +379,18 @@ public class TrafficStatisticsInfoController extends BaseController {
*/
@RequestMapping(value="appList")
@ResponseBody
public List appList(@RequestParam(value="appType",required=false)Integer appType,@RequestParam(value="beginDate",required=false)String beginDate,@RequestParam(value="endDate",required=false)String endDate){
public List appList(@RequestParam(value="appType",required=false)Integer[] appType,@RequestParam(value="beginDate",required=false)String beginDate,@RequestParam(value="endDate",required=false)String endDate){
Map<String, Object> fromJsonList = new HashMap<String, Object>();
List list = new ArrayList();
String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_APP_LIST;
try {
url=urlAddDate(url,beginDate,endDate);
if(!StringUtil.isEmpty(appType)){
url=url+"&appType="+appType;
if(appType!=null){
for (Integer dom : appType) {
if(dom!=null){
url=url+"&appType="+dom;
}
}
}
String string = HttpClientUtil.get(url);
Gson gson = new GsonBuilder().create();

View File

@@ -42,9 +42,14 @@ public class DynamicIndexController extends BaseController {
public String dynamicIndex(HttpServletRequest request){
String serviceIds = request.getParameter("sid");
String baseNum = request.getParameter("baseNum");
Object trafficAreaStat = trafficAreaStat(null, Integer.parseInt(baseNum));
Object dropStat = dropStat(null, Integer.parseInt(baseNum));
Object logStat = logStat(null, serviceIds, Integer.parseInt(baseNum));
String hourStr = request.getParameter("hour");
Integer hour = null;
if(hourStr!=null &&!"".equals(hourStr)){
hour = Integer.parseInt(hourStr);
}
Object trafficAreaStat = trafficAreaStat(hour, Integer.parseInt(baseNum));
Object dropStat = dropStat(hour, Integer.parseInt(baseNum));
Object logStat = logStat(hour, serviceIds, Integer.parseInt(baseNum));
Gson gson = new GsonBuilder().create();
String trafficJson = gson.toJson(trafficAreaStat);
String dropJson = gson.toJson(dropStat);
@@ -93,12 +98,12 @@ public class DynamicIndexController extends BaseController {
List<Map> results = new ArrayList<>();
if (hour == null || hour <= 0) {
hour = 24;
hour = 1;
}
Date now = new Date();
Date start = new Date(now.getTime()-(hour*60*60*1000));
Date start = new Date(now.getTime()-(hour*60*60*1000)-(5*60*1000));
now = new Date(now.getTime()-5*60*1000);
String nowString = DateUtils.formatDate(now, "yyyy-MM-dd HH:mm:ss");
String startString = DateUtils.formatDate(start, "yyyy-MM-dd HH:mm:ss");
/*nowString = "2018-12-05 00:00:00";

View File

@@ -130,7 +130,7 @@ public class OpenVpnLogController extends BaseController{
}else{
hColumns+=",";
}
String cfgIndexInfoNoExport=",cfg_id,action,"+hColumns;
String cfgIndexInfoNoExport=","+hColumns;
noExportMap.put("spoofing_ip_policy",cfgIndexInfoNoExport);
dataMap.put("spoofing_ip_policy",list);
String timeRange= initLogMap(log,"spoofing_ip_policy");

View File

@@ -28,6 +28,7 @@
<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="do_blacklist" property="doBlackList" jdbcType="INTEGER" />
</resultMap>
<sql id="ConfigIndex_Column" >
@@ -35,7 +36,7 @@
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.user_region1,
r.user_region2,r.user_region3,r.user_region4,r.user_region5,r.do_log
r.user_region2,r.user_region3,r.user_region4,r.user_region5,r.do_log,r.do_blacklist
</sql>
<select id="findPage" resultMap="CfgIndexInfoMap">
@@ -172,7 +173,8 @@
user_region3,
user_region4,
user_region5,
do_log
do_log,
do_blacklist
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
@@ -199,7 +201,8 @@
#{userRegion3,jdbcType=VARCHAR},
#{userRegion4,jdbcType=VARCHAR},
#{userRegion5,jdbcType=VARCHAR},
#{doLog,jdbcType=INTEGER}
#{doLog,jdbcType=INTEGER},
#{doBlackList,jdbcType=INTEGER}
)
</insert>
<update id="updateCfgIndexInfo" parameterType="com.nis.domain.configuration.CfgIndexInfo" >
@@ -254,6 +257,9 @@
</if>
<if test="functionId != null" >
function_id = #{functionId,jdbcType=INTEGER},
</if>
<if test="doBlackList != null">
do_blacklist = #{doBlackList,jdbcType=INTEGER},
</if>
user_region1 = #{userRegion1,jdbcType=VARCHAR},
user_region2 = #{userRegion2,jdbcType=VARCHAR},

View File

@@ -24,6 +24,7 @@
<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="do_blacklist" property="doBlackList" jdbcType="INTEGER" />
</resultMap>
<resultMap id="AvVoipIpCfgMap" type="com.nis.domain.configuration.AvVoipIpCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
@@ -234,7 +235,7 @@
r.CFG_ID,r.CFG_DESC,r.ACTION,r.IS_VALID,r.IS_AUDIT,
r.CREATOR_ID,r.CREATE_TIME,r.EDITOR_ID,r.EDIT_TIME,r.AUDITOR_ID,r.AUDIT_TIME,
r.SERVICE_ID,r.REQUEST_ID,r.COMPILE_ID,r.IS_AREA_EFFECTIVE,r.CLASSIFY,
r.ATTRIBUTE,r.LABLE,r.AREA_EFFECTIVE_IDS,r.function_id,r.do_log
r.ATTRIBUTE,r.LABLE,r.AREA_EFFECTIVE_IDS,r.function_id,r.do_log,r.do_blacklist
</sql>
<sql id="AvVoipIp_Column" >
r.cfg_id,r.cfg_desc,r.ip_type,r.src_ip_address,r.ip_pattern,r.port_pattern,r.src_port
@@ -743,7 +744,8 @@
LABLE,
AREA_EFFECTIVE_IDS,
function_id,
do_log
do_log,
do_blacklist
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
@@ -764,7 +766,8 @@
#{lable,jdbcType=VARCHAR},
#{areaEffectiveIds,jdbcType=VARCHAR},
#{functionId,jdbcType=INTEGER},
#{doLog,jdbcType=INTEGER}
#{doLog,jdbcType=INTEGER},
#{doBlackList,jdbcType=INTEGER}
)
</insert>
<!-- insert AV_VOIP_IP_CFG表信息 -->
@@ -1133,6 +1136,9 @@
<if test="doLog != null" >
do_log = #{doLog,jdbcType=INTEGER},
</if>
<if test="doBlackList != null">
do_blacklist = #{doBlackList,jdbcType=INTEGER},
</if>
</trim>
</set>
<where>

View File

@@ -24,6 +24,7 @@
<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="do_blacklist" property="doBlackList" jdbcType="INTEGER" />
</resultMap>
<resultMap id="ipPortMap" type="com.nis.domain.configuration.IpPortCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
@@ -158,7 +159,7 @@
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.do_log
a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id,a.do_log,a.do_blacklist
</sql>
<sql id="IpCfg_Column" >
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port
@@ -360,7 +361,8 @@
LABLE,
AREA_EFFECTIVE_IDS,
function_id,
do_log
do_log,
do_blacklist
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
@@ -381,7 +383,8 @@
#{lable,jdbcType=VARCHAR},
#{areaEffectiveIds,jdbcType=VARCHAR},
#{functionId,jdbcType=INTEGER},
#{doLog,jdbcType=INTEGER}
#{doLog,jdbcType=INTEGER},
#{doBlackList,jdbcType=INTEGER}
)
</insert>
<!-- insert ip_port_cfg表信息 -->
@@ -629,6 +632,9 @@
</if>
<if test="doLog != null" >
do_log = #{doLog,jdbcType=INTEGER},
</if>
<if test="doBlackList != null" >
do_blacklist = #{doBlackList,jdbcType=INTEGER},
</if>
</trim>
</set>

View File

@@ -32,6 +32,7 @@
<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="do_blacklist" property="doBlackList" jdbcType="INTEGER" />
</resultMap>
<resultMap id="ipPortMap" type="com.nis.domain.configuration.IpPortCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
@@ -131,7 +132,8 @@
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.dns_strategy_id,a.user_region1,
a.user_region2,a.user_region3,a.user_region4,a.user_region5,a.do_log,a.source_compile_id,a.cancel_request_id
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="IpCfg_Column" >
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port
@@ -372,7 +374,8 @@
user_region4,
user_region5,
do_log,
source_compile_id
source_compile_id,
do_blacklist
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
@@ -400,7 +403,8 @@
#{userRegion4,jdbcType=VARCHAR},
#{userRegion5,jdbcType=VARCHAR},
#{doLog,jdbcType=INTEGER},
#{sourceCompileId,jdbcType=INTEGER}
#{sourceCompileId,jdbcType=INTEGER},
#{doBlackList,jdbcType=INTEGER}
)
</insert>
@@ -677,6 +681,9 @@
</if>
<if test="functionId != null" >
function_id = #{functionId,jdbcType=INTEGER},
</if>
<if test="doBlackList != null">
do_blacklist = #{doBlackList,jdbcType=INTEGER},
</if>
user_region1 = #{userRegion1,jdbcType=VARCHAR},
user_region2 = #{userRegion2,jdbcType=VARCHAR},

View File

@@ -36,6 +36,7 @@
<result column="user_region4" property="userRegion4" jdbcType="VARCHAR" />
<result column="user_region5" property="userRegion5" jdbcType="VARCHAR" />
<result column="do_log" property="doLog" jdbcType="INTEGER" />
<result column="do_blacklist" property="doBlackList" jdbcType="INTEGER" />
</resultMap>
<resultMap id="AppFeatureIndexMap" type="com.nis.domain.configuration.AppFeatureIndex" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
@@ -374,6 +375,7 @@
<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="do_blacklist" property="doBlackList" jdbcType="INTEGER" />
</resultMap>
<resultMap id="ipPortMap" type="com.nis.domain.configuration.IpPortCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
@@ -502,6 +504,7 @@
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
<result column="do_log" property="doLog" jdbcType="INTEGER" />
<result column="do_blacklist" property="doBlackList" jdbcType="INTEGER" />
</resultMap>
<resultMap id="AvFileSampleMap" type="com.nis.domain.configuration.AvFileSampleCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
@@ -734,14 +737,14 @@
a.cfg_id,a.cfg_desc,a.action,a.is_valid,a.is_audit,a.creator_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.do_log,a.dns_strategy_id,a.user_region1,a.user_region2,
a.user_region3,a.user_region4,a.user_region5
a.user_region3,a.user_region4,a.user_region5,a.do_blacklist
</sql>
<sql id="DdosIpCfg_Column" >
a.cfg_id,a.cfg_desc,a.action,a.is_valid,a.is_audit,a.creator_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.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port
,a.protocol,a.protocol_id,a.direction,a.dest_port,a.dest_ip_address,a.cfg_type,a.pps_threadshold,
a.antiddos_protocol,a.bps_threadshold
a.antiddos_protocol,a.bps_threadshold,a.do_blacklist
</sql>
<sql id="IpCfg_Column" >
a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port,
@@ -780,7 +783,6 @@
a.cfg_id,a.cfg_desc,a.action,a.is_valid,a.is_audit,a.creator_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.do_log,a.user_region1,a.user_region2,
a.user_region3,a.user_region4,a.user_region5,a.raw_len,a.digest,a.cfds_level,a.file_url
</sql>
<sql id="PxyObjTrustedCaCertColumns">
a.cfg_id,a.cfg_desc

View File

@@ -29,6 +29,7 @@
<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="do_blacklist" property="doBlackList" jdbcType="INTEGER" />
</resultMap>
<resultMap id="ipPortMap" type="com.nis.domain.configuration.IpPortCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
@@ -167,7 +168,8 @@
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.do_log,
a.user_region1,a.user_region2,a.user_region3,a.user_region4,a.user_region5
a.user_region1,a.user_region2,a.user_region3,a.user_region4,a.user_region5,
a.do_blacklist
</sql>
<sql id="IpCfg_Column" >
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port
@@ -375,7 +377,8 @@
user_region2,
user_region3,
user_region4,
user_region5
user_region5,
do_blacklist
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
@@ -401,7 +404,8 @@
#{userRegion2,jdbcType=VARCHAR},
#{userRegion3,jdbcType=VARCHAR},
#{userRegion4,jdbcType=VARCHAR},
#{userRegion5,jdbcType=VARCHAR}
#{userRegion5,jdbcType=VARCHAR},
#{doBlackList,jdbcType=INTEGER}
)
</insert>
<!-- insert ip_port_cfg表信息 -->
@@ -536,7 +540,10 @@
function_id = #{functionId,jdbcType=INTEGER},
</if>
<if test="doLog != null" >
do_log = #{doLog,jdbcType=INTEGER}
do_log = #{doLog,jdbcType=INTEGER},
</if>
<if test="doBlackList != null">
do_blacklist = #{doBlackList,jdbcType=INTEGER}
</if>
</trim>
</set>

View File

@@ -74,6 +74,7 @@
<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="do_blacklist" property="doBlackList" 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" />
@@ -197,7 +198,7 @@
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.dns_strategy_id,a.user_region1,
a.user_region2,a.user_region3,a.user_region4,a.user_region5,a.do_log
a.user_region2,a.user_region3,a.user_region4,a.user_region5,a.do_log,a.do_blacklist
</sql>
<sql id="IpCfg_Column" >
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port
@@ -809,7 +810,8 @@
user_region3,
user_region4,
user_region5,
do_log
do_log,
do_blacklist
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
@@ -836,7 +838,8 @@
#{userRegion3,jdbcType=VARCHAR},
#{userRegion4,jdbcType=VARCHAR},
#{userRegion5,jdbcType=VARCHAR},
#{doLog,jdbcType=INTEGER}
#{doLog,jdbcType=INTEGER},
#{doBlackList,jdbcType=INTEGER}
)
</insert>
<insert id="saveCfgIndexForBatch" parameterType="com.nis.domain.configuration.CfgIndexInfo" >
@@ -866,7 +869,8 @@
user_region3,
user_region4,
user_region5,
do_log
do_log,
do_blacklist
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
@@ -893,7 +897,8 @@
#{userRegion3,jdbcType=VARCHAR},
#{userRegion4,jdbcType=VARCHAR},
#{userRegion5,jdbcType=VARCHAR},
#{doLog,jdbcType=INTEGER}
#{doLog,jdbcType=INTEGER},
#{doBlackList,jdbcType=INTEGER}
)
</insert>
<!-- insert ip_port_cfg表信息 -->
@@ -984,6 +989,7 @@
cfg_desc = #{cfgDesc,jdbcType=VARCHAR},
action = #{action,jdbcType=INTEGER},
do_log = #{doLog,jdbcType=INTEGER},
do_blacklist = #{doBlackList,jdbcType=INTEGER},
is_valid = #{isValid,jdbcType=INTEGER},
is_audit = #{isAudit,jdbcType=INTEGER},
<if test="creatorId != null" >

View File

@@ -23,6 +23,7 @@
<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_blacklist" property="doBlackList" jdbcType="INTEGER" />
</resultMap>
<resultMap id="ipPortMap" type="com.nis.domain.configuration.IpPortCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
@@ -120,7 +121,7 @@
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.do_log
a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id,a.do_log,a.do_blacklist
</sql>
<sql id="IpCfg_Column" >
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port
@@ -312,7 +313,8 @@
LABLE,
AREA_EFFECTIVE_IDS,
function_id,
do_log
do_log,
do_blacklist
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
@@ -333,7 +335,8 @@
#{lable,jdbcType=VARCHAR},
#{areaEffectiveIds,jdbcType=VARCHAR},
#{functionId,jdbcType=INTEGER},
#{doLog,jdbcType=INTEGER}
#{doLog,jdbcType=INTEGER},
#{doBlackList,jdbcType=INTEGER}
)
</insert>
<!-- insert ip_port_cfg表信息 -->
@@ -460,6 +463,9 @@
<if test="doLog != null" >
do_log = #{doLog,jdbcType=INTEGER},
</if>
<if test="doBlackList != null">
do_blacklist = #{doBlackList,jdbcType=INTEGER}
</if>
</trim>
</set>
where cfg_id = #{cfgId,jdbcType=BIGINT}

View File

@@ -33,6 +33,7 @@
<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="do_blacklist" property="doBlackList" jdbcType="INTEGER" />
</resultMap>
<resultMap id="ipPortMap" type="com.nis.domain.configuration.IpPortCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
@@ -132,7 +133,8 @@
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.dns_strategy_id,a.user_region1,
a.user_region2,a.user_region3,a.user_region4,a.user_region5,a.do_log,a.source_compile_id,a.cancel_request_id
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="IpCfg_Column" >
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port
@@ -476,7 +478,8 @@
user_region4,
user_region5,
do_log,
source_compile_id
source_compile_id,
do_blacklist
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
@@ -504,7 +507,8 @@
#{userRegion4,jdbcType=VARCHAR},
#{userRegion5,jdbcType=VARCHAR},
#{doLog,jdbcType=INTEGER},
#{sourceCompileId,jdbcType=INTEGER}
#{sourceCompileId,jdbcType=INTEGER},
#{doBlackList,jdbcType=INTEGER}
)
</insert>
<!-- insert ip_port_cfg表信息 -->
@@ -923,6 +927,9 @@
</if>
<if test="functionId != null" >
function_id = #{functionId,jdbcType=INTEGER},
</if>
<if test="doBlackList != null">
do_blacklist = #{doBlackList,jdbcType=INTEGER},
</if>
user_region1 = #{userRegion1,jdbcType=VARCHAR},
user_region2 = #{userRegion2,jdbcType=VARCHAR},

View File

@@ -80,6 +80,7 @@ import com.nis.domain.specific.SpecificServiceCfg;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.Configurations;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.IpUtil;
import com.nis.util.Reflections;
import com.nis.util.StringUtil;
@@ -600,7 +601,12 @@ public abstract class BaseService {
if (baseIpCfg.getProtocolId() != null && baseIpCfg.getProtocolId() != 0) {
if (numGroupId == 0) {
GroupCfg group1 = new GroupCfg();
group1.setGroupId(groupId);
//group1.setGroupId(groupId);
if(baseIpCfg.getNumberRegionGroupId()!=null) {
group1.setGroupId(baseIpCfg.getNumberRegionGroupId());
}else {
group1.setGroupId(ConfigServiceUtil.getId(2, 1).get(0));
}
group1.setCompileId(baseIpCfg.getCompileId());
group1.setAuditTime(baseIpCfg.getAuditTime());
group1.setIsValid(baseIpCfg.getIsValid());
@@ -1608,7 +1614,7 @@ public abstract class BaseService {
if("BaseIpCfg".equals(type)) {
List<BaseIpCfg> listPage = (List<BaseIpCfg>) list;
if (specificServiceCfg!=null&&regionDict.getFunctionId().equals(405)) {
this.saveAppIpCfg((List<BaseIpCfg>)listPage,specificServiceCfg);
this.saveAppIpCfg((List<BaseIpCfg>)listPage,specificServiceCfg,send);
}else {
this.saveIpBatch(regionDict,serviceDict,(List<BaseIpCfg>)listPage,send);
}
@@ -1775,7 +1781,7 @@ public abstract class BaseService {
* @throws Exception
*/
@Transactional(readOnly = false, rollbackFor = RuntimeException.class)
public void saveAppIpCfg(List<BaseIpCfg> cfgs,SpecificServiceCfg specificServiceCfg){
public void saveAppIpCfg(List<BaseIpCfg> cfgs,SpecificServiceCfg specificServiceCfg,boolean send){
logger.warn("Start to save IP");
ConfigGroupInfoDao configGroupInfoDao=SpringContextHolder.getBean(ConfigGroupInfoDao.class);
SpecificServiceCfgDao specificServiceCfgDao=SpringContextHolder.getBean(SpecificServiceCfgDao.class);
@@ -1800,25 +1806,182 @@ public abstract class BaseService {
Integer compileId = configGroupInfo.getCompileId();
// Varibles maxPacket=asnIpCfgDao.getVaribles("max_allowed_packet");
List<AppIpCfg> tempList=Lists.newArrayList();
int len=0;
int index=0;
for(BaseIpCfg cfg:cfgs) {
AppIpCfg entity=new AppIpCfg();
BeanUtils.copyProperties(cfg, entity);
entity.setCompileId(compileId);
cfg.setCompileId(compileId);
cfg.setGroupId(specificServiceCfg.getGroupId());
int tempLen=entity.toString().getBytes(Charset.forName("UTF-8")).length;
if((len+tempLen)<Constants.MAX_ALLOWED_PACKET) {
tempList.add(entity);
len+=tempLen;
}else {
appCfgDao.insertAppIpCfgBatch(tempList);
if(send) {
List<MaatCfg> configCompileList = new ArrayList();
List<GroupCfg> groupRelationList = new ArrayList();
List<IpCfg> ipRegionList = new ArrayList();
List<StringCfg> strRegionList = new ArrayList();
List<NumBoundaryCfg> numRegionList = new ArrayList();
List<DigestCfg> digestRegionList = new ArrayList();
List<IpCfg> areaIpRegionList = new ArrayList();
if(configGroupInfo.getIsIssued()==0) {//未下发下发region compile,group.
MaatCfg maatCfg = new MaatCfg();
ToMaatBean maatBean = new ToMaatBean();
maatCfg.initDefaultValue();
//group
GroupCfg groupCfg=new GroupCfg();
groupCfg.setCompileId(compileId);
groupCfg.setGroupId(configGroupInfo.getGroupId());
groupCfg.setIsValid(Constants.VALID_YES);
groupCfg.setAuditTime(tempList.get(0).getAuditTime());
groupRelationList.add(groupCfg);
BeanUtils.copyProperties(cfgs.get(0), maatCfg);
ipRegionList.addAll(groupReuseCfgAddRemoveConvert(tempList,Constants.VALID_YES,configGroupInfo.getGroupId()));
maatCfg.setAction(tempList.get(0).getAction());
maatCfg.setAuditTime(tempList.get(0).getAuditTime());
maatCfg.setIpRegionList(ipRegionList);
maatCfg.setStrRegionList(strRegionList);
maatCfg.setNumRegionList(numRegionList);
maatCfg.setDigestRegionList(digestRegionList);
maatCfg.setGroupRelationList(groupRelationList);
maatCfg.setGroupNum(groupRelationList.size());
maatCfg.setAreaIpRegionList(areaIpRegionList);
maatCfg.setIsValid(tempList.get(0).getIsValid());
// 设置APP自定义域
String userRegion = "APP_ID=" + tempList.get(0).getAppCode()/*+Constants.USER_REGION_SPLIT+"ASEV_ID="+businessType*/;
maatCfg.setUserRegion(userRegion);
configCompileList.add(maatCfg);
maatBean.setConfigCompileList(configCompileList);
maatBean.setAuditTime(tempList.get(0).getAuditTime());
maatBean.setCreatorName(tempList.get(0).getCurrentUser().getName());
maatBean.setVersion(Constants.MAAT_VERSION);
maatBean.setOpAction(Constants.INSERT_ACTION);
// 调用服务接口下发配置数据
String json = gsonToJson(maatBean);
logger.info("app协议IP配置下发配置参数" + json);
// 调用服务接口下发配置
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
logger.info("app协议IP配置下发响应信息" + result.getMsg());
configGroupInfo.setIsIssued(1);
configGroupInfo.setUpdateTime(new Date());
configGroupInfoDao.updateConfigGroupInfobyGroupId(configGroupInfo);
}else if(configGroupInfo.getIsIssued()==1) {//已经下发,分组复用下发
GroupReuseAddBean maatBean = new GroupReuseAddBean();
List<GroupReuseCfg> groupReuseList=new ArrayList<>();
GroupReuseCfg groupReuseCfg=new GroupReuseCfg();
/*groupReuseCfg.setUserRegion(userRegion);*/
groupReuseCfg.setServiceId(tempList.get(0).getServiceId());
ipRegionList.addAll(groupReuseCfgAddRemoveConvert(tempList,Constants.VALID_YES,configGroupInfo.getGroupId()));
groupReuseCfg.setIpRegionList(ipRegionList);
groupReuseCfg.setStrRegionList(strRegionList);
groupReuseCfg.setNumRegionList(numRegionList);
groupReuseList.add(groupReuseCfg);
maatBean.setGroupReuseCfgList(groupReuseList);
maatBean.setAuditTime(tempList.get(0).getAuditTime());
maatBean.setCreatorName(tempList.get(0).getCurrentUser().getName());
maatBean.setVersion(Constants.MAAT_VERSION);
maatBean.setOpAction(Constants.INSERT_ACTION);
//调用服务接口下发配置数据
String json=gsonToJson(maatBean);
logger.info("app协议IP域新增配置下发配置参数"+json);
//调用服务接口下发配置
ToMaatResult result = ConfigServiceUtil.postGroupReuseSources(json);
logger.info("app协议IP域新增配置响应信息"+result.getMsg());
}else {
throw new RuntimeException("Unknown configGroupInfo isIssued value");
}
}
tempList.clear();
tempList.add(entity);
len=tempLen;
}
index ++;
}
if(tempList.size()>0) {
logger.warn("save ip size:"+tempList.size());
appCfgDao.insertAppIpCfgBatch(tempList);
if(send) {
if(send) {
List<MaatCfg> configCompileList = new ArrayList();
List<GroupCfg> groupRelationList = new ArrayList();
List<IpCfg> ipRegionList = new ArrayList();
List<StringCfg> strRegionList = new ArrayList();
List<NumBoundaryCfg> numRegionList = new ArrayList();
List<DigestCfg> digestRegionList = new ArrayList();
List<IpCfg> areaIpRegionList = new ArrayList();
if(configGroupInfo.getIsIssued()==0) {//未下发下发region compile,group.
MaatCfg maatCfg = new MaatCfg();
ToMaatBean maatBean = new ToMaatBean();
maatCfg.initDefaultValue();
//group
GroupCfg groupCfg=new GroupCfg();
groupCfg.setCompileId(compileId);
groupCfg.setGroupId(configGroupInfo.getGroupId());
groupCfg.setIsValid(Constants.VALID_YES);
groupCfg.setAuditTime(tempList.get(0).getAuditTime());
groupRelationList.add(groupCfg);
BeanUtils.copyProperties(cfgs.get(0), maatCfg);
ipRegionList.addAll(groupReuseCfgAddRemoveConvert(tempList,Constants.VALID_YES,configGroupInfo.getGroupId()));
maatCfg.setAction(tempList.get(0).getAction());
maatCfg.setAuditTime(tempList.get(0).getAuditTime());
maatCfg.setIpRegionList(ipRegionList);
maatCfg.setStrRegionList(strRegionList);
maatCfg.setNumRegionList(numRegionList);
maatCfg.setDigestRegionList(digestRegionList);
maatCfg.setGroupRelationList(groupRelationList);
maatCfg.setGroupNum(groupRelationList.size());
maatCfg.setAreaIpRegionList(areaIpRegionList);
maatCfg.setIsValid(tempList.get(0).getIsValid());
// 设置APP自定义域
String userRegion = "APP_ID=" + tempList.get(0).getAppCode()/*+Constants.USER_REGION_SPLIT+"ASEV_ID="+businessType*/;
maatCfg.setUserRegion(userRegion);
configCompileList.add(maatCfg);
maatBean.setConfigCompileList(configCompileList);
maatBean.setAuditTime(tempList.get(0).getAuditTime());
maatBean.setCreatorName(tempList.get(0).getCurrentUser().getName());
maatBean.setVersion(Constants.MAAT_VERSION);
maatBean.setOpAction(Constants.INSERT_ACTION);
// 调用服务接口下发配置数据
String json = gsonToJson(maatBean);
logger.info("app协议IP配置下发配置参数" + json);
// 调用服务接口下发配置
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
logger.info("app协议IP配置下发响应信息" + result.getMsg());
configGroupInfo.setIsIssued(1);
configGroupInfo.setUpdateTime(new Date());
configGroupInfoDao.updateConfigGroupInfobyGroupId(configGroupInfo);
}else if(configGroupInfo.getIsIssued()==1) {//已经下发,分组复用下发
GroupReuseAddBean maatBean = new GroupReuseAddBean();
List<GroupReuseCfg> groupReuseList=new ArrayList<>();
GroupReuseCfg groupReuseCfg=new GroupReuseCfg();
/*groupReuseCfg.setUserRegion(userRegion);*/
groupReuseCfg.setServiceId(tempList.get(0).getServiceId());
ipRegionList.addAll(groupReuseCfgAddRemoveConvert(tempList,Constants.VALID_YES,configGroupInfo.getGroupId()));
groupReuseCfg.setIpRegionList(ipRegionList);
groupReuseCfg.setStrRegionList(strRegionList);
groupReuseCfg.setNumRegionList(numRegionList);
groupReuseList.add(groupReuseCfg);
maatBean.setGroupReuseCfgList(groupReuseList);
maatBean.setAuditTime(tempList.get(0).getAuditTime());
maatBean.setCreatorName(tempList.get(0).getCurrentUser().getName());
maatBean.setVersion(Constants.MAAT_VERSION);
maatBean.setOpAction(Constants.INSERT_ACTION);
//调用服务接口下发配置数据
String json=gsonToJson(maatBean);
logger.info("app协议IP域新增配置下发配置参数"+json);
//调用服务接口下发配置
ToMaatResult result = ConfigServiceUtil.postGroupReuseSources(json);
logger.info("app协议IP域新增配置响应信息"+result.getMsg());
}else {
throw new RuntimeException("Unknown configGroupInfo isIssued value");
}
}
}
tempList.clear();
}
long end=System.currentTimeMillis();
@@ -1913,7 +2076,27 @@ public abstract class BaseService {
_cfg.setUserRegion3(StringUtil.isEmpty(_cfg.getUserRegion3()) ? "":_cfg.getUserRegion3());
maatCfg.setUserRegion(Constants.INTERCEPT_IP_RATELIMIT_BANDWITH_USER_REGION_KEY+"="+_cfg.getUserRegion3());
}
}else if(regionDict.getFunctionId()==510) {
maatCfg.setUserRegion(Constants.P2P_IP_TYPE_USER_REGION_KEY+"="+_cfg.getUserRegion2());
}else if(regionDict.getFunctionId()==7) {
if(!StringUtil.isEmpty(_cfg.getDnsStrategyId())){
// maatCfg.setUserRegion(Constants.USER_REGION_SPLIT+entity.getDnsStrategyId()+Constants.USER_REGION_SPLIT);
maatCfg.setUserRegion(Constants.DNS_STRATEGY_USER_REGION_KEY+"="+_cfg.getDnsStrategyId());
}
}else if(regionDict.getFunctionId()==407) {// Protocol Identify
maatCfg.setUserRegion(Constants.PROTO_ID_REGION + "=" + _cfg.getAppCode());
}else if(regionDict.getFunctionId()==63) {// APP Policy
maatCfg.setUserRegion(Constants.APP_ID_REGION + "=" + _cfg.getAppCode()+Constants.USER_REGION_SPLIT+Constants.APP_VIGNORE_USER_REGION_KEY+"=1");
}else if(regionDict.getFunctionId()==408) {// Behavior Identify
maatCfg.setUserRegion(Constants.PROTO_ID_REGION + "=" + _cfg.getAppCode()+Constants.USER_REGION_SPLIT+Constants.APP_VIGNORE_USER_REGION_KEY+"=1");
}else if(regionDict.getFunctionId()==301) {// Anti DDOS
Map umap= new HashMap();
umap.put("protocol", _cfg.getAntiddosProtocol());
umap.put("bps_threadshold", _cfg.getBpsThreadshold());
umap.put("pps_threadshold", _cfg.getPpsThreadshold());
maatCfg.setUserRegion(new Gson().toJson(umap));
}
configCompileList.add(maatCfg);
}else {
//根据具体情况判断
@@ -1931,7 +2114,7 @@ public abstract class BaseService {
maatBean.setOpAction(Constants.INSERT_ACTION);
// 调用服务接口下发配置数据
String json = BaseService.gsonToJson(maatBean);
if(configCompileList.size()>100) {
if(configCompileList.size()>10) {
logger.info("IP 配置下发配置条数:" + configCompileList.size());
}else {
logger.info("IP 配置下发配置参数:" + json);
@@ -1994,8 +2177,17 @@ public abstract class BaseService {
}
if (send) {
if(regionDict.getIsMaat().intValue()==1) {
configCompileList.add(convertMaatCfg(_cfg,2));
MaatCfg maatCfg=convertMaatCfg(_cfg,2);
//userregion处理
if(regionDict.getFunctionId()==7) {
if(!StringUtil.isEmpty(_cfg.getDnsStrategyId())){
// maatCfg.setUserRegion(Constants.USER_REGION_SPLIT+entity.getDnsStrategyId()+Constants.USER_REGION_SPLIT);
maatCfg.setUserRegion(Constants.DNS_STRATEGY_USER_REGION_KEY+"="+_cfg.getDnsStrategyId());
}
}else if(regionDict.getDictId()==159) {
maatCfg.setUserRegion(Constants.P2P_HASH_TYPE_USER_REGION_KEY+"="+_cfg.getUserRegion1());
}
configCompileList.add(maatCfg);
}
}
@@ -2009,7 +2201,7 @@ public abstract class BaseService {
maatBean.setOpAction(Constants.INSERT_ACTION);
// 调用服务接口下发配置数据
String json = BaseService.gsonToJson(maatBean);
if(configCompileList.size()>100) {
if(configCompileList.size()>10) {
logger.info("字符串配置下发配置条数:" + configCompileList.size());
}else {
logger.info("字符串配置下发配置参数:" + json);
@@ -2037,29 +2229,78 @@ public abstract class BaseService {
*/
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void saveComplexkeywordCfgBatch(FunctionRegionDict regionDict, FunctionServiceDict serviceDict,List<ComplexkeywordCfg> data, String tableName,boolean send) {
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
SqlSession batchSqlSession = null;
try{
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
for(int index = 0; index < data.size();index++){
ComplexkeywordCfg cfg = data.get(index);
cfg.setTableName(tableName);
if(regionDict.getDictId().intValue()==63) {
AppHttpCfg _cfg=new AppHttpCfg();
BeanUtils.copyProperties(cfg, _cfg);
((AppCfgDao) batchSqlSession.getMapper(AppCfgDao.class)).insertAppHttpCfgBatch(_cfg);
}else {
((StringCfgDao) batchSqlSession.getMapper(StringCfgDao.class)).saveComplexkeywordCfgBatch(cfg);
}
}
batchSqlSession.commit();
}finally {
if(batchSqlSession != null){
batchSqlSession.close();
if (regionDict != null) {
Integer regionType = regionDict.getRegionType();
if (3 == regionType.intValue()) {
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
List<MaatCfg> configCompileList = new ArrayList();
SqlSession batchSqlSession = null;
try{
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
for(int index = 0; index < data.size();index++){
ComplexkeywordCfg cfg = data.get(index);
cfg.setTableName(tableName);
if(regionDict.getDictId().intValue()==63) {
AppHttpCfg _cfg=new AppHttpCfg();
BeanUtils.copyProperties(cfg, _cfg);
((AppCfgDao) batchSqlSession.getMapper(AppCfgDao.class)).insertAppHttpCfgBatch(_cfg);
}else {
((StringCfgDao) batchSqlSession.getMapper(StringCfgDao.class)).saveComplexkeywordCfgBatch(cfg);
}
if (send) {
if(regionDict.getIsMaat().intValue()==1) {
MaatCfg maatCfg=convertMaatCfg(cfg,3);
//userregion处理
if(regionDict.getFunctionId()==7) {
if(!StringUtil.isEmpty(cfg.getDnsStrategyId())){
// maatCfg.setUserRegion(Constants.USER_REGION_SPLIT+entity.getDnsStrategyId()+Constants.USER_REGION_SPLIT);
maatCfg.setUserRegion(Constants.DNS_STRATEGY_USER_REGION_KEY+"="+cfg.getDnsStrategyId());
}
}else if(regionDict.getDictId()==10) {
String dictValue = DictUtils.getDictCode(Constants.HTTP_HEADER_DICT_MODULE, cfg.getDistrict());
if(StringUtil.isEmpty(dictValue) || dictValue.equals("默认")){
maatCfg.setUserRegion(Constants.HTTP_HEADER_USER_REGION_KEY+"="+cfg.getDistrict());
}
}else if(regionDict.getDictId()==11) {
String dictValue = DictUtils.getDictCode(Constants.HTTP_HEADER_DICT_MODULE, cfg.getDistrict());
if(StringUtil.isEmpty(dictValue) || dictValue.equals("默认")){
maatCfg.setUserRegion(Constants.HTTP_HEADER_USER_REGION_KEY+"="+cfg.getDistrict());
}
}
configCompileList.add(maatCfg);
}
}
}
if (send && configCompileList.size() > 0) {
ToMaatBean maatBean = new ToMaatBean();
maatBean.setConfigCompileList(configCompileList);
maatBean.setAuditTime(new Date());
maatBean.setCreatorName(UserUtils.getUser().getName());
maatBean.setVersion(Constants.MAAT_VERSION);
maatBean.setOpAction(Constants.INSERT_ACTION);
// 调用服务接口下发配置数据
String json = BaseService.gsonToJson(maatBean);
if(configCompileList.size()>10) {
logger.info("增强字符串配置下发配置条数:" + configCompileList.size());
}else {
logger.info("增强字符串配置下发配置参数:" + json);
}
// 调用服务接口下发配置
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
logger.info("增强字符串配置下发响应信息:" + result.getMsg());
}
batchSqlSession.commit();
}finally {
if(batchSqlSession != null){
batchSqlSession.close();
}
}
}
}
}
/**
* asn ip分组复用新增