diff --git a/src/main/java/com/nis/util/Constants.java b/src/main/java/com/nis/util/Constants.java index 356931a1e..4c2ff5e96 100644 --- a/src/main/java/com/nis/util/Constants.java +++ b/src/main/java/com/nis/util/Constants.java @@ -447,6 +447,7 @@ public final class Constants { public static final String HTTP_REQ_HEAD_REGION = Configurations.getStringProperty("http_req_hdr_region","http_req_hdr"); public static final String HTTP_REQ_BODY_REGION = Configurations.getStringProperty("http_req_body_region","http_req_body"); public static final String HTTP_RES_HEAD_REGION = Configurations.getStringProperty("http_res_hdr_region","http_res_hdr"); + public static final String NTC_SUBSCRIBE_ID = Configurations.getStringProperty("ntc_subscribe_id","NTC_SUBSCRIBE_ID"); public static final String HTTP_RES_BODY_REGION = Configurations.getStringProperty("http_res_body_region","http_res_body"); public static final String HTTP_URL_REGION = Configurations.getStringProperty("http_url_region","http_url"); public static final String VOIP_IP_REGION = Configurations.getStringProperty("voip_ip","av_voip_ip"); diff --git a/src/main/java/com/nis/web/controller/configuration/ntc/MailCfgController.java b/src/main/java/com/nis/web/controller/configuration/ntc/MailCfgController.java index c08b5d2e3..bffad6486 100644 --- a/src/main/java/com/nis/web/controller/configuration/ntc/MailCfgController.java +++ b/src/main/java/com/nis/web/controller/configuration/ntc/MailCfgController.java @@ -28,6 +28,7 @@ import com.nis.domain.configuration.CfgIndexInfo; import com.nis.domain.configuration.ComplexkeywordCfg; import com.nis.domain.configuration.FileDigestCfg; import com.nis.domain.configuration.IpPortCfg; +import com.nis.domain.configuration.NtcSubscribeIdCfg; import com.nis.domain.maat.ToMaatResult; import com.nis.exceptions.MaatConvertException; import com.nis.util.ConfigServiceUtil; @@ -131,6 +132,15 @@ public class MailCfgController extends BaseController{ } } } + if(cfg.getNtcSubscribeIdCfgList()!=null){ + String cfgType = null; + for(NtcSubscribeIdCfg keyword:cfg.getNtcSubscribeIdCfgList()){ + if(!keyword.getCfgType().equals(cfgType)){ + tabList.add(new String[]{"2",keyword.getCfgType()}); + cfgType = keyword.getCfgType(); + } + } + } model.addAttribute("_cfg", cfg); model.addAttribute("index", index); model.addAttribute("tabList", tabList); diff --git a/src/main/java/com/nis/web/controller/configuration/ntc/WebsiteController.java b/src/main/java/com/nis/web/controller/configuration/ntc/WebsiteController.java index c8f2561f9..2f58cd72e 100644 --- a/src/main/java/com/nis/web/controller/configuration/ntc/WebsiteController.java +++ b/src/main/java/com/nis/web/controller/configuration/ntc/WebsiteController.java @@ -32,6 +32,7 @@ import com.nis.domain.configuration.HttpReqHeadCfg; import com.nis.domain.configuration.HttpResHeadCfg; import com.nis.domain.configuration.HttpUrlCfg; import com.nis.domain.configuration.IpPortCfg; +import com.nis.domain.configuration.NtcSubscribeIdCfg; import com.nis.exceptions.MaatConvertException; import com.nis.util.Constants; import com.nis.util.excel.ImportExcel; @@ -91,13 +92,18 @@ public class WebsiteController extends BaseController{ HttpBodyCfg resBodyCfg = new HttpBodyCfg(); resBodyCfg.setCfgType(Constants.HTTP_RES_BODY_REGION); entity.setHttpResBody(resBodyCfg); + NtcSubscribeIdCfg subscribeId = new NtcSubscribeIdCfg(); + subscribeId.setCfgType(Constants.NTC_SUBSCRIBE_ID); + entity.setNtcSubscribeIdCfg(subscribeId); int httpReqCfgNum = entity.getIpPortList().size()+ entity.getHttpUrlList().size()+ entity.getHttpReqBodyList().size()+ - entity.getHttpReqHdrList().size(); + entity.getHttpReqHdrList().size()+ + entity.getNtcSubscribeIdCfgList().size(); int httpResCfgNum = entity.getHttpResHdrList().size()+ - entity.getHttpResBodyList().size(); + entity.getHttpResBodyList().size()+ + entity.getNtcSubscribeIdCfgList().size(); model.addAttribute("httpReqCfgNum", httpReqCfgNum); model.addAttribute("httpResCfgNum", httpResCfgNum); if(entity.getIpPortList().size()==0){ @@ -118,6 +124,9 @@ public class WebsiteController extends BaseController{ if(entity.getHttpResBodyList().size()==0){ entity.getHttpResBodyList().add(resBodyCfg); } + if(entity.getNtcSubscribeIdCfgList().size()==0){ + entity.getNtcSubscribeIdCfgList().add(subscribeId); + } initUpdateFormCondition(model,entity); }else{ //设置http各类配置的配置域类型 @@ -139,6 +148,9 @@ public class WebsiteController extends BaseController{ HttpBodyCfg resBodyCfg = new HttpBodyCfg(); resBodyCfg.setCfgType(Constants.HTTP_RES_BODY_REGION); entity.setHttpResBody(resBodyCfg); + NtcSubscribeIdCfg subscribeIdCfg = new NtcSubscribeIdCfg(); + subscribeIdCfg.setCfgType(Constants.NTC_SUBSCRIBE_ID); + entity.setNtcSubscribeIdCfg(subscribeIdCfg); List ipList=new ArrayList(); ipList.add(ipCfg); @@ -158,6 +170,9 @@ public class WebsiteController extends BaseController{ List resBodyList=new ArrayList(); resBodyList.add(resBodyCfg); entity.setHttpResBodyList(resBodyList); + List subscribeIdList=new ArrayList(); + subscribeIdList.add(subscribeIdCfg); + entity.setNtcSubscribeIdCfgList(subscribeIdList); initFormCondition(model,entity); } @@ -257,6 +272,15 @@ public class WebsiteController extends BaseController{ } } } + if(cfg.getNtcSubscribeIdCfgList()!=null){ + String cfgType = null; + for(NtcSubscribeIdCfg keyword:cfg.getNtcSubscribeIdCfgList()){ + if(!keyword.getCfgType().equals(cfgType)){ + tabList.add(new String[]{"2",keyword.getCfgType()}); + cfgType = keyword.getCfgType(); + } + } + } model.addAttribute("_cfg", cfg); model.addAttribute("index", index); model.addAttribute("tabList", tabList); @@ -334,6 +358,15 @@ public class WebsiteController extends BaseController{ } } } + if(cfg.getNtcSubscribeIdCfgList()!=null){ + String cfgType = null; + for(NtcSubscribeIdCfg keyword:cfg.getNtcSubscribeIdCfgList()){ + if(!keyword.getCfgType().equals(cfgType)){ + tabList.add(new String[]{"2",keyword.getCfgType()}); + cfgType = keyword.getCfgType(); + } + } + } model.addAttribute("_cfg", cfg); model.addAttribute("index", index); model.addAttribute("tabList", tabList); diff --git a/src/main/java/com/nis/web/dao/configuration/AvContentCfgDao.java b/src/main/java/com/nis/web/dao/configuration/AvContentCfgDao.java index 4aaa6b797..b4c568a31 100644 --- a/src/main/java/com/nis/web/dao/configuration/AvContentCfgDao.java +++ b/src/main/java/com/nis/web/dao/configuration/AvContentCfgDao.java @@ -9,7 +9,6 @@ import com.nis.domain.configuration.AvVoipIpCfg; import com.nis.domain.configuration.BaseIpCfg; import com.nis.domain.configuration.BaseStringCfg; import com.nis.domain.configuration.CfgIndexInfo; -import com.nis.domain.configuration.NtcSubscribeIdCfg; import com.nis.web.dao.MyBatisDao; @@ -19,7 +18,6 @@ public interface AvContentCfgDao { public List findAccountList(CfgIndexInfo entity) ; public List findVoipIpCfgList(CfgIndexInfo entity); public List findVoipAccountCfgList(CfgIndexInfo entity); - public List findSubscribeIdCfgList(CfgIndexInfo entity); public CfgIndexInfo getCfgIndexInfo(CfgIndexInfo entity); public void insertCfgIndexInfo(CfgIndexInfo entity); @@ -33,7 +31,6 @@ public interface AvContentCfgDao { public void updateAvVoipKeywordCfgt(CfgIndexInfo entity); public void deleteAvVoipIp(CfgIndexInfo entity); - public void deleteAvVoipKeywordCfg(CfgIndexInfo entity); public void deleteAvVoipAccountCfg(CfgIndexInfo entity); public BaseIpCfg findIpCfgById(BaseIpCfg entity) ; diff --git a/src/main/java/com/nis/web/dao/configuration/StringCfgDao.java b/src/main/java/com/nis/web/dao/configuration/StringCfgDao.java index d7186be30..c17db24b8 100644 --- a/src/main/java/com/nis/web/dao/configuration/StringCfgDao.java +++ b/src/main/java/com/nis/web/dao/configuration/StringCfgDao.java @@ -5,6 +5,7 @@ import java.util.List; import org.apache.ibatis.annotations.Param; import com.nis.domain.configuration.BaseStringCfg; +import com.nis.domain.configuration.CfgIndexInfo; import com.nis.domain.configuration.NtcSubscribeIdCfg; import com.nis.web.dao.CrudDao; import com.nis.web.dao.MyBatisDao; @@ -41,7 +42,8 @@ public interface StringCfgDao extends CrudDao{ * @since 1.0.0 */ public void deleteByCompileIds(@Param("user")long user,@Param("tableName")String tableName,@Param("compileIds")String compileIds); - + public List findSubscribeIdCfgListByCfgIndexInfo(CfgIndexInfo entity); + public void deleteSubscribeIdCfgByCfgIndexInfo(CfgIndexInfo entity); public List findSubscribeIdCfgList(NtcSubscribeIdCfg ntcSubscribeIdCfg); public void saveSubscribeIdCfg(NtcSubscribeIdCfg ntcSubscribeIdCfg); public void updateSubscribeIdCfg(NtcSubscribeIdCfg ntcSubscribeIdCfg); diff --git a/src/main/java/com/nis/web/dao/configuration/StringCfgDao.xml b/src/main/java/com/nis/web/dao/configuration/StringCfgDao.xml index 08c42a5e2..2d375284e 100644 --- a/src/main/java/com/nis/web/dao/configuration/StringCfgDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/StringCfgDao.xml @@ -65,7 +65,6 @@ - CFG_ID, CFG_DESC, CFG_KEYWORDS,CFG_TYPE,ACTION,IS_VALID,IS_AUDIT, CREATOR_ID,CREATE_TIME,EDITOR_ID,EDIT_TIME,AUDITOR_ID,AUDIT_TIME, @@ -518,6 +517,9 @@ from ntc_subscribe_id_cfg r + + and r.FUNCTION_ID=#{fucntionId,jdbcType=INTEGER} + and r.COMPILE_ID=#{compileId,jdbcType=INTEGER} @@ -690,5 +692,44 @@ + + + + + + delete from ntc_subscribe_id_cfg + + + and cfg_id = #{ntcSubscribeIdCfg.cfgId,jdbcType=INTEGER} + + + and compile_id = #{compileId,jdbcType=INTEGER} + + + and function_id = #{functionId,jdbcType=INTEGER} + + + \ No newline at end of file diff --git a/src/main/java/com/nis/web/service/configuration/AvContentCfgService.java b/src/main/java/com/nis/web/service/configuration/AvContentCfgService.java index fcb7e015e..dc1b5d1d3 100644 --- a/src/main/java/com/nis/web/service/configuration/AvContentCfgService.java +++ b/src/main/java/com/nis/web/service/configuration/AvContentCfgService.java @@ -107,7 +107,7 @@ public class AvContentCfgService extends BaseService{ * @return */ public List getSubscribeIdCfgList(CfgIndexInfo entity) { - return avContentCfgDao.findSubscribeIdCfgList(entity); + return stringCfgDao.findSubscribeIdCfgListByCfgIndexInfo(entity); } /** * 根据索引表信息获取voipAccountCfg信息 @@ -198,7 +198,7 @@ public class AvContentCfgService extends BaseService{ avContentCfgDao.updateCfgIndexInfo(entity); //无效子配置后,再新增子配置 avContentCfgDao.deleteAvVoipIp(entity); - avContentCfgDao.deleteAvVoipKeywordCfg(entity); + stringCfgDao.deleteSubscribeIdCfgByCfgIndexInfo(entity); AreaIpCfg area = new AreaIpCfg(); area.setCompileId(entity.getCompileId()); area.setFunctionId(entity.getFunctionId()); @@ -280,7 +280,7 @@ public class AvContentCfgService extends BaseService{ entity.setEditorId(entity.getCurrentUser().getId()); avContentCfgDao.updateCfgIndexInfo(entity); //无效子配置后,再新增子配置 - avContentCfgDao.deleteAvVoipKeywordCfg(entity); + stringCfgDao.deleteSubscribeIdCfgByCfgIndexInfo(entity); avContentCfgDao.deleteAvVoipAccountCfg(entity); AreaIpCfg area = new AreaIpCfg(); area.setCompileId(entity.getCompileId()); @@ -398,7 +398,7 @@ public class AvContentCfgService extends BaseService{ areaIpCfgDao.updateAreaIpCfg(areaIpCfg); voipIpList=avContentCfgDao.findVoipIpCfgList(entity); - ntcList=avContentCfgDao.findSubscribeIdCfgList(entity); + ntcList=stringCfgDao.findSubscribeIdCfgListByCfgIndexInfo(entity); areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId()); ToMaatBean maatBean = new ToMaatBean(); @@ -511,7 +511,7 @@ public class AvContentCfgService extends BaseService{ BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode","cfgType","cfgId"}); areaIpCfgDao.updateAreaIpCfg(areaIpCfg); - ntcList=avContentCfgDao.findSubscribeIdCfgList(entity); + ntcList=stringCfgDao.findSubscribeIdCfgListByCfgIndexInfo(entity); accountList=avContentCfgDao.findVoipAccountCfgList(entity); areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId()); diff --git a/src/main/java/com/nis/web/service/configuration/MailCfgService.java b/src/main/java/com/nis/web/service/configuration/MailCfgService.java index 245446384..6d359fe36 100644 --- a/src/main/java/com/nis/web/service/configuration/MailCfgService.java +++ b/src/main/java/com/nis/web/service/configuration/MailCfgService.java @@ -22,6 +22,7 @@ import com.nis.domain.configuration.ComplexkeywordCfg; import com.nis.domain.configuration.FileDigestCfg; import com.nis.domain.configuration.IpPortCfg; import com.nis.domain.configuration.MailKeywordCfg; +import com.nis.domain.configuration.NtcSubscribeIdCfg; import com.nis.domain.maat.MaatCfg; import com.nis.domain.maat.ToMaatBean; import com.nis.domain.maat.ToMaatResult; @@ -37,6 +38,7 @@ import com.nis.util.FileUtils; import com.nis.util.JsonMapper; import com.nis.web.dao.configuration.AreaIpCfgDao; import com.nis.web.dao.configuration.MailCfgDao; +import com.nis.web.dao.configuration.StringCfgDao; import com.nis.web.security.UserUtils; import com.nis.web.service.CrudService; @@ -51,6 +53,10 @@ public class MailCfgService extends CrudService { protected MailCfgDao mailCfgDao; @Autowired protected AreaIpCfgDao areaIpCfgDao; + @Autowired + protected StringCfgDao stringCfgDao; + + public Page getMailList(Page page, CfgIndexInfo entity){ // 生成数据权限过滤条件(dsf为dataScopeFilter的简写,在xml中使用 ${sqlMap.dsf}调用权限SQL) entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"a")); @@ -65,9 +71,11 @@ public class MailCfgService extends CrudService { List keywordList = mailCfgDao.getMailKeywordList(entity); List digestList = mailCfgDao.getMailFileDigestList(entity); List areaCfg = areaIpCfgDao.getByCompileId(entity.getCompileId()); + List ntcSubscribeIdList = stringCfgDao.findSubscribeIdCfgListByCfgIndexInfo(entity); entity.setIpPortList(ipPortList); entity.setComplexList(keywordList); entity.setDigestList(digestList); + entity.setNtcSubscribeIdCfgList(ntcSubscribeIdList); entity.setAreaCfg(areaCfg); return entity; } @@ -79,6 +87,10 @@ public class MailCfgService extends CrudService { public void saveMailCfg(CfgIndexInfo entity,ToMaatResult result){ //设置区域运营商信息 setAreaEffectiveIds(entity); + + entity.setIsValid(0); + entity.setIsAudit(0); + if(entity.getCfgId()==null){ Integer compileId = 0; try { @@ -86,58 +98,67 @@ public class MailCfgService extends CrudService { if(idList!=null && idList.size()>0){ compileId = idList.get(0); } - entity.setCompileId(compileId); - entity.setCreateTime(new Date()); - entity.setCreatorId(entity.getCurrentUser().getId()); - mailCfgDao.saveCfgIndex(entity); - if(entity.getIpPortList()!=null){ - for(IpPortCfg cfg:entity.getIpPortList()){ - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); - mailCfgDao.saveIpPortCfg(cfg); - } - } - if(entity.getComplexList()!=null){ - for(ComplexkeywordCfg cfg:entity.getComplexList()){ - if(StringUtils.isNotBlank(cfg.getCfgKeywords())){ - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); - if(StringUtils.isNoneBlank(cfg.getDistrictShowName()) && cfg.getDistrict().equals("others")){ - cfg.setDistrict(cfg.getDistrictShowName()); - } - mailCfgDao.saveMailKeywordCfg(cfg); - } - } - } - if(entity.getDigestList()!=null){ - for(FileDigestCfg cfg:entity.getDigestList()){ - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); - if(result!=null && result.getData()!=null){ - cfg.setRawLen(result.getData().getRawLen()); - cfg.setDigest(result.getData().getDigest()); - cfg.setFileUrl(result.getData().getAccessUrl()); - } - mailCfgDao.saveMailFileDigestCfg(cfg); - } - } - //保存区域IP信息 - if(entity.getAreaCfg()!=null){ - for(AreaIpCfg cfg:entity.getAreaCfg()){ - cfg.initDefaultValue(); - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); - areaIpCfgDao.saveAreaIpCfg(cfg); - } - } - } catch (Exception e) { - e.printStackTrace(); + } catch (MaatConvertException e) { logger.info("获取编译ID出错"); - throw new MaatConvertException(":"+e.getMessage()); + throw new MaatConvertException(""); + } + entity.setCompileId(compileId); + entity.setCreateTime(new Date()); + entity.setCreatorId(entity.getCurrentUser().getId()); + mailCfgDao.saveCfgIndex(entity); + if(entity.getIpPortList()!=null){ + for(IpPortCfg cfg:entity.getIpPortList()){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + mailCfgDao.saveIpPortCfg(cfg); + } + } + if(entity.getComplexList()!=null){ + for(ComplexkeywordCfg cfg:entity.getComplexList()){ + if(StringUtils.isNotBlank(cfg.getCfgKeywords())){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + if(StringUtils.isNoneBlank(cfg.getDistrictShowName()) && cfg.getDistrict().equals("others")){ + cfg.setDistrict(cfg.getDistrictShowName()); + } + mailCfgDao.saveMailKeywordCfg(cfg); + } + } + } + if(entity.getDigestList()!=null){ + for(FileDigestCfg cfg:entity.getDigestList()){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + if(result!=null && result.getData()!=null){ + cfg.setRawLen(result.getData().getRawLen()); + cfg.setDigest(result.getData().getDigest()); + cfg.setFileUrl(result.getData().getAccessUrl()); + } + mailCfgDao.saveMailFileDigestCfg(cfg); + } } + if(entity.getNtcSubscribeIdCfgList()!=null){ + for(NtcSubscribeIdCfg cfg:entity.getNtcSubscribeIdCfgList()){ + if(StringUtils.isNotBlank(cfg.getCfgKeywords())){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + stringCfgDao.saveSubscribeIdCfg(cfg); + } + } + } + + //保存区域IP信息 + if(entity.getAreaCfg()!=null){ + for(AreaIpCfg cfg:entity.getAreaCfg()){ + cfg.initDefaultValue(); + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + areaIpCfgDao.saveAreaIpCfg(cfg); + } + } }else{ mailCfgDao.updateCfgIndex(entity); //无效子配置后,再新增子配置 mailCfgDao.deleteMailIpCfg(entity); mailCfgDao.deleteMailKeywordCfg(entity); mailCfgDao.deleteMailFileDigestCfg(entity); + stringCfgDao.deleteSubscribeIdCfgByCfgIndexInfo(entity); AreaIpCfg area = new AreaIpCfg(); area.setCompileId(entity.getCompileId()); area.setFunctionId(entity.getFunctionId()); @@ -172,6 +193,14 @@ public class MailCfgService extends CrudService { mailCfgDao.saveMailFileDigestCfg(cfg); } } + if(entity.getNtcSubscribeIdCfgList()!=null){ + for(NtcSubscribeIdCfg cfg:entity.getNtcSubscribeIdCfgList()){ + if(StringUtils.isNotBlank(cfg.getCfgKeywords())){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + stringCfgDao.saveSubscribeIdCfg(cfg); + } + } + } //保存区域IP信息 if(entity.getAreaCfg()!=null){ for(AreaIpCfg cfg:entity.getAreaCfg()){ @@ -208,6 +237,13 @@ public class MailCfgService extends CrudService { cfg.setTableName(MailKeywordCfg.getTablename()); mailCfgDao.updateCfgValid(cfg); } + if(entity.getNtcSubscribeIdCfgList()!=null && entity.getNtcSubscribeIdCfgList().size()>0) + { + NtcSubscribeIdCfg cfg = new NtcSubscribeIdCfg(); + BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + cfg.setTableName(NtcSubscribeIdCfg.getTablename()); + mailCfgDao.updateCfgValid(cfg); + } //保存区域IP信息 if(entity.getAreaCfg()!=null && entity.getAreaCfg().size()>0){ AreaIpCfg cfg = new AreaIpCfg(); @@ -272,6 +308,19 @@ public class MailCfgService extends CrudService { digestRegionList=map.get("dstList"); } } + + if(entity.getNtcSubscribeIdCfgList()!=null && entity.getNtcSubscribeIdCfgList().size()>0){ + NtcSubscribeIdCfg cfg = new NtcSubscribeIdCfg(); + BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + cfg.setTableName(NtcSubscribeIdCfg.getTablename()); + mailCfgDao.auditCfg(cfg); + if(isAudit==1){ + Map map = cfgConvert(strRegionList,entity.getNtcSubscribeIdCfgList(),2,entity,groupRelationList); + groupRelationList=map.get("groupList"); + strRegionList=map.get("dstList"); + } + } + //保存区域IP信息 if(entity.getAreaCfg()!=null && entity.getAreaCfg().size()>0){ AreaIpCfg cfg = new AreaIpCfg(); diff --git a/src/main/java/com/nis/web/service/configuration/WebsiteCfgService.java b/src/main/java/com/nis/web/service/configuration/WebsiteCfgService.java index e02d7d9c0..af7332b89 100644 --- a/src/main/java/com/nis/web/service/configuration/WebsiteCfgService.java +++ b/src/main/java/com/nis/web/service/configuration/WebsiteCfgService.java @@ -1,29 +1,17 @@ package com.nis.web.service.configuration; -import java.beans.PropertyDescriptor; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; import java.util.ArrayList; -import java.util.Arrays; import java.util.Date; -import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; -import org.springframework.beans.BeansException; -import org.springframework.beans.FatalBeanException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import org.springframework.util.Assert; -import org.springframework.util.ClassUtils; import com.nis.domain.Page; import com.nis.domain.configuration.AreaIpCfg; -import com.nis.domain.configuration.AvFileSampleCfg; -import com.nis.domain.configuration.AvSignSampleCfg; -import com.nis.domain.configuration.BaseIpCfg; import com.nis.domain.configuration.BaseStringCfg; import com.nis.domain.configuration.CfgIndexInfo; import com.nis.domain.configuration.ComplexkeywordCfg; @@ -33,6 +21,7 @@ import com.nis.domain.configuration.HttpReqHeadCfg; import com.nis.domain.configuration.HttpResHeadCfg; import com.nis.domain.configuration.HttpUrlCfg; import com.nis.domain.configuration.IpPortCfg; +import com.nis.domain.configuration.NtcSubscribeIdCfg; import com.nis.domain.configuration.SslKeywordCfg; import com.nis.domain.maat.MaatCfg; import com.nis.domain.maat.MaatCfg.NumBoundaryCfg; @@ -46,14 +35,11 @@ import com.nis.exceptions.MaatConvertException; import com.nis.util.ConfigServiceUtil; import com.nis.util.Constants; import com.nis.util.DictUtils; -import com.nis.util.IpUtil; import com.nis.util.StringUtil; import com.nis.web.dao.configuration.AreaIpCfgDao; -import com.nis.web.dao.configuration.IpCfgDao; import com.nis.web.dao.configuration.StringCfgDao; import com.nis.web.dao.configuration.WebsiteCfgDao; import com.nis.web.security.UserUtils; -import com.nis.web.service.BaseService; import com.nis.web.service.CrudService; /** @@ -67,6 +53,8 @@ public class WebsiteCfgService extends CrudService { protected WebsiteCfgDao websiteCfgDao; @Autowired protected AreaIpCfgDao areaIpCfgDao; + @Autowired + protected StringCfgDao stringCfgDao; public CfgIndexInfo getHttpCfg(Long cfgId){ CfgIndexInfo entity = websiteCfgDao.getCfgIndexInfo(cfgId); @@ -74,6 +62,7 @@ public class WebsiteCfgService extends CrudService { List httpUrlList = websiteCfgDao.getHttpUrlList(entity); List httpReqHdrList = websiteCfgDao.getHttpReqHdrList(entity); List httpResHdrList = websiteCfgDao.getHttpResHdrList(entity); + List subscribeIdList = stringCfgDao.findSubscribeIdCfgListByCfgIndexInfo(entity); entity.setCfgType(Constants.HTTP_REQ_BODY_REGION); List httpReqBodyList = websiteCfgDao.getHttpReqBodyList(entity); entity.setCfgType(Constants.HTTP_RES_BODY_REGION); @@ -84,13 +73,16 @@ public class WebsiteCfgService extends CrudService { entity.setHttpResBodyList(httpResBodyList); entity.setHttpResHdrList(httpResHdrList); entity.setHttpUrlList(httpUrlList); + entity.setNtcSubscribeIdCfgList(subscribeIdList); return entity; } public CfgIndexInfo getSslCfg(Long cfgId){ CfgIndexInfo entity = websiteCfgDao.getCfgIndexInfo(cfgId); List ipPortList = websiteCfgDao.getIpPortList(entity); List sslList = websiteCfgDao.getSslKewordList(entity); + List subscribeIdList = stringCfgDao.findSubscribeIdCfgListByCfgIndexInfo(entity); entity.setIpPortList(ipPortList); + entity.setNtcSubscribeIdCfgList(subscribeIdList); entity.setSslList(sslList); return entity; } @@ -98,8 +90,10 @@ public class WebsiteCfgService extends CrudService { CfgIndexInfo entity = websiteCfgDao.getCfgIndexInfo(cfgId); List ipPortList = websiteCfgDao.getIpPortList(entity); List domainList = websiteCfgDao.getDnsDomainList(entity); + List subscribeIdList = stringCfgDao.findSubscribeIdCfgListByCfgIndexInfo(entity); entity.setIpPortList(ipPortList); entity.setDomainList(domainList); + entity.setNtcSubscribeIdCfgList(subscribeIdList); return entity; } public Page getWebsiteList(Page page, CfgIndexInfo entity){ @@ -113,6 +107,10 @@ public class WebsiteCfgService extends CrudService { public void saveHttpCfg(CfgIndexInfo entity){ //设置区域运营商信息 setAreaEffectiveIds(entity); + + entity.setIsValid(0); + entity.setIsAudit(0); + if(entity.getCfgId()==null){ Integer compileId = 0; try { @@ -120,64 +118,69 @@ public class WebsiteCfgService extends CrudService { if(idList!=null && idList.size()>0){ compileId = idList.get(0); } - entity.setCompileId(compileId); - entity.setCreateTime(new Date()); - entity.setCreatorId(entity.getCurrentUser().getId()); - websiteCfgDao.saveCfgIndex(entity); - if(entity.getIpPortList()!=null){ - for(IpPortCfg cfg:entity.getIpPortList()){ - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); - websiteCfgDao.saveIpPortCfg(cfg); - } - } - if(entity.getHttpUrlList()!=null){ - for(HttpUrlCfg cfg:entity.getHttpUrlList()){ - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); - websiteCfgDao.saveHttpUrlCfg(cfg); - } - } - if(entity.getHttpReqHdrList()!=null){ - for(HttpReqHeadCfg cfg:entity.getHttpReqHdrList()){ - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); - if(StringUtils.isNoneBlank(cfg.getDistrictShowName()) && cfg.getDistrict().equals("others")){ - cfg.setDistrict(cfg.getDistrictShowName()); - } - websiteCfgDao.saveHttpReqHdrCfg(cfg); - } - } - if(entity.getHttpResHdrList()!=null){ - for(HttpResHeadCfg cfg:entity.getHttpResHdrList()){ - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); - if(StringUtils.isNoneBlank(cfg.getDistrictShowName()) && cfg.getDistrict().equals("others")){ - cfg.setDistrict(cfg.getDistrictShowName()); - } - websiteCfgDao.saveHttpResHdrCfg(cfg); - } - } - if(entity.getHttpReqBodyList()!=null){ - for(HttpBodyCfg cfg:entity.getHttpReqBodyList()){ - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); - websiteCfgDao.saveHttpBodyCfg(cfg); - } - } - if(entity.getHttpResBodyList()!=null){ - for(HttpBodyCfg cfg:entity.getHttpResBodyList()){ - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); - websiteCfgDao.saveHttpBodyCfg(cfg); - } - } - //保存区域IP信息 - if(entity.getAreaCfg()!=null){ - for(AreaIpCfg cfg:entity.getAreaCfg()){ - cfg.initDefaultValue(); - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); - areaIpCfgDao.saveAreaIpCfg(cfg); - } - } - } catch (Exception e) { - e.printStackTrace(); + } catch (MaatConvertException e) { logger.info("获取编译ID出错"); - throw new MaatConvertException(":"+e.getMessage()); + throw new MaatConvertException(""); + } + entity.setCompileId(compileId); + entity.setCreateTime(new Date()); + entity.setCreatorId(entity.getCurrentUser().getId()); + websiteCfgDao.saveCfgIndex(entity); + if(entity.getIpPortList()!=null){ + for(IpPortCfg cfg:entity.getIpPortList()){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + websiteCfgDao.saveIpPortCfg(cfg); + } + } + if(entity.getHttpUrlList()!=null){ + for(HttpUrlCfg cfg:entity.getHttpUrlList()){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + websiteCfgDao.saveHttpUrlCfg(cfg); + } + } + if(entity.getHttpReqHdrList()!=null){ + for(HttpReqHeadCfg cfg:entity.getHttpReqHdrList()){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + if(StringUtils.isNoneBlank(cfg.getDistrictShowName()) && cfg.getDistrict().equals("others")){ + cfg.setDistrict(cfg.getDistrictShowName()); + } + websiteCfgDao.saveHttpReqHdrCfg(cfg); + } + } + if(entity.getHttpResHdrList()!=null){ + for(HttpResHeadCfg cfg:entity.getHttpResHdrList()){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + if(StringUtils.isNoneBlank(cfg.getDistrictShowName()) && cfg.getDistrict().equals("others")){ + cfg.setDistrict(cfg.getDistrictShowName()); + } + websiteCfgDao.saveHttpResHdrCfg(cfg); + } + } + if(entity.getHttpReqBodyList()!=null){ + for(HttpBodyCfg cfg:entity.getHttpReqBodyList()){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + websiteCfgDao.saveHttpBodyCfg(cfg); + } + } + if(entity.getHttpResBodyList()!=null){ + for(HttpBodyCfg cfg:entity.getHttpResBodyList()){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + websiteCfgDao.saveHttpBodyCfg(cfg); + } + } + if(entity.getNtcSubscribeIdCfgList()!=null){ + for(NtcSubscribeIdCfg cfg:entity.getNtcSubscribeIdCfgList()){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + stringCfgDao.saveSubscribeIdCfg(cfg); + } + } + //保存区域IP信息 + if(entity.getAreaCfg()!=null){ + for(AreaIpCfg cfg:entity.getAreaCfg()){ + cfg.initDefaultValue(); + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + areaIpCfgDao.saveAreaIpCfg(cfg); + } } }else{ @@ -188,6 +191,7 @@ public class WebsiteCfgService extends CrudService { websiteCfgDao.deleteHttpReqHdrCfg(entity); websiteCfgDao.deleteHttpResHdrCfg(entity); websiteCfgDao.deleteHttpBodyCfg(entity); + stringCfgDao.deleteSubscribeIdCfgByCfgIndexInfo(entity); AreaIpCfg area = new AreaIpCfg(); area.setCompileId(entity.getCompileId()); area.setFunctionId(entity.getFunctionId()); @@ -236,6 +240,12 @@ public class WebsiteCfgService extends CrudService { websiteCfgDao.saveHttpBodyCfg(cfg); } } + if(entity.getNtcSubscribeIdCfgList()!=null){ + for(NtcSubscribeIdCfg cfg:entity.getNtcSubscribeIdCfgList()){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + stringCfgDao.saveSubscribeIdCfg(cfg); + } + } //保存区域IP信息 if(entity.getAreaCfg()!=null){ for(AreaIpCfg cfg:entity.getAreaCfg()){ @@ -290,6 +300,12 @@ public class WebsiteCfgService extends CrudService { cfg.setTableName(HttpBodyCfg.getTablename()); websiteCfgDao.updateCfgValid(cfg); } + if(entity.getNtcSubscribeIdCfgList()!=null && entity.getNtcSubscribeIdCfgList().size()>0){ + NtcSubscribeIdCfg cfg = new NtcSubscribeIdCfg(); + BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + cfg.setTableName(NtcSubscribeIdCfg.getTablename()); + websiteCfgDao.updateCfgValid(cfg); + } //保存区域IP信息 if(entity.getAreaCfg()!=null && entity.getAreaCfg().size()>0){ AreaIpCfg cfg = new AreaIpCfg(); @@ -384,6 +400,17 @@ public class WebsiteCfgService extends CrudService { } } } + if(entity.getNtcSubscribeIdCfgList()!=null && entity.getNtcSubscribeIdCfgList().size()>0){ + NtcSubscribeIdCfg cfg = new NtcSubscribeIdCfg(); + BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + cfg.setTableName(NtcSubscribeIdCfg.getTablename()); + websiteCfgDao.auditCfg(cfg); + if(isAudit==1){ + Map map = cfgConvert(strRegionList,entity.getNtcSubscribeIdCfgList(),2,entity,groupRelationList); + groupRelationList=map.get("groupList"); + strRegionList=map.get("dstList"); + } + } //保存区域IP信息 List areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId()); if(!StringUtil.isEmpty(areaIpCfgList)){ @@ -482,6 +509,10 @@ public class WebsiteCfgService extends CrudService { public void saveSslCfg(CfgIndexInfo entity){ //设置区域运营商信息 setAreaEffectiveIds(entity); + + entity.setIsValid(0); + entity.setIsAudit(0); + if(entity.getCfgId()==null){ Integer compileId = 0; try { @@ -489,36 +520,43 @@ public class WebsiteCfgService extends CrudService { if(idList!=null && idList.size()>0){ compileId = idList.get(0); } - entity.setCompileId(compileId); - entity.setCreateTime(new Date()); - entity.setCreatorId(entity.getCurrentUser().getId()); - websiteCfgDao.saveCfgIndex(entity); - if(entity.getIpPortList()!=null){ - for(IpPortCfg cfg:entity.getIpPortList()){ - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); - websiteCfgDao.saveIpPortCfg(cfg); - } - } - if(entity.getSslList()!=null){ - for(BaseStringCfg cfg:entity.getSslList()){ - if(StringUtils.isNotBlank(cfg.getCfgKeywords())){ - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); - websiteCfgDao.saveSslKeywordCfg(cfg); - } - } - } - //保存区域IP信息 - if(entity.getAreaCfg()!=null){ - for(AreaIpCfg cfg:entity.getAreaCfg()){ - cfg.initDefaultValue(); - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); - areaIpCfgDao.saveAreaIpCfg(cfg); - } - } - } catch (Exception e) { - e.printStackTrace(); + } catch (MaatConvertException e) { logger.info("获取编译ID出错"); - throw new MaatConvertException(":"+e.getMessage()); + throw new MaatConvertException(""); + } + entity.setCompileId(compileId); + entity.setCreateTime(new Date()); + entity.setCreatorId(entity.getCurrentUser().getId()); + websiteCfgDao.saveCfgIndex(entity); + if(entity.getIpPortList()!=null){ + for(IpPortCfg cfg:entity.getIpPortList()){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + websiteCfgDao.saveIpPortCfg(cfg); + } + } + if(entity.getSslList()!=null){ + for(BaseStringCfg cfg:entity.getSslList()){ + if(StringUtils.isNotBlank(cfg.getCfgKeywords())){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + websiteCfgDao.saveSslKeywordCfg(cfg); + } + } + } + if(entity.getSslList()!=null){ + for(NtcSubscribeIdCfg cfg:entity.getNtcSubscribeIdCfgList()){ + if(StringUtils.isNotBlank(cfg.getCfgKeywords())){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + stringCfgDao.saveSubscribeIdCfg(cfg); + } + } + } + //保存区域IP信息 + if(entity.getAreaCfg()!=null){ + for(AreaIpCfg cfg:entity.getAreaCfg()){ + cfg.initDefaultValue(); + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + areaIpCfgDao.saveAreaIpCfg(cfg); + } } }else{ @@ -526,6 +564,7 @@ public class WebsiteCfgService extends CrudService { //无效子配置后,再新增子配置 websiteCfgDao.deleteSslIpCfg(entity); websiteCfgDao.deleteSslKeywordCfg(entity); + stringCfgDao.deleteSubscribeIdCfgByCfgIndexInfo(entity); AreaIpCfg area = new AreaIpCfg(); area.setCompileId(entity.getCompileId()); area.setFunctionId(entity.getFunctionId()); @@ -546,6 +585,14 @@ public class WebsiteCfgService extends CrudService { } } } + if(entity.getNtcSubscribeIdCfgList()!=null){ + for(NtcSubscribeIdCfg cfg:entity.getNtcSubscribeIdCfgList()){ + if(StringUtils.isNotBlank(cfg.getCfgKeywords())){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + stringCfgDao.saveSubscribeIdCfg(cfg); + } + } + } //保存区域IP信息 if(entity.getAreaCfg()!=null){ for(AreaIpCfg cfg:entity.getAreaCfg()){ @@ -582,6 +629,13 @@ public class WebsiteCfgService extends CrudService { cfg.setTableName(SslKeywordCfg.getTablename()); websiteCfgDao.updateCfgValid(cfg); } + if(entity.getNtcSubscribeIdCfgList()!=null && entity.getNtcSubscribeIdCfgList().size()>0) + { + NtcSubscribeIdCfg cfg = new NtcSubscribeIdCfg(); + BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + cfg.setTableName(NtcSubscribeIdCfg.getTablename()); + websiteCfgDao.updateCfgValid(cfg); + } //保存区域IP信息 if(entity.getAreaCfg()!=null && entity.getAreaCfg().size()>0){ AreaIpCfg cfg = new AreaIpCfg(); @@ -635,6 +689,17 @@ public class WebsiteCfgService extends CrudService { strRegionList=map.get("dstList"); } } + if(entity.getNtcSubscribeIdCfgList()!=null && entity.getNtcSubscribeIdCfgList().size()>0){ + NtcSubscribeIdCfg cfg = new NtcSubscribeIdCfg(); + BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + cfg.setTableName(NtcSubscribeIdCfg.getTablename()); + websiteCfgDao.auditCfg(cfg); + if(isAudit==1){ + Map map = cfgConvert(strRegionList,entity.getNtcSubscribeIdCfgList(),2,entity,groupRelationList); + groupRelationList=map.get("groupList"); + strRegionList=map.get("dstList"); + } + } //保存区域IP信息 List areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId()); if(!StringUtil.isEmpty(areaIpCfgList)){ @@ -703,6 +768,10 @@ public class WebsiteCfgService extends CrudService { public void saveDnsCfg(CfgIndexInfo entity){ //设置区域运营商信息 setAreaEffectiveIds(entity); + + entity.setIsValid(0); + entity.setIsAudit(0); + if(entity.getCfgId()==null){ Integer compileId = 0; try { @@ -710,39 +779,46 @@ public class WebsiteCfgService extends CrudService { if(idList!=null && idList.size()>0){ compileId = idList.get(0); } - entity.setCompileId(compileId); - entity.setCreateTime(new Date()); - entity.setCreatorId(entity.getCurrentUser().getId()); - websiteCfgDao.saveCfgIndex(entity); - if(entity.getIpPortList()!=null){ - for(IpPortCfg cfg:entity.getIpPortList()){ - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); - websiteCfgDao.saveIpPortCfg(cfg); - } - } - if(entity.getDomainList()!=null){ - for(ComplexkeywordCfg cfg:entity.getDomainList()){ - if(StringUtils.isNotBlank(cfg.getCfgKeywords())){ - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); - if(StringUtils.isNoneBlank(cfg.getDistrictShowName()) && cfg.getDistrict().equals("others")){ - cfg.setDistrict(cfg.getDistrictShowName()); - } - websiteCfgDao.saveDnsDomainCfg(cfg); - } - } - } - //保存区域IP信息 - if(entity.getAreaCfg()!=null){ - for(AreaIpCfg cfg:entity.getAreaCfg()){ - cfg.initDefaultValue(); - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); - areaIpCfgDao.saveAreaIpCfg(cfg); - } - } - } catch (Exception e) { - e.printStackTrace(); + } catch (MaatConvertException e) { logger.info("获取编译ID出错"); - throw new MaatConvertException(":"+e.getMessage()); + throw new MaatConvertException(""); + } + entity.setCompileId(compileId); + entity.setCreateTime(new Date()); + entity.setCreatorId(entity.getCurrentUser().getId()); + websiteCfgDao.saveCfgIndex(entity); + if(entity.getIpPortList()!=null){ + for(IpPortCfg cfg:entity.getIpPortList()){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + websiteCfgDao.saveIpPortCfg(cfg); + } + } + if(entity.getDomainList()!=null){ + for(ComplexkeywordCfg cfg:entity.getDomainList()){ + if(StringUtils.isNotBlank(cfg.getCfgKeywords())){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + if(StringUtils.isNoneBlank(cfg.getDistrictShowName()) && cfg.getDistrict().equals("others")){ + cfg.setDistrict(cfg.getDistrictShowName()); + } + websiteCfgDao.saveDnsDomainCfg(cfg); + } + } + } + if(entity.getNtcSubscribeIdCfgList()!=null){ + for(NtcSubscribeIdCfg cfg:entity.getNtcSubscribeIdCfgList()){ + if(StringUtils.isNotBlank(cfg.getCfgKeywords())){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + stringCfgDao.saveSubscribeIdCfg(cfg); + } + } + } + //保存区域IP信息 + if(entity.getAreaCfg()!=null){ + for(AreaIpCfg cfg:entity.getAreaCfg()){ + cfg.initDefaultValue(); + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + areaIpCfgDao.saveAreaIpCfg(cfg); + } } }else{ @@ -750,6 +826,7 @@ public class WebsiteCfgService extends CrudService { //无效子配置后,再新增子配置 websiteCfgDao.deleteDnsIpCfg(entity); websiteCfgDao.deleteDnsDomainCfg(entity); + stringCfgDao.deleteSubscribeIdCfgByCfgIndexInfo(entity); AreaIpCfg area = new AreaIpCfg(); area.setCompileId(entity.getCompileId()); area.setFunctionId(entity.getFunctionId()); @@ -773,6 +850,14 @@ public class WebsiteCfgService extends CrudService { } } } + if(entity.getNtcSubscribeIdCfgList()!=null){ + for(NtcSubscribeIdCfg cfg:entity.getNtcSubscribeIdCfgList()){ + if(StringUtils.isNotBlank(cfg.getCfgKeywords())){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + stringCfgDao.saveSubscribeIdCfg(cfg); + } + } + } //保存区域IP信息 if(entity.getAreaCfg()!=null){ for(AreaIpCfg cfg:entity.getAreaCfg()){ @@ -810,11 +895,18 @@ public class WebsiteCfgService extends CrudService { } if(entity.getDomainList()!=null && entity.getDomainList().size()>0) { - SslKeywordCfg cfg = new SslKeywordCfg(); + DnsDomainCfg cfg = new DnsDomainCfg(); BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); cfg.setTableName(DnsDomainCfg.getTablename()); websiteCfgDao.updateCfgValid(cfg); } + if(entity.getNtcSubscribeIdCfgList()!=null && entity.getNtcSubscribeIdCfgList().size()>0) + { + NtcSubscribeIdCfg cfg = new NtcSubscribeIdCfg(); + BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + cfg.setTableName(NtcSubscribeIdCfg.getTablename()); + websiteCfgDao.updateCfgValid(cfg); + } //保存区域IP信息 if(entity.getAreaCfg()!=null && entity.getAreaCfg().size()>0){ AreaIpCfg cfg = new AreaIpCfg(); @@ -874,6 +966,17 @@ public class WebsiteCfgService extends CrudService { strRegionList=map.get("dstList"); } } + if(entity.getNtcSubscribeIdCfgList()!=null && entity.getNtcSubscribeIdCfgList().size()>0){ + NtcSubscribeIdCfg cfg = new NtcSubscribeIdCfg(); + BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + cfg.setTableName(NtcSubscribeIdCfg.getTablename()); + websiteCfgDao.auditCfg(cfg); + if(isAudit==1){ + Map map = cfgConvert(strRegionList,entity.getNtcSubscribeIdCfgList(),2,entity,groupRelationList); + groupRelationList=map.get("groupList"); + strRegionList=map.get("dstList"); + } + } //保存区域IP信息 List areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId()); if(!StringUtil.isEmpty(areaIpCfgList)){ diff --git a/src/main/resources/nis.properties b/src/main/resources/nis.properties index 9ec763708..2a7dd1c5f 100644 --- a/src/main/resources/nis.properties +++ b/src/main/resources/nis.properties @@ -443,7 +443,7 @@ specific_service_cfg_type_basic_protocol=basic_protocol proto_id_region=PROTO_ID #拦截IP自定义域key keyring_id=keyring_id -droprate=Droprate +droprate=DROPRATE bandwidth=Bandwidth #IP\u9ed8\u8ba4\u503c ipv4_default_ip_value=\:\: diff --git a/src/main/resources/sql/add_function_region.sql b/src/main/resources/sql/add_function_region.sql new file mode 100644 index 000000000..d4e7b16f6 --- /dev/null +++ b/src/main/resources/sql/add_function_region.sql @@ -0,0 +1,19 @@ +INSERT INTO function_region_dict + () +VALUES + ('subscribe_id', '0', '0,1', '0,1,2', '0,1,2,3', 174, 34, 2, 'NTC_SUBSCRIBE_ID', '', 'SSL SUBSCRIBE_ID配置', 1, NULL, NULL, NULL, NULL, 1, 2, '', '', '', '', '', '', 3); + +INSERT INTO function_region_dict + () +VALUES + ('subscribe_id', '0', '0,1', '0,1,2', '0,1,2,3', 175, 7, 2, 'NTC_SUBSCRIBE_ID', '', 'DNS SUBSCRIBE_ID配置', 1, NULL, NULL, NULL, NULL, 1, 2, '', '', '', '', '', '', 5); + +INSERT INTO function_region_dict + () +VALUES + ('subscribe_id', '0', '0,1', '0,1,2', '0,1,2,3', 176, 35, 3, 'NTC_SUBSCRIBE_ID', '', '邮件 SUBSCRIBE_ID配置', 1, NULL, NULL,NULL , NULL, 1, 2, '', '', '', '', '', '', 7); + +INSERT INTO function_region_dict + () +VALUES + ('subscribe_id', '0', '0,1', '0,1,2', '0,1,2,3', 177, 8, 3, 'NTC_SUBSCRIBE_ID', '', 'HTTP SUBSCRIBE_ID配置', 1, NULL, NULL,NULL , NULL, 1, 3, '', '', '', '', '', '', 7); \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/cfg/intercept/interceptIpForm.jsp b/src/main/webapp/WEB-INF/views/cfg/intercept/interceptIpForm.jsp index 0895aee36..9ddfc1d19 100644 --- a/src/main/webapp/WEB-INF/views/cfg/intercept/interceptIpForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/intercept/interceptIpForm.jsp @@ -16,6 +16,13 @@ $("#cancel").on("click", function() { window.history.back(); }); + + $(".action").on("change", function() { + //拦截根据action切换动作部分 + setInterceptDefaultInfo(""); + $("#serviceId").val($(this).attr("serviceId")); + $("#protocolId").val($(this).attr("protocolId")); + }); $("#serviceId").val($(".action:checked").attr("serviceId")); $("#protocolId").val($(".action:checked").attr("protocolId")); $("#cfgFrom").validate( diff --git a/src/main/webapp/WEB-INF/views/cfg/mail/mailSubList.jsp b/src/main/webapp/WEB-INF/views/cfg/mail/mailSubList.jsp index fe33fdfd3..34229a3a5 100644 --- a/src/main/webapp/WEB-INF/views/cfg/mail/mailSubList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/mail/mailSubList.jsp @@ -229,5 +229,60 @@ + + + +
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+
\ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/cfg/website/dnsSubList.jsp b/src/main/webapp/WEB-INF/views/cfg/website/dnsSubList.jsp index 3a9f4effa..ae10f6ef1 100644 --- a/src/main/webapp/WEB-INF/views/cfg/website/dnsSubList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/website/dnsSubList.jsp @@ -184,5 +184,60 @@ + + + +
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+
\ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/cfg/website/httpList.jsp b/src/main/webapp/WEB-INF/views/cfg/website/httpList.jsp index 677cbd532..7bad1eed4 100644 --- a/src/main/webapp/WEB-INF/views/cfg/website/httpList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/website/httpList.jsp @@ -9,6 +9,8 @@ //搜索框提示语初始化 if("${cfg.cfgDesc}"){ $("#intype").val("${cfg.cfgDesc}"); + }else if("${cfg.compileId}"){ + $("#intype").val("${cfg.compileId}"); }else{ $("#intype").attr("placeholder"," "+$("#seltype").find("option:selected").text()); } @@ -289,6 +291,7 @@ + <%-- @@ -363,7 +366,7 @@ - +
diff --git a/src/main/webapp/WEB-INF/views/cfg/website/httpSubList.jsp b/src/main/webapp/WEB-INF/views/cfg/website/httpSubList.jsp index 6b1cef82f..894572091 100644 --- a/src/main/webapp/WEB-INF/views/cfg/website/httpSubList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/website/httpSubList.jsp @@ -53,6 +53,13 @@
+ +
+ + +
+
@@ -409,6 +416,55 @@ + + +
+
+
+
+ +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
\ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/cfg/website/sslSubList.jsp b/src/main/webapp/WEB-INF/views/cfg/website/sslSubList.jsp index 0fe9e1429..1eebb9e1c 100644 --- a/src/main/webapp/WEB-INF/views/cfg/website/sslSubList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/website/sslSubList.jsp @@ -120,7 +120,7 @@ - +
@@ -172,5 +172,57 @@ + + + +
+
+
+
+ +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+
\ No newline at end of file