批量下发功能增加,delRow.tag中暂时不打开此功能。

app topic domain和app domain业务修改domain存储cfgkeyword属性。
摘要修改level属性存储为下发的最终数值。
同步的单域配置的增加时间和状态属性从entity中获取
This commit is contained in:
DuanDongmei
2018-12-05 17:56:41 +08:00
parent e5fa7cbca8
commit bb302e3f13
37 changed files with 2406 additions and 703 deletions

View File

@@ -11,6 +11,7 @@ import java.util.Properties;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
@@ -175,27 +176,55 @@ public class CachePolicyController extends BaseController{
}
@RequestMapping(value = {"audit"})
@RequiresPermissions(value={"cache:policy:confirm"})
public String audit(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes) {
CfgIndexInfo entity = new CfgIndexInfo();
String[] idArray = ids.split(",");
for(String id :idArray){
entity = cachePolicyService.getCachePolicy(Long.parseLong(id));
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
entity.setFunctionId(functionId);
try {
cachePolicyService.auditCachePolicy(entity,isAudit);
} catch ( Exception e) {
e.printStackTrace();
logger.info("代理缓存策略下发失败:"+e.getMessage());
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error","request_service_failed");
}else {
addMessage(redirectAttributes,"error","audit_failed");
public String audit(Model model,@ModelAttribute("cfg") CfgIndexInfo cfg,
Integer isValid,
Integer isAudit,
String ids,
Integer functionId,
RedirectAttributes redirectAttributes,
HttpServletResponse response,
HttpServletRequest request) {
if(!StringUtil.isEmpty(ids)){
CfgIndexInfo entity = new CfgIndexInfo();
String[] idArray = ids.split(",");
for(String id :idArray){
entity = cachePolicyService.getCachePolicy(Long.parseLong(id));
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
entity.setFunctionId(functionId);
try {
cachePolicyService.auditCachePolicy(entity,isAudit);
} catch ( Exception e) {
e.printStackTrace();
logger.info("代理缓存策略下发失败:"+e.getMessage());
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error","request_service_failed");
}else {
addMessage(redirectAttributes,"error","audit_failed");
}
}
}
}else {
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"r");
Page<CfgIndexInfo> auditPage=new Page<CfgIndexInfo>(request,response,"r");
try {
BeanUtils.copyProperties(searchPage, auditPage);
auditAll(auditPage,isValid , cfg);
} catch (Exception e) {
logger.error("配置下发失败:",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error", "request_service_failed");
}else {
addMessage(redirectAttributes,"error", "audit_failed");
}
}
return list(model, request, response, cfg);
}
return "redirect:" + adminPath +"/proxy/cache/list?functionId="+functionId;
}

View File

@@ -13,6 +13,7 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
@@ -223,28 +224,55 @@ public class HttpRedirectPolicyController extends BaseController{
,"control:httpMinit:confirm"
,"control:httpWhitelist:confirm"}
,logical=Logical.OR)
public String audit(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes) {
CfgIndexInfo entity = new CfgIndexInfo();
String[] idArray = ids.split(",");
for(String id :idArray){
entity = httpRedirectCfgService.getHttpCfg(Long.parseLong(id),null);
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
entity.setFunctionId(functionId);
try {
httpRedirectCfgService.auditHttpCfg(entity,isAudit);
} catch ( Exception e) {
e.printStackTrace();
logger.info("http重定向配置下发失败"+e.getMessage());
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error","request_service_failed");
}else {
addMessage(redirectAttributes,"error","audit_failed");
public String audit(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,
Integer isValid,
Integer isAudit,
String ids,
Integer functionId,
RedirectAttributes redirectAttributes,
HttpServletResponse response,
HttpServletRequest request) {
if(!StringUtil.isEmpty(ids)) {
CfgIndexInfo entity = new CfgIndexInfo();
String[] idArray = ids.split(",");
for(String id :idArray){
entity = httpRedirectCfgService.getHttpCfg(Long.parseLong(id),null);
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
entity.setFunctionId(functionId);
try {
httpRedirectCfgService.auditHttpCfg(entity,isAudit);
} catch ( Exception e) {
e.printStackTrace();
logger.info("http重定向配置下发失败"+e.getMessage());
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error","request_service_failed");
}else {
addMessage(redirectAttributes,"error","audit_failed");
}
}
}
}else{//条件下所有配置审核
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
Page<CfgIndexInfo> auditPage=new Page<CfgIndexInfo>(request,response,"a");
BeanUtils.copyProperties(searchPage, auditPage);
try {
auditAll(auditPage,isValid , cfg);
} catch (Exception e) {
logger.error("配置下发失败:",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error", "request_service_failed");
}else {
addMessage(redirectAttributes,"error", "audit_failed");
}
}
return list(model, request, response, cfg);
}
}
return "redirect:" + adminPath +"/proxy/control/httpRedirect/httpRedirectList?functionId="+functionId;
}

View File

@@ -11,6 +11,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
@@ -135,27 +136,54 @@ public class InterceptController extends CommonController{
}
@RequestMapping(value = {"auditInterceptIpCfg","auditInterceptDomainCfg","auditInterceptIpPayloadCfg"})
public String auditInterceptIpCfg(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes) {
CfgIndexInfo entity = new CfgIndexInfo();
String[] idArray = ids.split(",");
for(String id :idArray){
entity = interceptCfgService.getInterceptCfg(Long.parseLong(id),null);
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
entity.setFunctionId(functionId);
public String auditInterceptIpCfg(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,
Integer isValid,
Integer isAudit,
String ids,
Integer functionId,
RedirectAttributes redirectAttributes,
HttpServletResponse response,
HttpServletRequest request) {
if(!StringUtil.isEmpty(ids)) {
CfgIndexInfo entity = new CfgIndexInfo();
String[] idArray = ids.split(",");
for(String id :idArray){
entity = interceptCfgService.getInterceptCfg(Long.parseLong(id),null);
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
entity.setFunctionId(functionId);
try {
interceptCfgService.auditInterceptIpCfg(entity,isAudit);
addMessage(redirectAttributes,"success","audit_success");
} catch ( Exception e) {
logger.error("intercept ip audit failed",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error", "request_service_failed");
}else {
addMessage(redirectAttributes,"error", "audit_failed");
}
}
}
}else{//条件下所有配置审核
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
Page<CfgIndexInfo> auditPage=new Page<CfgIndexInfo>(request,response,"a");
BeanUtils.copyProperties(searchPage, auditPage);
try {
interceptCfgService.auditInterceptIpCfg(entity,isAudit);
addMessage(redirectAttributes,"success","audit_success");
} catch ( Exception e) {
logger.error("intercept ip audit failed",e);
auditAll(auditPage,isValid , cfg);
} catch (Exception e) {
logger.error("配置下发失败:",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error", "request_service_failed");
}else {
addMessage(redirectAttributes,"error", "audit_failed");
}
}
return ipList(model, cfg, request, response);
}
return "redirect:" + adminPath +"/proxy/intercept/ip/list?functionId="+functionId;
}

View File

@@ -25,6 +25,7 @@ import javax.net.ssl.TrustManagerFactory;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
@@ -340,8 +341,14 @@ public class PxyObjKeyringController extends BaseController {
@RequestMapping(value = {"/audit"})
@RequiresPermissions(value={"proxy:intercept:confirm"})
public String audit(Integer isAudit,Integer isValid,String ids,Integer functionId,
RedirectAttributes redirectAttributes) {
public String audit(Model model,@ModelAttribute("cfg")PxyObjKeyring cfg,
Integer isValid,
Integer isAudit,
String ids,
Integer functionId,
RedirectAttributes redirectAttributes,
HttpServletResponse response,
HttpServletRequest request) {
if(!StringUtil.isEmpty(ids)){
String[] idArray = ids.split(",");
Date auditTime=new Date();
@@ -357,6 +364,24 @@ public class PxyObjKeyringController extends BaseController {
}
}
}else {
Page<PxyObjKeyring> searchPage=new Page<PxyObjKeyring>(request,response,"r");
Page<PxyObjKeyring> auditPage=new Page<PxyObjKeyring>(request,response,"r");
try {
BeanUtils.copyProperties(searchPage, auditPage);
auditAll(auditPage,isValid , cfg);
} catch (Exception e) {
logger.error("配置下发失败:",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error", "request_service_failed");
}else {
addMessage(redirectAttributes,"error", "audit_failed");
}
}
return list(model, request, response, cfg,redirectAttributes);
}
return "redirect:" + adminPath +"/proxy/intercept/strateagy/list?functionId="+functionId;
}
@@ -814,8 +839,14 @@ public class PxyObjKeyringController extends BaseController {
@RequestMapping(value = {"/trustedCertAudit"})
@RequiresPermissions(value={"proxy:trustedCert:confirm"})
public String trustedCertAudit(Integer isAudit,Integer isValid,String ids,Integer functionId,
RedirectAttributes redirectAttributes) {
public String trustedCertAudit(Model model,@ModelAttribute("cfg")PxyObjTrustedCaCert cfg,
Integer isValid,
Integer isAudit,
String ids,
Integer functionId,
RedirectAttributes redirectAttributes,
HttpServletResponse response,
HttpServletRequest request) {
if(!StringUtil.isEmpty(ids)){
String[] idArray = ids.split(",");
Date auditTime=new Date();
@@ -833,6 +864,24 @@ public class PxyObjKeyringController extends BaseController {
}
}
}else {
Page<PxyObjTrustedCaCert> searchPage=new Page<PxyObjTrustedCaCert>(request,response,"r");
Page<PxyObjTrustedCaCert> auditPage=new Page<PxyObjTrustedCaCert>(request,response,"r");
try {
BeanUtils.copyProperties(searchPage, auditPage);
auditAll(auditPage,isValid , cfg);
} catch (Exception e) {
logger.error("配置下发失败:",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error", "request_service_failed");
}else {
addMessage(redirectAttributes,"error", "audit_failed");
}
}
return trustedCertList(model, request, response, cfg, redirectAttributes);
}
return "redirect:" + adminPath +"/proxy/intercept/strateagy/trustedCertList?functionId="+functionId;
}