修改配置异常提示信息
This commit is contained in:
@@ -69,7 +69,7 @@ public class ControlPolicyController extends BaseController{
|
||||
,RedirectAttributes redirectAttributes){
|
||||
try{
|
||||
controlPolicyService.saveOrUpdate(cfg,areaCfgIds);
|
||||
addMessage(redirectAttributes,"save_success");
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}catch(Exception e){
|
||||
logger.error("信息保存失败",e);
|
||||
addMessage(redirectAttributes,"save_failed");
|
||||
@@ -95,9 +95,13 @@ public class ControlPolicyController extends BaseController{
|
||||
for(String id :idArray){
|
||||
try {
|
||||
controlPolicyService.audit(isAudit,isValid,functionId,id,auditTime,Constants.REPLACE_REQ_KEY_VALUE);
|
||||
} catch (MaatConvertException e) {
|
||||
} catch ( Exception e) {
|
||||
logger.error("配置下发失败",e);
|
||||
addMessage(redirectAttributes, e.getMessage());
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","audit_failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,7 +141,7 @@ public class ControlPolicyController extends BaseController{
|
||||
,RedirectAttributes redirectAttributes){
|
||||
try{
|
||||
controlPolicyService.saveOrUpdate(cfg,areaCfgIds);
|
||||
addMessage(redirectAttributes,"save_success");
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}catch(Exception e){
|
||||
logger.error("信息保存失败",e);
|
||||
addMessage(redirectAttributes,"save_failed");
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.nis.domain.Page;
|
||||
import com.nis.domain.callback.ProxyFileStrategyCfg;
|
||||
import com.nis.domain.maat.ToMaatResult;
|
||||
import com.nis.domain.maat.ToMaatResult.ResponseData;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.FileUtils;
|
||||
import com.nis.util.JsonMapper;
|
||||
@@ -116,10 +117,14 @@ public class FileStrategyController extends CommonController {
|
||||
cfg.setContentLength(file.length());//文件长度
|
||||
}
|
||||
proxyFileStrategyService.saveOrUpdate(cfg);
|
||||
addMessage(redirectAttributes,"save_success");
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}catch(Exception e){
|
||||
logger.error("信息保存失败",e);
|
||||
addMessage(redirectAttributes,"save_failed");
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
}
|
||||
}finally {
|
||||
if(file != null) {
|
||||
file.delete();//删除临时文件
|
||||
|
||||
@@ -185,11 +185,15 @@ public class HttpRedirectPolicyController extends BaseController{
|
||||
@ModelAttribute("cfg")CfgIndexInfo cfg,RedirectAttributes redirectAttributes){
|
||||
try{
|
||||
httpRedirectCfgService.saveHttpCfg(cfg);
|
||||
addMessage(redirectAttributes,"save_success");
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}catch(Exception e){
|
||||
logger.error("信息保存失败",e);
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes,"save_failed");
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/proxy/control/httpRedirect/httpRedirectList?functionId="+cfg.getFunctionId();
|
||||
@@ -231,10 +235,14 @@ public class HttpRedirectPolicyController extends BaseController{
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
httpRedirectCfgService.auditHttpCfg(entity,isAudit);
|
||||
} catch (MaatConvertException e) {
|
||||
} catch ( Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("http重定向配置下发失败:"+e.getMessage());
|
||||
addMessage(redirectAttributes,"error", e.getMessage());
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","audit_failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
return "redirect:" + adminPath +"/proxy/control/httpRedirect/httpRedirectList?functionId="+functionId;
|
||||
|
||||
@@ -85,10 +85,14 @@ public class InterceptController extends CommonController{
|
||||
public String saveInterceptIpCfg(RedirectAttributes redirectAttributes,Model model,HttpServletRequest request,HttpServletResponse response,String ids,CfgIndexInfo entity) {
|
||||
try {
|
||||
interceptCfgService.saveInterceptCfg(entity);
|
||||
addMessage(redirectAttributes,"save_success");
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("save_failed", e);
|
||||
addMessage(redirectAttributes,"save_failed");
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
}
|
||||
}
|
||||
return "redirect:" + adminPath +"/proxy/intercept/ip/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
@@ -144,9 +148,13 @@ public class InterceptController extends CommonController{
|
||||
try {
|
||||
interceptCfgService.auditInterceptIpCfg(entity,isAudit);
|
||||
addMessage(redirectAttributes,"audit_success");
|
||||
} catch (MaatConvertException e) {
|
||||
} catch ( Exception e) {
|
||||
logger.error("intercept ip audit failed",e);
|
||||
addMessage(redirectAttributes,"audit_failed");
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
return "redirect:" + adminPath +"/proxy/intercept/ip/list?functionId="+functionId;
|
||||
|
||||
@@ -110,7 +110,11 @@ public class PxyObjKeyringController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
validFlag=false;
|
||||
logger.error("证书文件校验失败",e);
|
||||
addMessage(redirectAttributes,e.getMessage());
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "save_failed");
|
||||
}
|
||||
}
|
||||
|
||||
if(validFlag){
|
||||
@@ -131,7 +135,11 @@ public class PxyObjKeyringController extends BaseController {
|
||||
}
|
||||
}catch (Exception e) {
|
||||
logger.error("证书信息获取失败",e);
|
||||
addMessage(redirectAttributes,e.getMessage());
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "save_failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
if(validFlag){
|
||||
@@ -184,13 +192,13 @@ public class PxyObjKeyringController extends BaseController {
|
||||
}
|
||||
pxyObjKeyringService.saveOrUpdate(cfg);
|
||||
|
||||
addMessage(redirectAttributes,"save_success");
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}catch(Exception e){
|
||||
logger.error("证书上传失败",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,e.getMessage());
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,e.getMessage());
|
||||
addMessage(redirectAttributes,"error", "save_failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user