ASN导入全量,删除asnip逻辑修改为基于asn no的批量删除。
每次删除定量的asn ip cfg遍历,基于本批asn no,asn ip数量大于maat_send_size即删除并入库最新asn ip信息
This commit is contained in:
@@ -173,13 +173,14 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
}*/
|
||||
}
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void saveAsnIp(List<AsnIpCfg> asnIpCfgs){
|
||||
public void saveAsnIp(List<AsnIpCfg> asnIpCfgs,String asnIds){
|
||||
logger.warn("Start to only save asn ip size:"+asnIpCfgs.size());
|
||||
long start=System.currentTimeMillis();
|
||||
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||
SqlSession batchSqlSession = null;
|
||||
try{
|
||||
if(!StringUtil.isEmpty(asnIpCfgs)){
|
||||
asnIpCfgDao.deleteByAsnId(asnIds);
|
||||
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
for (AsnIpCfg cfg : asnIpCfgs) {
|
||||
((AsnIpCfgDao) batchSqlSession.getMapper(AsnIpCfgDao.class)).insert(cfg);
|
||||
@@ -331,11 +332,11 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
Integer serviceId=service.getServiceId();
|
||||
try{
|
||||
//1、删除所有asn ip
|
||||
asnIpCfgDao.deleteAll();
|
||||
//asnIpCfgDao.deleteAll();
|
||||
//2、删除所有的asn_group_info
|
||||
asnGroupInfoDao.deleteAll();
|
||||
//asnGroupInfoDao.deleteAll();
|
||||
//3、删除所有的组织信息
|
||||
configGroupInfoDao.deleteAllAsnGroup();
|
||||
//configGroupInfoDao.deleteAllAsnGroup();
|
||||
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
//4、遍历保存所有的config_group_info
|
||||
if(!StringUtil.isEmpty(asnOrgList)){
|
||||
@@ -343,7 +344,7 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
Map<String,ConfigGroupInfo> oldOrgMap=asnOrgList.get(1);//【1】 旧的config group info
|
||||
|
||||
//入库旧的asn组织信息
|
||||
if(!StringUtil.isEmpty(oldOrgMap)){
|
||||
/*if(!StringUtil.isEmpty(oldOrgMap)){
|
||||
index=0;
|
||||
for(Entry<String, ConfigGroupInfo> e:oldOrgMap.entrySet()) {
|
||||
ConfigGroupInfo configGroupInfo=e.getValue();
|
||||
@@ -355,7 +356,7 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
index++;
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
}
|
||||
}*/
|
||||
|
||||
//入库新的asn组织信息
|
||||
if(!StringUtil.isEmpty(newOrgMap)){
|
||||
@@ -415,7 +416,7 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
batchSqlSession.commit();
|
||||
}
|
||||
//保存旧的asn信息
|
||||
if(!oldAsnGroup.isEmpty()){
|
||||
/*if(!oldAsnGroup.isEmpty()){
|
||||
index=0;
|
||||
for(Entry<Long, AsnGroupInfo> e:oldAsnGroup.entrySet()) {
|
||||
AsnGroupInfo asnGroupInfo=e.getValue();
|
||||
@@ -428,7 +429,7 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
index++;
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
@@ -438,7 +439,7 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
}
|
||||
}
|
||||
//6、配置取消所有编译[编译取消,编译下的所有group和region都会取消(已和服务端确认)]
|
||||
if(!StringUtil.isEmpty(deleteAsnCompile)){
|
||||
/*if(!StringUtil.isEmpty(deleteAsnCompile)){
|
||||
long startAudit=System.currentTimeMillis();
|
||||
ToMaatBean maatBean = new ToMaatBean();
|
||||
MaatCfg maatCfg = new MaatCfg();
|
||||
@@ -470,7 +471,7 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
logger.info("ASN IP所有编译取消返回结果:"+result.getMsg());
|
||||
long resultEnd=System.currentTimeMillis();
|
||||
logger.warn("Cancle all ASN compile finish,cost:"+(resultEnd-auditEnd));
|
||||
}
|
||||
}*/
|
||||
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("Save group finish,cost:"+(end-start));
|
||||
|
||||
Reference in New Issue
Block a user