26号之前的asn ip导入版本,区分ipv4和ipv6,v4和v6互不影响
This commit is contained in:
@@ -1650,9 +1650,17 @@ public class BaseController {
|
||||
}
|
||||
//全量下发,删除asnNo对应的已有的IP
|
||||
if(isImportAll.get(0).getItemCode().equals("1")) {
|
||||
Integer ipType=null;
|
||||
if((!ipPortCfgs.isEmpty())){
|
||||
BaseIpCfg baseIpCfg=ipPortCfgs.take();
|
||||
ipPortCfgs.put(baseIpCfg);
|
||||
if(!StringUtil.isEmpty(baseIpCfg)){
|
||||
ipType=baseIpCfg.getIpType();
|
||||
}
|
||||
}
|
||||
logger.warn("Delete and send ip reuse regions start");
|
||||
long _start=System.currentTimeMillis();
|
||||
deleteIps(asnNoMaps.get(1));
|
||||
deleteIps(asnNoMaps.get(1),ipType);
|
||||
long _end=System.currentTimeMillis();
|
||||
logger.warn("Delete and send ip reuse regions end,cost:"+(_end-_start));
|
||||
}
|
||||
@@ -2383,7 +2391,7 @@ public class BaseController {
|
||||
logger.warn("import finish,cost:"+(end-start));
|
||||
}
|
||||
|
||||
public void deleteIps(Map<Long,AsnGroupInfo> asnNoMap){
|
||||
public void deleteIps(Map<Long,AsnGroupInfo> asnNoMap,Integer ipType){
|
||||
List<AsnIpCfg> toDelAndSendAsnIpCfgs=Lists.newArrayList();
|
||||
List<Long> asnIds=Lists.newArrayList(asnNoMap.size());
|
||||
for(Entry<Long, AsnGroupInfo> e:asnNoMap.entrySet()) {
|
||||
@@ -2399,7 +2407,7 @@ public class BaseController {
|
||||
}
|
||||
}
|
||||
if(asnIds.size()>0) {
|
||||
asnIpCfgService.deleteByAsnNo(asnIds);
|
||||
asnIpCfgService.deleteByAsnNo(asnIds,ipType);
|
||||
}
|
||||
if(toDelAndSendAsnIpCfgs.size()>0) {
|
||||
int pointsDataLimit = Constants.MAAT_JSON_SEND_SIZE;//限制条数
|
||||
|
||||
@@ -32,5 +32,6 @@ public interface AsnIpCfgDao extends CrudDao<AsnIpCfg>{
|
||||
public int hasValidAsnIp(@Param("asnId")Long asnNo);
|
||||
public AsnIpCfg getOne(AsnIpCfg cfg);
|
||||
public void updateAsn(@Param("asnId")String asnNo,@Param("organization")String organization,@Param("country")String country,@Param("detail")String detail);
|
||||
public List<Object[]> findAllAsnIpCfgList();
|
||||
public List<Object[]> findAllAsnIpCfgList();
|
||||
public int deleteByAsnIdAndIpType(@Param("asnId")String ids,@Param("ipType")Integer ipType);
|
||||
}
|
||||
|
||||
@@ -636,5 +636,14 @@
|
||||
<include refid="columns"></include>
|
||||
from asn_ip_cfg r
|
||||
where r.is_valid !=-1
|
||||
</select>
|
||||
</select>
|
||||
<delete id="deleteByAsnIdAndIpType" >
|
||||
delete from asn_ip_cfg
|
||||
<where>
|
||||
and user_region1 in(${asnId})
|
||||
<if test="ipType != null" >
|
||||
and ip_type = #{ipType,jdbcType=INTEGER}
|
||||
</if>
|
||||
</where>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -377,7 +377,7 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
return asnIpCfgDao.getByIds(ids);
|
||||
}
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void deleteByAsnNo(List<Long> asnNoList) {
|
||||
public void deleteByAsnNo(List<Long> asnNoList,Integer ipType) {
|
||||
// for(Long asnNo:asnNoList) {
|
||||
// int result=0;
|
||||
// do {
|
||||
@@ -397,7 +397,8 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
}
|
||||
int result=0;
|
||||
do {
|
||||
result=asnIpCfgDao.deleteByAsnId(asnNoStr.toString().substring(0,asnNoStr.toString().length()-1));
|
||||
//result=asnIpCfgDao.deleteByAsnId(asnNoStr.toString().substring(0,asnNoStr.toString().length()-1));
|
||||
result=asnIpCfgDao.deleteByAsnIdAndIpType(asnNoStr.toString().substring(0,asnNoStr.toString().length()-1),ipType);
|
||||
}while(result>0);
|
||||
//剔除
|
||||
asnNoList.subList(0, pointsDataLimit).clear();
|
||||
@@ -410,7 +411,7 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
}
|
||||
int result=0;
|
||||
do {
|
||||
result=asnIpCfgDao.deleteByAsnId(asnNoStr.toString().substring(0,asnNoStr.toString().length()-1));
|
||||
result=asnIpCfgDao.deleteByAsnIdAndIpType(asnNoStr.toString().substring(0,asnNoStr.toString().length()-1),ipType);
|
||||
}while(result>0);
|
||||
asnNoList.clear();
|
||||
}
|
||||
@@ -422,7 +423,7 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
}
|
||||
int result=0;
|
||||
do {
|
||||
result=asnIpCfgDao.deleteByAsnId(asnNoStr.toString().substring(0,asnNoStr.toString().length()-1));
|
||||
result=asnIpCfgDao.deleteByAsnIdAndIpType(asnNoStr.toString().substring(0,asnNoStr.toString().length()-1),ipType);
|
||||
}while(result>0);
|
||||
asnNoList.clear();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user