stream、DDOS和高级功能模块对某些用户的配置不经过审核直接生效及生效中的配置进行修改的功能
This commit is contained in:
@@ -34,6 +34,7 @@ import com.nis.domain.maat.ToMaatResult;
|
||||
import com.nis.domain.specific.ConfigGroupInfo;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.basics.AsnGroupInfoDao;
|
||||
import com.nis.web.dao.basics.AsnIpCfgDao;
|
||||
@@ -82,24 +83,31 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
public void save(List<AsnIpCfg> entitys) {
|
||||
logger.warn("Start to save IP,size:"+entitys.size());
|
||||
long start=System.currentTimeMillis();
|
||||
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||
SqlSession batchSqlSession = null;
|
||||
try{
|
||||
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
for(AsnIpCfg asnIpCfg:entitys) {
|
||||
((AsnIpCfgDao) batchSqlSession.getMapper(AsnIpCfgDao.class)).insert(asnIpCfg);
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
batchSqlSession.close();
|
||||
}
|
||||
}
|
||||
// SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||
// SqlSession batchSqlSession = null;
|
||||
// try{
|
||||
// batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
// for(AsnIpCfg asnIpCfg:entitys) {
|
||||
// ((AsnIpCfgDao) batchSqlSession.getMapper(AsnIpCfgDao.class)).insert(asnIpCfg);
|
||||
// }
|
||||
// batchSqlSession.commit();
|
||||
for(AsnIpCfg asnIpCfg:entitys) {
|
||||
asnIpCfgDao.insert(asnIpCfg);
|
||||
}
|
||||
// }finally {
|
||||
// if(batchSqlSession != null){
|
||||
// batchSqlSession.close();
|
||||
// }
|
||||
// }
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("Save IP finish,cost:"+(end-start));
|
||||
}
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void update(AsnIpCfg entity){
|
||||
int isValid=0;
|
||||
if(!StringUtil.isEmpty(entity.getIsValid()) && entity.getIsValid()==1) {
|
||||
isValid=1;
|
||||
}
|
||||
Date editTime=new Date();
|
||||
entity.setEditTime(editTime);
|
||||
entity.setEditorId(entity.getCurrentUser().getId());
|
||||
@@ -115,6 +123,22 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
entity.setDetail(detail);
|
||||
entity.setCompileId(groupInfo.getCompileId());
|
||||
asnIpCfgDao.update(entity);
|
||||
if(isValid==1) {
|
||||
Map<Long,List<AsnIpCfg>> asnIpMap=Maps.newHashMap();
|
||||
entity.setIsAudit(1);
|
||||
entity.setIsValid(1);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
if(asnIpMap.containsKey(Long.parseLong(entity.getUserRegion1()))) {
|
||||
asnIpMap.get(Long.parseLong(entity.getUserRegion1())).add(entity);
|
||||
}else {
|
||||
List<AsnIpCfg> _asnIps=Lists.newArrayList();
|
||||
_asnIps.add(entity);
|
||||
asnIpMap.put(Long.parseLong(entity.getUserRegion1()), _asnIps);
|
||||
}
|
||||
|
||||
auditIpBatch(asnIpMap,entity.getIsAudit());
|
||||
}
|
||||
}
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void processGroup(Map<Long,AsnGroupInfo> asnNoMap){
|
||||
@@ -261,6 +285,10 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void saveAsnIpCfg(CfgIndexInfo entity) {
|
||||
int isValid=0;
|
||||
if(!StringUtil.isEmpty(entity.getIsValid()) && entity.getIsValid()==1) {
|
||||
isValid=1;
|
||||
}
|
||||
Date createTime=new Date();
|
||||
//asn号
|
||||
String userRegion1=entity.getUserRegion1();
|
||||
@@ -308,6 +336,26 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
}
|
||||
}
|
||||
this.save(entity.getAsnIpCfgs());
|
||||
if(isValid==1) {
|
||||
entity.setIsAudit(1);
|
||||
entity.setIsValid(1);
|
||||
|
||||
Map<Long,List<AsnIpCfg>> asnIpMap=Maps.newHashMap();
|
||||
for(AsnIpCfg asnIpCfg:entity.getAsnIpCfgs()) {
|
||||
asnIpCfg.setIsAudit(1);
|
||||
asnIpCfg.setIsValid(1);
|
||||
asnIpCfg.setAuditorId(UserUtils.getUser().getId());
|
||||
asnIpCfg.setAuditTime(new Date());
|
||||
if(asnIpMap.containsKey(Long.parseLong(asnIpCfg.getUserRegion1()))) {
|
||||
asnIpMap.get(Long.parseLong(asnIpCfg.getUserRegion1())).add(asnIpCfg);
|
||||
}else {
|
||||
List<AsnIpCfg> _asnIps=Lists.newArrayList();
|
||||
_asnIps.add(asnIpCfg);
|
||||
asnIpMap.put(Long.parseLong(asnIpCfg.getUserRegion1()), _asnIps);
|
||||
}
|
||||
}
|
||||
auditIpBatch(asnIpMap,entity.getIsAudit());
|
||||
}
|
||||
}
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void delete(String ids) {
|
||||
|
||||
Reference in New Issue
Block a user