From 1c0896f46e7402d6edbb7f03d45d2bfd361c62a5 Mon Sep 17 00:00:00 2001 From: duandongmei Date: Mon, 4 Jun 2018 10:04:28 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E7=BD=AEareaEffectiveIds=E6=8F=90?= =?UTF-8?q?=E8=87=B3BaseService=E7=9A=84setAreaEffectiveIds=E6=96=B9?= =?UTF-8?q?=E6=B3=95=20saveOrUpdate=E6=96=B9=E6=B3=95=E4=B8=AD=E7=9B=B4?= =?UTF-8?q?=E6=8E=A5=E8=B0=83=E7=94=A8=20//=E8=AE=BE=E7=BD=AE=E5=8C=BA?= =?UTF-8?q?=E5=9F=9F=E8=BF=90=E8=90=A5=E5=95=86=E4=BF=A1=E6=81=AF=20setAre?= =?UTF-8?q?aEffectiveIds(entity);?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/nis/web/service/BaseService.java | 32 ++- .../configuration/AvContentCfgService.java | 193 +++--------------- 2 files changed, 64 insertions(+), 161 deletions(-) diff --git a/src/main/java/com/nis/web/service/BaseService.java b/src/main/java/com/nis/web/service/BaseService.java index 31c4f2e16..61212e333 100644 --- a/src/main/java/com/nis/web/service/BaseService.java +++ b/src/main/java/com/nis/web/service/BaseService.java @@ -20,10 +20,11 @@ import com.google.gson.JsonPrimitive; import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; import com.googlecode.ipv6.IPv6Address; -import com.googlecode.ipv6.IPv6AddressRange; import com.googlecode.ipv6.IPv6Network; import com.nis.domain.SysRole; import com.nis.domain.SysUser; +import com.nis.domain.configuration.AreaBean; +import com.nis.domain.configuration.AreaIpCfg; import com.nis.domain.configuration.BaseCfg; import com.nis.domain.configuration.BaseIpCfg; import com.nis.domain.configuration.BaseStringCfg; @@ -36,6 +37,7 @@ import com.nis.domain.maat.MaatCfg.NumBoundaryCfg; import com.nis.domain.maat.MaatCfg.StringCfg; import com.nis.util.ConfigServiceUtil; import com.nis.util.Configurations; +import com.nis.util.Constants; import com.nis.util.IpUtil; import com.nis.util.StringUtils; @@ -488,4 +490,32 @@ public abstract class BaseService { } return dstIp; } + //区域IPsetAreaEffectiveIds设置 + public void setAreaEffectiveIds(BaseCfg entity){ + List areaCfg=entity.getAreaCfg(); + List areaIsps=entity.getAreaIsp(); + if(Constants.IS_AREA_EFFECTIVE_NO==entity.getIsAreaEffective()){ + entity.setAreaEffectiveIds(""); + entity.setAreaType(null); + }else if(Constants.IS_AREA_EFFECTIVE_YES==entity.getIsAreaEffective()){ + if(Constants.AREA_EFFECTIVE_TYPE_AREA_ISP==entity.getAreaType()&&areaIsps!=null&&areaIsps.size()>0){ + StringBuffer areaEffectiveIds=new StringBuffer(); + for(int i=0;i0){ + entity.setAreaEffectiveIds(""); + } + } + } } 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 4f6ef6704..588b33877 100644 --- a/src/main/java/com/nis/web/service/configuration/AvContentCfgService.java +++ b/src/main/java/com/nis/web/service/configuration/AvContentCfgService.java @@ -109,33 +109,8 @@ public class AvContentCfgService extends BaseService{ @Transactional(readOnly=false,rollbackFor=RuntimeException.class) public void saveOrUpdateAvVoip(CfgIndexInfo entity,String voipIpIds,String voipAccountIds,String areaCfgIds){ Date createTime=new Date(); - //区域IPsetAreaEffectiveIds设置 - List areaCfg=entity.getAreaCfg(); - List areaIsps=entity.getAreaIsp(); - if(Constants.IS_AREA_EFFECTIVE_NO==entity.getIsAreaEffective()){ - entity.setAreaEffectiveIds(""); - entity.setAreaType(null); - }else if(Constants.IS_AREA_EFFECTIVE_YES==entity.getIsAreaEffective()){ - if(Constants.AREA_EFFECTIVE_TYPE_AREA_ISP==entity.getAreaType()&&areaIsps!=null&&areaIsps.size()>0){ - StringBuffer areaEffectiveIds=new StringBuffer(); - for(int i=0;i0){ - entity.setAreaEffectiveIds(""); - } - } - + //设置区域运营商信息 + setAreaEffectiveIds(entity); //新增 if(entity.getCfgId()==null){ entity.setCreatorId(UserUtils.getUser().getId()); @@ -146,7 +121,6 @@ public class AvContentCfgService extends BaseService{ List compileIds = new ArrayList(); try { compileIds = ConfigServiceUtil.getId(1,1); - //compileIds.add((int)Math.floor(Math.random()*1000000+1)); } catch (Exception e) { e.printStackTrace(); logger.info("获取编译ID出错"); @@ -473,34 +447,8 @@ public class AvContentCfgService extends BaseService{ public void saveOrUpdateContIp(BaseIpCfg entity,String areaCfgIds){ Date createTime=new Date(); entity.setTableName("av_cont_ip_cfg"); - - //区域IPsetAreaEffectiveIds设置 - List areaCfg=entity.getAreaCfg(); - List areaIsps=entity.getAreaIsp(); - if(Constants.IS_AREA_EFFECTIVE_NO==entity.getIsAreaEffective()){ - entity.setAreaEffectiveIds(""); - entity.setAreaType(null); - }else if(Constants.IS_AREA_EFFECTIVE_YES==entity.getIsAreaEffective()){ - if(Constants.AREA_EFFECTIVE_TYPE_AREA_ISP==entity.getAreaType()&&areaIsps!=null&&areaIsps.size()>0){ - StringBuffer areaEffectiveIds=new StringBuffer(); - for(int i=0;i0){ - entity.setAreaEffectiveIds(""); - } - } - + //设置区域运营商信息 + setAreaEffectiveIds(entity); //新增 if(entity.getCfgId()==null){ entity.setCreatorId(UserUtils.getUser().getId()); @@ -726,9 +674,9 @@ public class AvContentCfgService extends BaseService{ //调用服务接口下发配置数据 String json=gsonToJson(maatBean); logger.info("contIp配置下发配置参数:"+json); - //TODO 调用服务接口下发配置 - //ToMaatResult result = ConfigServiceUtil.postMaatCfg(json); - //logger.info("contIp配置下发响应信息:"+result.getMsg()); + // 调用服务接口下发配置 + ToMaatResult result = ConfigServiceUtil.postMaatCfg(json); + logger.info("contIp配置下发响应信息:"+result.getMsg()); }else if(isAudit==3){ maatCfg.setCompileId(entity.getCompileId()); @@ -744,8 +692,8 @@ public class AvContentCfgService extends BaseService{ String json=gsonToJson(maatBean); logger.info("contIp配置下发配置参数:"+json); //调用服务接口下发配置 - //ToMaatResult result = ConfigServiceUtil.put(json,1); - //logger.info("http配置取消配置响应信息:"+result.getMsg()); + ToMaatResult result = ConfigServiceUtil.put(json,1); + logger.info("contIp配置取消配置响应信息:"+result.getMsg()); } } /********************************contIp业务*********************************/ @@ -780,33 +728,8 @@ public class AvContentCfgService extends BaseService{ public void saveOrUpdatePicIp(BaseIpCfg entity,String areaCfgIds){ Date createTime=new Date(); entity.setTableName("av_pic_ip_cfg"); - //区域IPsetAreaEffectiveIds设置 - List areaCfg=entity.getAreaCfg(); - List areaIsps=entity.getAreaIsp(); - if(Constants.IS_AREA_EFFECTIVE_NO==entity.getIsAreaEffective()){ - entity.setAreaEffectiveIds(""); - entity.setAreaType(null); - }else if(Constants.IS_AREA_EFFECTIVE_YES==entity.getIsAreaEffective()){ - if(Constants.AREA_EFFECTIVE_TYPE_AREA_ISP==entity.getAreaType()&&areaIsps!=null&&areaIsps.size()>0){ - StringBuffer areaEffectiveIds=new StringBuffer(); - for(int i=0;i0){ - entity.setAreaEffectiveIds(""); - } - } - + //设置区域运营商信息 + setAreaEffectiveIds(entity); //新增 if(entity.getCfgId()==null){ entity.setCreatorId(UserUtils.getUser().getId()); @@ -1030,10 +953,10 @@ public class AvContentCfgService extends BaseService{ maatBean.setOpAction(Constants.INSERT_ACTION); //调用服务接口下发配置数据 String json=gsonToJson(maatBean); - logger.info("contIp配置下发配置参数:"+json); + logger.info("picIp配置下发配置参数:"+json); //TODO 调用服务接口下发配置 - //ToMaatResult result = ConfigServiceUtil.postMaatCfg(json); - //logger.info("contIp配置下发响应信息:"+result.getMsg()); + ToMaatResult result = ConfigServiceUtil.postMaatCfg(json); + logger.info("picIp配置下发响应信息:"+result.getMsg()); }else if(isAudit==3){ maatCfg.setCompileId(entity.getCompileId()); @@ -1047,10 +970,10 @@ public class AvContentCfgService extends BaseService{ maatBean.setOpAction(Constants.UPDATE_ACTION); //调用服务接口取消配置 String json=gsonToJson(maatBean); - logger.info("contIp配置下发配置参数:"+json); + logger.info("picIp配置下发配置参数:"+json); //调用服务接口下发配置 - //ToMaatResult result = ConfigServiceUtil.put(json,1); - //logger.info("http配置取消配置响应信息:"+result.getMsg()); + ToMaatResult result = ConfigServiceUtil.put(json,1); + logger.info("picIp配置取消配置响应信息:"+result.getMsg()); } } /********************************picIp业务*********************************/ @@ -1086,33 +1009,8 @@ public class AvContentCfgService extends BaseService{ public void saveOrUpdateContUrl(BaseStringCfg entity,String areaCfgIds){ Date createTime=new Date(); entity.setTableName("av_cont_url_cfg"); - //区域IPsetAreaEffectiveIds设置 - List areaCfg=entity.getAreaCfg(); - List areaIsps=entity.getAreaIsp(); - if(Constants.IS_AREA_EFFECTIVE_NO==entity.getIsAreaEffective()){ - entity.setAreaEffectiveIds(""); - entity.setAreaType(null); - }else if(Constants.IS_AREA_EFFECTIVE_YES==entity.getIsAreaEffective()){ - if(Constants.AREA_EFFECTIVE_TYPE_AREA_ISP==entity.getAreaType()&&areaIsps!=null&&areaIsps.size()>0){ - StringBuffer areaEffectiveIds=new StringBuffer(); - for(int i=0;i0){ - entity.setAreaEffectiveIds(""); - } - } - + //设置区域运营商信息 + setAreaEffectiveIds(entity); //新增 if(entity.getCfgId()==null){ entity.setCreatorId(UserUtils.getUser().getId()); @@ -1301,10 +1199,10 @@ public class AvContentCfgService extends BaseService{ maatBean.setOpAction(Constants.INSERT_ACTION); //调用服务接口下发配置数据 String json=gsonToJson(maatBean); - logger.info("contIp配置下发配置参数:"+json); - //TODO 调用服务接口下发配置 - //ToMaatResult result = ConfigServiceUtil.postMaatCfg(json); - //logger.info("contIp配置下发响应信息:"+result.getMsg()); + logger.info("contUrl配置下发配置参数:"+json); + //调用服务接口下发配置 + ToMaatResult result = ConfigServiceUtil.postMaatCfg(json); + logger.info("contUrl配置下发响应信息:"+result.getMsg()); }else if(isAudit==3){ maatCfg.setCompileId(entity.getCompileId()); @@ -1318,10 +1216,10 @@ public class AvContentCfgService extends BaseService{ maatBean.setOpAction(Constants.UPDATE_ACTION); //调用服务接口取消配置 String json=gsonToJson(maatBean); - logger.info("contIp配置下发配置参数:"+json); + logger.info("contUrl配置下发配置参数:"+json); //调用服务接口下发配置 - //ToMaatResult result = ConfigServiceUtil.put(json,1); - //logger.info("http配置取消配置响应信息:"+result.getMsg()); + ToMaatResult result = ConfigServiceUtil.put(json,1); + logger.info("contUrl配置取消配置响应信息:"+result.getMsg()); } } /********************************contUrl业务*********************************/ @@ -1356,33 +1254,8 @@ public class AvContentCfgService extends BaseService{ public void saveOrUpdatePicUrl(BaseStringCfg entity,String areaCfgIds){ Date createTime=new Date(); entity.setTableName("av_pic_url_cfg"); - //区域IPsetAreaEffectiveIds设置 - List areaCfg=entity.getAreaCfg(); - List areaIsps=entity.getAreaIsp(); - if(Constants.IS_AREA_EFFECTIVE_NO==entity.getIsAreaEffective()){ - entity.setAreaEffectiveIds(""); - entity.setAreaType(null); - }else if(Constants.IS_AREA_EFFECTIVE_YES==entity.getIsAreaEffective()){ - if(Constants.AREA_EFFECTIVE_TYPE_AREA_ISP==entity.getAreaType()&&areaIsps!=null&&areaIsps.size()>0){ - StringBuffer areaEffectiveIds=new StringBuffer(); - for(int i=0;i0){ - entity.setAreaEffectiveIds(""); - } - } - + //设置区域运营商信息 + setAreaEffectiveIds(entity); //新增 if(entity.getCfgId()==null){ entity.setCreatorId(UserUtils.getUser().getId()); @@ -1572,9 +1445,9 @@ public class AvContentCfgService extends BaseService{ //调用服务接口下发配置数据 String json=gsonToJson(maatBean); logger.info("picUrl配置下发配置参数:"+json); - //TODO 调用服务接口下发配置 - //ToMaatResult result = ConfigServiceUtil.postMaatCfg(json); - //logger.info("picUrl配置下发响应信息:"+result.getMsg()); + // 调用服务接口下发配置 + ToMaatResult result = ConfigServiceUtil.postMaatCfg(json); + logger.info("picUrl配置下发响应信息:"+result.getMsg()); }else if(isAudit==3){ maatCfg.setCompileId(entity.getCompileId()); @@ -1590,8 +1463,8 @@ public class AvContentCfgService extends BaseService{ String json=gsonToJson(maatBean); logger.info("picUrl配置下发配置参数:"+json); //调用服务接口下发配置 - //ToMaatResult result = ConfigServiceUtil.put(json,1); - //logger.info("http配置取消配置响应信息:"+result.getMsg()); + ToMaatResult result = ConfigServiceUtil.put(json,1); + logger.info("picUrl配置取消配置响应信息:"+result.getMsg()); } } /********************************picUrl业务*********************************/