增加高级功能菜单下的配置审核不通过、删除功能.

This commit is contained in:
zhangwenqing
2019-04-15 16:23:14 +08:00
parent ecb1fed2d5
commit a2f8cf56d3
13 changed files with 491 additions and 128 deletions

View File

@@ -3136,7 +3136,7 @@ public class BaseController {
}else{
//400 ASN IP
if(auditBatchCfg.getServiceId().equals(400)) {
if(auditBatchCfg.getIsValid() == 1) {
if(auditBatchCfg.getIsAudit() == 1) {
boolean hasData = true;
//批量生效[按每组每批次下发一次]
AsnGroupInfo groupInfo=new AsnGroupInfo();
@@ -3178,28 +3178,39 @@ public class BaseController {
List<AsnIpCfg> list=asnIpCfgService.findPage(page, searchAsnIpCfg).getList();
if(!StringUtil.isEmpty(list)){
Map<Integer,List> asnIpMap=new HashMap();
if(!StringUtil.isEmpty(list)) {
for (AsnIpCfg obj : list) {
BaseCfg baseCfg=(BaseCfg)obj;
if(!StringUtil.isEmpty(asnIpMap.get(obj.getAsnIpGroup()))) {
asnIpMap.get(obj.getAsnIpGroup()).add(baseCfg);
asnIpMap.put(obj.getAsnIpGroup(), asnIpMap.get(obj.getAsnIpGroup()));
}else {
List newList=new ArrayList<>();
newList.add(baseCfg);
asnIpMap.put(obj.getAsnIpGroup(),newList);
if(auditBatchCfg.getIsAudit() == 2) {
List<BaseCfg> BaseCfgList=new ArrayList<>();
for (AsnIpCfg cfg : list) {
BaseCfg baseCfg=new BaseCfg();
BeanUtils.copyProperties(cfg, baseCfg);
BaseCfgList.add(baseCfg);
}
hasData = commonPolicyService.batchUnApproveMaatData(cfgList, page, auditBatchCfg, BaseCfgList, hasData);
}else {
Map<Integer,List> asnIpMap=new HashMap();
if(!StringUtil.isEmpty(list)) {
for (AsnIpCfg obj : list) {
BaseCfg baseCfg=(BaseCfg)obj;
if(!StringUtil.isEmpty(asnIpMap.get(obj.getAsnIpGroup()))) {
asnIpMap.get(obj.getAsnIpGroup()).add(baseCfg);
asnIpMap.put(obj.getAsnIpGroup(), asnIpMap.get(obj.getAsnIpGroup()));
}else {
List newList=new ArrayList<>();
newList.add(baseCfg);
asnIpMap.put(obj.getAsnIpGroup(),newList);
}
}
}
hasData=commonPolicyService.auditReuseConfigData(page, auditBatchCfg,asnIpMap,hasData);
}
hasData=commonPolicyService.auditReuseConfigData(page, auditBatchCfg,asnIpMap,hasData);
}else{
hasData = false;
}
}
}
}else if(auditBatchCfg.getServiceId().equals(1028)) {
if(auditBatchCfg.getIsValid() == 1) {
if(auditBatchCfg.getIsAudit() == 1) {
boolean hasData = true;
//批量生效[按每组每批次下发一次]
ConfigGroupInfo groupInfo=new ConfigGroupInfo();
@@ -3249,21 +3260,32 @@ public class BaseController {
List<AppIpCfg> list=appCfgService.findAppIpList(page, searchAppIpCfg).getList();
if(!StringUtil.isEmpty(list)){
Map<Integer,List> appIpMap=new HashMap();
if(!StringUtil.isEmpty(list)) {
for (AppIpCfg obj : list) {
BaseCfg baseCfg=(BaseCfg)obj;
if(!StringUtil.isEmpty(appIpMap.get((groupMap.get(obj.getCompileId()))))) {
appIpMap.get(groupMap.get(obj.getCompileId())).add(baseCfg);
appIpMap.put(groupMap.get(obj.getCompileId()), appIpMap.get(groupMap.get(obj.getCompileId())));
}else {
List newList=new ArrayList<>();
newList.add(baseCfg);
appIpMap.put(groupMap.get(obj.getCompileId()),newList);
if(auditBatchCfg.getIsAudit() == 2) { // 配置批量审核不通过
List<BaseCfg> BaseCfgList=new ArrayList<>();
for (AppIpCfg cfg : list) {
BaseCfg baseCfg=new BaseCfg();
BeanUtils.copyProperties(cfg, baseCfg);
BaseCfgList.add(baseCfg);
}
hasData = commonPolicyService.batchUnApproveMaatData(cfgList, page, auditBatchCfg, BaseCfgList, hasData);
}else {
Map<Integer,List> appIpMap=new HashMap();
if(!StringUtil.isEmpty(list)) {
for (AppIpCfg obj : list) {
BaseCfg baseCfg=(BaseCfg)obj;
if(!StringUtil.isEmpty(appIpMap.get((groupMap.get(obj.getCompileId()))))) {
appIpMap.get(groupMap.get(obj.getCompileId())).add(baseCfg);
appIpMap.put(groupMap.get(obj.getCompileId()), appIpMap.get(groupMap.get(obj.getCompileId())));
}else {
List newList=new ArrayList<>();
newList.add(baseCfg);
appIpMap.put(groupMap.get(obj.getCompileId()),newList);
}
}
}
hasData=commonPolicyService.auditReuseConfigData(page, auditBatchCfg,appIpMap,hasData);
}
hasData=commonPolicyService.auditReuseConfigData(page, auditBatchCfg,appIpMap,hasData);
}else{
hasData = false;
}
@@ -3296,7 +3318,7 @@ public class BaseController {
list=appCfgService.findAppHttpList(page, searchAppHttpCfg).getList();
}
if(!StringUtil.isEmpty(list)){
if(auditBatchCfg.getIsValid().equals(1)) {
if(auditBatchCfg.getIsAudit().equals(1)) {
hasData=configSynchronizationService.auditSingleMaatData(cfgType,userRegionList,
page,auditBatchCfg,list,hasData,true);
}else {
@@ -3307,7 +3329,11 @@ public class BaseController {
newList.add(cfg);
}
}
hasData=commonPolicyService.auditNtcMaatData(cfgList, page, auditBatchCfg,newList, hasData);
if(auditBatchCfg.getIsAudit().equals(2)) { // 配置批量审核不通过
hasData = commonPolicyService.batchUnApproveMaatData(cfgList, page, auditBatchCfg, newList, hasData);
}else {
hasData=commonPolicyService.auditNtcMaatData(cfgList, page, auditBatchCfg,newList, hasData);
}
}
}else{
hasData = false;
@@ -3372,6 +3398,19 @@ public class BaseController {
AvFileSampleCfg searchFileSampleCfg=new AvFileSampleCfg();
DdosIpCfg searchDdosIpCfg=new DdosIpCfg();
AppIpCfg searchAppIpCfg=new AppIpCfg();
AppHttpCfg searchAppHttpCfg=new AppHttpCfg();
AppDomainCfg searchAppDomainCfg=new AppDomainCfg();
AppTopicDomainCfg searchAppTopicCfg=new AppTopicDomainCfg();
AppSslCertCfg searchAppSslCertCfg=new AppSslCertCfg();
AppFeatureIndex searchAppFeatureIndex=new AppFeatureIndex();
DnsResStrategy searchDnsResStrategy=new DnsResStrategy();
DnsIpCfg searchDnsIpCfg=new DnsIpCfg();
PxyObjKeyring searchObjKeyringCfg=new PxyObjKeyring();
PxyObjTrustedCaCert searchTrustedCaCertCfg=new PxyObjTrustedCaCert();
AsnIpCfg searchAsnIpCfg=new AsnIpCfg();
// 传递检索条件
if(entity != null && (entity instanceof CfgIndexInfo)) {
BeanUtils.copyProperties(entity, searchCfg);
@@ -3403,6 +3442,78 @@ public class BaseController {
searchDdosIpCfg.setIsAudit(0);
searchDdosIpCfg.setFunctionId(functionId);
}
if(entity != null && (entity instanceof AppHttpCfg)) {
BeanUtils.copyProperties(entity, searchAppHttpCfg);
searchAppHttpCfg.setIsValid(0);
searchAppHttpCfg.setIsAudit(0);
searchAppHttpCfg.setFunctionId(functionId);
}
if(entity != null && (entity instanceof AppHttpCfg)) {
BeanUtils.copyProperties(entity, searchAppHttpCfg);
searchAppHttpCfg.setIsValid(0);
searchAppHttpCfg.setIsAudit(0);
searchAppHttpCfg.setFunctionId(functionId);
}
if(entity != null && (entity instanceof AppDomainCfg)) {
BeanUtils.copyProperties(entity, searchAppDomainCfg);
searchAppDomainCfg.setIsValid(0);
searchAppDomainCfg.setIsAudit(0);
searchAppDomainCfg.setFunctionId(functionId);
}
if(entity != null && (entity instanceof AppTopicDomainCfg)) {
BeanUtils.copyProperties(entity, searchAppTopicCfg);
searchAppTopicCfg.setIsValid(0);
searchAppTopicCfg.setIsAudit(0);
searchAppTopicCfg.setFunctionId(functionId);
}
if(entity != null && (entity instanceof AppSslCertCfg)) {
BeanUtils.copyProperties(entity, searchAppSslCertCfg);
searchAppSslCertCfg.setIsValid(0);
searchAppSslCertCfg.setIsAudit(0);
searchAppSslCertCfg.setFunctionId(functionId);
}
if(entity != null && (entity instanceof AppIpCfg)) {
BeanUtils.copyProperties(entity, searchAppIpCfg);
searchAppIpCfg.setIsValid(0);
searchAppIpCfg.setIsAudit(0);
searchAppIpCfg.setFunctionId(functionId);
}
if(entity != null && (entity instanceof AppFeatureIndex)) {
BeanUtils.copyProperties(entity, searchAppFeatureIndex);
searchAppFeatureIndex.setIsValid(0);
searchAppFeatureIndex.setIsAudit(0);
searchAppFeatureIndex.setFunctionId(functionId);
}
if(entity != null && (entity instanceof DnsResStrategy)) {
BeanUtils.copyProperties(entity, searchDnsResStrategy);
searchDnsResStrategy.setIsValid(0);
searchDnsResStrategy.setIsAudit(0);
searchDnsResStrategy.setFunctionId(functionId);
}
if(entity != null && (entity instanceof DnsIpCfg)) {
BeanUtils.copyProperties(entity, searchDnsIpCfg);
searchDnsIpCfg.setIsValid(0);
searchDnsIpCfg.setIsAudit(0);
searchDnsIpCfg.setFunctionId(functionId);
}
if(entity != null && (entity instanceof PxyObjKeyring)) {
BeanUtils.copyProperties(entity, searchObjKeyringCfg);
searchObjKeyringCfg.setIsValid(0);
searchObjKeyringCfg.setIsAudit(0);
searchObjKeyringCfg.setFunctionId(functionId);
}
if(entity != null && (entity instanceof PxyObjTrustedCaCert)) {
BeanUtils.copyProperties(entity, searchTrustedCaCertCfg);
searchTrustedCaCertCfg.setIsValid(0);
searchTrustedCaCertCfg.setIsAudit(0);
searchTrustedCaCertCfg.setFunctionId(functionId);
}
if(entity != null && (entity instanceof AsnIpCfg)) {
BeanUtils.copyProperties(entity, searchAsnIpCfg);
searchAsnIpCfg.setIsValid(0);
searchAsnIpCfg.setIsAudit(0);
searchAsnIpCfg.setFunctionId(functionId);
}
BaseCfg batchCfg = new BaseCfg();
batchCfg.setEditTime(new Date());
@@ -3427,7 +3538,8 @@ public class BaseController {
// 存放域配置类型 及 对应表名
List<Map<String,Object>> cfgList = (List<Map<String, Object>>) service.get("cfgList");
//if(!StringUtil.isEmpty(cfgList)) {
if(!StringUtil.isEmpty(cfgList)) {
/** -- 多域maat -- **/
if("cfg_index_info".equals(tableNameXml)){
boolean hasData = true;
while(hasData){
@@ -3435,13 +3547,13 @@ public class BaseController {
page.setLastPage(false);
List<CfgIndexInfo> list = getDataList(page,searchCfg,null,null,null); // 通过serviceId获取主配置表数据
if(!StringUtil.isEmpty(list)){
List<BaseCfg> BaseCfgList=new ArrayList<>();
List<BaseCfg> baseCfgList=new ArrayList<>();
for (CfgIndexInfo cfg : list) {
BaseCfg baseCfg=new BaseCfg();
BeanUtils.copyProperties(cfg, baseCfg);
BaseCfgList.add(baseCfg);
baseCfgList.add(baseCfg);
}
hasData = commonPolicyService.batchDeleteMaatData(cfgList, page, batchCfg, BaseCfgList, hasData);
hasData = commonPolicyService.batchDeleteMaatData(cfgList, page, batchCfg, baseCfgList, hasData);
}else{
hasData = false;
}
@@ -3453,13 +3565,13 @@ public class BaseController {
page.setLastPage(false);
List<FileDigestCfg> list = getDataList(page,null,null,searchDigestCfg,null); // 通过serviceId获取主配置表数据
if(!StringUtil.isEmpty(list)){
List<BaseCfg> BaseCfgList=new ArrayList<>();
List<BaseCfg> baseCfgList=new ArrayList<>();
for (FileDigestCfg cfg : list) {
BaseCfg baseCfg=new BaseCfg();
BeanUtils.copyProperties(cfg, baseCfg);
BaseCfgList.add(baseCfg);
baseCfgList.add(baseCfg);
}
hasData = commonPolicyService.batchDeleteMaatData(cfgList, page, batchCfg, BaseCfgList, hasData);
hasData = commonPolicyService.batchDeleteMaatData(cfgList, page, batchCfg, baseCfgList, hasData);
}else{
hasData = false;
}
@@ -3471,17 +3583,60 @@ public class BaseController {
page.setLastPage(false);
List<AppPolicyCfg> list = getDataList(page,null,searchAppCfg,null,null); // 通过serviceId获取主配置表数据
if(!StringUtil.isEmpty(list)){
List<BaseCfg> BaseCfgList=new ArrayList<>();
List<BaseCfg> baseCfgList=new ArrayList<>();
for (AppPolicyCfg cfg : list) {
BaseCfg baseCfg=new BaseCfg();
BeanUtils.copyProperties(cfg, baseCfg);
BaseCfgList.add(baseCfg);
baseCfgList.add(baseCfg);
}
hasData = commonPolicyService.batchDeleteMaatData(cfgList, page, batchCfg, BaseCfgList, hasData);
hasData = commonPolicyService.batchDeleteMaatData(cfgList, page, batchCfg, baseCfgList, hasData);
}else{
hasData = false;
}
}
}else if("app_feature_index".equals(tableNameXml)) {
boolean hasData = true;
while(hasData){
page.setPageNo(1);
page.setLastPage(false);
List<AppFeatureIndex> list = getDataList(page,null,null,null,searchAppFeatureIndex); // 通过serviceId获取主配置表数据
if(!StringUtil.isEmpty(list)){
List<BaseCfg> baseCfgList=new ArrayList<>();
for (AppFeatureIndex cfg : list) {
BaseCfg baseCfg=new BaseCfg();
BeanUtils.copyProperties(cfg, baseCfg);
baseCfgList.add(baseCfg);
}
hasData = commonPolicyService.batchDeleteMaatData(cfgList, page, batchCfg, baseCfgList, hasData);
}else{
hasData = false;
}
}
}else{
logger.info("未知业务");
}
}else {
/** -- 单域maat -- **/
if("ddos_ip_cfg".equals(tableNameXml)) {
boolean hasData = true;
while(hasData){
page.setPageNo(1);
page.setLastPage(false);
List<DdosIpCfg> list=ddosCfgService.findPage(page, searchDdosIpCfg).getList();
if(!StringUtil.isEmpty(list)){
List<BaseCfg> baseCfgList=new ArrayList<>();
for (DdosIpCfg cfg : list) {
BaseCfg baseCfg=new BaseCfg();
BeanUtils.copyProperties(cfg, baseCfg);
baseCfgList.add(baseCfg);
}
hasData = commonPolicyService.batchDeleteMaatData(cfgList, page, batchCfg, baseCfgList, hasData);
}else{
hasData = false;
}
}
}else if("av_file_sample_cfg".equals(tableNameXml)) {
boolean hasData = true;
while(hasData){
@@ -3495,31 +3650,123 @@ public class BaseController {
}
}
}else if("ddos_ip_cfg".equals(tableNameXml)) {
}else if("dns_res_strategy".equals(tableNameXml)) {
boolean hasData = true;
while(hasData){
page.setPageNo(1);
page.setLastPage(false);
List<DdosIpCfg> list=ddosCfgService.findPage(page, searchDdosIpCfg).getList();
List<BaseCfg> list = dnsResStrategyService.findPage(page,searchDnsResStrategy).getList();
if(!StringUtil.isEmpty(list)){
List<BaseCfg> BaseCfgList=new ArrayList<>();
for (DdosIpCfg cfg : list) {
BaseCfg baseCfg=new BaseCfg();
BeanUtils.copyProperties(cfg, baseCfg);
BaseCfgList.add(baseCfg);
}
hasData = commonPolicyService.batchDeleteMaatData(cfgList, page, batchCfg, BaseCfgList, hasData);
hasData = commonPolicyService.batchDeleteMaatData(cfgList, page, batchCfg, list, hasData);
}else{
hasData = false;
}
}
}else if("app_feature_index".equals(tableNameXml)) {
}else if("dns_ip_cfg".equals(tableNameXml)) {
boolean hasData = true;
while(hasData){
page.setPageNo(1);
page.setLastPage(false);
List<DnsIpCfg> list = dnsIpCfgService.findPage(page,searchDnsIpCfg).getList();
if(!StringUtil.isEmpty(list)){
List<BaseCfg> baseCfgList=new ArrayList<>();
for (DnsIpCfg cfg : list) {
BaseCfg baseCfg=new BaseCfg();
BeanUtils.copyProperties(cfg, baseCfg);
baseCfgList.add(baseCfg);
}
hasData = commonPolicyService.batchDeleteMaatData(cfgList, page, batchCfg, baseCfgList, hasData);
}else{
hasData = false;
}
}
}else{
logger.info("未知业务");
}else if("pxy_obj_keyring".equals(tableNameXml)) {
boolean hasData = true;
while(hasData){
page.setPageNo(1);
page.setLastPage(false);
List<BaseCfg> list = pxyObjKeyringService.findPage(page,searchObjKeyringCfg).getList();
if(!StringUtil.isEmpty(list)){
hasData = commonPolicyService.batchDeleteMaatData(cfgList, page, batchCfg, list, hasData);
}else{
hasData = false;
}
}
}else if("pxy_obj_trusted_ca_cert".equals(tableNameXml)) {
boolean hasData = true;
while(hasData){
page.setPageNo(1);
page.setLastPage(false);
List<BaseCfg> list = pxyObjKeyringService.findTrustedCertPage(page,searchTrustedCaCertCfg).getList();
if(!StringUtil.isEmpty(list)){
hasData = commonPolicyService.batchDeleteMaatData(cfgList, page, batchCfg, list, hasData);
}else{
hasData = false;
}
}
}else if("asn_ip_cfg".equals(tableNameXml)) { // ASN IP
boolean hasData = true;
while(hasData){
page.setPageNo(1);
page.setLastPage(false);
List<BaseCfg> list=asnIpCfgService.findPage(page, searchAsnIpCfg).getList();
if(!StringUtil.isEmpty(list)){
hasData = commonPolicyService.batchDeleteMaatData(cfgList, page, batchCfg, list, hasData);
}else{
hasData = false;
}
}
}else {
boolean hasData = true;
while(hasData){
page.setPageNo(1);
page.setLastPage(false);
List list = Lists.newArrayList();
/*
1026 app_domain_cfg
1028 app_ip_cfg
1029 app_ssl_cert_cfg
1152 app_topic_domain_cfg
1024 app_http_cfg
1026 app_domain_cfg
*/
if(batchCfg.getServiceId().equals(1028)) {
list = appCfgService.findAppIpList(page, searchAppIpCfg).getList();
}
if(batchCfg.getServiceId().equals(1026)) {
list = appCfgService.findAppDomainList(page, searchAppDomainCfg).getList();
}
if(batchCfg.getServiceId().equals(1029)) {
list = appCfgService.findAppSslList(page, searchAppSslCertCfg).getList();
}
if(batchCfg.getServiceId().equals(1152)) {
list = appCfgService.findAppTopicDomainList(page, searchAppTopicCfg).getList();
}
if(batchCfg.getServiceId().equals(1024)) {
list = appCfgService.findAppHttpList(page, searchAppHttpCfg).getList();
}
if(!StringUtil.isEmpty(list)){
List<BaseCfg> baseCfgList = new ArrayList<>();
if(!StringUtil.isEmpty(list)) {
for (Object obj : list) {
BaseCfg cfg = (BaseCfg)obj;
baseCfgList.add(cfg);
}
}
hasData = commonPolicyService.batchDeleteMaatData(cfgList, page, batchCfg, baseCfgList, hasData);
}else{
hasData = false;
}
}
}
//}
}
}
long end=System.currentTimeMillis();

View File

@@ -160,12 +160,17 @@ public class AsnIpController extends BaseController{
}
@RequestMapping(value = {"/delete"})
@RequiresPermissions(value={"asn:ip:config"})
public String delete(Integer isValid
,String ids,Integer functionId
,RedirectAttributes redirectAttributes){
public String delete(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")AsnIpCfg cfg){
try{
asnIpCfgService.delete(ids);
addMessage(redirectAttributes,"success","delete_success");
if (!StringUtil.isEmpty(ids)) {
asnIpCfgService.delete(ids);
addMessage(redirectAttributes,"success","delete_success");
}else {
// 批量删除
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
deleteAll(searchPage, functionId, cfg);
}
}catch(Exception e){
logger.error("Delete failed",e);
if(e instanceof MaatConvertException) {

View File

@@ -314,7 +314,7 @@ public class AppCfgController extends BaseController {
addMessage(redirectAttributes, "success", "delete_success");
}else {
// 批量删除
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
Page<AppPolicyCfg> searchPage = new Page<AppPolicyCfg>(request, response, "a");
deleteAll(searchPage, functionId, cfg);
}
} catch (Exception e) {
@@ -492,8 +492,26 @@ public class AppCfgController extends BaseController {
*/
@RequestMapping(value = { "updateAppIpCfgValid" })
@RequiresPermissions(value = { "app:ip:config" })
public String updateAppIpCfgValid(Integer isValid, String ids, Integer functionId) {
appCfgService.updateAppIpCfgValid(isValid, ids, functionId);
public String updateAppIpCfgValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")AppIpCfg cfg) {
try {
if (!StringUtil.isEmpty(ids)) {
appCfgService.updateAppIpCfgValid(isValid, ids, functionId);
addMessage(redirectAttributes, "success", "delete_success");
}else {
// 批量删除
Page<AppIpCfg> searchPage = new Page<AppIpCfg>(request, response, "a");
deleteAll(searchPage, functionId, cfg);
}
} catch (Exception e) {
logger.error("配置删除失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
} else {
addMessage(redirectAttributes, "error", "delete_failed");
}
}
return "redirect:" + adminPath + "/app/ipCfgList?functionId=" + functionId;
}
@@ -803,8 +821,26 @@ public class AppCfgController extends BaseController {
*/
@RequestMapping(value = { "updateAppDomainCfgValid" })
@RequiresPermissions(value = { "app:domain:config" })
public String updateAppDomainCfgValid(Integer isValid, String ids, Integer functionId) {
appCfgService.updateAppDomainCfgValid(isValid, ids, functionId);
public String updateAppDomainCfgValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")AppDomainCfg cfg) {
try {
if (!StringUtil.isEmpty(ids)) {
appCfgService.updateAppDomainCfgValid(isValid, ids, functionId);
addMessage(redirectAttributes, "success", "delete_success");
}else {
// 批量删除
Page<AppDomainCfg> searchPage = new Page<AppDomainCfg>(request, response, "a");
deleteAll(searchPage, functionId, cfg);
}
} catch (Exception e) {
logger.error("配置删除失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
} else {
addMessage(redirectAttributes, "error", "delete_failed");
}
}
return "redirect:" + adminPath + "/app/domainCfgList?functionId=" + functionId;
}
@@ -1558,20 +1594,24 @@ public class AppCfgController extends BaseController {
*/
@RequestMapping(value = { "updateAppTopicDomainCfgValid" })
@RequiresPermissions(value = { "app:topic:config" })
public String updateAppTopicDomainCfgValid(Integer isValid, String ids, Integer functionId,
RedirectAttributes redirectAttributes) {
public String updateAppTopicDomainCfgValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")AppTopicDomainCfg cfg) {
try {
appCfgService.updateAppTopicDomainCfgValid(isValid, ids, functionId);
addMessage(redirectAttributes, "success", "delete_success");
if (!StringUtil.isEmpty(ids)) {
appCfgService.updateAppTopicDomainCfgValid(isValid, ids, functionId);
addMessage(redirectAttributes, "success", "delete_success");
}else {
// 批量删除
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
deleteAll(searchPage, functionId, cfg);
}
} catch (Exception e) {
logger.error("app主题网站删除失败", e);
if (e instanceof MaatConvertException) {
e.printStackTrace();
addMessage(redirectAttributes, "error", "request_service_failed");
} else if (e instanceof CallExternalProceduresException) {
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
} else {
e.printStackTrace();
addMessage(redirectAttributes, "error", "delete_failed");
}
}

View File

@@ -225,8 +225,26 @@ public class AppFeatureCfgController extends BaseController {
* @return
*/
@RequestMapping(value = { "updateAppFeatureCfgValid" })
public String updateAppFeatureCfgValid(Integer isValid, String ids, Integer functionId) {
appMultiFeatureCfgService.updateAppFeatureCfgValid(isValid, ids, functionId);
public String updateAppFeatureCfgValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")AppFeatureIndex cfg) {
try {
if (!StringUtil.isEmpty(ids)) {
appMultiFeatureCfgService.updateAppFeatureCfgValid(isValid, ids, functionId);
addMessage(redirectAttributes, "success", "delete_success");
}else {
// 批量删除
Page<AppFeatureIndex> searchPage = new Page<AppFeatureIndex>(request, response, "a");
deleteAll(searchPage, functionId, cfg);
}
} catch (Exception e) {
logger.error("配置删除失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
} else {
addMessage(redirectAttributes, "error", "delete_failed");
}
}
return "redirect:" + adminPath + "/app/feature/multiFeatureCfgList?functionId=" + functionId;
}

View File

@@ -258,7 +258,7 @@ public class BasicProtocolController extends BaseController {
appCfgService.updateAppPolicyCfgValid(isValid, ids, functionId);
addMessage(redirectAttributes, "success", "delete_success");
}else {
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
Page<AppPolicyCfg> searchPage = new Page<AppPolicyCfg>(request, response, "a");
deleteAll(searchPage, functionId, cfg);
}
} catch (Exception e) {

View File

@@ -279,7 +279,7 @@ public class EncryptedTunnelBehaviorController extends BaseController {
addMessage(redirectAttributes, "success", "delete_success");
}else {
// 批量删除
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
Page<AppPolicyCfg> searchPage = new Page<AppPolicyCfg>(request, response, "a");
deleteAll(searchPage, functionId, cfg);
}
} catch (Exception e) {

View File

@@ -114,9 +114,26 @@ public class DnsIpCfgController extends BaseController {
@RequestMapping(value = { "/delete" })
@RequiresPermissions(value = { "dns:fake:ip:config" })
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId,
RedirectAttributes redirectAttributes) {
dnsIpCfgService.delete(isAudit, isValid, ids, functionId);
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")DnsIpCfg cfg) {
try {
if (!StringUtil.isEmpty(ids)) {
dnsIpCfgService.delete(isAudit, isValid, ids, functionId);
addMessage(redirectAttributes, "success", "delete_success");
}else {
// 批量删除
Page<DnsIpCfg> searchPage = new Page<DnsIpCfg>(request, response, "a");
deleteAll(searchPage, functionId, cfg);
}
} catch (Exception e) {
logger.error("配置删除失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
} else {
addMessage(redirectAttributes, "error", "delete_failed");
}
}
return "redirect:" + adminPath + "/cfg/dnsIp/list?functionId=" + functionId;
}

View File

@@ -103,12 +103,26 @@ public class DnsResStrategyController extends BaseController {
@RequestMapping(value = { "/delete" })
@RequiresPermissions(value = { "dns:res:strategy:config" })
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, Model model,
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, Model model, @ModelAttribute("cfg")DnsResStrategy cfg,
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
if (!StringUtil.isEmpty(ids)) {
dnsResStrategyService.delete(isAudit, isValid, ids, functionId);
}
try {
if (!StringUtil.isEmpty(ids)) {
dnsResStrategyService.delete(isAudit, isValid, ids, functionId);
addMessage(redirectAttributes, "success", "delete_success");
}else {
// 批量删除
Page<DnsResStrategy> searchPage = new Page<DnsResStrategy>(request, response, "a");
deleteAll(searchPage, functionId, cfg);
}
} catch (Exception e) {
logger.error("配置删除失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
} else {
addMessage(redirectAttributes, "error", "delete_failed");
}
}
return "redirect:" + adminPath + "/maintenance/dnsResStrategy/list?functionId=" + functionId;
}

View File

@@ -95,7 +95,7 @@ public class DdosCfgController extends BaseController {
addMessage(redirectAttributes, "success", "delete_success");
}else {
// 批量删除
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
Page<DdosIpCfg> searchPage = new Page<DdosIpCfg>(request, response, "a");
deleteAll(searchPage, functionId, cfg);
}
} catch (Exception e) {

View File

@@ -358,7 +358,7 @@ public class AvController extends BaseController {
addMessage(redirectAttributes, "success", "delete_success");
}else {
// 批量删除
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
Page<AvFileSampleCfg> searchPage = new Page<AvFileSampleCfg>(request, response, "a");
deleteAll(searchPage, functionId, cfg);
}
} catch (Exception e) {

View File

@@ -328,10 +328,25 @@ public class PxyObjKeyringController extends BaseController {
@RequestMapping(value = { "/delete" })
@RequiresPermissions(value = { "proxy:intercept:config" })
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, Model model,
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, Model model, @ModelAttribute("cfg")PxyObjKeyring cfg,
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
if (!StringUtil.isEmpty(ids)) {
pxyObjKeyringService.delete(isAudit, isValid, ids, functionId);
try {
if (!StringUtil.isEmpty(ids)) {
pxyObjKeyringService.delete(isAudit, isValid, ids, functionId);
addMessage(redirectAttributes, "success", "delete_success");
}else {
// 批量删除
Page<PxyObjKeyring> searchPage = new Page<PxyObjKeyring>(request, response, "a");
deleteAll(searchPage, functionId, cfg);
}
} catch (Exception e) {
logger.error("配置删除失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
} else {
addMessage(redirectAttributes, "error", "delete_failed");
}
}
return "redirect:" + adminPath + "/proxy/intercept/strateagy/list?functionId=" + functionId;
@@ -860,11 +875,25 @@ public class PxyObjKeyringController extends BaseController {
@RequestMapping(value = { "/trustedCertDelete" })
@RequiresPermissions(value = { "proxy:trustedCert:config" })
public String trustedCertDelete(Integer isAudit, Integer isValid, String ids, Integer functionId, Model model,
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
if (!StringUtil.isEmpty(ids)) {
pxyObjKeyringService.trustedCertDelete(isAudit, isValid, ids, functionId);
}
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes, @ModelAttribute PxyObjTrustedCaCert cfg) {
try {
if (!StringUtil.isEmpty(ids)) {
pxyObjKeyringService.trustedCertDelete(isAudit, isValid, ids, functionId);
addMessage(redirectAttributes, "success", "delete_success");
}else {
// 批量删除
Page<PxyObjKeyring> searchPage = new Page<PxyObjKeyring>(request, response, "a");
deleteAll(searchPage, functionId, cfg);
}
} catch (Exception e) {
logger.error("配置删除失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
} else {
addMessage(redirectAttributes, "error", "delete_failed");
}
}
return "redirect:" + adminPath + "/proxy/intercept/strateagy/trustedCertList?functionId=" + functionId;
}

View File

@@ -1019,10 +1019,26 @@
editor_id = #{entity.editorId,jdbcType=INTEGER},
edit_time = #{entity.editTime,jdbcType=TIMESTAMP}
<where>
AND compile_id IN
<foreach collection="compileIds" index="index" item="compileId" open="(" separator="," close=")">
#{compileId}
</foreach>
<choose>
<when test="tableName == 'app_ip_cfg'">
AND user_region1 IN
<foreach collection="compileIds" index="index" item="compileId" open="(" separator="," close=")">
#{compileId}
</foreach>
</when>
<when test="tableName == 'asn_ip_cfg'">
AND region_id IN
<foreach collection="compileIds" index="index" item="compileId" open="(" separator="," close=")">
#{compileId}
</foreach>
</when>
<otherwise>
AND compile_id IN
<foreach collection="compileIds" index="index" item="compileId" open="(" separator="," close=")">
#{compileId}
</foreach>
</otherwise>
</choose>
</where>
</update>

View File

@@ -322,46 +322,17 @@ public class CommonPolicyService extends CrudService<WebsiteCfgDao, CfgIndexInfo
// 1.获取所有配置的编译ID
List<Integer> compileIds = new ArrayList();
for(BaseCfg cfg:list){
compileIds.add(cfg.getCompileId());
if(entity.getServiceId().equals(1028)) {
compileIds.add(Integer.parseInt(cfg.getUserRegion1()));
}else if(entity.getServiceId().equals(400)) {
compileIds.add(cfg.getRegionId());
}else {
compileIds.add(cfg.getCompileId());
}
}
// 2.更新配置审核状态(主表)
if(!StringUtil.isEmpty(compileIds) && !StringUtil.isEmpty(entity.getTableName())) {
List auditHttpCompileIds= new ArrayList();
List deleteHttpCompileIds= new ArrayList();
// Protocol -> HTTP 请求/响应内容关键字单独处理 ------>
//http关键字配置失效获取与其匹配的http url配置
if(entity.getServiceId().equals(152) || entity.getServiceId().equals(40)) {
List<CfgIndexInfo> httpUrlCfgs=commonPolicyDao.getHttpUrlCfgBySourceCompileId(compileIds);
if(!StringUtil.isEmpty(httpUrlCfgs)) {
for (CfgIndexInfo httpUrlCfg: httpUrlCfgs) {
//审核通过的
if(httpUrlCfg.getIsValid().equals(1) && httpUrlCfg.getIsAudit().equals(1)) {
auditHttpCompileIds.add(httpUrlCfg.getCompileId());
/*maatCfg = new MaatCfg();
maatCfg.setCompileId(httpUrlCfg.getCompileId());
maatCfg.setServiceId(httpUrlCfg.getServiceId());
maatCfg.setIsValid(0);//无效
configCompileList.add(maatCfg);*/
}
//未审核或者审核未通过的
if(httpUrlCfg.getIsValid().equals(0) && (httpUrlCfg.getIsAudit().equals(0) || httpUrlCfg.getIsAudit().equals(2))) {
deleteHttpCompileIds.add(httpUrlCfg.getCompileId());
}
}
}
}
if(!StringUtil.isEmpty(auditHttpCompileIds)) {
commonPolicyDao.auditCfgBatch("cfg_index_info", entity,auditHttpCompileIds,null);
commonPolicyDao.auditCfgBatch("http_url_cfg", entity,auditHttpCompileIds,null);
}
if(!StringUtil.isEmpty(deleteHttpCompileIds)) {
commonPolicyDao.deleteHttpUrlCfg("cfg_index_info", entity,deleteHttpCompileIds);
commonPolicyDao.deleteHttpUrlCfg("http_url_cfg", entity,deleteHttpCompileIds);
}
// Protocol -> HTTP 请求/响应内容关键字单独处理 ------>
commonPolicyDao.auditCfgBatch( entity.getTableName(), entity,compileIds,null); // 批量审核并修改配置审核状态(主表)
}
@@ -386,7 +357,13 @@ public class CommonPolicyService extends CrudService<WebsiteCfgDao, CfgIndexInfo
// 1.获取所有配置的编译ID
List<Integer> compileIds = new ArrayList();
for(BaseCfg cfg:list){
compileIds.add(cfg.getCompileId());
if(entity.getServiceId().equals(1028)) {
compileIds.add(Integer.parseInt(cfg.getUserRegion1()));
}else if(entity.getServiceId().equals(400)) {
compileIds.add(cfg.getRegionId());
}else {
compileIds.add(cfg.getCompileId());
}
}
// 2.更新配置状态(主表)