diff --git a/src/main/java/com/nis/web/controller/basics/AsnIpController.java b/src/main/java/com/nis/web/controller/basics/AsnIpController.java index 7e64592f3..ea7690457 100644 --- a/src/main/java/com/nis/web/controller/basics/AsnIpController.java +++ b/src/main/java/com/nis/web/controller/basics/AsnIpController.java @@ -140,6 +140,9 @@ public class AsnIpController extends BaseController{ ConfigGroupInfo info=AsnCacheUtils.get(Long.parseLong(id)); if(info!=null) { groupMap.put(id, info.getGroupName()); + }else { + info=asnIpCfgService.getConfigGroupInfoByAsnNo(Long.parseLong(id)); + groupMap.put(id, info.getGroupName()); } } return groupMap; diff --git a/src/main/java/com/nis/web/dao/CrudDao.java b/src/main/java/com/nis/web/dao/CrudDao.java index a1dc137e0..2df2b8ace 100644 --- a/src/main/java/com/nis/web/dao/CrudDao.java +++ b/src/main/java/com/nis/web/dao/CrudDao.java @@ -45,6 +45,12 @@ public interface CrudDao { * @return */ public int insert(T entity); + /** + * 批量插入数据专用,不返回id + * @param entity + * @return + */ + public int insertForBatch(T entity); /** * 更新数据 diff --git a/src/main/java/com/nis/web/dao/configuration/IpCfgDao.xml b/src/main/java/com/nis/web/dao/configuration/IpCfgDao.xml index 6d2f62b2c..65c364bfa 100644 --- a/src/main/java/com/nis/web/dao/configuration/IpCfgDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/IpCfgDao.xml @@ -572,6 +572,13 @@ ) + + insert into ${tableName} ( + + )values ( + + ) + update ${tableName} diff --git a/src/main/java/com/nis/web/service/CrudService.java b/src/main/java/com/nis/web/service/CrudService.java index 96b4e8f41..655dc28ba 100644 --- a/src/main/java/com/nis/web/service/CrudService.java +++ b/src/main/java/com/nis/web/service/CrudService.java @@ -109,7 +109,8 @@ public abstract class CrudService, T extends BaseEntity> batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false); for(int index = 0; index < data.size();index++){ T t = data.get(index); - ((CrudDao) batchSqlSession.getMapper(mClass)).insert(t); + //insertForBatch不要带上ID,会影响效率 + ((CrudDao) batchSqlSession.getMapper(mClass)).insertForBatch(t); // if(index>0&&index%batchSize==0) { // batchSqlSession.commit(); // batchSqlSession.clearCache(); diff --git a/src/main/java/com/nis/web/service/basics/AsnIpCfgService.java b/src/main/java/com/nis/web/service/basics/AsnIpCfgService.java index 4ff0c042d..e7caf9ab7 100644 --- a/src/main/java/com/nis/web/service/basics/AsnIpCfgService.java +++ b/src/main/java/com/nis/web/service/basics/AsnIpCfgService.java @@ -243,15 +243,18 @@ public class AsnIpCfgService extends CrudService, AsnIpCfg> { } long end=System.currentTimeMillis(); this.save(cfgs); - splitAndSend(toAddRegionAsnIpCfgs,Constants.VALID_YES); +// splitAndSend(toAddRegionAsnIpCfgs,Constants.VALID_YES); + asnIPRegionSendToMaat(toAddRegionAsnIpCfgs,Constants.VALID_YES); cfgs.clear(); toAddRegionAsnIpCfgs.clear(); } /** * 分割IP region分次下发 + * 由于在Controller中分割,此方法不需要调用,直接使用asnIPRegionSendToMaat方法即可 * @param asnIpCfgs * @param valid */ + @Deprecated public void splitAndSend(List asnIpCfgs,Integer valid){ if(asnIpCfgs!=null&&asnIpCfgs.size()>0) { // List asnIpCfgs=Lists.newArrayList(list.size()); @@ -393,7 +396,8 @@ public class AsnIpCfgService extends CrudService, AsnIpCfg> { } } this.save(entity.getAsnIpCfgs()); - splitAndSend(entity.getAsnIpCfgs(),Constants.VALID_YES); + asnIPRegionSendToMaat(entity.getAsnIpCfgs(),Constants.VALID_YES); +// splitAndSend(entity.getAsnIpCfgs(),Constants.VALID_YES); }else { if(entity.getAsnIpCfgs()!=null) { for(AsnIpCfg cfg:entity.getAsnIpCfgs()) { @@ -430,7 +434,8 @@ public class AsnIpCfgService extends CrudService, AsnIpCfg> { } asnIpCfgDao.delete(ids); //已经下发过的,调用分组复用配置删除接口 - splitAndSend(issuedList,Constants.VALID_NO); +// splitAndSend(issuedList,Constants.VALID_NO); + asnIPRegionSendToMaat(issuedList,Constants.VALID_NO); } // public List findPolicyGroupInfosByType(Integer groupId) { diff --git a/src/main/resources/jdbc.properties b/src/main/resources/jdbc.properties index 95ff26c1a..a03ff6e0f 100644 --- a/src/main/resources/jdbc.properties +++ b/src/main/resources/jdbc.properties @@ -1,13 +1,13 @@ #jdbc for oracle #jdbc.driver=oracle.jdbc.driver.OracleDriver jdbc.devlop.driver=com.mysql.jdbc.Driver -jdbc.devlop.url=jdbc:mysql://192.168.10.204:3306/gwall_dev?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull +jdbc.devlop.url=jdbc:mysql://192.168.10.204:3306/gwall_dev?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&rewriteBatchedStatements=true jdbc.devlop.username=root jdbc.devlop.key=pR3JFt5dsGCW0nZO3TLF7Q== jdbc.devlop.password=JgW5tsiGBNAtcqCgSQIP0g== jdbc.product.driver=com.mysql.jdbc.Driver -jdbc.product.url=jdbc:mysql://192.168.10.204:3306/gwall_dev?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull +jdbc.product.url=jdbc:mysql://192.168.10.204:3306/gwall_dev?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&rewriteBatchedStatements=true jdbc.product.username=root jdbc.product.key=pR3JFt5dsGCW0nZO3TLF7Q== jdbc.product.password=JgW5tsiGBNAtcqCgSQIP0g==