对象组提交
This commit is contained in:
@@ -76,8 +76,8 @@ public class BaseCfg<T> extends BaseEntity<T> implements Cloneable{
|
||||
* 定时任务信息,2019年1月18日18:54:53 修改
|
||||
*/
|
||||
protected ScheduleCfg schedule;
|
||||
|
||||
private String commonGroupIds; //公共组织id(考虑一个compile存在多个asn组织的情况)
|
||||
|
||||
protected String commonGroupIds; //公共组织id(考虑一个compile存在多个asn组织的情况)
|
||||
protected Integer groupType; //url组以及dns组相关功能使用
|
||||
protected Integer udFlag; //url组以及dns组相关功能使用 过滤数据库数据标记
|
||||
|
||||
|
||||
57
src/main/java/com/nis/domain/configuration/ObjGroupCfg.java
Normal file
57
src/main/java/com/nis/domain/configuration/ObjGroupCfg.java
Normal file
@@ -0,0 +1,57 @@
|
||||
package com.nis.domain.configuration;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
public class ObjGroupCfg extends BaseCfg<ObjGroupCfg> {
|
||||
|
||||
@ExcelField(title="ip_group",sort=50)
|
||||
private String ipGroup;
|
||||
@ExcelField(title="url_group",sort=51)
|
||||
private String urlGroup;
|
||||
@ExcelField(title="subscribe_id_group",sort=52)
|
||||
private String subscribeIdGroup;
|
||||
@ExcelField(title="domain_group",sort=53)
|
||||
private String domainGroup;
|
||||
@ExcelField(title="action",sort=2)
|
||||
protected String actionCode;
|
||||
|
||||
public String getActionCode() {
|
||||
return actionCode;
|
||||
}
|
||||
|
||||
public void setActionCode(String actionCode) {
|
||||
this.actionCode = actionCode;
|
||||
}
|
||||
|
||||
public String getIpGroup() {
|
||||
return ipGroup;
|
||||
}
|
||||
|
||||
public void setIpGroup(String ipGroup) {
|
||||
this.ipGroup = ipGroup;
|
||||
}
|
||||
|
||||
public String getUrlGroup() {
|
||||
return urlGroup;
|
||||
}
|
||||
|
||||
public void setUrlGroup(String urlGroup) {
|
||||
this.urlGroup = urlGroup;
|
||||
}
|
||||
|
||||
public String getSubscribeIdGroup() {
|
||||
return subscribeIdGroup;
|
||||
}
|
||||
|
||||
public void setSubscribeIdGroup(String subscribeIdGroup) {
|
||||
this.subscribeIdGroup = subscribeIdGroup;
|
||||
}
|
||||
|
||||
public String getDomainGroup() {
|
||||
return domainGroup;
|
||||
}
|
||||
|
||||
public void setDomainGroup(String domainGroup) {
|
||||
this.domainGroup = domainGroup;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,15 @@
|
||||
package com.nis.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.lang.reflect.Type;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
import com.google.gson.*;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.nis.domain.configuration.*;
|
||||
import com.nis.web.service.BaseService;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -15,13 +19,6 @@ import com.google.common.collect.Lists;
|
||||
import com.googlecode.ipv6.IPv6Address;
|
||||
import com.googlecode.ipv6.IPv6Network;
|
||||
import com.nis.domain.basics.AsnIpCfg;
|
||||
import com.nis.domain.configuration.AppIpCfg;
|
||||
import com.nis.domain.configuration.BaseCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.configuration.FileDigestCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.maat.MaatCfg.DigestCfg;
|
||||
import com.nis.domain.maat.MaatCfg.GroupCfg;
|
||||
import com.nis.domain.maat.MaatCfg.IpCfg;
|
||||
@@ -233,7 +230,6 @@ public class ConfigConvertUtil {
|
||||
* @param dstList
|
||||
* @param srcList
|
||||
* @param cfgType,1为IP类型,2为字符串类型,3为增强字符串,4数值类型,5摘要类,6回调类[但字符串类域配置和增强字符串域配置在接口参数中同属于strRegionList]
|
||||
* @param baseCfg,配置基本信息
|
||||
* @param groupRelationList
|
||||
* 配置分组列表
|
||||
* @return
|
||||
@@ -577,4 +573,310 @@ public class ConfigConvertUtil {
|
||||
dstIp.setDstPortMask("65535");
|
||||
}
|
||||
}
|
||||
/**
|
||||
*Obj 组maat配置转换
|
||||
* @param <T>
|
||||
* @param <T>
|
||||
* @param dstList
|
||||
* @param srcList
|
||||
* @param cfgType,1为IP类型,2为字符串类型,3为增强字符串,4数值类型,5摘要类,6回调类[但字符串类域配置和增强字符串域配置在接口参数中同属于strRegionList]
|
||||
* @param baseCfg,配置基本信息
|
||||
* @param groupRelationList
|
||||
* 配置分组列表
|
||||
* @return
|
||||
*/
|
||||
public static <T> Map<String, List> objGroupCfgConvert(List dstList, List<T> srcList, Integer cfgType, BaseCfg baseCfg,
|
||||
List groupRelationList, Map<String,Object> maatTableMap, Set<Integer> groupIdSet) {
|
||||
Map<String, List> map = new HashMap();
|
||||
if (cfgType == 1) {
|
||||
List numRegionList = new ArrayList();
|
||||
|
||||
Integer numGroupId = 0;
|
||||
List<Integer> regionIdList = new ArrayList<>();//ConfigServiceUtil.getId(3, srcList.size());
|
||||
for (int i = 0; i < srcList.size(); i++) {
|
||||
T srcCfg = srcList.get(i);
|
||||
BaseIpCfg baseIpCfg = new BaseIpCfg();
|
||||
BeanUtils.copyProperties(srcCfg, baseIpCfg);
|
||||
IpCfg cfg = new IpCfg();
|
||||
BeanUtils.copyProperties(baseIpCfg, cfg);
|
||||
// 区域IP配置,多条IP配置属于同一个分组,其他业务配置IP,一条配置一个分组
|
||||
// if(groupId==0 || !cfg.getCfgType().equals(Constants.AREA_REGION)){
|
||||
|
||||
if (!groupIdSet.contains(baseIpCfg.getGroupId())) {
|
||||
GroupCfg group = new GroupCfg();
|
||||
//groupId = ConfigServiceUtil.getId(2, 1).get(0);
|
||||
groupIdSet.add(baseIpCfg.getGroupId());
|
||||
group.setGroupId(baseIpCfg.getGroupId());
|
||||
group.setCompileId(baseCfg.getCompileId());
|
||||
group.setAuditTime(baseCfg.getAuditTime());
|
||||
group.setIsValid(baseCfg.getIsValid());
|
||||
groupRelationList.add(group);
|
||||
groupIdSet.add(baseIpCfg.getGroupId());
|
||||
}
|
||||
cfg.setGroupId(baseIpCfg.getGroupId());
|
||||
cfg.setAuditTime(baseCfg.getAuditTime());
|
||||
cfg.setIsValid(baseCfg.getIsValid());
|
||||
if(maatTableMap.containsKey("ipMaatTable")){
|
||||
Map<String,String> ipMaatTable=(Map<String,String>)maatTableMap.get("ipMaatTable");
|
||||
cfg.setCfgType(ipMaatTable.get(baseIpCfg.getGroupId().toString()));
|
||||
}
|
||||
List<IpCfg> cfgs = ipConvert(cfg, baseIpCfg);
|
||||
if (cfgs.size() > 1) {
|
||||
List<Integer> ids = ConfigServiceUtil.getId(3, cfgs.size() - 1);
|
||||
regionIdList.addAll(ids);
|
||||
//支持range????
|
||||
for (int j = 1; j < cfgs.size() + i; j++) {
|
||||
cfgs.get(j).setRegionId(ids.get(j));
|
||||
}
|
||||
}
|
||||
dstList.addAll(cfgs);
|
||||
|
||||
// 如果protocolId非空非零,需要构造数值型域配置,多条相同协议的IP只需要一条数值域配置(目前没有不同协议IP&情况)
|
||||
//分组复用每个IP组还需要不同的数值域组么?????
|
||||
if (baseIpCfg.getProtocolId() != null && baseIpCfg.getProtocolId() != 0) {
|
||||
if (numGroupId == 0) {
|
||||
GroupCfg group1 = new GroupCfg();
|
||||
group1.setGroupId(ConfigServiceUtil.getId(2, 1).get(0));
|
||||
group1.setCompileId(baseIpCfg.getCompileId());
|
||||
group1.setAuditTime(baseCfg.getAuditTime());
|
||||
group1.setIsValid(baseCfg.getIsValid());
|
||||
groupRelationList.add(group1);
|
||||
NumBoundaryCfg numCfg = new NumBoundaryCfg();
|
||||
numCfg.initDefaultValue();
|
||||
numCfg.setLowBoundary(baseIpCfg.getProtocolId());
|
||||
numCfg.setUpBoundary(baseIpCfg.getProtocolId());
|
||||
numCfg.setRegionId(ConfigServiceUtil.getId(3, 1).get(0));
|
||||
numCfg.setAuditTime(baseCfg.getAuditTime());
|
||||
numCfg.setGroupId(group1.getGroupId());
|
||||
numCfg.setIsValid(baseCfg.getIsValid());
|
||||
if(maatTableMap.containsKey("protocolMaatTable")){
|
||||
numCfg.setCfgType(maatTableMap.get("protocolMaatTable").toString());
|
||||
}
|
||||
numRegionList.add(numCfg);
|
||||
map.put("numRegionList", numRegionList);
|
||||
numGroupId++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else if (cfgType == 2 || cfgType == 3) {
|
||||
//List<Integer> groupIdList = ConfigServiceUtil.getId(2, srcList.size());
|
||||
//List<Integer> regionIdList = ConfigServiceUtil.getId(3, srcList.size());
|
||||
for (int i = 0; i < srcList.size(); i++) {
|
||||
BaseStringCfg baserStringCfg=new BaseStringCfg();
|
||||
BeanUtils.copyProperties(srcList.get(i),baserStringCfg);
|
||||
if(!groupIdSet.contains(baserStringCfg.getGroupId())){
|
||||
GroupCfg group = new GroupCfg();
|
||||
group.setGroupId(baserStringCfg.getGroupId());
|
||||
group.setCompileId(baseCfg.getCompileId());
|
||||
group.setAuditTime(baseCfg.getAuditTime());
|
||||
group.setIsValid(baseCfg.getIsValid());
|
||||
groupRelationList.add(group);
|
||||
groupIdSet.add(baserStringCfg.getGroupId());
|
||||
}
|
||||
StringCfg cfg = new StringCfg();
|
||||
BeanUtils.copyProperties(srcList.get(i), cfg);
|
||||
cfg.setGroupId(baserStringCfg.getGroupId());
|
||||
cfg.setRegionId(baserStringCfg.getRegionId());
|
||||
cfg.setAuditTime(baseCfg.getAuditTime());
|
||||
cfg.setIsValid(baseCfg.getIsValid());
|
||||
// 处理配置关键字转译
|
||||
cfg.setCfgKeywords(keywordsEscape(cfg.getCfgKeywords()));
|
||||
// 增强字符串转换
|
||||
cfg.setDistrict(keywordsEscape(cfg.getDistrict()));
|
||||
if(maatTableMap.containsKey("stringMaatTable")){
|
||||
Map<String,String> stringMaatTable=(Map<String,String>)maatTableMap.get("stringMaatTable");
|
||||
cfg.setCfgType(stringMaatTable.get(baserStringCfg.getGroupId().toString()));
|
||||
}
|
||||
dstList.add(cfg);
|
||||
}
|
||||
} else if (cfgType == 4) {
|
||||
// List<Integer> groupIdList = ConfigServiceUtil.getId(2, srcList.size());
|
||||
// List<Integer> regionIdList = ConfigServiceUtil.getId(3, srcList.size());
|
||||
for (int i = 0; i < srcList.size(); i++) {
|
||||
// 一条业务配置创建一个分组
|
||||
com.nis.domain.maat.MaatCfg.NumBoundaryCfg cfg = new com.nis.domain.maat.MaatCfg.NumBoundaryCfg();
|
||||
BeanUtils.copyProperties(srcList.get(i), cfg);
|
||||
if(!groupIdSet.contains(cfg.getGroupId())){
|
||||
GroupCfg group = new GroupCfg();
|
||||
group.setGroupId(cfg.getGroupId());
|
||||
group.setCompileId(baseCfg.getCompileId());
|
||||
group.setAuditTime(baseCfg.getAuditTime());
|
||||
group.setIsValid(baseCfg.getIsValid());
|
||||
groupRelationList.add(group);
|
||||
groupIdSet.add(cfg.getGroupId());
|
||||
}
|
||||
cfg.setGroupId(cfg.getGroupId());
|
||||
cfg.setRegionId(cfg.getRegionId());
|
||||
cfg.setAuditTime(baseCfg.getAuditTime());
|
||||
cfg.setIsValid(baseCfg.getIsValid());
|
||||
dstList.add(cfg);
|
||||
}
|
||||
} else if (cfgType == 5) {
|
||||
//List<Integer> groupIdList = ConfigServiceUtil.getId(2, srcList.size());
|
||||
//List<Integer> regionIdList = ConfigServiceUtil.getId(3, srcList.size());
|
||||
for (int i = 0; i < srcList.size(); i++) {
|
||||
// 一条业务配置创建一个分组
|
||||
com.nis.domain.maat.MaatCfg.DigestCfg cfg = new com.nis.domain.maat.MaatCfg.DigestCfg();
|
||||
BeanUtils.copyProperties(srcList.get(i), cfg);
|
||||
if(!groupIdSet.contains(cfg.getGroupId())){
|
||||
GroupCfg group = new GroupCfg();
|
||||
group.setGroupId(cfg.getGroupId());
|
||||
group.setCompileId(baseCfg.getCompileId());
|
||||
group.setAuditTime(baseCfg.getAuditTime());
|
||||
group.setIsValid(baseCfg.getIsValid());
|
||||
groupRelationList.add(group);
|
||||
groupIdSet.add(cfg.getGroupId());
|
||||
}
|
||||
cfg.setGroupId(cfg.getGroupId());
|
||||
cfg.setRegionId(cfg.getRegionId());
|
||||
cfg.setAuditTime(baseCfg.getAuditTime());
|
||||
cfg.setIsValid(baseCfg.getIsValid());
|
||||
dstList.add(cfg);
|
||||
}
|
||||
} else {
|
||||
dstList.addAll(srcList);
|
||||
}
|
||||
map.put("groupList", groupRelationList);
|
||||
map.put("dstList", dstList);
|
||||
return map;
|
||||
}
|
||||
/**
|
||||
* 转换成字符串
|
||||
*
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
public static <T> String gsonToJson(T obj) {
|
||||
Gson gson = new GsonBuilder().disableHtmlEscaping().excludeFieldsWithoutExposeAnnotation()
|
||||
.registerTypeAdapter(Date.class, new JsonSerializer<Date>() {
|
||||
@Override
|
||||
public JsonElement serialize(Date src, Type type, JsonSerializationContext context) {
|
||||
String format = "yyyy-MM-dd HH:mm:ss";
|
||||
long time = ((Date) src).getTime();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(format);
|
||||
return new JsonPrimitive(sdf.format(time));
|
||||
}
|
||||
}).create();
|
||||
return gson.toJson(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* 字符串转成对象
|
||||
*
|
||||
* @param jsonString
|
||||
* @param cls
|
||||
* @return
|
||||
*/
|
||||
public static <T> T gsonFromJson(String jsonString, Class<T> cls) {
|
||||
Gson gson = new GsonBuilder().registerTypeAdapter(new TypeToken<Map>() {
|
||||
}.getType(), new BaseService.MapTypeAdapter()).registerTypeAdapter(new TypeToken<List>() {
|
||||
}.getType(), new BaseService.MapTypeAdapter()).create();
|
||||
return gson.fromJson(jsonString, cls);
|
||||
}
|
||||
|
||||
/**
|
||||
* 公共分组生成默认自定义域
|
||||
* @param userRegionMap
|
||||
* @param serviceId
|
||||
* @return
|
||||
*/
|
||||
public static String generateCommonGroupDefaultUserRegion(Map<String,Object> userRegionMap,Integer serviceId){
|
||||
if(userRegionMap==null){
|
||||
userRegionMap=new HashMap<>();
|
||||
}
|
||||
if(serviceId.equals(576)){
|
||||
userRegionMap.put("method","block");
|
||||
userRegionMap.put("code",404);
|
||||
userRegionMap.put("message","");
|
||||
userRegionMap.put("html_profile",0);
|
||||
return gsonToJson(userRegionMap);
|
||||
}else if(serviceId.equals(512)){
|
||||
if(userRegionMap.isEmpty()){
|
||||
//keyring
|
||||
userRegionMap.put("keyring", 0);
|
||||
Map<String,Object> map = new HashMap();
|
||||
//exclusions
|
||||
map.put("ev_cert", 0);
|
||||
map.put("cert_transparency", 0);
|
||||
map.put("pinning", 0);
|
||||
map.put("client_cert_req", 0);
|
||||
userRegionMap.put("exclusions", map);
|
||||
//cert_verify
|
||||
Map<String,Object> map1=new HashMap<>();
|
||||
map=new HashMap<>();
|
||||
map.put("cn",0);
|
||||
map.put("issuer",0);
|
||||
map.put("self-signed",0);
|
||||
map.put("expiration",0);
|
||||
map1.put("approach", map);
|
||||
userRegionMap.put("cert_verify", map1);
|
||||
//ssl_ver
|
||||
map=new HashMap<>();
|
||||
map.put("mirror_client", 0);
|
||||
map.put("allow_http2", 0);
|
||||
map.put("min", "ssl3");
|
||||
map.put("max", "tls13");
|
||||
userRegionMap.put("ssl_ver", map);
|
||||
//decrypt_mirror
|
||||
map=new HashMap<>();
|
||||
map.put("enable", 0);
|
||||
userRegionMap.put("decrypt_mirror", map);
|
||||
}
|
||||
return gsonToJson(userRegionMap);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public static Map<String,Object> convertCommonGroupMaatTable(CfgIndexInfo cfgIndexInfo,List<Map<String, Object>> cfgList){
|
||||
Map<String,Object> maatTableMap=new HashMap<>();
|
||||
Map<String,Object> commonGroupIds= MapUtils.isEmpty(cfgIndexInfo.getUserRegion())?(Map<String,Object>)gsonFromJson(cfgIndexInfo.getCommonGroupIds(),Map.class):cfgIndexInfo.getUserRegion();
|
||||
for (Map<String, Object> map : cfgList) {
|
||||
String cfgType = map.get("cfgType").toString();
|
||||
if (cfgType.equals("1")) {
|
||||
if(commonGroupIds.containsKey("ipGroup")){
|
||||
Map<String,String> ipMaatMap=new HashMap<>();
|
||||
for(String group:commonGroupIds.get("ipGroup").toString().split(",")){
|
||||
if(StringUtils.isNotBlank(group)){
|
||||
ipMaatMap.put(group,map.get("maatTable").toString());
|
||||
}
|
||||
}
|
||||
maatTableMap.put("ipMaatTable",ipMaatMap);
|
||||
}
|
||||
|
||||
if(map.containsKey("protocolMaatTable")){
|
||||
maatTableMap.put("protocolMaatTable",map.get("protocolMaatTable").toString());
|
||||
}
|
||||
} else if (cfgType.equals("2")) {
|
||||
String _maatTable = map.get("maatTable").toString();
|
||||
Map<String,String> stringMaatMap=new HashMap<>();
|
||||
if(commonGroupIds.containsKey("urlGroup")&&_maatTable.toUpperCase().contains("URL")){
|
||||
for(String group:commonGroupIds.get("urlGroup").toString().split(",")){
|
||||
if(StringUtils.isNotBlank(group)){
|
||||
stringMaatMap.put(group,_maatTable);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(commonGroupIds.containsKey("domainGroup")&&_maatTable.toUpperCase().contains("DOMAIN")){
|
||||
for(String group:commonGroupIds.get("domainGroup").toString().split(",")){
|
||||
if(StringUtils.isNotBlank(group)){
|
||||
stringMaatMap.put(group,_maatTable);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(commonGroupIds.containsKey("subscribeIdGroup")&&_maatTable.toUpperCase().contains("SUBSCRIBE_ID")){
|
||||
for(String group:commonGroupIds.get("subscribeIdGroup").toString().split(",")){
|
||||
if(StringUtils.isNotBlank(group)){
|
||||
stringMaatMap.put(group,_maatTable);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(maatTableMap.containsKey("stringMaatTable")){
|
||||
((Map<String,String>)maatTableMap.get("stringMaatTable")).putAll(stringMaatMap);
|
||||
}else{
|
||||
maatTableMap.put("stringMaatTable",stringMaatMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
return maatTableMap;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -968,6 +968,7 @@ public class ConfigServiceUtil {
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
// getId(1,1);
|
||||
|
||||
@@ -13,8 +13,8 @@ public final class Constants {
|
||||
*/
|
||||
public static Integer IP_OBJ_GROUP_TYPE=Configurations.getIntProperty("ip_obj_group_type", 5);
|
||||
public static Integer URL_OBJ_GROUP_TYPE=Configurations.getIntProperty("url_obj_group_type", 7);
|
||||
public static Integer SUBID_OBJ_GROUP_TYPE=Configurations.getIntProperty("subid_obj_group_type", 8);
|
||||
public static Integer DOMAIN_OBJ_GROUP_TYPE=Configurations.getIntProperty("domain_obj_group_type", 9);
|
||||
public static Integer SUBID_OBJ_GROUP_TYPE=Configurations.getIntProperty("subid_obj_group_type", 9);
|
||||
public static Integer DOMAIN_OBJ_GROUP_TYPE=Configurations.getIntProperty("domain_obj_group_type", 8);
|
||||
/**
|
||||
* 导入条数限制
|
||||
*/
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
package com.nis.util;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.lang.reflect.Type;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
import com.google.gson.*;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.nis.domain.basics.*;
|
||||
import com.nis.domain.configuration.*;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authc.UsernamePasswordToken;
|
||||
@@ -20,25 +22,7 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.gson.Gson;
|
||||
import com.nis.domain.basics.AsnIpCfg;
|
||||
import com.nis.domain.callback.InlineIp;
|
||||
import com.nis.domain.configuration.AppPolicyCfg;
|
||||
import com.nis.domain.configuration.AvFileSampleCfg;
|
||||
import com.nis.domain.configuration.AvSignSampleCfg;
|
||||
import com.nis.domain.configuration.BaseCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
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.DnsResStrategy;
|
||||
import com.nis.domain.configuration.FileDigestCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.PxyObjKeyring;
|
||||
import com.nis.domain.configuration.PxyObjSpoofingIpPool;
|
||||
import com.nis.domain.configuration.PxyObjTrustedCaCert;
|
||||
import com.nis.domain.configuration.PxyObjTrustedCaCrl;
|
||||
import com.nis.domain.maat.MaatCfg;
|
||||
import com.nis.domain.maat.ManipulatActionParam;
|
||||
import com.nis.domain.maat.ToMaatBean;
|
||||
@@ -122,6 +106,14 @@ public class SchedulerTaskUtil {
|
||||
List<BaseStringCfg> strList = new ArrayList();
|
||||
List<ComplexkeywordCfg> complexStrList = new ArrayList();
|
||||
List<com.nis.domain.configuration.NumBoundaryCfg> numList = new ArrayList();
|
||||
//公共分组
|
||||
boolean isCommonGroup=false;
|
||||
List<IpCommCfg> ipCommCfgList=new ArrayList<>();
|
||||
List<UrlCommCfg> urlCommCfgList=new ArrayList<>();
|
||||
List<ScriberIdCommCfg> scriberIdCommCfgList=new ArrayList<>();
|
||||
List<DomainCommCfg> domainCommCfgList=new ArrayList<>();
|
||||
Map<String,Object> commGroupMap=new HashMap<>();
|
||||
Set<Integer> groupIdSet=new HashSet<>();
|
||||
List<FileDigestCfg> fileList = new ArrayList();
|
||||
maatBean = new ToMaatBean();
|
||||
configCompileList = new ArrayList();
|
||||
@@ -136,36 +128,67 @@ public class SchedulerTaskUtil {
|
||||
//查询配置
|
||||
if("cfg_index_info".equals(tableName)){
|
||||
List<CfgIndexInfo> list = configSynchronizationDao.getCfgIndexList(entity);
|
||||
|
||||
if(CollectionUtils.isNotEmpty(list)&&StringUtils.isNotBlank(list.get(0).getCommonGroupIds())){
|
||||
isCommonGroup=true;
|
||||
}
|
||||
if(isIssueContent.equals(1)){
|
||||
//用于存储自定义域为关键字的业务,key=compileId,value=keyword.
|
||||
Map<Integer, BaseStringCfg> keywordMap=new HashMap<>();
|
||||
//查询子域配置详情
|
||||
if(cfgList!=null){
|
||||
for(Map<String,Object> m:cfgList){
|
||||
String regionTable = m.get("tableName").toString();
|
||||
if("1".equals(m.get("cfgType"))){
|
||||
ipList.addAll(configSynchronizationDao.getIpPortList(regionTable, compileIds));
|
||||
}else if("2".equals(m.get("cfgType"))){
|
||||
strList.addAll(configSynchronizationDao.getStrList(regionTable,compileIds));
|
||||
//512/521/514/1026业务的用户自定义域取DOMAIN_STR取自Keyword
|
||||
if(/*entity.getServiceId()==512
|
||||
||*/entity.getServiceId()==521
|
||||
||entity.getServiceId()==514
|
||||
||entity.getServiceId()==1026) {
|
||||
keywordMap=configSynchronizationDao.getCompileIdWithKeyword(regionTable, compileIds);
|
||||
if(isCommonGroup){
|
||||
groupIdSet=new HashSet<>();
|
||||
commGroupMap=ConfigConvertUtil.gsonFromJson(list.get(0).getCommonGroupIds(),Map.class);
|
||||
//将组中的域设置到cfg_index_info中
|
||||
covertCommongroupIdsMap(commGroupMap,"ipGroup",list.get(0),configSynchronizationDao,IpCommCfg.class);
|
||||
if(CollectionUtils.isNotEmpty(list.get(0).getIpCommGroupCfgList())){
|
||||
ipCommCfgList.addAll(list.get(0).getIpCommGroupCfgList());
|
||||
}
|
||||
covertCommongroupIdsMap(commGroupMap,"urlGroup",list.get(0),configSynchronizationDao,UrlCommCfg.class);
|
||||
if(CollectionUtils.isNotEmpty(list.get(0).getUrlCommGroupList())){
|
||||
urlCommCfgList.addAll(list.get(0).getUrlCommGroupList());
|
||||
}
|
||||
covertCommongroupIdsMap(commGroupMap,"subscribeIdGroup",list.get(0),configSynchronizationDao,ScriberIdCommCfg.class);
|
||||
if(CollectionUtils.isNotEmpty(list.get(0).getScriberIdCommGroupList())){
|
||||
scriberIdCommCfgList.addAll(list.get(0).getScriberIdCommGroupList());
|
||||
}
|
||||
covertCommongroupIdsMap(commGroupMap,"domainGroup",list.get(0),configSynchronizationDao,DomainCommCfg.class);
|
||||
if(CollectionUtils.isNotEmpty(list.get(0).getDomainCommGroupList())){
|
||||
domainCommCfgList.addAll(list.get(0).getDomainCommGroupList());
|
||||
}
|
||||
}else{
|
||||
for(Map<String,Object> m:cfgList){
|
||||
String regionTable = m.get("tableName").toString();
|
||||
if("1".equals(m.get("cfgType"))){
|
||||
ipList.addAll(configSynchronizationDao.getIpPortList(regionTable, compileIds));
|
||||
}else if("2".equals(m.get("cfgType"))){
|
||||
strList.addAll(configSynchronizationDao.getStrList(regionTable,compileIds));
|
||||
//512/521/514/1026业务的用户自定义域取DOMAIN_STR取自Keyword
|
||||
if(/*entity.getServiceId()==512
|
||||
||*/entity.getServiceId()==521
|
||||
||entity.getServiceId()==514
|
||||
||entity.getServiceId()==1026) {
|
||||
keywordMap=configSynchronizationDao.getCompileIdWithKeyword(regionTable, compileIds);
|
||||
}
|
||||
|
||||
}else if("3".equals(m.get("cfgType"))){
|
||||
complexStrList.addAll(configSynchronizationDao.getComplexStrList(regionTable,compileIds));
|
||||
}else if("4".equals(m.get("cfgType"))){
|
||||
|
||||
}else if("5".equals(m.get("cfgType"))){
|
||||
fileList.addAll(configSynchronizationDao.getFileDigestList(regionTable, compileIds));
|
||||
}
|
||||
}else if("3".equals(m.get("cfgType"))){
|
||||
complexStrList.addAll(configSynchronizationDao.getComplexStrList(regionTable,compileIds));
|
||||
}else if("4".equals(m.get("cfgType"))){
|
||||
|
||||
}else if("5".equals(m.get("cfgType"))){
|
||||
fileList.addAll(configSynchronizationDao.getFileDigestList(regionTable, compileIds));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//批量获取regionId,groupId(相同编译下的IP类配置多条ip只获取一个组号),分组复用的域配置不需要重新获取regionId,groupId
|
||||
List<Integer> regionIds = ConfigServiceUtil.getId(3, ipList.size()+strList.size()+complexStrList.size()+numList.size()+fileList.size());
|
||||
List<Integer> groupIds = ConfigServiceUtil.getId(2, ipList.size()+strList.size()+complexStrList.size()+numList.size()+fileList.size());
|
||||
List<Integer> regionIds=new ArrayList<>(),groupIds=new ArrayList<>();
|
||||
if(!isCommonGroup){
|
||||
regionIds = ConfigServiceUtil.getId(3, ipList.size()+strList.size()+complexStrList.size()+numList.size()+fileList.size());
|
||||
groupIds = ConfigServiceUtil.getId(2, ipList.size()+strList.size()+complexStrList.size()+numList.size()+fileList.size());
|
||||
}
|
||||
entity.setIsValid(isValid);//将最新的配置状态赋给配置对象
|
||||
entity.setAuditTime(updateTime);
|
||||
for(CfgIndexInfo cfg:list){
|
||||
@@ -175,169 +198,237 @@ public class SchedulerTaskUtil {
|
||||
numRegionList = new ArrayList();
|
||||
digestRegionList = new ArrayList();
|
||||
areaIpRegionList = new ArrayList();
|
||||
List list1 = new ArrayList();
|
||||
List<BaseStringCfg> list2 = new ArrayList();
|
||||
List<ComplexkeywordCfg> list3 = new ArrayList();
|
||||
List<com.nis.domain.configuration.NumBoundaryCfg> list4 = new ArrayList();
|
||||
List<FileDigestCfg> list5 = new ArrayList();
|
||||
String userRegion = "";
|
||||
//处理自定义域
|
||||
if(userRegionList!=null){
|
||||
for(Map<String,Object> n:userRegionList){
|
||||
Object userRegionPosition = n.get("userRegionPosition");
|
||||
if(userRegionPosition!=null && (userRegionPosition.toString().equals("1")||userRegionPosition.toString().equals("0"))){
|
||||
//通过反射机制获取自定义域字段值
|
||||
String regionColumn = n.get("regionColumn").toString();
|
||||
String regionKey = n.get("regionKey").toString();
|
||||
Object value = "";
|
||||
Class aClass = null;
|
||||
if(userRegionPosition.toString().equals(("0"))){
|
||||
aClass = BaseCfg.class;
|
||||
}else{
|
||||
aClass = CfgIndexInfo.class;
|
||||
}
|
||||
if(entity.getServiceId().equals(517)||entity.getServiceId().equals(560)){//代理替换策略
|
||||
String[] regionArray = regionColumn.split(",");
|
||||
for(int r=0;r<regionArray.length;r++){
|
||||
Field field = aClass.getDeclaredField(regionArray[r]);
|
||||
field.setAccessible(true);
|
||||
if(n.get("regionKey").equals("substitute")){
|
||||
value += "/"+BaseService.replaceContentEscape(field.get(cfg)==null?"":field.get(cfg).toString());//自定义域以/分割时的处理
|
||||
}else{
|
||||
value += BaseService.replaceContentEscape(field.get(cfg)==null?"":field.get(cfg).toString());
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(cfg.getCommonGroupIds())){//公共分组
|
||||
//处理自定义域
|
||||
StringBuffer userRegion = new StringBuffer();
|
||||
if(cfg.getServiceId().equals(512)){
|
||||
cfg.setAction(2);
|
||||
userRegion.append(ConfigConvertUtil.generateCommonGroupDefaultUserRegion(null,cfg.getServiceId()));
|
||||
}else if(cfg.getServiceId().equals(576)){
|
||||
userRegion.append(ConfigConvertUtil.generateCommonGroupDefaultUserRegion(null,cfg.getServiceId()));
|
||||
}
|
||||
//子配置
|
||||
Map<String,Object> maatTableMap=ConfigConvertUtil.convertCommonGroupMaatTable(cfg,cfgList);
|
||||
//IP公共分组
|
||||
if(CollectionUtils.isNotEmpty(cfg.getIpCommGroupCfgList())){
|
||||
IpPortCfg _cfg = new IpPortCfg();
|
||||
BeanUtils.copyProperties(cfg, _cfg, new String[]{"cfgId","menuNameCode"});
|
||||
Map<String,List> map = ConfigConvertUtil.objGroupCfgConvert(ipRegionList,cfg.getIpCommGroupCfgList(),1,_cfg,groupRelationList,maatTableMap,groupIdSet);
|
||||
groupRelationList=map.get("groupList");
|
||||
ipRegionList=map.get("dstList");
|
||||
if(map.get("numRegionList")!=null){
|
||||
numRegionList.addAll(map.get("numRegionList"));
|
||||
}
|
||||
|
||||
}
|
||||
//URL公共分组
|
||||
if(CollectionUtils.isNotEmpty(cfg.getUrlCommGroupList())){
|
||||
CommonStringCfg _cfg = new CommonStringCfg();
|
||||
BeanUtils.copyProperties(cfg, _cfg, new String[]{"cfgId","menuNameCode"});
|
||||
Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(strRegionList,cfg.getUrlCommGroupList(),2,_cfg,groupRelationList,maatTableMap,groupIdSet);
|
||||
groupRelationList=map.get("groupList");
|
||||
strRegionList=map.get("dstList");
|
||||
}
|
||||
//账号公共分组
|
||||
if(CollectionUtils.isNotEmpty(cfg.getScriberIdCommGroupList())){
|
||||
CommonStringCfg _cfg = new CommonStringCfg();
|
||||
BeanUtils.copyProperties(cfg, _cfg, new String[]{"cfgId","menuNameCode"});
|
||||
|
||||
Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(strRegionList,cfg.getScriberIdCommGroupList(),2,_cfg,groupRelationList,maatTableMap,groupIdSet);
|
||||
groupRelationList=map.get("groupList");
|
||||
strRegionList=map.get("dstList");
|
||||
|
||||
}
|
||||
//域名公共分组
|
||||
if(CollectionUtils.isNotEmpty(cfg.getDomainCommGroupList())){
|
||||
CommonStringCfg _cfg = new CommonStringCfg();
|
||||
BeanUtils.copyProperties(cfg, _cfg, new String[]{"cfgId","menuNameCode"});
|
||||
|
||||
Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(strRegionList,cfg.getDomainCommGroupList(),2,_cfg,groupRelationList,maatTableMap,groupIdSet);
|
||||
groupRelationList=map.get("groupList");
|
||||
strRegionList=map.get("dstList");
|
||||
}
|
||||
BeanUtils.copyProperties(cfg, maatCfg);
|
||||
maatCfg.setAction(cfg.getAction());
|
||||
maatCfg.setAuditTime(StringUtil.isEmpty(entity.getAuditTime()) ? cfg.getAuditTime():entity.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(entity.getIsValid());
|
||||
if(!StringUtil.isEmpty(userRegion.toString())){
|
||||
maatCfg.setUserRegion(userRegion.toString());
|
||||
}
|
||||
configCompileList.add(maatCfg);
|
||||
}else{//非公共分组
|
||||
List list1 = new ArrayList();
|
||||
List<BaseStringCfg> list2 = new ArrayList();
|
||||
List<ComplexkeywordCfg> list3 = new ArrayList();
|
||||
List<com.nis.domain.configuration.NumBoundaryCfg> list4 = new ArrayList();
|
||||
List<FileDigestCfg> list5 = new ArrayList();
|
||||
String userRegion = "";
|
||||
//处理自定义域
|
||||
if(userRegionList!=null){
|
||||
for(Map<String,Object> n:userRegionList){
|
||||
Object userRegionPosition = n.get("userRegionPosition");
|
||||
if(userRegionPosition!=null && (userRegionPosition.toString().equals("1")||userRegionPosition.toString().equals("0"))){
|
||||
//通过反射机制获取自定义域字段值
|
||||
String regionColumn = n.get("regionColumn").toString();
|
||||
String regionKey = n.get("regionKey").toString();
|
||||
Object value = "";
|
||||
Class aClass = null;
|
||||
if(userRegionPosition.toString().equals(("0"))){
|
||||
aClass = BaseCfg.class;
|
||||
}else{
|
||||
aClass = CfgIndexInfo.class;
|
||||
}
|
||||
userRegion += n.get("regionKey")+"="+value+Constants.USER_REGION_SPLIT;
|
||||
}else{
|
||||
if(entity.getServiceId().equals(517)||entity.getServiceId().equals(560)){//代理替换策略
|
||||
String[] regionArray = regionColumn.split(",");
|
||||
for(int r=0;r<regionArray.length;r++){
|
||||
Field field = aClass.getDeclaredField(regionArray[r]);
|
||||
field.setAccessible(true);
|
||||
if(n.get("regionKey").equals("substitute")){
|
||||
value += "/"+BaseService.replaceContentEscape(field.get(cfg)==null?"":field.get(cfg).toString());//自定义域以/分割时的处理
|
||||
}else{
|
||||
value += BaseService.replaceContentEscape(field.get(cfg)==null?"":field.get(cfg).toString());
|
||||
}
|
||||
|
||||
}
|
||||
userRegion += n.get("regionKey")+"="+value+Constants.USER_REGION_SPLIT;
|
||||
}else{
|
||||
/*if(regionKey.equals("keyring_id") && StringUtil.isEmpty(value)){
|
||||
value = "0";
|
||||
}else*/ if(regionKey.equals("DOMAIN_STR")) {
|
||||
if(!StringUtil.isEmpty(keywordMap) && !StringUtil.isEmpty(keywordMap.get(cfg.getCompileId()))) {
|
||||
value = keywordMap.get(cfg.getCompileId()).getCfgKeywords();
|
||||
if(!StringUtil.isEmpty(keywordMap) && !StringUtil.isEmpty(keywordMap.get(cfg.getCompileId()))) {
|
||||
value = keywordMap.get(cfg.getCompileId()).getCfgKeywords();
|
||||
}
|
||||
}else if(regionKey.equals("DOMAIN_ID")) {
|
||||
if(!StringUtil.isEmpty(keywordMap) && !StringUtil.isEmpty(keywordMap.get(cfg.getCompileId()))) {
|
||||
value = cfg.getCompileId();
|
||||
}
|
||||
|
||||
}else {
|
||||
Field field = aClass.getDeclaredField(regionColumn);
|
||||
field.setAccessible(true);
|
||||
value = field.get(cfg);
|
||||
}
|
||||
}else if(regionKey.equals("DOMAIN_ID")) {
|
||||
if(!StringUtil.isEmpty(keywordMap) && !StringUtil.isEmpty(keywordMap.get(cfg.getCompileId()))) {
|
||||
value = cfg.getCompileId();
|
||||
}
|
||||
|
||||
}else {
|
||||
Field field = aClass.getDeclaredField(regionColumn);
|
||||
field.setAccessible(true);
|
||||
value = field.get(cfg);
|
||||
}
|
||||
if(!StringUtil.isEmpty(value)){
|
||||
if(StringUtil.isEmpty(n.get("regionKey"))){
|
||||
userRegion = value.toString();
|
||||
}else{
|
||||
userRegion += n.get("regionKey")+"="+value+Constants.USER_REGION_SPLIT;
|
||||
if(!StringUtil.isEmpty(value)){
|
||||
if(StringUtil.isEmpty(n.get("regionKey"))){
|
||||
userRegion = value.toString();
|
||||
}else{
|
||||
userRegion += n.get("regionKey")+"="+value+Constants.USER_REGION_SPLIT;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(userRegion.endsWith(Constants.USER_REGION_SPLIT)){
|
||||
userRegion = userRegion.substring(0, userRegion.length()-1);
|
||||
}
|
||||
}
|
||||
if(userRegion.endsWith(Constants.USER_REGION_SPLIT)){
|
||||
userRegion = userRegion.substring(0, userRegion.length()-1);
|
||||
// Proxy Block --xml无法描述的user_region
|
||||
if(entity.getServiceId().equals(576)) {
|
||||
ManipulatActionParam actionParam = new ManipulatActionParam();
|
||||
actionParam.setMethod("block");
|
||||
actionParam.setCode(Integer.valueOf(cfg.getUserRegion1()));
|
||||
actionParam.setMessage(!StringUtil.isBlank(cfg.getUserRegion2()) ? cfg.getUserRegion2():"");
|
||||
actionParam.setHtml_profile(Integer.valueOf(!StringUtil.isBlank(cfg.getUserRegion3()) ? cfg.getUserRegion3():"0"));
|
||||
userRegion = StringEscapeUtils.unescapeJson(BaseService.gsonToJson(actionParam));
|
||||
}
|
||||
}
|
||||
// Proxy Block --xml无法描述的user_region
|
||||
if(entity.getServiceId().equals(576)) {
|
||||
ManipulatActionParam actionParam = new ManipulatActionParam();
|
||||
actionParam.setMethod("block");
|
||||
actionParam.setCode(Integer.valueOf(cfg.getUserRegion1()));
|
||||
actionParam.setMessage(!StringUtil.isBlank(cfg.getUserRegion2()) ? cfg.getUserRegion2():"");
|
||||
actionParam.setHtml_profile(Integer.valueOf(!StringUtil.isBlank(cfg.getUserRegion3()) ? cfg.getUserRegion3():"0"));
|
||||
userRegion = StringEscapeUtils.unescapeJson(BaseService.gsonToJson(actionParam));
|
||||
}
|
||||
|
||||
// Proxy Manipulate
|
||||
if(entity.getServiceId().equals(656)) {
|
||||
userRegion = BaseService.setUserRegionOfMantipulateCfg(cfg, userRegion);
|
||||
}
|
||||
//Intercept Policy、http(s) 监测 、http(s) 白名单
|
||||
else if(entity.getServiceId().equals(521) || entity.getServiceId().equals(592)
|
||||
|| entity.getServiceId().equals(750)) {
|
||||
userRegion="{}";
|
||||
}
|
||||
for(AsnIpCfg ip:asnIpList){//asn不需要再次获取regionId,groupId
|
||||
if(ip.getAsnIpGroup().toString().equals(cfg.getUserRegion4())){//根据组号对应
|
||||
ip.setIsValid(entity.getIsValid());
|
||||
ip.setAuditTime(StringUtil.isEmpty(entity.getAuditTime()) ? cfg.getAuditTime():entity.getAuditTime());
|
||||
list1.add(ip);
|
||||
|
||||
// Proxy Manipulate
|
||||
if(entity.getServiceId().equals(656)) {
|
||||
userRegion = BaseService.setUserRegionOfMantipulateCfg(cfg, userRegion);
|
||||
}
|
||||
}
|
||||
//ip spoofing
|
||||
if(cfg.getServiceId().equals(518)){
|
||||
//IP仿冒策略
|
||||
//仿冒IP池配置匹配下发或者取消
|
||||
PxyObjSpoofingIpPool pool=new PxyObjSpoofingIpPool();
|
||||
pool.setCfgId(Long.valueOf(cfg.getUserRegion3()));
|
||||
//Intercept Policy、http(s) 监测 、http(s) 白名单
|
||||
else if(entity.getServiceId().equals(521) || entity.getServiceId().equals(592)
|
||||
|| entity.getServiceId().equals(750)) {
|
||||
userRegion="{}";
|
||||
}
|
||||
for(AsnIpCfg ip:asnIpList){//asn不需要再次获取regionId,groupId
|
||||
if(ip.getAsnIpGroup().toString().equals(cfg.getUserRegion4())){//根据组号对应
|
||||
ip.setIsValid(entity.getIsValid());
|
||||
ip.setAuditTime(StringUtil.isEmpty(entity.getAuditTime()) ? cfg.getAuditTime():entity.getAuditTime());
|
||||
list1.add(ip);
|
||||
}
|
||||
}
|
||||
//ip spoofing
|
||||
if(cfg.getServiceId().equals(518)){
|
||||
//IP仿冒策略
|
||||
//仿冒IP池配置匹配下发或者取消
|
||||
PxyObjSpoofingIpPool pool=new PxyObjSpoofingIpPool();
|
||||
pool.setCfgId(Long.valueOf(cfg.getUserRegion3()));
|
||||
// pxyObjSpoofingIpPoolDao.update(pool);
|
||||
pool = configSynchronizationDao.getPxyObjSpoofingIpPool(pool.getCfgId());
|
||||
pool.setIsValid(entity.getIsValid());
|
||||
pool.setIsAudit(entity.getIsAudit());
|
||||
pool.setAuditorId(entity.getAuditorId());
|
||||
pool.setAuditTime(entity.getAuditTime());
|
||||
List<PxyObjSpoofingIpPool> poolList = new ArrayList<PxyObjSpoofingIpPool>();
|
||||
String json="";
|
||||
String areaEffectiveIds="0";
|
||||
if(isValid==1){
|
||||
pool.setAreaEffectiveIds(areaEffectiveIds);
|
||||
pool.setGroupId(pool.getCfgId().intValue());//界面端的配置ID作为策略分组ID
|
||||
poolList.add(pool);
|
||||
//调用服务接口下发配置数据
|
||||
json=BaseService.gsonToJson(poolList);
|
||||
logger.info("欺骗IP池配置下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
try {
|
||||
ToMaatResult result = ConfigServiceUtil.postCallbackCfg(json);
|
||||
if(result!=null){
|
||||
logger.info("欺骗IP池配置下发响应信息:"+result.getMsg());
|
||||
pool = configSynchronizationDao.getPxyObjSpoofingIpPool(pool.getCfgId());
|
||||
pool.setIsValid(entity.getIsValid());
|
||||
pool.setIsAudit(entity.getIsAudit());
|
||||
pool.setAuditorId(entity.getAuditorId());
|
||||
pool.setAuditTime(entity.getAuditTime());
|
||||
List<PxyObjSpoofingIpPool> poolList = new ArrayList<PxyObjSpoofingIpPool>();
|
||||
String json="";
|
||||
String areaEffectiveIds="0";
|
||||
if(isValid==1){
|
||||
pool.setAreaEffectiveIds(areaEffectiveIds);
|
||||
pool.setGroupId(pool.getCfgId().intValue());//界面端的配置ID作为策略分组ID
|
||||
poolList.add(pool);
|
||||
//调用服务接口下发配置数据
|
||||
json=BaseService.gsonToJson(poolList);
|
||||
logger.info("欺骗IP池配置下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
try {
|
||||
ToMaatResult result = ConfigServiceUtil.postCallbackCfg(json);
|
||||
if(result!=null){
|
||||
logger.info("欺骗IP池配置下发响应信息:"+result.getMsg());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("欺骗IP池配置配置下发失败",e);
|
||||
throw e;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("欺骗IP池配置配置下发失败",e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
if(list1.size()>0){
|
||||
GroupCfg groupCfg=new GroupCfg();
|
||||
groupCfg.setCompileId(cfg.getCompileId());
|
||||
groupCfg.setGroupId(Integer.parseInt(cfg.getUserRegion4()));
|
||||
groupCfg.setIsValid(entity.getIsValid());
|
||||
groupCfg.setAuditTime(StringUtil.isEmpty(entity.getAuditTime()) ? cfg.getAuditTime():entity.getAuditTime());
|
||||
groupRelationList.add(groupCfg);
|
||||
ipRegionList.addAll(ConfigConvertUtil.groupReuseCfgAddRemoveConvert(list1,Constants.VALID_YES,null));
|
||||
}else if(!StringUtil.isEmpty(asnGroupIds)) {
|
||||
GroupCfg groupCfg=new GroupCfg();
|
||||
groupCfg.setCompileId(cfg.getCompileId());
|
||||
groupCfg.setGroupId(Integer.parseInt(cfg.getUserRegion4()));
|
||||
groupCfg.setIsValid(entity.getIsValid());
|
||||
groupCfg.setAuditTime(StringUtil.isEmpty(entity.getAuditTime()) ? cfg.getAuditTime():entity.getAuditTime());
|
||||
groupRelationList.add(groupCfg);
|
||||
ipRegionList.addAll(ipRegionList);
|
||||
}
|
||||
//配置域转换
|
||||
userRegion = ConfigConvertUtil.configCovert(ipList,strList,complexStrList,
|
||||
numList,fileList,regionIds,groupIds,entity,cfg.getCompileId(),
|
||||
StringUtil.isEmpty(entity.getAuditTime()) ? cfg.getAuditTime():entity.getAuditTime(),
|
||||
groupRelationList,ipRegionList,strRegionList,numRegionList,digestRegionList,areaIpRegionList,userRegion);
|
||||
|
||||
BeanUtils.copyProperties(cfg, maatCfg);
|
||||
maatCfg.setAction(cfg.getAction());
|
||||
maatCfg.setAuditTime(StringUtil.isEmpty(entity.getAuditTime()) ? cfg.getAuditTime():entity.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(entity.getIsValid());
|
||||
if(!StringUtil.isEmpty(userRegion)){
|
||||
maatCfg.setUserRegion(userRegion);
|
||||
}
|
||||
configCompileList.add(maatCfg);
|
||||
}
|
||||
if(list1.size()>0){
|
||||
GroupCfg groupCfg=new GroupCfg();
|
||||
groupCfg.setCompileId(cfg.getCompileId());
|
||||
groupCfg.setGroupId(Integer.parseInt(cfg.getUserRegion4()));
|
||||
groupCfg.setIsValid(entity.getIsValid());
|
||||
groupCfg.setAuditTime(StringUtil.isEmpty(entity.getAuditTime()) ? cfg.getAuditTime():entity.getAuditTime());
|
||||
groupRelationList.add(groupCfg);
|
||||
ipRegionList.addAll(ConfigConvertUtil.groupReuseCfgAddRemoveConvert(list1,Constants.VALID_YES,null));
|
||||
}else if(!StringUtil.isEmpty(asnGroupIds)) {
|
||||
GroupCfg groupCfg=new GroupCfg();
|
||||
groupCfg.setCompileId(cfg.getCompileId());
|
||||
groupCfg.setGroupId(Integer.parseInt(cfg.getUserRegion4()));
|
||||
groupCfg.setIsValid(entity.getIsValid());
|
||||
groupCfg.setAuditTime(StringUtil.isEmpty(entity.getAuditTime()) ? cfg.getAuditTime():entity.getAuditTime());
|
||||
groupRelationList.add(groupCfg);
|
||||
ipRegionList.addAll(ipRegionList);
|
||||
}
|
||||
//配置域转换
|
||||
userRegion = ConfigConvertUtil.configCovert(ipList,strList,complexStrList,
|
||||
numList,fileList,regionIds,groupIds,entity,cfg.getCompileId(),
|
||||
StringUtil.isEmpty(entity.getAuditTime()) ? cfg.getAuditTime():entity.getAuditTime(),
|
||||
groupRelationList,ipRegionList,strRegionList,numRegionList,digestRegionList,areaIpRegionList,userRegion);
|
||||
|
||||
BeanUtils.copyProperties(cfg, maatCfg);
|
||||
maatCfg.setAction(cfg.getAction());
|
||||
maatCfg.setAuditTime(StringUtil.isEmpty(entity.getAuditTime()) ? cfg.getAuditTime():entity.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(entity.getIsValid());
|
||||
if(!StringUtil.isEmpty(userRegion)){
|
||||
maatCfg.setUserRegion(userRegion);
|
||||
}
|
||||
configCompileList.add(maatCfg);
|
||||
|
||||
}
|
||||
maatBean.setConfigCompileList(configCompileList);
|
||||
maatBean.setAuditTime(new Date());
|
||||
@@ -1019,5 +1110,28 @@ public class SchedulerTaskUtil {
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
|
||||
}
|
||||
private void covertCommongroupIdsMap(Map commGroupMap,String key,CfgIndexInfo cfg,ConfigSynchronizationDao configSynchronizationDao,Class clazz){
|
||||
if(commGroupMap.containsKey(key)){
|
||||
String groups=commGroupMap.get(key).toString();
|
||||
List<Integer> _groupIds=new ArrayList<>();
|
||||
for(String group:groups.split(",")){
|
||||
if(StringUtils.isNotBlank(group)){
|
||||
_groupIds.add(Integer.parseInt(group));
|
||||
}
|
||||
}
|
||||
if(_groupIds.size()>0){
|
||||
if("IpCommCfg".equals(clazz.getSimpleName())){
|
||||
cfg.setIpCommGroupCfgList(configSynchronizationDao.getIpCommCfgPortList(_groupIds));
|
||||
}else if("UrlCommCfg".equals(clazz.getSimpleName())){
|
||||
cfg.setUrlCommGroupList(configSynchronizationDao.getUrlCommCfgPortList(_groupIds));
|
||||
}else if("ScriberIdCommCfg".equals(clazz.getSimpleName())){
|
||||
cfg.setScriberIdCommGroupList(configSynchronizationDao.getSubscribeIdCommCfgPortList(_groupIds));
|
||||
}else if("DomainCommCfg".equals(clazz.getSimpleName())){
|
||||
cfg.setDomainCommGroupList(configSynchronizationDao.getDomainCommCfgPortList(_groupIds));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class ConfigSynchronizationController extends BaseController {
|
||||
Map<String,Integer> map = new HashMap();
|
||||
map.put("syncStatus", cmd);
|
||||
JSONObject result = ConfigServiceUtil.configSyncCmd(BaseService.gsonToJson(map));
|
||||
//JSONObject result=JSONObject.fromObject("{\"status\": 201,\"businessCode\": 2001000,\"reason\":\"数据获取操作成功\",\"msg\": \"根据配置id获取对应的编译,组,域等信息成功\",\"fromuri\": \"/galaxy-service/service/cfg/v1/getAllKVByCompileId\",\"traceCode\": \"2019031211285044813363\",\"data\": [{\"service\":\"ntc\",\"status\":0,\"opTime\":\"2016-11-22 08:31:27\"}]}");
|
||||
// JSONObject result=JSONObject.fromObject("{\"status\": 201,\"businessCode\": 2001000,\"reason\":\"数据获取操作成功\",\"msg\": \"根据配置id获取对应的编译,组,域等信息成功\",\"fromuri\": \"/galaxy-service/service/cfg/v1/getAllKVByCompileId\",\"traceCode\": \"2019031211285044813363\",\"data\": [{\"service\":\"ntc\",\"status\":0,\"opTime\":\"2016-11-22 08:31:27\"}]}");
|
||||
if(result.get("status").equals(201)){//响应成功
|
||||
if(cmd.equals(1)){//同步
|
||||
SysDataDictionaryName sysDictName = new SysDataDictionaryName();
|
||||
|
||||
@@ -0,0 +1,441 @@
|
||||
package com.nis.web.controller.configuration;
|
||||
|
||||
|
||||
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.PolicyGroupInfo;
|
||||
import com.nis.domain.configuration.BaseCfg;
|
||||
import com.nis.domain.configuration.CachePolicyUserRegion;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.ObjGroupCfg;
|
||||
import com.nis.exceptions.CallExternalProceduresException;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.configuration.ObjectGroupService;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.*;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/objgroup")
|
||||
public class ObjectGroupController extends BaseController {
|
||||
@Autowired
|
||||
private ObjectGroupService objectGroupService;
|
||||
@RequestMapping(value = { "/list" })
|
||||
public String list(Model model, @ModelAttribute("cfg") CfgIndexInfo cfg, HttpServletRequest request,
|
||||
HttpServletResponse response){
|
||||
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
Page<CfgIndexInfo> page = objectGroupService.getPolicyListList(searchPage, cfg);
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,cfg);
|
||||
return "/cfg/objgroup/list";
|
||||
}
|
||||
@RequestMapping(value = { "/form" })
|
||||
@RequiresPermissions(value = { "objgroup:config" })
|
||||
public String form(Model model, String ids, CfgIndexInfo entity) {
|
||||
List<PolicyGroupInfo> ipGroups=new ArrayList<>();
|
||||
List<PolicyGroupInfo> urlGroups=new ArrayList<>();
|
||||
List<PolicyGroupInfo> subscribeIdGroups=new ArrayList<>();
|
||||
List<PolicyGroupInfo> domainGroups=new ArrayList<>();
|
||||
//查询所有可选择(没有被其他配置引用,并且组下有域配置的组,ud_flag=1)
|
||||
ipGroups=policyGroupInfoService.findPolicyGroupInfosByTypeforUD(Constants.IP_OBJ_GROUP_TYPE,1);
|
||||
urlGroups=policyGroupInfoService.findPolicyGroupInfosByTypeforUD(Constants.URL_OBJ_GROUP_TYPE,1);
|
||||
subscribeIdGroups=policyGroupInfoService.findPolicyGroupInfosByTypeforUD(Constants.SUBID_OBJ_GROUP_TYPE,1);
|
||||
domainGroups=policyGroupInfoService.findPolicyGroupInfosByTypeforUD(Constants.DOMAIN_OBJ_GROUP_TYPE,1);
|
||||
if (StringUtils.isNotBlank(ids)) {
|
||||
entity = objectGroupService.getObjectGroupCfg(Long.parseLong(ids), null);
|
||||
initUpdateFormCondition(model, entity);
|
||||
//查询配置引用到的分组,加到对应的组下(维持选中选项)
|
||||
if(MapUtils.isNotEmpty(entity.getUserRegion())){
|
||||
for(Map.Entry<String,Object> e:entity.getUserRegion().entrySet()){
|
||||
if(e.getKey().equals("ipGroup")&&StringUtils.isNotBlank(e.getValue().toString())){
|
||||
List<PolicyGroupInfo> _ipGrpups=policyGroupInfoService.findPolicyByServiceGroupInfoList(e.getValue().toString());
|
||||
if(CollectionUtils.isNotEmpty(_ipGrpups)){
|
||||
ipGroups.addAll(_ipGrpups);
|
||||
}
|
||||
}else if(e.getKey().equals("urlGroup")&&StringUtils.isNotBlank(e.getValue().toString())){
|
||||
List<PolicyGroupInfo> _urlGrpups=policyGroupInfoService.findPolicyByServiceGroupInfoList(e.getValue().toString());
|
||||
if(CollectionUtils.isNotEmpty(_urlGrpups)){
|
||||
urlGroups.addAll(_urlGrpups);
|
||||
}
|
||||
}else if(e.getKey().equals("subscribeIdGroup")&&StringUtils.isNotBlank(e.getValue().toString())){
|
||||
List<PolicyGroupInfo> _subscribeIdGroups=policyGroupInfoService.findPolicyByServiceGroupInfoList(e.getValue().toString());
|
||||
if(CollectionUtils.isNotEmpty(_subscribeIdGroups)){
|
||||
subscribeIdGroups.addAll(_subscribeIdGroups);
|
||||
}
|
||||
}else if(e.getKey().equals("domainGroup")&&StringUtils.isNotBlank(e.getValue().toString())){
|
||||
List<PolicyGroupInfo> _domainGroups=policyGroupInfoService.findPolicyByServiceGroupInfoList(e.getValue().toString());
|
||||
if(CollectionUtils.isNotEmpty(_domainGroups)){
|
||||
domainGroups.addAll(_domainGroups);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
initFormCondition(model, entity);
|
||||
}
|
||||
model.addAttribute("ipGroups", ipGroups);
|
||||
model.addAttribute("urlGroups", urlGroups);
|
||||
model.addAttribute("subscribeIdGroups", subscribeIdGroups);
|
||||
model.addAttribute("domainGroups", domainGroups);
|
||||
model.addAttribute("_cfg", entity);
|
||||
return "/cfg/objgroup/form";
|
||||
}
|
||||
@RequestMapping(value = {"saveOrUpdate"})
|
||||
@RequiresPermissions(value={"objgroup:config"})
|
||||
public String saveOrUpdate(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg")CfgIndexInfo cfg, RedirectAttributes redirectAttributes){
|
||||
try{
|
||||
String ipGroup=formatMultSelect(request.getParameterValues("ipGroup")),
|
||||
subscribeIdGroup=formatMultSelect(request.getParameterValues("subscribeIdGroup")),
|
||||
domainGroup=formatMultSelect(request.getParameterValues("domainGroup")),
|
||||
urlGroup=formatMultSelect(request.getParameterValues("urlGroup"));
|
||||
|
||||
Map<String,Object> map = new HashMap();
|
||||
if(StringUtils.isNotBlank(ipGroup)){
|
||||
map.put("ipGroup", ipGroup.toString());
|
||||
}
|
||||
if(StringUtils.isNotBlank(subscribeIdGroup)){
|
||||
map.put("subscribeIdGroup", subscribeIdGroup.toString());
|
||||
}
|
||||
if(StringUtils.isNotBlank(domainGroup)){
|
||||
map.put("domainGroup", domainGroup.toString());
|
||||
}
|
||||
if(StringUtils.isNotBlank(urlGroup)){
|
||||
map.put("urlGroup", urlGroup.toString());
|
||||
}
|
||||
cfg.setUserRegion(map);
|
||||
objectGroupService.saveOrUpdate(cfg);
|
||||
//配置仅保存
|
||||
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
}else {
|
||||
//配置直接生效
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
}
|
||||
} catch (MaatConvertException e) {
|
||||
logger.error("对象组配置下发失败:",e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (CallExternalProceduresException e) {
|
||||
logger.error("调用外部程序出错:",e);
|
||||
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
logger.error("对象组配置保存失败:",e);
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/objgroup/list?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
@RequestMapping(value = {"updateValid"})
|
||||
@RequiresPermissions(value={"objgroup:config"})
|
||||
public String delete(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg){
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
objectGroupService.updatePolicyValid(isValid,ids,functionId);
|
||||
}else {
|
||||
// 批量删除
|
||||
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
deleteAll(searchPage, functionId, cfg);
|
||||
}
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("配置删除失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath +"/objgroup/list?functionId="+functionId;
|
||||
}
|
||||
/**
|
||||
* 界面批量删除当前检索条件下的配置
|
||||
* @param page
|
||||
* @param functionId
|
||||
* @param entity
|
||||
* @throws Exception
|
||||
*/
|
||||
public void deleteAll(Page page,Integer functionId, Object entity)throws Exception {
|
||||
long start=System.currentTimeMillis();
|
||||
page.setOrderBy("");
|
||||
page.setPageSize(Constants.MAAT_JSON_SEND_SIZE);
|
||||
page.setPageNo(1);
|
||||
page.setLastPage(false);
|
||||
|
||||
CfgIndexInfo searchCfg = new CfgIndexInfo();
|
||||
|
||||
// 传递检索条件
|
||||
if(entity != null && (entity instanceof CfgIndexInfo)) {
|
||||
BeanUtils.copyProperties(entity, searchCfg);
|
||||
searchCfg.setFunctionId(functionId);
|
||||
}
|
||||
|
||||
BaseCfg batchCfg = new BaseCfg();
|
||||
batchCfg.setIsValid(-1);
|
||||
batchCfg.setIsAudit(0);
|
||||
batchCfg.setEditTime(new Date());
|
||||
batchCfg.setEditorId(UserUtils.getUser().getId());
|
||||
//cfg_index_info表中存有servicdId
|
||||
boolean hasData = true;
|
||||
while(hasData){
|
||||
page.setPageNo(1);
|
||||
page.setLastPage(false);
|
||||
List<CfgIndexInfo> list = getDataList(page,searchCfg); //获取主配置表数据
|
||||
if(CollectionUtils.isNotEmpty(list)){
|
||||
StringBuffer serviceGroupIds=new StringBuffer();
|
||||
List<BaseCfg> baseCfgList=new ArrayList<>();
|
||||
for (CfgIndexInfo cfg : list) {
|
||||
if(cfg.getUserRegion()!=null){
|
||||
for (Object val:cfg.getUserRegion().values()) {
|
||||
if(StringUtils.isNotBlank(val.toString())){
|
||||
if(val.toString().startsWith(",")){
|
||||
serviceGroupIds.append(val.toString().substring(1));
|
||||
}else{
|
||||
serviceGroupIds.append(val.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
BaseCfg baseCfg=new BaseCfg();
|
||||
BeanUtils.copyProperties(cfg, baseCfg);
|
||||
baseCfgList.add(baseCfg);
|
||||
}
|
||||
if(serviceGroupIds.lastIndexOf(",")==(serviceGroupIds.toString().length()-1)){
|
||||
serviceGroupIds.deleteCharAt(serviceGroupIds.toString().length()-1);
|
||||
}
|
||||
hasData = objectGroupService.batchDeleteMaatData(page, batchCfg, baseCfgList, hasData,serviceGroupIds.toString());
|
||||
}else{
|
||||
hasData = false;
|
||||
}
|
||||
}
|
||||
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("配置批量删除耗时:"+(end-start));
|
||||
|
||||
}
|
||||
public List getDataList(Page searchPage
|
||||
,CfgIndexInfo searchCfg
|
||||
){
|
||||
BaseCfg baseCfg=new BaseCfg<>();
|
||||
if(!StringUtil.isEmpty(searchCfg)) {
|
||||
BeanUtils.copyProperties(searchCfg, baseCfg);
|
||||
}
|
||||
Page pageResult=new Page();
|
||||
pageResult=objectGroupService.getPolicyListList(searchPage,searchCfg);
|
||||
return pageResult.getList();
|
||||
}
|
||||
@RequestMapping(value = {"audit"})
|
||||
@RequiresPermissions(value={"objgroup:confirm"})
|
||||
public String audit(Model model,@ModelAttribute("cfg") CfgIndexInfo cfg,
|
||||
Integer isValid,
|
||||
Integer isAudit,
|
||||
String ids,
|
||||
Integer functionId,
|
||||
RedirectAttributes redirectAttributes,
|
||||
HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
CfgIndexInfo entity = new CfgIndexInfo();
|
||||
String[] idArray = ids.split(",");
|
||||
for(String id :idArray){
|
||||
entity = objectGroupService.getObjectGroupCfg(Long.parseLong(id),null);
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
objectGroupService.auditPolicy(entity,isAudit,Constants.INSERT_ACTION);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
} catch ( Exception e) {
|
||||
logger.error("策略对象组下发失败:"+e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}else {
|
||||
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"r");
|
||||
Page<CfgIndexInfo> auditPage=new Page<CfgIndexInfo>(request,response,"r");
|
||||
|
||||
try {
|
||||
BeanUtils.copyProperties(searchPage, auditPage);
|
||||
auditAll(auditPage,isValid , cfg);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("策略对象组下发失败:",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return list(model, cfg, request, response);
|
||||
}
|
||||
return "redirect:" + adminPath +"/objgroup/list?functionId="+functionId;
|
||||
}
|
||||
private String formatMultSelect(Object requestParameter){
|
||||
if(StringUtil.isEmpty(requestParameter)){
|
||||
return null;
|
||||
}else if(requestParameter.getClass().isArray()){
|
||||
String[] array=(String[])requestParameter;
|
||||
StringBuffer buf=new StringBuffer(",");
|
||||
for(String param:array){
|
||||
buf.append(param).append(",");
|
||||
}
|
||||
return buf.toString().length()==1?null:buf.toString();
|
||||
}else{
|
||||
return ","+requestParameter.toString()+",";
|
||||
}
|
||||
}
|
||||
@RequestMapping(value = { "/ajaxGetNames" })
|
||||
@ResponseBody
|
||||
public Map<String,Map<String,String>> ajaxGetNames(Model model, @RequestParam(required=true,value="groupIds")String group) {
|
||||
String _group=group.replaceAll("\\|",",");
|
||||
Map<String,Map<String,String>> datas=new HashMap<>();
|
||||
datas.put("ipGroup",new HashMap<String,String>());
|
||||
datas.put("urlGroup",new HashMap<String,String>());
|
||||
datas.put("subscribeIdGroup",new HashMap<String,String>());
|
||||
datas.put("domainGroup",new HashMap<String,String>());
|
||||
if(StringUtils.isNotBlank(group)){
|
||||
List<PolicyGroupInfo> infos=policyGroupInfoService.findPolicyByServiceGroupInfoList(_group);
|
||||
for(PolicyGroupInfo info:infos){
|
||||
for(String g:group.split("\\|")){
|
||||
if(objectGroupService.indexOfContains(g,",",info.getServiceGroupId().toString())){
|
||||
Map<String,String> map=null;
|
||||
if(info.getGroupType().equals(Constants.IP_OBJ_GROUP_TYPE)){
|
||||
map=datas.get("ipGroup");
|
||||
}else if(info.getGroupType().equals(Constants.URL_OBJ_GROUP_TYPE)){
|
||||
map=datas.get("urlGroup");
|
||||
}else if(info.getGroupType().equals(Constants.SUBID_OBJ_GROUP_TYPE)){
|
||||
map=datas.get("subscribeIdGroup");
|
||||
}else if(info.getGroupType().equals(Constants.DOMAIN_OBJ_GROUP_TYPE)){
|
||||
map=datas.get("domainGroup");
|
||||
}
|
||||
map.put(g,map.containsKey(g)?map.get(g)+info.getGroupName()+",":info.getGroupName()+",");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//删除最后的逗号
|
||||
for(Map<String,String> m:datas.values()){
|
||||
for(Map.Entry<String,String> e:m.entrySet()){
|
||||
if(e.getValue().endsWith(",")){
|
||||
m.put(e.getKey(),e.getValue().substring(0,e.getValue().length()-1));
|
||||
}
|
||||
}
|
||||
}
|
||||
return datas;
|
||||
}
|
||||
//http配置导出
|
||||
@RequestMapping(value = "exportObjGroup")
|
||||
public void exportdomain(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") ObjGroupCfg entity, String ids, RedirectAttributes redirectAttributes){
|
||||
try {
|
||||
//export data info
|
||||
List<String> titleList=new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap=new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap=new HashMap<String, List>();
|
||||
Map<String, String> noExportMap = new HashMap<String, String>();
|
||||
List<ObjGroupCfg> lists = new ArrayList<ObjGroupCfg>();
|
||||
Properties msgProp = getMsgProp();
|
||||
// 导出选中记录
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
lists = objectGroupService.getObjGroupList(ids,msgProp,entity.getFunctionId());
|
||||
} else {
|
||||
Page<ObjGroupCfg> pageInfo=new Page<ObjGroupCfg>(request, response,"a");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<ObjGroupCfg> page = objectGroupService.getObjGroup(pageInfo, entity,msgProp);
|
||||
lists = page.getList();
|
||||
}
|
||||
for(ObjGroupCfg c:lists){
|
||||
if(StringUtils.isNotBlank(c.getIpGroup())&&c.getIpGroup().startsWith(",")){
|
||||
c.setIpGroup(c.getIpGroup().substring(1));
|
||||
}
|
||||
if(StringUtils.isNotBlank(c.getUrlGroup())&&c.getUrlGroup().startsWith(",")){
|
||||
c.setUrlGroup(c.getUrlGroup().substring(1));
|
||||
}
|
||||
if(StringUtils.isNotBlank(c.getSubscribeIdGroup())&&c.getSubscribeIdGroup().startsWith(",")){
|
||||
c.setSubscribeIdGroup(c.getSubscribeIdGroup().substring(1));
|
||||
}
|
||||
if(StringUtils.isNotBlank(c.getDomainGroup())&&c.getDomainGroup().startsWith(",")){
|
||||
c.setDomainGroup(c.getDomainGroup().substring(1));
|
||||
}
|
||||
}
|
||||
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), ObjGroupCfg.class);
|
||||
String cfgIndexInfoNoExport=",block_type,do_log,policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,&action:block_type-";
|
||||
|
||||
// 时间过滤
|
||||
if (entity.getSearch_create_time_start() == null) {
|
||||
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_edit_time_start() == null) {
|
||||
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_audit_time_start() == null) {
|
||||
cfgIndexInfoNoExport = ",audit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (!StringUtil.isEmpty(entity.gethColumns())) {
|
||||
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
|
||||
}
|
||||
|
||||
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
|
||||
|
||||
dataMap.put(entity.getMenuNameCode(), lists);
|
||||
|
||||
String timeRange = initTimeMap(entity);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(entity.getExType())) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("Obj group export failed",e);
|
||||
addMessage(redirectAttributes,"error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -381,4 +381,81 @@
|
||||
WHERE user_region3= #{groupId}
|
||||
and is_valid=1
|
||||
</select>
|
||||
<select id="findAllList" parameterType="com.nis.domain.basics.DomainCommCfg" resultMap="domainCommGroupCfgMap">
|
||||
SELECT
|
||||
<include refid="columns"></include>
|
||||
FROM
|
||||
domain_comm_cfg r
|
||||
<trim prefix="WHERE" prefixOverrides="AND |OR ">
|
||||
<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="cfgKeywords != null and cfgKeywords != ''">
|
||||
AND r.cfg_keywords like concat(concat('%',#{cfgKeywords,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('%',#{cfgType,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="createTime != null and createTime !=''">
|
||||
AND r.CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="editTime != null and editTime !='' ">
|
||||
AND r.EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
|
||||
</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="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>
|
||||
<if test="groupId != null">
|
||||
AND r.group_id = #{groupId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="commonGroupIds != null">
|
||||
AND r.group_id in(${commonGroupIds})
|
||||
</if>
|
||||
<!-- 数据范围过滤 -->
|
||||
${sqlMap.dsf}
|
||||
</trim>
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -381,4 +381,81 @@
|
||||
WHERE user_region3= #{groupId}
|
||||
and is_valid=1
|
||||
</select>
|
||||
<select id="findAllList" parameterType="com.nis.domain.basics.ScriberIdCommCfg" resultMap="commGroupCfgMap">
|
||||
SELECT
|
||||
<include refid="columns"></include>
|
||||
FROM
|
||||
scriberid_comm_cfg r
|
||||
<trim prefix="WHERE" prefixOverrides="AND |OR ">
|
||||
<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="cfgKeywords != null and cfgKeywords != ''">
|
||||
AND r.cfg_keywords like concat(concat('%',#{cfgKeywords,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('%',#{cfgType,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="createTime != null and createTime !=''">
|
||||
AND r.CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="editTime != null and editTime !='' ">
|
||||
AND r.EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
|
||||
</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="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>
|
||||
<if test="groupId != null">
|
||||
AND r.group_id = #{groupId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="commonGroupIds != null">
|
||||
AND r.group_id in(${commonGroupIds})
|
||||
</if>
|
||||
<!-- 数据范围过滤 -->
|
||||
${sqlMap.dsf}
|
||||
</trim>
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -399,9 +399,6 @@
|
||||
FROM
|
||||
url_comm_cfg r
|
||||
<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>
|
||||
|
||||
@@ -2,13 +2,9 @@ package com.nis.web.dao.configuration;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.nis.domain.configuration.*;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.nis.domain.configuration.BaseCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CachePolicyUserRegion;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.web.dao.MyBatisDao;
|
||||
|
||||
|
||||
@@ -47,4 +43,12 @@ public interface CommonPolicyDao {
|
||||
@Param("compileIds")List compileIds);
|
||||
|
||||
public void clearPolicies(@Param("tableName")String tableName);
|
||||
|
||||
List<CfgIndexInfo> getObjGroupListByGroupIds(@Param("groupIds")String groupIds,@Param("functionId")Integer functionId,@Param("isValid") Integer isValid);
|
||||
|
||||
void updateCfgIndexCommonGroupIds(List<CfgIndexInfo> cfgIndexInfos);
|
||||
|
||||
List<ObjGroupCfg> getObjGroupList(@Param("ids")String ids);
|
||||
|
||||
List<ObjGroupCfg> getObjGroupPagedList(ObjGroupCfg entity);
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
<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="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
|
||||
<result column="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
|
||||
<result column="dest_ip_pattern" property="destIpPattern" jdbcType="INTEGER" />
|
||||
<result column="dest_ip_address" property="destIpAddress" jdbcType="VARCHAR" />
|
||||
<result column="src_ip_address" property="srcIpAddress" jdbcType="VARCHAR" />
|
||||
@@ -164,13 +164,16 @@
|
||||
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
|
||||
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
|
||||
</resultMap>
|
||||
<resultMap id="ObjMap" type="com.nis.domain.configuration.ObjGroupCfg" extends="CfgIndexInfoMap" >
|
||||
<result column="common_group_ids" property="commonGroupIds" jdbcType="VARCHAR" />
|
||||
</resultMap>
|
||||
<sql id="ConfigIndex_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.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.do_blacklist
|
||||
a.do_blacklist,a.common_group_ids
|
||||
</sql>
|
||||
<sql id="IpCfg_Column" >
|
||||
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.src_ip_pattern,a.dest_ip_pattern,a.src_port_pattern,a.dest_port_pattern,a.src_port
|
||||
@@ -447,7 +450,8 @@
|
||||
user_region5,
|
||||
do_log,
|
||||
source_compile_id,
|
||||
do_blacklist
|
||||
do_blacklist,
|
||||
common_group_ids
|
||||
)values (
|
||||
#{cfgDesc,jdbcType=VARCHAR},
|
||||
#{action,jdbcType=INTEGER},
|
||||
@@ -476,7 +480,8 @@
|
||||
#{userRegion5,jdbcType=VARCHAR},
|
||||
#{doLog,jdbcType=INTEGER},
|
||||
#{sourceCompileId,jdbcType=INTEGER},
|
||||
#{doBlackList,jdbcType=INTEGER}
|
||||
#{doBlackList,jdbcType=INTEGER},
|
||||
#{commonGroupIds,jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
|
||||
@@ -760,10 +765,24 @@
|
||||
user_region3 = #{userRegion3,jdbcType=VARCHAR},
|
||||
user_region4 = #{userRegion4,jdbcType=VARCHAR},
|
||||
user_region5 = #{userRegion5,jdbcType=VARCHAR},
|
||||
<if test="commonGroupIds != null">
|
||||
common_group_ids= #{commonGroupIds,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</set>
|
||||
where cfg_id = #{cfgId,jdbcType=BIGINT}
|
||||
</update>
|
||||
<update id="updateCfgIndexCommonGroupIds" parameterType="com.nis.domain.configuration.CfgIndexInfo" >
|
||||
update cfg_index_info
|
||||
<set >
|
||||
<trim suffixOverrides=",">
|
||||
<if test="commonGroupIds != null">
|
||||
common_group_ids= #{commonGroupIds,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</set>
|
||||
where cfg_id = #{cfgId,jdbcType=BIGINT}
|
||||
</update>
|
||||
|
||||
<!-- 删除子配置 -->
|
||||
<delete id="deleteIpPortCfg" >
|
||||
@@ -1081,5 +1100,135 @@
|
||||
SET is_valid = -1, is_audit = 0
|
||||
WHERE is_valid != -1
|
||||
</update>
|
||||
|
||||
<select id="getObjGroupListByGroupIds" resultMap="CfgIndexInfoMap">
|
||||
SELECT
|
||||
<include refid="ConfigIndex_Column" />
|
||||
FROM cfg_index_info a
|
||||
where a.common_group_ids like concat('%,',#{groupIds,jdbcType=VARCHAR},',%')
|
||||
<if test="functionId!=null" >
|
||||
and function_id=#{functionId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isValid!=null" >
|
||||
and is_valid=#{isValid,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isValid==null" >
|
||||
and is_valid !=-1
|
||||
</if>
|
||||
</select>
|
||||
<select id="getObjGroupList" resultMap="ObjMap" parameterType="com.nis.domain.configuration.ObjGroupCfg" >
|
||||
SELECT
|
||||
<include refid="ConfigIndex_Column" />
|
||||
<trim prefix="," prefixOverrides=",">
|
||||
, s.name as creator_name,e.name as editor_name,u.name as auditor_name
|
||||
,ri.request_title as requestName
|
||||
</trim>
|
||||
FROM cfg_index_info 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 u on a.auditor_id=u.id
|
||||
left join request_info ri on a.request_id=ri.id
|
||||
where a.CFG_ID in (${ids})
|
||||
</select>
|
||||
<select id="getObjGroupPagedList" resultMap="ObjMap" parameterType="com.nis.domain.configuration.ObjGroupCfg" >
|
||||
SELECT
|
||||
<include refid="ConfigIndex_Column" />
|
||||
<trim prefix="," prefixOverrides=",">
|
||||
, s.name as creator_name,e.name as editor_name,u.name as auditor_name
|
||||
,ri.request_title as requestName
|
||||
</trim>
|
||||
FROM cfg_index_info 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 u on a.auditor_id=u.id
|
||||
left join request_info ri on a.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 a.CFG_ID=#{cfgId,jdbcType=BIGINT}
|
||||
</if>
|
||||
<if test="cfgDesc != null and cfgDesc != ''">
|
||||
AND a.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="action != null">
|
||||
AND a.ACTION=#{action,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isValid != null">
|
||||
AND a.IS_VALID=#{isValid,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isValid == null">
|
||||
AND a.IS_VALID != -1
|
||||
</if>
|
||||
<if test="isAudit != null">
|
||||
AND a.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 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 a.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="requestId != null">
|
||||
AND a.REQUEST_ID=#{requestId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="compileId != null">
|
||||
AND a.COMPILE_ID=#{compileId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="compileIdNew != null and compileIdNew != '' and compileIdNew.indexOf('-') != -1">
|
||||
<foreach collection="compileIdNew.split('-')" index="index" item="item" >
|
||||
<if test="index == 0">
|
||||
AND a.COMPILE_ID >= #{item,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="index == 1">
|
||||
AND a.COMPILE_ID <= #{item,jdbcType=INTEGER}
|
||||
</if>
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="compileIdNew !=null and compileIdNew != '' and compileIdNew.indexOf(',') != -1">
|
||||
AND a.COMPILE_ID in
|
||||
<foreach collection="compileIdNew.split(',')" index="index" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="compileIdNew !=null and compileIdNew != '' and compileIdNew.indexOf(',') == -1 and compileIdNew.indexOf('-') == -1">
|
||||
AND a.COMPILE_ID=#{compileIdNew,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isAreaEffective != null">
|
||||
AND a.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="classify != null and classify != ''">
|
||||
AND a.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="attribute != null and attribute != ''">
|
||||
AND a.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="lable != null and lable != ''">
|
||||
AND a.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="areaEffectiveIds != null and areaEffectiveIds != ''">
|
||||
AND a.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="functionId != null">
|
||||
AND a.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}, a.is_audit,a.CFG_ID desc
|
||||
</when>
|
||||
<otherwise>
|
||||
ORDER BY a.is_audit,a.CFG_ID desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -4,11 +4,11 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.nis.domain.basics.*;
|
||||
import org.apache.ibatis.annotations.MapKey;
|
||||
import org.apache.ibatis.annotations.ResultType;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.nis.domain.basics.AsnIpCfg;
|
||||
import com.nis.domain.configuration.AppByteCfg;
|
||||
import com.nis.domain.configuration.AppComplexKeywordCfg;
|
||||
import com.nis.domain.configuration.AppDomainCfg;
|
||||
@@ -106,4 +106,8 @@ public interface ConfigSynchronizationDao {
|
||||
public void updateCfgStatus(BaseCfg entity);
|
||||
|
||||
public PxyObjSpoofingIpPool getPxyObjSpoofingIpPool(Long cfgId);
|
||||
List<IpCommCfg> getIpCommCfgPortList(@Param("groupIds")List groupIds);
|
||||
List<UrlCommCfg> getUrlCommCfgPortList(@Param("groupIds")List<Integer> groupIds);
|
||||
List<ScriberIdCommCfg> getSubscribeIdCommCfgPortList(@Param("groupIds")List<Integer> groupIds);
|
||||
List<DomainCommCfg> getDomainCommCfgPortList(@Param("groupIds")List<Integer> groupIds);
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
<result column="app_code" property="appCode" jdbcType="INTEGER" />
|
||||
<result column="behav_code" property="behavCode" jdbcType="INTEGER" />
|
||||
<result column="ip_type" property="ipType" jdbcType="INTEGER" />
|
||||
<result column="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
|
||||
<result column="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
|
||||
<result column="dest_ip_pattern" property="destIpPattern" jdbcType="INTEGER" />
|
||||
<result column="src_ip_address" property="srcIpAddress" jdbcType="VARCHAR" />
|
||||
<result column="dest_ip_address" property="destIpAddress" jdbcType="VARCHAR" />
|
||||
@@ -241,7 +241,7 @@
|
||||
<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="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
|
||||
<result column="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
|
||||
<result column="dest_ip_pattern" property="destIpPattern" jdbcType="INTEGER" />
|
||||
<result column="dest_ip_address" property="destIpAddress" jdbcType="VARCHAR" />
|
||||
<result column="src_ip_address" property="srcIpAddress" jdbcType="VARCHAR" />
|
||||
@@ -378,12 +378,13 @@
|
||||
<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" />
|
||||
<result column="common_group_ids" property="commonGroupIds" jdbcType="VARCHAR" />
|
||||
</resultMap>
|
||||
<resultMap id="ipPortMap" type="com.nis.domain.configuration.IpPortCfg" >
|
||||
<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="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
|
||||
<result column="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
|
||||
<result column="dest_ip_pattern" property="destIpPattern" jdbcType="INTEGER" />
|
||||
<result column="dest_ip_address" property="destIpAddress" jdbcType="VARCHAR" />
|
||||
<result column="src_ip_address" property="srcIpAddress" jdbcType="VARCHAR" />
|
||||
@@ -414,6 +415,10 @@
|
||||
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
|
||||
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
|
||||
</resultMap>
|
||||
<resultMap id="ipCommMap" type="com.nis.domain.basics.IpCommCfg" extends="ipPortMap">
|
||||
<result column="region_id" property="regionId" jdbcType="INTEGER" />
|
||||
<result column="group_id" property="groupId" jdbcType="INTEGER" />
|
||||
</resultMap>
|
||||
<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" />
|
||||
@@ -446,6 +451,18 @@
|
||||
<result column="app_code" property="appCode" jdbcType="INTEGER" />
|
||||
<result column="behav_code" property="behavCode" jdbcType="INTEGER" />
|
||||
</resultMap>
|
||||
<resultMap id="urlCommMap" type="com.nis.domain.basics.UrlCommCfg" extends="stringCfgMap">
|
||||
<result column="region_id" property="regionId" jdbcType="INTEGER" />
|
||||
<result column="group_id" property="groupId" jdbcType="INTEGER" />
|
||||
</resultMap>
|
||||
<resultMap id="scriberIdCommMap" type="com.nis.domain.basics.ScriberIdCommCfg" extends="stringCfgMap">
|
||||
<result column="region_id" property="regionId" jdbcType="INTEGER" />
|
||||
<result column="group_id" property="groupId" jdbcType="INTEGER" />
|
||||
</resultMap>
|
||||
<resultMap id="domainCommMap" type="com.nis.domain.basics.DomainCommCfg" extends="stringCfgMap">
|
||||
<result column="region_id" property="regionId" jdbcType="INTEGER" />
|
||||
<result column="group_id" property="groupId" jdbcType="INTEGER" />
|
||||
</resultMap>
|
||||
<resultMap id="complexCfgMap" type="com.nis.domain.configuration.ComplexkeywordCfg" >
|
||||
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
|
||||
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
|
||||
@@ -704,7 +721,7 @@
|
||||
<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="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
|
||||
<result column="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
|
||||
<result column="dest_ip_pattern" property="destIpPattern" jdbcType="INTEGER" />
|
||||
<result column="dest_ip_address" property="destIpAddress" jdbcType="VARCHAR" />
|
||||
<result column="src_ip_address" property="srcIpAddress" jdbcType="VARCHAR" />
|
||||
@@ -787,6 +804,10 @@
|
||||
a.ip_type,a.src_ip_address,a.src_ip_pattern,a.dest_ip_pattern,a.src_port_pattern,a.dest_port_pattern,a.src_port,
|
||||
a.protocol,a.protocol_id,a.direction,a.dest_port,a.dest_ip_address,a.cfg_type,a.compile_id
|
||||
</sql>
|
||||
<sql id="IpCommCfg_Column" >
|
||||
a.ip_type,a.src_ip_address,a.src_ip_pattern,a.dest_ip_pattern,a.src_port_pattern,a.dest_port_pattern,a.src_port,
|
||||
a.protocol,a.protocol_id,a.direction,a.dest_port,a.dest_ip_address,a.cfg_type,a.compile_id,a.region_id,a.group_id
|
||||
</sql>
|
||||
<sql id="IpCfg_AllColumn" >
|
||||
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,
|
||||
@@ -812,6 +833,10 @@
|
||||
a.cfg_keywords,a.cfg_type,
|
||||
a.expr_type,a.match_method,a.is_hexbin,a.compile_id
|
||||
</sql>
|
||||
<sql id="CommStrCfg_Column" >
|
||||
a.cfg_keywords,a.cfg_type,
|
||||
a.expr_type,a.match_method,a.is_hexbin,a.compile_id,a.region_id,a.group_id
|
||||
</sql>
|
||||
<sql id="ComplexCfg_Column" >
|
||||
a.cfg_keywords,a.district,a.cfg_type,
|
||||
a.expr_type,a.match_method,a.is_hexbin,a.compile_id
|
||||
@@ -1025,7 +1050,7 @@
|
||||
SELECT
|
||||
<include refid="BaseCfg_Column" />
|
||||
<trim prefix="," prefixOverrides=",">
|
||||
, s.name as creator_name,u.name as auditor_name
|
||||
,a.common_group_ids, s.name as creator_name,u.name as auditor_name
|
||||
<if test="serviceId !=null and serviceId == 18">
|
||||
,dns.cfg_desc as dns_strategy_name
|
||||
</if>
|
||||
@@ -1096,16 +1121,16 @@
|
||||
ORDER BY a.CFG_ID
|
||||
</select>
|
||||
<select id="getIpPortList" resultMap="ipPortMap" parameterType="com.nis.domain.configuration.CfgIndexInfo">
|
||||
SELECT
|
||||
<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
|
||||
<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="getIpDropList" resultMap="ipPortMap" parameterType="com.nis.domain.configuration.CfgIndexInfo">
|
||||
SELECT
|
||||
<include refid="IpDropCfg_Column" />
|
||||
@@ -1926,4 +1951,48 @@
|
||||
</if>
|
||||
</trim>
|
||||
</select> -->
|
||||
<select id="getIpCommCfgPortList" resultMap="ipCommMap" parameterType="com.nis.domain.configuration.CfgIndexInfo">
|
||||
SELECT
|
||||
<include refid="IpCommCfg_Column" />
|
||||
FROM ip_comm_cfg a
|
||||
<where>
|
||||
and a.group_id in
|
||||
<foreach collection="groupIds" index="index" item="groupId" open="(" separator="," close=")">
|
||||
#{groupId}
|
||||
</foreach>
|
||||
</where>
|
||||
</select>
|
||||
<select id="getUrlCommCfgPortList" resultMap="urlCommMap" parameterType="com.nis.domain.configuration.CfgIndexInfo">
|
||||
SELECT
|
||||
<include refid="CommStrCfg_Column" />
|
||||
FROM url_comm_cfg a
|
||||
<where>
|
||||
and a.group_id in
|
||||
<foreach collection="groupIds" index="index" item="groupId" open="(" separator="," close=")">
|
||||
#{groupId}
|
||||
</foreach>
|
||||
</where>
|
||||
</select>
|
||||
<select id="getSubscribeIdCommCfgPortList" resultMap="scriberIdCommMap" parameterType="com.nis.domain.configuration.CfgIndexInfo">
|
||||
SELECT
|
||||
<include refid="CommStrCfg_Column" />
|
||||
FROM scriberid_comm_cfg a
|
||||
<where>
|
||||
and a.group_id in
|
||||
<foreach collection="groupIds" index="index" item="groupId" open="(" separator="," close=")">
|
||||
#{groupId}
|
||||
</foreach>
|
||||
</where>
|
||||
</select>
|
||||
<select id="getDomainCommCfgPortList" resultMap="domainCommMap" parameterType="com.nis.domain.configuration.CfgIndexInfo">
|
||||
SELECT
|
||||
<include refid="CommStrCfg_Column" />
|
||||
FROM domain_comm_cfg a
|
||||
<where>
|
||||
and a.group_id in
|
||||
<foreach collection="groupIds" index="index" item="groupId" open="(" separator="," close=")">
|
||||
#{groupId}
|
||||
</foreach>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.nis.web.dao.configuration;
|
||||
|
||||
import com.nis.domain.basics.DomainCommCfg;
|
||||
import com.nis.domain.basics.IpCommCfg;
|
||||
import com.nis.domain.basics.ScriberIdCommCfg;
|
||||
import com.nis.domain.basics.UrlCommCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.MyBatisDao;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@MyBatisDao
|
||||
public interface ObjectGroupDao extends CrudDao<CfgIndexInfo> {
|
||||
public CfgIndexInfo getObjectGroupConfig(@Param("cfgId")Long cfgId,@Param("compileId")Integer compileId);
|
||||
|
||||
List<UrlCommCfg> getUrlCommonList(@Param("groupIds")String groupIds, @Param("compileId")Long compileId);
|
||||
List<ScriberIdCommCfg> getScriberIdCommonList(@Param("groupIds")String groupIds, @Param("compileId")Long compileId);
|
||||
List<DomainCommCfg> getDomainCommonList(@Param("groupIds")String groupIds, @Param("compileId")Long compileId);
|
||||
|
||||
List<IpCommCfg> getIpCommonList(@Param("groupIds")String groupIds, @Param("compileId")Long compileId);
|
||||
}
|
||||
326
src/main/java/com/nis/web/dao/configuration/ObjectGroupDao.xml
Normal file
326
src/main/java/com/nis/web/dao/configuration/ObjectGroupDao.xml
Normal file
@@ -0,0 +1,326 @@
|
||||
<?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.ObjectGroupDao" >
|
||||
<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" />
|
||||
<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="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" />
|
||||
<result column="user_region4" property="userRegion4" jdbcType="VARCHAR" />
|
||||
<result column="user_region5" property="userRegion5" jdbcType="VARCHAR" />
|
||||
</resultMap>
|
||||
<resultMap id="IpCommGroupCfgMap" type="com.nis.domain.basics.IpCommCfg">
|
||||
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
|
||||
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
|
||||
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
|
||||
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
|
||||
<result column="ip_type" property="ipType" jdbcType="INTEGER" />
|
||||
<result column="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
|
||||
<result column="dest_ip_pattern" property="destIpPattern" jdbcType="INTEGER" />
|
||||
<result column="src_ip_address" property="srcIpAddress" jdbcType="VARCHAR" />
|
||||
<result column="dest_ip_address" property="destIpAddress" jdbcType="VARCHAR" />
|
||||
<result column="port_pattern" property="portPattern" jdbcType="INTEGER" />
|
||||
<result column="src_port" property="srcPort" jdbcType="VARCHAR" />
|
||||
<result column="dest_port" property="destPort" jdbcType="VARCHAR" />
|
||||
<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="ratelimit" property="ratelimit" jdbcType="VARCHAR" />
|
||||
<result column="region_id" property="regionId" jdbcType="INTEGER" />
|
||||
<result column="group_id" property="groupId" 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" />
|
||||
</resultMap>
|
||||
<resultMap id="urlCommGroupCfgMap" type="com.nis.domain.basics.UrlCommCfg">
|
||||
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
|
||||
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
|
||||
<result column="cfg_keywords" property="cfgKeywords" 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="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="function_id" property="functionId" jdbcType="INTEGER" />
|
||||
<result column="ratelimit" property="ratelimit" jdbcType="VARCHAR" />
|
||||
<result column="region_id" property="regionId" jdbcType="INTEGER" />
|
||||
<result column="group_id" property="groupId" 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" />
|
||||
</resultMap>
|
||||
<resultMap id="domainCommGroupCfgMap" type="com.nis.domain.basics.DomainCommCfg">
|
||||
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
|
||||
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
|
||||
<result column="cfg_keywords" property="cfgKeywords" 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="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="function_id" property="functionId" jdbcType="INTEGER" />
|
||||
<result column="ratelimit" property="ratelimit" jdbcType="VARCHAR" />
|
||||
<result column="region_id" property="regionId" jdbcType="INTEGER" />
|
||||
<result column="group_id" property="groupId" 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" />
|
||||
</resultMap>
|
||||
<resultMap id="scribeIdCommGroupCfgMap" type="com.nis.domain.basics.ScriberIdCommCfg">
|
||||
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
|
||||
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
|
||||
<result column="cfg_keywords" property="cfgKeywords" 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="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="function_id" property="functionId" jdbcType="INTEGER" />
|
||||
<result column="ratelimit" property="ratelimit" jdbcType="VARCHAR" />
|
||||
<result column="region_id" property="regionId" jdbcType="INTEGER" />
|
||||
<result column="group_id" property="groupId" 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" />
|
||||
</resultMap>
|
||||
<sql id="ConfigIndex_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.dns_strategy_id,a.user_region1,
|
||||
a.user_region2,a.user_region3,a.user_region4,a.user_region5,a.do_log,a.do_blacklist,a.common_group_ids
|
||||
</sql>
|
||||
<sql id="Cfg_Column_List" >
|
||||
CFG_DESC,CFG_REGION_CODE,CFG_TYPE,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,RATELIMIT,
|
||||
DNS_STRATEGY_ID,IR_TYPE,USER_REGION1,USER_REGION2,USER_REGION3,USER_REGION4,USER_REGION5
|
||||
</sql>
|
||||
<sql id="Cfg_Value_List" >
|
||||
#{cfgDesc,jdbcType=VARCHAR},#{cfgRegionCode,jdbcType=INTEGER},#{cfgType,jdbcType=VARCHAR},#{action,jdbcType=INTEGER},
|
||||
#{isValid,jdbcType=INTEGER},#{isAudit,jdbcType=INTEGER},#{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}, #{ratelimit,jdbcType=VARCHAR},
|
||||
#{dnsStrategyId,jdbcType=INTEGER},#{irType,jdbcType=INTEGER},
|
||||
#{userRegion1,jdbcType=VARCHAR},
|
||||
#{userRegion2,jdbcType=VARCHAR},
|
||||
#{userRegion3,jdbcType=VARCHAR},
|
||||
#{userRegion4,jdbcType=VARCHAR},
|
||||
#{userRegion5,jdbcType=VARCHAR}
|
||||
</sql>
|
||||
<sql id="IpCfg_Column">
|
||||
r.cfg_id,r.cfg_desc,r.cfg_type,r.cfg_region_code,r.ip_type,r.src_ip_pattern,r.src_ip_address,r.dest_ip_pattern,r.dest_ip_address,
|
||||
r.src_port_pattern,r.src_port,r.dest_port_pattern,r.dest_port
|
||||
,r.protocol,r.protocol_id,r.direction,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.user_region1
|
||||
,r.user_region2,r.user_region3,r.user_region4,r.user_region5,r.compile_id,r.region_id,r.group_id
|
||||
</sql>
|
||||
<sql id="StringCfg_Column">
|
||||
r.cfg_id,r.cfg_desc,r.cfg_keywords,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.expr_type,r.match_method,r.is_hexbin,r.area_effective_ids,r.function_id,
|
||||
r.ratelimit,r.user_region1,r.user_region2,r.user_region3,r.user_region4,r.user_region5,
|
||||
r.compile_id,r.region_id,r.group_id
|
||||
</sql>
|
||||
<select id="getObjectGroupConfig" resultMap="CfgIndexInfoMap">
|
||||
SELECT
|
||||
<include refid="ConfigIndex_Column" />
|
||||
FROM CFG_INDEX_INFO a
|
||||
<where>
|
||||
<if test="cfgId !=null">
|
||||
CFG_ID = #{cfgId,jdbcType=BIGINT}
|
||||
</if>
|
||||
<if test="compileId != null">
|
||||
AND COMPILE_ID=#{compileId,jdbcType=INTEGER}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<insert id="insert" parameterType="com.nis.domain.configuration.CfgIndexInfo" >
|
||||
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
|
||||
SELECT LAST_INSERT_ID()
|
||||
</selectKey>
|
||||
insert into cfg_index_info (
|
||||
<include refid="Cfg_Column_List" />
|
||||
)values (
|
||||
<include refid="Cfg_Value_List" />
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertForBatch" parameterType="com.nis.domain.configuration.CfgIndexInfo" >
|
||||
insert into ${tableName} (
|
||||
<include refid="Cfg_Column_List" />
|
||||
)values (
|
||||
<include refid="Cfg_Column_List" />
|
||||
)
|
||||
</insert>
|
||||
<select id="getIpCommonList" resultMap="IpCommGroupCfgMap" parameterType="com.nis.domain.configuration.CfgIndexInfo">
|
||||
SELECT
|
||||
<include refid="IpCfg_Column" />
|
||||
FROM ip_comm_cfg r
|
||||
<where>
|
||||
<if test="compileId != null">
|
||||
AND r.compile_id =#{compileId}
|
||||
</if>
|
||||
<if test="groupIds != null and groupIds !=''">
|
||||
AND r.group_id in (${groupIds})
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="getUrlCommonList" resultMap="urlCommGroupCfgMap" >
|
||||
SELECT
|
||||
<include refid="StringCfg_Column" />
|
||||
FROM url_comm_cfg r
|
||||
<where>
|
||||
<if test="compileId != null">
|
||||
AND r.compile_id =#{compileId}
|
||||
</if>
|
||||
<if test="groupIds != null and groupIds !=''">
|
||||
AND r.group_id in (${groupIds})
|
||||
</if>
|
||||
</where>
|
||||
</select><select id="getScriberIdCommonList" resultMap="scribeIdCommGroupCfgMap" >
|
||||
SELECT
|
||||
<include refid="StringCfg_Column" />
|
||||
FROM scriberid_comm_cfg r
|
||||
<where>
|
||||
<if test="compileId != null">
|
||||
AND r.compile_id =#{compileId}
|
||||
</if>
|
||||
<if test="groupIds != null and groupIds !=''">
|
||||
AND r.group_id in (${groupIds})
|
||||
</if>
|
||||
</where>
|
||||
</select><select id="getDomainCommonList" resultMap="domainCommGroupCfgMap" >
|
||||
SELECT
|
||||
<include refid="StringCfg_Column" />
|
||||
FROM domain_comm_cfg r
|
||||
<where>
|
||||
<if test="compileId != null">
|
||||
AND r.compile_id =#{compileId}
|
||||
</if>
|
||||
<if test="groupIds != null and groupIds !=''">
|
||||
AND r.group_id in (${groupIds})
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<!--<select id="getComplexStringList" resultMap="complexCfgMap" parameterType="com.nis.domain.configuration.CfgIndexInfo">
|
||||
SELECT
|
||||
<include refid="ComplexCfg_Column" />
|
||||
FROM complex_keyword_cfg a
|
||||
<where>
|
||||
<if test="compileId != null">
|
||||
AND a.compile_id =#{compileId}
|
||||
</if>
|
||||
<if test="functionId != null">
|
||||
AND a.function_id =#{functionId}
|
||||
</if>
|
||||
<if test="cfgType != null and cfgType !='' ">
|
||||
AND a.cfg_type =#{cfgType}
|
||||
</if>
|
||||
</where>
|
||||
</select>-->
|
||||
</mapper>
|
||||
@@ -16,11 +16,16 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
import com.nis.domain.basics.*;
|
||||
import com.nis.domain.configuration.*;
|
||||
import com.nis.util.*;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.basics.*;
|
||||
import com.nis.web.dao.configuration.*;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
import org.apache.ibatis.executor.Executor;
|
||||
import org.apache.ibatis.mapping.MappedStatement;
|
||||
import org.apache.ibatis.session.Configuration;
|
||||
import org.apache.ibatis.session.ExecutorType;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
@@ -129,9 +134,7 @@ import com.nis.web.dao.configuration.StringCfgDao;
|
||||
import com.nis.web.dao.specific.ConfigGroupInfoDao;
|
||||
import com.nis.web.dao.specific.SpecificServiceCfgDao;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.basics.AsnGroupInfoService;
|
||||
import com.nis.web.service.basics.SysDictInfoService;
|
||||
import com.sun.org.apache.bcel.internal.generic.NEW;
|
||||
|
||||
/**
|
||||
* Service基类
|
||||
@@ -326,7 +329,7 @@ public abstract class BaseService {
|
||||
*
|
||||
* getTableName(获取表名对应的Class) (这里描述这个方法适用条件 – 可选)
|
||||
*
|
||||
* @param clazz
|
||||
* @param tableName
|
||||
* @return String
|
||||
* @exception @since
|
||||
* 1.0.0
|
||||
@@ -741,7 +744,6 @@ public abstract class BaseService {
|
||||
* @param dstList
|
||||
* @param srcList
|
||||
* @param cfgType,1为IP类型,2为字符串类型,3为增强字符串,4数值类型,5摘要类,6回调类[但字符串类域配置和增强字符串域配置在接口参数中同属于strRegionList]
|
||||
* @param baseCfg,配置基本信息
|
||||
* @param groupRelationList
|
||||
* 配置分组列表
|
||||
* @return
|
||||
@@ -1536,7 +1538,7 @@ public abstract class BaseService {
|
||||
* @param regionDict
|
||||
* @param serviceDict
|
||||
* @param specificServiceCfg
|
||||
* @param asnNoMap
|
||||
* @param asnNoMaps
|
||||
* @param list
|
||||
* @param cfgIndexInfos
|
||||
* @param appPolicyCfgs
|
||||
@@ -2420,7 +2422,7 @@ public abstract class BaseService {
|
||||
|
||||
/**
|
||||
* 导入配置保存App特征
|
||||
* @param appPolicyCfgs
|
||||
* @param appFeatures
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void saveAppFeatureList(List<AppFeatureIndex> appFeatures){
|
||||
@@ -2444,8 +2446,10 @@ public abstract class BaseService {
|
||||
/**
|
||||
* 导入配置时数据批量入库(IP配置)
|
||||
*
|
||||
* @param data
|
||||
* @param tableName
|
||||
* @param regionDict
|
||||
* @param serviceDict
|
||||
* @param cfgs
|
||||
* @param send
|
||||
*/
|
||||
@Transactional(readOnly = false, rollbackFor = RuntimeException.class)
|
||||
public void saveIpBatch(FunctionRegionDict regionDict, FunctionServiceDict serviceDict,List<BaseIpCfg> cfgs, boolean send) {
|
||||
@@ -3306,5 +3310,291 @@ public abstract class BaseService {
|
||||
userRegion = gsonToJson(actionParam);
|
||||
return StringEscapeUtils.unescapeJson(userRegion);
|
||||
}
|
||||
|
||||
/**
|
||||
*只会更新maat配置,公共分组删除时会取消配置
|
||||
* 调用场景(1)公共分组域增加(3)公共分组修改(2)公共分组域删除(3)公共分组删除
|
||||
* @param policyGroupInfos
|
||||
|
||||
* @return
|
||||
*/
|
||||
public boolean transObjGroupToMaat(List<PolicyGroupInfo> policyGroupInfos){
|
||||
IpCommGroupCfgDao ipCommGroupCfgDao=SpringContextHolder.getBean(IpCommGroupCfgDao.class);
|
||||
UrlCommGroupDao urlCommGroupCfgDao=SpringContextHolder.getBean(UrlCommGroupDao.class);
|
||||
ScriberIdCommGroupDao scriberIdCommGroupDao=SpringContextHolder.getBean(ScriberIdCommGroupDao.class);
|
||||
DomainCommGroupDao domainCommGroupDao=SpringContextHolder.getBean(DomainCommGroupDao.class);
|
||||
CommonPolicyDao commonPolicyDao=SpringContextHolder.getBean(CommonPolicyDao.class);
|
||||
AreaIpCfgDao areaIpCfgDao=SpringContextHolder.getBean(AreaIpCfgDao.class);
|
||||
Set<String> ipDeletedGroups=new HashSet<>();
|
||||
Set<String> urlDeletedGroups=new HashSet<>();
|
||||
Set<String> subIdDeletedGroups=new HashSet<>();
|
||||
Set<String> domainDeletedGroups=new HashSet<>();
|
||||
//遍历,获取需要下发配置的组
|
||||
StringBuffer realGroupIds=new StringBuffer();
|
||||
for(PolicyGroupInfo policyGroupInfo:policyGroupInfos){
|
||||
//删除的时候
|
||||
if(policyGroupInfo.getUdFlag().equals(2)){
|
||||
realGroupIds.append(policyGroupInfo.getServiceGroupId()).append(",");
|
||||
if(policyGroupInfo.getGroupType().equals(Constants.IP_OBJ_GROUP_TYPE)){
|
||||
if(policyGroupInfo.getIsValid().equals(0)){
|
||||
ipDeletedGroups.add(policyGroupInfo.getServiceGroupId().toString());
|
||||
}
|
||||
}
|
||||
if(policyGroupInfo.getGroupType().equals(Constants.URL_OBJ_GROUP_TYPE)){
|
||||
if(policyGroupInfo.getIsValid().equals(0)){
|
||||
urlDeletedGroups.add(policyGroupInfo.getServiceGroupId().toString());
|
||||
}
|
||||
}
|
||||
if(policyGroupInfo.getGroupType().equals(Constants.SUBID_OBJ_GROUP_TYPE)){
|
||||
if(policyGroupInfo.getIsValid().equals(0)){
|
||||
subIdDeletedGroups.add(policyGroupInfo.getServiceGroupId().toString());
|
||||
}
|
||||
}
|
||||
if(policyGroupInfo.getGroupType().equals(Constants.DOMAIN_OBJ_GROUP_TYPE)){
|
||||
if(policyGroupInfo.getIsValid().equals(0)){
|
||||
domainDeletedGroups.add(policyGroupInfo.getServiceGroupId().toString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if(realGroupIds.toString().endsWith(",")){
|
||||
realGroupIds.deleteCharAt(realGroupIds.toString().length()-1);
|
||||
}
|
||||
List<CfgIndexInfo> toUpdateCfgIndexInfos=new ArrayList<>();
|
||||
//查询cfg_index_info表,获取所有用到了这个group_id的非删除配置
|
||||
List<CfgIndexInfo> cfgIndexInfos=commonPolicyDao.getObjGroupListByGroupIds(realGroupIds.toString(),null,null);
|
||||
|
||||
CfgIndexInfo auditCfg=new CfgIndexInfo();
|
||||
auditCfg.setTableName(CfgIndexInfo.getTablename());
|
||||
auditCfg.setIsAudit(Constants.AUDIT_YES);
|
||||
auditCfg.setAuditorId(UserUtils.getUser().getId());
|
||||
auditCfg.setAuditTime(new Date());
|
||||
List compileIds=new ArrayList();
|
||||
//组织一个大的json
|
||||
ToMaatBean maatBean = new ToMaatBean();
|
||||
ServiceConfigTemplateUtil templateUtil=new ServiceConfigTemplateUtil();
|
||||
Map<String,Object> interceptUserRegionMap=new HashMap<>();
|
||||
for(CfgIndexInfo cfgIndexInfo:cfgIndexInfos){
|
||||
Integer serviceId=cfgIndexInfo.getServiceId();
|
||||
if(serviceId!=null&&StringUtils.isNotBlank(cfgIndexInfo.getCommonGroupIds())){
|
||||
MaatCfg maatCfg = new MaatCfg();
|
||||
Set<Integer> groupIdSet=new HashSet<>();
|
||||
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();
|
||||
Map<String,Object> userRgionMap=gsonFromJson(cfgIndexInfo.getCommonGroupIds(),Map.class);
|
||||
cfgIndexInfo.setUserRegion(userRgionMap);
|
||||
String oldCommonGroupIds=cfgIndexInfo.getCommonGroupIds();
|
||||
|
||||
this.processUserRegionMap(userRgionMap,"ipGroup",ipDeletedGroups,cfgIndexInfo,ipCommGroupCfgDao,IpCommCfg.class);
|
||||
this.processUserRegionMap(userRgionMap,"urlGroup",urlDeletedGroups,cfgIndexInfo,urlCommGroupCfgDao,UrlCommCfg.class);
|
||||
this.processUserRegionMap(userRgionMap,"subscribeIdGroup",subIdDeletedGroups,cfgIndexInfo,scriberIdCommGroupDao,ScriberIdCommCfg.class);
|
||||
this.processUserRegionMap(userRgionMap,"domainGroup",domainDeletedGroups,cfgIndexInfo,domainCommGroupDao,DomainCommCfg.class);
|
||||
|
||||
//需要更新的组
|
||||
cfgIndexInfo.setCommonGroupIds(gsonToJson(userRgionMap));
|
||||
if(!oldCommonGroupIds.equals(cfgIndexInfo.getCommonGroupIds())){
|
||||
toUpdateCfgIndexInfos.add(cfgIndexInfo);
|
||||
//commonPolicyDao.updateCfgIndexCommonGroupIds(cfgIndexInfo);
|
||||
}
|
||||
if(cfgIndexInfo.getIsValid().equals(Constants.VALID_YES)){
|
||||
//没组了,取消配置
|
||||
if(userRgionMap.isEmpty()){
|
||||
maatCfg.setCompileId(cfgIndexInfo.getCompileId());
|
||||
maatCfg.setServiceId(cfgIndexInfo.getServiceId());
|
||||
maatCfg.setIsValid(0);//无效
|
||||
configCompileList.add(maatCfg);
|
||||
}else{//有组,重新下发配置
|
||||
//保存区域IP信息
|
||||
List<AreaIpCfg> areaIpCfgList=areaIpCfgDao.getByCompileId(cfgIndexInfo.getCompileId());
|
||||
if(!StringUtil.isEmpty(areaIpCfgList)){
|
||||
AreaIpCfg cfg = new AreaIpCfg();
|
||||
BeanUtils.copyProperties(cfgIndexInfo, cfg, new String[]{"cfgId"});
|
||||
cfg.setTableName(AreaIpCfg.getTablename());
|
||||
commonPolicyDao.auditCfg(cfg);
|
||||
|
||||
Map<String,List> map = cfgConvert(areaIpRegionList,areaIpCfgList,1,cfgIndexInfo,groupRelationList);
|
||||
groupRelationList=map.get("groupList");
|
||||
areaIpRegionList=map.get("dstList");
|
||||
}
|
||||
|
||||
Map<String,Object> maatTableMap=new HashMap<>();
|
||||
StringBuffer userRegion=new StringBuffer();
|
||||
List<Map<String,Object>> list= templateUtil.getServiceListByServiceId(serviceId);
|
||||
//获取业务下的配置域
|
||||
List<Map<String,Object>> cfgList = new ArrayList<>();
|
||||
//获取业务下的自定义域
|
||||
List<Map<String,Object>> userRegionList = new ArrayList<>();
|
||||
for(Map<String,Object> service:list){
|
||||
String serviceType = service.get("serviceType").toString();
|
||||
//主表上有maatTable的一般是app的表
|
||||
// if(service.containsKey("maatTable")){ }
|
||||
if(service.containsKey("cfgList")) {
|
||||
cfgList=(List<Map<String, Object>>) service.get("cfgList");
|
||||
maatTableMap=ConfigConvertUtil.convertCommonGroupMaatTable(cfgIndexInfo,cfgList);
|
||||
}
|
||||
if(service.containsKey("userRegionList")){
|
||||
//Map<String,Object> userregionMap=new HashMap<>();
|
||||
//userRegionList=(List<Map<String, Object>>) service.get("userRegionList");
|
||||
if(serviceId.equals(576)){
|
||||
String _userregion=ConfigConvertUtil.generateCommonGroupDefaultUserRegion(interceptUserRegionMap,serviceId);
|
||||
userRegion.append(_userregion);
|
||||
}else if(serviceId.equals(512)){
|
||||
cfgIndexInfo.setAction(2);
|
||||
String _userregion=ConfigConvertUtil.generateCommonGroupDefaultUserRegion(interceptUserRegionMap,serviceId);
|
||||
userRegion.append(_userregion);
|
||||
}
|
||||
}
|
||||
}
|
||||
compileIds.add(cfgIndexInfo.getCompileId());
|
||||
//子表
|
||||
//IP公共分组
|
||||
if(CollectionUtils.isNotEmpty(cfgIndexInfo.getIpCommGroupCfgList())){
|
||||
IpPortCfg cfg = new IpPortCfg();
|
||||
BeanUtils.copyProperties(cfgIndexInfo, cfg, new String[]{"cfgId"});
|
||||
Map<String,List> map = ConfigConvertUtil.objGroupCfgConvert(ipRegionList,cfgIndexInfo.getIpCommGroupCfgList(),1,cfgIndexInfo,groupRelationList,maatTableMap,groupIdSet);
|
||||
groupRelationList=map.get("groupList");
|
||||
ipRegionList=map.get("dstList");
|
||||
if(map.get("numRegionList")!=null){
|
||||
numRegionList.addAll(map.get("numRegionList"));
|
||||
}
|
||||
|
||||
}
|
||||
//URL公共分组
|
||||
if(CollectionUtils.isNotEmpty(cfgIndexInfo.getUrlCommGroupList())){
|
||||
CommonStringCfg cfg = new CommonStringCfg();
|
||||
BeanUtils.copyProperties(cfgIndexInfo, cfg, new String[]{"cfgId"});
|
||||
Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(strRegionList,cfgIndexInfo.getUrlCommGroupList(),2,cfgIndexInfo,groupRelationList,maatTableMap,groupIdSet);
|
||||
groupRelationList=map.get("groupList");
|
||||
strRegionList=map.get("dstList");
|
||||
}
|
||||
//账号公共分组
|
||||
if(CollectionUtils.isNotEmpty(cfgIndexInfo.getScriberIdCommGroupList())){
|
||||
CommonStringCfg cfg = new CommonStringCfg();
|
||||
BeanUtils.copyProperties(cfgIndexInfo, cfg, new String[]{"cfgId"});
|
||||
|
||||
Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(strRegionList,cfgIndexInfo.getScriberIdCommGroupList(),2,cfgIndexInfo,groupRelationList,maatTableMap,groupIdSet);
|
||||
groupRelationList=map.get("groupList");
|
||||
strRegionList=map.get("dstList");
|
||||
|
||||
}
|
||||
//域名公共分组
|
||||
if(CollectionUtils.isNotEmpty(cfgIndexInfo.getDomainCommGroupList())){
|
||||
CommonStringCfg cfg = new CommonStringCfg();
|
||||
BeanUtils.copyProperties(cfgIndexInfo, cfg, new String[]{"cfgId"});
|
||||
|
||||
Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(strRegionList,cfgIndexInfo.getDomainCommGroupList(),2,cfgIndexInfo,groupRelationList,maatTableMap,groupIdSet);
|
||||
groupRelationList=map.get("groupList");
|
||||
strRegionList=map.get("dstList");
|
||||
|
||||
}
|
||||
//构造提交综合服务参数格式
|
||||
maatCfg.initDefaultValue();
|
||||
BeanUtils.copyProperties(cfgIndexInfo, maatCfg);
|
||||
maatCfg.setAction(cfgIndexInfo.getAction());
|
||||
maatCfg.setAuditTime(cfgIndexInfo.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(Constants.VALID_YES);
|
||||
//设置用户自定义域
|
||||
String protpcolType=cfgIndexInfo.getUserRegion1();
|
||||
|
||||
if("HTTPS".equalsIgnoreCase(protpcolType)||"INTERCEPT".equalsIgnoreCase(protpcolType)){
|
||||
if(StringUtils.isBlank(userRegion.toString())){
|
||||
userRegion.append("{}");
|
||||
}
|
||||
}else if("HTTP".equalsIgnoreCase(protpcolType)){
|
||||
}
|
||||
maatCfg.setUserRegion(userRegion.toString());
|
||||
|
||||
configCompileList.add(maatCfg);
|
||||
}
|
||||
if(CollectionUtils.isEmpty(maatBean.getConfigCompileList())){
|
||||
maatBean.setConfigCompileList(configCompileList);
|
||||
maatBean.setAuditTime(cfgIndexInfo.getAuditTime());
|
||||
maatBean.setCreatorName(cfgIndexInfo.getCurrentUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.UPDATE_ACTION);
|
||||
}
|
||||
}
|
||||
|
||||
//下发maat配置
|
||||
//auditPolicy(cfgIndexInfo,cfgIndexInfo.getIsAudit(),Constants.UPDATE_ACTION);
|
||||
}
|
||||
}
|
||||
//需要更新的cfg_index_info数据库更新
|
||||
if(toUpdateCfgIndexInfos.size()>0){
|
||||
commonPolicyDao.updateCfgIndexCommonGroupIds(toUpdateCfgIndexInfos);
|
||||
}
|
||||
//向maat发送配置
|
||||
if(CollectionUtils.isNotEmpty(maatBean.getConfigCompileList())){
|
||||
//调用服务接口下发配置数据
|
||||
String json=gsonToJson(maatBean);
|
||||
logger.info("策略对象组下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
||||
logger.info("策略对象组下发响应信息:"+result.getMsg());
|
||||
}
|
||||
//commonPolicyDao.auditCfgBatch(CfgIndexInfo.getTablename(),auditCfg,compileIds,null);
|
||||
return true;
|
||||
}
|
||||
private void processUserRegionMap(Map<String,Object> userRgionMap, String key, Set deletedGroups, CfgIndexInfo cfgIndexInfo, CrudDao dao,Class clazz) {
|
||||
if(userRgionMap.containsKey(key)){
|
||||
//排除删除的组,添加新的组
|
||||
for(String urlGroup:((String)userRgionMap.get(key)).split(",")){
|
||||
if(deletedGroups.contains(urlGroup)){
|
||||
userRgionMap.put(key,((String) userRgionMap.get(key)).replace(","+urlGroup+",",","));
|
||||
}
|
||||
}
|
||||
boolean contains=true;
|
||||
//空了
|
||||
if(userRgionMap.get(key).toString().equals(",")){
|
||||
userRgionMap.remove(key);
|
||||
contains=false;
|
||||
}
|
||||
if(contains&&cfgIndexInfo.getIsValid()==Constants.VALID_YES){
|
||||
if("IpCommCfg".equals(clazz.getSimpleName())){
|
||||
IpCommCfg searchCfg=new IpCommCfg();
|
||||
searchCfg.setCommonGroupIds(userRgionMap.get(key).toString().substring(1,userRgionMap.get(key).toString().length()-1));
|
||||
List commCfgs=dao.findAllList(searchCfg);
|
||||
if(CollectionUtils.isNotEmpty(commCfgs)){
|
||||
cfgIndexInfo.setIpCommGroupCfgList(commCfgs);
|
||||
}
|
||||
}else if("ScriberIdCommCfg".equals(clazz.getSimpleName()) ){
|
||||
ScriberIdCommCfg searchCfg=new ScriberIdCommCfg();
|
||||
searchCfg.setCommonGroupIds(userRgionMap.get(key).toString().substring(1,userRgionMap.get(key).toString().length()-1));
|
||||
List commCfgs=dao.findAllList(searchCfg);
|
||||
if(CollectionUtils.isNotEmpty(commCfgs)){
|
||||
cfgIndexInfo.setScriberIdCommGroupList(commCfgs);
|
||||
}
|
||||
}else if("UrlCommCfg".equals(clazz.getSimpleName())){
|
||||
UrlCommCfg searchCfg=new UrlCommCfg();
|
||||
searchCfg.setCommonGroupIds(userRgionMap.get(key).toString().substring(1,userRgionMap.get(key).toString().length()-1));
|
||||
List commCfgs=dao.findAllList(searchCfg);
|
||||
if(CollectionUtils.isNotEmpty(commCfgs)){
|
||||
cfgIndexInfo.setUrlCommGroupList(commCfgs);
|
||||
}
|
||||
}else if("DomainCommCfg".equals(clazz.getSimpleName())){
|
||||
DomainCommCfg searchCfg=new DomainCommCfg();
|
||||
searchCfg.setCommonGroupIds(userRgionMap.get(key).toString().substring(1,userRgionMap.get(key).toString().length()-1));
|
||||
List commCfgs=dao.findAllList(searchCfg);
|
||||
if(CollectionUtils.isNotEmpty(commCfgs)){
|
||||
cfgIndexInfo.setDomainCommGroupList(commCfgs);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.nis.web.dao.basics.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -50,7 +51,8 @@ public class CommonGroupManageService extends BaseService{
|
||||
private DomainCommGroupDao domainCommGroupDao;
|
||||
@Autowired
|
||||
private ScriberIdCommGroupDao scriberIdCommGroupDao;
|
||||
|
||||
@Autowired
|
||||
private PolicyGroupInfoDao policyGroupInfoDao;
|
||||
public Page<CommonGroupInfo> findCommonGroupInfoList(Page<CommonGroupInfo> page, CommonGroupInfo entity) {
|
||||
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r"));
|
||||
entity.setPage(page);
|
||||
@@ -108,7 +110,8 @@ public class CommonGroupManageService extends BaseService{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<PolicyGroupInfo> policyGroupInfos=policyGroupInfoDao.findPolicyByServiceGroupInfoList(ids);
|
||||
transObjGroupToMaat(policyGroupInfos);
|
||||
}
|
||||
|
||||
// 分组配置界面使用
|
||||
@@ -205,7 +208,7 @@ public class CommonGroupManageService extends BaseService{
|
||||
|
||||
/**
|
||||
* 校验执行删除操作后分组下域配置是否为空
|
||||
* @param serviceGroupIds
|
||||
* @param grouIdAndCfgId
|
||||
* @param groupType
|
||||
* @return
|
||||
*/
|
||||
@@ -225,7 +228,7 @@ public class CommonGroupManageService extends BaseService{
|
||||
map.put(groupId, list);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
List<Integer> resultList = new ArrayList<Integer>();
|
||||
for (Integer groupId : map.keySet()) {
|
||||
List<Integer> cfgIdList = map.get(groupId);
|
||||
@@ -243,7 +246,7 @@ public class CommonGroupManageService extends BaseService{
|
||||
}else if(groupType == 9) { // ScriberId
|
||||
size = commonGroupManageDao.ajaxCheckIsLastOneCfg(groupId, cfgIds.substring(1), ScriberIdCommCfg.getTablename());
|
||||
}
|
||||
|
||||
|
||||
if(size == 0) { // 0为分组下的最后一条配置,获取配置ID提示
|
||||
Integer compileId = commonGroupManageDao.getCompileIdByGroupId(","+groupId+",");
|
||||
if(compileId != null) {
|
||||
@@ -253,5 +256,5 @@ public class CommonGroupManageService extends BaseService{
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ public class DomainCommGroupService extends CrudService<CrudDao<DomainCommCfg>,
|
||||
// 更新分组状态
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, 8);
|
||||
//TODO 组配置更新时 需检索是否被其它配置引用,若被引用需调用相应服务接口更新配置
|
||||
//transObjGroupToMaat(policyGroupInfos);
|
||||
transObjGroupToMaat(policyGroupInfos);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,12 +116,13 @@ public class DomainCommGroupService extends CrudService<CrudDao<DomainCommCfg>,
|
||||
domainCommGroupDao.update(entity);
|
||||
|
||||
// 更新分组状态
|
||||
List<PolicyGroupInfo> policyGroupInfos = new ArrayList<PolicyGroupInfo>();
|
||||
if(!entity.getUserRegion1().equals(entity.getGroupId().toString())) {
|
||||
List<PolicyGroupInfo> policyGroupInfos = new ArrayList<PolicyGroupInfo>();
|
||||
policyGroupInfos.addAll(policyGroupInfoDao.findPolicyByServiceGroupInfoList(entity.getUserRegion1()));
|
||||
policyGroupInfos.addAll(policyGroupInfoDao.findPolicyByServiceGroupInfoList(entity.getGroupId().toString()));
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, 8);
|
||||
}
|
||||
policyGroupInfos.addAll(policyGroupInfoDao.findPolicyByServiceGroupInfoList(entity.getGroupId().toString()));
|
||||
transObjGroupToMaat(policyGroupInfos);
|
||||
}
|
||||
|
||||
|
||||
@@ -131,6 +132,7 @@ public class DomainCommGroupService extends CrudService<CrudDao<DomainCommCfg>,
|
||||
domainCommGroupDao.delete(ids);
|
||||
// 更新分组状态
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, 8);
|
||||
transObjGroupToMaat(policyGroupInfos);
|
||||
}
|
||||
|
||||
public List<DomainCommCfg> getByIds(String ids) {
|
||||
|
||||
@@ -75,13 +75,13 @@ public class IpCommGroupCfgService extends BaseService {
|
||||
public void update(IpCommCfg entity){
|
||||
ipCommGroupCfgDao.update(entity);
|
||||
// 更新分组状态
|
||||
List<PolicyGroupInfo> policyGroupInfos = new ArrayList<PolicyGroupInfo>();
|
||||
if(!entity.getUserRegion1().equals(entity.getGroupId().toString())) {
|
||||
List<PolicyGroupInfo> policyGroupInfos = new ArrayList<PolicyGroupInfo>();
|
||||
policyGroupInfos.addAll(policyGroupInfoDao.findPolicyByServiceGroupInfoList(entity.getUserRegion1()));
|
||||
policyGroupInfos.addAll(policyGroupInfoDao.findPolicyByServiceGroupInfoList(entity.getGroupId().toString()));
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, 5);
|
||||
policyGroupInfos.addAll(policyGroupInfoDao.findPolicyByServiceGroupInfoList(entity.getUserRegion1()));
|
||||
}
|
||||
|
||||
policyGroupInfos.addAll(policyGroupInfoDao.findPolicyByServiceGroupInfoList(entity.getGroupId().toString()));
|
||||
transObjGroupToMaat(policyGroupInfos);
|
||||
}
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ public class IpCommGroupCfgService extends BaseService {
|
||||
// 更新分组状态
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, 5);
|
||||
//TODO 组配置更新时 需检索是否被其它配置引用,若被引用需调用相应服务接口更新配置
|
||||
//transObjGroupToMaat(policyGroupInfos);
|
||||
transObjGroupToMaat(policyGroupInfos);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -136,7 +136,7 @@ public class IpCommGroupCfgService extends BaseService {
|
||||
ipCommGroupCfgDao.delete(ids);
|
||||
// 更新分组状态
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, 5);
|
||||
//transObjGroupToMaat(policyGroupInfos);
|
||||
transObjGroupToMaat(policyGroupInfos);
|
||||
}
|
||||
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
|
||||
@@ -97,7 +97,7 @@ public class ScriberIdCommGroupService extends CrudService<CrudDao<ScriberIdComm
|
||||
// 更新分组状态
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, 9);
|
||||
//TODO 组配置更新时 需检索是否被其它配置引用,若被引用需调用相应服务接口更新配置
|
||||
//transObjGroupToMaat(policyGroupInfos);
|
||||
transObjGroupToMaat(policyGroupInfos);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -117,13 +117,13 @@ public class ScriberIdCommGroupService extends CrudService<CrudDao<ScriberIdComm
|
||||
scriberIdCommGroupDao.update(entity);
|
||||
|
||||
// 更新分组状态
|
||||
List<PolicyGroupInfo> policyGroupInfos = new ArrayList<PolicyGroupInfo>();
|
||||
if(!entity.getUserRegion1().equals(entity.getGroupId().toString())) {
|
||||
List<PolicyGroupInfo> policyGroupInfos = new ArrayList<PolicyGroupInfo>();
|
||||
policyGroupInfos.addAll(policyGroupInfoDao.findPolicyByServiceGroupInfoList(entity.getUserRegion1()));
|
||||
policyGroupInfos.addAll(policyGroupInfoDao.findPolicyByServiceGroupInfoList(entity.getGroupId().toString()));
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, 9);
|
||||
policyGroupInfos.addAll(policyGroupInfoDao.findPolicyByServiceGroupInfoList(entity.getUserRegion1()));
|
||||
}
|
||||
|
||||
policyGroupInfos.addAll(policyGroupInfoDao.findPolicyByServiceGroupInfoList(entity.getGroupId().toString()));
|
||||
transObjGroupToMaat(policyGroupInfos);
|
||||
}
|
||||
|
||||
|
||||
@@ -133,6 +133,7 @@ public class ScriberIdCommGroupService extends CrudService<CrudDao<ScriberIdComm
|
||||
scriberIdCommGroupDao.delete(ids);
|
||||
// 更新分组状态
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, 9);
|
||||
transObjGroupToMaat(policyGroupInfos);
|
||||
}
|
||||
|
||||
public List<ScriberIdCommCfg> getByIds(String ids) {
|
||||
|
||||
@@ -95,7 +95,7 @@ public class UrlCommGroupService extends CrudService<CrudDao<UrlCommCfg>, UrlCom
|
||||
}
|
||||
// 更新分组状态
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, 7);
|
||||
|
||||
transObjGroupToMaat(policyGroupInfos);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,12 +114,13 @@ public class UrlCommGroupService extends CrudService<CrudDao<UrlCommCfg>, UrlCom
|
||||
urlCommGroupDao.update(entity);
|
||||
|
||||
// 更新分组状态
|
||||
List<PolicyGroupInfo> policyGroupInfos = new ArrayList<PolicyGroupInfo>();
|
||||
if(!entity.getUserRegion1().equals(entity.getGroupId().toString())) {
|
||||
List<PolicyGroupInfo> policyGroupInfos = new ArrayList<PolicyGroupInfo>();
|
||||
policyGroupInfos.addAll(policyGroupInfoDao.findPolicyByServiceGroupInfoList(entity.getUserRegion1()));
|
||||
policyGroupInfos.addAll(policyGroupInfoDao.findPolicyByServiceGroupInfoList(entity.getGroupId().toString()));
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, 7);
|
||||
policyGroupInfos.addAll(policyGroupInfoDao.findPolicyByServiceGroupInfoList(entity.getUserRegion1()));
|
||||
}
|
||||
policyGroupInfos.addAll(policyGroupInfoDao.findPolicyByServiceGroupInfoList(entity.getGroupId().toString()));
|
||||
transObjGroupToMaat(policyGroupInfos);
|
||||
}
|
||||
|
||||
|
||||
@@ -129,6 +130,7 @@ public class UrlCommGroupService extends CrudService<CrudDao<UrlCommCfg>, UrlCom
|
||||
// 更新分组状态
|
||||
List<PolicyGroupInfo> policyGroupInfos=policyGroupInfoDao.findPolicyByServiceGroupInfoList(groupIds);
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, 7);
|
||||
transObjGroupToMaat(policyGroupInfos);
|
||||
}
|
||||
|
||||
public List<UrlCommCfg> getByIds(String ids) {
|
||||
|
||||
@@ -1,51 +1,32 @@
|
||||
package com.nis.web.service.configuration;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.nis.domain.basics.*;
|
||||
import com.nis.domain.configuration.*;
|
||||
import com.nis.util.*;
|
||||
import com.nis.web.dao.basics.*;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.dom4j.Node;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import antlr.StringUtils;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
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.AppFeatureIndex;
|
||||
import com.nis.domain.configuration.AppIpCfg;
|
||||
import com.nis.domain.configuration.AppPolicyCfg;
|
||||
import com.nis.domain.configuration.AvFileSampleCfg;
|
||||
import com.nis.domain.configuration.BaseCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
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.DnsResStrategy;
|
||||
import com.nis.domain.configuration.FileDigestCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.PxyObjKeyring;
|
||||
import com.nis.domain.configuration.PxyObjSpoofingIpPool;
|
||||
import com.nis.domain.configuration.PxyObjTrustedCaCert;
|
||||
import com.nis.domain.configuration.PxyObjTrustedCaCrl;
|
||||
import com.nis.domain.configuration.WebsiteDomainTopic;
|
||||
import com.nis.domain.maat.GroupReuseAddBean;
|
||||
import com.nis.domain.maat.GroupReuseCfg;
|
||||
import com.nis.domain.maat.MaatCfg;
|
||||
@@ -59,15 +40,6 @@ import com.nis.domain.maat.MaatCfg.StringCfg;
|
||||
import com.nis.domain.maat.ManipulatActionParam;
|
||||
import com.nis.domain.specific.ConfigGroupInfo;
|
||||
import com.nis.domain.specific.SpecificServiceCfg;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DateUtil;
|
||||
import com.nis.util.DateUtils;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.FileUtils;
|
||||
import com.nis.util.ServiceConfigTemplateUtil;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.dao.basics.AsnGroupInfoDao;
|
||||
import com.nis.web.dao.configuration.AppCfgDao;
|
||||
import com.nis.web.dao.configuration.CommonPolicyDao;
|
||||
import com.nis.web.dao.configuration.ConfigSynchronizationDao;
|
||||
@@ -97,6 +69,14 @@ public class ConfigSynchronizationService extends BaseService{
|
||||
protected AppCfgDao appCfgDao;
|
||||
@Autowired
|
||||
protected PxyObjSpoofingIpPoolDao pxyObjSpoofingIpPoolDao;
|
||||
@Autowired
|
||||
protected IpCommGroupCfgDao ipCommGroupCfgDao;
|
||||
@Autowired
|
||||
protected ScriberIdCommGroupDao scriberIdCommGroupDao;
|
||||
@Autowired
|
||||
protected UrlCommGroupDao urlCommGroupDao;
|
||||
@Autowired
|
||||
protected DomainCommGroupDao domainCommGroupDao;
|
||||
|
||||
private boolean lastServiceTag = false;//标识是否是最后一个同步业务
|
||||
private boolean isFinished = false;
|
||||
@@ -132,25 +112,42 @@ public class ConfigSynchronizationService extends BaseService{
|
||||
String serviceType = service.get("serviceType").toString();
|
||||
String className = service.get("className").toString();
|
||||
String serviceId = service.get("id").toString();
|
||||
String serviceIds=service.get("serviceIds").toString();
|
||||
BaseCfg entity = new BaseCfg();
|
||||
entity.setServiceId(Integer.valueOf(serviceId));
|
||||
entity.setIsAudit(1);
|
||||
entity.setIsValid(1);
|
||||
entity.setTableName(tableName);
|
||||
if("1".equals(serviceType)){//maat类配置
|
||||
List<Map<String,Object>> cfgList = (List<Map<String, Object>>) service.get("cfgList");
|
||||
List<Map<String,Object>> userRegionList = (List<Map<String, Object>>) service.get("userRegionList");
|
||||
if(cfgList.size()>0){
|
||||
Page page=new Page(request,response,Constants.MAAT_JSON_SEND_SIZE,"a");
|
||||
handleNtcMaatData(cfgList,userRegionList,page,entity,request,response,false,tableName);
|
||||
if(StringUtils.isNotBlank(serviceIds)){//公共分组
|
||||
Map<Integer,List<Map<String,Object>>> childrenCfgMap=new HashMap<>();
|
||||
Map<Integer,List<Map<String,Object>>> childrenUserRegionMap=new HashMap<>();
|
||||
for(String _serviceId:serviceIds.split(",")){
|
||||
if(StringUtils.isNotBlank(_serviceId)){
|
||||
Map<String,Object> subService=serviceTemplate.getServiceListByServiceId(Integer.parseInt(_serviceId)).get(0);
|
||||
childrenCfgMap.put(Integer.parseInt(_serviceId),(List<Map<String,Object>>)subService.get("cfgList"));
|
||||
}
|
||||
}
|
||||
if(childrenCfgMap.size()>0){
|
||||
entity.setFunctionId(Integer.parseInt(service.get("functionId").toString()));
|
||||
Page page=new Page(request,response,Constants.MAAT_JSON_SEND_SIZE,"a");
|
||||
handleObjGroupListMaatData(childrenCfgMap,childrenUserRegionMap,page,entity,request,response,false,tableName);
|
||||
}
|
||||
}else{
|
||||
int cfgType = Integer.parseInt(service.get("cfgType").toString());
|
||||
if("ddos_ip_cfg".equals(tableName)){
|
||||
List<Map<String,Object>> cfgList = (List<Map<String, Object>>) service.get("cfgList");
|
||||
List<Map<String,Object>> userRegionList = (List<Map<String, Object>>) service.get("userRegionList");
|
||||
if(cfgList.size()>0){
|
||||
Page page=new Page(request,response,Constants.MAAT_JSON_SEND_SIZE,"a");
|
||||
handleNtcMaatData(cfgList,userRegionList,page,entity,request,response,false,tableName);
|
||||
}else{
|
||||
int cfgType = Integer.parseInt(service.get("cfgType").toString());
|
||||
if("ddos_ip_cfg".equals(tableName)){
|
||||
Page<DdosIpCfg> page=new Page<DdosIpCfg>(request,response,Constants.MAAT_JSON_SEND_SIZE,"a");
|
||||
handleDdosMaatData(cfgList,userRegionList,page,entity,request,response,false);
|
||||
}else{
|
||||
Page<T> page=new Page<T>(request,response,Constants.MAAT_JSON_SEND_SIZE,"a");
|
||||
handleSingleMaatData(cfgType,userRegionList,page,entity,request,response,false);
|
||||
}else{
|
||||
Page<T> page=new Page<T>(request,response,Constants.MAAT_JSON_SEND_SIZE,"a");
|
||||
handleSingleMaatData(cfgType,userRegionList,page,entity,request,response,false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}else if("2".equals(serviceType)){//回调类配置
|
||||
@@ -2252,4 +2249,262 @@ public class ConfigSynchronizationService extends BaseService{
|
||||
}
|
||||
return userRegion;
|
||||
}
|
||||
/**
|
||||
* 处理Obj group list
|
||||
* @throws SecurityException
|
||||
* @throws NoSuchFieldException
|
||||
* @throws IllegalAccessException
|
||||
* @throws IllegalArgumentException
|
||||
*/
|
||||
public void handleObjGroupListMaatData(Map<Integer,List<Map<String,Object>>> cfgMap,Map<Integer,List<Map<String,Object>>> userRegionMap,
|
||||
Page<T> page,BaseCfg entity,HttpServletRequest request,HttpServletResponse response,
|
||||
boolean isUpdateCfg,String tableName) throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException{
|
||||
|
||||
boolean hasData = true;
|
||||
int index=0;
|
||||
while(hasData){
|
||||
entity.setPage(page);
|
||||
List list = Lists.newArrayList();
|
||||
if("cfg_index_info".equals(tableName)){
|
||||
int ind=0;
|
||||
for(Map.Entry e:cfgMap.entrySet()){
|
||||
entity.setServiceId((Integer) e.getKey());
|
||||
list = configSynchronizationDao.getCfgIndexList(entity);
|
||||
if(CollectionUtils.isNotEmpty(list)){
|
||||
hasData=auditObjGroupListMaatData(cfgMap,userRegionMap,page,entity,list,hasData,isUpdateCfg);
|
||||
if(hasData) {
|
||||
page.setPageNo(page.getNext());
|
||||
}
|
||||
}else{
|
||||
hasData = false;
|
||||
}
|
||||
ind++;
|
||||
}
|
||||
|
||||
|
||||
}else{
|
||||
logger.info("全量同步未知业务");
|
||||
hasData = false;
|
||||
}
|
||||
|
||||
//此业务无数据需同步,也许向服务端发送一个{}串
|
||||
if(index ==0 && StringUtil.isEmpty(list) && !isUpdateCfg){
|
||||
String json = "{}";
|
||||
FileUtils.writeToFile("/home/ceiec/configSync/"+DateUtils.getDate("yyyy-MM-dd")+"/"+entity.getServiceId()+"_"+System.currentTimeMillis()+"(m nodata).json", json, false);
|
||||
JSONObject result = ConfigServiceUtil.configSync(json,1,entity.getServiceId(),entity.getTableName(),null);
|
||||
logger.info("全量下发响应信息:"+result.toString());
|
||||
}
|
||||
index++;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Obj Group List 配置批量下发
|
||||
* @param cfgMap
|
||||
* @param userRegionMap
|
||||
* @param page
|
||||
* @param entity
|
||||
* @param list
|
||||
* @param hasData
|
||||
* @param isUpdateCfg 业务配置全部生效时需同步更新库表配置状态
|
||||
* @return
|
||||
* @throws NoSuchFieldException
|
||||
* @throws SecurityException
|
||||
* @throws IllegalArgumentException
|
||||
* @throws IllegalAccessException
|
||||
*/
|
||||
public boolean auditObjGroupListMaatData(Map<Integer,List<Map<String,Object>>> cfgMap,
|
||||
Map<Integer,List<Map<String,Object>>> userRegionMap,
|
||||
Page page,
|
||||
BaseCfg entity,
|
||||
List<CfgIndexInfo> list,
|
||||
boolean hasData,
|
||||
boolean isUpdateCfg)throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException{
|
||||
ToMaatBean maatBean;
|
||||
MaatCfg maatCfg;
|
||||
List<MaatCfg> configCompileList;
|
||||
List<GroupCfg> groupRelationList;
|
||||
List<IpCfg> ipRegionList;
|
||||
List<StringCfg> strRegionList;
|
||||
List<NumBoundaryCfg> numRegionList;
|
||||
List<DigestCfg> digestRegionList;
|
||||
List<IpCfg> areaIpRegionList;
|
||||
|
||||
List<IpPortCfg> ipList = new ArrayList();
|
||||
List<AsnIpCfg> asnIpList = new ArrayList();
|
||||
List<BaseStringCfg> strList = new ArrayList();
|
||||
List<ComplexkeywordCfg> complexStrList = new ArrayList();
|
||||
List<com.nis.domain.configuration.NumBoundaryCfg> numList = new ArrayList();
|
||||
List<FileDigestCfg> fileList = new ArrayList();
|
||||
maatBean = new ToMaatBean();
|
||||
configCompileList = new ArrayList();
|
||||
List<Integer> compileIds = new ArrayList();
|
||||
List<IpCommCfg> ipCommCfgList=new ArrayList<>();
|
||||
List<ScriberIdCommCfg> scriberIdCommCfgList=new ArrayList<>();
|
||||
List<UrlCommCfg> urlCommCfgList=new ArrayList<>();
|
||||
List<DomainCommCfg> domainCommCfgList=new ArrayList<>();
|
||||
for(CfgIndexInfo cfg:list){
|
||||
//查询子配置
|
||||
String commonGroupIds=cfg.getCommonGroupIds();
|
||||
if(StringUtils.isNotBlank(commonGroupIds)){
|
||||
Map<String,Object> groupMap=ConfigConvertUtil.gsonFromJson(commonGroupIds,Map.class);
|
||||
if(groupMap.containsKey("ipGroup")){
|
||||
IpCommCfg commCfg=new IpCommCfg();
|
||||
commCfg.setCommonGroupIds(groupMap.get("ipGroup").toString().substring(1,groupMap.get("ipGroup").toString().length()-1));
|
||||
List<IpCommCfg> commIps=ipCommGroupCfgDao.findAllList(commCfg);
|
||||
if(CollectionUtils.isNotEmpty(commIps)){
|
||||
cfg.setIpCommGroupCfgList(commIps);
|
||||
}
|
||||
}
|
||||
if(groupMap.containsKey("subscribeIdGroup")){
|
||||
ScriberIdCommCfg commCfg=new ScriberIdCommCfg();
|
||||
commCfg.setCommonGroupIds(groupMap.get("subscribeIdGroup").toString().substring(1,groupMap.get("subscribeIdGroup").toString().length()-1));
|
||||
List<ScriberIdCommCfg> commIds=scriberIdCommGroupDao.findAllList(commCfg);
|
||||
if(CollectionUtils.isNotEmpty(commIds)){
|
||||
cfg.setScriberIdCommGroupList(commIds);
|
||||
}
|
||||
}
|
||||
if(groupMap.containsKey("urlGroup")){
|
||||
UrlCommCfg commCfg=new UrlCommCfg();
|
||||
commCfg.setCommonGroupIds(groupMap.get("urlGroup").toString().substring(1,groupMap.get("urlGroup").toString().length()-1));
|
||||
List<UrlCommCfg> commIds=urlCommGroupDao.findAllList(commCfg);
|
||||
if(CollectionUtils.isNotEmpty(commIds)){
|
||||
cfg.setUrlCommGroupList(commIds);
|
||||
}
|
||||
}
|
||||
if(groupMap.containsKey("domainGroup")){
|
||||
DomainCommCfg commCfg=new DomainCommCfg();
|
||||
commCfg.setCommonGroupIds(groupMap.get("domainGroup").toString().substring(1,groupMap.get("domainGroup").toString().length()-1));
|
||||
List<DomainCommCfg> commIds=domainCommGroupDao.findAllList(commCfg);
|
||||
if(CollectionUtils.isNotEmpty(commIds)){
|
||||
cfg.setDomainCommGroupList(commIds);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(isUpdateCfg) {
|
||||
if(!StringUtil.isEmpty(compileIds) && !StringUtil.isEmpty(entity.getTableName())) {
|
||||
commonPolicyDao.auditCfgBatch( entity.getTableName(), entity,compileIds,null);
|
||||
}
|
||||
}
|
||||
//批量获取regionId,groupId(相同编译下的IP类配置多条ip只获取一个组号),分组复用的域配置不需要重新获取regionId,groupId
|
||||
// List<Integer> regionIds = ConfigServiceUtil.getId(3, ipList.size()+strList.size()+complexStrList.size()+numList.size()+fileList.size());
|
||||
// List<Integer> groupIds = ConfigServiceUtil.getId(2, ipList.size()+strList.size()+complexStrList.size()+numList.size()+fileList.size());
|
||||
for(CfgIndexInfo cfg:list){
|
||||
maatCfg = new MaatCfg();
|
||||
maatCfg.initDefaultValue();
|
||||
groupRelationList = new ArrayList();
|
||||
ipRegionList = new ArrayList();
|
||||
strRegionList = new ArrayList();
|
||||
numRegionList = new ArrayList();
|
||||
digestRegionList = new ArrayList();
|
||||
areaIpRegionList = new ArrayList();
|
||||
List list1 = new ArrayList();
|
||||
List<BaseStringCfg> list2 = new ArrayList();
|
||||
List<ComplexkeywordCfg> list3 = new ArrayList();
|
||||
List<com.nis.domain.configuration.NumBoundaryCfg> list4 = new ArrayList();
|
||||
List<FileDigestCfg> list5 = new ArrayList();
|
||||
StringBuffer userRegion = new StringBuffer();
|
||||
//处理自定义域
|
||||
if(userRegionMap.containsKey(cfg.getServiceId())){
|
||||
List<Map<String,Object>> userRegionList=userRegionMap.get(cfg.getServiceId());
|
||||
userRegion.append(ConfigConvertUtil.generateCommonGroupDefaultUserRegion(null,cfg.getServiceId()));
|
||||
}
|
||||
|
||||
//Intercept Policy、http(s) 监测 、http(s) 白名单
|
||||
if("HTTPS".equalsIgnoreCase(entity.getUserRegion1())||"INTERCEPT".equalsIgnoreCase(entity.getUserRegion1())&&userRegion.toString().length()==0) {
|
||||
userRegion.append("{}");
|
||||
}
|
||||
//子配置
|
||||
if(cfgMap.containsKey(cfg.getServiceId())){
|
||||
List<Map<String,Object>> cfgList=(List<Map<String,Object>>)cfgMap.get(cfg.getServiceId());
|
||||
Map<String,Object> maatTableMap=ConfigConvertUtil.convertCommonGroupMaatTable(cfg,cfgList);
|
||||
Set<Integer> groupIdSet=new HashSet<>();
|
||||
//IP公共分组
|
||||
if(CollectionUtils.isNotEmpty(cfg.getIpCommGroupCfgList())){
|
||||
IpPortCfg _cfg = new IpPortCfg();
|
||||
BeanUtils.copyProperties(cfg, _cfg, new String[]{"cfgId"});
|
||||
Map<String,List> map = ConfigConvertUtil.objGroupCfgConvert(ipRegionList,cfg.getIpCommGroupCfgList(),1,_cfg,groupRelationList,maatTableMap,groupIdSet);
|
||||
groupRelationList=map.get("groupList");
|
||||
ipRegionList=map.get("dstList");
|
||||
if(map.get("numRegionList")!=null){
|
||||
numRegionList.addAll(map.get("numRegionList"));
|
||||
}
|
||||
|
||||
}
|
||||
//URL公共分组
|
||||
if(CollectionUtils.isNotEmpty(cfg.getUrlCommGroupList())){
|
||||
CommonStringCfg _cfg = new CommonStringCfg();
|
||||
BeanUtils.copyProperties(cfg, _cfg, new String[]{"cfgId"});
|
||||
Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(strRegionList,cfg.getUrlCommGroupList(),2,_cfg,groupRelationList,maatTableMap,groupIdSet);
|
||||
groupRelationList=map.get("groupList");
|
||||
strRegionList=map.get("dstList");
|
||||
}
|
||||
//账号公共分组
|
||||
if(CollectionUtils.isNotEmpty(cfg.getScriberIdCommGroupList())){
|
||||
CommonStringCfg _cfg = new CommonStringCfg();
|
||||
BeanUtils.copyProperties(cfg, _cfg, new String[]{"cfgId"});
|
||||
|
||||
Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(strRegionList,cfg.getScriberIdCommGroupList(),2,_cfg,groupRelationList,maatTableMap,groupIdSet);
|
||||
groupRelationList=map.get("groupList");
|
||||
strRegionList=map.get("dstList");
|
||||
|
||||
}
|
||||
//域名公共分组
|
||||
if(CollectionUtils.isNotEmpty(cfg.getDomainCommGroupList())){
|
||||
CommonStringCfg _cfg = new CommonStringCfg();
|
||||
BeanUtils.copyProperties(cfg, _cfg, new String[]{"cfgId",});
|
||||
|
||||
Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(strRegionList,cfg.getDomainCommGroupList(),2,_cfg,groupRelationList,maatTableMap,groupIdSet);
|
||||
groupRelationList=map.get("groupList");
|
||||
strRegionList=map.get("dstList");
|
||||
}
|
||||
BeanUtils.copyProperties(cfg, maatCfg);
|
||||
maatCfg.setAction(cfg.getAction());
|
||||
maatCfg.setAuditTime(StringUtil.isEmpty(entity.getAuditTime()) ? cfg.getAuditTime():entity.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(entity.getIsValid());
|
||||
if(!StringUtil.isEmpty(userRegion.toString())){
|
||||
maatCfg.setUserRegion(userRegion.toString());
|
||||
}
|
||||
configCompileList.add(maatCfg);
|
||||
}
|
||||
}
|
||||
page.setList(list);
|
||||
if(page.getLast()==page.getPageNo()){
|
||||
hasData = false;
|
||||
}
|
||||
if(CollectionUtils.isNotEmpty(configCompileList)){
|
||||
maatBean.setConfigCompileList(configCompileList);
|
||||
maatBean.setAuditTime(new Date());
|
||||
maatBean.setCreatorName(UserUtils.getUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.INSERT_ACTION);
|
||||
String json=gsonToJson(maatBean);
|
||||
//调用服务接口下发配置数据
|
||||
if(isUpdateCfg) {
|
||||
//logger.info("配置批量下发:"+json);
|
||||
//调用服务接口同步回调类配置
|
||||
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
||||
if(result!=null){
|
||||
logger.info("配置批量下发响应信息:"+result.getMsg());
|
||||
}
|
||||
}else {
|
||||
//调用服务接口配置全量更新
|
||||
isFinished = ((!hasData)&&lastServiceTag)?true:false;
|
||||
FileUtils.writeToFile("/home/ceiec/configSync/"+DateUtils.getDate("yyyy-MM-dd")+"/"+entity.getServiceId()+"_"+page.getPageNo()+"_"+System.currentTimeMillis()+".json", json, false);
|
||||
JSONObject result = ConfigServiceUtil.configSync(json,1,entity.getServiceId(),null,null);
|
||||
logger.info("全量下发响应信息:"+result.toString());
|
||||
}
|
||||
}
|
||||
return hasData;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,656 @@
|
||||
package com.nis.web.service.configuration;
|
||||
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.*;
|
||||
import com.nis.domain.configuration.*;
|
||||
import com.nis.domain.maat.MaatCfg;
|
||||
import com.nis.domain.maat.ToMaatBean;
|
||||
import com.nis.domain.maat.ToMaatResult;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.*;
|
||||
import com.nis.web.dao.basics.IpCommGroupCfgDao;
|
||||
import com.nis.web.dao.basics.PolicyGroupInfoDao;
|
||||
import com.nis.web.dao.basics.UrlCommGroupDao;
|
||||
import com.nis.web.dao.configuration.AreaIpCfgDao;
|
||||
import com.nis.web.dao.configuration.CommonPolicyDao;
|
||||
import com.nis.web.dao.configuration.ObjectGroupDao;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.BaseService;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.lang.StringEscapeUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
public class ObjectGroupService extends BaseService {
|
||||
@Autowired
|
||||
private ObjectGroupDao objectGroupDao;
|
||||
@Autowired
|
||||
private CommonPolicyDao commonPolicyDao;
|
||||
@Autowired
|
||||
private AreaIpCfgDao areaIpCfgDao;
|
||||
@Autowired
|
||||
private PolicyGroupInfoDao policyGroupInfoDao;
|
||||
@Autowired
|
||||
private IpCommGroupCfgDao ipCommGroupCfgDao;
|
||||
@Autowired
|
||||
private UrlCommGroupDao urlCommGroupCfgDao;
|
||||
public Page getPolicyListList(Page searchPage, CfgIndexInfo searchCfg) {
|
||||
// 生成数据权限过滤条件(dsf为dataScopeFilter的简写,在xml中使用 ${sqlMap.dsf}调用权限SQL)
|
||||
searchCfg.getSqlMap().put("dsf", configScopeFilter(searchCfg.getCurrentUser(),"a"));
|
||||
searchCfg.setPage(searchPage);
|
||||
List<CfgIndexInfo> list = commonPolicyDao.getPolicyList(searchCfg);
|
||||
for(CfgIndexInfo c:list){
|
||||
if(StringUtils.isNotBlank(c.getCommonGroupIds())){
|
||||
c.setUserRegion(this.gsonFromJson(c.getCommonGroupIds(),Map.class));
|
||||
}
|
||||
}
|
||||
searchPage.setList(list);
|
||||
return searchPage;
|
||||
}
|
||||
public CfgIndexInfo getObjectGroupCfg(Long cfgId,Integer compileId) {
|
||||
CfgIndexInfo cfg=objectGroupDao.getObjectGroupConfig(cfgId,compileId);
|
||||
//去除首尾括号
|
||||
if(StringUtils.isNotBlank(cfg.getCommonGroupIds())){
|
||||
Map<String,Object> userRegionMap=gsonFromJson(cfg.getCommonGroupIds(),Map.class);
|
||||
for(Map.Entry<String,Object> e:userRegionMap.entrySet()){
|
||||
String value=(String)e.getValue();
|
||||
if(value.startsWith(",")){
|
||||
value=value.substring(1);
|
||||
}
|
||||
if(value.endsWith(",")){
|
||||
value=value.substring(0,value.length()-1);
|
||||
}
|
||||
userRegionMap.put(e.getKey(),value);
|
||||
}
|
||||
cfg.setUserRegion(userRegionMap);
|
||||
}
|
||||
return cfg;
|
||||
}
|
||||
|
||||
public void saveOrUpdate(CfgIndexInfo entity) {
|
||||
String protocolType=entity.getUserRegion1();
|
||||
//获取旧的ID,用于更新时恢复policyGroupInfo的可选状态
|
||||
String oldCommonGroupIds= StringEscapeUtils.unescapeHtml(entity.getCommonGroupIds());
|
||||
//设置区域运营商信息
|
||||
setAreaEffectiveIds(entity);
|
||||
|
||||
int isValid=0;
|
||||
if(!StringUtil.isEmpty(entity.getIsValid()) && entity.getIsValid()==1) {
|
||||
isValid=1;
|
||||
}
|
||||
entity.setIsValid(0);
|
||||
entity.setIsAudit(0);
|
||||
//设置service_id
|
||||
if("HTTP".equalsIgnoreCase(protocolType)){
|
||||
|
||||
}else if("HTTPS".equalsIgnoreCase(protocolType)){
|
||||
if(entity.getAction().equals(1)){
|
||||
entity.setServiceId(592);
|
||||
}else if(entity.getAction().equals(16)){
|
||||
entity.setServiceId(576);
|
||||
}
|
||||
}else if("INTERCEPT".equalsIgnoreCase(protocolType)){
|
||||
entity.setServiceId(512);
|
||||
}
|
||||
if(entity.getCfgId()==null){
|
||||
Integer compileId = 0;
|
||||
try {
|
||||
//处理组
|
||||
if(!StringUtil.isEmpty(entity.getUserRegion())){
|
||||
entity.setCommonGroupIds(gsonToJson(entity.getUserRegion()));
|
||||
}
|
||||
List<Integer> idList = ConfigServiceUtil.getId(1, 1);
|
||||
if(idList!=null && idList.size()>0){
|
||||
compileId = idList.get(0);
|
||||
}
|
||||
entity.setCompileId(compileId);
|
||||
entity.setCreateTime(new Date());
|
||||
entity.setCreatorId(entity.getCurrentUser().getId());
|
||||
commonPolicyDao.saveCfgIndex(entity);
|
||||
//保存区域IP信息
|
||||
if(entity.getAreaCfg()!=null){
|
||||
for(AreaIpCfg cfg:entity.getAreaCfg()){
|
||||
cfg.initDefaultValue();
|
||||
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
|
||||
areaIpCfgDao.saveAreaIpCfg(cfg);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("数据保存出错");
|
||||
throw e;
|
||||
}
|
||||
|
||||
if(isValid==1) {
|
||||
entity.setIsAudit(1);
|
||||
entity.setIsValid(1);
|
||||
auditPolicy(entity, entity.getIsAudit(),Constants.INSERT_ACTION);
|
||||
}
|
||||
|
||||
}else{
|
||||
//处理公共分组
|
||||
if(MapUtils.isNotEmpty(entity.getUserRegion())){
|
||||
entity.setCommonGroupIds(gsonToJson(entity.getUserRegion()));
|
||||
}else{
|
||||
entity.setCommonGroupIds("");
|
||||
}
|
||||
// 审核未通过状态的配置 修改后状态改为未审核
|
||||
entity.setIsValid(0);
|
||||
entity.setIsAudit(0);
|
||||
entity.setEditorId(UserUtils.getUser().getId());
|
||||
entity.setEditTime(new Date());
|
||||
commonPolicyDao.updateCfgIndex(entity);
|
||||
|
||||
AreaIpCfg area = new AreaIpCfg();
|
||||
area.setCompileId(entity.getCompileId());
|
||||
area.setFunctionId(entity.getFunctionId());
|
||||
areaIpCfgDao.deleteAreaIpCfg(area);
|
||||
entity.setCreateTime(new Date());
|
||||
entity.setCreatorId(entity.getCurrentUser().getId());
|
||||
|
||||
//保存区域IP信息
|
||||
if(entity.getAreaCfg()!=null){
|
||||
for(AreaIpCfg cfg:entity.getAreaCfg()){
|
||||
cfg.initDefaultValue();
|
||||
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgDesc","cfgRegionCode","cfgType"});
|
||||
areaIpCfgDao.saveAreaIpCfg(cfg);
|
||||
}
|
||||
}
|
||||
|
||||
if(isValid==1) {
|
||||
entity.setIsAudit(1);
|
||||
entity.setIsValid(1);
|
||||
auditPolicy(entity, entity.getIsAudit(), Constants.UPDATE_ACTION);
|
||||
}
|
||||
}
|
||||
//更新UD_FLAG
|
||||
if(StringUtils.isNotBlank(oldCommonGroupIds)){
|
||||
Map<String,Object> oldMap=gsonFromJson(oldCommonGroupIds,Map.class);
|
||||
Map<String,Object> newMap=entity.getUserRegion();
|
||||
StringBuffer canceledGroup=new StringBuffer();
|
||||
|
||||
for(Map.Entry<String,Object> e:oldMap.entrySet()){
|
||||
if(MapUtils.isEmpty(newMap)){
|
||||
for(String s:((String)e.getValue()).split(",")){
|
||||
if(StringUtils.isNotBlank(s)){
|
||||
canceledGroup.append(","+s);
|
||||
}
|
||||
}
|
||||
}else if(newMap.containsKey(e.getKey())){
|
||||
for(String s:((String)e.getValue()).split(",")){
|
||||
if(StringUtils.isNotBlank(s)&&newMap.get(e.getKey()).toString().indexOf(","+s+",")==-1){
|
||||
canceledGroup.append(","+s);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(StringUtils.isNotBlank(e.getValue().toString())){
|
||||
String val=e.getValue().toString().substring(0,e.getValue().toString().length()-1);
|
||||
canceledGroup.append(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
StringBuffer okGroup=new StringBuffer();
|
||||
for(Object val:newMap.values()){
|
||||
String _val=(String)val;
|
||||
if(StringUtils.isNotBlank(_val)){
|
||||
if(_val.startsWith(",")){
|
||||
okGroup.append(_val.substring(1));
|
||||
}else{
|
||||
okGroup.append(_val);
|
||||
}
|
||||
}
|
||||
}
|
||||
//取消勾选的组更新UD_FLAG
|
||||
if(StringUtils.isNotBlank(canceledGroup.toString())){
|
||||
policyGroupInfoDao.updateUdFlag(canceledGroup.toString().substring(1),1,null);
|
||||
}
|
||||
//新选择的组更新UD_FALG
|
||||
if(StringUtils.isNotBlank(okGroup.toString())){
|
||||
okGroup.deleteCharAt(okGroup.toString().length()-1);
|
||||
policyGroupInfoDao.updateUdFlag(okGroup.toString(),2,null);
|
||||
}
|
||||
}else if(MapUtils.isNotEmpty(entity.getUserRegion())){
|
||||
policyGroupInfoDao.updateUdFlag(userRegionMapToString(entity.getUserRegion()),2,null);
|
||||
}
|
||||
//处理定时任务
|
||||
handelScheduleCfg(entity, entity.getIndexTable(), entity);
|
||||
}
|
||||
public CfgIndexInfo getObjGroupPolicyWithoutSubCfg(Long cfgId){
|
||||
CfgIndexInfo entity = commonPolicyDao.getPolicyById(cfgId);
|
||||
entity.setUserRegion((Map<String,Object>)this.gsonFromJson(entity.getUserRegion1(),Map.class));
|
||||
return entity;
|
||||
}
|
||||
public CfgIndexInfo getObjGroupPolicy(Long cfgId){
|
||||
CfgIndexInfo entity = commonPolicyDao.getPolicyById(cfgId);
|
||||
entity.setUserRegion((Map<String,Object>)this.gsonFromJson(entity.getCommonGroupIds(),Map.class));
|
||||
if(entity.getUserRegion().containsKey("ipGroup")){
|
||||
String ids=entity.getUserRegion().get("ipGroup").toString().startsWith(",")?entity.getUserRegion().get("ipGroup").toString().substring(1):entity.getUserRegion().get("ipGroup").toString();
|
||||
ids=ids.endsWith(",")?ids.substring(0,ids.length()-1):ids;
|
||||
List<IpCommCfg> ipList = objectGroupDao.getIpCommonList(ids,null);
|
||||
entity.setIpCommGroupCfgList(ipList);
|
||||
}
|
||||
if(entity.getUserRegion().containsKey("subscribeIdGroup")){
|
||||
String ids=entity.getUserRegion().get("subscribeIdGroup").toString().startsWith(",")?entity.getUserRegion().get("subscribeIdGroup").toString().substring(1):entity.getUserRegion().get("subscribeIdGroup").toString();
|
||||
ids=ids.endsWith(",")?ids.substring(0,ids.length()-1):ids;
|
||||
List<ScriberIdCommCfg> stringList=objectGroupDao.getScriberIdCommonList(ids,null);
|
||||
entity.setScriberIdCommGroupList(stringList);
|
||||
}
|
||||
if(entity.getUserRegion().containsKey("domainGroup")){
|
||||
String ids=entity.getUserRegion().get("domainGroup").toString().startsWith(",")?entity.getUserRegion().get("domainGroup").toString().substring(1):entity.getUserRegion().get("domainGroup").toString();
|
||||
ids=ids.endsWith(",")?ids.substring(0,ids.length()-1):entity.getUserRegion().get("domainGroup").toString();
|
||||
List<DomainCommCfg> stringList=objectGroupDao.getDomainCommonList(ids,null);
|
||||
entity.setDomainCommGroupList(stringList);
|
||||
}
|
||||
if(entity.getUserRegion().containsKey("urlGroup")){
|
||||
String ids=entity.getUserRegion().get("urlGroup").toString().startsWith(",")?entity.getUserRegion().get("urlGroup").toString().substring(1):entity.getUserRegion().get("urlGroup").toString();
|
||||
ids=ids.endsWith(",")?ids.substring(0,ids.length()-1):ids;
|
||||
List<UrlCommCfg> stringList = objectGroupDao.getUrlCommonList(ids,null);
|
||||
entity.setUrlCommGroupList(stringList);
|
||||
}
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
public void auditPolicy(CfgIndexInfo entity,Integer isAudit,Integer opAction) throws MaatConvertException {
|
||||
//修改数据库审核状态信息
|
||||
entity.setTableName(CfgIndexInfo.getTablename());
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
//审核cfg_index_info
|
||||
commonPolicyDao.auditCfg(entity);
|
||||
|
||||
ToMaatBean maatBean = new ToMaatBean();
|
||||
MaatCfg maatCfg = new MaatCfg();
|
||||
Set<Integer> groupIdSet=new HashSet<>();
|
||||
List<MaatCfg> configCompileList = new ArrayList();
|
||||
List<MaatCfg.GroupCfg> groupRelationList = new ArrayList();
|
||||
List<MaatCfg.IpCfg> ipRegionList = new ArrayList();
|
||||
List<MaatCfg.StringCfg> strRegionList = new ArrayList();
|
||||
List<MaatCfg.NumBoundaryCfg> numRegionList = new ArrayList();
|
||||
List<MaatCfg.DigestCfg> digestRegionList = new ArrayList();
|
||||
List<MaatCfg.IpCfg> areaIpRegionList = new ArrayList();
|
||||
|
||||
//查询子配置并修改审核状态
|
||||
entity = this.getObjGroupPolicy(entity.getCfgId());
|
||||
ServiceConfigTemplateUtil templateUtil=new ServiceConfigTemplateUtil();
|
||||
List<Map<String,Object>> serviceMapList= ServiceConfigTemplateUtil.getServiceList();
|
||||
List<FunctionServiceDict> dicts=DictUtils.getFunctionServiceDictList();
|
||||
Integer serviceId=entity.getServiceId();
|
||||
Map<String,Object> maatTableMap=new HashMap<>();
|
||||
|
||||
StringBuffer userRegion=new StringBuffer();
|
||||
if(serviceId!=null){
|
||||
if(isAudit==1){
|
||||
List<Map<String,Object>> list= templateUtil.getServiceListByServiceId(serviceId);
|
||||
//获取业务下的配置域
|
||||
List<Map<String,Object>> cfgList = new ArrayList<>();
|
||||
//获取业务下的自定义域
|
||||
List<Map<String,Object>> userRegionList = new ArrayList<>();
|
||||
for(Map<String,Object> service:list){
|
||||
String serviceType = service.get("serviceType").toString();
|
||||
if(service.containsKey("maatTable")){ }
|
||||
if(service.containsKey("cfgList")) {
|
||||
cfgList=(List<Map<String, Object>>) service.get("cfgList");
|
||||
maatTableMap=ConfigConvertUtil.convertCommonGroupMaatTable(entity,cfgList);
|
||||
}
|
||||
if(service.containsKey("userRegionList")){
|
||||
Map<String,Object> userregionMap=new HashMap<>();
|
||||
userRegionList=(List<Map<String, Object>>) service.get("userRegionList");
|
||||
userRegion.append(ConfigConvertUtil.generateCommonGroupDefaultUserRegion(userregionMap,serviceId));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//IP公共分组
|
||||
if(CollectionUtils.isNotEmpty(entity.getIpCommGroupCfgList())){
|
||||
IpPortCfg cfg = new IpPortCfg();
|
||||
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
|
||||
//cfg.setTableName("ip_comm_cfg");
|
||||
//commonPolicyDao.auditCfg(cfg);
|
||||
if(isAudit==1){
|
||||
Map<String,List> map = ConfigConvertUtil.objGroupCfgConvert(ipRegionList,entity.getIpCommGroupCfgList(),1,cfg,groupRelationList,maatTableMap,groupIdSet);
|
||||
groupRelationList=map.get("groupList");
|
||||
ipRegionList=map.get("dstList");
|
||||
if(map.get("numRegionList")!=null){
|
||||
numRegionList.addAll(map.get("numRegionList"));
|
||||
}
|
||||
}
|
||||
}
|
||||
//URL公共分组
|
||||
if(CollectionUtils.isNotEmpty(entity.getUrlCommGroupList())){
|
||||
CommonStringCfg cfg = new CommonStringCfg();
|
||||
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
|
||||
//cfg.setTableName(CommonStringCfg.getTablename());
|
||||
//commonPolicyDao.auditCfg(cfg);
|
||||
if(isAudit==1){
|
||||
Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(strRegionList,entity.getUrlCommGroupList(),2,cfg,groupRelationList,maatTableMap,groupIdSet);
|
||||
groupRelationList=map.get("groupList");
|
||||
strRegionList=map.get("dstList");
|
||||
}
|
||||
}
|
||||
//账号公共分组
|
||||
if(CollectionUtils.isNotEmpty(entity.getScriberIdCommGroupList())){
|
||||
CommonStringCfg cfg = new CommonStringCfg();
|
||||
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
|
||||
//cfg.setTableName(CommonStringCfg.getTablename());
|
||||
//commonPolicyDao.auditCfg(cfg);
|
||||
if(isAudit==1){
|
||||
Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(strRegionList,entity.getScriberIdCommGroupList(),2,cfg,groupRelationList,maatTableMap,groupIdSet);
|
||||
groupRelationList=map.get("groupList");
|
||||
strRegionList=map.get("dstList");
|
||||
}
|
||||
}
|
||||
//域名公共分组
|
||||
if(CollectionUtils.isNotEmpty(entity.getDomainCommGroupList())){
|
||||
CommonStringCfg cfg = new CommonStringCfg();
|
||||
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
|
||||
//cfg.setTableName(CommonStringCfg.getTablename());
|
||||
//commonPolicyDao.auditCfg(cfg);
|
||||
if(isAudit==1){
|
||||
Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(strRegionList,entity.getDomainCommGroupList(),2,cfg,groupRelationList,maatTableMap,groupIdSet);
|
||||
groupRelationList=map.get("groupList");
|
||||
strRegionList=map.get("dstList");
|
||||
}
|
||||
}
|
||||
//保存区域IP信息
|
||||
List<AreaIpCfg> areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId());
|
||||
if(!StringUtil.isEmpty(areaIpCfgList)){
|
||||
AreaIpCfg cfg = new AreaIpCfg();
|
||||
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
|
||||
cfg.setTableName(AreaIpCfg.getTablename());
|
||||
commonPolicyDao.auditCfg(cfg);
|
||||
if(isAudit==1){
|
||||
Map<String,List> map = cfgConvert(areaIpRegionList,areaIpCfgList,1,entity,groupRelationList);
|
||||
groupRelationList=map.get("groupList");
|
||||
areaIpRegionList=map.get("dstList");
|
||||
}
|
||||
}
|
||||
|
||||
//构造提交综合服务参数格式,一条配置提交一次综合服务
|
||||
if(isAudit==1){
|
||||
maatCfg.initDefaultValue();
|
||||
if(entity.getServiceId().equals(512)){
|
||||
maatCfg.setAction(2);
|
||||
}
|
||||
BeanUtils.copyProperties(entity, maatCfg);
|
||||
maatCfg.setAction(entity.getAction());
|
||||
maatCfg.setAuditTime(entity.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(entity.getIsValid());
|
||||
//设置用户自定义域
|
||||
String protpcolType=entity.getUserRegion1();
|
||||
|
||||
if("HTTPS".equalsIgnoreCase(protpcolType)||"INTERCEPT".equalsIgnoreCase(protpcolType)){
|
||||
if(StringUtils.isBlank(userRegion.toString())){
|
||||
userRegion.append("{}");
|
||||
}
|
||||
}else if("HTTP".equalsIgnoreCase(protpcolType)){
|
||||
|
||||
}
|
||||
maatCfg.setUserRegion(userRegion.toString());
|
||||
|
||||
configCompileList.add(maatCfg);
|
||||
maatBean.setConfigCompileList(configCompileList);
|
||||
maatBean.setAuditTime(entity.getAuditTime());
|
||||
maatBean.setCreatorName(entity.getCurrentUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(opAction);
|
||||
//调用服务接口下发配置数据
|
||||
String json=gsonToJson(maatBean);
|
||||
logger.info("策略对象组下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
||||
logger.info("策略对象组下发响应信息:"+result.getMsg());
|
||||
|
||||
}else if(isAudit==3){
|
||||
maatCfg.setCompileId(entity.getCompileId());
|
||||
maatCfg.setServiceId(entity.getServiceId());
|
||||
maatCfg.setIsValid(0);//无效
|
||||
configCompileList.add(maatCfg);
|
||||
maatBean.setConfigCompileList(configCompileList);
|
||||
maatBean.setAuditTime(entity.getAuditTime());
|
||||
maatBean.setCreatorName(entity.getCurrentUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.UPDATE_ACTION);
|
||||
//调用服务接口取消配置
|
||||
String json=gsonToJson(maatBean);
|
||||
logger.info("策略对象组下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
ToMaatResult result = ConfigServiceUtil.put(json,1);
|
||||
logger.info("策略对象组取消配置响应信息:"+result.getMsg());
|
||||
}
|
||||
}
|
||||
public boolean indexOfContains(String arrayString,String splitor,String current){
|
||||
if(arrayString==null||arrayString==null){
|
||||
return false;
|
||||
}
|
||||
return arrayString.equals(current)?true:arrayString.indexOf(splitor+current+splitor)>-1?true:arrayString.startsWith(current+splitor)?true:arrayString.endsWith(splitor+current)?true:false;
|
||||
}
|
||||
|
||||
public void updatePolicyValid(Integer isValid, String ids, Integer functionId) {
|
||||
String[] idArray = ids.split(",");
|
||||
for(String id :idArray){
|
||||
CfgIndexInfo entity = new CfgIndexInfo();
|
||||
entity.setCfgId(Long.parseLong(id));
|
||||
entity.setIsValid(isValid);
|
||||
entity.setEditorId(UserUtils.getUser().getId());
|
||||
entity.setEditTime(new Date());
|
||||
entity.setTableName(CfgIndexInfo.getTablename());
|
||||
entity.setFunctionId(functionId);
|
||||
commonPolicyDao.updateCfgValid(entity);
|
||||
//修改对应的policyGroupInfo的udFlag状态
|
||||
CfgIndexInfo cfg=commonPolicyDao.getPolicyById(Long.parseLong(id));
|
||||
String userregion=cfg.getCommonGroupIds();
|
||||
if(StringUtils.isNotBlank(userregion)){
|
||||
Map<String,Object> userRegionMap=gsonFromJson(userregion,Map.class);
|
||||
StringBuffer serviceGroupIds=new StringBuffer();
|
||||
for(Object val:userRegionMap.values()){
|
||||
if(val.toString().startsWith(",")){
|
||||
serviceGroupIds.append(val.toString().substring(1));
|
||||
}else{
|
||||
serviceGroupIds.append(val.toString());
|
||||
}
|
||||
}
|
||||
if(serviceGroupIds.toString().endsWith(",")){
|
||||
serviceGroupIds.deleteCharAt(serviceGroupIds.toString().length()-1);
|
||||
}
|
||||
//删除之后恢复组的ud_flag
|
||||
int size = ipCommGroupCfgDao.getCfgInfoByGroupIds(serviceGroupIds.toString());
|
||||
if(size==0){
|
||||
policyGroupInfoDao.updateUdFlag(serviceGroupIds.toString(),0,null);
|
||||
}else{
|
||||
policyGroupInfoDao.updateUdFlag(serviceGroupIds.toString(),1,null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@Transactional(rollbackFor = RuntimeException.class)
|
||||
public boolean batchDeleteMaatData(Page page, BaseCfg entity,
|
||||
List<BaseCfg> list, boolean hasData,String groupIds) {
|
||||
// 1.获取所有配置的编译ID
|
||||
List<Integer> compileIds = new ArrayList();
|
||||
|
||||
for(BaseCfg cfg:list){
|
||||
if(entity.getServiceId().equals(1028)) {
|
||||
compileIds.add(Integer.parseInt(cfg.getUserRegion1()));
|
||||
}else if(entity.getServiceId().equals(400)) {
|
||||
compileIds.add(cfg.getRegionId());
|
||||
}else {
|
||||
compileIds.add(cfg.getCompileId());
|
||||
}
|
||||
|
||||
cfg.setIsValid(-1);
|
||||
cfg.setIsAudit(0);
|
||||
}
|
||||
|
||||
// 2.更新配置状态(主表)
|
||||
if(!StringUtil.isEmpty(compileIds) && !StringUtil.isEmpty(entity.getTableName())) {
|
||||
commonPolicyDao.deleteCfgBatch(entity.getTableName(), entity,compileIds); // 批量修改配置状态(主表)
|
||||
//更新各配置定时任务信息
|
||||
handelScheduleCfg(list, entity.getTableName(),entity);
|
||||
}
|
||||
//3.恢复policy_group_info可选状态
|
||||
policyGroupInfoDao.updateUdFlag(groupIds,1,null);
|
||||
// 4.判断是否是当前检索条件下最后一页数据 并返回结果
|
||||
page.setList(list);
|
||||
if(page.isLastPage()){
|
||||
hasData = false;
|
||||
}
|
||||
return hasData;
|
||||
}
|
||||
private String userRegionMapToString(Map<String,Object> dataMap){
|
||||
StringBuffer buf=new StringBuffer();
|
||||
for(Object val:dataMap.values()){
|
||||
String _val=(String)val;
|
||||
if(_val.startsWith(",")){
|
||||
buf.append(_val.substring(1));
|
||||
}else{
|
||||
buf.append(_val);
|
||||
}
|
||||
}
|
||||
if(buf.toString().endsWith(",")){
|
||||
buf.deleteCharAt(buf.toString().length()-1);
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
public List<ObjGroupCfg> getObjGroupList(String ids,Properties msgProp,Integer functionId){
|
||||
List<ObjGroupCfg> list = commonPolicyDao.getObjGroupList(ids);
|
||||
StringBuffer groupIds=new StringBuffer();
|
||||
List<PolicyGroupInfo> policyGroupInfos=new ArrayList<>();
|
||||
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(functionId);
|
||||
for (ObjGroupCfg c : list) {
|
||||
if(!StringUtil.isBlank(c.getCommonGroupIds())) {
|
||||
Map<String,String> groupIdMap=ConfigConvertUtil.gsonFromJson(c.getCommonGroupIds(),Map.class);
|
||||
for(String value:groupIdMap.values()){
|
||||
if(StringUtils.isNotBlank(value)){
|
||||
groupIds.append(value.substring(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
for (FunctionServiceDict service : serviceList) {
|
||||
if(c.getAction().intValue()==service.getAction().intValue()){
|
||||
c.setActionCode(msgProp.getProperty(service.getActionCode(),service.getActionCode()));
|
||||
}
|
||||
}
|
||||
}
|
||||
if(StringUtils.isNotBlank(groupIds.toString())){
|
||||
groupIds.deleteCharAt(groupIds.toString().length()-1);
|
||||
policyGroupInfos=policyGroupInfoDao.findPolicyByServiceGroupInfoList(groupIds.toString());
|
||||
}
|
||||
Map<Integer,PolicyGroupInfo> policyGroupInfoMap=new HashMap<>();
|
||||
for(PolicyGroupInfo info:policyGroupInfos){
|
||||
policyGroupInfoMap.put(info.getServiceGroupId(),info);
|
||||
}
|
||||
Map<Integer,PolicyGroupInfo> policyGroupInfoMapCopy=new HashMap<>();
|
||||
policyGroupInfoMapCopy.putAll(policyGroupInfoMap);
|
||||
for (ObjGroupCfg c : list) {
|
||||
for(Map.Entry<Integer,PolicyGroupInfo> e:policyGroupInfoMap.entrySet()){
|
||||
if(c.getCommonGroupIds().indexOf(","+e.getKey()+",")>-1){
|
||||
if(e.getValue().getGroupType().equals(Constants.IP_OBJ_GROUP_TYPE)){
|
||||
String name=(StringUtils.isBlank(c.getIpGroup())?"":c.getIpGroup())+","+e.getValue().getGroupName();
|
||||
c.setIpGroup(name);
|
||||
policyGroupInfoMap.remove(e.getKey());
|
||||
}else if(e.getValue().getGroupType().equals(Constants.URL_OBJ_GROUP_TYPE)){
|
||||
String name=(StringUtils.isBlank(c.getIpGroup())?"":c.getUrlGroup())+","+e.getValue().getGroupName();
|
||||
c.setUrlGroup(name);
|
||||
policyGroupInfoMap.remove(e.getKey());
|
||||
}else if(e.getValue().getGroupType().equals(Constants.SUBID_OBJ_GROUP_TYPE)){
|
||||
String name=(StringUtils.isBlank(c.getSubscribeIdGroup())?"":c.getSubscribeIdGroup())+","+e.getValue().getGroupName();
|
||||
c.setSubscribeIdGroup(name);
|
||||
policyGroupInfoMap.remove(e.getKey());
|
||||
}else if(e.getValue().getGroupType().equals(Constants.DOMAIN_OBJ_GROUP_TYPE)){
|
||||
String name=(StringUtils.isBlank(c.getDomainGroup())?"":c.getDomainGroup())+","+e.getValue().getGroupName();
|
||||
c.setDomainGroup(name);
|
||||
policyGroupInfoMap.remove(e.getKey());
|
||||
}
|
||||
}
|
||||
}
|
||||
policyGroupInfoMapCopy.clear();
|
||||
policyGroupInfoMapCopy.putAll(policyGroupInfoMap);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public Page<ObjGroupCfg> getObjGroup(Page<ObjGroupCfg> page, ObjGroupCfg entity,Properties msgProp){
|
||||
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"a"));
|
||||
entity.setPage(page);
|
||||
StringBuffer groupIds=new StringBuffer();
|
||||
List<ObjGroupCfg> list = commonPolicyDao.getObjGroupPagedList(entity);
|
||||
List<PolicyGroupInfo> policyGroupInfos=new ArrayList<>();
|
||||
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(entity.getFunctionId());
|
||||
|
||||
for (ObjGroupCfg c : list) {
|
||||
if(StringUtils.isNotBlank(c.getCommonGroupIds())) {
|
||||
Map<String,String> groupIdMap=ConfigConvertUtil.gsonFromJson(c.getCommonGroupIds(),Map.class);
|
||||
for(String value:groupIdMap.values()){
|
||||
if(StringUtils.isNotBlank(value)){
|
||||
groupIds.append(value.substring(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
for (FunctionServiceDict service : serviceList) {
|
||||
if(c.getAction().intValue()==service.getAction().intValue()){
|
||||
c.setActionCode(msgProp.getProperty(service.getActionCode(),service.getActionCode()));
|
||||
}
|
||||
}
|
||||
}
|
||||
if(StringUtils.isNotBlank(groupIds.toString())){
|
||||
groupIds.deleteCharAt(groupIds.toString().length()-1);
|
||||
policyGroupInfos=policyGroupInfoDao.findPolicyByServiceGroupInfoList(groupIds.toString());
|
||||
}
|
||||
Map<Integer,PolicyGroupInfo> policyGroupInfoMap=new HashMap<>();
|
||||
for(PolicyGroupInfo info:policyGroupInfos){
|
||||
policyGroupInfoMap.put(info.getServiceGroupId(),info);
|
||||
}
|
||||
Map<Integer,PolicyGroupInfo> policyGroupInfoMapCopy=new HashMap<>();
|
||||
policyGroupInfoMapCopy.putAll(policyGroupInfoMap);
|
||||
for (ObjGroupCfg c : list) {
|
||||
for(Map.Entry<Integer,PolicyGroupInfo> e:policyGroupInfoMapCopy.entrySet()){
|
||||
if(c.getCommonGroupIds().indexOf(","+e.getKey()+",")>-1){
|
||||
if(e.getValue().getGroupType().equals(Constants.IP_OBJ_GROUP_TYPE)){
|
||||
String name=(StringUtils.isBlank(c.getIpGroup())?"":c.getIpGroup())+","+e.getValue().getGroupName();
|
||||
c.setIpGroup(name);
|
||||
policyGroupInfoMap.remove(e.getKey());
|
||||
}else if(e.getValue().getGroupType().equals(Constants.URL_OBJ_GROUP_TYPE)){
|
||||
String name=(StringUtils.isBlank(c.getIpGroup())?"":c.getUrlGroup())+","+e.getValue().getGroupName();
|
||||
c.setUrlGroup(name);
|
||||
policyGroupInfoMap.remove(e.getKey());
|
||||
}else if(e.getValue().getGroupType().equals(Constants.SUBID_OBJ_GROUP_TYPE)){
|
||||
String name=(StringUtils.isBlank(c.getSubscribeIdGroup())?"":c.getSubscribeIdGroup())+","+e.getValue().getGroupName();
|
||||
c.setSubscribeIdGroup(name);
|
||||
policyGroupInfoMap.remove(e.getKey());
|
||||
}else if(e.getValue().getGroupType().equals(Constants.DOMAIN_OBJ_GROUP_TYPE)){
|
||||
String name=(StringUtils.isBlank(c.getDomainGroup())?"":c.getDomainGroup())+","+e.getValue().getGroupName();
|
||||
c.setDomainGroup(name);
|
||||
policyGroupInfoMap.remove(e.getKey());
|
||||
}
|
||||
}
|
||||
}
|
||||
policyGroupInfoMapCopy.clear();
|
||||
policyGroupInfoMapCopy.putAll(policyGroupInfoMap);
|
||||
}
|
||||
page.setList(list);
|
||||
return page;
|
||||
}
|
||||
}
|
||||
@@ -1634,5 +1634,10 @@ domain_group_configuration=Domain Group Configuration
|
||||
scriberid_group_configuration=ScriberId Group Configuration
|
||||
common_group_manage=Common Group Manage
|
||||
can_not_delete_issued_group=Can not delete issued group
|
||||
#---------------------------Object List Group Manage------------------------------------
|
||||
intercept_built_in=Built-in policy does not allow this operation!
|
||||
obj_group_configuration=Object Group Configuration
|
||||
domain_group=Domain Group
|
||||
url_group=URL Group
|
||||
subscribe_id_group=Subscribe Id Group
|
||||
at_least_one_group=Please choose at least one group
|
||||
most_eight_group=At most 8 groups you can choose
|
||||
#---------------------------Object List Group Manage------------------------------------
|
||||
@@ -1605,7 +1605,7 @@ hour=Hour
|
||||
year=Year
|
||||
chart_type=Chart Type
|
||||
line_chart=Line Chart
|
||||
column_chart=Bar Chart
|
||||
bar_chart=Bar Chart
|
||||
pie_chart=Pie Chart
|
||||
statistical_content=Statistical Content
|
||||
statistical_detail=Statistical Detail
|
||||
@@ -1636,5 +1636,10 @@ domain_group_configuration=Domain Group Configuration
|
||||
scriberid_group_configuration=ScriberId Group Configuration
|
||||
common_group_manage=Common Group Manage
|
||||
can_not_delete_issued_group=Can not delete issued group
|
||||
#---------------------------Object List Group Manage------------------------------------
|
||||
intercept_built_in=Built-in policy does not allow this operation!
|
||||
obj_group_configuration=Object Group Configuration
|
||||
domain_group=Domain Group
|
||||
url_group=URL Group
|
||||
subscribe_id_group=Subscribe Id Group
|
||||
at_least_one_group=Please choose at least one group
|
||||
most_eight_group=At most 8 groups you can choose
|
||||
#---------------------------Object List Group Manage------------------------------------
|
||||
@@ -1498,9 +1498,9 @@ validate_error=\u9a8c\u8bc1\u65f6\u53d1\u751f\u610f\u5916\u9519\u8bef
|
||||
is_schduler=\u5b9a\u65f6\u5668
|
||||
v4_num=IPv4 \u6570\u91cf
|
||||
v6_num=IPv6 \u6570\u91cf
|
||||
always=\u957f\u671f
|
||||
always=\u957f\u671f
|
||||
schedule=Scheduler
|
||||
cancel_all=\u53d6\u6d88\u6240\u6709\u914d\u7f6e!
|
||||
cancel_all=\u53d6\u6d88\u6240\u6709\u914d\u7f6e!
|
||||
pre_version=\u4e0a\u4e00\u7248
|
||||
approved_all=\u5ba1\u6838\u901a\u8fc7\u6240\u6709\u914d\u7f6e!
|
||||
protection_list_manage=\u5185\u7f6e\u4fdd\u62a4\u540d\u5355\u7ba1\u7406
|
||||
@@ -1515,7 +1515,7 @@ the_same_ip_type=\u6e90IP\u4e0e\u76ee\u7684IP\u7684IP\u7c7b\u578b\u5fc5\u987b\u7
|
||||
src_ip_pattern=\u6e90IP\u683c\u5f0f
|
||||
dest_ip_pattern=\u76ee\u7684IP\u683c\u5f0f
|
||||
src_port_pattern=\u6e90\u7aef\u53e3\u683c\u5f0f
|
||||
dest_port_pattern=\u76ee\u7684\u7aef\u53e3\u683c\u5f0f
|
||||
dest_port_pattern=\u76ee\u7684\u7aef\u53e3\u683c\u5f0f
|
||||
url_group_configuration=URL \u5206\u7ec4\u914d\u7f6e
|
||||
dns_keyword_group_configuration=DNS \u5173\u952e\u5b57\u5206\u7ec4\u914d\u7f6e
|
||||
app_ip_correlation=APP IP \u901a\u8054
|
||||
@@ -1548,7 +1548,7 @@ format=\u683c\u5f0f
|
||||
file_is_used=\u7b56\u7565\u88ab\u5f15\u7528
|
||||
none_profile_tip=\u8bf7\u9009\u62e9\u6587\u4ef6!
|
||||
#---------------------------pxy intercept------------------------------------
|
||||
min_should_less_than_max=\u6700\u5c0fSSL\u7248\u672c\u5e94\u5c0f\u4e8e\u6216\u7b49\u4e8e\u6700\u5927SSL\u7248\u672c
|
||||
min_should_less_than_max=\u6700\u5c0fSSL\u7248\u672c\u5e94\u5c0f\u4e8e\u6216\u7B49\u4E8E\u6700\u5927SSL\u7248\u672c
|
||||
exclusions_ev_cert=\u6392\u9664EV\u8bc1\u4e66
|
||||
exclusions_cert_transparency=\u6392\u9664\u8bc1\u4e66\u900f\u660e
|
||||
exclusions_client_cert_req=\u6392\u9664\u5ba2\u6237\u7aef\u8bc1\u4e66\u8bf7\u6c42
|
||||
@@ -1603,7 +1603,7 @@ hour=\u5c0f\u65f6
|
||||
year=\u5e74
|
||||
chart_type=\u56fe\u8868\u7c7b\u578b
|
||||
line_chart=\u6298\u7ebf\u56fe
|
||||
column_chart=\u67f1\u72b6\u56fe
|
||||
bar_chart=\u6761\u5f62\u56fe
|
||||
pie_chart=\u997c\u56fe
|
||||
statistical_content=\u7edf\u8ba1\u5185\u5bb9
|
||||
statistical_detail=\u7edf\u8ba1\u660e\u7ec6
|
||||
@@ -1626,13 +1626,18 @@ ssl_client_side_version=\u5ba2\u6237\u7aef\u4fa7SSL\u7248\u672c
|
||||
ssl_cert_verify=\u8bc1\u4e66\u6821\u9a8c\u7ed3\u679c
|
||||
stream_trace_id=\u6d41\u7684\u8ffd\u8e2aID
|
||||
ssl_error=SSL\u9519\u8bef\u4fe1\u606f
|
||||
import_built_cert_file=\u5bfc\u5165\u5185\u7f6e\u8bc1\u4e66
|
||||
built_in=\u5185\u7f6e\u8bc1\u4e66
|
||||
import_built_cert_file=\u5BFC\u5165\u5185\u7F6E\u8BC1\u4E66
|
||||
built_in=\u5185\u7F6E\u8BC1\u4E66
|
||||
#---------------------------Object List Group Manage------------------------------------
|
||||
ip_group_configuration=IP \u5206\u7ec4\u914d\u7f6e
|
||||
domain_group_configuration=\u57df\u540d\u5206\u7ec4\u914d\u7f6e
|
||||
scriberid_group_configuration=\u8d26\u53f7\u5206\u7ec4\u914d\u7f6e
|
||||
common_group_manage=\u516c\u5171\u5206\u7ec4\u7ba1\u7406
|
||||
can_not_delete_issued_group=\u4e0d\u80fd\u5220\u9664\u5df2\u7ecf\u88ab\u5f15\u7528\u7684\u5206\u7ec4
|
||||
#---------------------------Object List Group Manage------------------------------------
|
||||
intercept_built_in=\u5185\u7F6E\u7B56\u7565\u4E0D\u5141\u8BB8\u6B64\u64CD\u4F5C\uFF01
|
||||
domain_group_configuration=\u57DF\u540D\u5206\u7ec4\u914d\u7f6e
|
||||
scriberid_group_configuration=\u8D26\u53F7\u5206\u7ec4\u914d\u7f6e
|
||||
common_group_manage=\u516C\u5171\u5206\u7EC4\u7BA1\u7406
|
||||
can_not_delete_issued_group=\u4E0D\u80FD\u5220\u9664\u5DF2\u7ECF\u88AB\u5F15\u7528\u7684\u5206\u7EC4
|
||||
obj_group_configuration=\u5BF9\u8C61\u7EC4\u7BA1\u7406
|
||||
domain_group=\u57DF\u540D\u7EC4
|
||||
url_group=URL\u7EC4
|
||||
subscribe_id_group=\u8D26\u53F7\u7EC4
|
||||
at_least_one_group=\u8FB7\u81F3\u5C11\u9009\u62E9\u4E00\u4E2A\u7EC4
|
||||
most_eight_group=\u81F3\u591A\u53EF\u9009\u62E9\u0038\u4E2A\u7EC4
|
||||
#---------------------------Object List Group Manage------------------------------------
|
||||
20
src/main/resources/sql/20190613/obj_group_list.sql
Normal file
20
src/main/resources/sql/20190613/obj_group_list.sql
Normal file
@@ -0,0 +1,20 @@
|
||||
#function_service_dict
|
||||
INSERT INTO `function_service_dict`(`function_id`, `protocol_id`, `action`, `action_code`, `service_id`, `service_name`, `service_desc`, `is_valid`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `region_code`, `is_import`, `sort`, `config_do_log`) VALUES (888, 0, 1, 'monit', 0, 'obj_group_monit', NULL, 1, NULL, NULL, NULL, NULL, NULL, 0, 0, '1;0,1,2;2');
|
||||
INSERT INTO `function_service_dict`(`function_id`, `protocol_id`, `action`, `action_code`, `service_id`, `service_name`, `service_desc`, `is_valid`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `region_code`, `is_import`, `sort`, `config_do_log`) VALUES (888, 0, 16, 'reject', -1, 'obj_group_reject', NULL, 1, NULL, NULL, NULL, NULL, NULL, 0, 0, '1;0,1,2;2');
|
||||
#functiuon_region_dict;
|
||||
INSERT INTO `function_region_dict`( `function_id`, `config_district`, `config_region_code`, `config_region_value`, `config_desc`, `is_valid`, `is_maat`, `region_type`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `config_service_type`, `config_expr_type`, `config_match_method`, `config_ip_type`, `config_hex`, `config_multi_keywords`, `config_ip_pattern`, `config_port_pattern`, `config_direction`, `config_protocol`, `config_ip_port_show`, `config_region_sort`, `is_import`) VALUES (888, '', 0, '0', '0', 1, 1, 0, NULL, NULL, NULL, NULL, '', '', '', '', '', '', NULL, NULL, NULL, NULL, NULL, 1, 1);
|
||||
#sys_menu
|
||||
#审计菜单 Object-List-Group
|
||||
INSERT INTO `sys_menu`(`parent_id`, `parent_ids`, `code`, `name`, `sort`, `href`, `target`, `icon`, `is_show`, `permission`, `create_by`, `create_date`, `update_by`, `update_date`, `remarks`, `del_flag`, `menu_bg`, `quick_action`, `is_top`, `function_id`) select id, CONCAT('0,1,',id),'Object-List-Group', 'Object-List-Group', 5060, '', '', '', 1, '', '1', '2019-06-13 19:46:56', '1', '2019-06-13 19:46:56', '', 1, NULL, 0, 0, NULL from sys_menu s1 where s1.code='audit_manage' and s1.del_flag=1;
|
||||
#审核菜单 Object-List-Group
|
||||
INSERT INTO `sys_menu`(`parent_id`, `parent_ids`, `code`, `name`, `sort`, `href`, `target`, `icon`, `is_show`, `permission`, `create_by`, `create_date`, `update_by`, `update_date`, `remarks`, `del_flag`, `menu_bg`, `quick_action`, `is_top`, `function_id`) select id, CONCAT('0,1,',id),'Object-List-Group', 'Object-List-Group', 5060, '', '', '', 1, '', '1', '2019-06-13 19:46:56', '1', '2019-06-13 19:46:56', '', 1, NULL, 0, 0, NULL from sys_menu s1 where s1.code='examine_manage' and s1.del_flag=1;
|
||||
#配置菜单 Object-List-Group
|
||||
INSERT INTO `sys_menu`(`parent_id`, `parent_ids`, `code`, `name`, `sort`, `href`, `target`, `icon`, `is_show`, `permission`, `create_by`, `create_date`, `update_by`, `update_date`, `remarks`, `del_flag`, `menu_bg`, `quick_action`, `is_top`, `function_id`) select id, CONCAT('0,1,',id),'Object-List-Group', 'Object-List-Group', 5060, '', '', '', 1, '', '1', '2019-06-13 19:46:56', '1', '2019-06-13 19:46:56', '', 1, NULL, 0, 0, NULL from sys_menu s1 where s1.code='configuration_manage' and s1.del_flag=1;
|
||||
#审计置菜单 Policy Group
|
||||
INSERT INTO `sys_menu`(`parent_id`, `parent_ids`, `code`, `name`, `sort`, `href`, `target`, `icon`, `is_show`, `permission`, `create_by`, `create_date`, `update_by`, `update_date`, `remarks`, `del_flag`, `menu_bg`, `quick_action`, `is_top`, `function_id`) select s1.id,CONCAT_WS(',','0,1',s2.id,s1.id), 'Policy Group', 'Policy Group', 30, '/objgroup/list', '', '', 1, 'objgroup:audit', '1', '2019-06-13 19:47:42', '1', '2019-06-13 19:47:42', '', 1, NULL, 0, 0, 888 from sys_menu s1,sys_menu s2 where s2.code='audit_manage' and s2.del_flag=1 and s1.parent_id=s2.id and s1.code='Object-List-Group';
|
||||
#审核置菜单 Policy Group
|
||||
INSERT INTO `sys_menu`(`parent_id`, `parent_ids`, `code`, `name`, `sort`, `href`, `target`, `icon`, `is_show`, `permission`, `create_by`, `create_date`, `update_by`, `update_date`, `remarks`, `del_flag`, `menu_bg`, `quick_action`, `is_top`, `function_id`) select s1.id,CONCAT_WS(',','0,1',s2.id,s1.id), 'Policy Group', 'Policy Group', 30, '/objgroup/list', '', '', 1, 'objgroup:audit', '1', '2019-06-13 19:47:42', '1', '2019-06-13 19:47:42', '', 1, NULL, 0, 0, 888 from sys_menu s1,sys_menu s2 where s2.code='examine_manage' and s2.del_flag=1 and s1.parent_id=s2.id and s1.code='Object-List-Group';
|
||||
#配置置菜单 Policy Group
|
||||
INSERT INTO `sys_menu`(`parent_id`, `parent_ids`, `code`, `name`, `sort`, `href`, `target`, `icon`, `is_show`, `permission`, `create_by`, `create_date`, `update_by`, `update_date`, `remarks`, `del_flag`, `menu_bg`, `quick_action`, `is_top`, `function_id`) select s1.id,CONCAT_WS(',','0,1',s2.id,s1.id), 'Policy Group', 'Policy Group', 30, '/objgroup/list', '', '', 1, 'objgroup:audit', '1', '2019-06-13 19:47:42', '1', '2019-06-13 19:47:42', '', 1, NULL, 0, 0, 888 from sys_menu s1,sys_menu s2 where s2.code='configuration_manage' and s2.del_flag=1 and s1.parent_id=s2.id and s1.code='Object-List-Group';
|
||||
|
||||
|
||||
417
src/main/webapp/WEB-INF/views/cfg/objgroup/form.jsp
Normal file
417
src/main/webapp/WEB-INF/views/cfg/objgroup/form.jsp
Normal file
@@ -0,0 +1,417 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8"%>
|
||||
<%@ include file="/WEB-INF/include/taglib.jsp"%>
|
||||
<html>
|
||||
<head>
|
||||
<title><spring:message code="obj_group_configuration"></spring:message></title>
|
||||
<style type="text/css">
|
||||
.boxSolid {
|
||||
border: 1px solid #eeeeee
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
if('${_cfg.action}'!=1){
|
||||
$("[name='userRegion1'] option[value=intercept]").addClass("hidden").addClass("disabled");
|
||||
$(".domainGroup").addClass("hidden").addClass("disabled");
|
||||
//处理do_log
|
||||
$("[name='doLog']").each(function () {
|
||||
if($(this).val()==0){
|
||||
$(this).parent(".radio-inline").removeClass("hidden");
|
||||
}
|
||||
})
|
||||
}else{
|
||||
//处理do_log
|
||||
$("[name='doLog']").each(function () {
|
||||
if($(this).val()==0){
|
||||
$(this).parent(".radio-inline").addClass("hidden");
|
||||
}
|
||||
})
|
||||
}
|
||||
if('${_cfg.userRegion1}'=='intercept'){
|
||||
$(".urlGroup").addClass("hidden").addClass("disabled");
|
||||
$(".subscribeIdGroup").addClass("hidden").addClass("disabled");
|
||||
//处理do_log
|
||||
$(".doLog").addClass("hidden");
|
||||
$("[name='doLog']").find("[value=2]").prop("checked",true);
|
||||
}else if('${_cfg.userRegion1}'=='https'){
|
||||
$(".domainGroup").addClass("hidden").addClass("disabled");
|
||||
}
|
||||
$(".action").on("change", function() {
|
||||
$("#serviceId").val($(this).attr("serviceId"));
|
||||
$("#protocolId").val($(this).attr("protocolId"));
|
||||
var action=$("input[name='action']:checked").val();
|
||||
switchAction(action);
|
||||
//处理页面协议
|
||||
if($(this).val()!="1"){
|
||||
if($("[name='userRegion1']").val()=="intercept"){
|
||||
$("[name='userRegion1']").selectpicker("val","https");
|
||||
$("[name='userRegion1']").change();
|
||||
}
|
||||
$("[name='userRegion1'] option[value=intercept]").addClass("hidden").addClass("disabled");
|
||||
$(".domainGroup").addClass("hidden").addClass("disabled");
|
||||
//处理do_log
|
||||
$(".doLog").removeClass("hidden");
|
||||
$("[name='doLog']").each(function () {
|
||||
if($(this).val()==0){
|
||||
$(this).parent(".radio-inline").removeClass("hidden");
|
||||
}
|
||||
})
|
||||
}else{
|
||||
$("[name='userRegion1'] option[value=intercept]").removeClass("hidden").removeClass("disabled");
|
||||
if($("[name='userRegion1']").val()=="intercept"){
|
||||
$(".domainGroup").removeClass("hidden").removeClass("disabled");
|
||||
//处理do_log
|
||||
$(".doLog").addClass("hidden");
|
||||
}else{
|
||||
$(".domainGroup").addClass("hidden").addClass("disabled");
|
||||
//处理do_log
|
||||
$(".doLog").removeClass("hidden");
|
||||
}
|
||||
$("[name='doLog']").each(function () {
|
||||
if($(this).val()==0){
|
||||
if(typeof($(this).attr("checked"))!="undefined"){
|
||||
$(this).removeAttr("checked");
|
||||
}
|
||||
$(this).parent(".radio-inline").addClass("hidden");
|
||||
}
|
||||
})
|
||||
}
|
||||
$("[name='userRegion1']").selectpicker("refresh");
|
||||
});
|
||||
$("[name='userRegion1']").on("change",function () {
|
||||
if("intercept"==$(this).val()){
|
||||
$(".urlGroup").addClass("hidden").addClass("disabled");
|
||||
$(".subscribeIdGroup").addClass("hidden").addClass("disabled");
|
||||
$(".domainGroup").removeClass("hidden").removeClass("disabled");
|
||||
//处理do_log
|
||||
$(".doLog").addClass("hidden");
|
||||
$("[name='doLog']").find("[value=2]").prop("checked",true);
|
||||
}else if("https"==$(this).val()){
|
||||
$(".urlGroup").removeClass("hidden").removeClass("disabled");
|
||||
$(".subscribeIdGroup").removeClass("hidden").removeClass("disabled");
|
||||
$(".domainGroup").addClass("hidden").addClass("disabled");
|
||||
//处理do_log
|
||||
$(".doLog").removeClass("hidden");
|
||||
}else{
|
||||
$(".urlGroup").removeClass("hidden").removeClass("disabled");
|
||||
$(".subscribeIdGroup").removeClass("hidden").removeClass("disabled");
|
||||
$(".domainGroup").removeClass("hidden").removeClass("disabled");
|
||||
//处理do_log
|
||||
$(".doLog").removeClass("hidden");
|
||||
}
|
||||
})
|
||||
$("#serviceId").val($(".action:checked").attr("serviceId"));
|
||||
$("#protocolId").val($(".action:checked").attr("protocolId"));
|
||||
|
||||
$("#cfgFrom").validate({
|
||||
errorPlacement: function(error,element){
|
||||
if($(element).parents().hasClass("tagsinput")){
|
||||
$(element).parents(".col-md-6").next("div").append(error);
|
||||
}else{
|
||||
$(element).parents(".form-group").find("div[for='"+element.attr("name")+"']").append(error);
|
||||
}
|
||||
},
|
||||
submitHandler: function(form){
|
||||
var flag = true;
|
||||
//代表所有业务都隐藏了,提示必须增加一种业务数据
|
||||
//if($("[name=action]:checked").val()==1&&$(".boxSolid").length ==$(".boxSolid.hidden").length) {
|
||||
// top.$.jBox.tip("<spring:message code='one_more'/>", "<spring:message code='info'/>");
|
||||
// return;
|
||||
//}
|
||||
//限制组必选一个,并且最多选择8个组
|
||||
var ipGroupLen=$("[name='ipGroup'] option:selected").length,subscribeIdGroupLen=$("[name='subscribeIdGroup'] option:selected").length,urlGroupLen=$("[name='urlGroup'] option:selected").length,domainGroupLen=$("[name='domainGroup'] option:selected").length;
|
||||
var grouplen=0;
|
||||
if($(".ipGroup").is(":visible")){
|
||||
grouplen+=ipGroupLen;
|
||||
}
|
||||
if($(".subscribeIdGroup").is(":visible")){
|
||||
grouplen+=subscribeIdGroupLen;
|
||||
}
|
||||
if($(".urlGroup").is(":visible")){
|
||||
grouplen+=urlGroupLen;
|
||||
}
|
||||
if($(".domainGroup").is(":visible")){
|
||||
grouplen+=domainGroupLen;
|
||||
}
|
||||
if(grouplen==0){
|
||||
top.$.jBox.tip("<spring:message code='at_least_one_group'/>", "<spring:message code='info'/>");
|
||||
return;
|
||||
}else if(grouplen>8){
|
||||
top.$.jBox.tip("<spring:message code='most_eight_group'/>", "<spring:message code='info'/>");
|
||||
return;
|
||||
}
|
||||
var flag1=validateInvisibleCharTag();
|
||||
if(flag){
|
||||
flag=flag1;
|
||||
}
|
||||
if(flag){
|
||||
//将disable属性的元素删除
|
||||
$(".disabled").each(function(){
|
||||
$(this).remove();
|
||||
});
|
||||
$("input[name='exprType']").attr("disabled",false);
|
||||
|
||||
loading('onloading...');
|
||||
form.submit();
|
||||
}else{
|
||||
return;
|
||||
}
|
||||
},
|
||||
errorContainer: "#messageBox",
|
||||
});
|
||||
});
|
||||
|
||||
//业务窗口打开
|
||||
var addContent = function(obj, contentClassName) {
|
||||
var showDiv = $(obj).parent().parent().next();
|
||||
$(showDiv).removeClass("hidden").removeClass(
|
||||
"disabled");
|
||||
$(obj).addClass("hidden");
|
||||
}
|
||||
|
||||
//业务窗口关闭
|
||||
var delContent = function(contentClassName, addBtnClassName) {
|
||||
$("." + contentClassName).addClass("hidden").addClass("disabled");
|
||||
$("." + addBtnClassName).removeClass("hidden");
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<span id="keywordError" style="display:none"><spring:message code="required"></spring:message></span>
|
||||
<span id="tagsinputTip" style="display:none"><spring:message code="multiple_keywords_tip"></spring:message></span>
|
||||
<div class="page-content">
|
||||
<h3 class="page-title">
|
||||
<spring:message code="${_cfg.menuNameCode }"></spring:message>
|
||||
</h3>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="portlet box blue">
|
||||
<div class="portlet-title">
|
||||
<div class="caption">
|
||||
<i class="fa fa-gift"></i>
|
||||
<c:if test="${empty _cfg.cfgId}"><spring:message code="add"></spring:message></c:if>
|
||||
<c:if test="${not empty _cfg.cfgId}"><spring:message code="edit"></spring:message></c:if>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-body form">
|
||||
<!-- BEGIN FORM-->
|
||||
<form id="cfgFrom" action="${ctx}/objgroup/saveOrUpdate" method="post" class="form-horizontal">
|
||||
<input type="hidden" name="cfgId" value="${_cfg.cfgId}">
|
||||
<input type="hidden" name="compileId" value="${_cfg.compileId}">
|
||||
<input type="hidden" name="functionId" value="${_cfg.functionId}">
|
||||
<input type="hidden" name="isValid" value="${_cfg.isValid}">
|
||||
<input type="hidden" name="isAudit" value="${_cfg.isAudit}">
|
||||
<input type="hidden" id="serviceId" name="serviceId" value="${_cfg.serviceId}">
|
||||
<input type="hidden" id="commonGroupIds" name="commonGroupIds" value='${_cfg.commonGroupIds}'>
|
||||
<%--<input type="hidden" id="exprType" name="exprType" value="0">
|
||||
<input type="hidden" id="matchMethod" name="matchMethod" value="0">
|
||||
<input type="hidden" id="isHexbin" name="isHexbin" value="0">--%>
|
||||
<div class="form-body">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><spring:message
|
||||
code="config_describe" /></label>
|
||||
<div class="col-md-6">
|
||||
<input class="form-control" type="text" name="cfgDesc"
|
||||
value="${_cfg.cfgDesc}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><spring:message
|
||||
code="action" /></label>
|
||||
<div class="col-md-6">
|
||||
<c:forEach items="${serviceList}" var="service"
|
||||
varStatus="satus">
|
||||
<label class="radio-inline"> <c:if
|
||||
test="${_cfg.functionId eq service.functionId}">
|
||||
<input type="radio" name="action" class="action"
|
||||
serviceId="${service.serviceId }"
|
||||
protocolId="${service.protocolId }"
|
||||
regionCode="${service.regionCode }"
|
||||
configDolog="${service.configDoLog }"
|
||||
value="${service.action }" class="required action"
|
||||
<c:if test="${_cfg.action==service.action || (_cfg.action==null && satus.index==0)}">checked</c:if>>
|
||||
<%--<spring:message code="${service.actionCode }"/>--%>
|
||||
<c:choose>
|
||||
<c:when test="${service.action eq 16}">
|
||||
<spring:message code="block"/>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<spring:message code="${service.actionCode }"/>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
<%-- <c:forEach items="${fns:getDictList('SERVICE_ACTION') }" var="dict">
|
||||
<c:if test="${dict.itemCode eq service.action }">
|
||||
<c:set var="action" value="${dict.itemCode }"></c:set>
|
||||
<spring:message code="${dict.itemValue }"/>
|
||||
</c:if>
|
||||
</c:forEach> --%>
|
||||
</c:if>
|
||||
</label>
|
||||
</c:forEach>
|
||||
</div>
|
||||
<div for="action"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 记录日志begin -->
|
||||
<div class="row">
|
||||
<div class="col-md-6 doLog">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><spring:message code="do_log" /></label>
|
||||
<c:forEach items="${fns:getDictList('DO_LOG') }" var="dict">
|
||||
<c:choose>
|
||||
<c:when test="${dict.itemCode eq _cfg.doLog}">
|
||||
<label class="radio-inline">
|
||||
<input type="radio" id="doLog" name="doLog" checked value="${dict.itemCode}" ><spring:message code="${dict.itemValue}"/>
|
||||
</label>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" id="doLog" name="doLog" value="${dict.itemCode}" ><spring:message code="${dict.itemValue}"/>
|
||||
</label>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
</c:forEach>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 doBlackList">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><spring:message code="do_blacklist" /></label>
|
||||
<c:forEach items="${fns:getDictList('DO_BLACKLIST') }" var="dict">
|
||||
<c:choose>
|
||||
<c:when test="${not empty _cfg.doBlackList and dict.itemCode eq _cfg.doBlackList}">
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="doBlackList" checked value="${dict.itemCode}" ><spring:message code="${dict.itemValue}"/>
|
||||
</label>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="doBlackList" value="${dict.itemCode}" ><spring:message code="${dict.itemValue}"/>
|
||||
</label>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
|
||||
</c:forEach>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group ">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="protocol"/></label>
|
||||
<div class="col-md-6">
|
||||
<select name="userRegion1" data-live-search="true" class="selectpicker form-control">
|
||||
<option value="https" <c:if test="${_cfg.userRegion1 eq 'https'}">selected</c:if>><spring:message code="HTTPS"/></option>
|
||||
<option value="intercept" <c:if test="${_cfg.userRegion1 eq 'intercept'}">selected</c:if>> <spring:message code="intercept"/></option>
|
||||
<option value="http" <c:if test="${_cfg.userRegion1 eq 'http'}">selected</c:if>> <spring:message code="HTTP"/></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6 ipGroup">
|
||||
<div class="form-group ">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="ip_group"/></label>
|
||||
<div class="col-md-6">
|
||||
<select name="ipGroup" data-live-search="true" class="selectpicker form-control form-control" multiple data-live-search="true">
|
||||
<c:forEach items="${ipGroups}" var="ipGroup">
|
||||
<option value="${ipGroup.serviceGroupId}" <c:if test="${fn:indexOf(_cfg.commonGroupIds,','.concat(ipGroup.serviceGroupId).concat(','))>-1}">selected</c:if>> <spring:message code="${ipGroup.groupName}"/></option>
|
||||
</c:forEach>
|
||||
</select>
|
||||
</div>
|
||||
<div for="ipGroup"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 subscribeIdGroup">
|
||||
<div class="form-group ">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="subscribe_id_group"/></label>
|
||||
<div class="col-md-6">
|
||||
<select name="subscribeIdGroup" data-live-search="true" class="selectpicker form-control form-control " multiple data-live-search="true">
|
||||
<c:forEach items="${subscribeIdGroups}" var="subscribeIdGroup">
|
||||
<option value="${subscribeIdGroup.serviceGroupId}" <c:if test="${fn:indexOf(_cfg.commonGroupIds,','.concat(subscribeIdGroup.serviceGroupId).concat(','))>-1}">selected</c:if> ><spring:message code="${subscribeIdGroup.groupName}"/></option>
|
||||
</c:forEach>
|
||||
</select>
|
||||
</div>
|
||||
<div for="subscribeIdGroup"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6 urlGroup">
|
||||
<div class="form-group ">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="url_group"/></label>
|
||||
<div class="col-md-6">
|
||||
<select name="urlGroup" data-live-search="true" class="selectpicker form-control form-control " multiple data-live-search="true" >
|
||||
<c:forEach items="${urlGroups}" var="urlGroup">
|
||||
<option value="${urlGroup.serviceGroupId}" <c:if test="${fn:indexOf(_cfg.commonGroupIds,','.concat(urlGroup.serviceGroupId).concat(','))>-1}">selected</c:if> ><spring:message code="${urlGroup.groupName}"/></option>
|
||||
</c:forEach>
|
||||
</select>
|
||||
</div>
|
||||
<div for="urlGroups"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 domainGroup">
|
||||
<div class="form-group ">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="domain_group"/></label>
|
||||
<div class="col-md-6">
|
||||
<select name="domainGroup" data-live-search="true" class="selectpicker form-control " multiple data-live-search="true">
|
||||
<c:forEach items="${domainGroups}" var="domainGroup">
|
||||
<option value="${domainGroup.serviceGroupId}" <c:if test="${fn:indexOf(_cfg.commonGroupIds,','.concat(domainGroup.serviceGroupId).concat(','))>-1}">selected</c:if> ><spring:message code="${domainGroup.groupName}"/></option>
|
||||
</c:forEach>
|
||||
</select>
|
||||
</div>
|
||||
<div for="domainGroup"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 记录日志end -->
|
||||
<%@include file="/WEB-INF/include/form/areaInfo.jsp" %>
|
||||
<%@include file="/WEB-INF/include/form/basicInfo.jsp" %>
|
||||
<br>
|
||||
<%@include file="/WEB-INF/include/form/scheduleNew.jsp"%>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="row">
|
||||
<div class="col-md-offset-3 col-md-8">
|
||||
<c:set var="auditPermission" value="false"></c:set>
|
||||
<!-- 拥有配置新增直接生效的功能权限 -->
|
||||
<shiro:hasPermission name="save:audit:permission">
|
||||
<c:set var="auditPermission" value="true"></c:set>
|
||||
</shiro:hasPermission>
|
||||
<c:choose>
|
||||
<c:when test="${!(fns:getUser().isAdmin()) && auditPermission}">
|
||||
<button id="audit" type="submit" class="btn green">
|
||||
<spring:message code="submit" />
|
||||
</button>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<button id="save" type="submit" class="btn green">
|
||||
<spring:message code="submit" />
|
||||
</button>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
<button id="cancel" type="button" class="btn default"><spring:message code="cancel"/></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6"> </div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<!-- END FORM-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
557
src/main/webapp/WEB-INF/views/cfg/objgroup/list.jsp
Normal file
557
src/main/webapp/WEB-INF/views/cfg/objgroup/list.jsp
Normal file
@@ -0,0 +1,557 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8"%>
|
||||
<%@ include file="/WEB-INF/include/taglib.jsp"%>
|
||||
<html>
|
||||
<head>
|
||||
<title><spring:message code="obj_group_configuration"></spring:message></title>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$(".tooltips").tooltip();
|
||||
//搜索框提示语初始化
|
||||
if("${cfg.cfgDesc}"){
|
||||
$("#intype").val("${cfg.cfgDesc}");
|
||||
}else if("${cfg.compileIdNew}"){
|
||||
$("#intype").val("${cfg.compileIdNew}");
|
||||
}else{
|
||||
$("#intype").attr("placeholder","<spring:message code='input'/> "+$("#seltype").find("option:selected").text());
|
||||
}
|
||||
$("#seltype").change(function(){
|
||||
$("#intype").attr("placeholder","<spring:message code='input'/> "+$(this).find("option:selected").text());
|
||||
});
|
||||
//筛选功能初始化
|
||||
filterActionInit();
|
||||
$("#isAudit").change(function(){
|
||||
page();
|
||||
});
|
||||
//reset
|
||||
$("#resetBtn").on("click",function(){
|
||||
$("select.selectpicker").each(function(){
|
||||
$(this).selectpicker('val',$(this).find('option:first').val());
|
||||
$(this).find("option").attr("selected",false);
|
||||
$(this).find("option:first").attr("selected",true);
|
||||
});
|
||||
$(".Wdate").attr("value",'');
|
||||
$("#level").attr("value",'');
|
||||
$("#searchForm")[0].reset();
|
||||
$("#intype").attr("placeholder","<spring:message code='input'/> "+$("#seltype").find("option:selected").text());
|
||||
$("#specServiceIdId").val("");
|
||||
$("#specServiceIdName").val("");
|
||||
$("#specServiceIdName").attr("placeholder",'<spring:message code="basic_protocol"/>');
|
||||
});
|
||||
$("span[id^=close]").on("click",function(){
|
||||
var closeId=$(this).attr("id");
|
||||
var openId=$(this).attr("id").replace("close","open");
|
||||
$("#"+closeId).hide();
|
||||
$("#"+openId).show();
|
||||
$("#"+closeId).parent().parent().next("tr").hide();
|
||||
});
|
||||
|
||||
if($("#exportType").val() != null && $("#exportType").val() != ""){
|
||||
if($("#intype").val() != null && $("#intype").val() != ""){
|
||||
$("#exportValue").val($("#intype").val());
|
||||
}
|
||||
}
|
||||
|
||||
if($("td[commonGroupIds]")){
|
||||
var groups=[];
|
||||
$("td[commonGroupIds]").each(function(){
|
||||
var json=JSON.parse($(this).attr("commonGroupIds"));
|
||||
if(json.ipGroup){
|
||||
groups.push(json.ipGroup.substring(1,json.ipGroup.length-1));
|
||||
}
|
||||
if(json.urlGroup){
|
||||
groups.push(json.urlGroup.substring(1,json.urlGroup.length-1));
|
||||
}
|
||||
if(json.subscribeIdGroup){
|
||||
groups.push(json.subscribeIdGroup.substring(1,json.subscribeIdGroup.length-1));
|
||||
}
|
||||
if(json.domainGroup){
|
||||
groups.push(json.domainGroup.substring(1,json.domainGroup.length-1));
|
||||
}
|
||||
});
|
||||
if(groups.length>0){
|
||||
$.post("${ctx}/objgroup/ajaxGetNames",{"groupIds":groups.join('\|')},function(data){
|
||||
$("td[commonGroupIds]").each(function(){
|
||||
for(var key in data.ipGroup){
|
||||
if($(this).text().trim()==key){
|
||||
$(this).text(data.ipGroup[key]);
|
||||
}
|
||||
}
|
||||
});
|
||||
$("td[urlGroup]").each(function(){
|
||||
for(var key in data.urlGroup){
|
||||
if($(this).text().trim()==key){
|
||||
$(this).text(data.urlGroup[key]);
|
||||
}
|
||||
}
|
||||
});
|
||||
$("td[domainGroup]").each(function(){
|
||||
for(var key in data.domainGroup){
|
||||
if($(this).text().trim()==key){
|
||||
$(this).text(data.domainGroup[key]);
|
||||
}
|
||||
}
|
||||
});$("td[subscribeIdGroup]").each(function(){
|
||||
for(var key in data.subscribeIdGroup){
|
||||
if($(this).text().trim()==key){
|
||||
$(this).text(data.subscribeIdGroup[key]);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="page-content">
|
||||
<div class="theme-panel hidden-xs hidden-sm">
|
||||
<shiro:hasPermission name="objgroup:config">
|
||||
<button type="button" class="addId btn btn-primary"
|
||||
onClick="javascript:window.location='${ctx}/objgroup/form?functionId=${cfg.functionId}'">
|
||||
<i class="fa fa-plus"></i>
|
||||
<spring:message code="add"></spring:message></button>
|
||||
<c:set var="serviceImport" value="false"></c:set>
|
||||
<c:set var="regionImport" value="false"></c:set>
|
||||
<c:forEach items="${serviceList}" var="service" >
|
||||
<c:if test="${(cfg.functionId eq service.functionId) && service.isImport eq 1}">
|
||||
<c:set var="serviceImport" value="true"></c:set>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
<c:forEach items="${regionList}" var="region" >
|
||||
<c:if test="${(cfg.functionId eq region.functionId) && region.isImport eq 1}">
|
||||
<c:set var="regionImport" value="true"></c:set>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
<c:if test="${serviceImport eq 'true' && regionImport eq 'true'}">
|
||||
<button type="button" class="importId btn btn-primary import" >
|
||||
<i class="fa fa-plus"></i>
|
||||
<spring:message code="import"></spring:message></button>
|
||||
</c:if>
|
||||
</shiro:hasPermission>
|
||||
</div>
|
||||
|
||||
<h3 class="page-title">
|
||||
<spring:message code="${cfg.menuNameCode }"></spring:message>
|
||||
</h3>
|
||||
<h5 class="page-header"></h5>
|
||||
<div class="col-md-12">
|
||||
<div class="portlet">
|
||||
<div class="portlet-body">
|
||||
<div class="row" >
|
||||
|
||||
<form:form id="searchForm" modelAttribute="cfg" action="${ctx}/objgroup/list?functionId=${cfg.functionId}" method="post" class="form-search">
|
||||
<input id="functionId" name="functionId" type="hidden" value="${cfg.functionId}"/>
|
||||
<input id="audit" name="audit" type="hidden" value="${audit}"/>
|
||||
<input id="exportType" type="hidden" value="${cfg.seltype}"/>
|
||||
<input id="exportValue" type="hidden" value=""/>
|
||||
<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
|
||||
<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
|
||||
<sys:tableSort id="orderBy" name="orderBy" value="${page.orderBy}"
|
||||
callback="page();" />
|
||||
<!-- 筛选按钮展开状态-->
|
||||
<input id="isFilterAction" name="isFilterAction" type="hidden" value="${cfg.isFilterAction }"/>
|
||||
<!-- 搜索内容与操作按钮栏 -->
|
||||
<div class="col-md-12">
|
||||
<div class="pull-left">
|
||||
<c:set var="state"><spring:message code='state'/></c:set>
|
||||
<form:select path="isAudit" class="selectpicker select2 input-small">
|
||||
<form:option value=""><spring:message code="all_states"/></form:option>
|
||||
<form:option value="0"><spring:message code="created"></spring:message></form:option>
|
||||
<form:option value="1"><spring:message code="approved"></spring:message></form:option>
|
||||
<form:option value="2"><spring:message code="unapproved"></spring:message></form:option>
|
||||
<form:option value="3"><spring:message code="cancel_approved"></spring:message></form:option>
|
||||
</form:select>
|
||||
</div>
|
||||
<div class="pull-left">
|
||||
<div class="input-group">
|
||||
<div class="input-group-btn">
|
||||
|
||||
<form:select path="seltype" class="selectpicker select2 input-small" >
|
||||
<form:option value="cfgDesc"><spring:message code="config_describe"></spring:message></form:option>
|
||||
<form:option value="compileIdNew"><spring:message code="cfg_id"></spring:message></form:option>
|
||||
<form:option value="action"><spring:message code="block_type"></spring:message></form:option>
|
||||
<%-- <form:option value="ntcSubscribeIdCfg.cfgKeywords"><spring:message code="APP_SUBSCRIBE_ID"></spring:message></form:option> --%>
|
||||
<form:option value="isValid"><spring:message code="valid_identifier"></spring:message></form:option>
|
||||
</form:select>
|
||||
|
||||
</div>
|
||||
|
||||
<input id="intype" class="form-control input-small" type="text" value="">
|
||||
<div class="input-group-btn">
|
||||
<form:select id="actionSelect" path="action" class="selectpicker select2 input-small" >
|
||||
<form:option value=""><spring:message code="select"/></form:option>
|
||||
<c:forEach items="${serviceList}" var="service">
|
||||
|
||||
<c:choose>
|
||||
<c:when test="${service.action eq 16}">
|
||||
<form:option value="${service.action }"><spring:message code="block_drop"/></form:option>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<form:option value="${service.action }"><spring:message code="action_${service.actionCode }"/></form:option>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
|
||||
</c:forEach>
|
||||
</form:select>
|
||||
<form:select path="isValid" class="selectpicker select2 input-small" >
|
||||
<form:option value=""><spring:message code="select"/></form:option>
|
||||
<form:option value="1"><spring:message code="yes"/></form:option>
|
||||
<form:option value="0"><spring:message code="no"/></form:option>
|
||||
</form:select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pull-left">
|
||||
<button type="button" class="btn blue" onClick="return page()"> <i class="fa fa-search"></i> <spring:message code="search"/> </button>
|
||||
<button type="button" class="btn btn-default" id="resetBtn"> <i class="fa fa-refresh"></i> <spring:message code="reset"/> </button>
|
||||
<button type="button" class="btn btn-default" id="filter-btn"> <spring:message code="filter"/> <i class="fa fa-angle-double-down"></i></button>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<shiro:hasPermission name="objgroup:config">
|
||||
<sys:delRow url="${ctx}/objgroup/form" id="contentTable" label="update"></sys:delRow>
|
||||
<sys:delRow url="${ctx}/objgroup/updateValid?isValid=-1&functionId=${cfg.functionId }" id="contentTable" label="delete"></sys:delRow>
|
||||
</shiro:hasPermission>
|
||||
|
||||
<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="export"></spring:message>
|
||||
<i class="fa fa-angle-down"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu pull-right" style="min-width: 110px;" >
|
||||
<li><sys:delRow url="${ctx}/objgroup/exportObjGroup?functionId=${cfg.functionId }&exType=excel" searchUrl="${ctx}/objgroup/list?functionId=${cfg.functionId}" id="contentTable" maxRow="10000" label="cfg_excel"></sys:delRow></li>
|
||||
<li><sys:delRow url="${ctx}/objgroup/exportObjGroup?functionId=${cfg.functionId }&exType=csv" searchUrl="${ctx}/objgroup/list?functionId=${cfg.functionId}" id="contentTable" maxRow="10000" label="cfg_csv"></sys:delRow></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<shiro:hasPermission name="objgroup:confirm">
|
||||
<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>
|
||||
</button>
|
||||
<ul class="dropdown-menu pull-right">
|
||||
<li><sys:delRow url="${ctx}/objgroup/audit?isAudit=1&isValid=1&functionId=${cfg.functionId }" id="contentTable" label="approved"></sys:delRow></li>
|
||||
<li><sys:delRow url="${ctx}/objgroup/audit?isAudit=2&isValid=0&functionId=${cfg.functionId }" id="contentTable" label="unapproved"></sys:delRow></li>
|
||||
<li><sys:delRow url="${ctx}/objgroup/audit?isAudit=3&isValid=0&functionId=${cfg.functionId }" id="contentTable" label="cancelPass"></sys:delRow></li>
|
||||
</ul>
|
||||
</div>
|
||||
</shiro:hasPermission>
|
||||
<a class="btn btn-icon-only btn-default setfields tooltips"
|
||||
data-container="body" data-placement="top" data-original-title=<spring:message code="custom_columns"/> href="javascript:;">
|
||||
<i class="icon-wrench"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /搜索内容与操作按钮栏 -->
|
||||
|
||||
<!-- 筛选搜索内容栏默认隐藏-->
|
||||
<div class="col-md-12 filter-action-select-panle hide" >
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-3">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label"><spring:message code='letter'/></label>
|
||||
<c:set var="select"><spring:message code='select'/></c:set>
|
||||
<form:select path="requestId" class="selectpicker form-control" data-live-search="true" data-live-search-placeholder="search">
|
||||
<form:option value=""><spring:message code="select"/></form:option>
|
||||
<c:forEach items="${requestInfos}" var="requestInfo" >
|
||||
<form:option value="${requestInfo.id}"><spring:message code="${requestInfo.requestTitle}"></spring:message></form:option>
|
||||
</c:forEach>
|
||||
</form:select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label"><spring:message code='classification'/></label>
|
||||
<form:select path="classify" class="selectpicker form-control" data-live-search="true" data-live-search-placeholder="search">
|
||||
<form:option value=""><spring:message code="select"/></form:option>
|
||||
<c:forEach items="${fls}" var="fl" >
|
||||
<form:option value="${fl.serviceDictId}"><spring:message code="${fl.itemValue}"></spring:message></form:option>
|
||||
</c:forEach>
|
||||
</form:select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label"><spring:message code='attribute'/></label>
|
||||
<c:set var="select"><spring:message code='select'/></c:set>
|
||||
<form:select path="attribute" class="selectpicker form-control" data-live-search="true" data-live-search-placeholder="search">
|
||||
<form:option value=""><spring:message code="select"/></form:option>
|
||||
<c:forEach items="${xzs}" var="xz" >
|
||||
<form:option value="${xz.serviceDictId}"><spring:message code="${xz.itemValue}"></spring:message></form:option>
|
||||
</c:forEach>
|
||||
</form:select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label"><spring:message code='label'/></label>
|
||||
<form:select path="lable" class="selectpicker form-control" data-live-search="true" data-live-search-placeholder="search">
|
||||
<form:option value=""><spring:message code="select"/></form:option>
|
||||
<c:forEach items="${lables}" var="lable" >
|
||||
<form:option value="${lable.serviceDictId}"><spring:message code="${lable.itemValue}"></spring:message></form:option>
|
||||
</c:forEach>
|
||||
</form:select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<label><spring:message code="config_time"/>:</label>
|
||||
<input name="search_create_time_start" type="text" readonly="readonly" maxlength="20" class="form-control Wdate"
|
||||
value="<fmt:formatDate value='${cfg.search_create_time_start}' pattern='yyyy-MM-dd HH:mm:ss'/>" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<label> </label>
|
||||
<input name="search_create_time_end" type="text" readonly="readonly" maxlength="20" class="form-control Wdate"
|
||||
value="<fmt:formatDate value="${cfg.search_create_time_end}" pattern="yyyy-MM-dd HH:mm:ss"/>" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<label><spring:message code="edit_time"/>:</label>
|
||||
<input name="search_edit_time_start" type="text" readonly="readonly" maxlength="20" class="form-control Wdate"
|
||||
value="<fmt:formatDate value="${cfg.search_edit_time_start}" pattern="yyyy-MM-dd HH:mm:ss"/>" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<label> </label>
|
||||
<input name="search_edit_time_end" type="text" readonly="readonly" maxlength="20" class="form-control Wdate"
|
||||
value="<fmt:formatDate value="${cfg.search_edit_time_end}" pattern="yyyy-MM-dd HH:mm:ss"/>" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<label><spring:message code="audit_time"/>:</label>
|
||||
<input name="search_audit_time_start" type="text" readonly="readonly" maxlength="20" class="form-control Wdate"
|
||||
value="<fmt:formatDate value="${cfg.search_audit_time_start}" pattern="yyyy-MM-dd HH:mm:ss"/>" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<label> </label>
|
||||
<input name="search_audit_time_end" type="text" readonly="readonly" maxlength="20" class="form-control Wdate"
|
||||
value="<fmt:formatDate value="${cfg.search_audit_time_end}" pattern="yyyy-MM-dd HH:mm:ss"/>" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<!-- /筛选搜索内容栏 结束-->
|
||||
</form:form>
|
||||
</div>
|
||||
<sys:message content="${message}" type="${messageType }"/>
|
||||
<div class="table-responsive">
|
||||
<table id="contentTable" class="table table-striped table-bordered table-condensed text-nowrap">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><input type="checkbox" class="i-checks" id="checkAll"></th>
|
||||
<th column="cfg_id" class="sort-column r.compile_id" style="display: none"><spring:message code="cfg_id"/></th>
|
||||
<th column="config_describe" class="sort-column r.cfg_desc cfgDesc"><spring:message code="config_describe"/></th>
|
||||
<th column="block_type" class="sort-column r.action"><spring:message code="block_type"/></th>
|
||||
<th column="ip_group" ><spring:message code="ip_group"/></th>
|
||||
<th column="subscribe_id_group" ><spring:message code="subscribe_id_group"/></th>
|
||||
<th column="url_group" ><spring:message code="url_group"/></th>
|
||||
<th column="domain_group" ><spring:message code="domain_group"/></th>
|
||||
<th column="is_audit" ><spring:message code="is_audit"/></th>
|
||||
<th column="valid_identifier" class="sort-column r.is_valid"><spring:message code="valid_identifier"/></th>
|
||||
<th><spring:message code="is_schduler"/></th>
|
||||
<th column="do_log" ><spring:message code="do_log"/></th>
|
||||
<th column="log_total" ><spring:message code="log_total"/></th>
|
||||
<th column="whether_area_block" ><spring:message code="whether_area_block"/></th>
|
||||
<th column="letter" ><spring:message code="letter"/></th>
|
||||
<th column="classification" ><spring:message code="classification"/></th>
|
||||
<th column="attribute" ><spring:message code="attribute"/></th>
|
||||
<th column="label" ><spring:message code="label"/></th>
|
||||
<th column="creator" ><spring:message code="creator"/></th>
|
||||
<th column="config_time" class="sort-column r.create_time"><spring:message code="config_time"/></th>
|
||||
<th column="editor" ><spring:message code="editor"/></th>
|
||||
<th column="edit_time" class="sort-column r.edit_time"><spring:message code="edit_time"/></th>
|
||||
<th column="auditor" ><spring:message code="auditor"/></th>
|
||||
<th column="audit_time" class="sort-column r.audit_time"><spring:message code="audit_time"/></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${page.list }" var="cfg" varStatus="status" step="1">
|
||||
<tr>
|
||||
<td>
|
||||
<span id="open${status.index}" class="" compileId="${cfg.compileId}" cfgId="${cfg.cfgId}"> ▷ </span><span style="display: none" id="close${status.index}" > ▼ </span>
|
||||
<input type="checkbox" class="i-checks child-checks" id="${cfg.cfgId}" value="${cfg.isAudit}">
|
||||
</td>
|
||||
<td>${cfg.compileId }</td>
|
||||
<td>${cfg.cfgDesc }</td>
|
||||
<td>
|
||||
<c:forEach items="${fns:getDictList('SERVICE_ACTION') }" var="dict">
|
||||
<c:if test="${dict.itemCode eq cfg.action }">
|
||||
<c:choose>
|
||||
<c:when test="${cfg.action eq 16}">
|
||||
<spring:message code="block"/>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<spring:message code="${dict.itemValue }"/>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</td>
|
||||
<td commonGroupIds='${cfg.commonGroupIds}'>${fn:substring(cfg.userRegion.ipGroup,1,fn:length(cfg.userRegion.ipGroup)-1)}</td>
|
||||
<td subscribeIdGroup>${fn:substring(cfg.userRegion.subscribeIdGroup,1,fn:length(cfg.userRegion.subscribeIdGroup)-1)}</td>
|
||||
<td urlGroup>${fn:substring(cfg.userRegion.urlGroup,1,fn:length(cfg.userRegion.urlGroup)-1)}</td>
|
||||
<td domainGroup>${fn:substring(cfg.userRegion.domainGroup,1,fn:length(cfg.userRegion.domainGroup)-1)}</td>
|
||||
<td>
|
||||
<c:choose>
|
||||
<c:when test="${cfg.isAudit eq '0'}"><span class="label label-danger"><spring:message code="created"></spring:message></span></c:when>
|
||||
<c:when test="${cfg.isAudit eq '1'}"><span class="label label-success"><spring:message code="approved"></spring:message></span></c:when>
|
||||
<c:when test="${cfg.isAudit eq '2'}"><span class="label label-warning"><spring:message code="unapproved"></spring:message></span></c:when>
|
||||
<c:when test="${cfg.isAudit eq '3'}">
|
||||
<span indexTable="${cfg.indexTable}" data-placement="right" data-original-title="<spring:message code='letter_cancel_info'/>: " class="label le-ca-fo label-warning tooltips" data-icon=""> <spring:message code="cancel_approved"/></span>
|
||||
</c:when></c:choose>
|
||||
</td>
|
||||
<td>
|
||||
<c:if test="${cfg.isValid==0}"><spring:message code="no"/></c:if>
|
||||
<c:if test="${cfg.isValid==1}"><spring:message code="yes"/></c:if>
|
||||
<c:if test="${cfg.isValid==-1}"><spring:message code="deleted"/></c:if>
|
||||
</td>
|
||||
<td class="schedulerFlag">
|
||||
<c:choose>
|
||||
<c:when test="${not empty cfg.schedule }">
|
||||
<span isScheduler="yes">
|
||||
<i class="icon-clock icon-state-danger"></i>
|
||||
</span>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<span isScheduler="no">
|
||||
</span>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
</td>
|
||||
<td>
|
||||
<c:forEach items="${fns:getDictList('DO_LOG') }" var="dict">
|
||||
<c:if test="${dict.itemCode eq cfg.doLog and cfg.action!=64}">
|
||||
<spring:message code="${dict.itemValue }"/>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</td>
|
||||
<td audit="${cfg.isAudit}" functionId="${cfg.functionId}" compileId="${cfg.compileId}" action="${cfg.action}" serviceId="${cfg.serviceId}"><div class="loading-total"></div></td>
|
||||
<td>
|
||||
<c:if test="${cfg.isAreaEffective==0}"><spring:message code="all"/></c:if>
|
||||
<c:if test="${cfg.isAreaEffective==1}">
|
||||
<a href="javascript:viewAreaInfo('${ctx}','${cfg.areaEffectiveIds }','${cfg.compileId }')" >
|
||||
<spring:message code="selective"/>
|
||||
</a>
|
||||
</c:if>
|
||||
</td>
|
||||
<td>${cfg.requestName }</td>
|
||||
<td>
|
||||
<c:set var="classify"></c:set>
|
||||
<c:forEach items="${fn:split(cfg.classify,',')}" var="classifyId" varStatus="status">
|
||||
<c:forEach items="${fls}" var="fl">
|
||||
<c:if test="${classifyId eq fn:trim(fl.serviceDictId)}">
|
||||
<c:if test="${status.index+1 eq 1}">
|
||||
<c:set var="classify" value="${fl.itemValue}"></c:set>
|
||||
</c:if>
|
||||
<c:if test="${status.index+1 ne 1}">
|
||||
<c:set var="classify" value="${classify},${fl.itemValue}"></c:set>
|
||||
</c:if>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</c:forEach>
|
||||
<a href="javascript:;" data-original-title="${classify}"
|
||||
class="tooltips" data-flag="false" data-html="true" data-placement="top">
|
||||
${fns:abbr(classify,20)}
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<c:set var="attribute"></c:set>
|
||||
<c:forEach items="${fn:split(cfg.attribute,',')}" var="attributeId" varStatus="status">
|
||||
<c:forEach items="${xzs}" var="xz">
|
||||
<c:if test="${attributeId eq fn:trim(xz.serviceDictId)}">
|
||||
<c:if test="${status.index+1 eq 1}">
|
||||
<c:set var="attribute" value="${xz.itemValue}"></c:set>
|
||||
</c:if>
|
||||
<c:if test="${status.index+1 ne 1}">
|
||||
<c:set var="attribute" value="${attribute},${xz.itemValue}"></c:set>
|
||||
</c:if>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</c:forEach>
|
||||
<a href="javascript:;" data-original-title="${attribute}"
|
||||
class="tooltips" data-flag="false" data-html="true" data-placement="top">
|
||||
${fns:abbr(attribute,20)}
|
||||
</a>
|
||||
|
||||
</td>
|
||||
<td>
|
||||
<c:set var="lableInfo"></c:set>
|
||||
<c:forEach items="${fn:split(cfg.lable,',')}" var="lableId" varStatus="status">
|
||||
<c:forEach items="${lables}" var="lable">
|
||||
<c:if test="${lableId eq fn:trim(lable.serviceDictId)}">
|
||||
<c:if test="${status.index+1 eq 1}">
|
||||
<c:set var="lableInfo" value="${lable.itemValue}"></c:set>
|
||||
</c:if>
|
||||
<c:if test="${status.index+1 ne 1}">
|
||||
<c:set var="lableInfo" value="${lableInfo},${lable.itemValue}"></c:set>
|
||||
</c:if>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</c:forEach>
|
||||
<a href="javascript:;" data-original-title="${lableInfo}"
|
||||
class="tooltips" data-flag="false" data-html="true" data-placement="top">
|
||||
${fns:abbr(lableInfo,20)}
|
||||
</a>
|
||||
</td>
|
||||
<td>${cfg.creatorName }</td>
|
||||
<td><fmt:formatDate value="${cfg.createTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
|
||||
<td>${cfg.editorName }</td>
|
||||
<td><fmt:formatDate value="${cfg.editTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
|
||||
<td>${cfg.auditorName }</td>
|
||||
<td><fmt:formatDate value="${cfg.auditTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="page">${page}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<c:set var="importPath" value="/objgroup/list?functionId=${cfg.functionId}"/>
|
||||
<!-- 模板导入,start -->
|
||||
<%@include file="/WEB-INF/include/excel/importModal.jsp" %>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user