(1)asn no放入eCache中
(2)导入验证采用多线程验证,优化验证速度 (3)asn ip导入方式调整(未采用多线程,因为redis承受不了) (4)asn ip列表展示速度优化 (5)导入方式重写:采用csv模式,限制采用xlsx格式,加载80万数据不会内存溢出.
This commit is contained in:
@@ -1092,33 +1092,48 @@ public abstract class BaseService {
|
||||
}
|
||||
//asn IP 复用转换
|
||||
public List<IpCfg> groupReuseCfgAddRemoveConvert(List<? extends BaseCfg<?>> ipCfgList,Integer isValid,Integer groupId) {
|
||||
logger.warn("convert data start");
|
||||
long start=System.currentTimeMillis();
|
||||
Date opTime=new Date();
|
||||
List<IpCfg> maatIpList=new ArrayList<>();
|
||||
for(BaseCfg<?> _cfg:ipCfgList) {
|
||||
IpCfg cfg = new IpCfg();
|
||||
BaseIpCfg baseIpCfg = new BaseIpCfg();
|
||||
if(_cfg instanceof AsnIpCfg) {
|
||||
AsnIpCfg asnIpCfg=(AsnIpCfg)_cfg;
|
||||
BeanUtils.copyProperties(asnIpCfg, baseIpCfg);
|
||||
BeanUtils.copyProperties(baseIpCfg, cfg);
|
||||
cfg.setGroupId(asnIpCfg.getAsnIpGroup());
|
||||
cfg.setRegionId(asnIpCfg.getRegionId());
|
||||
String userRegion = "ASN_ID=" + asnIpCfg.getUserRegion1();
|
||||
cfg.setUserRegion(userRegion);
|
||||
}else if(_cfg instanceof AppIpCfg) {
|
||||
AppIpCfg appIpCfg=(AppIpCfg)_cfg;
|
||||
BeanUtils.copyProperties(appIpCfg, baseIpCfg);
|
||||
BeanUtils.copyProperties(baseIpCfg, cfg);
|
||||
cfg.setGroupId(groupId);
|
||||
cfg.setRegionId(Integer.parseInt(appIpCfg.getUserRegion1()));
|
||||
String userRegion = "APP_ID=" + appIpCfg.getAppCode();
|
||||
cfg.setUserRegion(userRegion);
|
||||
if(ipCfgList.size()>0) {
|
||||
//只用一次instanceof,取代循环中每次都用一次instanceof
|
||||
if(ipCfgList.get(0) instanceof AsnIpCfg) {
|
||||
for(BaseCfg<?> _cfg:ipCfgList) {
|
||||
IpCfg cfg = new IpCfg();
|
||||
BaseIpCfg baseIpCfg = new BaseIpCfg();
|
||||
AsnIpCfg asnIpCfg=(AsnIpCfg)_cfg;
|
||||
BeanUtils.copyProperties(asnIpCfg, baseIpCfg);
|
||||
BeanUtils.copyProperties(baseIpCfg, cfg);
|
||||
cfg.setGroupId(asnIpCfg.getAsnIpGroup());
|
||||
cfg.setRegionId(asnIpCfg.getRegionId());
|
||||
String userRegion = "ASN_ID=" + asnIpCfg.getUserRegion1();
|
||||
cfg.setUserRegion(userRegion);
|
||||
cfg.setIsValid(isValid);
|
||||
cfg.setAuditTime(opTime);
|
||||
List<IpCfg> cfgs = ipConvert(cfg,baseIpCfg);
|
||||
maatIpList.addAll(cfgs);
|
||||
}
|
||||
}else if(ipCfgList.get(0) instanceof AppIpCfg) {
|
||||
for(BaseCfg<?> _cfg:ipCfgList) {
|
||||
IpCfg cfg = new IpCfg();
|
||||
BaseIpCfg baseIpCfg = new BaseIpCfg();
|
||||
AppIpCfg appIpCfg=(AppIpCfg)_cfg;
|
||||
BeanUtils.copyProperties(appIpCfg, baseIpCfg);
|
||||
BeanUtils.copyProperties(baseIpCfg, cfg);
|
||||
cfg.setGroupId(groupId);
|
||||
cfg.setRegionId(Integer.parseInt(appIpCfg.getUserRegion1()));
|
||||
String userRegion = "APP_ID=" + appIpCfg.getAppCode();
|
||||
cfg.setUserRegion(userRegion);
|
||||
cfg.setIsValid(isValid);
|
||||
cfg.setAuditTime(opTime);
|
||||
List<IpCfg> cfgs = ipConvert(cfg,baseIpCfg);
|
||||
maatIpList.addAll(cfgs);
|
||||
}
|
||||
}
|
||||
cfg.setIsValid(isValid);
|
||||
cfg.setAuditTime(opTime);
|
||||
List<IpCfg> cfgs = ipConvert(cfg,baseIpCfg);
|
||||
maatIpList.addAll(cfgs);
|
||||
}
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("convert data finish,cost:"+(end-start));
|
||||
return maatIpList;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user