(1)为了使用批量更新,修改了updateByPrimaryKeySelective方法的方法名为update
(2)多域类配置加入地域IP (3)多域类配置可任选 (4)多域类配置加入批量删除,审核
This commit is contained in:
@@ -1,13 +1,9 @@
|
||||
package com.nis.web.service.configuration;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -18,10 +14,9 @@ import com.nis.domain.Page;
|
||||
import com.nis.domain.ServiceConfigInfo;
|
||||
import com.nis.domain.configuration.AppComplexKeywordCfg;
|
||||
import com.nis.domain.configuration.AppIdCfg;
|
||||
import com.nis.domain.configuration.AppStringCfg;
|
||||
import com.nis.domain.configuration.AreaIpCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.AppIdCfg.AppFeaturesIndex;
|
||||
import com.nis.domain.configuration.AppStringCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.maat.AppMaatCfg;
|
||||
import com.nis.domain.specific.ConfigGroupInfo;
|
||||
import com.nis.domain.specific.SpecificServiceCfg;
|
||||
@@ -212,7 +207,7 @@ public class AppCfgService extends CrudService<AppCfgDao,AppIdCfg> {
|
||||
c.setIsValid(cfg.getIsValid());
|
||||
complexStringCfgDao.insert(c);
|
||||
}else{
|
||||
complexStringCfgDao.updateByPrimaryKeySelective(c);
|
||||
complexStringCfgDao.update(c);
|
||||
}
|
||||
|
||||
|
||||
@@ -248,7 +243,7 @@ public class AppCfgService extends CrudService<AppCfgDao,AppIdCfg> {
|
||||
s.setIsValid(cfg.getIsValid());
|
||||
stringCfgDao.insert(s);
|
||||
}else{
|
||||
stringCfgDao.updateByPrimaryKeySelective(s);
|
||||
stringCfgDao.update(s);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class ComplexStringCfgService extends CrudService<ComplexStringCfgDao,Com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int addStringCfg(ComplexkeywordCfg cfg,List<AreaIpCfg> areaIpCfgs){
|
||||
public int addStringCfg(ComplexkeywordCfg cfg,List<BaseIpCfg> areaIpCfgs){
|
||||
if(areaIpCfgs!=null&&areaIpCfgs.size()>0){
|
||||
this.saveIpBatch(areaIpCfgs);
|
||||
}
|
||||
@@ -53,7 +53,7 @@ public class ComplexStringCfgService extends CrudService<ComplexStringCfgDao,Com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int updateStringCfg(ComplexkeywordCfg cfg,List<AreaIpCfg> addAreaCfg,List<AreaIpCfg> updateAreaCfg,List<AreaIpCfg> deleteAreaCfgs){
|
||||
public int updateStringCfg(ComplexkeywordCfg cfg,List<BaseIpCfg> addAreaCfg,List<BaseIpCfg> updateAreaCfg,List<BaseIpCfg> deleteAreaCfgs){
|
||||
if(addAreaCfg!=null&&addAreaCfg.size()>0){
|
||||
this.saveIpBatch(addAreaCfg);
|
||||
}
|
||||
@@ -63,7 +63,7 @@ public class ComplexStringCfgService extends CrudService<ComplexStringCfgDao,Com
|
||||
if(deleteAreaCfgs!=null&&deleteAreaCfgs.size()>0){
|
||||
this.deleteIpBatch(deleteAreaCfgs);
|
||||
}
|
||||
return complexStringCfgDao.updateByPrimaryKeySelective(cfg);
|
||||
return complexStringCfgDao.update(cfg);
|
||||
}
|
||||
/**
|
||||
*
|
||||
@@ -77,11 +77,11 @@ public class ComplexStringCfgService extends CrudService<ComplexStringCfgDao,Com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void auditStringCfg(int isAduit,List<ComplexkeywordCfg> auditCfg,List<AreaIpCfg> areaCfg,List<ComplexkeywordCfg> sendCfg) throws Exception{
|
||||
List<BaseCfg[]> sendCfgs=new ArrayList<BaseCfg[]>();
|
||||
public void auditStringCfg(int isAduit,List<ComplexkeywordCfg> auditCfg,List<BaseIpCfg> areaCfg,List<ComplexkeywordCfg> sendCfg) throws Exception{
|
||||
List<List<BaseCfg>> sendCfgs=new ArrayList<List<BaseCfg>>();
|
||||
for(ComplexkeywordCfg c:sendCfg){
|
||||
BaseCfg[] cArr=new BaseCfg[1];
|
||||
cArr[0]=c;
|
||||
List<BaseCfg> cArr=new ArrayList<>();
|
||||
cArr.add(c);
|
||||
sendCfgs.add(cArr);
|
||||
}
|
||||
if(Constants.AUDIT_NOT_YES==isAduit||
|
||||
@@ -110,7 +110,7 @@ public class ComplexStringCfgService extends CrudService<ComplexStringCfgDao,Com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void deleteStringCfg(List<ComplexkeywordCfg> cfgs,List<AreaIpCfg> areaCfg){
|
||||
public void deleteStringCfg(List<ComplexkeywordCfg> cfgs,List<BaseIpCfg> areaCfg){
|
||||
if(areaCfg!=null&&areaCfg.size()>0){
|
||||
this.deleteIpBatch(areaCfg);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int addIpCfg(BaseIpCfg baseIpCfg,List<AreaIpCfg> areaIpCfgs){
|
||||
public int addIpCfg(BaseIpCfg baseIpCfg,List<BaseIpCfg> areaIpCfgs){
|
||||
if(areaIpCfgs!=null&&areaIpCfgs.size()>0){
|
||||
this.saveIpBatch(areaIpCfgs);
|
||||
}
|
||||
@@ -54,7 +54,7 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int updateIpCfg(BaseIpCfg baseIpCfg,List<AreaIpCfg> addAreaCfg,List<AreaIpCfg> updateAreaCfg,List<AreaIpCfg> deleteAreaCfgs){
|
||||
public int updateIpCfg(BaseIpCfg baseIpCfg,List<BaseIpCfg> addAreaCfg,List<BaseIpCfg> updateAreaCfg,List<BaseIpCfg> deleteAreaCfgs){
|
||||
if(addAreaCfg!=null&&addAreaCfg.size()>0){
|
||||
this.saveIpBatch(addAreaCfg);
|
||||
}
|
||||
@@ -64,7 +64,7 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
if(deleteAreaCfgs!=null&&deleteAreaCfgs.size()>0){
|
||||
this.deleteIpBatch(deleteAreaCfgs);
|
||||
}
|
||||
return ipCfgDao.updateByPrimaryKeySelective(baseIpCfg);
|
||||
return ipCfgDao.update(baseIpCfg);
|
||||
}
|
||||
/**
|
||||
*
|
||||
@@ -78,11 +78,11 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void auditIpCfg(int isAduit,List<BaseIpCfg> auditCfg,List<AreaIpCfg> areaCfg,List<BaseIpCfg> sendCfg) throws Exception{
|
||||
List<BaseCfg[]> sendCfgs=new ArrayList<BaseCfg[]>();
|
||||
public void auditIpCfg(int isAduit,List<BaseIpCfg> auditCfg,List<BaseIpCfg> areaCfg,List<BaseIpCfg> sendCfg) throws Exception{
|
||||
List<List<BaseCfg>> sendCfgs=new ArrayList<List<BaseCfg>>();
|
||||
for(BaseIpCfg c:sendCfg){
|
||||
BaseCfg[] cArr=new BaseCfg[1];
|
||||
cArr[0]=c;
|
||||
List<BaseCfg> cArr=new ArrayList<>();
|
||||
cArr.add(c);
|
||||
sendCfgs.add(cArr);
|
||||
}
|
||||
if(Constants.AUDIT_NOT_YES==isAduit||
|
||||
|
||||
@@ -3,6 +3,9 @@ package com.nis.web.service.configuration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.session.ExecutorType;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -16,12 +19,14 @@ import com.nis.domain.configuration.MultipleCfg;
|
||||
import com.nis.domain.configuration.MultipleSearchCfg;
|
||||
import com.nis.domain.configuration.NumBoundaryCfg;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.configuration.ComplexStringCfgDao;
|
||||
import com.nis.web.dao.configuration.IpCfgDao;
|
||||
import com.nis.web.dao.configuration.MultipleCfgDao;
|
||||
import com.nis.web.dao.configuration.NumCfgDao;
|
||||
import com.nis.web.dao.configuration.StringCfgDao;
|
||||
import com.nis.web.service.CrudService;
|
||||
import com.nis.web.service.SpringContextHolder;
|
||||
|
||||
/**
|
||||
* 多域相关配置事务类
|
||||
@@ -51,98 +56,112 @@ public class MultipleCfgService extends CrudService<MultipleCfgDao,MultipleSearc
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int addCfg(MultipleCfg cfg){
|
||||
if(cfg==null) return 0;
|
||||
if(cfg.getIpCfg()!=null){
|
||||
for(BaseIpCfg _cfg:cfg.getIpCfg().values()){
|
||||
ipCfgDao.insert(_cfg);
|
||||
public void addCfg(MultipleCfg cfg){
|
||||
if(cfg!=null) {
|
||||
if(cfg.getIpCfg()!=null){
|
||||
for(BaseIpCfg _cfg:cfg.getIpCfg().values()){
|
||||
ipCfgDao.insert(_cfg);
|
||||
}
|
||||
}
|
||||
if(cfg.getStringCfg()!=null){
|
||||
for(BaseStringCfg _cfg:cfg.getStringCfg().values()){
|
||||
stringCfgDao.insert(_cfg);
|
||||
}
|
||||
}
|
||||
if(cfg.getNumCfg()!=null){
|
||||
for(NumBoundaryCfg _cfg:cfg.getNumCfg().values()){
|
||||
numCfgDao.insert(_cfg);
|
||||
}
|
||||
}
|
||||
if(cfg.getComplexCfg()!=null){
|
||||
for(ComplexkeywordCfg _cfg:cfg.getComplexCfg().values()){
|
||||
complexStringCfgDao.insert(_cfg);
|
||||
}
|
||||
}
|
||||
if(cfg.getAreaCfg()!=null&&cfg.getAreaCfg().size()>0){
|
||||
List<BaseIpCfg> areaCfg=new ArrayList<>();
|
||||
areaCfg.addAll(cfg.getAreaCfg());
|
||||
this.saveIpBatch(areaCfg);
|
||||
}
|
||||
}
|
||||
if(cfg.getStringCfg()!=null){
|
||||
for(BaseStringCfg _cfg:cfg.getStringCfg().values()){
|
||||
stringCfgDao.insert(_cfg);
|
||||
}
|
||||
}
|
||||
if(cfg.getNumCfg()!=null){
|
||||
for(NumBoundaryCfg _cfg:cfg.getNumCfg().values()){
|
||||
numCfgDao.insert(_cfg);
|
||||
}
|
||||
}
|
||||
if(cfg.getComplexCfg()!=null){
|
||||
for(ComplexkeywordCfg _cfg:cfg.getComplexCfg().values()){
|
||||
complexStringCfgDao.insert(_cfg);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int updateCfg(MultipleCfg cfg,List<BaseCfg> deleteCfg){
|
||||
if(cfg==null) return 0;
|
||||
if(cfg.getIpCfg()!=null){
|
||||
for(BaseIpCfg _cfg:cfg.getIpCfg().values()){
|
||||
if(_cfg.getCfgId()==null){//修改配置时用户可能希望新增IP配置,此时新增的IP配置无配置ID
|
||||
ipCfgDao.insert(_cfg);
|
||||
}else{
|
||||
ipCfgDao.updateByPrimaryKeySelective(_cfg);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if(cfg.getStringCfg()!=null){
|
||||
for(BaseStringCfg _cfg:cfg.getStringCfg().values()){
|
||||
stringCfgDao.updateByPrimaryKeySelective(_cfg);
|
||||
}
|
||||
}
|
||||
if(cfg.getNumCfg()!=null){
|
||||
for(NumBoundaryCfg _cfg:cfg.getNumCfg().values()){
|
||||
numCfgDao.updateByPrimaryKeySelective(_cfg);
|
||||
}
|
||||
}
|
||||
if(cfg.getComplexCfg()!=null){
|
||||
for(ComplexkeywordCfg _cfg:cfg.getComplexCfg().values()){
|
||||
complexStringCfgDao.updateByPrimaryKeySelective(_cfg);
|
||||
}
|
||||
}
|
||||
if(deleteCfg!=null&&deleteCfg.size()>0){
|
||||
for(BaseCfg _cfg:deleteCfg){
|
||||
if(_cfg instanceof BaseIpCfg){
|
||||
ipCfgDao.deleteByCompileId((BaseIpCfg)_cfg);
|
||||
}else if(_cfg instanceof BaseStringCfg){
|
||||
stringCfgDao.deleteByCompileId((BaseStringCfg)_cfg);
|
||||
}else if(_cfg instanceof NumBoundaryCfg){
|
||||
numCfgDao.deleteByCompileId((NumBoundaryCfg)_cfg);
|
||||
}else if(_cfg instanceof ComplexkeywordCfg){
|
||||
complexStringCfgDao.deleteByCompileId((ComplexkeywordCfg)_cfg);
|
||||
public void updateCfg(MultipleCfg cfg,List<BaseCfg> deleteCfg,List<BaseIpCfg> addAreaCfg,List<BaseIpCfg> updateAreaCfg,List<BaseIpCfg> deleteAreaCfgs){
|
||||
if(cfg!=null){
|
||||
if(cfg.getIpCfg()!=null){
|
||||
for(BaseIpCfg _cfg:cfg.getIpCfg().values()){
|
||||
if(_cfg.getCfgId()==null){//修改配置时用户可能希望新增IP配置,此时新增的IP配置无配置ID
|
||||
ipCfgDao.insert(_cfg);
|
||||
}else{
|
||||
ipCfgDao.update(_cfg);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if(cfg.getStringCfg()!=null){
|
||||
for(BaseStringCfg _cfg:cfg.getStringCfg().values()){
|
||||
if(_cfg.getCfgId()==null){
|
||||
stringCfgDao.insert(_cfg);
|
||||
}else
|
||||
stringCfgDao.update(_cfg);
|
||||
}
|
||||
}
|
||||
if(cfg.getNumCfg()!=null){
|
||||
for(NumBoundaryCfg _cfg:cfg.getNumCfg().values()){
|
||||
if(_cfg.getCfgId()==null){
|
||||
numCfgDao.insert(_cfg);
|
||||
}else
|
||||
numCfgDao.updateByPrimaryKeySelective(_cfg);
|
||||
}
|
||||
}
|
||||
if(cfg.getComplexCfg()!=null){
|
||||
for(ComplexkeywordCfg _cfg:cfg.getComplexCfg().values()){
|
||||
if(_cfg.getCfgId()==null){
|
||||
complexStringCfgDao.insert(_cfg);
|
||||
}else
|
||||
complexStringCfgDao.update(_cfg);
|
||||
}
|
||||
}
|
||||
if(deleteCfg!=null&&deleteCfg.size()>0){
|
||||
for(BaseCfg _cfg:deleteCfg){
|
||||
if(_cfg instanceof BaseIpCfg){
|
||||
ipCfgDao.deleteByCompileId((BaseIpCfg)_cfg);
|
||||
}else if(_cfg instanceof BaseStringCfg){
|
||||
stringCfgDao.deleteByCompileId((BaseStringCfg)_cfg);
|
||||
}else if(_cfg instanceof NumBoundaryCfg){
|
||||
numCfgDao.deleteByCompileId((NumBoundaryCfg)_cfg);
|
||||
}else if(_cfg instanceof ComplexkeywordCfg){
|
||||
complexStringCfgDao.deleteByCompileId((ComplexkeywordCfg)_cfg);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(addAreaCfg!=null&&addAreaCfg.size()>0){
|
||||
this.saveIpBatch(addAreaCfg);
|
||||
}
|
||||
if(updateAreaCfg!=null&&updateAreaCfg.size()>0){
|
||||
this.updateIpBatch(updateAreaCfg);
|
||||
}
|
||||
if(deleteAreaCfgs!=null&&deleteAreaCfgs.size()>0){
|
||||
this.deleteIpBatch(deleteAreaCfgs);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int deleteCfg(MultipleCfg cfg){
|
||||
if(cfg==null) return 0;
|
||||
if(cfg.getIpCfg()!=null){
|
||||
for(BaseIpCfg _cfg:cfg.getIpCfg().values()){
|
||||
ipCfgDao.deleteByCompileId(_cfg);
|
||||
}
|
||||
public void deleteCfg(List<BaseIpCfg> delIpCfgs,List<BaseStringCfg> delStringCfgs,List<NumBoundaryCfg> delNumCfgs,List<ComplexkeywordCfg> delComplexCfgs){
|
||||
if(delIpCfgs!=null&&delIpCfgs.size()>0){
|
||||
this.deleteIpBatch(delIpCfgs);
|
||||
}
|
||||
if(cfg.getStringCfg()!=null){
|
||||
for(BaseStringCfg _cfg:cfg.getStringCfg().values()){
|
||||
stringCfgDao.deleteByCompileId(_cfg);
|
||||
}
|
||||
if(delStringCfgs!=null&&delStringCfgs.size()>0){
|
||||
this.deleteStringBatch(delStringCfgs);
|
||||
}
|
||||
if(cfg.getNumCfg()!=null){
|
||||
for(NumBoundaryCfg _cfg:cfg.getNumCfg().values()){
|
||||
numCfgDao.deleteByCompileId(_cfg);
|
||||
}
|
||||
if(delNumCfgs!=null&&delNumCfgs.size()>0){
|
||||
this.deleteNumBatch(delNumCfgs);
|
||||
}
|
||||
if(cfg.getComplexCfg()!=null){
|
||||
for(ComplexkeywordCfg _cfg:cfg.getComplexCfg().values()){
|
||||
complexStringCfgDao.deleteByCompileId(_cfg);
|
||||
}
|
||||
if(delComplexCfgs!=null&&delComplexCfgs.size()>0){
|
||||
this.deleteComplexBatch(delComplexCfgs);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
/**
|
||||
*
|
||||
@@ -156,93 +175,72 @@ public class MultipleCfgService extends CrudService<MultipleCfgDao,MultipleSearc
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public boolean auditCfg(MultipleCfg sendCfg,MultipleCfg cfg) throws Exception{
|
||||
int should=0;
|
||||
if(cfg.getComplexCfg()!=null){
|
||||
should+=cfg.getComplexCfg().size();
|
||||
}
|
||||
if(cfg.getStringCfg()!=null){
|
||||
should+=cfg.getStringCfg().size();
|
||||
}
|
||||
if(cfg.getNumCfg()!=null){
|
||||
should+=cfg.getNumCfg().size();
|
||||
}
|
||||
if(cfg.getIpCfg()!=null){
|
||||
should+=cfg.getIpCfg().size();
|
||||
}
|
||||
int result=0;
|
||||
if(Constants.AUDIT_YES==cfg.getIsAudit()||Constants.AUDIT_NOT_YES==cfg.getIsAudit()){
|
||||
List<BaseCfg> cfgs=new ArrayList<BaseCfg>();
|
||||
if(sendCfg.getIpCfg()!=null){
|
||||
for(BaseIpCfg _cfg:sendCfg.getIpCfg().values()){
|
||||
cfgs.add(_cfg);
|
||||
}
|
||||
}
|
||||
if(sendCfg.getStringCfg()!=null){
|
||||
for(BaseStringCfg _cfg:sendCfg.getStringCfg().values()){
|
||||
cfgs.add(_cfg);
|
||||
}
|
||||
}
|
||||
if(sendCfg.getNumCfg()!=null){
|
||||
for(NumBoundaryCfg _cfg:sendCfg.getNumCfg().values()){
|
||||
cfgs.add(_cfg);
|
||||
}
|
||||
}
|
||||
if(sendCfg.getComplexCfg()!=null){
|
||||
for(ComplexkeywordCfg _cfg:sendCfg.getComplexCfg().values()){
|
||||
cfgs.add(_cfg);
|
||||
}
|
||||
}
|
||||
BaseCfg[] cfgArray=new BaseCfg[cfgs.size()];
|
||||
cfgs.toArray(cfgArray);
|
||||
if(this.sendToMaatConvertor(cfg.getIsAudit(), null, cfgArray)){
|
||||
if(cfg.getIpCfg()!=null){
|
||||
for(BaseIpCfg _cfg:cfg.getIpCfg().values()){
|
||||
result+=ipCfgDao.audit(_cfg);
|
||||
public void auditCfg(int isAudit,List<MultipleCfg> sendCfgs,List<BaseIpCfg> auduitIpCfgs,
|
||||
List<BaseStringCfg> auduitStringCfgs,List<NumBoundaryCfg> auduitNumCfgs,List<ComplexkeywordCfg> auduitComplexCfgs) throws Exception{
|
||||
if(Constants.AUDIT_YES==isAudit||Constants.AUDIT_NOT_YES==isAudit){
|
||||
List<List<BaseCfg>> cfgs=new ArrayList<List<BaseCfg>>();
|
||||
for(MultipleCfg sendCfg:sendCfgs){
|
||||
List<BaseCfg> cfg=new ArrayList<>();
|
||||
if(sendCfg.getIpCfg()!=null){
|
||||
for(BaseIpCfg _cfg:sendCfg.getIpCfg().values()){
|
||||
cfg.add(_cfg);
|
||||
}
|
||||
}
|
||||
if(cfg.getStringCfg()!=null){
|
||||
for(BaseStringCfg _cfg:cfg.getStringCfg().values()){
|
||||
result+=stringCfgDao.audit(_cfg);
|
||||
if(sendCfg.getStringCfg()!=null){
|
||||
for(BaseStringCfg _cfg:sendCfg.getStringCfg().values()){
|
||||
cfg.add(_cfg);
|
||||
}
|
||||
}
|
||||
if(cfg.getNumCfg()!=null){
|
||||
for(NumBoundaryCfg _cfg:cfg.getNumCfg().values()){
|
||||
result+=numCfgDao.audit(_cfg);
|
||||
if(sendCfg.getNumCfg()!=null){
|
||||
for(NumBoundaryCfg _cfg:sendCfg.getNumCfg().values()){
|
||||
cfg.add(_cfg);
|
||||
}
|
||||
}
|
||||
if(cfg.getComplexCfg()!=null){
|
||||
for(ComplexkeywordCfg _cfg:cfg.getComplexCfg().values()){
|
||||
result+=complexStringCfgDao.audit(_cfg);
|
||||
if(sendCfg.getComplexCfg()!=null){
|
||||
for(ComplexkeywordCfg _cfg:sendCfg.getComplexCfg().values()){
|
||||
cfg.add(_cfg);
|
||||
}
|
||||
}
|
||||
//设置区域ip
|
||||
if(sendCfg.getAreaCfg()!=null){
|
||||
if(cfg.size()>0){
|
||||
cfg.get(0).setAreaCfg(sendCfg.getAreaCfg());
|
||||
}else{
|
||||
throw new RuntimeException("发送至maat异常,没有有效的配置!");
|
||||
}
|
||||
}
|
||||
cfgs.add(cfg);
|
||||
}
|
||||
if(this.sendToMaatConvertorBatch(isAudit, cfgs)){
|
||||
if(auduitIpCfgs!=null&&auduitIpCfgs.size()>0){
|
||||
this.auditIpBatch(auduitIpCfgs);
|
||||
}
|
||||
if(auduitStringCfgs!=null&&auduitStringCfgs.size()>0){
|
||||
this.auditStringBatch(auduitStringCfgs);
|
||||
}
|
||||
if(auduitNumCfgs!=null&&auduitNumCfgs.size()>0){
|
||||
this.auditNumBatch(auduitNumCfgs);
|
||||
}
|
||||
if(auduitComplexCfgs!=null&&auduitComplexCfgs.size()>0){
|
||||
this.auditComplexBatch(auduitComplexCfgs);
|
||||
}
|
||||
}else{
|
||||
result=0;
|
||||
throw new RuntimeException("发送至maat失败,返回false!");
|
||||
}
|
||||
|
||||
}else{
|
||||
if(cfg.getIpCfg()!=null){
|
||||
for(BaseIpCfg _cfg:cfg.getIpCfg().values()){
|
||||
result+=ipCfgDao.audit(_cfg);
|
||||
}
|
||||
if(auduitIpCfgs!=null&&auduitIpCfgs.size()>0){
|
||||
this.auditIpBatch(auduitIpCfgs);
|
||||
}
|
||||
if(cfg.getStringCfg()!=null){
|
||||
for(BaseStringCfg _cfg:cfg.getStringCfg().values()){
|
||||
result+=stringCfgDao.audit(_cfg);
|
||||
}
|
||||
if(auduitStringCfgs!=null&&auduitStringCfgs.size()>0){
|
||||
this.auditStringBatch(auduitStringCfgs);
|
||||
}
|
||||
if(cfg.getNumCfg()!=null){
|
||||
for(NumBoundaryCfg _cfg:cfg.getNumCfg().values()){
|
||||
result+=numCfgDao.audit(_cfg);
|
||||
}
|
||||
if(auduitNumCfgs!=null&&auduitNumCfgs.size()>0){
|
||||
this.auditNumBatch(auduitNumCfgs);
|
||||
}
|
||||
if(cfg.getComplexCfg()!=null){
|
||||
for(ComplexkeywordCfg _cfg:cfg.getComplexCfg().values()){
|
||||
result+=complexStringCfgDao.audit(_cfg);
|
||||
}
|
||||
if(auduitComplexCfgs!=null&&auduitComplexCfgs.size()>0){
|
||||
this.auditComplexBatch(auduitComplexCfgs);
|
||||
}
|
||||
}
|
||||
return should==result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -252,5 +250,100 @@ public class MultipleCfgService extends CrudService<MultipleCfgDao,MultipleSearc
|
||||
public Page<MultipleSearchCfg> findPage(Page<MultipleSearchCfg> page, MultipleSearchCfg entity) {
|
||||
return super.findPage(page, entity);
|
||||
}
|
||||
|
||||
private void deleteStringBatch(List<BaseStringCfg> data) {
|
||||
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||
SqlSession batchSqlSession = null;
|
||||
try{
|
||||
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
for(int index = 0; index < data.size();index++){
|
||||
BaseStringCfg t = data.get(index);
|
||||
((CrudDao<BaseStringCfg>) batchSqlSession.getMapper(StringCfgDao.class)).delete(t);
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
batchSqlSession.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
private void deleteComplexBatch(List<ComplexkeywordCfg> data) {
|
||||
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||
SqlSession batchSqlSession = null;
|
||||
try{
|
||||
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
for(int index = 0; index < data.size();index++){
|
||||
ComplexkeywordCfg t = data.get(index);
|
||||
((CrudDao<ComplexkeywordCfg>) batchSqlSession.getMapper(ComplexStringCfgDao.class)).delete(t);
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
batchSqlSession.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
private void deleteNumBatch(List<NumBoundaryCfg> data) {
|
||||
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||
SqlSession batchSqlSession = null;
|
||||
try{
|
||||
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
for(int index = 0; index < data.size();index++){
|
||||
NumBoundaryCfg t = data.get(index);
|
||||
((CrudDao<NumBoundaryCfg>) batchSqlSession.getMapper(NumCfgDao.class)).delete(t);
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
batchSqlSession.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
private void auditStringBatch(List<BaseStringCfg> data) {
|
||||
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||
SqlSession batchSqlSession = null;
|
||||
try{
|
||||
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
for(int index = 0; index < data.size();index++){
|
||||
BaseStringCfg t = data.get(index);
|
||||
((CrudDao<BaseStringCfg>) batchSqlSession.getMapper(StringCfgDao.class)).audit(t);
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
batchSqlSession.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
private void auditNumBatch(List<NumBoundaryCfg> data) {
|
||||
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||
SqlSession batchSqlSession = null;
|
||||
try{
|
||||
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
for(int index = 0; index < data.size();index++){
|
||||
NumBoundaryCfg t = data.get(index);
|
||||
((CrudDao<NumBoundaryCfg>) batchSqlSession.getMapper(NumCfgDao.class)).audit(t);
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
batchSqlSession.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
private void auditComplexBatch(List<ComplexkeywordCfg> data) {
|
||||
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||
SqlSession batchSqlSession = null;
|
||||
try{
|
||||
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
for(int index = 0; index < data.size();index++){
|
||||
ComplexkeywordCfg t = data.get(index);
|
||||
((CrudDao<ComplexkeywordCfg>) batchSqlSession.getMapper(ComplexStringCfgDao.class)).audit(t);
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
batchSqlSession.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.nis.domain.configuration.AreaIpCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.NumBoundaryCfg;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.dao.configuration.NumCfgDao;
|
||||
@@ -32,7 +33,7 @@ public class NumCfgService extends CrudService<NumCfgDao,NumBoundaryCfg> {
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int addNumCfg(NumBoundaryCfg cfg,List<AreaIpCfg> areaIpCfgs){
|
||||
public int addNumCfg(NumBoundaryCfg cfg,List<BaseIpCfg> areaIpCfgs){
|
||||
if(areaIpCfgs!=null&&areaIpCfgs.size()>0){
|
||||
this.saveIpBatch(areaIpCfgs);
|
||||
}
|
||||
@@ -49,7 +50,7 @@ public class NumCfgService extends CrudService<NumCfgDao,NumBoundaryCfg> {
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int updateNumCfg(NumBoundaryCfg cfg,List<AreaIpCfg> addAreaCfg,List<AreaIpCfg> updateAreaCfg,List<AreaIpCfg> deleteAreaCfgs){
|
||||
public int updateNumCfg(NumBoundaryCfg cfg,List<BaseIpCfg> addAreaCfg,List<BaseIpCfg> updateAreaCfg,List<BaseIpCfg> deleteAreaCfgs){
|
||||
if(addAreaCfg!=null&&addAreaCfg.size()>0){
|
||||
this.saveIpBatch(addAreaCfg);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class StringCfgService extends CrudService<StringCfgDao,BaseStringCfg> {
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int addStringCfg(BaseStringCfg baseStringCfg,List<AreaIpCfg> areaIpCfgs){
|
||||
public int addStringCfg(BaseStringCfg baseStringCfg,List<BaseIpCfg> areaIpCfgs){
|
||||
if(areaIpCfgs!=null&&areaIpCfgs.size()>0){
|
||||
this.saveIpBatch(areaIpCfgs);
|
||||
}
|
||||
@@ -53,7 +53,7 @@ public class StringCfgService extends CrudService<StringCfgDao,BaseStringCfg> {
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int updateStringCfg(BaseStringCfg baseStringCfg,List<AreaIpCfg> addAreaCfg,List<AreaIpCfg> updateAreaCfg,List<AreaIpCfg> deleteAreaCfgs){
|
||||
public int updateStringCfg(BaseStringCfg baseStringCfg,List<BaseIpCfg> addAreaCfg,List<BaseIpCfg> updateAreaCfg,List<BaseIpCfg> deleteAreaCfgs){
|
||||
if(addAreaCfg!=null&&addAreaCfg.size()>0){
|
||||
this.saveIpBatch(addAreaCfg);
|
||||
}
|
||||
@@ -63,7 +63,7 @@ public class StringCfgService extends CrudService<StringCfgDao,BaseStringCfg> {
|
||||
if(deleteAreaCfgs!=null&&deleteAreaCfgs.size()>0){
|
||||
this.deleteIpBatch(deleteAreaCfgs);
|
||||
}
|
||||
return stringCfgDao.updateByPrimaryKeySelective(baseStringCfg);
|
||||
return stringCfgDao.update(baseStringCfg);
|
||||
}
|
||||
/**
|
||||
*
|
||||
@@ -77,11 +77,11 @@ public class StringCfgService extends CrudService<StringCfgDao,BaseStringCfg> {
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void auditStringCfg(int isAduit,List<BaseStringCfg> auditCfg,List<AreaIpCfg> areaCfg,List<BaseStringCfg> sendCfg) throws Exception{
|
||||
List<BaseCfg[]> sendCfgs=new ArrayList<BaseCfg[]>();
|
||||
public void auditStringCfg(int isAduit,List<BaseStringCfg> auditCfg,List<BaseIpCfg> areaCfg,List<BaseStringCfg> sendCfg) throws Exception{
|
||||
List<List<BaseCfg>> sendCfgs=new ArrayList<List<BaseCfg>>();
|
||||
for(BaseStringCfg c:sendCfg){
|
||||
BaseStringCfg[] cArr=new BaseStringCfg[1];
|
||||
cArr[0]=c;
|
||||
List<BaseCfg> cArr=new ArrayList<>();
|
||||
cArr.add(c);
|
||||
sendCfgs.add(cArr);
|
||||
}
|
||||
if(Constants.AUDIT_NOT_YES==isAduit||
|
||||
@@ -107,7 +107,7 @@ public class StringCfgService extends CrudService<StringCfgDao,BaseStringCfg> {
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void deleteStringCfg(List<BaseStringCfg> stringCfg,List<AreaIpCfg> areaCfg){
|
||||
public void deleteStringCfg(List<BaseStringCfg> stringCfg,List<BaseIpCfg> areaCfg){
|
||||
if(areaCfg!=null&&areaCfg.size()>0){
|
||||
this.deleteIpBatch(areaCfg);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user