app Http、app DNS、app ssl增加导入功能
This commit is contained in:
@@ -1231,12 +1231,14 @@ public class BaseController {
|
||||
BlockingQueue<DnsResStrategy> dnsResStrategies=null;
|
||||
List<CfgIndexInfo> cfgIndexInfos = new ArrayList<CfgIndexInfo>();
|
||||
List<AppPolicyCfg> appPolicyCfgs = new ArrayList<AppPolicyCfg>();
|
||||
List<AppFeatureIndex> appFeatureIndexs= new ArrayList<AppFeatureIndex>();
|
||||
List<Map<Long,Integer>> asnNoMaps=Lists.newArrayList();
|
||||
Map<Long,Integer> newAsnNoMap=Maps.newConcurrentMap();
|
||||
Map<Long,Integer> OldAsnNoMap=Maps.newConcurrentMap();
|
||||
asnNoMaps.add(newAsnNoMap);
|
||||
asnNoMaps.add(OldAsnNoMap);
|
||||
FunctionRegionDict appRegion = null;
|
||||
FunctionRegionDict appFeatureRegion = null;
|
||||
if(serviceDict!=null) {
|
||||
String regionCode = serviceDict.getRegionCode();
|
||||
for (String code : regionCode.split(",")) {
|
||||
@@ -1248,6 +1250,12 @@ public class BaseController {
|
||||
appRegion = d;
|
||||
break;
|
||||
}
|
||||
|
||||
if (d != null && d.getFunctionId() != null
|
||||
&& (d.getFunctionId().intValue()==565 || d.getFunctionId().intValue()==564 || d.getFunctionId().intValue()==566 || d.getFunctionId().intValue()==563)) {
|
||||
appFeatureRegion = d;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1375,6 +1383,7 @@ public class BaseController {
|
||||
String specServiceId = request.getParameter("appId");
|
||||
String behaviorId = request.getParameter("behaviorId");
|
||||
String asnIpGroup = request.getParameter("asnGroupId");
|
||||
|
||||
String isSend = request.getParameter("isSend")==null?"":request.getParameter("isSend");
|
||||
SpecificServiceCfg specificServiceCfg = null;
|
||||
if (serviceDict!=null&&(serviceDict.getServiceId().intValue() == 33 || serviceDict.getServiceId().intValue() == 145
|
||||
@@ -1385,6 +1394,9 @@ public class BaseController {
|
||||
|| serviceDict.getServiceId().intValue() == 1028// app ip
|
||||
|| serviceDict.getServiceId().intValue() == 1024//app http
|
||||
|| serviceDict.getServiceId().intValue() == 1026//app domain
|
||||
|| serviceDict.getServiceId().intValue() == 1027//app dns
|
||||
|| serviceDict.getServiceId().intValue() == 1029//app ssl
|
||||
|| serviceDict.getServiceId().intValue() == 1025//app PAYLOAD
|
||||
)) {
|
||||
if (StringUtils.isNotBlank(specServiceId)) {
|
||||
specificServiceCfg = specificServiceCfgService
|
||||
@@ -1530,7 +1542,7 @@ public class BaseController {
|
||||
asnIpCfgs.add(_cfg);
|
||||
ind++;
|
||||
}
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, asnIpCfgs, cfgIndexInfos, appPolicyCfgs,isSend.equals("1"));
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, asnIpCfgs, cfgIndexInfos, appPolicyCfgs,appFeatureIndexs,isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
appPolicyCfgs.clear();
|
||||
_ipPortCfgs.clear();
|
||||
@@ -1651,15 +1663,29 @@ public class BaseController {
|
||||
if(regionDict.getFunctionId().intValue()!=600
|
||||
&®ionDict.getFunctionId().intValue()!=301
|
||||
&®ionDict.getFunctionId().intValue()!=401
|
||||
&®ionDict.getFunctionId().intValue()!=405) {
|
||||
&®ionDict.getFunctionId().intValue()!=405
|
||||
&®ionDict.getFunctionId().intValue()!=565
|
||||
&®ionDict.getFunctionId().intValue()!=566
|
||||
&®ionDict.getFunctionId().intValue()!=563) {
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo,new String[] {"cfgId"});
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
}
|
||||
if(regionDict.getFunctionId().intValue()==565 || regionDict.getFunctionId().intValue()==566 || regionDict.getFunctionId().intValue()==563){
|
||||
AppFeatureIndex appfeature = new AppFeatureIndex();
|
||||
if(appFeatureRegion!=null){
|
||||
appfeature.setCfgRegionCode1(String.valueOf(regionDict.getConfigRegionCode()));
|
||||
appfeature.setCfgRegionValue(regionDict.getConfigRegionValue());
|
||||
appfeature.setCfgRegionType(String.valueOf(regionDict.getRegionType()));
|
||||
}
|
||||
BeanUtils.copyProperties(cfg, appfeature,new String[] {"cfgId"});
|
||||
appFeatureIndexs.add(appfeature);
|
||||
}
|
||||
|
||||
}
|
||||
ind++;
|
||||
}
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, _ipPortCfgs, cfgIndexInfos, appPolicyCfgs,isSend.equals("1"));
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, _ipPortCfgs, cfgIndexInfos, appPolicyCfgs,appFeatureIndexs,isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
appPolicyCfgs.clear();
|
||||
_ipPortCfgs.clear();
|
||||
@@ -1784,7 +1810,7 @@ public class BaseController {
|
||||
}
|
||||
ind++;
|
||||
}
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, _stringCfgs, cfgIndexInfos, appPolicyCfgs,isSend.equals("1"));
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, _stringCfgs, cfgIndexInfos, appPolicyCfgs,appFeatureIndexs,isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
appPolicyCfgs.clear();
|
||||
_stringCfgs.clear();
|
||||
@@ -1874,16 +1900,27 @@ public class BaseController {
|
||||
appPolicyCfgs.add(appPolicyCfg);
|
||||
}
|
||||
} else {
|
||||
if(!regionDict.getFunctionId().equals(402)) {
|
||||
if(!regionDict.getFunctionId().equals(402) && !regionDict.getFunctionId().equals(565)
|
||||
&& !regionDict.getFunctionId().equals(566) && !regionDict.getFunctionId().equals(564)) {
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo,new String[] {"cfgId"});
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
}
|
||||
|
||||
if(regionDict.getFunctionId().intValue()==565 || regionDict.getFunctionId().intValue()==566
|
||||
|| regionDict.getFunctionId().intValue()==564){
|
||||
AppFeatureIndex appfeature = new AppFeatureIndex();
|
||||
BeanUtils.copyProperties(cfg, appfeature,new String[] {"cfgId"});
|
||||
if(appFeatureRegion!=null){
|
||||
appfeature.setCfgRegionCode1(String.valueOf(appFeatureRegion.getConfigRegionCode()));
|
||||
appfeature.setCfgRegionValue(appFeatureRegion.getConfigRegionValue());
|
||||
appfeature.setCfgRegionType(String.valueOf(appFeatureRegion.getRegionType()));
|
||||
}
|
||||
appFeatureIndexs.add(appfeature);
|
||||
}
|
||||
}
|
||||
ind++;
|
||||
}
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, _complexkeywordCfgs, cfgIndexInfos, appPolicyCfgs,isSend.equals("1"));
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, _complexkeywordCfgs, cfgIndexInfos, appPolicyCfgs,appFeatureIndexs,isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
appPolicyCfgs.clear();
|
||||
_complexkeywordCfgs.clear();
|
||||
@@ -1923,7 +1960,7 @@ public class BaseController {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
ind++;
|
||||
}
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, _dnsResStrategies, cfgIndexInfos, appPolicyCfgs,isSend.equals("1"));
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, _dnsResStrategies, cfgIndexInfos, appPolicyCfgs,appFeatureIndexs,isSend.equals("1"));
|
||||
_dnsResStrategies.clear();
|
||||
cfgIndexInfos.clear();
|
||||
appPolicyCfgs.clear();
|
||||
|
||||
@@ -46,7 +46,9 @@ import com.nis.domain.callback.InlineIp;
|
||||
import com.nis.domain.callback.NtcDnsResStrategy;
|
||||
import com.nis.domain.callback.ProxyObjKeyring;
|
||||
import com.nis.domain.callback.ProxyObjTrustedCa;
|
||||
import com.nis.domain.configuration.AppComplexFeatureCfg;
|
||||
import com.nis.domain.configuration.AppDomainCfg;
|
||||
import com.nis.domain.configuration.AppFeatureIndex;
|
||||
import com.nis.domain.configuration.AppHttpCfg;
|
||||
import com.nis.domain.configuration.AppIpCfg;
|
||||
import com.nis.domain.configuration.AppPolicyCfg;
|
||||
@@ -87,6 +89,7 @@ import com.nis.util.StringUtil;
|
||||
import com.nis.util.StringUtils;
|
||||
import com.nis.web.dao.basics.AsnIpCfgDao;
|
||||
import com.nis.web.dao.configuration.AppCfgDao;
|
||||
import com.nis.web.dao.configuration.AppMultiFeatureCfgDao;
|
||||
import com.nis.web.dao.configuration.DdosCfgDao;
|
||||
import com.nis.web.dao.configuration.DnsIpCfgDao;
|
||||
import com.nis.web.dao.configuration.DnsResStrategyDao;
|
||||
@@ -1595,7 +1598,9 @@ public abstract class BaseService {
|
||||
public void saveAndSend(FunctionRegionDict regionDict,FunctionServiceDict serviceDict,
|
||||
SpecificServiceCfg specificServiceCfg,
|
||||
List<? extends BaseCfg> list,List<CfgIndexInfo> cfgIndexInfos,
|
||||
List<AppPolicyCfg> appPolicyCfgs,boolean send){
|
||||
List<AppPolicyCfg> appPolicyCfgs,
|
||||
List<AppFeatureIndex> appFeatureCfgs,
|
||||
boolean send){
|
||||
if(list!=null&&list.size()>0) {
|
||||
String type=null;
|
||||
if (list.get(0) instanceof BaseIpCfg) {
|
||||
@@ -1615,6 +1620,10 @@ public abstract class BaseService {
|
||||
if (appPolicyCfgs != null && appPolicyCfgs.size() > 0) {
|
||||
this.savePolicyList(appPolicyCfgs);
|
||||
}
|
||||
if (appFeatureCfgs != null && appFeatureCfgs.size() > 0) {
|
||||
this.saveAppFeatureList(appFeatureCfgs);
|
||||
}
|
||||
|
||||
if("BaseIpCfg".equals(type)) {
|
||||
List<BaseIpCfg> listPage = (List<BaseIpCfg>) list;
|
||||
if (specificServiceCfg!=null&®ionDict.getFunctionId().equals(405)) {
|
||||
@@ -1729,7 +1738,11 @@ public abstract class BaseService {
|
||||
if(regionDict.getDictId().intValue()==63) {
|
||||
// appCfgService.saveAppHttpCfg(listPage);
|
||||
this.saveComplexkeywordCfgBatch(regionDict,serviceDict,listPage, AppHttpCfg.getTablename(),send);
|
||||
}else
|
||||
}else
|
||||
//app Http特征
|
||||
if(regionDict.getDictId().intValue()==220 || regionDict.getDictId().intValue()==216 || regionDict.getDictId().intValue()==224){
|
||||
this.saveComplexkeywordCfgBatch(regionDict,serviceDict,listPage,"app_complex_feature_cfg",send);
|
||||
}
|
||||
// HTTP(s)请求头域
|
||||
if(regionDict.getDictId().intValue()==98 || regionDict.getDictId().intValue()==80 ||
|
||||
regionDict.getDictId().intValue()==86 || regionDict.getDictId().intValue()==92 ||
|
||||
@@ -2058,6 +2071,31 @@ public abstract class BaseService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导入配置保存App特征
|
||||
* @param appPolicyCfgs
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void saveAppFeatureList(List<AppFeatureIndex> appFeatures){
|
||||
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||
SqlSession batchSqlSession = null;
|
||||
try{
|
||||
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
for(int index = 0; index < appFeatures.size();index++){
|
||||
AppFeatureIndex _cfg = appFeatures.get(index);
|
||||
((AppMultiFeatureCfgDao) batchSqlSession.getMapper(AppMultiFeatureCfgDao.class)).insertAppFeatureIndex(_cfg);
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
batchSqlSession.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导入配置时数据批量入库(IP配置)
|
||||
*
|
||||
@@ -2087,7 +2125,12 @@ public abstract class BaseService {
|
||||
BeanUtils.copyProperties(_cfg, dnsIpCfg);
|
||||
//如果insert加入了select last_insert_id,会拖慢6~7倍以上的效率
|
||||
((DnsIpCfgDao) batchSqlSession.getMapper(DnsIpCfgDao.class)).insert(dnsIpCfg);
|
||||
}else {
|
||||
} else if(regionDict.getFunctionId().equals(565) || regionDict.getFunctionId().equals(566) || regionDict.getFunctionId().equals(563)){
|
||||
AppIpCfg app =new AppIpCfg();
|
||||
BeanUtils.copyProperties(_cfg, app);
|
||||
((AppMultiFeatureCfgDao) batchSqlSession.getMapper(AppMultiFeatureCfgDao.class)).insertAppIpRangeCfg(app);
|
||||
}
|
||||
else {
|
||||
batchSqlSession.getMapper(IpCfgDao.class).insertForBatch(_cfg);
|
||||
}
|
||||
|
||||
@@ -2307,7 +2350,12 @@ public abstract class BaseService {
|
||||
AppHttpCfg _cfg=new AppHttpCfg();
|
||||
BeanUtils.copyProperties(cfg, _cfg);
|
||||
((AppCfgDao) batchSqlSession.getMapper(AppCfgDao.class)).insertAppHttpCfgBatch(_cfg);
|
||||
}else {
|
||||
}else if(regionDict.getDictId().intValue()==220 || regionDict.getDictId().intValue()==216 || regionDict.getDictId().intValue()==224){
|
||||
AppComplexFeatureCfg appCfg=new AppComplexFeatureCfg();
|
||||
BeanUtils.copyProperties(cfg, appCfg);
|
||||
((AppMultiFeatureCfgDao) batchSqlSession.getMapper(AppMultiFeatureCfgDao.class)).insertAppComplexFeatureCfg(appCfg);
|
||||
}
|
||||
else {
|
||||
((StringCfgDao) batchSqlSession.getMapper(StringCfgDao.class)).saveComplexkeywordCfgBatch(cfg);
|
||||
}
|
||||
if (send) {
|
||||
|
||||
12
src/main/resources/sql/20181229/update_region_import.sql
Normal file
12
src/main/resources/sql/20181229/update_region_import.sql
Normal file
@@ -0,0 +1,12 @@
|
||||
# App Http<74><70><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD>
|
||||
update function_region_dict set is_import='1' where dict_id='220';
|
||||
update function_region_dict set is_import='1' where dict_id='223';
|
||||
update function_service_dict set is_import='1' where dict_id='134';
|
||||
#dns<6E><73><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD>
|
||||
update function_region_dict set is_import='1' where dict_id='216';
|
||||
update function_service_dict set is_import='1' where dict_id='133';
|
||||
#ssl<73><6C><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD>
|
||||
update function_region_dict set is_import='1' where dict_id='224';
|
||||
update function_region_dict set is_import='1' where dict_id='227';
|
||||
update function_service_dict set is_import='1' where dict_id='135';
|
||||
|
||||
@@ -441,7 +441,8 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<c:set var="importPath" value="/ntc/website/dnsList?functionId=${cfg.functionId}"/>
|
||||
|
||||
<c:set var="importPath" value="/app/feature/multiFeatureCfgList?functionId=${cfg.functionId}"/>
|
||||
<!-- 模板导入,start -->
|
||||
<%@include file="/WEB-INF/include/excel/importModal.jsp" %>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user