协议-配置支持对某些用户的配置不经过审核直接生效的流程

This commit is contained in:
leijun
2019-04-16 14:34:05 +08:00
parent 36e990a247
commit bdcc2bb1b4
23 changed files with 572 additions and 158 deletions

View File

@@ -91,7 +91,13 @@ public class AvContentController extends BaseController {
CfgIndexInfo cfg, RedirectAttributes redirectAttributes) {
try {
avContentCfgService.saveOrUpdateAvVoip(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 (Exception e) {
if (e instanceof MaatConvertException) {
e.printStackTrace();
@@ -204,7 +210,15 @@ public class AvContentController extends BaseController {
Date auditTime = new Date();
for (String id : idArray) {
try {
avContentCfgService.auditAvVoip(isAudit, isValid, functionId, id, auditTime);
CfgIndexInfo entity=new CfgIndexInfo();
entity.setCfgId(Long.parseLong(id));
entity = avContentCfgService.getCfgIndexInfo(entity);
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
entity.setFunctionId(functionId);
avContentCfgService.auditAvVoip(entity,isAudit,Constants.INSERT_ACTION);
addMessage(redirectAttributes, "success", "audit_success");
} catch (Exception e) {
if (e instanceof MaatConvertException) {
@@ -614,7 +628,13 @@ public class AvContentController extends BaseController {
CfgIndexInfo cfg, RedirectAttributes redirectAttributes) {
try {
avContentCfgService.saveOrUpdateContUrl(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 (Exception e) {
if (e instanceof MaatConvertException) {
e.printStackTrace();
@@ -663,7 +683,6 @@ public class AvContentController extends BaseController {
HttpServletRequest request) {
if (!StringUtil.isEmpty(ids)) {
String[] idArray = ids.split(",");
Date auditTime = new Date();
for (String id : idArray) {
try {
CfgIndexInfo entity=new CfgIndexInfo();

View File

@@ -72,7 +72,22 @@ public class BgpCfgController extends BaseController {
@RequiresPermissions(value = { "other:bgp:config" })
public String saveBgpCfg(Model model, HttpServletRequest request, HttpServletResponse response, String ids,
CfgIndexInfo entity, RedirectAttributes redirectAttributes) {
bgpCfgService.saveBgpCfg(entity);
try {
bgpCfgService.saveBgpCfg(entity);
//配置仅保存
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (MaatConvertException e) {
logger.error("ip白名单配置下发失败",e);
addMessage(redirectAttributes, "error", "request_service_failed");
} catch (Exception e) {
logger.error("ip白名单配置保存失败",e);
addMessage(redirectAttributes, "error", "save_failed");
}
return "redirect:" + adminPath + "/ntc/other/bgpList?functionId=" + entity.getFunctionId();
}
@@ -157,11 +172,11 @@ public class BgpCfgController extends BaseController {
entity = bgpCfgService.getBgpCfg(Long.parseLong(id), null);
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
/*entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());*/
entity.setFunctionId(functionId);
try {
bgpCfgService.auditBgpCfg(entity, isAudit);
bgpCfgService.auditBgpCfg(entity, isAudit,Constants.INSERT_ACTION);
addMessage(redirectAttributes, "success", "audit_success");
} catch (MaatConvertException e) {
e.printStackTrace();

View File

@@ -87,7 +87,13 @@ public class FileTransferCfgController extends BaseController {
CfgIndexInfo entity, RedirectAttributes redirectAttributes) {
try {
fileTransferCfgService.saveFtpCfg(entity);
addMessage(redirectAttributes, "success", "save_success");
//配置仅保存
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (Exception e) {
if (e instanceof MaatConvertException) {
e.printStackTrace();
@@ -185,11 +191,11 @@ public class FileTransferCfgController extends BaseController {
entity = fileTransferCfgService.getFtpCfg(Long.parseLong(id), null);
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
// entity.setAuditorId(UserUtils.getUser().getId());
// entity.setAuditTime(new Date());
entity.setFunctionId(functionId);
try {
fileTransferCfgService.auditFtpCfg(entity, isAudit);
fileTransferCfgService.auditFtpCfg(entity, isAudit,Constants.INSERT_ACTION);
addMessage(redirectAttributes, "success", "audit_success");
} catch (Exception e) {
if (e instanceof MaatConvertException) {
@@ -487,7 +493,13 @@ public class FileTransferCfgController extends BaseController {
CfgIndexInfo entity, RedirectAttributes redirectAttributes) {
try {
fileTransferCfgService.saveP2pCfg(entity);
addMessage(redirectAttributes, "success", "save_success");
//配置仅保存
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (Exception e) {
if (e instanceof MaatConvertException) {
e.printStackTrace();
@@ -585,11 +597,11 @@ public class FileTransferCfgController extends BaseController {
entity = fileTransferCfgService.getP2pCfg(Long.parseLong(id), null);
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
// entity.setAuditorId(UserUtils.getUser().getId());
// entity.setAuditTime(new Date());
entity.setFunctionId(functionId);
try {
fileTransferCfgService.auditP2pCfg(entity, isAudit);
fileTransferCfgService.auditP2pCfg(entity, isAudit,Constants.INSERT_ACTION);
addMessage(redirectAttributes, "success", "audit_success");
} catch (Exception e) {
e.printStackTrace();

View File

@@ -107,7 +107,12 @@ public class MailCfgController extends BaseController {
logger.info("获取文件摘要响应信息:" + result);
}
mailCfgService.saveMailCfg(entity, result);
addMessage(redirectAttributes, "success", "save_success");
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (Exception e) {
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
@@ -205,11 +210,11 @@ public class MailCfgController extends BaseController {
entity = mailCfgService.getMailCfg(Long.parseLong(id), null);
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
/*entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());*/
entity.setFunctionId(functionId);
try {
mailCfgService.auditMailCfg(entity, isAudit);
mailCfgService.auditMailCfg(entity, isAudit,Constants.INSERT_ACTION);
addMessage(redirectAttributes, "success", "audit_success");
} catch (Exception e) {
e.printStackTrace();

View File

@@ -192,9 +192,25 @@ public class WebsiteController extends BaseController {
@RequestMapping(value = { "saveHttpCfg" })
@RequiresPermissions(value = { "website:http:config" })
public String saveHttpCfg(RedirectAttributes model, HttpServletRequest request, HttpServletResponse response,
String ids, CfgIndexInfo entity) {
websiteCfgService.saveHttpCfg(entity);
public String saveHttpCfg( HttpServletRequest request, HttpServletResponse response,
String ids, CfgIndexInfo entity,RedirectAttributes redirectAttributes) {
try {
websiteCfgService.saveHttpCfg(entity);
//配置仅保存
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (MaatConvertException e) {
logger.error("ip白名单配置下发失败",e);
addMessage(redirectAttributes, "error", "request_service_failed");
} catch (Exception e) {
logger.error("ip白名单配置保存失败",e);
addMessage(redirectAttributes, "error", "save_failed");
}
return "redirect:" + adminPath + "/ntc/website/httpList?functionId=" + entity.getFunctionId();
}
@@ -243,11 +259,11 @@ public class WebsiteController extends BaseController {
entity = websiteCfgService.getHttpCfg(Long.parseLong(id), null);
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
/*entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());*/
entity.setFunctionId(functionId);
try {
websiteCfgService.auditHttpCfg(entity, isAudit);
websiteCfgService.auditHttpCfg(entity, isAudit,Constants.INSERT_ACTION);
addMessage(redirectAttributes, "success", "audit_success");
} catch (MaatConvertException e) {
logger.error("http配置下发失败" + e.getMessage());
@@ -306,9 +322,24 @@ public class WebsiteController extends BaseController {
@RequestMapping(value = { "saveSslCfg" })
@RequiresPermissions(value = { "website:ssl:config" })
public String saveSslCfg(RedirectAttributes model, HttpServletRequest request, HttpServletResponse response,
String ids, CfgIndexInfo entity) {
websiteCfgService.saveSslCfg(entity);
public String saveSslCfg(HttpServletRequest request, HttpServletResponse response,
String ids, CfgIndexInfo entity,RedirectAttributes redirectAttributes) {
try {
websiteCfgService.saveSslCfg(entity);
//配置仅保存
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (MaatConvertException e) {
logger.error("ip白名单配置下发失败",e);
addMessage(redirectAttributes, "error", "request_service_failed");
} catch (Exception e) {
logger.error("ip白名单配置保存失败",e);
addMessage(redirectAttributes, "error", "save_failed");
}
return "redirect:" + adminPath + "/ntc/website/sslList?functionId=" + entity.getFunctionId();
}
@@ -391,11 +422,11 @@ public class WebsiteController extends BaseController {
entity = websiteCfgService.getSslCfg(Long.parseLong(id), null);
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
// entity.setAuditorId(UserUtils.getUser().getId());
// entity.setAuditTime(new Date());
entity.setFunctionId(functionId);
try {
websiteCfgService.auditSslCfg(entity, isAudit);
websiteCfgService.auditSslCfg(entity, isAudit,Constants.INSERT_ACTION);
addMessage(redirectAttributes, "success", "audit_success");
} catch (Exception e) {
e.printStackTrace();
@@ -452,8 +483,23 @@ public class WebsiteController extends BaseController {
@RequestMapping(value = { "saveDnsCfg" })
@RequiresPermissions(value = { "website:dns:config" })
public String saveDnsCfg(RedirectAttributes model, HttpServletRequest request, HttpServletResponse response,
String ids, CfgIndexInfo entity) {
websiteCfgService.saveDnsCfg(entity);
String ids, CfgIndexInfo entity,RedirectAttributes redirectAttributes) {
try {
websiteCfgService.saveDnsCfg(entity);
//配置仅保存
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (MaatConvertException e) {
logger.error("ip白名单配置下发失败",e);
addMessage(redirectAttributes, "error", "request_service_failed");
} catch (Exception e) {
logger.error("ip白名单配置保存失败",e);
addMessage(redirectAttributes, "error", "save_failed");
}
return "redirect:" + adminPath + "/ntc/website/dnsList?functionId=" + entity.getFunctionId();
}
@@ -531,11 +577,11 @@ public class WebsiteController extends BaseController {
entity = websiteCfgService.getDnsCfg(Long.parseLong(id), null);
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
// entity.setAuditorId(UserUtils.getUser().getId());
// entity.setAuditTime(new Date());
entity.setFunctionId(functionId);
try {
websiteCfgService.auditDnsCfg(entity, isAudit);
websiteCfgService.auditDnsCfg(entity, isAudit,Constants.INSERT_ACTION);
addMessage(redirectAttributes, "success", "audit_success");
} catch (MaatConvertException e) {
e.printStackTrace();

View File

@@ -205,9 +205,8 @@ public class WhiteListController extends CommonController {
@RequestMapping(value = { "saveHttpUrlCfgs" })
public String saveHttpUrlCfgs(RedirectAttributes model, HttpServletRequest request, HttpServletResponse response,
CfgIndexInfo entity) {
CfgIndexInfo entity) throws Exception {
if (!StringUtil.isEmpty(entity) && !StringUtil.isEmpty(entity.getHttpUrlList())) {
CfgIndexInfo sourceCfg = websiteCfgService
.getCfgIndexInfo(entity.getHttpUrlList().get(0).getSourceCompileId());
for (HttpUrlCfg httpUrlCfg : entity.getHttpUrlList()) {
@@ -217,7 +216,7 @@ public class WhiteListController extends CommonController {
BeanUtils.copyProperties(httpUrlCfg, cfg);
httpList.add(httpUrlCfg);
cfg.setHttpUrlList(httpList);
websiteCfgService.saveHttpCfg(cfg);
websiteCfgService.saveHttpCfg(cfg);
}
}
return "redirect:" + adminPath + "/ntc/whitelist/domain/list?functionId=" + entity.getFunctionId();
@@ -249,9 +248,24 @@ public class WhiteListController extends CommonController {
}
@RequestMapping(value = { "domain/save" })
public String saveOrUpdateDomain(RedirectAttributes model, HttpServletRequest request, HttpServletResponse response,
public String saveOrUpdateDomain(RedirectAttributes redirectAttributes, HttpServletRequest request, HttpServletResponse response,
String ids, CfgIndexInfo entity) {
domainService.saveDomainCfg(entity);
try {
domainService.saveDomainCfg(entity);
//配置仅保存
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (MaatConvertException e) {
logger.error("ip白名单配置下发失败",e);
addMessage(redirectAttributes, "error", "request_service_failed");
} catch (Exception e) {
logger.error("ip白名单配置保存失败",e);
addMessage(redirectAttributes, "error", "save_failed");
}
return "redirect:" + adminPath + "/ntc/whitelist/domain/list?functionId=" + entity.getFunctionId();
}
@@ -333,11 +347,11 @@ public class WhiteListController extends CommonController {
entity = domainService.getDomainCfg(Long.parseLong(id), null);
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
/*entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());*/
entity.setFunctionId(functionId);
try {
domainService.auditDomainCfg(entity, isAudit);
domainService.auditDomainCfg(entity, isAudit,Constants.INSERT_ACTION);
addMessage(redirectAttributes, "success", "audit_success");
} catch (MaatConvertException e) {
e.printStackTrace();