Merge branch 'develop_no_common_group' of https://git.mesalab.cn/K18_NTCS_WEB/NTC.git into develop_no_common_group

This commit is contained in:
段冬梅
2019-04-19 18:33:01 +08:00
110 changed files with 3653 additions and 3258 deletions

View File

@@ -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) {

View File

@@ -248,7 +248,10 @@ public class AppCfgService extends BaseService {
public void saveOrUpdateAppPolicyCfg(AppPolicyCfg entity) throws Exception {
// 设置区域运营商信息
setAreaEffectiveIds(entity);
int isValid=0;
if(!StringUtil.isEmpty(entity.getIsValid()) && entity.getIsValid()==1) {
isValid=1;
}
if (entity.getCfgId() == null) {
Integer compileId = 0;
try {
@@ -302,7 +305,20 @@ public class AppCfgService extends BaseService {
areaIpCfgDao.saveAreaIpCfg(cfg);
}
}
if(isValid==1) {
entity.setIsAudit(1);
entity.setIsValid(1);
if(entity.getFunctionId() == 407){
entity.setConfigType(Constants.SPECIFIC_SERVICE_CFG_TYPE_BASIC_PROTOCOL);
}
if(entity.getFunctionId() == 63){
entity.setConfigType(Constants.SPECIFIC_SERVICE_CFG_TYPE_APP);
}
if(entity.getFunctionId() == 408){
entity.setConfigType(Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR);
}
auditAppPolicyCfg(entity, entity.getIsAudit(),Constants.INSERT_ACTION);
}
} else {
entity.setEditorId(entity.getCurrentUser().getId());
entity.setEditTime(new Date());
@@ -356,6 +372,20 @@ public class AppCfgService extends BaseService {
areaIpCfgDao.saveAreaIpCfg(cfg);
}
}
if(isValid==1) {
entity.setIsAudit(1);
entity.setIsValid(1);
if(entity.getFunctionId() == 407){
entity.setConfigType(Constants.SPECIFIC_SERVICE_CFG_TYPE_BASIC_PROTOCOL);
}
if(entity.getFunctionId() == 63){
entity.setConfigType(Constants.SPECIFIC_SERVICE_CFG_TYPE_APP);
}
if(entity.getFunctionId() == 408){
entity.setConfigType(Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR);
}
auditAppPolicyCfg(entity, entity.getIsAudit(),Constants.UPDATE_ACTION);
}
}
}
@@ -363,7 +393,10 @@ public class AppCfgService extends BaseService {
public void saveOrUpdateAppIpCfg(AppIpCfg entity) throws Exception {
// 设置区域运营商信息
setAreaEffectiveIds(entity);
int isValid=0;
if(!StringUtil.isEmpty(entity.getIsValid()) && entity.getIsValid()==1) {
isValid=1;
}
if (entity.getCfgId() == null) {
SpecificServiceCfg specificServiceCfg=specificServiceCfgDao.getBySpecServiceId(entity.getSpecServiceId());
@@ -429,10 +462,17 @@ public class AppCfgService extends BaseService {
BeanUtils.copyProperties(entity, cfg,
new String[] { "cfgRegionCode", "cfgType", "ipType", "isAreaEffective",
"areaEffectiveIds", "protocol", "portPattern", "srcPort", "destPort",
"direction", "destIpAddress", "srcIpAddress", "ipPattern" });
"direction", "destIpAddress", "srcIpAddress", "srcIpPattern", "destIpPattern" });
areaIpCfgDao.saveAreaIpCfg(cfg);
}
}
if(isValid==1) {
List<AppIpCfg> entitys=new ArrayList<AppIpCfg>();
entity.setIsAudit(1);
entity.setIsValid(1);
entitys.add(entity);
auditAppIpCfg(entitys, entity.getIsAudit());
}
} else {
entity.setEditorId(entity.getCurrentUser().getId());
entity.setEditTime(new Date());
@@ -453,10 +493,20 @@ public class AppCfgService extends BaseService {
BeanUtils.copyProperties(entity, cfg,
new String[] { "cfgRegionCode", "cfgType", "ipType", "isAreaEffective", "areaEffectiveIds",
"protocol", "portPattern", "srcPort", "destPort", "direction", "destIpAddress",
"srcIpAddress", "ipPattern" });
"srcIpAddress", "srcIpPattern", "destIpPattern" });
areaIpCfgDao.saveAreaIpCfg(cfg);
}
}
if(isValid==1) {
List<AppIpCfg> entitys=new ArrayList<AppIpCfg>();
entity.setIsAudit(1);
entity.setIsValid(1);
AppIpCfg entity2 = appCfgDao.getAppIpCfg(entity.getCfgId());
entity2.setIsAudit(1);
entity2.setIsValid(1);
entitys.add(entity2);
auditAppIpCfg(entitys, entity.getIsAudit());
}
}
}
public void saveAppHttpCfg(List<ComplexkeywordCfg> cfgs) {
@@ -538,7 +588,10 @@ public class AppCfgService extends BaseService {
public void saveOrUpdateAppDomainCfg(AppDomainCfg entity) throws Exception {
// 设置区域运营商信息
setAreaEffectiveIds(entity);
int isValid=0;
if(!StringUtil.isEmpty(entity.getIsValid()) && entity.getIsValid()==1) {
isValid=1;
}
if (entity.getCfgId() == null) {
Integer compileId = 0;
try {
@@ -565,6 +618,11 @@ public class AppCfgService extends BaseService {
logger.info("获取编译ID出错");
throw new MaatConvertException(e.getMessage());
}
if(isValid==1) {
entity.setIsAudit(1);
entity.setIsValid(1);
auditAppDomainCfg(entity, entity.getIsAudit(),Constants.INSERT_ACTION);
}
} else {
entity.setEditorId(entity.getCurrentUser().getId());
entity.setEditTime(new Date());
@@ -586,6 +644,11 @@ public class AppCfgService extends BaseService {
areaIpCfgDao.saveAreaIpCfg(cfg);
}
}
if(isValid==1) {
entity.setIsAudit(1);
entity.setIsValid(1);
auditAppDomainCfg(entity, entity.getIsAudit(),Constants.UPDATE_ACTION);
}
}
}
@@ -593,7 +656,10 @@ public class AppCfgService extends BaseService {
public void saveOrUpdateAppTopicDomainCfg(AppTopicDomainCfg entity) throws Exception {
// 设置区域运营商信息
setAreaEffectiveIds(entity);
int isValid=0;
if(!StringUtil.isEmpty(entity.getIsValid()) && entity.getIsValid()==1) {
isValid=1;
}
if (entity.getCfgId() == null) {
Integer compileId = 0;
try {
@@ -620,6 +686,11 @@ public class AppCfgService extends BaseService {
logger.info("获取编译ID出错");
throw new MaatConvertException(e.getMessage());
}
if(isValid==1) {
entity.setIsAudit(1);
entity.setIsValid(1);
auditAppTopicDomainCfg(entity, entity.getIsAudit(),Constants.INSERT_ACTION);
}
} else {
entity.setEditorId(entity.getCurrentUser().getId());
entity.setEditTime(new Date());
@@ -641,6 +712,11 @@ public class AppCfgService extends BaseService {
areaIpCfgDao.saveAreaIpCfg(cfg);
}
}
if(isValid==1) {
entity.setIsAudit(1);
entity.setIsValid(1);
auditAppTopicDomainCfg(entity, entity.getIsAudit(),Constants.UPDATE_ACTION);
}
}
}
@@ -890,7 +966,10 @@ public class AppCfgService extends BaseService {
}
}
public void auditAppPolicyCfg(AppPolicyCfg entity, Integer isAudit) {
public void auditAppPolicyCfg(AppPolicyCfg entity, Integer isAudit,Integer opAction) {
entity.setIsAudit(isAudit);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
String configType = entity.getConfigType();
ToMaatBean maatBean = new ToMaatBean();
MaatCfg maatCfg = new MaatCfg();
@@ -1036,7 +1115,7 @@ public class AppCfgService extends BaseService {
maatBean.setAuditTime(entity.getAuditTime());
maatBean.setCreatorName(entity.getCurrentUser().getName());
maatBean.setVersion(Constants.MAAT_VERSION);
maatBean.setOpAction(Constants.INSERT_ACTION);
maatBean.setOpAction(opAction);
// 调用服务接口下发配置数据
String json = gsonToJson(maatBean);
logger.info("app策略配置下发配置参数" + json);
@@ -1164,6 +1243,12 @@ public class AppCfgService extends BaseService {
}
}
public void auditAppIpCfg(List<AppIpCfg> entitys, Integer isAudit) {
for (AppIpCfg entity : entitys) {
entity.setTableName(AppIpCfg.getTablename());
entity.setIsAudit(isAudit);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
}
MaatCfg maatCfg = new MaatCfg();
List<MaatCfg> configCompileList = new ArrayList();
List<GroupCfg> groupRelationList = new ArrayList();
@@ -1380,7 +1465,10 @@ public class AppCfgService extends BaseService {
}
}
public void auditAppDomainCfg(AppDomainCfg entity, Integer isAudit) {
public void auditAppDomainCfg(AppDomainCfg entity, Integer isAudit,Integer opAction) {
entity.setIsAudit(isAudit);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
ToMaatBean maatBean = new ToMaatBean();
MaatCfg maatCfg = new MaatCfg();
List<MaatCfg> configCompileList = new ArrayList();
@@ -1441,7 +1529,7 @@ public class AppCfgService extends BaseService {
maatBean.setAuditTime(entity.getAuditTime());
maatBean.setCreatorName(entity.getCurrentUser().getName());
maatBean.setVersion(Constants.MAAT_VERSION);
maatBean.setOpAction(Constants.INSERT_ACTION);
maatBean.setOpAction(opAction);
// 调用服务接口下发配置数据
String json = gsonToJson(maatBean);
logger.info("app域名配置下发配置参数" + json);
@@ -1469,7 +1557,10 @@ public class AppCfgService extends BaseService {
}
// app主题网站配置审核
public void auditAppTopicDomainCfg(AppTopicDomainCfg entity, Integer isAudit) {
public void auditAppTopicDomainCfg(AppTopicDomainCfg entity, Integer isAudit,Integer opAction) {
entity.setIsAudit(isAudit);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
ToMaatBean maatBean = new ToMaatBean();
MaatCfg maatCfg = new MaatCfg();
List<MaatCfg> configCompileList = new ArrayList();
@@ -1536,7 +1627,7 @@ public class AppCfgService extends BaseService {
maatBean.setAuditTime(entity.getAuditTime());
maatBean.setCreatorName(entity.getCurrentUser().getName());
maatBean.setVersion(Constants.MAAT_VERSION);
maatBean.setOpAction(Constants.INSERT_ACTION);
maatBean.setOpAction(opAction);
// 调用服务接口下发配置数据
String json = gsonToJson(maatBean);
logger.info("app主题网站配置下发配置参数" + json);

View File

@@ -78,6 +78,10 @@ public class AppMultiFeatureCfgService extends BaseService {
//新增或保存复杂特征配置
@Transactional(readOnly = false, rollbackFor = RuntimeException.class)
public void saveOrUpdateAppFeatureCfg(AppFeatureIndex entity) throws Exception {
int isValid=0;
if(!StringUtil.isEmpty(entity.getIsValid()) && entity.getIsValid()==1) {
isValid=1;
}
if (entity.getCfgId() == null) {
Integer compileId = 0;
try {
@@ -166,6 +170,11 @@ public class AppMultiFeatureCfgService extends BaseService {
logger.info("获取编译ID出错");
throw new MaatConvertException(e.getMessage());
}
if(isValid==1) {
entity.setIsAudit(1);
entity.setIsValid(1);
auditAppFeatureCfg(entity, entity.getIsAudit(),Constants.INSERT_ACTION);
}
} else {
entity.setEditorId(entity.getCurrentUser().getId());
entity.setEditTime(new Date());
@@ -243,6 +252,11 @@ public class AppMultiFeatureCfgService extends BaseService {
}
}
}
if(isValid==1) {
entity.setIsAudit(1);
entity.setIsValid(1);
auditAppFeatureCfg(entity, entity.getIsAudit(),Constants.UPDATE_ACTION);
}
}
}
@@ -286,7 +300,11 @@ public class AppMultiFeatureCfgService extends BaseService {
cfg.setCfgKeywords(keyword);
}
public void auditAppFeatureCfg(AppFeatureIndex entity, Integer isAudit) {
public void auditAppFeatureCfg(AppFeatureIndex entity, Integer isAudit,Integer opAction) {
entity.setIsAudit(isAudit);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
ToMaatBean maatBean = new ToMaatBean();
MaatCfg maatCfg = new MaatCfg();
List<MaatCfg> configCompileList = new ArrayList();
@@ -421,7 +439,7 @@ public class AppMultiFeatureCfgService extends BaseService {
maatBean.setAuditTime(entity.getAuditTime());
maatBean.setCreatorName(entity.getCurrentUser().getName());
maatBean.setVersion(Constants.MAAT_VERSION);
maatBean.setOpAction(Constants.INSERT_ACTION);
maatBean.setOpAction(opAction);
// 调用服务接口下发配置数据
String json = gsonToJson(maatBean);
logger.info("app 特征配置下发配置参数:" + json);

View File

@@ -255,7 +255,6 @@ public class AvContentCfgService extends BaseService{
auditAvVoip(entity,entity.getIsAudit(), Constants.INSERT_ACTION);
}
}else{
entity.setEditTime(new Date());
entity.setEditorId(entity.getCurrentUser().getId());
@@ -534,7 +533,6 @@ public class AvContentCfgService extends BaseService{
}
}
//构造提交综合服务参数格式,一条配置提交一次综合服务
if(isAudit==1){
maatCfg.initDefaultValue();
@@ -772,9 +770,11 @@ public class AvContentCfgService extends BaseService{
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode"
,"cfgType"
,"ipType"
,"ipPattern"
,"srcIpPattern"
,"destIpPattern"
,"srcIpAddress"
,"portPattern"
,"srcPortPattern"
,"destPortPattern"
,"srcPort"
,"destPort"
,"protocol"
@@ -812,9 +812,11 @@ public class AvContentCfgService extends BaseService{
,"cfgType"
,"cfgId"
,"ipType"
,"ipPattern"
,"srcIpPattern"
,"destIpPattern"
,"srcIpAddress"
,"portPattern"
,"srcPortPattern"
,"destPortPattern"
,"srcPort"
,"destPort"
,"protocol"
@@ -829,9 +831,11 @@ public class AvContentCfgService extends BaseService{
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode"
,"cfgType"
,"ipType"
,"ipPattern"
,"srcIpPattern"
,"destIpPattern"
,"srcIpAddress"
,"portPattern"
,"srcPortPattern"
,"destPortPattern"
,"srcPort"
,"destPort"
,"protocol"
@@ -936,9 +940,11 @@ public class AvContentCfgService extends BaseService{
,"cfgType"
,"cfgId"
,"ipType"
,"ipPattern"
,"srcIpPattern"
,"destIpPattern"
,"srcIpAddress"
,"portPattern"
,"srcPortPattern"
,"destPortPattern"
,"srcPort"
,"destPort"
,"protocol"
@@ -1111,9 +1117,11 @@ public class AvContentCfgService extends BaseService{
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode"
,"cfgType"
,"ipType"
,"ipPattern"
,"srcIpPattern"
,"destIpPattern"
,"srcIpAddress"
,"portPattern"
,"srcPortPattern"
,"destPortPattern"
,"srcPort"
,"destPort"
,"protocol"
@@ -1151,9 +1159,11 @@ public class AvContentCfgService extends BaseService{
,"cfgType"
,"cfgId"
,"ipType"
,"ipPattern"
,"srcIpPattern"
,"destIpPattern"
,"srcIpAddress"
,"portPattern"
,"srcPortPattern"
,"destPortPattern"
,"srcPort"
,"destPort"
,"protocol"
@@ -1168,9 +1178,11 @@ public class AvContentCfgService extends BaseService{
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode"
,"cfgType"
,"ipType"
,"ipPattern"
,"srcIpPattern"
,"destIpPattern"
,"srcIpAddress"
,"portPattern"
,"srcPortPattern"
,"destPortPattern"
,"srcPort"
,"destPort"
,"protocol"
@@ -1275,9 +1287,11 @@ public class AvContentCfgService extends BaseService{
,"cfgType"
,"cfgId"
,"ipType"
,"ipPattern"
,"srcIpPattern"
,"destIpPattern"
,"srcIpAddress"
,"portPattern"
,"srcPortPattern"
,"destPortPattern"
,"srcPort"
,"destPort"
,"protocol"

View File

@@ -71,10 +71,14 @@ public class DdosCfgService extends BaseService{
return ddosCfgDao.getDdosIpCfg(cfgId,compileId);
}
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void saveOrUpdate(DdosIpCfg entity){
public void saveOrUpdate(DdosIpCfg entity) throws Exception{
Date createTime=new Date();
//设置区域运营商信息
setAreaEffectiveIds(entity);
int isValid=0;
if(!StringUtil.isEmpty(entity.getIsValid()) && entity.getIsValid()==1) {
isValid=1;
}
String antiddosProtocol = entity.getAntiddosProtocol();
Long bpsThreadshold = entity.getBpsThreadshold();
Long ppsThreadshold = entity.getPpsThreadshold();
@@ -116,7 +120,11 @@ public class DdosCfgService extends BaseService{
}else {
throw new RuntimeException("Could not get compileId!");
}
if(isValid==1) {
entity.setIsAudit(1);
entity.setIsValid(1);
audit(entity.getIsAudit(), isValid, entity.getFunctionId(),String.valueOf(entity.getCfgId()), new Date(),Constants.INSERT_ACTION);
}
//修改
}else{
Date editTime=new Date();
@@ -126,6 +134,11 @@ public class DdosCfgService extends BaseService{
entity.setEditTime(editTime);
ddosCfgDao.update(entity);
if(isValid==1) {
entity.setIsAudit(1);
entity.setIsValid(1);
audit(entity.getIsAudit(), isValid, entity.getFunctionId(),String.valueOf(entity.getCfgId()), new Date(),Constants.UPDATE_ACTION);
}
}
}
@@ -228,7 +241,7 @@ public class DdosCfgService extends BaseService{
}*/
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void audit(Integer isAudit,Integer isValid,Integer functionId,String id,Date auditTime) throws Exception{
public void audit(Integer isAudit,Integer isValid,Integer functionId,String id,Date auditTime,Integer opAction) throws Exception{
DdosIpCfg entity = new DdosIpCfg();
entity=ddosCfgDao.getDdosIpCfg(Long.valueOf(id),entity.getCompileId());
@@ -308,7 +321,7 @@ public class DdosCfgService extends BaseService{
maatBean.setAuditTime(auditTime);
maatBean.setCreatorName(entity.getCurrentUser().getName());
maatBean.setVersion(Constants.MAAT_VERSION);
maatBean.setOpAction(Constants.INSERT_ACTION);
maatBean.setOpAction(opAction);
//调用服务接口下发配置数据
String json=gsonToJson(maatBean);
logger.info("ddos 配置下发配置参数:"+json);

View File

@@ -22,6 +22,7 @@ import com.nis.domain.maat.ToMaatResult;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.StringUtil;
import com.nis.web.dao.configuration.DnsIpCfgDao;
import com.nis.web.security.UserUtils;
import com.nis.web.service.BaseService;
@@ -64,6 +65,10 @@ public class DnsIpCfgService extends BaseService{
Date createTime=new Date();
//设置区域运营商信息
setAreaEffectiveIds(entity);
int isValid=0;
if(!StringUtil.isEmpty(entity.getIsValid()) && entity.getIsValid()==1) {
isValid=1;
}
//新增
if(entity.getCfgId()==null){
entity.setCreatorId(UserUtils.getUser().getId());
@@ -102,6 +107,11 @@ public class DnsIpCfgService extends BaseService{
entity.setEditTime(editTime);
dnsIpCfgDao.update(entity);
}
if(isValid==1) {
entity.setIsAudit(1);
entity.setIsValid(1);
audit( entity.getIsAudit(), isValid, entity.getFunctionId(), String.valueOf(entity.getCfgId()), new Date());
}
}
/**
@@ -140,11 +150,13 @@ public class DnsIpCfgService extends BaseService{
dnsIp.setFunctionId(401);
dnsIp.setCfgRegionCode(1);
dnsIp.setCfgType("dns_fake_ip");
dnsIp.setIpPattern(3);
dnsIp.setSrcIpPattern(3);
dnsIp.setDestIpPattern(3);
dnsIp.setSrcIpAddress("0.0.0.0");
dnsIp.setDestPort("0");
dnsIp.setSrcPort("0");
dnsIp.setPortPattern(1);
dnsIp.setSrcPortPattern(1);
dnsIp.setDestPortPattern(1);
dnsIp.setDnsStrategyId(0);
dnsIp.setAction(16);
dnsIp.setServiceId(64);

View File

@@ -19,6 +19,7 @@ import com.nis.domain.configuration.DnsResStrategy;
import com.nis.domain.maat.ToMaatResult;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.StringUtil;
import com.nis.web.dao.configuration.DnsResStrategyDao;
import com.nis.web.dao.configuration.StringCfgDao;
@@ -86,6 +87,10 @@ public class DnsResStrategyService extends BaseService{
public void saveOrUpdate(DnsResStrategy entity){
Date createTime=new Date();
setAreaEffectiveIds(entity);
int isValid=0;
if(!StringUtil.isEmpty(entity.getIsValid()) && entity.getIsValid()==1) {
isValid=1;
}
List<DnsResStrategy> list = new ArrayList<DnsResStrategy>();
if( entity.getCfgId()!=null && !"".equals(entity.getCfgId())){
list=dnsResStrategyDao.findList(entity.getCfgId(),null,null);
@@ -112,6 +117,11 @@ public class DnsResStrategyService extends BaseService{
}
}
dnsResStrategyDao.insert(entity);
if(isValid==1) {
entity.setIsAudit(1);
entity.setIsValid(1);
audit( entity.getIsAudit(), isValid, entity.getFunctionId(), String.valueOf(entity.getCfgId()), new Date());
}
//修改
}else{
Date editTime=new Date();
@@ -121,6 +131,11 @@ public class DnsResStrategyService extends BaseService{
entity.setEditTime(editTime);
dnsResStrategyDao.update(entity);
if(isValid==1) {
entity.setIsAudit(1);
entity.setIsValid(1);
audit( entity.getIsAudit(), isValid, entity.getFunctionId(), String.valueOf(entity.getCfgId()), new Date());
}
}
}
@@ -157,8 +172,8 @@ public class DnsResStrategyService extends BaseService{
cfg.setCfgId(Long.valueOf(id));
cfg.setIsValid(isValid);
cfg.setIsAudit(isAudit);
cfg.setEditTime(auditTime);
cfg.setEditorId(UserUtils.getUser().getId());
// cfg.setEditTime(auditTime);
// cfg.setEditorId(UserUtils.getUser().getId());
cfg.setAuditorId(UserUtils.getUser().getId());
cfg.setAuditTime(auditTime);
dnsResStrategyDao.update(cfg);

View File

@@ -76,7 +76,7 @@ public class DomainService extends CrudService<DomainDao,HttpUrlCfg> {
c.initDefaultValue();
BeanUtils.copyProperties(cfg, c,new String[]{"cfgId","ipType","direction",
"protocol","protocolId","areaEffectiveIds","cfgRegionCode",
"cfgType","ipPattern","srcIpAddress","portPattern","srcPort","destIpAddress","destPort"});
"cfgType","srcIpPattern","destIpPattern","srcIpAddress","srcPortPattern","destPortPattern","srcPort","destIpAddress","destPort"});
c.setTableName(AreaIpCfg.getTablename());
}
this.saveIpBatch(cfg.getAreaCfg());
@@ -106,7 +106,7 @@ public class DomainService extends CrudService<DomainDao,HttpUrlCfg> {
c.initDefaultValue();
BeanUtils.copyProperties(cfg, c,new String[]{"cfgId","ipType","direction",
"protocol","protocolId","areaEffectiveIds","cfgRegionCode",
"cfgType","ipPattern","srcIpAddress","portPattern","srcPort","destIpAddress","destPort"});
"cfgType","srcIpPattern","destIpPattern","srcIpAddress","srcPortPattern","destPortPattern","srcPort","destIpAddress","destPort"});
c.setTableName(AreaIpCfg.getTablename());
c.setCreatorId(cfg.getCurrentUser().getId());
c.setCreateTime(date);
@@ -202,9 +202,11 @@ public class DomainService extends CrudService<DomainDao,HttpUrlCfg> {
,"cfgType"
,"cfgId"
,"ipType"
,"ipPattern"
,"srcIpPattern"
,"destIpPattern"
,"srcIpAddress"
,"portPattern"
,"srcPortPattern"
,"destPortPattern"
,"srcPort"
,"destPort"
,"protocol"

View File

@@ -1,14 +1,11 @@
package com.nis.web.service.configuration;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -16,14 +13,12 @@ import org.springframework.transaction.annotation.Transactional;
import com.beust.jcommander.internal.Lists;
import com.nis.domain.Page;
import com.nis.domain.configuration.BaseIpCfg;
import com.nis.domain.configuration.DdosIpCfg;
import com.nis.domain.configuration.IpReuseDnatPolicyCfg;
import com.nis.domain.configuration.IpReusePolicyCfg;
import com.nis.domain.maat.ToMaatResult;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.StringUtils;
import com.nis.web.dao.configuration.IpMultiplexDao;
import com.nis.web.security.UserUtils;
import com.nis.web.service.BaseService;

View File

@@ -20,6 +20,7 @@ import com.nis.domain.configuration.PxyObjTrustedCaCrl;
import com.nis.domain.maat.ToMaatResult;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.StringUtil;
import com.nis.web.dao.basics.ServiceDictInfoDao;
import com.nis.web.dao.configuration.PxyObjKeyringDao;
@@ -100,6 +101,10 @@ public class PxyObjKeyringService extends BaseService{
public void saveOrUpdate(PxyObjKeyring entity){
Date createTime=new Date();
setAreaEffectiveIds(entity);
int isValid=0;
if(!StringUtil.isEmpty(entity.getIsValid()) && entity.getIsValid()==1) {
isValid=1;
}
entity.setIsValid(0);
entity.setIsAudit(0);
//新增
@@ -128,11 +133,21 @@ public class PxyObjKeyringService extends BaseService{
pxyObjKeyringDao.update(entity);
}
if(isValid==1) {
entity.setIsAudit(1);
entity.setIsValid(1);
audit( entity.getIsAudit(), isValid, entity.getFunctionId(), String.valueOf(entity.getCfgId()), new Date());
}
}
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void trustedCertsaveOrUpdate(PxyObjTrustedCaCert entity){
public void trustedCertsaveOrUpdate(PxyObjTrustedCaCert entity) throws InterruptedException{
Date createTime=new Date();
setAreaEffectiveIds(entity);
int isValid=0;
if(!StringUtil.isEmpty(entity.getIsValid()) && entity.getIsValid()==1) {
isValid=1;
}
entity.setIsValid(0);
entity.setIsAudit(0);
//新增
@@ -162,11 +177,16 @@ public class PxyObjKeyringService extends BaseService{
//修改主表cert配置时需要修改子表crl配置信息
PxyObjTrustedCaCrl crlCfg =new PxyObjTrustedCaCrl();
BeanUtils.copyProperties(entity, crlCfg, new String[]{"cfgId","serviceId","compileId","cfgType"});
entity=pxyObjKeyringDao.getPxyObjTrustedCaCert(entity.getCfgId());
crlCfg.setCertId(entity.getCompileId());
PxyObjTrustedCaCert cert=pxyObjKeyringDao.getPxyObjTrustedCaCert(entity.getCfgId());
crlCfg.setCertId(cert.getCompileId());
pxyObjKeyringDao.updatePxyObjTrustedCaCrl(crlCfg);
}
if(isValid==1) {
entity.setIsAudit(1);
entity.setIsValid(1);
trustedCertAudit(entity.getIsAudit(), isValid, entity.getFunctionId(), String.valueOf(entity.getCfgId()), new Date());
}
}
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void trustedCrlsaveOrUpdate(PxyObjTrustedCaCrl entity){
@@ -320,8 +340,8 @@ public class PxyObjKeyringService extends BaseService{
cfg.setCfgId(Long.valueOf(id));
cfg.setIsValid(isValid);
cfg.setIsAudit(isAudit);
cfg.setEditTime(auditTime);
cfg.setEditorId(UserUtils.getUser().getId());
// cfg.setEditTime(auditTime);
// cfg.setEditorId(UserUtils.getUser().getId());
cfg.setAuditorId(UserUtils.getUser().getId());
cfg.setAuditTime(auditTime);
pxyObjKeyringDao.update(cfg);
@@ -402,8 +422,8 @@ public class PxyObjKeyringService extends BaseService{
cfg.setCfgId(Long.valueOf(id));
cfg.setIsValid(isValid);
cfg.setIsAudit(isAudit);
cfg.setEditTime(auditTime);
cfg.setEditorId(UserUtils.getUser().getId());
// cfg.setEditTime(auditTime);
// cfg.setEditorId(UserUtils.getUser().getId());
cfg.setAuditorId(UserUtils.getUser().getId());
cfg.setAuditTime(auditTime);
//修改主表cert 配置状态

View File

@@ -17,7 +17,6 @@ import com.nis.domain.Page;
import com.nis.domain.SysUser;
import com.nis.domain.specific.SpecificServiceCfg;
import com.nis.domain.specific.SpecificServiceHostCfg;
import com.nis.util.BasicProvingUtil;
import com.nis.util.StringUtil;
import com.nis.web.dao.specific.SpecificServiceHostCfgDao;
import com.nis.web.security.UserUtils;
@@ -58,45 +57,66 @@ public class SpecificServiceHostCfgService extends BaseService{
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void saveOrUpdate(SpecificServiceHostCfg specificServiceHostCfg) {
SysUser user = UserUtils.getUser();
String defaultIp = "0.0.0.0"; //缺省0.0.0.0值表示任意
String defaultSrcIp = "0.0.0.0"; //缺省0.0.0.0值表示任意
String defaultDestIp = "0.0.0.0"; //缺省0.0.0.0值表示任意
if(specificServiceHostCfg.getIpType().equals(4)){
if(specificServiceHostCfg.getIpPattern()==1){
defaultIp = "0.0.0.0/32"; //0.0.0.0表示任意
}else if(specificServiceHostCfg.getIpPattern()==2){
defaultIp = "0.0.0.0-0.0.0.0";
if(specificServiceHostCfg.getSrcIpPattern()==1){
defaultSrcIp = "0.0.0.0/32"; //0.0.0.0表示任意
}else if(specificServiceHostCfg.getSrcIpPattern()==2){
defaultSrcIp = "0.0.0.0-0.0.0.0";
}else{
defaultIp = "0.0.0.0";
defaultSrcIp = "0.0.0.0";
}
if(specificServiceHostCfg.getDestIpPattern()==1){
defaultDestIp = "0.0.0.0/32"; //0.0.0.0表示任意
}else if(specificServiceHostCfg.getDestIpPattern()==2){
defaultDestIp = "0.0.0.0-0.0.0.0";
}else{
defaultDestIp = "0.0.0.0";
}
}
if(specificServiceHostCfg.getIpType().equals(6)){
if(specificServiceHostCfg.getIpPattern()==1){
defaultIp = "::/64";
}else if(specificServiceHostCfg.getIpPattern()==2){
defaultIp = "::-::";
if(specificServiceHostCfg.getSrcIpPattern()==1){
defaultSrcIp = "::/64";
}else if(specificServiceHostCfg.getSrcIpPattern()==2){
defaultSrcIp = "::-::";
}else{
defaultIp = "::";
defaultSrcIp = "::";
}
if(specificServiceHostCfg.getDestIpPattern()==1){
defaultDestIp = "::/64";
}else if(specificServiceHostCfg.getDestIpPattern()==2){
defaultDestIp = "::-::";
}else{
defaultDestIp = "::";
}
}
String defaultPort = "0"; //0表示任意
if(specificServiceHostCfg.getPortPattern().equals(1)){
defaultPort = "0";
String defaultSrcPort = "0"; //0表示任意
String defaultDestPort = "0"; //0表示任意
if(specificServiceHostCfg.getSrcPortPattern().equals(1)){
defaultSrcPort = "0";
}else{
defaultPort = "0/0";
defaultSrcPort = "0/0";
}
if(specificServiceHostCfg.getDestPortPattern().equals(1)){
defaultDestPort = "0";
}else{
defaultDestPort = "0/0";
}
//ip地址默认 缺省0.0.0.0值表示任意
if(StringUtil.isBlank(specificServiceHostCfg.getSrcIpAddress())){
specificServiceHostCfg.setSrcIpAddress(defaultIp);
specificServiceHostCfg.setSrcIpAddress(defaultSrcIp);
}
if(StringUtil.isBlank(specificServiceHostCfg.getDestIpAddress())){
specificServiceHostCfg.setDestIpAddress(defaultIp);
specificServiceHostCfg.setDestIpAddress(defaultDestIp);
}
//端口掩码默认
if(StringUtil.isBlank(specificServiceHostCfg.getSrcPort())){
specificServiceHostCfg.setSrcPort(defaultPort);
specificServiceHostCfg.setSrcPort(defaultSrcPort);
}
if(StringUtil.isBlank(specificServiceHostCfg.getDestPort())){
specificServiceHostCfg.setDestPort(defaultPort);
specificServiceHostCfg.setDestPort(defaultDestPort);
}
//方向缺省
if(specificServiceHostCfg.getDirection()==null){