stream、DDOS和高级功能模块对某些用户的配置不经过审核直接生效及生效中的配置进行修改的功能

This commit is contained in:
shangguanyanfei
2019-04-19 17:20:32 +08:00
parent 5a5bdddba4
commit 865811b9b2
34 changed files with 729 additions and 189 deletions

View File

@@ -219,15 +219,19 @@ public class AppCfgController extends BaseController {
entity.setAppCode(specificService.getSpecServiceCode());
}
appCfgService.saveOrUpdateAppPolicyCfg(entity);
addMessage(redirectAttributes, "success", "save_success");
} catch (Exception e) {
logger.error("saveAppPolicyCfg failed", e);
e.printStackTrace();
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
} else {
addMessage(redirectAttributes, "error", "save_failed");
//配置仅保存
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (MaatConvertException e) {
logger.error("app 协议配置下发失败:",e);
addMessage(redirectAttributes, "error", "request_service_failed");
} catch (Exception e) {
logger.error("app 协议配置保存失败:",e);
addMessage(redirectAttributes, "error", "save_failed");
}
return "redirect:" + adminPath + "/app/policyCfgList?functionId=" + entity.getFunctionId();
@@ -255,12 +259,10 @@ public class AppCfgController extends BaseController {
entity = appCfgService.getAppPolicyCfg(Long.parseLong(id), null);
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
entity.setFunctionId(functionId);
entity.setConfigType(Constants.SPECIFIC_SERVICE_CFG_TYPE_APP);
try {
appCfgService.auditAppPolicyCfg(entity, isAudit);
appCfgService.auditAppPolicyCfg(entity, isAudit,Constants.INSERT_ACTION);
addMessage(redirectAttributes, "success", "audit_success");
} catch (Exception e) {
e.printStackTrace();
@@ -394,15 +396,19 @@ public class AppCfgController extends BaseController {
entity.setAppCode(specificService.getSpecServiceCode());
}
appCfgService.saveOrUpdateAppIpCfg(entity);
addMessage(redirectAttributes, "success", "save_success");
} catch (Exception e) {
e.printStackTrace();
logger.error("saveAppIpCfg failed", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
} else {
addMessage(redirectAttributes, "error", "save_failed");
//配置仅保存
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
}catch (MaatConvertException e) {
logger.error("APP IP配置下发失败",e);
addMessage(redirectAttributes, "error", "request_service_failed");
} catch (Exception e) {
logger.error("APP IP配置保存失败",e);
addMessage(redirectAttributes, "error", "save_failed");
}
return "redirect:" + adminPath + "/app/ipCfgList?functionId=" + entity.getFunctionId();
@@ -432,10 +438,7 @@ public class AppCfgController extends BaseController {
entity = appCfgService.getAppIpCfg(Long.parseLong(id));
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
entity.setFunctionId(functionId);
entity.setTableName(AppIpCfg.getTablename());
if (dataMap.containsKey(entity.getCompileId())) {
dataMap.get(entity.getCompileId()).add(entity);
} else {
@@ -737,14 +740,19 @@ public class AppCfgController extends BaseController {
entity.setAppCode(specificService.getSpecServiceCode());
}
appCfgService.saveOrUpdateAppDomainCfg(entity);
addMessage(redirectAttributes, "success", "save_success");
} catch (Exception e) {
e.printStackTrace();
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
} else {
addMessage(redirectAttributes, "error", "save_failed");
//配置仅保存
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (MaatConvertException e) {
logger.error("APP域名配置下发失败",e);
addMessage(redirectAttributes, "error", "request_service_failed");
} catch (Exception e) {
logger.error("APP域名配置保存失败",e);
addMessage(redirectAttributes, "error", "save_failed");
}
return "redirect:" + adminPath + "/app/domainCfgList?functionId=" + entity.getFunctionId();
@@ -772,11 +780,9 @@ public class AppCfgController extends BaseController {
entity = appCfgService.getAppDomainCfg(Long.parseLong(id));
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
entity.setFunctionId(functionId);
try {
appCfgService.auditAppDomainCfg(entity, isAudit);
appCfgService.auditAppDomainCfg(entity, isAudit,Constants.INSERT_ACTION);
addMessage(redirectAttributes, "success", "audit_success");
} catch (Exception e) {
e.printStackTrace();
@@ -1507,18 +1513,19 @@ public class AppCfgController extends BaseController {
entity.setCfgKeywords(entity.getCfgKeywords());
}
appCfgService.saveOrUpdateAppTopicDomainCfg(entity);
addMessage(redirectAttributes, "success", "save_success");
} catch (Exception e) {
if (e instanceof MaatConvertException) {
e.printStackTrace();
logger.info("app主题网站配置下发失败" + e.getMessage());
;
addMessage(redirectAttributes, "error", "request_service_failed");
} else {
e.printStackTrace();
logger.error("app主题网站配置下发失败", e);
addMessage(redirectAttributes, "error", "save_failed");
//配置仅保存
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (MaatConvertException e) {
logger.error("APP主题网站配置下发失败",e);
addMessage(redirectAttributes, "error", "request_service_failed");
} catch (Exception e) {
logger.error("APP主题网站配置保存失败",e);
addMessage(redirectAttributes, "error", "save_failed");
}
return "redirect:" + adminPath + "/app/topicDomainCfgList?functionId=" + entity.getFunctionId();
@@ -1546,11 +1553,9 @@ public class AppCfgController extends BaseController {
entity = appCfgService.getAppTopicDomainCfg(Long.parseLong(id));
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
entity.setFunctionId(functionId);
try {
appCfgService.auditAppTopicDomainCfg(entity, isAudit);
appCfgService.auditAppTopicDomainCfg(entity, isAudit,Constants.INSERT_ACTION);
addMessage(redirectAttributes, "success", "audit_success");
} catch (Exception e) {
logger.error("app主题网站配置下发失败", e);

View File

@@ -142,14 +142,19 @@ public class AppFeatureCfgController extends BaseController {
entity.setAppCode(specificService.getSpecServiceCode());
}
appMultiFeatureCfgService.saveOrUpdateAppFeatureCfg(entity);
addMessage(redirectAttributes, "success", "save_success");
} catch (Exception e) {
e.printStackTrace();
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
} else {
addMessage(redirectAttributes, "error", "save_failed");
//配置仅保存
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (MaatConvertException e) {
logger.error("APP 特征配置下发失败:",e);
addMessage(redirectAttributes, "error", "request_service_failed");
} catch (Exception e) {
logger.error("APP 特征配置保存失败:",e);
addMessage(redirectAttributes, "error", "save_failed");
}
return "redirect:" + adminPath + "/app/feature/multiFeatureCfgList?functionId=" + entity.getFunctionId();
@@ -176,11 +181,9 @@ public class AppFeatureCfgController extends BaseController {
entity = appMultiFeatureCfgService.getAppFeatureIndex(Long.parseLong(id));
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
entity.setFunctionId(functionId);
try {
appMultiFeatureCfgService.auditAppFeatureCfg(entity, isAudit);
appMultiFeatureCfgService.auditAppFeatureCfg(entity, isAudit,Constants.INSERT_ACTION);
addMessage(redirectAttributes, "success", "audit_success");
} catch (MaatConvertException e) {
e.printStackTrace();

View File

@@ -158,18 +158,22 @@ public class BasicProtocolController extends BaseController {
entity.setAppCode(specificService.getSpecServiceCode());
}
appCfgService.saveOrUpdateAppPolicyCfg(entity);
addMessage(redirectAttributes, "success", "save_success");
} catch (Exception e) {
e.printStackTrace();
logger.error("基础协议信息保存失败", e);
if (e instanceof MaatConvertException) {
// addMessage(redirectAttributes,e.getMessage());
addMessage(redirectAttributes, "error", "request_service_failed");
} else if (e instanceof CallExternalProceduresException) {
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
} else {
addMessage(redirectAttributes, "error", "save_failed");
//配置仅保存
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (MaatConvertException e) {
logger.error("基础协议配置下发失败:",e);
addMessage(redirectAttributes, "error", "request_service_failed");
} catch (CallExternalProceduresException e) {
logger.error("调用外部程序出错:",e);
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
} catch (Exception e) {
logger.error("基础协议配置保存失败:",e);
addMessage(redirectAttributes, "error", "save_failed");
}
return "redirect:" + adminPath + "/basicprotocol/list?functionId=" + entity.getFunctionId();
@@ -197,12 +201,10 @@ public class BasicProtocolController extends BaseController {
entity = appCfgService.getAppPolicyCfg(Long.parseLong(id), null);
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
entity.setFunctionId(functionId);
entity.setConfigType(Constants.SPECIFIC_SERVICE_CFG_TYPE_BASIC_PROTOCOL);
try {
appCfgService.auditAppPolicyCfg(entity, isAudit);
appCfgService.auditAppPolicyCfg(entity, isAudit,Constants.INSERT_ACTION);
addMessage(redirectAttributes, "success", "audit_success");
} catch (Exception e) {
if (e instanceof MaatConvertException) {

View File

@@ -178,17 +178,22 @@ public class EncryptedTunnelBehaviorController extends BaseController {
entity.setAppCode(specificService.getSpecServiceCode());
}
appCfgService.saveOrUpdateAppPolicyCfg(entity);
addMessage(redirectAttributes, "success", "save_success");
} catch (Exception e) {
e.printStackTrace();
logger.error("加密隧道信息保存失败", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
} else if (e instanceof CallExternalProceduresException) {
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
} else {
addMessage(redirectAttributes, "error", "save_failed");
//配置仅保存
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (MaatConvertException e) {
logger.error("加密隧道行为配置下发失败:",e);
addMessage(redirectAttributes, "error", "request_service_failed");
} catch (CallExternalProceduresException e) {
logger.error("调用外部程序出错:",e);
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
} catch (Exception e) {
logger.error("加密隧道行为配置保存失败:",e);
addMessage(redirectAttributes, "error", "save_failed");
}
return "redirect:" + adminPath + "/encryptedtunnelbehav/list?functionId=" + entity.getFunctionId();
@@ -221,7 +226,7 @@ public class EncryptedTunnelBehaviorController extends BaseController {
entity.setFunctionId(functionId);
entity.setConfigType(Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR);
try {
appCfgService.auditAppPolicyCfg(entity, isAudit);
appCfgService.auditAppPolicyCfg(entity, isAudit,Constants.INSERT_ACTION);
addMessage(redirectAttributes, "success", "audit_success");
} catch (Exception e) {
if (e instanceof MaatConvertException) {

View File

@@ -98,15 +98,19 @@ public class DnsIpCfgController extends BaseController {
@ModelAttribute("cfg") DnsIpCfg cfg, RedirectAttributes redirectAttributes) {
try {
dnsIpCfgService.saveOrUpdate(cfg);
addMessage(redirectAttributes, "success", "save_success");
} catch (Exception e) {
logger.error("信息保存失败", e);
e.printStackTrace();
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
} else {
addMessage(redirectAttributes, "error", "save_failed");
//配置仅保存
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (MaatConvertException e) {
logger.error("DNS欺骗ip配置下发失败",e);
addMessage(redirectAttributes, "error", "request_service_failed");
} catch (Exception e) {
logger.error("DNS欺骗ip配置保存失败",e);
addMessage(redirectAttributes, "error", "save_failed");
}
return "redirect:" + adminPath + "/cfg/dnsIp/list?functionId=" + cfg.getFunctionId();

View File

@@ -80,10 +80,18 @@ public class DnsResStrategyController extends BaseController {
dnsResStrategyService.saveOrUpdate(cfg);
addMessage(redirectAttributes, "success", "save_success");
//配置仅保存
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (MaatConvertException e) {
logger.error("DNS响应策略配置下发失败",e);
addMessage(redirectAttributes, "error", "request_service_failed");
} catch (Exception e) {
logger.error("DNS响应策略配置保存失败",e);
addMessage(redirectAttributes, "error", "save_failed");
}

View File

@@ -71,15 +71,19 @@ public class DdosCfgController extends BaseController {
@ModelAttribute("cfg") DdosIpCfg cfg, RedirectAttributes redirectAttributes) {
try {
ddosCfgService.saveOrUpdate(cfg);
addMessage(redirectAttributes, "success", "save_success");
} catch (Exception e) {
logger.error("信息保存失败", e);
e.printStackTrace();
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
} else {
addMessage(redirectAttributes, "error", "save_failed");
//配置仅保存
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (MaatConvertException e) {
logger.error("DDOS配置下发失败",e);
addMessage(redirectAttributes, "error", "request_service_failed");
} catch (Exception e) {
logger.error("DDOS配置保存失败",e);
addMessage(redirectAttributes, "error", "save_failed");
}
return "redirect:" + adminPath + "/manipulation/ddos/list?functionId=" + cfg.getFunctionId();
@@ -120,7 +124,7 @@ public class DdosCfgController extends BaseController {
Date auditTime = new Date();
for (String id : idArray) {
try {
ddosCfgService.audit(isAudit, isValid, functionId, id, auditTime);
ddosCfgService.audit(isAudit, isValid, functionId, id, auditTime,Constants.INSERT_ACTION);
addMessage(redirectAttributes, "success", "audit_success");
} catch (MaatConvertException e) {
e.printStackTrace();

View File

@@ -238,20 +238,26 @@ public class PxyObjKeyringController extends BaseController {
}
}
pxyObjKeyringService.saveOrUpdate(cfg);
addMessage(redirectAttributes, "success", "save_success");
//配置仅保存
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
}
} catch (MultiPartNewException e) {
logger.error("证书文件上传失败:",e);
addMessage(redirectAttributes, "error", "request_service_failed");
} catch (MaatConvertException e) {
logger.error("拦截策略配置下发失败:",e);
addMessage(redirectAttributes, "error", "request_service_failed");
} catch (Exception e) {
logger.error("证书上传失败", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
} else if (e instanceof MultiPartNewException) {
addMessage(redirectAttributes, "error", e.getMessage());
} else {
addMessage(redirectAttributes, "error", "save_failed");
}
logger.error("拦截策略配置保存失败",e);
addMessage(redirectAttributes, "error", "save_failed");
}
return "redirect:" + adminPath + "/proxy/intercept/strateagy/list?functionId=" + cfg.getFunctionId();
}
@@ -641,18 +647,24 @@ public class PxyObjKeyringController extends BaseController {
}
}
pxyObjKeyringService.trustedCertsaveOrUpdate(cfg);
addMessage(redirectAttributes, "success", "save_success");
//配置仅保存
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
}
} catch (MultiPartNewException e) {
logger.error("可信证书上传失败:",e);
addMessage(redirectAttributes, "error", e.getMessage());
} catch (MaatConvertException e) {
logger.error("可信证书单配置下发失败:",e);
addMessage(redirectAttributes, "error", "request_service_failed");
} catch (Exception e) {
logger.error("证书上传失败", e);
if (e instanceof MultiPartNewException) {
addMessage(redirectAttributes, "error", e.getMessage());
} else if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
} else {
addMessage(redirectAttributes, "error", "save_failed");
}
logger.error("可信证书配置保存失败",e);
addMessage(redirectAttributes, "error", "save_failed");
}
return "redirect:" + adminPath + "/proxy/intercept/strateagy/trustedCertList?functionId=" + cfg.getFunctionId();