Merge branch 'develop_no_common_group' of https://git.mesalab.cn/K18_NTCS_WEB/NTC into develop_no_common_group
This commit is contained in:
@@ -4,6 +4,7 @@ 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;
|
||||
|
||||
@@ -133,6 +134,8 @@ public class SchedulerTaskUtil {
|
||||
if("cfg_index_info".equals(tableName)){
|
||||
List<CfgIndexInfo> list = configSynchronizationDao.getCfgIndexList(entity);
|
||||
if(isIssueContent.equals(1)){
|
||||
//用于存储自定义域为关键字的业务,key=compileId,value=keyword.
|
||||
Map<Integer, BaseStringCfg> keywordMap=new HashMap<>();
|
||||
//查询子域配置详情
|
||||
if(cfgList!=null){
|
||||
for(Map<String,Object> m:cfgList){
|
||||
@@ -141,6 +144,13 @@ public class SchedulerTaskUtil {
|
||||
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"))){
|
||||
@@ -175,14 +185,14 @@ public class SchedulerTaskUtil {
|
||||
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;
|
||||
}
|
||||
|
||||
Object value = "";
|
||||
if(entity.getServiceId().equals(517)||entity.getServiceId().equals(560)){//代理替换策略
|
||||
String[] regionArray = regionColumn.split(",");
|
||||
for(int r=0;r<regionArray.length;r++){
|
||||
@@ -197,9 +207,22 @@ public class SchedulerTaskUtil {
|
||||
}
|
||||
userRegion += n.get("regionKey")+"="+value+Constants.USER_REGION_SPLIT;
|
||||
}else{
|
||||
Field field = aClass.getDeclaredField(regionColumn);
|
||||
field.setAccessible(true);
|
||||
value = field.get(cfg);
|
||||
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();
|
||||
}
|
||||
}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();
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.nis.web.dao.configuration;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.ibatis.annotations.MapKey;
|
||||
import org.apache.ibatis.annotations.ResultType;
|
||||
@@ -79,6 +80,9 @@ public interface ConfigSynchronizationDao {
|
||||
public List<DdosIpCfg> getDdosIpCfgList(BaseCfg entity);
|
||||
public List<FileDigestCfg> getFileDigestListByService(BaseCfg entity);
|
||||
|
||||
@MapKey(value = "compileId")
|
||||
public Map<Integer,BaseStringCfg> getCompileIdWithKeyword(@Param("tableName")String tableName,@Param("compileIds")List compileIds);
|
||||
|
||||
public List<AvFileSampleCfg> getAvFileCfgList(BaseCfg entity);
|
||||
public List<AvSignSampleCfg> getAvSignCfgList(BaseCfg entity);
|
||||
public List<PxyObjKeyring> getPxyObjKeyringCfgList(BaseCfg entity);
|
||||
|
||||
@@ -1144,6 +1144,32 @@
|
||||
</if> -->
|
||||
</where>
|
||||
</select>
|
||||
<select id="getCompileIdWithKeyword" resultType="com.nis.domain.configuration.BaseStringCfg" >
|
||||
SELECT
|
||||
a.compile_id compileId,
|
||||
<if test="tableName == 'app_domain_cfg'">
|
||||
a.domain cfgKeywords
|
||||
</if>
|
||||
<if test="tableName != 'app_domain_cfg'">
|
||||
a.cfg_keywords cfgKeywords
|
||||
</if>
|
||||
FROM ${tableName} a
|
||||
<where>
|
||||
and a.compile_id in
|
||||
<foreach collection="compileIds" index="index" item="compileId" open="(" separator="," close=")">
|
||||
#{compileId}
|
||||
</foreach>
|
||||
<!-- <if test="compileId != null">
|
||||
AND a.compile_id =#{compileId}
|
||||
</if>
|
||||
<if test="functionId != null">
|
||||
AND a.function_id =#{functionId}
|
||||
</if>
|
||||
<if test="serviceId!= null">
|
||||
AND a.service_id =#{serviceId}
|
||||
</if> -->
|
||||
</where>
|
||||
</select>
|
||||
<select id="getComplexStrList" resultMap="complexCfgMap" parameterType="com.nis.domain.configuration.CfgIndexInfo">
|
||||
SELECT
|
||||
<include refid="ComplexCfg_Column" />
|
||||
|
||||
@@ -305,6 +305,8 @@ public class ConfigSynchronizationService extends BaseService{
|
||||
commonPolicyDao.auditCfgBatch( entity.getTableName(), entity,compileIds,null);
|
||||
}
|
||||
}
|
||||
//用于存储自定义域为关键字的业务,key=compileId,value=keyword.
|
||||
Map<Integer, BaseStringCfg> keywordMap=new HashMap<>();
|
||||
|
||||
if(cfgList!=null){
|
||||
for(Map<String,Object> m:cfgList){
|
||||
@@ -312,7 +314,15 @@ public class ConfigSynchronizationService extends BaseService{
|
||||
if("1".equals(m.get("cfgType"))){
|
||||
ipList.addAll(configSynchronizationDao.getIpPortList(tableName, compileIds));
|
||||
}else if("2".equals(m.get("cfgType"))){
|
||||
strList.addAll(configSynchronizationDao.getStrList(tableName,compileIds));
|
||||
List<BaseStringCfg> strDataList=configSynchronizationDao.getStrList(tableName,compileIds);
|
||||
strList.addAll(strDataList);
|
||||
//512/521/514/1026业务的用户自定义域取DOMAIN_STR取自Keyword
|
||||
if(entity.getServiceId()==512
|
||||
||entity.getServiceId()==521
|
||||
||entity.getServiceId()==514
|
||||
||entity.getServiceId()==1026) {
|
||||
keywordMap=configSynchronizationDao.getCompileIdWithKeyword(tableName, compileIds);
|
||||
}
|
||||
}else if("3".equals(m.get("cfgType"))){
|
||||
complexStrList.addAll(configSynchronizationDao.getComplexStrList(tableName,compileIds));
|
||||
}else if("4".equals(m.get("cfgType"))){
|
||||
@@ -381,17 +391,18 @@ public class ConfigSynchronizationService extends BaseService{
|
||||
if(regionKey.equals("keyring_id") && StringUtil.isEmpty(value)){
|
||||
value = "0";
|
||||
}else if(regionKey.equals("DOMAIN_STR")) {
|
||||
if(!StringUtil.isEmpty(strList)) {
|
||||
value = strList.get(0).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 {
|
||||
if(regionKey.equals("DOMAIN_ID") && StringUtil.isEmpty(strList)) {
|
||||
value="";
|
||||
}else {
|
||||
Field field = aClass.getDeclaredField(regionColumn);
|
||||
field.setAccessible(true);
|
||||
value = field.get(cfg);
|
||||
}
|
||||
Field field = aClass.getDeclaredField(regionColumn);
|
||||
field.setAccessible(true);
|
||||
value = field.get(cfg);
|
||||
}
|
||||
if(!StringUtil.isEmpty(value)){
|
||||
if(StringUtil.isEmpty(n.get("regionKey"))){
|
||||
|
||||
Reference in New Issue
Block a user