asn缓存工具类添加清除缓存的方法。
asn ip相关配置第一次下发的时候,更新缓存中is_issued字段
This commit is contained in:
@@ -47,6 +47,9 @@ public class AsnCacheUtils{
|
|||||||
Element element = getCache(ASN_NO_CACHE).get(key);
|
Element element = getCache(ASN_NO_CACHE).get(key);
|
||||||
return (Map<Long,ConfigGroupInfo>)element.getObjectValue();
|
return (Map<Long,ConfigGroupInfo>)element.getObjectValue();
|
||||||
}
|
}
|
||||||
|
public static void clearCache() {
|
||||||
|
CacheUtils.getCacheManager().removeCache(ASN_NO_CACHE);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 初始化缓存
|
* 初始化缓存
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import com.nis.domain.maat.ToMaatBean;
|
|||||||
import com.nis.domain.maat.ToMaatResult;
|
import com.nis.domain.maat.ToMaatResult;
|
||||||
import com.nis.domain.specific.ConfigGroupInfo;
|
import com.nis.domain.specific.ConfigGroupInfo;
|
||||||
import com.nis.exceptions.MaatConvertException;
|
import com.nis.exceptions.MaatConvertException;
|
||||||
|
import com.nis.util.AsnCacheUtils;
|
||||||
import com.nis.util.ConfigServiceUtil;
|
import com.nis.util.ConfigServiceUtil;
|
||||||
import com.nis.util.Configurations;
|
import com.nis.util.Configurations;
|
||||||
import com.nis.util.Constants;
|
import com.nis.util.Constants;
|
||||||
@@ -279,7 +280,8 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
|||||||
this.saveIpBatch(cfg.getAreaCfg());
|
this.saveIpBatch(cfg.getAreaCfg());
|
||||||
}
|
}
|
||||||
ipCfgDao.update(cfg);
|
ipCfgDao.update(cfg);
|
||||||
}
|
}
|
||||||
|
@Deprecated
|
||||||
public void audit(BaseIpCfg cfg) throws Exception{
|
public void audit(BaseIpCfg cfg) throws Exception{
|
||||||
//更新IP配置与区域IP的状态
|
//更新IP配置与区域IP的状态
|
||||||
List<BaseIpCfg> beans=new ArrayList<>();
|
List<BaseIpCfg> beans=new ArrayList<>();
|
||||||
@@ -464,82 +466,6 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void auditWhiteIp(BaseIpCfg cfg) throws Exception{
|
|
||||||
List<BaseIpCfg> beans=new ArrayList<>();
|
|
||||||
beans.add(cfg);
|
|
||||||
ipCfgDao.audit(cfg);
|
|
||||||
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<>();
|
|
||||||
ToMaatBean maatBean = new ToMaatBean();
|
|
||||||
MaatCfg maatCfg = new MaatCfg();
|
|
||||||
maatCfg.initDefaultValue();
|
|
||||||
BeanUtils.copyProperties(cfg, maatCfg);
|
|
||||||
|
|
||||||
if(cfg.getIsAudit()==Constants.AUDIT_YES){
|
|
||||||
maatBean.setOpAction(Constants.INSERT_ACTION);
|
|
||||||
Map<String,List> map = cfgConvert(ipRegionList,beans,1,cfg,groupRelationList);
|
|
||||||
groupRelationList=map.get("groupList");
|
|
||||||
ipRegionList=map.get("dstList");
|
|
||||||
if (map.get("numRegionList") != null) {
|
|
||||||
numRegionList.addAll(map.get("numRegionList"));
|
|
||||||
}
|
|
||||||
maatCfg.setAreaEffectiveIds("0");
|
|
||||||
maatCfg.setAction(cfg.getAction());
|
|
||||||
maatCfg.setAuditTime(cfg.getAuditTime());
|
|
||||||
maatCfg.setIpRegionList(ipRegionList);
|
|
||||||
maatCfg.setStrRegionList(strRegionList);
|
|
||||||
maatCfg.setNumRegionList(numRegionList);
|
|
||||||
maatCfg.setDigestRegionList(digestRegionList);
|
|
||||||
maatCfg.setGroupRelationList(groupRelationList);
|
|
||||||
maatCfg.setGroupNum(groupRelationList.size());
|
|
||||||
maatCfg.setAreaIpRegionList(areaIpRegionList);
|
|
||||||
configCompileList.add(maatCfg);
|
|
||||||
maatBean.setConfigCompileList(configCompileList);
|
|
||||||
maatBean.setAuditTime(cfg.getAuditTime());
|
|
||||||
maatBean.setCreatorName(cfg.getCurrentUser().getName());
|
|
||||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
|
||||||
//调用服务接口下发配置数据
|
|
||||||
String json=gsonToJson(maatBean);
|
|
||||||
logger.info("IP白名单下发配置参数:"+json);
|
|
||||||
//调用服务接口下发配置
|
|
||||||
try {
|
|
||||||
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
|
||||||
if(result!=null){
|
|
||||||
logger.info("IP白名单配置下发响应信息:"+result.getMsg());
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("IP白名单配置下发失败",e);
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}else if(cfg.getIsAudit()==Constants.AUDIT_NOT_YES){
|
|
||||||
maatCfg.setCompileId(cfg.getCompileId());
|
|
||||||
maatCfg.setServiceId(cfg.getServiceId());
|
|
||||||
maatCfg.setIsValid(Constants.VALID_NO);//无效
|
|
||||||
configCompileList.add(maatCfg);
|
|
||||||
maatBean.setConfigCompileList(configCompileList);
|
|
||||||
maatBean.setAuditTime(cfg.getAuditTime());
|
|
||||||
maatBean.setCreatorName(cfg.getCurrentUser().getName());
|
|
||||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
|
||||||
maatBean.setOpAction(Constants.UPDATE_ACTION);
|
|
||||||
//调用服务接口取消配置
|
|
||||||
String json=gsonToJson(maatBean);
|
|
||||||
logger.info("IP白名单配置参数:"+json);
|
|
||||||
//调用服务接口取消配置
|
|
||||||
try {
|
|
||||||
ToMaatResult result = ConfigServiceUtil.put(json, 1);
|
|
||||||
logger.info("IP白名单取消配置响应信息:"+result.getMsg());
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
logger.info("IP白名单取消配置失败");
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void auditIpCfg(CfgIndexInfo entity,Integer isAudit) throws MaatConvertException{
|
public void auditIpCfg(CfgIndexInfo entity,Integer isAudit) throws MaatConvertException{
|
||||||
Properties props=this.getMsgProp();
|
Properties props=this.getMsgProp();
|
||||||
//修改数据库审核状态信息
|
//修改数据库审核状态信息
|
||||||
@@ -830,6 +756,7 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
|||||||
info.setIsIssued(1);
|
info.setIsIssued(1);
|
||||||
//info.setGroupId(Integer.parseInt(entity.getUserRegion4()));
|
//info.setGroupId(Integer.parseInt(entity.getUserRegion4()));
|
||||||
configGroupInfoDao.updateConfigGroupInfobyGroupId(info);
|
configGroupInfoDao.updateConfigGroupInfobyGroupId(info);
|
||||||
|
AsnCacheUtils.put(info.getAsnId(), info);
|
||||||
AsnIpCfg cfg=new AsnIpCfg();
|
AsnIpCfg cfg=new AsnIpCfg();
|
||||||
cfg.setIsValid(Constants.VALID_YES);
|
cfg.setIsValid(Constants.VALID_YES);
|
||||||
cfg.setAsnIpGroup(Integer.parseInt(entity.getUserRegion4()));
|
cfg.setAsnIpGroup(Integer.parseInt(entity.getUserRegion4()));
|
||||||
|
|||||||
Reference in New Issue
Block a user