增加查看区域信息公共方法ajaxAreaEffictiveInfo

修改contIp、contUrl、picUrl、picIp、voip列表中的区域ip
This commit is contained in:
duandongmei
2018-06-05 17:52:26 +08:00
parent 8adaa4a9ec
commit 2b93917c27
13 changed files with 252 additions and 37 deletions

View File

@@ -18,6 +18,8 @@ package com.nis.domain.configuration;
public class AreaBean {
private String area;
private String isp;
private String areaName;
private String ispName;
/**
* area
* @return area
@@ -46,4 +48,17 @@ public class AreaBean {
public void setIsp(String isp) {
this.isp = isp;
}
public String getAreaName() {
return areaName;
}
public void setAreaName(String areaName) {
this.areaName = areaName;
}
public void setIspName(String ispName) {
this.ispName = ispName;
}
public String getIspName() {
return ispName;
}
}

View File

@@ -3,7 +3,9 @@ import java.beans.PropertyEditorSupport;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
@@ -15,6 +17,8 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.ui.Model;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.nis.domain.FunctionRegionDict;
@@ -24,9 +28,12 @@ import com.nis.domain.basics.ServiceDictInfo;
import com.nis.domain.basics.SysDictInfo;
import com.nis.domain.configuration.AreaBean;
import com.nis.domain.configuration.AreaIpCfg;
import com.nis.domain.configuration.AvVoipAccountCfg;
import com.nis.domain.configuration.AvVoipIpCfg;
import com.nis.domain.configuration.BaseCfg;
import com.nis.domain.configuration.BaseIpCfg;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.ComplexkeywordCfg;
import com.nis.domain.configuration.NumBoundaryCfg;
import com.nis.domain.configuration.RequestInfo;
@@ -358,31 +365,7 @@ public class BaseController {
//从区域生效ID中获取区域与运营商
String areaEffectiveIds=cfg.getAreaEffectiveIds();
List<AreaBean> areaIspList=new ArrayList<AreaBean>();
//areaEffectiveIds 存在冒号则冒号前为area后为isp不存在冒号判断id是否为isp否则为area
if(StringUtils.isNotBlank(areaEffectiveIds)){
String[] areaIsps=areaEffectiveIds.split(",");
for(String areaIsp:areaIsps){
AreaBean area=new AreaBean();
if(areaIsp.contains(":")){
area.setArea(areaIsp.split(":")[0]);
area.setIsp(areaIsp.split(":")[1]);
}else{
boolean isIsp=false;
for (SysDictInfo ispDict : isps) {
if(ispDict.getItemCode().equals(areaIsp)){
area.setIsp(areaIsp);
isIsp=true;
break;
}
}
if(!isIsp){
area.setArea(areaIsp);
}
}
areaIspList.add(area);
}
}
getAreaIsps(areaEffectiveIds,areaIspList,isps,areas);
model.addAttribute("_areaIsps", areaIspList);
List<RequestInfo> requestInfos=requestInfoService.getAllRequestInfo();
model.addAttribute("requestInfos", requestInfos);
@@ -400,4 +383,43 @@ public class BaseController {
@Deprecated
protected void setSaveOrUpdateProps(Model model,BaseCfg cfg,String areaCfgIds) throws Exception{
}
public List<AreaBean> getAreaIsps(String areaEffectiveIds,List<AreaBean> areaIspList,List<SysDictInfo> isps,List<SysDictInfo> areas) {
Map<String, SysDictInfo> areaMap=new HashMap<String, SysDictInfo>();
for (SysDictInfo areaDict : areas) {
areaMap.put(areaDict.getItemCode(), areaDict);
}
Map<String, SysDictInfo> ispMap=new HashMap<String, SysDictInfo>();
for (SysDictInfo ispDict : isps) {
ispMap.put(ispDict.getItemCode(), ispDict);
}
// 存在冒号则冒号前为area后为isp不存在冒号判断id是否为isp否则为area
if(StringUtils.isNotBlank(areaEffectiveIds)){
String[] areaIsps=areaEffectiveIds.split(",");
for(String areaIsp:areaIsps){
AreaBean area=new AreaBean();
if(areaIsp.contains(":")){
area.setArea(areaIsp.split(":")[0]);
area.setIsp(areaIsp.split(":")[1]);
area.setAreaName(areaMap.get(areaIsp.split(":")[0]).getItemValue());
area.setIspName(ispMap.get(areaIsp.split(":")[1]).getItemValue());
}else{
if(ispMap.keySet().contains(areaIsp)){
area.setIsp(areaIsp);
area.setIspName(ispMap.get(areaIsp).getItemValue());
area.setAreaName("");
}else{
area.setArea(areaIsp);
area.setIspName("");
area.setAreaName(areaMap.get(areaIsp).getItemValue());
}
}
areaIspList.add(area);
}
}
return areaIspList;
}
}

View File

@@ -9,6 +9,7 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
@@ -17,6 +18,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.nis.domain.Page;
import com.nis.domain.basics.SysDictInfo;
import com.nis.domain.configuration.AreaBean;
import com.nis.domain.configuration.AreaIpCfg;
import com.nis.domain.configuration.AvContIpCfg;
import com.nis.domain.configuration.AvVoipAccountCfg;
@@ -24,6 +27,7 @@ import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.AvVoipIpCfg;
import com.nis.domain.configuration.BaseIpCfg;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.util.Constants;
import com.nis.util.StringUtil;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
@@ -393,4 +397,32 @@ public class AvContentController extends BaseController {
return "redirect:" + adminPath +"/ntc/av/picUrlList?functionId="+functionId;
}
/*****************************picUrl业务***************/
/**
* 1、effectiveIds分组展示
* 2、无effectiveIds查询area_ip根据compileId查询展示
*/
@ResponseBody
@RequestMapping(value = "/ajaxAreaEffictiveInfo")
public Map ajaxAreaEffictiveInfo(String areaEffectiveIds,Integer compileId) {
Map<String, Object> data=new HashMap<String, Object>();
List<AreaBean> areaIsps=new ArrayList<AreaBean>();
List<AreaIpCfg> areaIps=new ArrayList<AreaIpCfg>();
if(StringUtils.isEmpty(areaEffectiveIds)){
areaIps=ipCfgService.getAreaCfgByCompileId(compileId);
}else{
List<Integer> itTypeList=new ArrayList<Integer>();
itTypeList.add(Constants.ITEM_TYPE_AREA);
List<SysDictInfo> areas = sysDictInfoService.findAllSysDictInfo(new SysDictInfo(),itTypeList,null);
itTypeList.clear();
itTypeList.add(Constants.ITEM_TYPE_ISP);
List<SysDictInfo> isps = sysDictInfoService.findAllSysDictInfo(new SysDictInfo(),itTypeList,null);
getAreaIsps(areaEffectiveIds, areaIsps, isps, areas);
}
data.put("areaIsps", areaIsps);
data.put("areaIps", areaIps);
return data;
}
}

View File

@@ -343,7 +343,11 @@
</td>
<td>
<c:if test="${cfg.isAreaEffective==0}"><spring:message code="no"/></c:if>
<c:if test="${cfg.isAreaEffective==1}"><spring:message code="yes"/></c:if>
<c:if test="${cfg.isAreaEffective==1}">
<a areaEffectiveIds="${cfg.areaEffectiveIds }" compileId="${cfg.compileId }" href="javascript:void(0)" name="viewAreaInfo">
<spring:message code="yes"/>
</a>
</c:if>
</td>
<td>${cfg.requestName }</td>
<c:set var="classify"></c:set>

View File

@@ -329,7 +329,11 @@
</td>
<td>
<c:if test="${cfg.isAreaEffective==0}"><spring:message code="no"/></c:if>
<c:if test="${cfg.isAreaEffective==1}"><spring:message code="yes"/></c:if>
<c:if test="${cfg.isAreaEffective==1}">
<a areaEffectiveIds="${cfg.areaEffectiveIds }" compileId="${cfg.compileId }" href="javascript:void(0)" name="viewAreaInfo">
<spring:message code="yes"/>
</a>
</c:if>
</td>
<td>${cfg.requestName }</td>
<c:set var="classify"></c:set>

View File

@@ -343,7 +343,11 @@
</td>
<td>
<c:if test="${cfg.isAreaEffective==0}"><spring:message code="no"/></c:if>
<c:if test="${cfg.isAreaEffective==1}"><spring:message code="yes"/></c:if>
<c:if test="${cfg.isAreaEffective==1}">
<a areaEffectiveIds="${cfg.areaEffectiveIds }" compileId="${cfg.compileId }" href="javascript:void(0)" name="viewAreaInfo">
<spring:message code="yes"/>
</a>
</c:if>
</td>
<td>${cfg.requestName }</td>
<c:set var="classify"></c:set>

View File

@@ -329,7 +329,11 @@
</td>
<td>
<c:if test="${cfg.isAreaEffective==0}"><spring:message code="no"/></c:if>
<c:if test="${cfg.isAreaEffective==1}"><spring:message code="yes"/></c:if>
<c:if test="${cfg.isAreaEffective==1}">
<a areaEffectiveIds="${cfg.areaEffectiveIds }" compileId="${cfg.compileId }" href="javascript:void(0)" name="viewAreaInfo">
<spring:message code="yes"/>
</a>
</c:if>
</td>
<td>${cfg.requestName }</td>
<c:set var="classify"></c:set>

View File

@@ -194,10 +194,10 @@
html+="<label><spring:message code='ip_type'/></label>";
html+="<label>"
if(item.ipType==4){
html+="<spring:message code='IPV4'/>";
html+="<spring:message code='ipv4'/>";
}
if(item.ipType==6){
html+="<spring:message code='IPV6'/>";
html+="<spring:message code='ipv6'/>";
}
if(item.ipType==46){
html+="<spring:message code='4over6'/>";
@@ -657,7 +657,11 @@
</td>
<td>
<c:if test="${indexCfg.isAreaEffective==0}"><spring:message code="no"/></c:if>
<c:if test="${indexCfg.isAreaEffective==1}"><spring:message code="yes"/></c:if>
<c:if test="${indexCfg.isAreaEffective==1}">
<a areaEffectiveIds="${indexCfg.areaEffectiveIds }" compileId="${indexCfg.compileId }" href="javascript:void(0)" name="viewAreaInfo">
<spring:message code="yes"/>
</a>
</c:if>
</td>
<td>${indexCfg.requestName }</td>
<c:set var="classify"></c:set>

View File

@@ -608,7 +608,7 @@
if(lang.indexOf("zh")!=-1) {
$.jBox.stateDefaults = { content: '', buttons: { '确定': 'ok' }, buttonsFocus: 0, submit: function (v, h, f) { return true; } };
$.jBox.languageDefaults = { close: '关闭', ok: '确定', yes: '是', no: '否', cancel: '取消' };
$.jBox.languageDefaults = { close: "", ok: '确定', yes: '是', no: '否', cancel: '取消' };
}else{
$.jBox.stateDefaults = { content: '', buttons: { 'ok': 'ok' }, buttonsFocus: 0, submit: function (v, h, f) { return true; } };
$.jBox.languageDefaults = { close: 'close', ok: 'ok', yes: 'yes', no: 'no', cancel: 'cancel' };

View File

@@ -34,6 +34,19 @@
portRange:"Please enter a valid Integer",
portMaskRange:"Port must be a valid Integer and mask must between 0 and 65535.The correct pattern is \"port/mask\".",
chooseAreaOrIsp:"The region and the oprater must choose one",
areaControl:"Action drop and loop do not need area control"
areaControl:"Action drop and loop do not need area control",
ip_type: "ip type",
ip_pattern: "ip Pattern",
area: "area",
isp: "isp",
close_info: "close",
client_ip: "client ip",
ipv4: "ipv4",
ipv6: "ipv6",
over6: "4over6",
over4: "6over4",
all: "all",
ip_subnet: "Subnet",
ip_range: "ip Range"
});
}(jQuery));

View File

@@ -32,6 +32,19 @@
portRange:"Please enter a valid Integer",
portMaskRange:"Port must be a valid Integer and mask must between 0 and 65535.The correct pattern is \"port/mask\".",
chooseAreaOrIsp:"The region and the oprater must choose one",
areaControl:"Action drop and loop do not need area control"
areaControl:"Action drop and loop do not need area control",
ip_type: "ip type",
ip_pattern: "ip Pattern",
area: "area",
isp: "isp",
close_info: "close",
client_ip: "client ip",
ipv4: "ipv4",
ipv6: "ipv6",
over6: "4over6",
over4: "6over4",
all: "all",
ip_subnet: "Subnet",
ip_range: "ip Range"
});
}(jQuery));

View File

@@ -35,6 +35,20 @@
portRange:"端口必须为整数非0数字不能以0开头",
portMaskRange:"端口必须为整数掩码范围0-65535非0数字不能以0开头。格式为\"端口/掩码\"",
chooseAreaOrIsp:"区域和运营商必选一个",
areaControl:"丢弃和回流动作不能区域管控"
areaControl:"丢弃和回流动作不能区域管控",
ip_type: "ip类型",
ip_pattern: "ip格式",
area: "区域",
isp: "运营商",
close_info: "关闭",
client_ip: "源IP",
ipv4: "ipv4",
ipv6: "ipv6",
over6: "4over6",
over4: "6over4",
all: "全部",
ip_subnet: "Subnet",
ip_subnet: "Subnet",
ip_range: "ip Range"
});
}(jQuery));

View File

@@ -247,6 +247,92 @@ $(function(){
}
});
/*=====关键字与表达式处理 结束=====*/
$("a[name=viewAreaInfo]").hover(function(){
var areaEffectiveIds=$(this).attr("areaEffectiveIds");
var compileId=$(this).attr("compileId");
$.ajax({
type:'post',
url:'ajaxAreaEffictiveInfo',
data:{"areaEffectiveIds":areaEffectiveIds,"compileId":compileId},
dataType:'json',
async:false,
success:function(data,textStatus){
if(textStatus=="success"){
var html = "";
var title="";
if(data.areaIsps.length > 0){
title=$.validator.messages.area+" "+$.validator.messages.isp;
html+="<table class='table table-striped table-bordered table-condensed' style='margin-left: 10px; width: 96%;'>";
html+="<thead>";
html+="<th>"+$.validator.messages.area+"</th>" +
"<th>"+$.validator.messages.isp+"</th>";
html+="</thead>";
html+="<tbody>";
for(i=0;i<data.areaIsps.length;i++){
html+="<tr>";
html+="<td>"+data.areaIsps[i].areaName;
html+="</td>";
html+="<td>"+data.areaIsps[i].ispName;
html+="</td>";
html+="</tr>";
}
html+="</tbody>";
html+="</table>";
}
if(data.areaIps.length > 0){
title=$.validator.messages.area+" ip";
html+="<table class='table table-striped table-bordered table-condensed' style='margin-left: 10px; width: 96%;'>";
html+="<thead>";
html+="<th>"+$.validator.messages.ip_type+"</th>" +
"<th>"+$.validator.messages.ip_pattern+"</th>" +
"<th>"+$.validator.messages.client_ip+"</th>";
html+="</thead>";
html+="<tbody>";
for(i=0;i<data.areaIps.length;i++){
html+="<tr>";
html+="<td>";
if(data.areaIps[i].ipType==4){
html+=$.validator.messages.ipv4;
}
if(data.areaIps[i].ipType==6){
html+=$.validator.messages.ipv6;
}
if(data.areaIps[i].ipType==46){
html+=$.validator.messages.over4;
}
if(data.areaIps[i].ipType==64){
html+=$.validator.messages.over6;
}
if(data.areaIps[i].ipType==10){
html+=$.validator.messages.all;
}
html+="</td>";
html+="<td>";
if(data.areaIps[i].ipPattern==1){
html+=$.validator.messages.ip_subnet;
}
if(data.areaIps[i].ipPattern==2){
html+=$.validator.messages.ip_range;
}
if(data.areaIps[i].ipPattern==3){
html+="IP";
}
html+="</td>";
html+="<td>"+data.areaIps[i].srcIpAddress;
html+="</td>";
html+="</tr>";
}
html+="</tbody>";
html+="</table>";
}
top.$.jBox(html,{width: $(document).width()*0.4,height: 400,title:title, buttons:false});
}
}
});
},function(){});
});
var switchIpType=function(obj){
var type=$(obj).val();
@@ -549,4 +635,4 @@ function exprTypeChecked(objNamePrefix,size){
function validateDataIsLicit(){
var fdfz = $.trim($("#tags_1").val()).replace(/,/g,"");
return isLicit(fdfz);
}
}