Merge branch 'develop_no_common_group' of https://git.mesalab.cn/K18_NTCS_WEB/NTC.git into develop_no_common_group
This commit is contained in:
@@ -71,6 +71,7 @@ public class ScheduleUpdateInterceptor extends BaseInterceptor{
|
||||
EXCLUDE_MAPPER_IDS.add("com.nis.web.dao.basics.ServiceDictInfoDao");
|
||||
EXCLUDE_MAPPER_IDS.add("com.nis.web.dao.configuration.PxyObjKeyringDao.updatePxyObjTrustedCaCrl");
|
||||
EXCLUDE_MAPPER_IDS.add("com.nis.web.dao.configuration.CommonPolicyDao.auditCfgBatch");
|
||||
EXCLUDE_MAPPER_IDS.add("com.nis.web.dao.configuration.CommonPolicyDao.deleteCfgBatch");
|
||||
}
|
||||
/**
|
||||
* is_valid 字段名
|
||||
|
||||
@@ -131,6 +131,7 @@ import com.nis.util.Constants;
|
||||
import com.nis.util.DateUtils;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.JsonMapper;
|
||||
import com.nis.util.Reflections;
|
||||
import com.nis.util.ServiceConfigTemplateUtil;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.excel.ExcelCsv;
|
||||
@@ -2816,10 +2817,10 @@ public class BaseController {
|
||||
BeanUtils.copyProperties(entity, searchAsnIpCfg);
|
||||
}
|
||||
|
||||
auditType = (Integer)Reflections.invokeGetter(entity, "isAudit");
|
||||
|
||||
|
||||
//全部审核通过,只查询当前条件下的所有未审核的配置
|
||||
if(auditType.equals(1)) {
|
||||
//全部审核通过,只查询当前条件下的所有未审核的配置 -批量审核通过/不通过
|
||||
if(auditType.equals(1) || auditType.equals(2)) {
|
||||
searchCfg.setIsValid(0);
|
||||
searchCfg.setIsAudit(0);
|
||||
searchAppCfg.setIsValid(0);
|
||||
@@ -2859,8 +2860,13 @@ public class BaseController {
|
||||
searchAsnIpCfg.setIsValid(0);
|
||||
searchAsnIpCfg.setIsAudit(0);
|
||||
|
||||
auditBatchCfg.setIsAudit(1);
|
||||
auditBatchCfg.setIsValid(1);
|
||||
if(auditType.equals(1)) {
|
||||
auditBatchCfg.setIsAudit(1);
|
||||
auditBatchCfg.setIsValid(1);
|
||||
}else {
|
||||
auditBatchCfg.setIsAudit(2);
|
||||
auditBatchCfg.setIsValid(0);
|
||||
}
|
||||
auditBatchCfg.setAuditTime(new Date());
|
||||
auditBatchCfg.setAuditorId(UserUtils.getUser().getId());
|
||||
}else {
|
||||
@@ -2916,12 +2922,11 @@ public class BaseController {
|
||||
functionId=auditBatchCfg.getFunctionId();
|
||||
}
|
||||
List<Map<String,Object>> serviceList = serviceTemplate.getServiceListByFunctionId(functionId);
|
||||
|
||||
for(Map<String,Object> service:serviceList){
|
||||
String tableNameXml = service.get("tableName").toString();
|
||||
String serviceTypeXml = service.get("serviceType").toString();
|
||||
String classNameXml = service.get("className").toString();
|
||||
String serviceIdXml = service.get("id").toString();
|
||||
String tableNameXml = service.get("tableName").toString(); // 获取业务主配置表
|
||||
String serviceTypeXml = service.get("serviceType").toString(); // 业务类型 1maat 2callback
|
||||
String classNameXml = service.get("className").toString(); // 主配置Java类
|
||||
String serviceIdXml = service.get("id").toString(); // service字典表 service_id字段
|
||||
auditBatchCfg.setServiceId(Integer.valueOf(serviceIdXml));
|
||||
auditBatchCfg.setTableName(tableNameXml);
|
||||
searchCfg.setServiceId(Integer.valueOf(serviceIdXml));
|
||||
@@ -2962,6 +2967,7 @@ public class BaseController {
|
||||
searchAppSslCertCfg.setTableName(tableNameXml);
|
||||
|
||||
if("1".equals(serviceTypeXml)){//maat类配置
|
||||
// 存放域配置类型 及 对应表名
|
||||
List<Map<String,Object>> cfgList = (List<Map<String, Object>>) service.get("cfgList");
|
||||
List<Map<String,Object>> userRegionList = (List<Map<String, Object>>) service.get("userRegionList");
|
||||
if(!StringUtil.isEmpty(cfgList)) {
|
||||
@@ -2971,21 +2977,25 @@ public class BaseController {
|
||||
while(hasData){
|
||||
page.setPageNo(1);
|
||||
page.setLastPage(false);
|
||||
List<CfgIndexInfo> list=getDataList(page,searchCfg,null,null,null);
|
||||
List<CfgIndexInfo> list = getDataList(page,searchCfg,null,null,null); // 通过ServiceId获取cfg_index_info主配置表数据
|
||||
if(!StringUtil.isEmpty(list)){
|
||||
//配置生效处理 复用全量下发
|
||||
if(auditBatchCfg.getIsValid().equals(1)) {
|
||||
hasData=configSynchronizationService.auditNtcMaatData(cfgList,userRegionList,page,auditBatchCfg,list,hasData,true);
|
||||
}else {//配置失效处理 批量处理
|
||||
List<BaseCfg> cfgIndexList=new ArrayList<>();
|
||||
if(auditBatchCfg.getIsAudit().equals(1)) {
|
||||
hasData = configSynchronizationService.auditNtcMaatData(cfgList,userRegionList,page,auditBatchCfg,list,hasData,true);
|
||||
}else {
|
||||
List<BaseCfg> BaseCfgList=new ArrayList<>();
|
||||
if(!StringUtil.isEmpty(list)) {
|
||||
for (CfgIndexInfo cfg : list) {
|
||||
BaseCfg baseCfg=new BaseCfg();
|
||||
BeanUtils.copyProperties(cfg, baseCfg);
|
||||
cfgIndexList.add(baseCfg);
|
||||
BaseCfgList.add(baseCfg);
|
||||
}
|
||||
}
|
||||
hasData=commonPolicyService.auditNtcMaatData(cfgList, page, auditBatchCfg, cfgIndexList, hasData);
|
||||
if(auditBatchCfg.getIsAudit().equals(2)) {// 配置批量审核不通过
|
||||
hasData = commonPolicyService.batchUnApproveMaatData(cfgList, page, auditBatchCfg, BaseCfgList, hasData);
|
||||
}else {// 配置失效处理 批量处理
|
||||
hasData = commonPolicyService.auditNtcMaatData(cfgList, page, auditBatchCfg, BaseCfgList, hasData);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
hasData = false;
|
||||
@@ -3001,9 +3011,9 @@ public class BaseController {
|
||||
List<FileDigestCfg> list=getDataList(page,null,null,searchDigestCfg,null);
|
||||
if(!StringUtil.isEmpty(list)){
|
||||
//配置生效处理 复用全量下发
|
||||
if(auditBatchCfg.getIsValid().equals(1)) {
|
||||
if(auditBatchCfg.getIsAudit().equals(1)) {
|
||||
hasData=configSynchronizationService.auditFileDigestData(cfgList, userRegionList, page, auditBatchCfg, list, hasData, true);
|
||||
}else {//配置失效处理 批量处理
|
||||
}else {
|
||||
List<BaseCfg> baseCfgList=new ArrayList<>();
|
||||
if(!StringUtil.isEmpty(list)) {
|
||||
for (FileDigestCfg cfg : list) {
|
||||
@@ -3012,7 +3022,11 @@ public class BaseController {
|
||||
baseCfgList.add(baseCfg);
|
||||
}
|
||||
}
|
||||
hasData=commonPolicyService.auditNtcMaatData(cfgList, page, auditBatchCfg,baseCfgList, hasData);
|
||||
if(auditBatchCfg.getIsAudit().equals(2)) {// 配置批量审核不通过
|
||||
hasData = commonPolicyService.batchUnApproveMaatData(cfgList, page, auditBatchCfg, baseCfgList, hasData);
|
||||
}else {// 配置失效处理 批量处理
|
||||
hasData=commonPolicyService.auditNtcMaatData(cfgList, page, auditBatchCfg,baseCfgList, hasData);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
hasData = false;
|
||||
@@ -3027,9 +3041,9 @@ public class BaseController {
|
||||
List<AppPolicyCfg> list=getDataList(page,null,searchAppCfg,null,null);
|
||||
if(!StringUtil.isEmpty(list)){
|
||||
//配置生效处理 复用全量下发
|
||||
if(auditBatchCfg.getIsValid().equals(1)) {
|
||||
if(auditBatchCfg.getIsAudit().equals(1)) {
|
||||
hasData=configSynchronizationService.auditAppPolicyData(cfgList,userRegionList,page,auditBatchCfg,list,hasData,true);
|
||||
}else {//配置失效处理 批量处理
|
||||
}else {
|
||||
List<BaseCfg> cfgAppList=new ArrayList<>();
|
||||
if(!StringUtil.isEmpty(list)) {
|
||||
for (AppPolicyCfg cfg : list) {
|
||||
@@ -3038,7 +3052,11 @@ public class BaseController {
|
||||
cfgAppList.add(baseCfg);
|
||||
}
|
||||
}
|
||||
hasData=commonPolicyService.auditNtcMaatData(cfgList, page, auditBatchCfg,cfgAppList, hasData);
|
||||
if(auditBatchCfg.getIsAudit().equals(2)) {// 配置批量审核不通过
|
||||
hasData = commonPolicyService.batchUnApproveMaatData(cfgList, page, auditBatchCfg, cfgAppList, hasData);
|
||||
}else {// 配置失效处理 批量处理
|
||||
hasData=commonPolicyService.auditNtcMaatData(cfgList, page, auditBatchCfg,cfgAppList, hasData);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
hasData = false;
|
||||
@@ -3054,9 +3072,9 @@ public class BaseController {
|
||||
List<AppFeatureIndex> list=getDataList(page,null,null,null,searchAppFeatureIndex);
|
||||
if(!StringUtil.isEmpty(list)){
|
||||
//配置生效处理 复用全量下发
|
||||
if(auditBatchCfg.getIsValid().equals(1)) {
|
||||
if(auditBatchCfg.getIsAudit().equals(1)) {
|
||||
hasData=configSynchronizationService.auditAppFeatureData(cfgList,userRegionList,page,auditBatchCfg,list,hasData,true);
|
||||
}else {//配置失效处理 批量处理
|
||||
}else {
|
||||
List<BaseCfg> cfgFeatrureList=new ArrayList<>();
|
||||
if(!StringUtil.isEmpty(list)) {
|
||||
for (AppFeatureIndex cfg : list) {
|
||||
@@ -3065,7 +3083,11 @@ public class BaseController {
|
||||
cfgFeatrureList.add(baseCfg);
|
||||
}
|
||||
}
|
||||
hasData=commonPolicyService.auditNtcMaatData(cfgList, page, auditBatchCfg,cfgFeatrureList, hasData);
|
||||
if(auditBatchCfg.getIsAudit().equals(2)) {// 配置批量审核不通过
|
||||
hasData = commonPolicyService.batchUnApproveMaatData(cfgList, page, auditBatchCfg, cfgFeatrureList, hasData);
|
||||
}else {// 配置失效处理 批量处理
|
||||
hasData=commonPolicyService.auditNtcMaatData(cfgList, page, auditBatchCfg,cfgFeatrureList, hasData);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
hasData = false;
|
||||
@@ -3085,7 +3107,8 @@ public class BaseController {
|
||||
|
||||
List<DdosIpCfg> list=ddosCfgService.findPage(page, searchDdosIpCfg).getList();
|
||||
if(!StringUtil.isEmpty(list)){
|
||||
if(auditBatchCfg.getIsValid().equals(1)) {
|
||||
// 配置生效处理
|
||||
if(auditBatchCfg.getIsAudit().equals(1)) {
|
||||
hasData=configSynchronizationService.auditDdosMaatData(cfgList,userRegionList,
|
||||
page,auditBatchCfg,list,hasData,true);
|
||||
}else {
|
||||
@@ -3096,7 +3119,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);
|
||||
}
|
||||
}
|
||||
if(hasData) {
|
||||
page.setPageNo(1);
|
||||
@@ -3324,7 +3351,181 @@ public class BaseController {
|
||||
logger.warn("配置批量生效/失效耗时:"+(end-start));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 界面批量删除当前检索条件下的配置
|
||||
* @param page
|
||||
* @param functionId
|
||||
* @param entity
|
||||
* @throws Exception
|
||||
*/
|
||||
public void deleteAll(Page page,Integer functionId, Object entity)throws Exception {
|
||||
long start=System.currentTimeMillis();
|
||||
page.setOrderBy("");
|
||||
page.setPageSize(Constants.MAAT_JSON_SEND_SIZE);
|
||||
page.setPageNo(1);
|
||||
page.setLastPage(false);
|
||||
|
||||
// 只有未审核的配置可删除
|
||||
CfgIndexInfo searchCfg = new CfgIndexInfo();
|
||||
AppPolicyCfg searchAppCfg=new AppPolicyCfg();
|
||||
FileDigestCfg searchDigestCfg=new FileDigestCfg();
|
||||
AvFileSampleCfg searchFileSampleCfg=new AvFileSampleCfg();
|
||||
DdosIpCfg searchDdosIpCfg=new DdosIpCfg();
|
||||
|
||||
// 传递检索条件
|
||||
if(entity != null && (entity instanceof CfgIndexInfo)) {
|
||||
BeanUtils.copyProperties(entity, searchCfg);
|
||||
searchCfg.setIsValid(0);
|
||||
searchCfg.setIsAudit(0);
|
||||
searchCfg.setFunctionId(functionId);
|
||||
}
|
||||
if(entity != null && (entity instanceof AppPolicyCfg)) {
|
||||
BeanUtils.copyProperties(entity, searchAppCfg);
|
||||
searchAppCfg.setIsValid(0);
|
||||
searchAppCfg.setIsAudit(0);
|
||||
searchAppCfg.setFunctionId(functionId);
|
||||
}
|
||||
if(entity != null && (entity instanceof FileDigestCfg)) {
|
||||
BeanUtils.copyProperties(entity, searchDigestCfg);
|
||||
searchDigestCfg.setIsValid(0);
|
||||
searchDigestCfg.setIsAudit(0);
|
||||
searchDigestCfg.setFunctionId(functionId);
|
||||
}
|
||||
if(entity != null && (entity instanceof AvFileSampleCfg)) {
|
||||
BeanUtils.copyProperties(entity, searchFileSampleCfg);
|
||||
searchFileSampleCfg.setIsValid(0);
|
||||
searchFileSampleCfg.setIsAudit(0);
|
||||
searchFileSampleCfg.setFunctionId(functionId);
|
||||
}
|
||||
if(entity != null && (entity instanceof DdosIpCfg)) {
|
||||
BeanUtils.copyProperties(entity, searchDdosIpCfg);
|
||||
searchDdosIpCfg.setIsValid(0);
|
||||
searchDdosIpCfg.setIsAudit(0);
|
||||
searchDdosIpCfg.setFunctionId(functionId);
|
||||
}
|
||||
|
||||
BaseCfg batchCfg = new BaseCfg();
|
||||
batchCfg.setEditTime(new Date());
|
||||
batchCfg.setEditorId(UserUtils.getUser().getId());
|
||||
|
||||
ServiceConfigTemplateUtil serviceTemplate = new ServiceConfigTemplateUtil();
|
||||
List<Map<String,Object>> serviceList = serviceTemplate.getServiceListByFunctionId(functionId);
|
||||
for(Map<String,Object> service:serviceList){
|
||||
String tableNameXml = service.get("tableName").toString(); // 获取业务主配置表
|
||||
String serviceTypeXml = service.get("serviceType").toString(); // 业务类型 1maat 2callback
|
||||
String classNameXml = service.get("className").toString(); // 主配置Java类
|
||||
String serviceIdXml = service.get("id").toString(); // service字典表 service_id字段
|
||||
|
||||
searchCfg.setServiceId(Integer.valueOf(serviceIdXml));
|
||||
searchCfg.setTableName(tableNameXml);
|
||||
searchAppCfg.setServiceId(Integer.valueOf(serviceIdXml));
|
||||
searchAppCfg.setTableName(tableNameXml);
|
||||
searchDigestCfg.setServiceId(Integer.valueOf(serviceIdXml));
|
||||
searchDigestCfg.setTableName(tableNameXml);
|
||||
batchCfg.setServiceId(Integer.valueOf(serviceIdXml));
|
||||
batchCfg.setTableName(tableNameXml);
|
||||
|
||||
// 存放域配置类型 及 对应表名
|
||||
List<Map<String,Object>> cfgList = (List<Map<String, Object>>) service.get("cfgList");
|
||||
//if(!StringUtil.isEmpty(cfgList)) {
|
||||
if("cfg_index_info".equals(tableNameXml)){
|
||||
boolean hasData = true;
|
||||
while(hasData){
|
||||
page.setPageNo(1);
|
||||
page.setLastPage(false);
|
||||
List<CfgIndexInfo> list = getDataList(page,searchCfg,null,null,null); // 通过serviceId获取主配置表数据
|
||||
if(!StringUtil.isEmpty(list)){
|
||||
List<BaseCfg> BaseCfgList=new ArrayList<>();
|
||||
for (CfgIndexInfo 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("file_digest_cfg".equals(tableNameXml)) {
|
||||
boolean hasData = true;
|
||||
while(hasData){
|
||||
page.setPageNo(1);
|
||||
page.setLastPage(false);
|
||||
List<FileDigestCfg> list = getDataList(page,null,null,searchDigestCfg,null); // 通过serviceId获取主配置表数据
|
||||
if(!StringUtil.isEmpty(list)){
|
||||
List<BaseCfg> BaseCfgList=new ArrayList<>();
|
||||
for (FileDigestCfg 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("app_policy_cfg".equals(tableNameXml)) {
|
||||
boolean hasData = true;
|
||||
while(hasData){
|
||||
page.setPageNo(1);
|
||||
page.setLastPage(false);
|
||||
List<AppPolicyCfg> list = getDataList(page,null,searchAppCfg,null,null); // 通过serviceId获取主配置表数据
|
||||
if(!StringUtil.isEmpty(list)){
|
||||
List<BaseCfg> BaseCfgList=new ArrayList<>();
|
||||
for (AppPolicyCfg 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){
|
||||
page.setPageNo(1);
|
||||
page.setLastPage(false);
|
||||
List<BaseCfg> list = avCfgService.getAvFileSampleList(page,searchFileSampleCfg).getList();
|
||||
if(!StringUtil.isEmpty(list)){
|
||||
hasData = commonPolicyService.batchDeleteMaatData(cfgList, page, batchCfg, list, hasData);
|
||||
}else{
|
||||
hasData = false;
|
||||
}
|
||||
}
|
||||
|
||||
}else 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("app_feature_index".equals(tableNameXml)) {
|
||||
|
||||
}else{
|
||||
logger.info("未知业务");
|
||||
}
|
||||
//}
|
||||
|
||||
}
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("配置批量删除耗时:"+(end-start));
|
||||
|
||||
}
|
||||
|
||||
public List getDataList(Page searchPage
|
||||
,CfgIndexInfo searchCfg
|
||||
|
||||
@@ -41,6 +41,7 @@ import com.nis.domain.configuration.AppSslCertCfg;
|
||||
import com.nis.domain.configuration.AppTcpCfg;
|
||||
import com.nis.domain.configuration.AppTopicDomainCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.domain.configuration.WebsiteDomainTopic;
|
||||
@@ -305,8 +306,26 @@ public class AppCfgController extends BaseController {
|
||||
*/
|
||||
@RequestMapping(value = { "updateAppPolicyCfgValid" })
|
||||
@RequiresPermissions(value = { "app:policy:config" })
|
||||
public String updateAppPolicyCfgValid(Integer isValid, String ids, Integer functionId) {
|
||||
appCfgService.updateAppPolicyCfgValid(isValid, ids, functionId);
|
||||
public String updateAppPolicyCfgValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")AppPolicyCfg cfg) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
appCfgService.updateAppPolicyCfgValid(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("配置删除失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
}
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath + "/app/policyCfgList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
|
||||
@@ -251,20 +251,23 @@ public class BasicProtocolController extends BaseController {
|
||||
*/
|
||||
@RequestMapping(value = { "updateValid" })
|
||||
@RequiresPermissions(value = { "basicprotocol:config" })
|
||||
public String updateAppPolicyCfgValid(Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
public String updateAppPolicyCfgValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")AppPolicyCfg cfg) {
|
||||
try {
|
||||
appCfgService.updateAppPolicyCfgValid(isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
if(!StringUtil.isEmpty(ids)) {
|
||||
appCfgService.updateAppPolicyCfgValid(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("基础协议信息保存失败", 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");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.nis.domain.Page;
|
||||
import com.nis.domain.SysDataDictionaryItem;
|
||||
import com.nis.domain.configuration.AppPolicyCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.domain.specific.SpecificServiceCfg;
|
||||
@@ -270,10 +271,17 @@ public class EncryptedTunnelBehaviorController extends BaseController {
|
||||
*/
|
||||
@RequestMapping(value = { "updateValid" })
|
||||
@RequiresPermissions(value = { "encryptedtunnelbehav:config" })
|
||||
public String updateAppPolicyCfgValid(Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
public String updateAppPolicyCfgValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")AppPolicyCfg cfg) {
|
||||
try {
|
||||
appCfgService.updateAppPolicyCfgValid(isValid, ids, functionId);
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
appCfgService.updateAppPolicyCfgValid(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("加密隧道协议保存失败", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
|
||||
@@ -87,8 +87,26 @@ public class DdosCfgController extends BaseController {
|
||||
|
||||
@RequestMapping(value = { "/delete" })
|
||||
@RequiresPermissions(value = { "ddos:ip:config" })
|
||||
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId) {
|
||||
ddosCfgService.delete(isAudit, isValid, ids, functionId);
|
||||
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")DdosIpCfg cfg) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ddosCfgService.delete(isAudit, 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("配置删除失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
}
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath + "/manipulation/ddos/list?functionId=" + functionId;
|
||||
}
|
||||
|
||||
|
||||
@@ -152,18 +152,22 @@ public class AvContentController extends BaseController {
|
||||
// 修改VOIP IP配置状态
|
||||
@RequestMapping(value = { "/updateAvVoipValid" })
|
||||
@RequiresPermissions(value = { "avVoip:config" })
|
||||
public String updateVoipValid(Integer isAudit, String compileIds, Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
public String updateVoipValid(Integer isAudit, String compileIds, Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
|
||||
try {
|
||||
avContentCfgService.updateAvVoipValid(isAudit, isValid, compileIds, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
avContentCfgService.updateAvVoipValid(isAudit, isValid, compileIds, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
}else {
|
||||
// 批量删除
|
||||
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
deleteAll(searchPage, functionId, cfg);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if (e instanceof MaatConvertException) {
|
||||
e.printStackTrace();
|
||||
logger.error("voip 信息审核失败", e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
e.printStackTrace();
|
||||
logger.error("voip 信息审核失败", e);
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
}
|
||||
@@ -627,9 +631,26 @@ public class AvContentController extends BaseController {
|
||||
// 修改CONTUrl例配置状态
|
||||
@RequestMapping(value = { "/updateAvContUrlValid" })
|
||||
@RequiresPermissions(value = { "avContUrl:config" })
|
||||
public String updateAvContUrlValid(Integer isAudit, Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
avContentCfgService.updateContUrlValid(isAudit, isValid, ids, functionId);
|
||||
public String updateAvContUrlValid(Integer isAudit, Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
avContentCfgService.updateContUrlValid(isAudit, 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("配置删除失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
}
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath + "/ntc/av/contUrlList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
|
||||
@@ -350,10 +350,26 @@ public class AvController extends BaseController {
|
||||
|
||||
// 修改文件样例配置状态
|
||||
@RequestMapping(value = { "/sample/updateAvFileSampleValid" })
|
||||
public String updateAvFileSampleValid(Integer isAudit, Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
avCfgService.updateAvFileSampleValid(isAudit, isValid, ids);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
public String updateAvFileSampleValid(Integer isAudit, Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")AvFileSampleCfg cfg) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
avCfgService.updateAvFileSampleValid(isAudit, isValid, 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("配置删除失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
}
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath + "/ntc/av/sample/fileSampleList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
|
||||
@@ -122,9 +122,26 @@ public class BgpCfgController extends BaseController {
|
||||
|
||||
@RequestMapping(value = { "updateBgpCfgValid" })
|
||||
@RequiresPermissions(value = { "other:bgp:config" })
|
||||
public String updateBgpCfgValid(Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
bgpCfgService.updateBgpCfgValid(isValid, ids, functionId);
|
||||
public String updateBgpCfgValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
bgpCfgService.updateBgpCfgValid(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("配置删除失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
}
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath + "/ntc/other/bgpList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
|
||||
@@ -150,19 +150,22 @@ public class FileTransferCfgController extends BaseController {
|
||||
*/
|
||||
@RequestMapping(value = { "updateFtpCfgValid" })
|
||||
@RequiresPermissions(value = { "fileTransfer:ftp:config" })
|
||||
public String updateFtpCfgValid(Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
public String updateFtpCfgValid(Integer isValid, String ids, Integer functionId,RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
|
||||
try {
|
||||
fileTransferCfgService.updateFtpCfgValid(isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
if(!StringUtil.isEmpty(ids)) {
|
||||
fileTransferCfgService.updateFtpCfgValid(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) {
|
||||
if (e instanceof MaatConvertException) {
|
||||
e.printStackTrace();
|
||||
logger.info("ftp配置删除失败:" + e.getMessage());
|
||||
;
|
||||
logger.error("ftp配置删除失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
e.printStackTrace();
|
||||
logger.error("ftp配置删除失败", e);
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
}
|
||||
@@ -303,9 +306,27 @@ public class FileTransferCfgController extends BaseController {
|
||||
|
||||
@RequestMapping(value = { "updateFileDigestValid" })
|
||||
@RequiresPermissions(value = { "fileTransfer:fileDigest:config" })
|
||||
public String updateFileDigestValid(Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
fileTransferCfgService.updateFileDigestCfgValid(isValid, ids, functionId);
|
||||
public String updateFileDigestValid(Integer isValid, String ids, Integer functionId,RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")FileDigestCfg cfg) {
|
||||
try {
|
||||
if(!StringUtil.isEmpty(ids)) {
|
||||
fileTransferCfgService.updateFileDigestCfgValid(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) {
|
||||
if (e instanceof MaatConvertException) {
|
||||
logger.error("文件摘要配置删除失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
logger.error("文件摘要配置删除失败", e);
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath + "/ntc/fileTransfer/fileDigestList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@@ -483,19 +504,22 @@ public class FileTransferCfgController extends BaseController {
|
||||
|
||||
@RequestMapping(value = { "updateP2pCfgValid" })
|
||||
@RequiresPermissions(value = { "fileTransfer:p2p:config" })
|
||||
public String updateP2pCfgValid(Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
public String updateP2pCfgValid(Integer isValid, String ids, Integer functionId,RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
|
||||
try {
|
||||
fileTransferCfgService.updateP2pCfgValid(isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
if(!StringUtil.isEmpty(ids)) {
|
||||
fileTransferCfgService.updateP2pCfgValid(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) {
|
||||
if (e instanceof MaatConvertException) {
|
||||
e.printStackTrace();
|
||||
logger.info("P2P配置删除失败:" + e.getMessage());
|
||||
;
|
||||
logger.error("P2P配置删除失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
e.printStackTrace();
|
||||
logger.error("P2P配置删除失败", e);
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
}
|
||||
|
||||
@@ -170,8 +170,26 @@ public class MailCfgController extends BaseController {
|
||||
|
||||
@RequestMapping(value = { "updateMailCfgValid" })
|
||||
@RequiresPermissions(value = { "mail:config" })
|
||||
public String updateMailCfgValid(Integer isValid, String ids, Integer functionId) {
|
||||
mailCfgService.updateMailCfgValid(isValid, ids, functionId);
|
||||
public String updateMailCfgValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
mailCfgService.updateMailCfgValid(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("配置删除失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
}
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath + "/ntc/mail/mailList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
|
||||
@@ -208,8 +208,26 @@ public class WebsiteController extends BaseController {
|
||||
|
||||
@RequestMapping(value = { "updateHttpCfgValid" })
|
||||
@RequiresPermissions(value = { "website:http:config" })
|
||||
public String updateHttpCfgValid(Integer isValid, String ids, Integer functionId) {
|
||||
websiteCfgService.updateHttpCfgValid(isValid, ids, functionId);
|
||||
public String updateHttpCfgValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
websiteCfgService.updateHttpCfgValid(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("配置删除失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
}
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath + "/ntc/website/httpList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@@ -338,8 +356,26 @@ public class WebsiteController extends BaseController {
|
||||
|
||||
@RequestMapping(value = { "updateSslCfgValid" })
|
||||
@RequiresPermissions(value = { "website:ssl:config" })
|
||||
public String updateSslCfgValid(Integer isValid, String ids, Integer functionId) {
|
||||
websiteCfgService.updateSslCfgValid(isValid, ids, functionId);
|
||||
public String updateSslCfgValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
websiteCfgService.updateSslCfgValid(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("配置删除失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
}
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath + "/ntc/website/sslList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@@ -460,8 +496,26 @@ public class WebsiteController extends BaseController {
|
||||
|
||||
@RequestMapping(value = { "updateDnsCfgValid" })
|
||||
@RequiresPermissions(value = { "website:dns:config" })
|
||||
public String updateDnsCfgValid(Integer isValid, String ids, Integer functionId) {
|
||||
websiteCfgService.updateDnsCfgValid(isValid, ids, functionId);
|
||||
public String updateDnsCfgValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
websiteCfgService.updateDnsCfgValid(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("配置删除失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
}
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath + "/ntc/website/dnsList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
|
||||
@@ -167,8 +167,28 @@ public class WhiteListController extends CommonController {
|
||||
|
||||
@RequestMapping(value = { "updateIpValid" })
|
||||
@RequiresPermissions(value = { "whitelist:ip:config" })
|
||||
public String updateIpCfgValid(Integer isValid, String ids, Integer functionId) {
|
||||
ipCfgService.updateIpCfgValid(isValid, ids, functionId);
|
||||
public String updateIpCfgValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipCfgService.updateIpCfgValid(isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
}else {
|
||||
// 批量删除
|
||||
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
deleteAll(searchPage, functionId, cfg);
|
||||
//addMessage(redirectAttributes, "success", "delete_success");
|
||||
}
|
||||
} 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 + "/ntc/whitelist/ip/list?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@@ -265,8 +285,26 @@ public class WhiteListController extends CommonController {
|
||||
|
||||
@RequestMapping(value = { "domain/updateValid" })
|
||||
@RequiresPermissions(value = { "whitelist:domain:config" })
|
||||
public String updateDomainValid(Integer isValid, String ids, Integer functionId) {
|
||||
domainService.updateDomainCfgValid(isValid, ids, functionId);
|
||||
public String updateDomainValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
domainService.updateDomainCfgValid(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("配置删除失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
}
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath + "/ntc/whitelist/domain/list?functionId=" + functionId;
|
||||
}
|
||||
|
||||
|
||||
@@ -106,10 +106,15 @@ public class CachePolicyController extends BaseController{
|
||||
}
|
||||
}
|
||||
cachePolicyService.saveCachePolicy(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){
|
||||
logger.error("信息保存失败",e);
|
||||
e.printStackTrace();
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
}else {
|
||||
@@ -157,8 +162,26 @@ public class CachePolicyController extends BaseController{
|
||||
}
|
||||
@RequestMapping(value = {"delete"})
|
||||
@RequiresPermissions(value={"cache:policy:config"})
|
||||
public String delete(Integer isAudit,Integer isValid,String ids,Integer functionId){
|
||||
cachePolicyService.updateCachePolicyValid(isValid,ids,functionId);
|
||||
public String delete(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg){
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
cachePolicyService.updateCachePolicyValid(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("配置删除失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
}
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath +"/proxy/cache/list?functionId="+functionId;
|
||||
}
|
||||
@RequestMapping(value = {"audit"})
|
||||
@@ -183,7 +206,7 @@ public class CachePolicyController extends BaseController{
|
||||
entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
cachePolicyService.auditCachePolicy(entity,isAudit);
|
||||
cachePolicyService.auditCachePolicy(entity,isAudit,Constants.INSERT_ACTION);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
} catch ( Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -67,16 +67,21 @@ public class ControlPolicyController extends BaseController{
|
||||
@ModelAttribute("cfg")HttpBodyCfg cfg,
|
||||
@ModelAttribute("areaCfgIds")String areaCfgIds
|
||||
,RedirectAttributes redirectAttributes){
|
||||
try{
|
||||
try {
|
||||
controlPolicyService.saveOrUpdate(cfg,areaCfgIds);
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}catch(Exception e){
|
||||
logger.error("信息保存失败",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
//配置仅保存
|
||||
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
//配置直接生效
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
}
|
||||
} catch (MaatConvertException e) {
|
||||
logger.error("HTTPS配置下发失败:",e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} catch (Exception e) {
|
||||
logger.error("HTTPS配置保存失败:",e);
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/proxy/control/httpReqReplace/list?functionId="+cfg.getFunctionId();
|
||||
@@ -98,7 +103,7 @@ public class ControlPolicyController extends BaseController{
|
||||
Date auditTime=new Date();
|
||||
for(String id :idArray){
|
||||
try {
|
||||
controlPolicyService.audit(isAudit,isValid,functionId,id,auditTime,Constants.REPLACE_REQ_KEY_VALUE);
|
||||
controlPolicyService.audit(isAudit,isValid,functionId,id,auditTime,Constants.REPLACE_REQ_KEY_VALUE,Constants.INSERT_ACTION);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
} catch ( Exception e) {
|
||||
logger.error("配置下发失败",e);
|
||||
@@ -175,7 +180,7 @@ public class ControlPolicyController extends BaseController{
|
||||
Date auditTime=new Date();
|
||||
for(String id :idArray){
|
||||
try {
|
||||
controlPolicyService.audit(isAudit,isValid,functionId,id,auditTime,Constants.REPLACE_RES_KEY_VALUE);
|
||||
controlPolicyService.audit(isAudit,isValid,functionId,id,auditTime,Constants.REPLACE_RES_KEY_VALUE,Constants.INSERT_ACTION);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
} catch ( Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -188,10 +188,16 @@ public class HttpRedirectPolicyController extends BaseController {
|
||||
@ModelAttribute("cfg") CfgIndexInfo cfg, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
httpRedirectCfgService.saveHttpCfg(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) {
|
||||
logger.error("信息保存失败", e);
|
||||
e.printStackTrace();
|
||||
logger.error("save_failed", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
@@ -215,8 +221,26 @@ public class HttpRedirectPolicyController extends BaseController {
|
||||
@RequiresPermissions(value = { "control:httpBlock:config", "control:httpRedirect:config",
|
||||
"control:httpReplace:config", "control:httpMinit:config",
|
||||
"control:httpWhitelist:config" }, logical = Logical.OR)
|
||||
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId) {
|
||||
httpRedirectCfgService.updateHttpCfgValid(isValid, ids, functionId);
|
||||
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
httpRedirectCfgService.updateHttpCfgValid(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("配置删除失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
}
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath + "/proxy/control/httpRedirect/httpRedirectList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@@ -238,7 +262,7 @@ public class HttpRedirectPolicyController extends BaseController {
|
||||
entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
httpRedirectCfgService.auditHttpCfg(entity, isAudit);
|
||||
httpRedirectCfgService.auditHttpCfg(entity, isAudit,Constants.INSERT_ACTION);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -110,7 +110,14 @@ public class InterceptController extends CommonController {
|
||||
HttpServletResponse response, String ids, CfgIndexInfo entity) {
|
||||
try {
|
||||
interceptCfgService.saveInterceptCfg(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) {
|
||||
logger.error("save_failed", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
@@ -175,7 +182,7 @@ public class InterceptController extends CommonController {
|
||||
entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
interceptCfgService.auditInterceptIpCfg(entity, isAudit);
|
||||
interceptCfgService.auditInterceptIpCfg(entity, isAudit,Constants.INSERT_ACTION);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("intercept ip audit failed", e);
|
||||
@@ -209,11 +216,16 @@ public class InterceptController extends CommonController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = { "updateInterceptIpValid", "updateInterceptDomainValid", "updateInterceptIpPayloadValid" })
|
||||
public String updateInterceptIpValid(Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
public String updateInterceptIpValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
|
||||
try {
|
||||
interceptCfgService.updatInterceptValid(isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
if(!StringUtil.isEmpty(ids)) {
|
||||
interceptCfgService.updatInterceptValid(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("intercept ip delete failed", e);
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
|
||||
@@ -41,4 +41,8 @@ public interface CommonPolicyDao {
|
||||
public List<CachePolicyUserRegion> getCachePolicyUserRegionList(CachePolicyUserRegion entity);
|
||||
|
||||
public List<CachePolicyUserRegion> getCachePolicyByUserRegionList(@Param("ids")String ids);
|
||||
|
||||
public void deleteCfgBatch(@Param("tableName")String tableName,
|
||||
@Param("entity")BaseCfg entity,
|
||||
@Param("compileIds")List compileIds);
|
||||
}
|
||||
|
||||
@@ -1013,5 +1013,17 @@
|
||||
where a.CFG_ID in (${ids})
|
||||
</select>
|
||||
|
||||
<update id="deleteCfgBatch">
|
||||
UPDATE ${tableName}
|
||||
SET is_valid =-1,is_audit=0,
|
||||
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>
|
||||
</where>
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
@@ -167,6 +167,15 @@ public class CachePolicyService extends CrudService<WebsiteCfgDao,CfgIndexInfo>
|
||||
public void saveCachePolicy(CfgIndexInfo entity){
|
||||
//设置区域运营商信息
|
||||
setAreaEffectiveIds(entity);
|
||||
|
||||
int isValid=0;
|
||||
if(!StringUtil.isEmpty(entity.getIsValid()) && entity.getIsValid()==1) {
|
||||
isValid=1;
|
||||
}
|
||||
|
||||
entity.setIsValid(0);
|
||||
entity.setIsAudit(0);
|
||||
|
||||
if(entity.getCfgId()==null){
|
||||
Integer compileId = 0;
|
||||
try {
|
||||
@@ -206,6 +215,12 @@ public class CachePolicyService extends CrudService<WebsiteCfgDao,CfgIndexInfo>
|
||||
throw e;
|
||||
}
|
||||
|
||||
if(isValid==1) {
|
||||
entity.setIsAudit(1);
|
||||
entity.setIsValid(1);
|
||||
auditCachePolicy(entity, isValid,Constants.INSERT_ACTION);
|
||||
}
|
||||
|
||||
}else{
|
||||
//处理复杂用户自定义域
|
||||
if(!StringUtil.isEmpty(entity.getUserRegion())){
|
||||
@@ -243,6 +258,12 @@ public class CachePolicyService extends CrudService<WebsiteCfgDao,CfgIndexInfo>
|
||||
areaIpCfgDao.saveAreaIpCfg(cfg);
|
||||
}
|
||||
}
|
||||
|
||||
if(isValid==1) {
|
||||
entity.setIsAudit(1);
|
||||
entity.setIsValid(1);
|
||||
auditCachePolicy(entity, isValid,Constants.UPDATE_ACTION);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void updateCachePolicyValid(Integer isValid,String ids,Integer functionId){
|
||||
@@ -276,9 +297,12 @@ public class CachePolicyService extends CrudService<WebsiteCfgDao,CfgIndexInfo>
|
||||
}
|
||||
|
||||
}
|
||||
public void auditCachePolicy(CfgIndexInfo entity,Integer isAudit) throws MaatConvertException{
|
||||
public void auditCachePolicy(CfgIndexInfo entity,Integer isAudit,Integer opAction) throws MaatConvertException{
|
||||
//修改数据库审核状态信息
|
||||
entity.setTableName(CfgIndexInfo.getTablename());
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
commonPolicyDao.auditCfg(entity);
|
||||
|
||||
ToMaatBean maatBean = new ToMaatBean();
|
||||
@@ -377,7 +401,7 @@ public class CachePolicyService extends CrudService<WebsiteCfgDao,CfgIndexInfo>
|
||||
maatBean.setAuditTime(entity.getAuditTime());
|
||||
maatBean.setCreatorName(entity.getCurrentUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.INSERT_ACTION);
|
||||
maatBean.setOpAction(opAction);
|
||||
//调用服务接口下发配置数据
|
||||
String json=gsonToJson(maatBean);
|
||||
logger.info("代理缓存策略下发配置参数:"+json);
|
||||
|
||||
@@ -306,4 +306,107 @@ public class CommonPolicyService extends CrudService<WebsiteCfgDao, CfgIndexInfo
|
||||
logger.warn("回调配置批量失效-下发耗时:end("+(end-start)+")");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置批量审核不通过
|
||||
* @param cfgList // 存放域配置类型 及 对应表名
|
||||
* @param page
|
||||
* @param entity // 保存要审核的状态类
|
||||
* @param list // 主配置表数据(在调用前查出)
|
||||
* @param hasData // 标识是否还有数据
|
||||
* @return
|
||||
*/
|
||||
public boolean batchUnApproveMaatData(List<Map<String, Object>> cfgList, Page page, BaseCfg entity,
|
||||
List<BaseCfg> list, boolean hasData) {
|
||||
|
||||
// 1.获取所有配置的编译ID
|
||||
List<Integer> compileIds = new ArrayList();
|
||||
for(BaseCfg cfg:list){
|
||||
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); // 批量审核并修改配置审核状态(主表)
|
||||
}
|
||||
|
||||
// 3.更新域配置审核状态(子表)
|
||||
if(cfgList!=null){
|
||||
for(Map<String,Object> m:cfgList){
|
||||
String tableName = m.get("tableName").toString();
|
||||
commonPolicyDao.auditCfgBatch( tableName, entity,compileIds,null);
|
||||
}
|
||||
}
|
||||
|
||||
// 4.判断是否是当前检索条件下最后一页数据 并返回结果
|
||||
page.setList(list);
|
||||
if(page.isLastPage()){
|
||||
hasData = false;
|
||||
}
|
||||
return hasData;
|
||||
|
||||
}
|
||||
public boolean batchDeleteMaatData(List<Map<String, Object>> cfgList, Page page, BaseCfg entity,
|
||||
List<BaseCfg> list, boolean hasData) {
|
||||
// 1.获取所有配置的编译ID
|
||||
List<Integer> compileIds = new ArrayList();
|
||||
for(BaseCfg cfg:list){
|
||||
compileIds.add(cfg.getCompileId());
|
||||
}
|
||||
|
||||
// 2.更新配置状态(主表)
|
||||
if(!StringUtil.isEmpty(compileIds) && !StringUtil.isEmpty(entity.getTableName())) {
|
||||
commonPolicyDao.deleteCfgBatch(entity.getTableName(), entity,compileIds); // 批量修改配置状态(主表)
|
||||
}
|
||||
|
||||
// 3.更新域配置状态(子表)
|
||||
if(cfgList != null){
|
||||
for(Map<String,Object> m : cfgList){
|
||||
String tableName = m.get("tableName").toString();
|
||||
commonPolicyDao.deleteCfgBatch(tableName, entity, compileIds);
|
||||
}
|
||||
}
|
||||
|
||||
// 4.判断是否是当前检索条件下最后一页数据 并返回结果
|
||||
page.setList(list);
|
||||
if(page.isLastPage()){
|
||||
hasData = false;
|
||||
}
|
||||
return hasData;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +56,12 @@ public class ControlPolicyService extends BaseService{
|
||||
Date createTime=new Date();
|
||||
//设置区域运营商信息
|
||||
setAreaEffectiveIds(entity);
|
||||
|
||||
int isValid=0;
|
||||
if(!StringUtil.isEmpty(entity.getIsValid()) && entity.getIsValid()==1) {
|
||||
isValid=1;
|
||||
}
|
||||
|
||||
//新增
|
||||
if(entity.getCfgId()==null){
|
||||
entity.setCreatorId(UserUtils.getUser().getId());
|
||||
@@ -89,6 +95,12 @@ public class ControlPolicyService extends BaseService{
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
||||
}
|
||||
|
||||
if(isValid==1) {
|
||||
entity.setIsAudit(1);
|
||||
entity.setIsValid(1);
|
||||
audit(entity.getIsAudit(), entity.getIsValid(), entity.getFunctionId(), entity.getId().toString(), new Date(), Constants.REPLACE_REQ_KEY_VALUE, Constants.INSERT_ACTION);
|
||||
}
|
||||
|
||||
//修改
|
||||
}else{
|
||||
Date editTime=new Date();
|
||||
@@ -135,6 +147,12 @@ public class ControlPolicyService extends BaseService{
|
||||
entity.setEditorId(UserUtils.getUser().getId());
|
||||
entity.setEditTime(editTime);
|
||||
controlPolicyDao.update(entity);
|
||||
|
||||
if(isValid==1) {
|
||||
entity.setIsAudit(1);
|
||||
entity.setIsValid(1);
|
||||
audit(entity.getIsAudit(), entity.getIsValid(), entity.getFunctionId(), entity.getId().toString(), new Date(), Constants.REPLACE_REQ_KEY_VALUE, Constants.UPDATE_ACTION);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,7 +174,7 @@ public class ControlPolicyService extends BaseService{
|
||||
}
|
||||
}
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void audit(Integer isAudit,Integer isValid,Integer functionId,String id,Date auditTime,String replaceKeyValue){
|
||||
public void audit(Integer isAudit,Integer isValid,Integer functionId,String id,Date auditTime,String replaceKeyValue,Integer opAction){
|
||||
HttpBodyCfg entity = new HttpBodyCfg();
|
||||
List<HttpBodyCfg> list = new ArrayList();
|
||||
List<AreaIpCfg> areaIpCfgList = new ArrayList();
|
||||
@@ -234,7 +252,7 @@ public class ControlPolicyService extends BaseService{
|
||||
maatBean.setAuditTime(auditTime);
|
||||
maatBean.setCreatorName(entity.getCurrentUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.INSERT_ACTION);
|
||||
maatBean.setOpAction(opAction);
|
||||
//调用服务接口下发配置数据
|
||||
String json=gsonToJson(maatBean);
|
||||
logger.info("配置下发配置参数:"+json);
|
||||
|
||||
@@ -124,6 +124,15 @@ public class HttpRedirectCfgService extends CrudService<WebsiteCfgDao,CfgIndexIn
|
||||
public void saveHttpCfg(CfgIndexInfo entity){
|
||||
//设置区域运营商信息
|
||||
setAreaEffectiveIds(entity);
|
||||
|
||||
int isValid=0;
|
||||
if(!StringUtil.isEmpty(entity.getIsValid()) && entity.getIsValid()==1) {
|
||||
isValid=1;
|
||||
}
|
||||
|
||||
entity.setIsValid(0);
|
||||
entity.setIsAudit(0);
|
||||
|
||||
if(entity.getCfgId()==null){
|
||||
Integer compileId = 0;
|
||||
try {
|
||||
@@ -196,11 +205,12 @@ public class HttpRedirectCfgService extends CrudService<WebsiteCfgDao,CfgIndexIn
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
|
||||
if(isValid==1) {
|
||||
entity.setIsAudit(1);
|
||||
entity.setIsValid(1);
|
||||
auditHttpCfg(entity, isValid,Constants.INSERT_ACTION);
|
||||
}
|
||||
}else{
|
||||
// 审核未通过状态的配置 修改后状态改为未审核
|
||||
entity.setIsValid(0);
|
||||
entity.setIsAudit(0);
|
||||
entity.setEditorId(UserUtils.getUser().getId());
|
||||
entity.setEditTime(new Date());
|
||||
websiteCfgDao.updateCfgIndex(entity);
|
||||
@@ -274,6 +284,11 @@ public class HttpRedirectCfgService extends CrudService<WebsiteCfgDao,CfgIndexIn
|
||||
areaIpCfgDao.saveAreaIpCfg(cfg);
|
||||
}
|
||||
}
|
||||
if(isValid==1) {
|
||||
entity.setIsAudit(1);
|
||||
entity.setIsValid(1);
|
||||
auditHttpCfg(entity, isValid,Constants.UPDATE_ACTION);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void updateHttpCfgValid(Integer isValid,String ids,Integer functionId){
|
||||
@@ -338,9 +353,12 @@ public class HttpRedirectCfgService extends CrudService<WebsiteCfgDao,CfgIndexIn
|
||||
}
|
||||
|
||||
}
|
||||
public void auditHttpCfg(CfgIndexInfo entity,Integer isAudit) throws MaatConvertException{
|
||||
public void auditHttpCfg(CfgIndexInfo entity,Integer isAudit,Integer opAction) throws MaatConvertException{
|
||||
//修改数据库审核状态信息
|
||||
entity.setTableName(CfgIndexInfo.getTablename());
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
websiteCfgDao.auditCfg(entity);
|
||||
|
||||
ToMaatBean maatBean = new ToMaatBean();
|
||||
@@ -515,7 +533,7 @@ public class HttpRedirectCfgService extends CrudService<WebsiteCfgDao,CfgIndexIn
|
||||
maatBean.setAuditTime(entity.getAuditTime());
|
||||
maatBean.setCreatorName(entity.getCurrentUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.INSERT_ACTION);
|
||||
maatBean.setOpAction(opAction);
|
||||
//调用服务接口下发配置数据
|
||||
String json=gsonToJson(maatBean);
|
||||
logger.info("http配置下发配置参数:"+json);
|
||||
|
||||
@@ -104,6 +104,11 @@ public class InterceptCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo>
|
||||
entity.setInterceptPktBinList(null);
|
||||
}
|
||||
|
||||
int isValid=0;
|
||||
if(!StringUtil.isEmpty(entity.getIsValid()) && entity.getIsValid()==1) {
|
||||
isValid=1;
|
||||
}
|
||||
|
||||
entity.setIsValid(0);
|
||||
entity.setIsAudit(0);
|
||||
|
||||
@@ -196,7 +201,11 @@ public class InterceptCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(isValid==1) {
|
||||
entity.setIsAudit(1);
|
||||
entity.setIsValid(1);
|
||||
auditInterceptIpCfg(entity, isValid,Constants.INSERT_ACTION);
|
||||
}
|
||||
}else{
|
||||
if(entity.getServiceId().equals(518)){//ip仿冒策略
|
||||
//保存IP仿冒池
|
||||
@@ -266,6 +275,12 @@ public class InterceptCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo>
|
||||
areaIpCfgDao.saveAreaIpCfg(cfg);
|
||||
}
|
||||
}
|
||||
|
||||
if(isValid==1) {
|
||||
entity.setIsAudit(1);
|
||||
entity.setIsValid(1);
|
||||
auditInterceptIpCfg(entity, isValid,Constants.UPDATE_ACTION);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
@@ -338,9 +353,12 @@ public class InterceptCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo>
|
||||
* @param isAudit
|
||||
* @throws MaatConvertException
|
||||
*/
|
||||
public void auditInterceptIpCfg(CfgIndexInfo entity,Integer isAudit) throws MaatConvertException{
|
||||
public void auditInterceptIpCfg(CfgIndexInfo entity,Integer isAudit,Integer opAction) throws MaatConvertException{
|
||||
//修改数据库审核状态信息
|
||||
entity.setTableName(CfgIndexInfo.getTablename());
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
websiteCfgDao.auditCfg(entity);
|
||||
|
||||
ToMaatBean maatBean = new ToMaatBean();
|
||||
@@ -552,7 +570,7 @@ public class InterceptCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo>
|
||||
maatBean.setAuditTime(entity.getAuditTime());
|
||||
maatBean.setCreatorName(entity.getCurrentUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.INSERT_ACTION);
|
||||
maatBean.setOpAction(opAction);
|
||||
//调用服务接口下发配置数据
|
||||
String json=gsonToJson(maatBean);
|
||||
logger.info("intercept IP/DNS 配置下发配置参数:"+json);
|
||||
|
||||
Reference in New Issue
Block a user