diff --git a/src/main/java/com/nis/domain/configuration/AppPolicyCfg.java b/src/main/java/com/nis/domain/configuration/AppPolicyCfg.java index bc6895c44..2873bfd98 100644 --- a/src/main/java/com/nis/domain/configuration/AppPolicyCfg.java +++ b/src/main/java/com/nis/domain/configuration/AppPolicyCfg.java @@ -69,17 +69,17 @@ public class AppPolicyCfg extends BaseCfg { @Expose @ExcelField(title="expression_type") @SerializedName("exprType") - protected Integer exprType ; + private Integer exprType ; @Expose @ExcelField(title="match_method") @SerializedName("matchMethod") - protected Integer matchMethod ; + private Integer matchMethod ; @Expose @ExcelField(title="whether_hexbinary") @SerializedName("isHexbin") - protected Integer isHexbin; + private Integer isHexbin; private List ipPortList; private IpPortCfg ipPort; @@ -129,6 +129,8 @@ public class AppPolicyCfg extends BaseCfg { // TODO Auto-generated method stub super.initDefaultValue(); this.isHexbin = 0; + this.exprType=0; + this.matchMethod=0; } diff --git a/src/main/java/com/nis/web/dao/configuration/AppCfgDao.xml b/src/main/java/com/nis/web/dao/configuration/AppCfgDao.xml index 50a01fff6..309954269 100644 --- a/src/main/java/com/nis/web/dao/configuration/AppCfgDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/AppCfgDao.xml @@ -1974,7 +1974,16 @@ --> USER_REGION1 =#{userRegion5,jdbcType=VARCHAR}, - DO_LOG=#{doLog,jdbcType=INTEGER} + DO_LOG=#{doLog,jdbcType=INTEGER}, + + expr_type=#{exprType,jdbcType=INTEGER}, + + + match_method=#{matchMethod,jdbcType=INTEGER}, + + + is_hexbin=#{isHexbin,jdbcType=INTEGER}, + where cfg_id = #{cfgId,jdbcType=BIGINT} diff --git a/src/main/java/com/nis/web/service/configuration/AppCfgService.java b/src/main/java/com/nis/web/service/configuration/AppCfgService.java index 0388674ea..d08a11bed 100644 --- a/src/main/java/com/nis/web/service/configuration/AppCfgService.java +++ b/src/main/java/com/nis/web/service/configuration/AppCfgService.java @@ -43,9 +43,9 @@ import com.nis.web.dao.configuration.StringCfgDao; import com.nis.web.security.UserUtils; import com.nis.web.service.BaseService; - /** * 特定协议相关配置事务类 + * * @author dell * */ @@ -57,213 +57,245 @@ public class AppCfgService extends BaseService { protected AreaIpCfgDao areaIpCfgDao; @Autowired protected StringCfgDao stringcfgDao; - - + public Page findAppPolicyList(Page page, AppPolicyCfg entity) { - entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r")); + entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(), "r")); entity.setPage(page); List list = appCfgDao.findAppPolicyList(entity); page.setList(list); return page; } + public Page findAppIpList(Page page, AppIpCfg entity) { - entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r")); + entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(), "r")); entity.setPage(page); List list = appCfgDao.findAppIpList(entity); page.setList(list); return page; } + public Page findAppHttpList(Page page, AppHttpCfg entity) { - entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r")); + entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(), "r")); entity.setPage(page); List list = appCfgDao.findAppHttpList(entity); page.setList(list); return page; } + public Page findAppDomainList(Page page, AppDomainCfg entity) { - entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r")); + entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(), "r")); entity.setPage(page); List list = appCfgDao.findAppDomainList(entity); page.setList(list); return page; } - //主题网站列表 + + // 主题网站列表 public Page findAppTopicDomainList(Page page, AppTopicDomainCfg entity) { - entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r")); + entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(), "r")); entity.setPage(page); List list = appCfgDao.findAppTopicDomainList(entity); page.setList(list); return page; } + public Page findAppByteList(Page page, AppByteCfg entity) { - entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r")); + entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(), "r")); entity.setPage(page); List list = appCfgDao.findAppByteList(entity); page.setList(list); return page; } + public Page findAppSslList(Page page, AppSslCertCfg entity) { - entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r")); + entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(), "r")); entity.setPage(page); List list = appCfgDao.findAppSslList(entity); page.setList(list); return page; } - public Page findAppTcpList(Page page, AppTcpCfg entity) { - entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r")); + entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(), "r")); entity.setPage(page); List list = appCfgDao.findAppTcpList(entity); page.setList(list); return page; } - public AppTcpCfg getAppTcpCfg(Long cfgId){ + public AppTcpCfg getAppTcpCfg(Long cfgId) { return appCfgDao.getAppTcpCfg(cfgId); } - - - public AppPolicyCfg getAppPolicyCfg(Long cfgId){ + + public AppPolicyCfg getAppPolicyCfg(Long cfgId) { AppPolicyCfg policy = appCfgDao.getAppPolicyCfg(cfgId); List ipPortList = appCfgDao.getAppPolicyIpList(policy); - //查询关键字 - if(policy.getCompileId()!=null){ + // 查询关键字 + if (policy.getCompileId() != null) { NtcSubscribeIdCfg ntcSubscribeIdCfg = new NtcSubscribeIdCfg(); ntcSubscribeIdCfg.setCompileId(policy.getCompileId()); List ntcList = stringcfgDao.findSubscribeIdCfgList(ntcSubscribeIdCfg); policy.setNtcSubscribeIdCfgList(ntcList); } - + policy.setIpPortList(ipPortList); return policy; } - public AppIpCfg getAppIpCfg(Long cfgId){ + + public AppIpCfg getAppIpCfg(Long cfgId) { return appCfgDao.getAppIpCfg(cfgId); } - public AppHttpCfg getAppHttpCfg(Long cfgId){ + + public AppHttpCfg getAppHttpCfg(Long cfgId) { return appCfgDao.getAppHttpCfg(cfgId); } - public AppDomainCfg getAppDomainCfg(Long cfgId){ + + public AppDomainCfg getAppDomainCfg(Long cfgId) { return appCfgDao.getAppDomainCfg(cfgId); } - //主题网站form - public AppTopicDomainCfg getAppTopicDomainCfg(Long cfgId){ + + // 主题网站form + public AppTopicDomainCfg getAppTopicDomainCfg(Long cfgId) { return appCfgDao.getAppTopicDomainCfg(cfgId); } - public AppByteCfg getAppByteCfg(Long cfgId){ + + public AppByteCfg getAppByteCfg(Long cfgId) { return appCfgDao.getAppByteCfg(cfgId); } - public AppSslCertCfg getAppSslCfg(Long cfgId){ + + public AppSslCertCfg getAppSslCfg(Long cfgId) { return appCfgDao.getAppSslCfg(cfgId); } - @Transactional(readOnly=false,rollbackFor=RuntimeException.class) - public void saveOrUpdateAppPolicyCfg(AppPolicyCfg entity) throws Exception{ - //设置区域运营商信息 + + @Transactional(readOnly = false, rollbackFor = RuntimeException.class) + public void saveOrUpdateAppPolicyCfg(AppPolicyCfg entity) throws Exception { + // 设置区域运营商信息 setAreaEffectiveIds(entity); - - if(entity.getCfgId()==null){ + + if (entity.getCfgId() == null) { Integer compileId = 0; try { List idList = ConfigServiceUtil.getId(1, 1); - if(idList!=null && idList.size()>0){ + if (idList != null && idList.size() > 0) { compileId = idList.get(0); } - entity.setCompileId(compileId); - entity.setCreateTime(new Date()); - entity.setCreatorId(entity.getCurrentUser().getId()); - entity.setIsValid(0); - entity.setIsAudit(0); - appCfgDao.insertAppPolicyCfg(entity); - //保存策略IP配置 - if(entity!=null&&entity.getIpPortList()!=null){ - for(IpPortCfg cfg:entity.getIpPortList()){ - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); - appCfgDao.insertAppPolicyIpCfg(cfg); - } - } - //保存关键字配置 - if(entity!=null&&entity.getNtcSubscribeIdCfgList()!=null){ - for(NtcSubscribeIdCfg cfg:entity.getNtcSubscribeIdCfgList()){ - if(StringUtils.isNotBlank(cfg.getCfgKeywords())){ - entity.setCfgKeywords(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[]{"cfgDesc","cfgRegionCode","cfgType"}); - areaIpCfgDao.saveAreaIpCfg(cfg); - } - } - }catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); logger.info("获取编译ID出错"); throw new MaatConvertException(e.getMessage()); } - }else{ + entity.setCompileId(compileId); + entity.setCreateTime(new Date()); + entity.setCreatorId(entity.getCurrentUser().getId()); + entity.setIsValid(0); + entity.setIsAudit(0); + // 设置SubscribeID域配置参数 + if (entity != null && entity.getNtcSubscribeIdCfgList() != null) { + for (NtcSubscribeIdCfg cfg : entity.getNtcSubscribeIdCfgList()) { + entity.setExprType(cfg.getExprType()); + entity.setIsHexbin(cfg.getIsHexbin()); + entity.setMatchMethod(cfg.getMatchMethod()); + entity.setCfgKeywords(cfg.getCfgKeywords()); + } + } + entity.initDefaultValue(); + appCfgDao.insertAppPolicyCfg(entity); + // 保存策略IP配置 + if (entity != null && entity.getIpPortList() != null) { + for (IpPortCfg cfg : entity.getIpPortList()) { + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgRegionCode", "cfgType" }); + appCfgDao.insertAppPolicyIpCfg(cfg); + } + } + // 保存关键字配置 + if (entity != null && entity.getNtcSubscribeIdCfgList() != null) { + for (NtcSubscribeIdCfg cfg : entity.getNtcSubscribeIdCfgList()) { + if (StringUtils.isNotBlank(cfg.getCfgKeywords())) { + entity.setCfgKeywords(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[] { "cfgDesc", "cfgRegionCode", "cfgType" }); + areaIpCfgDao.saveAreaIpCfg(cfg); + } + } + + } else { entity.setEditorId(entity.getCurrentUser().getId()); entity.setEditTime(new Date()); entity.setIsValid(0); entity.setIsAudit(0); - appCfgDao.updateAppPolicyCfg(entity); - + // 设置SubscribeID域配置参数 + if (entity != null && entity.getNtcSubscribeIdCfgList() != null) { + for (NtcSubscribeIdCfg cfg : entity.getNtcSubscribeIdCfgList()) { + entity.setExprType(cfg.getExprType()); + entity.setIsHexbin(cfg.getIsHexbin()); + entity.setMatchMethod(cfg.getMatchMethod()); + } + } + appCfgDao.updateAppPolicyCfg(entity); + appCfgDao.deleteAppPolicyIpCfg(entity); - if(entity!=null&&entity.getNtcSubscribeIdCfgList()!=null&&entity.getNtcSubscribeIdCfgList().size()>0){ + if (entity != null && entity.getNtcSubscribeIdCfgList() != null + && entity.getNtcSubscribeIdCfgList().size() > 0) { for (NtcSubscribeIdCfg ntcSubscribeIdCfg : entity.getNtcSubscribeIdCfgList()) { ntcSubscribeIdCfg.setCompileId(entity.getCompileId()); stringcfgDao.deleteSubscribeIdCfg(ntcSubscribeIdCfg); } } - //删除旧的区域IP,新增新的区域IP + // 删除旧的区域IP,新增新的区域IP AreaIpCfg area = new AreaIpCfg(); area.setCompileId(entity.getCompileId()); area.setFunctionId(entity.getFunctionId()); areaIpCfgDao.deleteAreaIpCfg(area); - + entity.setCreateTime(new Date()); entity.setCreatorId(entity.getCurrentUser().getId()); - //保存策略IP配置 - if(entity.getIpPortList()!=null){ - for(IpPortCfg cfg:entity.getIpPortList()){ - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + // 保存策略IP配置 + if (entity.getIpPortList() != null) { + for (IpPortCfg cfg : entity.getIpPortList()) { + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgRegionCode", "cfgType" }); appCfgDao.insertAppPolicyIpCfg(cfg); } } - if(entity!=null&&entity.getNtcSubscribeIdCfgList()!=null){ - for(NtcSubscribeIdCfg cfg:entity.getNtcSubscribeIdCfgList()){ - if(StringUtils.isNotBlank(cfg.getCfgKeywords())){ - entity.setCfgKeywords(cfg.getCfgKeywords()); - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType","exprType","matchMethod","isHexbin"}); - stringcfgDao.saveSubscribeIdCfg(cfg); + if (entity != null && entity.getNtcSubscribeIdCfgList() != null) { + for (NtcSubscribeIdCfg cfg : entity.getNtcSubscribeIdCfgList()) { + if (StringUtils.isNotBlank(cfg.getCfgKeywords())) { + entity.setCfgKeywords(cfg.getCfgKeywords()); + BeanUtils.copyProperties(entity, cfg, + new String[] { "cfgRegionCode", "cfgType", "exprType", "matchMethod", "isHexbin" }); + stringcfgDao.saveSubscribeIdCfg(cfg); } } } - - //保存区域IP信息 - if(entity.getAreaCfg()!=null){ - for(AreaIpCfg cfg:entity.getAreaCfg()){ + + // 保存区域IP信息 + if (entity.getAreaCfg() != null) { + for (AreaIpCfg cfg : entity.getAreaCfg()) { cfg.initDefaultValue(); - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgDesc","cfgRegionCode","cfgType"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgDesc", "cfgRegionCode", "cfgType" }); areaIpCfgDao.saveAreaIpCfg(cfg); } } } - } - @Transactional(readOnly=false,rollbackFor=RuntimeException.class) - public void saveOrUpdateAppIpCfg(AppIpCfg entity) throws Exception{ - //设置区域运营商信息 + } + + @Transactional(readOnly = false, rollbackFor = RuntimeException.class) + public void saveOrUpdateAppIpCfg(AppIpCfg entity) throws Exception { + // 设置区域运营商信息 setAreaEffectiveIds(entity); - - if(entity.getCfgId()==null){ + + if (entity.getCfgId() == null) { Integer compileId = 0; try { List idList = ConfigServiceUtil.getId(1, 1); - if(idList!=null && idList.size()>0){ + if (idList != null && idList.size() > 0) { compileId = idList.get(0); } entity.setCompileId(compileId); @@ -271,58 +303,60 @@ public class AppCfgService extends BaseService { entity.setCreatorId(entity.getCurrentUser().getId()); entity.setIsValid(0); entity.setIsAudit(0); - appCfgDao.insertAppIpCfg(entity); - - //保存区域IP信息 - if(entity.getAreaCfg()!=null){ - for(AreaIpCfg cfg:entity.getAreaCfg()){ + appCfgDao.insertAppIpCfg(entity); + + // 保存区域IP信息 + if (entity.getAreaCfg() != null) { + for (AreaIpCfg cfg : entity.getAreaCfg()) { cfg.initDefaultValue(); BeanUtils.copyProperties(entity, cfg, - new String[]{"cfgRegionCode","cfgType","ipType","isAreaEffective", - "areaEffectiveIds","protocol","portPattern","srcPort","destPort","direction", - "destIpAddress","srcIpAddress","ipPattern"}); + new String[] { "cfgRegionCode", "cfgType", "ipType", "isAreaEffective", + "areaEffectiveIds", "protocol", "portPattern", "srcPort", "destPort", + "direction", "destIpAddress", "srcIpAddress", "ipPattern" }); areaIpCfgDao.saveAreaIpCfg(cfg); } } - }catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); logger.info("获取编译ID出错"); throw new MaatConvertException(e.getMessage()); } - }else{ + } else { entity.setEditorId(entity.getCurrentUser().getId()); entity.setEditTime(new Date()); entity.setIsValid(0); entity.setIsAudit(0); appCfgDao.updateAppIpCfg(entity); - //删除旧的区域IP,新增新的区域IP + // 删除旧的区域IP,新增新的区域IP AreaIpCfg area = new AreaIpCfg(); area.setCompileId(entity.getCompileId()); area.setFunctionId(entity.getFunctionId()); areaIpCfgDao.deleteAreaIpCfg(area); entity.setCreateTime(new Date()); entity.setCreatorId(entity.getCurrentUser().getId()); - //保存区域IP信息 - if(entity.getAreaCfg()!=null){ - for(AreaIpCfg cfg:entity.getAreaCfg()){ + // 保存区域IP信息 + if (entity.getAreaCfg() != null) { + for (AreaIpCfg cfg : entity.getAreaCfg()) { cfg.initDefaultValue(); - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType","ipType","isAreaEffective", - "areaEffectiveIds","protocol","portPattern","srcPort","destPort","direction", - "destIpAddress","srcIpAddress","ipPattern"}); + BeanUtils.copyProperties(entity, cfg, + new String[] { "cfgRegionCode", "cfgType", "ipType", "isAreaEffective", "areaEffectiveIds", + "protocol", "portPattern", "srcPort", "destPort", "direction", "destIpAddress", + "srcIpAddress", "ipPattern" }); areaIpCfgDao.saveAreaIpCfg(cfg); } } } - } - @Transactional(readOnly=false,rollbackFor=RuntimeException.class) - public void saveOrUpdateAppHttpCfg(AppHttpCfg entity) throws Exception{ - //设置区域运营商信息 + } + + @Transactional(readOnly = false, rollbackFor = RuntimeException.class) + public void saveOrUpdateAppHttpCfg(AppHttpCfg entity) throws Exception { + // 设置区域运营商信息 setAreaEffectiveIds(entity); - if(entity.getCfgId()==null){ + if (entity.getCfgId() == null) { Integer compileId = 0; try { List idList = ConfigServiceUtil.getId(1, 1); - if(idList!=null && idList.size()>0){ + if (idList != null && idList.size() > 0) { compileId = idList.get(0); } entity.setCompileId(compileId); @@ -331,57 +365,58 @@ public class AppCfgService extends BaseService { entity.setIsValid(0); entity.setIsAudit(0); appCfgDao.insertAppHttpCfg(entity); - //保存区域IP信息 - if(entity.getAreaCfg()!=null){ - for(AreaIpCfg cfg:entity.getAreaCfg()){ + // 保存区域IP信息 + if (entity.getAreaCfg() != null) { + for (AreaIpCfg cfg : entity.getAreaCfg()) { cfg.initDefaultValue(); - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); - + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgRegionCode", "cfgType" }); + areaIpCfgDao.saveAreaIpCfg(cfg); } } - - }catch (Exception e) { + + } catch (Exception e) { e.printStackTrace(); logger.info("获取编译ID出错"); throw new MaatConvertException(e.getMessage()); } - }else{ + } else { entity.setEditorId(entity.getCurrentUser().getId()); entity.setEditTime(new Date()); entity.setIsValid(0); entity.setIsAudit(0); appCfgDao.updateAppHttpCfg(entity); - - //删除旧的区域IP,新增新的区域IP + + // 删除旧的区域IP,新增新的区域IP AreaIpCfg area = new AreaIpCfg(); area.setCompileId(entity.getCompileId()); area.setFunctionId(entity.getFunctionId()); areaIpCfgDao.deleteAreaIpCfg(area); entity.setCreateTime(new Date()); entity.setCreatorId(entity.getCurrentUser().getId()); - //保存区域IP信息 - if(entity.getAreaCfg()!=null){ - for(AreaIpCfg cfg:entity.getAreaCfg()){ + // 保存区域IP信息 + if (entity.getAreaCfg() != null) { + for (AreaIpCfg cfg : entity.getAreaCfg()) { cfg.initDefaultValue(); - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgDesc","cfgRegionCode","cfgType"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgDesc", "cfgRegionCode", "cfgType" }); areaIpCfgDao.saveAreaIpCfg(cfg); } } - + } - + } - @Transactional(readOnly=false,rollbackFor=RuntimeException.class) - public void saveOrUpdateAppDomainCfg(AppDomainCfg entity) throws Exception{ - //设置区域运营商信息 + + @Transactional(readOnly = false, rollbackFor = RuntimeException.class) + public void saveOrUpdateAppDomainCfg(AppDomainCfg entity) throws Exception { + // 设置区域运营商信息 setAreaEffectiveIds(entity); - - if(entity.getCfgId()==null){ + + if (entity.getCfgId() == null) { Integer compileId = 0; try { List idList = ConfigServiceUtil.getId(1, 1); - if(idList!=null && idList.size()>0){ + if (idList != null && idList.size() > 0) { compileId = idList.get(0); } entity.setCompileId(compileId); @@ -389,53 +424,54 @@ public class AppCfgService extends BaseService { entity.setCreatorId(entity.getCurrentUser().getId()); entity.setIsValid(0); entity.setIsAudit(0); - appCfgDao.insertAppDomainCfg(entity); - //保存区域IP信息 - if(entity.getAreaCfg()!=null){ - for(AreaIpCfg cfg:entity.getAreaCfg()){ + appCfgDao.insertAppDomainCfg(entity); + // 保存区域IP信息 + if (entity.getAreaCfg() != null) { + for (AreaIpCfg cfg : entity.getAreaCfg()) { cfg.initDefaultValue(); - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgDesc","cfgRegionCode","cfgType"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgDesc", "cfgRegionCode", "cfgType" }); areaIpCfgDao.saveAreaIpCfg(cfg); } } - }catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); logger.info("获取编译ID出错"); throw new MaatConvertException(e.getMessage()); } - }else{ + } else { entity.setEditorId(entity.getCurrentUser().getId()); entity.setEditTime(new Date()); entity.setIsValid(0); entity.setIsAudit(0); appCfgDao.updateAppDomainCfg(entity); - //删除旧的区域IP,新增新的区域IP + // 删除旧的区域IP,新增新的区域IP AreaIpCfg area = new AreaIpCfg(); area.setCompileId(entity.getCompileId()); area.setFunctionId(entity.getFunctionId()); areaIpCfgDao.deleteAreaIpCfg(area); entity.setCreateTime(new Date()); entity.setCreatorId(entity.getCurrentUser().getId()); - //保存区域IP信息 - if(entity.getAreaCfg()!=null){ - for(AreaIpCfg cfg:entity.getAreaCfg()){ + // 保存区域IP信息 + if (entity.getAreaCfg() != null) { + for (AreaIpCfg cfg : entity.getAreaCfg()) { cfg.initDefaultValue(); - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgDesc","cfgRegionCode","cfgType"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgDesc", "cfgRegionCode", "cfgType" }); areaIpCfgDao.saveAreaIpCfg(cfg); } } } } - //主题网站新增 修改 - public void saveOrUpdateAppTopicDomainCfg(AppTopicDomainCfg entity) throws Exception{ - //设置区域运营商信息 + + // 主题网站新增 修改 + public void saveOrUpdateAppTopicDomainCfg(AppTopicDomainCfg entity) throws Exception { + // 设置区域运营商信息 setAreaEffectiveIds(entity); - - if(entity.getCfgId()==null){ + + if (entity.getCfgId() == null) { Integer compileId = 0; try { List idList = ConfigServiceUtil.getId(1, 1); - if(idList!=null && idList.size()>0){ + if (idList != null && idList.size() > 0) { compileId = idList.get(0); } entity.setCompileId(compileId); @@ -443,54 +479,53 @@ public class AppCfgService extends BaseService { entity.setCreatorId(entity.getCurrentUser().getId()); entity.setIsValid(0); entity.setIsAudit(0); - appCfgDao.insertAppTopicDomainCfg(entity); - //保存区域IP信息 - if(entity.getAreaCfg()!=null){ - for(AreaIpCfg cfg:entity.getAreaCfg()){ + appCfgDao.insertAppTopicDomainCfg(entity); + // 保存区域IP信息 + if (entity.getAreaCfg() != null) { + for (AreaIpCfg cfg : entity.getAreaCfg()) { cfg.initDefaultValue(); - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgDesc","cfgRegionCode","cfgType"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgDesc", "cfgRegionCode", "cfgType" }); areaIpCfgDao.saveAreaIpCfg(cfg); } } - }catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); logger.info("获取编译ID出错"); throw new MaatConvertException(e.getMessage()); } - }else{ + } else { entity.setEditorId(entity.getCurrentUser().getId()); entity.setEditTime(new Date()); entity.setIsValid(0); entity.setIsAudit(0); appCfgDao.updateAppTopicDomainCfg(entity); - //删除旧的区域IP,新增新的区域IP + // 删除旧的区域IP,新增新的区域IP AreaIpCfg area = new AreaIpCfg(); area.setCompileId(entity.getCompileId()); area.setFunctionId(entity.getFunctionId()); areaIpCfgDao.deleteAreaIpCfg(area); entity.setCreateTime(new Date()); entity.setCreatorId(entity.getCurrentUser().getId()); - //保存区域IP信息 - if(entity.getAreaCfg()!=null){ - for(AreaIpCfg cfg:entity.getAreaCfg()){ + // 保存区域IP信息 + if (entity.getAreaCfg() != null) { + for (AreaIpCfg cfg : entity.getAreaCfg()) { cfg.initDefaultValue(); - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgDesc","cfgRegionCode","cfgType"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgDesc", "cfgRegionCode", "cfgType" }); areaIpCfgDao.saveAreaIpCfg(cfg); } } } } - - - @Transactional(readOnly=false,rollbackFor=RuntimeException.class) - public void saveOrUpdateAppByteCfg(AppByteCfg entity) throws Exception{ - //设置区域运营商信息 + + @Transactional(readOnly = false, rollbackFor = RuntimeException.class) + public void saveOrUpdateAppByteCfg(AppByteCfg entity) throws Exception { + // 设置区域运营商信息 setAreaEffectiveIds(entity); - if(entity.getCfgId()==null){ + if (entity.getCfgId() == null) { Integer compileId = 0; try { List idList = ConfigServiceUtil.getId(1, 1); - if(idList!=null && idList.size()>0){ + if (idList != null && idList.size() > 0) { compileId = idList.get(0); } entity.setCompileId(compileId); @@ -498,52 +533,53 @@ public class AppCfgService extends BaseService { entity.setCreatorId(entity.getCurrentUser().getId()); entity.setIsValid(0); entity.setIsAudit(0); - appCfgDao.insertAppByteCfg(entity); - //保存区域IP信息 - if(entity.getAreaCfg()!=null){ - for(AreaIpCfg cfg:entity.getAreaCfg()){ + appCfgDao.insertAppByteCfg(entity); + // 保存区域IP信息 + if (entity.getAreaCfg() != null) { + for (AreaIpCfg cfg : entity.getAreaCfg()) { cfg.initDefaultValue(); - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgDesc","cfgRegionCode","cfgType"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgDesc", "cfgRegionCode", "cfgType" }); areaIpCfgDao.saveAreaIpCfg(cfg); } } - }catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); logger.info("获取编译ID出错"); throw new MaatConvertException(e.getMessage()); } - }else{ + } else { entity.setEditorId(entity.getCurrentUser().getId()); entity.setEditTime(new Date()); entity.setIsValid(0); entity.setIsAudit(0); appCfgDao.updateAppByteCfg(entity); - //删除旧的区域IP,新增新的区域IP + // 删除旧的区域IP,新增新的区域IP AreaIpCfg area = new AreaIpCfg(); area.setCompileId(entity.getCompileId()); area.setFunctionId(entity.getFunctionId()); areaIpCfgDao.deleteAreaIpCfg(area); entity.setCreateTime(new Date()); entity.setCreatorId(entity.getCurrentUser().getId()); - //保存区域IP信息 - if(entity.getAreaCfg()!=null){ - for(AreaIpCfg cfg:entity.getAreaCfg()){ + // 保存区域IP信息 + if (entity.getAreaCfg() != null) { + for (AreaIpCfg cfg : entity.getAreaCfg()) { cfg.initDefaultValue(); - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgDesc","cfgRegionCode","cfgType"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgDesc", "cfgRegionCode", "cfgType" }); areaIpCfgDao.saveAreaIpCfg(cfg); } } } } - @Transactional(readOnly=false,rollbackFor=RuntimeException.class) - public void saveOrUpdateAppSslCfg(AppSslCertCfg entity) throws Exception{ - //设置区域运营商信息 + + @Transactional(readOnly = false, rollbackFor = RuntimeException.class) + public void saveOrUpdateAppSslCfg(AppSslCertCfg entity) throws Exception { + // 设置区域运营商信息 setAreaEffectiveIds(entity); - if(entity.getCfgId()==null){ + if (entity.getCfgId() == null) { Integer compileId = 0; try { List idList = ConfigServiceUtil.getId(1, 1); - if(idList!=null && idList.size()>0){ + if (idList != null && idList.size() > 0) { compileId = idList.get(0); } entity.setCompileId(compileId); @@ -552,56 +588,56 @@ public class AppCfgService extends BaseService { entity.setIsValid(0); entity.setIsAudit(0); appCfgDao.insertAppSslCfg(entity); - //保存区域IP信息 - if(entity.getAreaCfg()!=null){ - for(AreaIpCfg cfg:entity.getAreaCfg()){ + // 保存区域IP信息 + if (entity.getAreaCfg() != null) { + for (AreaIpCfg cfg : entity.getAreaCfg()) { cfg.initDefaultValue(); - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgRegionCode", "cfgType" }); areaIpCfgDao.saveAreaIpCfg(cfg); } } - - }catch (Exception e) { + + } catch (Exception e) { e.printStackTrace(); logger.info("获取编译ID出错"); throw new MaatConvertException(e.getMessage()); } - }else{ + } else { entity.setEditorId(entity.getCurrentUser().getId()); entity.setEditTime(new Date()); entity.setIsValid(0); entity.setIsAudit(0); appCfgDao.updateAppSslCfg(entity); - - //删除旧的区域IP,新增新的区域IP + + // 删除旧的区域IP,新增新的区域IP AreaIpCfg area = new AreaIpCfg(); area.setCompileId(entity.getCompileId()); area.setFunctionId(entity.getFunctionId()); areaIpCfgDao.deleteAreaIpCfg(area); entity.setCreateTime(new Date()); entity.setCreatorId(entity.getCurrentUser().getId()); - //保存区域IP信息 - if(entity.getAreaCfg()!=null){ - for(AreaIpCfg cfg:entity.getAreaCfg()){ + // 保存区域IP信息 + if (entity.getAreaCfg() != null) { + for (AreaIpCfg cfg : entity.getAreaCfg()) { cfg.initDefaultValue(); - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgDesc","cfgRegionCode","cfgType"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgDesc", "cfgRegionCode", "cfgType" }); areaIpCfgDao.saveAreaIpCfg(cfg); } } - + } - + } - - @Transactional(readOnly=false,rollbackFor=RuntimeException.class) - public void saveOrUpdateAppTcpeCfg(AppTcpCfg entity) throws Exception{ - //设置区域运营商信息 + + @Transactional(readOnly = false, rollbackFor = RuntimeException.class) + public void saveOrUpdateAppTcpeCfg(AppTcpCfg entity) throws Exception { + // 设置区域运营商信息 setAreaEffectiveIds(entity); - if(entity.getCfgId()==null){ + if (entity.getCfgId() == null) { Integer compileId = 0; try { List idList = ConfigServiceUtil.getId(1, 1); - if(idList!=null && idList.size()>0){ + if (idList != null && idList.size() > 0) { compileId = idList.get(0); } entity.setCompileId(compileId); @@ -609,46 +645,46 @@ public class AppCfgService extends BaseService { entity.setCreatorId(entity.getCurrentUser().getId()); entity.setIsValid(0); entity.setIsAudit(0); - appCfgDao.insertAppTcpCfg(entity); - //保存区域IP信息 - if(entity.getAreaCfg()!=null){ - for(AreaIpCfg cfg:entity.getAreaCfg()){ + appCfgDao.insertAppTcpCfg(entity); + // 保存区域IP信息 + if (entity.getAreaCfg() != null) { + for (AreaIpCfg cfg : entity.getAreaCfg()) { cfg.initDefaultValue(); - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgDesc","cfgRegionCode","cfgType"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgDesc", "cfgRegionCode", "cfgType" }); areaIpCfgDao.saveAreaIpCfg(cfg); } } - }catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); logger.info("获取编译ID出错"); throw new MaatConvertException(e.getMessage()); } - }else{ + } else { entity.setEditorId(entity.getCurrentUser().getId()); entity.setEditTime(new Date()); entity.setIsValid(0); entity.setIsAudit(0); appCfgDao.updateAppTcpCfg(entity); - //删除旧的区域IP,新增新的区域IP + // 删除旧的区域IP,新增新的区域IP AreaIpCfg area = new AreaIpCfg(); area.setCompileId(entity.getCompileId()); area.setFunctionId(entity.getFunctionId()); areaIpCfgDao.deleteAreaIpCfg(area); entity.setCreateTime(new Date()); entity.setCreatorId(entity.getCurrentUser().getId()); - //保存区域IP信息 - if(entity.getAreaCfg()!=null){ - for(AreaIpCfg cfg:entity.getAreaCfg()){ + // 保存区域IP信息 + if (entity.getAreaCfg() != null) { + for (AreaIpCfg cfg : entity.getAreaCfg()) { cfg.initDefaultValue(); - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgDesc","cfgRegionCode","cfgType"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgDesc", "cfgRegionCode", "cfgType" }); areaIpCfgDao.saveAreaIpCfg(cfg); } } } } - - public void auditAppTcpCfg(AppTcpCfg entity,Integer isAudit){ - ToMaatBean maatBean = new ToMaatBean(); + + public void auditAppTcpCfg(AppTcpCfg entity, Integer isAudit) { + ToMaatBean maatBean = new ToMaatBean(); MaatCfg maatCfg = new MaatCfg(); List configCompileList = new ArrayList(); List groupRelationList = new ArrayList(); @@ -659,29 +695,27 @@ public class AppCfgService extends BaseService { List areaIpRegionList = new ArrayList(); entity.setTableName(AppTcpCfg.getTablename()); appCfgDao.auditCfg(entity); - - if(isAudit==1){ + + if (isAudit == 1) { List list = new ArrayList(); list.add(entity); - Map map = cfgConvert(numRegionList,list,4,entity,groupRelationList); - groupRelationList=map.get("groupList"); - numRegionList=map.get("dstList"); + Map map = cfgConvert(numRegionList, list, 4, entity, groupRelationList); + groupRelationList = map.get("groupList"); + numRegionList = map.get("dstList"); } - /* //保存区域IP信息 - List areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId()); - if(!StringUtil.isEmpty(areaIpCfgList)){ - AreaIpCfg cfg = new AreaIpCfg(); - BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); - cfg.setTableName(AreaIpCfg.getTablename()); - appCfgDao.auditCfg(cfg); - if(isAudit==1){ - Map map = cfgConvert(areaIpRegionList,areaIpCfgList,4,entity,groupRelationList); - groupRelationList=map.get("groupList"); - areaIpRegionList=map.get("dstList"); - } - }*/ - //构造提交综合服务参数格式,一条配置提交一次综合服务 - if(isAudit==1){ + /* + * //保存区域IP信息 List + * areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId()); + * if(!StringUtil.isEmpty(areaIpCfgList)){ AreaIpCfg cfg = new AreaIpCfg(); + * BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + * cfg.setTableName(AreaIpCfg.getTablename()); appCfgDao.auditCfg(cfg); + * if(isAudit==1){ Map map = + * cfgConvert(areaIpRegionList,areaIpCfgList,4,entity,groupRelationList); + * groupRelationList=map.get("groupList"); areaIpRegionList=map.get("dstList"); + * } } + */ + // 构造提交综合服务参数格式,一条配置提交一次综合服务 + if (isAudit == 1) { maatCfg.initDefaultValue(); BeanUtils.copyProperties(entity, maatCfg); maatCfg.setAction(entity.getAction()); @@ -694,8 +728,8 @@ public class AppCfgService extends BaseService { maatCfg.setGroupNum(groupRelationList.size()); maatCfg.setAreaIpRegionList(areaIpRegionList); maatCfg.setIsValid(entity.getIsValid()); - //设置APP自定义域 - String userRegion = "APP_ID="+entity.getAppCode(); + // 设置APP自定义域 + String userRegion = "APP_ID=" + entity.getAppCode(); maatCfg.setUserRegion(userRegion); configCompileList.add(maatCfg); maatBean.setConfigCompileList(configCompileList); @@ -703,35 +737,35 @@ public class AppCfgService extends BaseService { maatBean.setCreatorName(entity.getCurrentUser().getName()); maatBean.setVersion(Constants.MAAT_VERSION); maatBean.setOpAction(Constants.INSERT_ACTION); - //调用服务接口下发配置数据 - String json=gsonToJson(maatBean); - logger.info("app SSL配置下发配置参数:"+json); - //调用服务接口下发配置 + // 调用服务接口下发配置数据 + String json = gsonToJson(maatBean); + logger.info("app SSL配置下发配置参数:" + json); + // 调用服务接口下发配置 ToMaatResult result = ConfigServiceUtil.postMaatCfg(json); - logger.info("app TCP配置下发响应信息:"+result.getMsg()); + logger.info("app TCP配置下发响应信息:" + result.getMsg()); - }else if(isAudit==3){ + } else if (isAudit == 3) { maatCfg.setCompileId(entity.getCompileId()); maatCfg.setServiceId(entity.getServiceId()); - maatCfg.setIsValid(0);//无效 + maatCfg.setIsValid(0);// 无效 configCompileList.add(maatCfg); maatBean.setConfigCompileList(configCompileList); maatBean.setAuditTime(entity.getAuditTime()); maatBean.setCreatorName(entity.getCurrentUser().getName()); maatBean.setVersion(Constants.MAAT_VERSION); maatBean.setOpAction(Constants.UPDATE_ACTION); - //调用服务接口取消配置 - String json=gsonToJson(maatBean); - logger.info("app TCP配置下发配置参数:"+json); - //调用服务接口下发配置 - ToMaatResult result = ConfigServiceUtil.put(json,1); - logger.info("app TCP配置取消配置响应信息:"+result.getMsg()); + // 调用服务接口取消配置 + String json = gsonToJson(maatBean); + logger.info("app TCP配置下发配置参数:" + json); + // 调用服务接口下发配置 + ToMaatResult result = ConfigServiceUtil.put(json, 1); + logger.info("app TCP配置取消配置响应信息:" + result.getMsg()); } } - - public void auditAppPolicyCfg(AppPolicyCfg entity,Integer isAudit){ - String configType=entity.getConfigType(); - ToMaatBean maatBean = new ToMaatBean(); + + public void auditAppPolicyCfg(AppPolicyCfg entity, Integer isAudit) { + String configType = entity.getConfigType(); + ToMaatBean maatBean = new ToMaatBean(); MaatCfg maatCfg = new MaatCfg(); List configCompileList = new ArrayList(); List groupRelationList = new ArrayList(); @@ -739,12 +773,12 @@ public class AppCfgService extends BaseService { List strRegionList = new ArrayList(); List numRegionList = new ArrayList(); List digestRegionList = new ArrayList(); - List areaIpRegionList = new ArrayList(); + List areaIpRegionList = new ArrayList(); entity.setTableName(AppPolicyCfg.getTablename()); - List ntcList = new ArrayList(); + List ntcList = new ArrayList(); appCfgDao.auditCfg(entity); - //更新关键字表状态 - if(entity.getCompileId()!=null){ + // 更新关键字表状态 + if (entity.getCompileId() != null) { NtcSubscribeIdCfg ntc = new NtcSubscribeIdCfg(); ntc.setCompileId(entity.getCompileId()); ntc.setIsAudit(entity.getIsAudit()); @@ -753,73 +787,76 @@ public class AppCfgService extends BaseService { ntc.setAuditTime(entity.getAuditTime()); stringcfgDao.updateSubscribeIdCfg(ntc); } - - if(isAudit==1){ - StringBuffer cfgKeywords=new StringBuffer(); - if(entity.getBehavCode()!=null){ - if(Constants.SPECIFIC_SERVICE_CFG_TYPE_APP.equalsIgnoreCase(configType)) { - cfgKeywords.append(Constants.APP_ID_REGION+"="+entity.getAppCode()); - }else if(Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR.equalsIgnoreCase(configType)||Constants.SPECIFIC_SERVICE_CFG_TYPE_BASIC_PROTOCOL.equalsIgnoreCase(configType)) { - cfgKeywords.append(Constants.PROTO_ID_REGION+"="+entity.getAppCode()); + + if (isAudit == 1) { + StringBuffer cfgKeywords = new StringBuffer(); + if (entity.getBehavCode() != null) { + if (Constants.SPECIFIC_SERVICE_CFG_TYPE_APP.equalsIgnoreCase(configType)) { + cfgKeywords.append(Constants.APP_ID_REGION + "=" + entity.getAppCode()); + } else if (Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR.equalsIgnoreCase(configType) + || Constants.SPECIFIC_SERVICE_CFG_TYPE_BASIC_PROTOCOL.equalsIgnoreCase(configType)) { + cfgKeywords.append(Constants.PROTO_ID_REGION + "=" + entity.getAppCode()); } cfgKeywords.append(Constants.KEYWORD_EXPR); - cfgKeywords.append(Constants.BEHAV_ID_REGION+"="+entity.getBehavCode()); -// entity.setCfgKeywords(entity.getAppCode()+Constants.KEYWORD_EXPR+entity.getBehavCode()); - }else{ - if(Constants.SPECIFIC_SERVICE_CFG_TYPE_APP.equalsIgnoreCase(configType)) { - cfgKeywords.append(Constants.APP_ID_REGION+"="+entity.getAppCode()); - }else if(Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR.equalsIgnoreCase(configType)||Constants.SPECIFIC_SERVICE_CFG_TYPE_BASIC_PROTOCOL.equalsIgnoreCase(configType)) { - cfgKeywords.append(Constants.PROTO_ID_REGION+"="+entity.getAppCode()); + cfgKeywords.append(Constants.BEHAV_ID_REGION + "=" + entity.getBehavCode()); + // entity.setCfgKeywords(entity.getAppCode()+Constants.KEYWORD_EXPR+entity.getBehavCode()); + } else { + if (Constants.SPECIFIC_SERVICE_CFG_TYPE_APP.equalsIgnoreCase(configType)) { + cfgKeywords.append(Constants.APP_ID_REGION + "=" + entity.getAppCode()); + } else if (Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR.equalsIgnoreCase(configType) + || Constants.SPECIFIC_SERVICE_CFG_TYPE_BASIC_PROTOCOL.equalsIgnoreCase(configType)) { + cfgKeywords.append(Constants.PROTO_ID_REGION + "=" + entity.getAppCode()); } -// entity.setCfgKeywords(entity.getAppCode()+""); + // entity.setCfgKeywords(entity.getAppCode()+""); } entity.setCfgKeywords(cfgKeywords.toString()); List list = new ArrayList(); list.add(entity); - Map map = cfgConvert(strRegionList,list,2,entity,groupRelationList); - groupRelationList=map.get("groupList"); - strRegionList=map.get("dstList"); + Map map = cfgConvert(strRegionList, list, 2, entity, groupRelationList); + groupRelationList = map.get("groupList"); + strRegionList = map.get("dstList"); } - - //查询子配置并修改审核状态 + + // 查询子配置并修改审核状态 entity = this.getAppPolicyCfg(entity.getCfgId()); - if(entity.getIpPortList()!=null && entity.getIpPortList().size()>0){ + if (entity.getIpPortList() != null && entity.getIpPortList().size() > 0) { IpPortCfg cfg = new IpPortCfg(); - BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" }); cfg.setTableName(IpPortCfg.getTablename()); appCfgDao.auditCfg(cfg); - if(isAudit==1){ - Map map = cfgConvert(ipRegionList,entity.getIpPortList(),1,entity,groupRelationList); - groupRelationList=map.get("groupList"); - ipRegionList=map.get("dstList"); - if(map.get("numRegionList")!=null){ - numRegionList.addAll(map.get("numRegionList")); + if (isAudit == 1) { + Map map = cfgConvert(ipRegionList, entity.getIpPortList(), 1, entity, groupRelationList); + groupRelationList = map.get("groupList"); + ipRegionList = map.get("dstList"); + if (map.get("numRegionList") != null) { + numRegionList.addAll(map.get("numRegionList")); } } } - if(entity.getNtcSubscribeIdCfgList()!=null&&entity.getNtcSubscribeIdCfgList().size()>0){ - if(isAudit==1){ - Map ntcMap = cfgConvert(strRegionList,entity.getNtcSubscribeIdCfgList(),2,entity,groupRelationList); - groupRelationList=ntcMap.get("groupList"); - strRegionList=ntcMap.get("dstList"); + if (entity.getNtcSubscribeIdCfgList() != null && entity.getNtcSubscribeIdCfgList().size() > 0) { + if (isAudit == 1) { + Map ntcMap = cfgConvert(strRegionList, entity.getNtcSubscribeIdCfgList(), 2, entity, + groupRelationList); + groupRelationList = ntcMap.get("groupList"); + strRegionList = ntcMap.get("dstList"); } } - - //保存区域IP信息 - List areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId()); - if(!StringUtil.isEmpty(areaIpCfgList)){ + + // 保存区域IP信息 + List areaIpCfgList = areaIpCfgDao.getByCompileId(entity.getCompileId()); + if (!StringUtil.isEmpty(areaIpCfgList)) { AreaIpCfg cfg = new AreaIpCfg(); - BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" }); cfg.setTableName(AreaIpCfg.getTablename()); appCfgDao.auditCfg(cfg); - if(isAudit==1){ - Map map = cfgConvert(areaIpRegionList,areaIpCfgList,1,entity,groupRelationList); - groupRelationList=map.get("groupList"); - areaIpRegionList=map.get("dstList"); + if (isAudit == 1) { + Map map = cfgConvert(areaIpRegionList, areaIpCfgList, 1, entity, groupRelationList); + groupRelationList = map.get("groupList"); + areaIpRegionList = map.get("dstList"); } } - //构造提交综合服务参数格式,一条配置提交一次综合服务 - if(isAudit==1){ + // 构造提交综合服务参数格式,一条配置提交一次综合服务 + if (isAudit == 1) { maatCfg.initDefaultValue(); BeanUtils.copyProperties(entity, maatCfg); maatCfg.setAction(entity.getAction()); @@ -832,27 +869,28 @@ public class AppCfgService extends BaseService { maatCfg.setGroupNum(groupRelationList.size()); maatCfg.setAreaIpRegionList(areaIpRegionList); maatCfg.setIsValid(entity.getIsValid()); - String userRegion=null; - if(Constants.SPECIFIC_SERVICE_CFG_TYPE_APP.equalsIgnoreCase(configType)) { - //设置APP自定义域 - userRegion = Constants.APP_ID_REGION+"="+entity.getAppCode(); - if(entity.getBehavCode()!=null) { - userRegion += Constants.USER_REGION_SPLIT+Constants.BEHAV_ID_REGION+"="+entity.getBehavCode(); + String userRegion = null; + if (Constants.SPECIFIC_SERVICE_CFG_TYPE_APP.equalsIgnoreCase(configType)) { + // 设置APP自定义域 + userRegion = Constants.APP_ID_REGION + "=" + entity.getAppCode(); + if (entity.getBehavCode() != null) { + userRegion += Constants.USER_REGION_SPLIT + Constants.BEHAV_ID_REGION + "=" + entity.getBehavCode(); } - }else if(Constants.SPECIFIC_SERVICE_CFG_TYPE_BASIC_PROTOCOL.equalsIgnoreCase(configType)) { - userRegion = Constants.PROTO_ID_REGION+"="+entity.getAppCode(); - }else if(Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR.equalsIgnoreCase(configType)) { - userRegion = Constants.PROTO_ID_REGION+"="+entity.getAppCode(); - if(entity.getBehavCode()!=null) { - userRegion += Constants.USER_REGION_SPLIT+Constants.BEHAV_ID_REGION+"="+entity.getBehavCode(); + } else if (Constants.SPECIFIC_SERVICE_CFG_TYPE_BASIC_PROTOCOL.equalsIgnoreCase(configType)) { + userRegion = Constants.PROTO_ID_REGION + "=" + entity.getAppCode(); + } else if (Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR.equalsIgnoreCase(configType)) { + userRegion = Constants.PROTO_ID_REGION + "=" + entity.getAppCode(); + if (entity.getBehavCode() != null) { + userRegion += Constants.USER_REGION_SPLIT + Constants.BEHAV_ID_REGION + "=" + entity.getBehavCode(); } - + } - //限速业务需要设置 + // 限速业务需要设置 String actionCode = DictUtils.getDictCode("SERVICE_ACTION", "action_ratelimit"); - if(!actionCode.equals("默认")){ - if(entity.getAction().equals(Integer.parseInt(actionCode))){ - userRegion += Constants.USER_REGION_SPLIT+Constants.RATE_LIMIT_REGION+"="+entity.getRatelimit(); + if (!actionCode.equals("默认")) { + if (entity.getAction().equals(Integer.parseInt(actionCode))) { + userRegion += Constants.USER_REGION_SPLIT + Constants.RATE_LIMIT_REGION + "=" + + entity.getRatelimit(); } } maatCfg.setUserRegion(userRegion); @@ -862,33 +900,34 @@ public class AppCfgService extends BaseService { maatBean.setCreatorName(entity.getCurrentUser().getName()); maatBean.setVersion(Constants.MAAT_VERSION); maatBean.setOpAction(Constants.INSERT_ACTION); - //调用服务接口下发配置数据 - String json=gsonToJson(maatBean); - logger.info("app策略配置下发配置参数:"+json); - //调用服务接口下发配置 + // 调用服务接口下发配置数据 + String json = gsonToJson(maatBean); + logger.info("app策略配置下发配置参数:" + json); + // 调用服务接口下发配置 ToMaatResult result = ConfigServiceUtil.postMaatCfg(json); - logger.info("app策略配置下发响应信息:"+result.getMsg()); + logger.info("app策略配置下发响应信息:" + result.getMsg()); - }else if(isAudit==3){ + } else if (isAudit == 3) { maatCfg.setCompileId(entity.getCompileId()); maatCfg.setServiceId(entity.getServiceId()); - maatCfg.setIsValid(0);//无效 + maatCfg.setIsValid(0);// 无效 configCompileList.add(maatCfg); maatBean.setConfigCompileList(configCompileList); maatBean.setAuditTime(entity.getAuditTime()); maatBean.setCreatorName(entity.getCurrentUser().getName()); maatBean.setVersion(Constants.MAAT_VERSION); maatBean.setOpAction(Constants.UPDATE_ACTION); - //调用服务接口取消配置 - String json=gsonToJson(maatBean); - logger.info("app策略配置下发配置参数:"+json); - //调用服务接口下发配置 - ToMaatResult result = ConfigServiceUtil.put(json,1); - logger.info("app策略配置取消配置响应信息:"+result.getMsg()); + // 调用服务接口取消配置 + String json = gsonToJson(maatBean); + logger.info("app策略配置下发配置参数:" + json); + // 调用服务接口下发配置 + ToMaatResult result = ConfigServiceUtil.put(json, 1); + logger.info("app策略配置取消配置响应信息:" + result.getMsg()); } } - public void auditAppIpCfg(AppIpCfg entity,Integer isAudit){ - ToMaatBean maatBean = new ToMaatBean(); + + public void auditAppIpCfg(AppIpCfg entity, Integer isAudit) { + ToMaatBean maatBean = new ToMaatBean(); MaatCfg maatCfg = new MaatCfg(); List configCompileList = new ArrayList(); List groupRelationList = new ArrayList(); @@ -899,28 +938,28 @@ public class AppCfgService extends BaseService { List areaIpRegionList = new ArrayList(); entity.setTableName(AppIpCfg.getTablename()); appCfgDao.auditCfg(entity); - if(isAudit==1){ + if (isAudit == 1) { List list = new ArrayList(); list.add(entity); - Map map = cfgConvert(ipRegionList,list,1,entity,groupRelationList); - groupRelationList=map.get("groupList"); - ipRegionList=map.get("dstList"); + Map map = cfgConvert(ipRegionList, list, 1, entity, groupRelationList); + groupRelationList = map.get("groupList"); + ipRegionList = map.get("dstList"); } - //保存区域IP信息 - List areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId()); - if(!StringUtil.isEmpty(areaIpCfgList)){ + // 保存区域IP信息 + List areaIpCfgList = areaIpCfgDao.getByCompileId(entity.getCompileId()); + if (!StringUtil.isEmpty(areaIpCfgList)) { AreaIpCfg cfg = new AreaIpCfg(); - BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" }); cfg.setTableName(AreaIpCfg.getTablename()); appCfgDao.auditCfg(cfg); - if(isAudit==1){ - Map map = cfgConvert(areaIpRegionList,areaIpCfgList,1,entity,groupRelationList); - groupRelationList=map.get("groupList"); - areaIpRegionList=map.get("dstList"); + if (isAudit == 1) { + Map map = cfgConvert(areaIpRegionList, areaIpCfgList, 1, entity, groupRelationList); + groupRelationList = map.get("groupList"); + areaIpRegionList = map.get("dstList"); } } - //构造提交综合服务参数格式,一条配置提交一次综合服务 - if(isAudit==1){ + // 构造提交综合服务参数格式,一条配置提交一次综合服务 + if (isAudit == 1) { maatCfg.initDefaultValue(); BeanUtils.copyProperties(entity, maatCfg); maatCfg.setAction(entity.getAction()); @@ -933,8 +972,8 @@ public class AppCfgService extends BaseService { maatCfg.setGroupNum(groupRelationList.size()); maatCfg.setAreaIpRegionList(areaIpRegionList); maatCfg.setIsValid(entity.getIsValid()); - //设置APP自定义域 - String userRegion = "APP_ID="+entity.getAppCode(); + // 设置APP自定义域 + String userRegion = "APP_ID=" + entity.getAppCode(); maatCfg.setUserRegion(userRegion); configCompileList.add(maatCfg); maatBean.setConfigCompileList(configCompileList); @@ -942,33 +981,34 @@ public class AppCfgService extends BaseService { maatBean.setCreatorName(entity.getCurrentUser().getName()); maatBean.setVersion(Constants.MAAT_VERSION); maatBean.setOpAction(Constants.INSERT_ACTION); - //调用服务接口下发配置数据 - String json=gsonToJson(maatBean); - logger.info("app协议IP配置下发配置参数:"+json); - //调用服务接口下发配置 + // 调用服务接口下发配置数据 + String json = gsonToJson(maatBean); + logger.info("app协议IP配置下发配置参数:" + json); + // 调用服务接口下发配置 ToMaatResult result = ConfigServiceUtil.postMaatCfg(json); - logger.info("app协议IP配置下发响应信息:"+result.getMsg()); + logger.info("app协议IP配置下发响应信息:" + result.getMsg()); - }else if(isAudit==3){ + } else if (isAudit == 3) { maatCfg.setCompileId(entity.getCompileId()); maatCfg.setServiceId(entity.getServiceId()); - maatCfg.setIsValid(0);//无效 + maatCfg.setIsValid(0);// 无效 configCompileList.add(maatCfg); maatBean.setConfigCompileList(configCompileList); maatBean.setAuditTime(entity.getAuditTime()); maatBean.setCreatorName(entity.getCurrentUser().getName()); maatBean.setVersion(Constants.MAAT_VERSION); maatBean.setOpAction(Constants.UPDATE_ACTION); - //调用服务接口取消配置 - String json=gsonToJson(maatBean); - logger.info("app协议IP配置下发配置参数:"+json); - //调用服务接口下发配置 - ToMaatResult result = ConfigServiceUtil.put(json,1); - logger.info("app协议IP配置取消配置响应信息:"+result.getMsg()); + // 调用服务接口取消配置 + String json = gsonToJson(maatBean); + logger.info("app协议IP配置下发配置参数:" + json); + // 调用服务接口下发配置 + ToMaatResult result = ConfigServiceUtil.put(json, 1); + logger.info("app协议IP配置取消配置响应信息:" + result.getMsg()); } } - public void auditAppHttpCfg(AppHttpCfg entity,Integer isAudit){ - ToMaatBean maatBean = new ToMaatBean(); + + public void auditAppHttpCfg(AppHttpCfg entity, Integer isAudit) { + ToMaatBean maatBean = new ToMaatBean(); MaatCfg maatCfg = new MaatCfg(); List configCompileList = new ArrayList(); List groupRelationList = new ArrayList(); @@ -979,29 +1019,29 @@ public class AppCfgService extends BaseService { List areaIpRegionList = new ArrayList(); entity.setTableName(AppHttpCfg.getTablename()); appCfgDao.auditCfg(entity); - - if(isAudit==1){ + + if (isAudit == 1) { List list = new ArrayList(); list.add(entity); - Map map = cfgConvert(strRegionList,list,2,entity,groupRelationList); - groupRelationList=map.get("groupList"); - strRegionList=map.get("dstList"); + Map map = cfgConvert(strRegionList, list, 2, entity, groupRelationList); + groupRelationList = map.get("groupList"); + strRegionList = map.get("dstList"); } - //保存区域IP信息 - List areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId()); - if(!StringUtil.isEmpty(areaIpCfgList)){ + // 保存区域IP信息 + List areaIpCfgList = areaIpCfgDao.getByCompileId(entity.getCompileId()); + if (!StringUtil.isEmpty(areaIpCfgList)) { AreaIpCfg cfg = new AreaIpCfg(); - BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" }); cfg.setTableName(AreaIpCfg.getTablename()); appCfgDao.auditCfg(cfg); - if(isAudit==1){ - Map map = cfgConvert(areaIpRegionList,areaIpCfgList,1,entity,groupRelationList); - groupRelationList=map.get("groupList"); - areaIpRegionList=map.get("dstList"); + if (isAudit == 1) { + Map map = cfgConvert(areaIpRegionList, areaIpCfgList, 1, entity, groupRelationList); + groupRelationList = map.get("groupList"); + areaIpRegionList = map.get("dstList"); } } - //构造提交综合服务参数格式,一条配置提交一次综合服务 - if(isAudit==1){ + // 构造提交综合服务参数格式,一条配置提交一次综合服务 + if (isAudit == 1) { maatCfg.initDefaultValue(); BeanUtils.copyProperties(entity, maatCfg); maatCfg.setAction(entity.getAction()); @@ -1014,8 +1054,8 @@ public class AppCfgService extends BaseService { maatCfg.setGroupNum(groupRelationList.size()); maatCfg.setAreaIpRegionList(areaIpRegionList); maatCfg.setIsValid(entity.getIsValid()); - //设置APP自定义域 - String userRegion = "APP_ID="+entity.getAppCode(); + // 设置APP自定义域 + String userRegion = "APP_ID=" + entity.getAppCode(); maatCfg.setUserRegion(userRegion); configCompileList.add(maatCfg); maatBean.setConfigCompileList(configCompileList); @@ -1023,33 +1063,34 @@ public class AppCfgService extends BaseService { maatBean.setCreatorName(entity.getCurrentUser().getName()); maatBean.setVersion(Constants.MAAT_VERSION); maatBean.setOpAction(Constants.INSERT_ACTION); - //调用服务接口下发配置数据 - String json=gsonToJson(maatBean); - logger.info("app HTTP配置下发配置参数:"+json); - //调用服务接口下发配置 + // 调用服务接口下发配置数据 + String json = gsonToJson(maatBean); + logger.info("app HTTP配置下发配置参数:" + json); + // 调用服务接口下发配置 ToMaatResult result = ConfigServiceUtil.postMaatCfg(json); - logger.info("app HTTP配置下发响应信息:"+result.getMsg()); + logger.info("app HTTP配置下发响应信息:" + result.getMsg()); - }else if(isAudit==3){ + } else if (isAudit == 3) { maatCfg.setCompileId(entity.getCompileId()); maatCfg.setServiceId(entity.getServiceId()); - maatCfg.setIsValid(0);//无效 + maatCfg.setIsValid(0);// 无效 configCompileList.add(maatCfg); maatBean.setConfigCompileList(configCompileList); maatBean.setAuditTime(entity.getAuditTime()); maatBean.setCreatorName(entity.getCurrentUser().getName()); maatBean.setVersion(Constants.MAAT_VERSION); maatBean.setOpAction(Constants.UPDATE_ACTION); - //调用服务接口取消配置 - String json=gsonToJson(maatBean); - logger.info("app HTTP配置下发配置参数:"+json); - //调用服务接口下发配置 - ToMaatResult result = ConfigServiceUtil.put(json,1); - logger.info("app HTTP配置取消配置响应信息:"+result.getMsg()); + // 调用服务接口取消配置 + String json = gsonToJson(maatBean); + logger.info("app HTTP配置下发配置参数:" + json); + // 调用服务接口下发配置 + ToMaatResult result = ConfigServiceUtil.put(json, 1); + logger.info("app HTTP配置取消配置响应信息:" + result.getMsg()); } } - public void auditAppDomainCfg(AppDomainCfg entity,Integer isAudit){ - ToMaatBean maatBean = new ToMaatBean(); + + public void auditAppDomainCfg(AppDomainCfg entity, Integer isAudit) { + ToMaatBean maatBean = new ToMaatBean(); MaatCfg maatCfg = new MaatCfg(); List configCompileList = new ArrayList(); List groupRelationList = new ArrayList(); @@ -1060,29 +1101,29 @@ public class AppCfgService extends BaseService { List areaIpRegionList = new ArrayList(); entity.setTableName(AppDomainCfg.getTablename()); appCfgDao.auditCfg(entity); - if(isAudit==1){ + if (isAudit == 1) { entity.setCfgKeywords(entity.getDomain()); List list = new ArrayList(); list.add(entity); - Map map = cfgConvert(strRegionList,list,2,entity,groupRelationList); - groupRelationList=map.get("groupList"); - strRegionList=map.get("dstList"); + Map map = cfgConvert(strRegionList, list, 2, entity, groupRelationList); + groupRelationList = map.get("groupList"); + strRegionList = map.get("dstList"); } - //保存区域IP信息 - List areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId()); - if(!StringUtil.isEmpty(areaIpCfgList)){ + // 保存区域IP信息 + List areaIpCfgList = areaIpCfgDao.getByCompileId(entity.getCompileId()); + if (!StringUtil.isEmpty(areaIpCfgList)) { AreaIpCfg cfg = new AreaIpCfg(); - BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" }); cfg.setTableName(AreaIpCfg.getTablename()); appCfgDao.auditCfg(cfg); - if(isAudit==1){ - Map map = cfgConvert(areaIpRegionList,areaIpCfgList,1,entity,groupRelationList); - groupRelationList=map.get("groupList"); - areaIpRegionList=map.get("dstList"); + if (isAudit == 1) { + Map map = cfgConvert(areaIpRegionList, areaIpCfgList, 1, entity, groupRelationList); + groupRelationList = map.get("groupList"); + areaIpRegionList = map.get("dstList"); } } - //构造提交综合服务参数格式,一条配置提交一次综合服务 - if(isAudit==1){ + // 构造提交综合服务参数格式,一条配置提交一次综合服务 + if (isAudit == 1) { maatCfg.initDefaultValue(); BeanUtils.copyProperties(entity, maatCfg); maatCfg.setAction(entity.getAction()); @@ -1095,10 +1136,10 @@ public class AppCfgService extends BaseService { maatCfg.setGroupNum(groupRelationList.size()); maatCfg.setAreaIpRegionList(areaIpRegionList); maatCfg.setIsValid(entity.getIsValid()); - //设置APP自定义域 - String userRegion = "APP_ID="+entity.getAppCode()+Constants.USER_REGION_SPLIT+ - "DOMAIN_ID="+entity.getCompileId()+Constants.USER_REGION_SPLIT+ - "DOMAIN_STR="+keywordsEscape(entity.getDomain()); + // 设置APP自定义域 + String userRegion = "APP_ID=" + entity.getAppCode() + Constants.USER_REGION_SPLIT + "DOMAIN_ID=" + + entity.getCompileId() + Constants.USER_REGION_SPLIT + "DOMAIN_STR=" + + keywordsEscape(entity.getDomain()); maatCfg.setUserRegion(userRegion); configCompileList.add(maatCfg); maatBean.setConfigCompileList(configCompileList); @@ -1106,35 +1147,35 @@ public class AppCfgService extends BaseService { maatBean.setCreatorName(entity.getCurrentUser().getName()); maatBean.setVersion(Constants.MAAT_VERSION); maatBean.setOpAction(Constants.INSERT_ACTION); - //调用服务接口下发配置数据 - String json=gsonToJson(maatBean); - logger.info("app域名配置下发配置参数:"+json); - //调用服务接口下发配置 + // 调用服务接口下发配置数据 + String json = gsonToJson(maatBean); + logger.info("app域名配置下发配置参数:" + json); + // 调用服务接口下发配置 ToMaatResult result = ConfigServiceUtil.postMaatCfg(json); - logger.info("app域名配置下发响应信息:"+result.getMsg()); + logger.info("app域名配置下发响应信息:" + result.getMsg()); - }else if(isAudit==3){ + } else if (isAudit == 3) { maatCfg.setCompileId(entity.getCompileId()); maatCfg.setServiceId(entity.getServiceId()); - maatCfg.setIsValid(0);//无效 + maatCfg.setIsValid(0);// 无效 configCompileList.add(maatCfg); maatBean.setConfigCompileList(configCompileList); maatBean.setAuditTime(entity.getAuditTime()); maatBean.setCreatorName(entity.getCurrentUser().getName()); maatBean.setVersion(Constants.MAAT_VERSION); maatBean.setOpAction(Constants.UPDATE_ACTION); - //调用服务接口取消配置 - String json=gsonToJson(maatBean); - logger.info("app域名配置下发配置参数:"+json); - //调用服务接口下发配置 - ToMaatResult result = ConfigServiceUtil.put(json,1); - logger.info("app域名配置取消配置响应信息:"+result.getMsg()); + // 调用服务接口取消配置 + String json = gsonToJson(maatBean); + logger.info("app域名配置下发配置参数:" + json); + // 调用服务接口下发配置 + ToMaatResult result = ConfigServiceUtil.put(json, 1); + logger.info("app域名配置取消配置响应信息:" + result.getMsg()); } } - - //app主题网站配置审核 - public void auditAppTopicDomainCfg(AppTopicDomainCfg entity,Integer isAudit){ - ToMaatBean maatBean = new ToMaatBean(); + + // app主题网站配置审核 + public void auditAppTopicDomainCfg(AppTopicDomainCfg entity, Integer isAudit) { + ToMaatBean maatBean = new ToMaatBean(); MaatCfg maatCfg = new MaatCfg(); List configCompileList = new ArrayList(); List groupRelationList = new ArrayList(); @@ -1145,30 +1186,30 @@ public class AppCfgService extends BaseService { List areaIpRegionList = new ArrayList(); entity.setTableName(AppTopicDomainCfg.getTablename()); appCfgDao.auditCfg(entity); - //域名为关键字 - if(isAudit==1){ + // 域名为关键字 + if (isAudit == 1) { entity.setCfgKeywords(entity.getDomain()); List list = new ArrayList(); list.add(entity); - Map map = cfgConvert(strRegionList,list,2,entity,groupRelationList); - groupRelationList=map.get("groupList"); - strRegionList=map.get("dstList"); + Map map = cfgConvert(strRegionList, list, 2, entity, groupRelationList); + groupRelationList = map.get("groupList"); + strRegionList = map.get("dstList"); } - //保存区域IP信息 - List areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId()); - if(!StringUtil.isEmpty(areaIpCfgList)){ + // 保存区域IP信息 + List areaIpCfgList = areaIpCfgDao.getByCompileId(entity.getCompileId()); + if (!StringUtil.isEmpty(areaIpCfgList)) { AreaIpCfg cfg = new AreaIpCfg(); - BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" }); cfg.setTableName(AreaIpCfg.getTablename()); appCfgDao.auditCfg(cfg); - if(isAudit==1){ - Map map = cfgConvert(areaIpRegionList,areaIpCfgList,1,entity,groupRelationList); - groupRelationList=map.get("groupList"); - areaIpRegionList=map.get("dstList"); + if (isAudit == 1) { + Map map = cfgConvert(areaIpRegionList, areaIpCfgList, 1, entity, groupRelationList); + groupRelationList = map.get("groupList"); + areaIpRegionList = map.get("dstList"); } } - //构造提交综合服务参数格式,一条配置提交一次综合服务 - if(isAudit==1){ + // 构造提交综合服务参数格式,一条配置提交一次综合服务 + if (isAudit == 1) { maatCfg.initDefaultValue(); BeanUtils.copyProperties(entity, maatCfg); maatCfg.setAction(entity.getAction()); @@ -1181,50 +1222,48 @@ public class AppCfgService extends BaseService { maatCfg.setGroupNum(groupRelationList.size()); maatCfg.setAreaIpRegionList(areaIpRegionList); maatCfg.setIsValid(entity.getIsValid()); - - //设置APP自定义域 -// "APP_ID="+entity.getAppCode()+Constants.USER_REGION_SPLIT+ - String userRegion = "DOMAIN_ID="+entity.getCompileId()+Constants.USER_REGION_SPLIT+ - "DOMAIN_STR="+keywordsEscape(entity.getDomain()); - + + // 设置APP自定义域 + // "APP_ID="+entity.getAppCode()+Constants.USER_REGION_SPLIT+ + String userRegion = "DOMAIN_ID=" + entity.getCompileId() + Constants.USER_REGION_SPLIT + "DOMAIN_STR=" + + keywordsEscape(entity.getDomain()); + maatCfg.setUserRegion(userRegion); - - + configCompileList.add(maatCfg); maatBean.setConfigCompileList(configCompileList); maatBean.setAuditTime(entity.getAuditTime()); maatBean.setCreatorName(entity.getCurrentUser().getName()); maatBean.setVersion(Constants.MAAT_VERSION); maatBean.setOpAction(Constants.INSERT_ACTION); - //调用服务接口下发配置数据 - String json=gsonToJson(maatBean); - logger.info("app主题网站配置下发配置参数:"+json); - //调用服务接口下发配置 + // 调用服务接口下发配置数据 + String json = gsonToJson(maatBean); + logger.info("app主题网站配置下发配置参数:" + json); + // 调用服务接口下发配置 ToMaatResult result = ConfigServiceUtil.postMaatCfg(json); - logger.info("app主题网站配置下发响应信息:"+result.getMsg()); + logger.info("app主题网站配置下发响应信息:" + result.getMsg()); - }else if(isAudit==3){ + } else if (isAudit == 3) { maatCfg.setCompileId(entity.getCompileId()); maatCfg.setServiceId(entity.getServiceId()); - maatCfg.setIsValid(0);//无效 + maatCfg.setIsValid(0);// 无效 configCompileList.add(maatCfg); maatBean.setConfigCompileList(configCompileList); maatBean.setAuditTime(entity.getAuditTime()); maatBean.setCreatorName(entity.getCurrentUser().getName()); maatBean.setVersion(Constants.MAAT_VERSION); maatBean.setOpAction(Constants.UPDATE_ACTION); - //调用服务接口取消配置 - String json=gsonToJson(maatBean); - logger.info("app主题网站配置下发配置参数:"+json); - //调用服务接口下发配置 - ToMaatResult result = ConfigServiceUtil.put(json,1); - logger.info("app主题网站配置取消配置响应信息:"+result.getMsg()); + // 调用服务接口取消配置 + String json = gsonToJson(maatBean); + logger.info("app主题网站配置下发配置参数:" + json); + // 调用服务接口下发配置 + ToMaatResult result = ConfigServiceUtil.put(json, 1); + logger.info("app主题网站配置取消配置响应信息:" + result.getMsg()); } } - - - public void auditAppByteCfg(AppByteCfg entity,Integer isAudit){ - ToMaatBean maatBean = new ToMaatBean(); + + public void auditAppByteCfg(AppByteCfg entity, Integer isAudit) { + ToMaatBean maatBean = new ToMaatBean(); MaatCfg maatCfg = new MaatCfg(); List configCompileList = new ArrayList(); List groupRelationList = new ArrayList(); @@ -1235,30 +1274,30 @@ public class AppCfgService extends BaseService { List areaIpRegionList = new ArrayList(); entity.setTableName(AppByteCfg.getTablename()); appCfgDao.auditCfg(entity); - - if(isAudit==1){ + + if (isAudit == 1) { entity.setCfgKeywords(entity.getBytes()); List list = new ArrayList(); list.add(entity); - Map map = cfgConvert(strRegionList,list,2,entity,groupRelationList); - groupRelationList=map.get("groupList"); - strRegionList=map.get("dstList"); + Map map = cfgConvert(strRegionList, list, 2, entity, groupRelationList); + groupRelationList = map.get("groupList"); + strRegionList = map.get("dstList"); } - //保存区域IP信息 - List areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId()); - if(!StringUtil.isEmpty(areaIpCfgList)){ + // 保存区域IP信息 + List areaIpCfgList = areaIpCfgDao.getByCompileId(entity.getCompileId()); + if (!StringUtil.isEmpty(areaIpCfgList)) { AreaIpCfg cfg = new AreaIpCfg(); - BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" }); cfg.setTableName(AreaIpCfg.getTablename()); appCfgDao.auditCfg(cfg); - if(isAudit==1){ - Map map = cfgConvert(areaIpRegionList,areaIpCfgList,1,entity,groupRelationList); - groupRelationList=map.get("groupList"); - areaIpRegionList=map.get("dstList"); + if (isAudit == 1) { + Map map = cfgConvert(areaIpRegionList, areaIpCfgList, 1, entity, groupRelationList); + groupRelationList = map.get("groupList"); + areaIpRegionList = map.get("dstList"); } } - //构造提交综合服务参数格式,一条配置提交一次综合服务 - if(isAudit==1){ + // 构造提交综合服务参数格式,一条配置提交一次综合服务 + if (isAudit == 1) { maatCfg.initDefaultValue(); BeanUtils.copyProperties(entity, maatCfg); maatCfg.setAction(entity.getAction()); @@ -1271,8 +1310,8 @@ public class AppCfgService extends BaseService { maatCfg.setGroupNum(groupRelationList.size()); maatCfg.setAreaIpRegionList(areaIpRegionList); maatCfg.setIsValid(entity.getIsValid()); - //设置用户自定义域 - String userRegion = "APP_ID="+entity.getAppCode(); + // 设置用户自定义域 + String userRegion = "APP_ID=" + entity.getAppCode(); maatCfg.setUserRegion(userRegion); configCompileList.add(maatCfg); maatBean.setConfigCompileList(configCompileList); @@ -1280,33 +1319,34 @@ public class AppCfgService extends BaseService { maatBean.setCreatorName(entity.getCurrentUser().getName()); maatBean.setVersion(Constants.MAAT_VERSION); maatBean.setOpAction(Constants.INSERT_ACTION); - //调用服务接口下发配置数据 - String json=gsonToJson(maatBean); - logger.info("app字节配置下发配置参数:"+json); - //调用服务接口下发配置 + // 调用服务接口下发配置数据 + String json = gsonToJson(maatBean); + logger.info("app字节配置下发配置参数:" + json); + // 调用服务接口下发配置 ToMaatResult result = ConfigServiceUtil.postMaatCfg(json); - logger.info("app字节配置下发响应信息:"+result.getMsg()); + logger.info("app字节配置下发响应信息:" + result.getMsg()); - }else if(isAudit==3){ + } else if (isAudit == 3) { maatCfg.setCompileId(entity.getCompileId()); maatCfg.setServiceId(entity.getServiceId()); - maatCfg.setIsValid(0);//无效 + maatCfg.setIsValid(0);// 无效 configCompileList.add(maatCfg); maatBean.setConfigCompileList(configCompileList); maatBean.setAuditTime(entity.getAuditTime()); maatBean.setCreatorName(entity.getCurrentUser().getName()); maatBean.setVersion(Constants.MAAT_VERSION); maatBean.setOpAction(Constants.UPDATE_ACTION); - //调用服务接口取消配置 - String json=gsonToJson(maatBean); - logger.info("app字节配置下发配置参数:"+json); - //调用服务接口下发配置 - ToMaatResult result = ConfigServiceUtil.put(json,1); - logger.info("app字节配置取消配置响应信息:"+result.getMsg()); + // 调用服务接口取消配置 + String json = gsonToJson(maatBean); + logger.info("app字节配置下发配置参数:" + json); + // 调用服务接口下发配置 + ToMaatResult result = ConfigServiceUtil.put(json, 1); + logger.info("app字节配置取消配置响应信息:" + result.getMsg()); } } - public void auditAppSslCfg(AppSslCertCfg entity,Integer isAudit){ - ToMaatBean maatBean = new ToMaatBean(); + + public void auditAppSslCfg(AppSslCertCfg entity, Integer isAudit) { + ToMaatBean maatBean = new ToMaatBean(); MaatCfg maatCfg = new MaatCfg(); List configCompileList = new ArrayList(); List groupRelationList = new ArrayList(); @@ -1317,29 +1357,29 @@ public class AppCfgService extends BaseService { List areaIpRegionList = new ArrayList(); entity.setTableName(AppSslCertCfg.getTablename()); appCfgDao.auditCfg(entity); - - if(isAudit==1){ + + if (isAudit == 1) { List list = new ArrayList(); list.add(entity); - Map map = cfgConvert(strRegionList,list,3,entity,groupRelationList); - groupRelationList=map.get("groupList"); - strRegionList=map.get("dstList"); + Map map = cfgConvert(strRegionList, list, 3, entity, groupRelationList); + groupRelationList = map.get("groupList"); + strRegionList = map.get("dstList"); } - //保存区域IP信息 - List areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId()); - if(!StringUtil.isEmpty(areaIpCfgList)){ + // 保存区域IP信息 + List areaIpCfgList = areaIpCfgDao.getByCompileId(entity.getCompileId()); + if (!StringUtil.isEmpty(areaIpCfgList)) { AreaIpCfg cfg = new AreaIpCfg(); - BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" }); cfg.setTableName(AreaIpCfg.getTablename()); appCfgDao.auditCfg(cfg); - if(isAudit==1){ - Map map = cfgConvert(areaIpRegionList,areaIpCfgList,1,entity,groupRelationList); - groupRelationList=map.get("groupList"); - areaIpRegionList=map.get("dstList"); + if (isAudit == 1) { + Map map = cfgConvert(areaIpRegionList, areaIpCfgList, 1, entity, groupRelationList); + groupRelationList = map.get("groupList"); + areaIpRegionList = map.get("dstList"); } } - //构造提交综合服务参数格式,一条配置提交一次综合服务 - if(isAudit==1){ + // 构造提交综合服务参数格式,一条配置提交一次综合服务 + if (isAudit == 1) { maatCfg.initDefaultValue(); BeanUtils.copyProperties(entity, maatCfg); maatCfg.setAction(entity.getAction()); @@ -1352,8 +1392,8 @@ public class AppCfgService extends BaseService { maatCfg.setGroupNum(groupRelationList.size()); maatCfg.setAreaIpRegionList(areaIpRegionList); maatCfg.setIsValid(entity.getIsValid()); - //设置APP自定义域 - String userRegion = "APP_ID="+entity.getAppCode(); + // 设置APP自定义域 + String userRegion = "APP_ID=" + entity.getAppCode(); maatCfg.setUserRegion(userRegion); configCompileList.add(maatCfg); maatBean.setConfigCompileList(configCompileList); @@ -1361,35 +1401,36 @@ public class AppCfgService extends BaseService { maatBean.setCreatorName(entity.getCurrentUser().getName()); maatBean.setVersion(Constants.MAAT_VERSION); maatBean.setOpAction(Constants.INSERT_ACTION); - //调用服务接口下发配置数据 - String json=gsonToJson(maatBean); - logger.info("app SSL配置下发配置参数:"+json); - //调用服务接口下发配置 + // 调用服务接口下发配置数据 + String json = gsonToJson(maatBean); + logger.info("app SSL配置下发配置参数:" + json); + // 调用服务接口下发配置 ToMaatResult result = ConfigServiceUtil.postMaatCfg(json); - logger.info("app SSL配置下发响应信息:"+result.getMsg()); + logger.info("app SSL配置下发响应信息:" + result.getMsg()); - }else if(isAudit==3){ + } else if (isAudit == 3) { maatCfg.setCompileId(entity.getCompileId()); maatCfg.setServiceId(entity.getServiceId()); - maatCfg.setIsValid(0);//无效 + maatCfg.setIsValid(0);// 无效 configCompileList.add(maatCfg); maatBean.setConfigCompileList(configCompileList); maatBean.setAuditTime(entity.getAuditTime()); maatBean.setCreatorName(entity.getCurrentUser().getName()); maatBean.setVersion(Constants.MAAT_VERSION); maatBean.setOpAction(Constants.UPDATE_ACTION); - //调用服务接口取消配置 - String json=gsonToJson(maatBean); - logger.info("app SSL配置下发配置参数:"+json); - //调用服务接口下发配置 - ToMaatResult result = ConfigServiceUtil.put(json,1); - logger.info("app SSL配置取消配置响应信息:"+result.getMsg()); + // 调用服务接口取消配置 + String json = gsonToJson(maatBean); + logger.info("app SSL配置下发配置参数:" + json); + // 调用服务接口下发配置 + ToMaatResult result = ConfigServiceUtil.put(json, 1); + logger.info("app SSL配置取消配置响应信息:" + result.getMsg()); } } - public void updateAppPolicyCfgValid(Integer isValid,String ids,Integer functionId){ + + public void updateAppPolicyCfgValid(Integer isValid, String ids, Integer functionId) { AppPolicyCfg entity = new AppPolicyCfg(); String[] idArray = ids.split(","); - for(String id :idArray){ + for (String id : idArray) { entity.setCfgId(Long.parseLong(id)); entity.setIsValid(isValid); entity.setEditorId(UserUtils.getUser().getId()); @@ -1397,36 +1438,37 @@ public class AppCfgService extends BaseService { entity.setTableName(AppPolicyCfg.getTablename()); entity.setFunctionId(functionId); appCfgDao.updateCfgValid(entity); - - //查询子配置 + + // 查询子配置 entity = this.getAppPolicyCfg(Long.parseLong(id)); - if(entity.getIpPortList()!=null && entity.getIpPortList().size()>0){ + if (entity.getIpPortList() != null && entity.getIpPortList().size() > 0) { IpPortCfg cfg = new IpPortCfg(); - BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" }); cfg.setTableName(IpPortCfg.getTablename()); appCfgDao.updateCfgValid(cfg); } - //删除关键字 - if(entity.getNtcSubscribeIdCfgList()!=null&&entity.getNtcSubscribeIdCfgList().size()>0){ + // 删除关键字 + if (entity.getNtcSubscribeIdCfgList() != null && entity.getNtcSubscribeIdCfgList().size() > 0) { NtcSubscribeIdCfg ntcSubscribeIdCfg = new NtcSubscribeIdCfg(); - BeanUtils.copyProperties(entity, ntcSubscribeIdCfg, new String[]{"cfgId"}); + BeanUtils.copyProperties(entity, ntcSubscribeIdCfg, new String[] { "cfgId" }); stringcfgDao.updateSubscribeIdCfg(ntcSubscribeIdCfg); } - //保存区域IP信息 - if(entity.getAreaCfg()!=null && entity.getAreaCfg().size()>0){ + // 保存区域IP信息 + if (entity.getAreaCfg() != null && entity.getAreaCfg().size() > 0) { AreaIpCfg cfg = new AreaIpCfg(); - BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" }); cfg.setTableName(AreaIpCfg.getTablename()); appCfgDao.updateCfgValid(cfg); } - + } - + } - public void updateAppIpCfgValid(Integer isValid,String ids,Integer functionId){ + + public void updateAppIpCfgValid(Integer isValid, String ids, Integer functionId) { AppIpCfg entity = new AppIpCfg(); String[] idArray = ids.split(","); - for(String id :idArray){ + for (String id : idArray) { entity.setCfgId(Long.parseLong(id)); entity.setIsValid(isValid); entity.setEditorId(UserUtils.getUser().getId()); @@ -1434,22 +1476,22 @@ public class AppCfgService extends BaseService { entity.setTableName(AppIpCfg.getTablename()); entity.setFunctionId(functionId); appCfgDao.updateCfgValid(entity); - //保存区域IP信息 - if(entity.getAreaCfg()!=null && entity.getAreaCfg().size()>0){ + // 保存区域IP信息 + if (entity.getAreaCfg() != null && entity.getAreaCfg().size() > 0) { AreaIpCfg cfg = new AreaIpCfg(); - BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" }); cfg.setTableName(AreaIpCfg.getTablename()); appCfgDao.updateCfgValid(cfg); } - + } - + } - - public void updateAppTcpCfgValid(Integer isValid,String ids,Integer functionId){ + + public void updateAppTcpCfgValid(Integer isValid, String ids, Integer functionId) { AppTcpCfg entity = new AppTcpCfg(); String[] idArray = ids.split(","); - for(String id :idArray){ + for (String id : idArray) { entity.setCfgId(Long.parseLong(id)); entity.setIsValid(isValid); entity.setEditorId(UserUtils.getUser().getId()); @@ -1457,22 +1499,22 @@ public class AppCfgService extends BaseService { entity.setTableName(AppTcpCfg.getTablename()); entity.setFunctionId(functionId); appCfgDao.updateCfgValid(entity); - //保存区域IP信息 - if(entity.getAreaCfg()!=null && entity.getAreaCfg().size()>0){ + // 保存区域IP信息 + if (entity.getAreaCfg() != null && entity.getAreaCfg().size() > 0) { AreaIpCfg cfg = new AreaIpCfg(); - BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" }); cfg.setTableName(AreaIpCfg.getTablename()); appCfgDao.updateCfgValid(cfg); } - + } - + } - - public void updateAppHttpCfgValid(Integer isValid,String ids,Integer functionId){ + + public void updateAppHttpCfgValid(Integer isValid, String ids, Integer functionId) { AppHttpCfg entity = new AppHttpCfg(); String[] idArray = ids.split(","); - for(String id :idArray){ + for (String id : idArray) { entity.setCfgId(Long.parseLong(id)); entity.setIsValid(isValid); entity.setEditorId(UserUtils.getUser().getId()); @@ -1480,21 +1522,22 @@ public class AppCfgService extends BaseService { entity.setTableName(AppHttpCfg.getTablename()); entity.setFunctionId(functionId); appCfgDao.updateCfgValid(entity); - //保存区域IP信息 - if(entity.getAreaCfg()!=null && entity.getAreaCfg().size()>0){ + // 保存区域IP信息 + if (entity.getAreaCfg() != null && entity.getAreaCfg().size() > 0) { AreaIpCfg cfg = new AreaIpCfg(); - BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" }); cfg.setTableName(AreaIpCfg.getTablename()); appCfgDao.updateCfgValid(cfg); } - + } - + } - public void updateAppDomainCfgValid(Integer isValid,String ids,Integer functionId){ + + public void updateAppDomainCfgValid(Integer isValid, String ids, Integer functionId) { AppDomainCfg entity = new AppDomainCfg(); String[] idArray = ids.split(","); - for(String id :idArray){ + for (String id : idArray) { entity.setCfgId(Long.parseLong(id)); entity.setIsValid(isValid); entity.setEditorId(UserUtils.getUser().getId()); @@ -1502,45 +1545,46 @@ public class AppCfgService extends BaseService { entity.setTableName(AppDomainCfg.getTablename()); entity.setFunctionId(functionId); appCfgDao.updateCfgValid(entity); - //保存区域IP信息 - if(entity.getAreaCfg()!=null && entity.getAreaCfg().size()>0){ + // 保存区域IP信息 + if (entity.getAreaCfg() != null && entity.getAreaCfg().size() > 0) { AreaIpCfg cfg = new AreaIpCfg(); - BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" }); cfg.setTableName(AreaIpCfg.getTablename()); appCfgDao.updateCfgValid(cfg); } - + } - + } - //主题网站配置删除 - public void updateAppTopicDomainCfgValid(Integer isValid,String ids,Integer functionId){ - AppTopicDomainCfg entity = new AppTopicDomainCfg(); - String[] idArray = ids.split(","); - for(String id :idArray){ - entity.setCfgId(Long.parseLong(id)); - entity.setIsValid(isValid); - entity.setEditorId(UserUtils.getUser().getId()); - entity.setEditTime(new Date()); - entity.setTableName(AppTopicDomainCfg.getTablename()); - entity.setFunctionId(functionId); - appCfgDao.updateCfgValid(entity); - //保存区域IP信息 - if(entity.getAreaCfg()!=null && entity.getAreaCfg().size()>0){ - AreaIpCfg cfg = new AreaIpCfg(); - BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); - cfg.setTableName(AreaIpCfg.getTablename()); - appCfgDao.updateCfgValid(cfg); - } - + + // 主题网站配置删除 + public void updateAppTopicDomainCfgValid(Integer isValid, String ids, Integer functionId) { + AppTopicDomainCfg entity = new AppTopicDomainCfg(); + String[] idArray = ids.split(","); + for (String id : idArray) { + entity.setCfgId(Long.parseLong(id)); + entity.setIsValid(isValid); + entity.setEditorId(UserUtils.getUser().getId()); + entity.setEditTime(new Date()); + entity.setTableName(AppTopicDomainCfg.getTablename()); + entity.setFunctionId(functionId); + appCfgDao.updateCfgValid(entity); + // 保存区域IP信息 + if (entity.getAreaCfg() != null && entity.getAreaCfg().size() > 0) { + AreaIpCfg cfg = new AreaIpCfg(); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" }); + cfg.setTableName(AreaIpCfg.getTablename()); + appCfgDao.updateCfgValid(cfg); } - + } - - public void updateAppByteCfgValid(Integer isValid,String ids,Integer functionId){ + + } + + public void updateAppByteCfgValid(Integer isValid, String ids, Integer functionId) { AppByteCfg entity = new AppByteCfg(); String[] idArray = ids.split(","); - for(String id :idArray){ + for (String id : idArray) { entity.setCfgId(Long.parseLong(id)); entity.setIsValid(isValid); entity.setEditorId(UserUtils.getUser().getId()); @@ -1548,21 +1592,22 @@ public class AppCfgService extends BaseService { entity.setTableName(AppByteCfg.getTablename()); entity.setFunctionId(functionId); appCfgDao.updateCfgValid(entity); - //保存区域IP信息 - if(entity.getAreaCfg()!=null && entity.getAreaCfg().size()>0){ + // 保存区域IP信息 + if (entity.getAreaCfg() != null && entity.getAreaCfg().size() > 0) { AreaIpCfg cfg = new AreaIpCfg(); - BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" }); cfg.setTableName(AreaIpCfg.getTablename()); appCfgDao.updateCfgValid(cfg); } - + } - + } - public void updateAppSslCfgValid(Integer isValid,String ids,Integer functionId){ + + public void updateAppSslCfgValid(Integer isValid, String ids, Integer functionId) { AppSslCertCfg entity = new AppSslCertCfg(); String[] idArray = ids.split(","); - for(String id :idArray){ + for (String id : idArray) { entity.setCfgId(Long.parseLong(id)); entity.setIsValid(isValid); entity.setEditorId(UserUtils.getUser().getId()); @@ -1570,21 +1615,22 @@ public class AppCfgService extends BaseService { entity.setTableName(AppSslCertCfg.getTablename()); entity.setFunctionId(functionId); appCfgDao.updateCfgValid(entity); - //保存区域IP信息 - if(entity.getAreaCfg()!=null && entity.getAreaCfg().size()>0){ + // 保存区域IP信息 + if (entity.getAreaCfg() != null && entity.getAreaCfg().size() > 0) { AreaIpCfg cfg = new AreaIpCfg(); - BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" }); cfg.setTableName(AreaIpCfg.getTablename()); appCfgDao.updateCfgValid(cfg); } - + } - + } - public void updateAppHeaderCfgValid(Integer isValid,String ids,Integer functionId){ + + public void updateAppHeaderCfgValid(Integer isValid, String ids, Integer functionId) { AppHeaderCfg entity = new AppHeaderCfg(); String[] idArray = ids.split(","); - for(String id :idArray){ + for (String id : idArray) { entity.setCfgId(Long.parseLong(id)); entity.setIsValid(isValid); entity.setEditorId(UserUtils.getUser().getId()); @@ -1592,36 +1638,39 @@ public class AppCfgService extends BaseService { entity.setTableName(AppHeaderCfg.getTablename()); entity.setFunctionId(functionId); appCfgDao.updateCfgValid(entity); - //保存区域IP信息 - if(entity.getAreaCfg()!=null && entity.getAreaCfg().size()>0){ + // 保存区域IP信息 + if (entity.getAreaCfg() != null && entity.getAreaCfg().size() > 0) { AreaIpCfg cfg = new AreaIpCfg(); - BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" }); cfg.setTableName(AreaIpCfg.getTablename()); appCfgDao.updateCfgValid(cfg); } - + } - + } + public Page findAppHeaderList(Page page, AppHeaderCfg entity) { - entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r")); + entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(), "r")); entity.setPage(page); List list = appCfgDao.findAppHeaderList(entity); page.setList(list); return page; } - public AppHeaderCfg getAppHeaderCfg(Long cfgId){ + + public AppHeaderCfg getAppHeaderCfg(Long cfgId) { return appCfgDao.getAppHeaderCfg(cfgId); } - @Transactional(readOnly=false,rollbackFor=RuntimeException.class) - public void saveOrUpdateAppHeaderCfg(AppHeaderCfg entity) throws Exception{ - //设置区域运营商信息 + + @Transactional(readOnly = false, rollbackFor = RuntimeException.class) + public void saveOrUpdateAppHeaderCfg(AppHeaderCfg entity) throws Exception { + // 设置区域运营商信息 setAreaEffectiveIds(entity); - if(entity.getCfgId()==null){ + if (entity.getCfgId() == null) { Integer compileId = 0; try { List idList = ConfigServiceUtil.getId(1, 1); - if(idList!=null && idList.size()>0){ + if (idList != null && idList.size() > 0) { compileId = idList.get(0); } entity.setCompileId(compileId); @@ -1630,48 +1679,49 @@ public class AppCfgService extends BaseService { entity.setIsValid(0); entity.setIsAudit(0); appCfgDao.insertAppHeaderCfg(entity); - //保存区域IP信息 - if(entity.getAreaCfg()!=null){ - for(AreaIpCfg cfg:entity.getAreaCfg()){ + // 保存区域IP信息 + if (entity.getAreaCfg() != null) { + for (AreaIpCfg cfg : entity.getAreaCfg()) { cfg.initDefaultValue(); - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgRegionCode", "cfgType" }); areaIpCfgDao.saveAreaIpCfg(cfg); } } - - }catch (Exception e) { + + } catch (Exception e) { e.printStackTrace(); logger.info("获取编译ID出错"); throw new MaatConvertException(e.getMessage()); } - }else{ + } else { entity.setEditorId(entity.getCurrentUser().getId()); entity.setEditTime(new Date()); entity.setIsValid(0); entity.setIsAudit(0); appCfgDao.updateAppHeaderCfg(entity); - - //删除旧的区域IP,新增新的区域IP + + // 删除旧的区域IP,新增新的区域IP AreaIpCfg area = new AreaIpCfg(); area.setCompileId(entity.getCompileId()); area.setFunctionId(entity.getFunctionId()); areaIpCfgDao.deleteAreaIpCfg(area); entity.setCreateTime(new Date()); entity.setCreatorId(entity.getCurrentUser().getId()); - //保存区域IP信息 - if(entity.getAreaCfg()!=null){ - for(AreaIpCfg cfg:entity.getAreaCfg()){ + // 保存区域IP信息 + if (entity.getAreaCfg() != null) { + for (AreaIpCfg cfg : entity.getAreaCfg()) { cfg.initDefaultValue(); - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgDesc","cfgRegionCode","cfgType"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgDesc", "cfgRegionCode", "cfgType" }); areaIpCfgDao.saveAreaIpCfg(cfg); } } - + } - + } - public void auditAppHeaderCfg(AppHeaderCfg entity,Integer isAudit){ - ToMaatBean maatBean = new ToMaatBean(); + + public void auditAppHeaderCfg(AppHeaderCfg entity, Integer isAudit) { + ToMaatBean maatBean = new ToMaatBean(); MaatCfg maatCfg = new MaatCfg(); List configCompileList = new ArrayList(); List groupRelationList = new ArrayList(); @@ -1682,29 +1732,29 @@ public class AppCfgService extends BaseService { List areaIpRegionList = new ArrayList(); entity.setTableName(AppHeaderCfg.getTablename()); appCfgDao.auditCfg(entity); - - if(isAudit==1){ + + if (isAudit == 1) { List list = new ArrayList(); list.add(entity); - Map map = cfgConvert(strRegionList,list,3,entity,groupRelationList); - groupRelationList=map.get("groupList"); - strRegionList=map.get("dstList"); + Map map = cfgConvert(strRegionList, list, 3, entity, groupRelationList); + groupRelationList = map.get("groupList"); + strRegionList = map.get("dstList"); } - //保存区域IP信息 - List areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId()); - if(!StringUtil.isEmpty(areaIpCfgList)){ + // 保存区域IP信息 + List areaIpCfgList = areaIpCfgDao.getByCompileId(entity.getCompileId()); + if (!StringUtil.isEmpty(areaIpCfgList)) { AreaIpCfg cfg = new AreaIpCfg(); - BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" }); cfg.setTableName(AreaIpCfg.getTablename()); appCfgDao.auditCfg(cfg); - if(isAudit==1){ - Map map = cfgConvert(areaIpRegionList,areaIpCfgList,1,entity,groupRelationList); - groupRelationList=map.get("groupList"); - areaIpRegionList=map.get("dstList"); + if (isAudit == 1) { + Map map = cfgConvert(areaIpRegionList, areaIpCfgList, 1, entity, groupRelationList); + groupRelationList = map.get("groupList"); + areaIpRegionList = map.get("dstList"); } } - //构造提交综合服务参数格式,一条配置提交一次综合服务 - if(isAudit==1){ + // 构造提交综合服务参数格式,一条配置提交一次综合服务 + if (isAudit == 1) { maatCfg.initDefaultValue(); BeanUtils.copyProperties(entity, maatCfg); maatCfg.setAction(entity.getAction()); @@ -1717,8 +1767,8 @@ public class AppCfgService extends BaseService { maatCfg.setGroupNum(groupRelationList.size()); maatCfg.setAreaIpRegionList(areaIpRegionList); maatCfg.setIsValid(entity.getIsValid()); - //设置APP自定义域 - String userRegion = "APP_ID="+entity.getAppCode(); + // 设置APP自定义域 + String userRegion = "APP_ID=" + entity.getAppCode(); maatCfg.setUserRegion(userRegion); configCompileList.add(maatCfg); maatBean.setConfigCompileList(configCompileList); @@ -1726,29 +1776,29 @@ public class AppCfgService extends BaseService { maatBean.setCreatorName(entity.getCurrentUser().getName()); maatBean.setVersion(Constants.MAAT_VERSION); maatBean.setOpAction(Constants.INSERT_ACTION); - //调用服务接口下发配置数据 - String json=gsonToJson(maatBean); - logger.info("app Header配置下发配置参数:"+json); - //调用服务接口下发配置 + // 调用服务接口下发配置数据 + String json = gsonToJson(maatBean); + logger.info("app Header配置下发配置参数:" + json); + // 调用服务接口下发配置 ToMaatResult result = ConfigServiceUtil.postMaatCfg(json); - logger.info("app Header配置下发响应信息:"+result.getMsg()); + logger.info("app Header配置下发响应信息:" + result.getMsg()); - }else if(isAudit==3){ + } else if (isAudit == 3) { maatCfg.setCompileId(entity.getCompileId()); maatCfg.setServiceId(entity.getServiceId()); - maatCfg.setIsValid(0);//无效 + maatCfg.setIsValid(0);// 无效 configCompileList.add(maatCfg); maatBean.setConfigCompileList(configCompileList); maatBean.setAuditTime(entity.getAuditTime()); maatBean.setCreatorName(entity.getCurrentUser().getName()); maatBean.setVersion(Constants.MAAT_VERSION); maatBean.setOpAction(Constants.UPDATE_ACTION); - //调用服务接口取消配置 - String json=gsonToJson(maatBean); - logger.info("app Header配置下发配置参数:"+json); - //调用服务接口下发配置 - ToMaatResult result = ConfigServiceUtil.put(json,1); - logger.info("app Header配置取消配置响应信息:"+result.getMsg()); + // 调用服务接口取消配置 + String json = gsonToJson(maatBean); + logger.info("app Header配置下发配置参数:" + json); + // 调用服务接口下发配置 + ToMaatResult result = ConfigServiceUtil.put(json, 1); + logger.info("app Header配置取消配置响应信息:" + result.getMsg()); } } } diff --git a/src/main/webapp/WEB-INF/views/cfg/app/appPolicyCfgForm.jsp b/src/main/webapp/WEB-INF/views/cfg/app/appPolicyCfgForm.jsp index 283fe2e40..95c0599c8 100644 --- a/src/main/webapp/WEB-INF/views/cfg/app/appPolicyCfgForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/app/appPolicyCfgForm.jsp @@ -46,7 +46,7 @@ $(function(){ top.$.jBox.tip("", ""); return; } - $("input[name$='cfgKeywords']").each(function(){ + $(".boxSolid:visible").find("input[name$='cfgKeywords']").each(function(){ if($(this).val()==''){ $(this).parents(".form-group").find( "div[for='" @@ -54,7 +54,7 @@ $(function(){ + "']").html(""); flag = false; } - }) + }); $("select[name$='isHexbin']").each(function(){ var isHexbin=$(this).val(); if(isHexbin == 1){ //十六进制