1.XMPP增加subscribe_id 2.增加do_log 3.compileId查询

This commit is contained in:
leijun
2018-08-24 11:45:35 +08:00
parent 295d92fe79
commit f70838f4d4
6 changed files with 207 additions and 9 deletions

View File

@@ -27,6 +27,7 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.nis.domain.Page;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.configuration.NtcSubscribeIdCfg;
import com.nis.exceptions.MaatConvertException;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
@@ -104,6 +105,15 @@ public class XmppController extends BaseController {
}
}
}
if(cfg.getNtcSubscribeIdCfgList()!=null){
String cfgType = null;
for(NtcSubscribeIdCfg keyword:cfg.getNtcSubscribeIdCfgList()){
if(!keyword.getCfgType().equals(cfgType)){
tabList.add(new String[]{"2",keyword.getCfgType()});
cfgType = keyword.getCfgType();
}
}
}
model.addAttribute("_cfg", cfg);
model.addAttribute("index", index);
model.addAttribute("tabList", tabList);

View File

@@ -23,6 +23,7 @@
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="do_log" property="doLog" jdbcType="INTEGER" />
</resultMap>
<resultMap id="ipPortMap" type="com.nis.domain.configuration.IpPortCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
@@ -121,7 +122,7 @@
a.CFG_ID,a.CFG_DESC,a.ACTION,a.IS_VALID,a.IS_AUDIT,
a.CREATOR_ID,a.CREATE_TIME,a.EDITOR_ID,a.EDIT_TIME,a.AUDITOR_ID,a.AUDIT_TIME,
a.SERVICE_ID,a.REQUEST_ID,a.COMPILE_ID,a.IS_AREA_EFFECTIVE,a.CLASSIFY,
a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id
a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id,do_log
</sql>
<sql id="IpCfg_Column" >
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port
@@ -301,7 +302,8 @@
ATTRIBUTE,
LABLE,
AREA_EFFECTIVE_IDS,
function_id
function_id,
do_log
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
@@ -321,7 +323,8 @@
#{attribute,jdbcType=VARCHAR},
#{lable,jdbcType=VARCHAR},
#{areaEffectiveIds,jdbcType=VARCHAR},
#{functionId,jdbcType=INTEGER}
#{functionId,jdbcType=INTEGER},
#{doLog,jdbcType=INTEGER}
)
</insert>
<!-- insert ip_port_cfg表信息 -->
@@ -445,6 +448,9 @@
</if>
<if test="functionId != null" >
function_id = #{functionId,jdbcType=INTEGER},
</if>
<if test="doLog != null" >
do_log = #{doLog,jdbcType=INTEGER},
</if>
</trim>
</set>

View File

@@ -15,6 +15,7 @@ import com.nis.domain.configuration.AreaIpCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.ComplexkeywordCfg;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.configuration.NtcSubscribeIdCfg;
import com.nis.domain.maat.MaatCfg;
import com.nis.domain.maat.MaatCfg.DigestCfg;
import com.nis.domain.maat.MaatCfg.GroupCfg;
@@ -28,6 +29,7 @@ import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.StringUtil;
import com.nis.web.dao.configuration.AreaIpCfgDao;
import com.nis.web.dao.configuration.StringCfgDao;
import com.nis.web.dao.configuration.XmppCfgDao;
import com.nis.web.security.UserUtils;
import com.nis.web.service.CrudService;
@@ -43,10 +45,19 @@ public class XmppCfgService extends CrudService<XmppCfgDao,CfgIndexInfo> {
protected XmppCfgDao xmppCfgDao;
@Autowired
protected AreaIpCfgDao areaIpCfgDao;
@Autowired
protected StringCfgDao stringCfgDao;
public CfgIndexInfo getXmppCfg(Long cfgId){
CfgIndexInfo entity = xmppCfgDao.getCfgIndexInfo(cfgId);
List<IpPortCfg> ipPortList = xmppCfgDao.getIpPortList(entity);
//设置关键字
if(entity.getCompileId()!=null){
NtcSubscribeIdCfg ntcSubscribeIdCfg = new NtcSubscribeIdCfg();
ntcSubscribeIdCfg.setCompileId(entity.getCompileId());
List<NtcSubscribeIdCfg> ntcList = stringCfgDao.findSubscribeIdCfgList(ntcSubscribeIdCfg);
entity.setNtcSubscribeIdCfgList(ntcList);
}
entity.setIpPortList(ipPortList);
return entity;
}
@@ -68,6 +79,10 @@ public class XmppCfgService extends CrudService<XmppCfgDao,CfgIndexInfo> {
if(idList!=null && idList.size()>0){
compileId = idList.get(0);
}
} catch (MaatConvertException e) {
logger.info("获取编译ID出错");
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
}
entity.setCompileId(compileId);
entity.setCreateTime(new Date());
entity.setCreatorId(entity.getCurrentUser().getId());
@@ -78,6 +93,14 @@ public class XmppCfgService extends CrudService<XmppCfgDao,CfgIndexInfo> {
xmppCfgDao.saveIpPortCfg(cfg);
}
}
if(entity.getNtcSubscribeIdCfgList()!=null){
for(NtcSubscribeIdCfg cfg:entity.getNtcSubscribeIdCfgList()){
if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
stringCfgDao.saveSubscribeIdCfg(cfg);
}
}
}
//保存区域IP信息
if(entity.getAreaCfg()!=null){
for(AreaIpCfg cfg:entity.getAreaCfg()){
@@ -86,16 +109,13 @@ public class XmppCfgService extends CrudService<XmppCfgDao,CfgIndexInfo> {
areaIpCfgDao.saveAreaIpCfg(cfg);
}
}
} catch (Exception e) {
e.printStackTrace();
logger.info("获取编译ID出错");
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
}
}else{
xmppCfgDao.updateCfgIndex(entity);
//无效子配置后,再新增子配置
xmppCfgDao.deleteXmppIpCfg(entity);
stringCfgDao.deleteSubscribeIdCfgByCfgIndexInfo(entity);
AreaIpCfg area = new AreaIpCfg();
area.setCompileId(entity.getCompileId());
area.setFunctionId(entity.getFunctionId());
@@ -108,6 +128,14 @@ public class XmppCfgService extends CrudService<XmppCfgDao,CfgIndexInfo> {
xmppCfgDao.saveIpPortCfg(cfg);
}
}
if(entity.getNtcSubscribeIdCfgList()!=null){
for(NtcSubscribeIdCfg cfg:entity.getNtcSubscribeIdCfgList()){
if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
stringCfgDao.saveSubscribeIdCfg(cfg);
}
}
}
//保存区域IP信息
if(entity.getAreaCfg()!=null){
for(AreaIpCfg cfg:entity.getAreaCfg()){
@@ -137,6 +165,13 @@ public class XmppCfgService extends CrudService<XmppCfgDao,CfgIndexInfo> {
cfg.setTableName(IpPortCfg.getTablename());
xmppCfgDao.updateCfgValid(cfg);
}
if(entity.getNtcSubscribeIdCfgList()!=null && entity.getNtcSubscribeIdCfgList().size()>0)
{
NtcSubscribeIdCfg cfg = new NtcSubscribeIdCfg();
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
cfg.setTableName(NtcSubscribeIdCfg.getTablename());
xmppCfgDao.updateCfgValid(cfg);
}
// if(entity.getHttpUrlList()!=null && entity.getHttpUrlList().size()>0){
// HttpUrlCfg cfg = new HttpUrlCfg();
// BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
@@ -185,6 +220,17 @@ public class XmppCfgService extends CrudService<XmppCfgDao,CfgIndexInfo> {
}
}
}
if(entity.getNtcSubscribeIdCfgList()!=null && entity.getNtcSubscribeIdCfgList().size()>0){
NtcSubscribeIdCfg cfg = new NtcSubscribeIdCfg();
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
cfg.setTableName(NtcSubscribeIdCfg.getTablename());
xmppCfgDao.auditCfg(cfg);
if(isAudit==1){
Map<String,List> map = cfgConvert(strRegionList,entity.getNtcSubscribeIdCfgList(),2,entity,groupRelationList);
groupRelationList=map.get("groupList");
strRegionList=map.get("dstList");
}
}
// if(entity.getHttpUrlList()!=null && entity.getHttpUrlList().size()>0){
// HttpUrlCfg cfg = new HttpUrlCfg();
// BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});

View File

@@ -178,7 +178,33 @@
</div>
</div>
</div>
<!-- dolog begin-->
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-3"><spring:message code="do_log" /></label>
<c:forEach items="${fns:getDictList('DO_LOG') }" var="dict">
<c:choose>
<c:when test="${dict.itemCode eq _cfg.doLog}">
<label class="radio-inline">
<input type="radio" name="doLog" checked value="${dict.itemCode}" ><spring:message code="${dict.itemValue}"/>
</label>
</c:when>
<c:otherwise>
<label class="radio-inline">
<input type="radio" name="doLog" value="${dict.itemCode}" ><spring:message code="${dict.itemValue}"/>
</label>
</c:otherwise>
</c:choose>
</c:forEach>
</div>
</div>
</div>
<!-- dolog end-->
<c:set var="ipCfgIndex" value="0"></c:set>
<c:set var="strCfgIndex" value="0"></c:set>
<c:set var="complexCfgIndex" value="0"></c:set>
<c:forEach items="${regionList}" var="region" varStatus="status">
<c:if test="${region.regionType eq 1 }">
@@ -212,6 +238,48 @@
</c:choose>
<!--/ip info-->
</c:if>
<c:if test="${region.regionType eq 2 }">
<c:if test="${region.configServiceType == 'subscribe_id'}">
<c:set var="tabName" value="${region.configRegionValue}Tab"></c:set>
<h4 class="form-section">
<spring:message code="${region.configRegionValue}" />
<small> <span
class="glyphicon glyphicon-plus ${tabName}Add"
onClick="addContent(this,'${tabName}')" title="add"></span></small>
</h4>
<c:set var="cfgName" value="ntcSubscribeIdCfgList[${strCfgIndex}]"></c:set>
<c:choose>
<c:when test="${fn:length(_cfg.ntcSubscribeIdCfgList)>0}">
<c:set var="isBreak" value="false" ></c:set>
<c:forEach items="${_cfg.ntcSubscribeIdCfgList}" var="cfg">
<c:choose>
<c:when test="${region.configRegionValue eq cfg.cfgType and !isBreak}">
<div class="row boxSolid ${tabName}${status.index}">
<%@include file="/WEB-INF/views/cfg/complexCfgForm.jsp"%>
</div>
<c:set var="isBreak" value="true" ></c:set>
<c:set var="strCfgIndex" value="${strCfgIndex+1 }"></c:set>
</c:when>
</c:choose>
</c:forEach>
<c:if test="${!isBreak}">
<div class="row boxSolid ${tabName}${status.index} hidden disabled">
<%@include file="/WEB-INF/views/cfg/complexCfgForm.jsp"%>
</div>
<c:set var="strCfgIndex" value="${strCfgIndex+1 }"></c:set>
</c:if>
</c:when>
<c:otherwise>
<div class="row boxSolid ${tabName}${status.index} hidden disabled">
<%@include file="/WEB-INF/views/cfg/complexCfgForm.jsp"%>
</div>
<c:set var="strCfgIndex" value="${strCfgIndex+1 }"></c:set>
</c:otherwise>
</c:choose>
</c:if>
</c:if>
<c:if test="${region.regionType eq 3 }">
<c:set var="tabName" value="${region.configRegionValue}Tab"></c:set>
<h4 class="form-section">

View File

@@ -9,7 +9,9 @@
//搜索框提示语初始化
if("${cfg.cfgDesc}"){
$("#intype").val("${cfg.cfgDesc}");
}else{
}else if("${cfg.compileId}"){
$("#intype").val("${cfg.compileId}");
} else{
$("#intype").attr("placeholder","<spring:message code='input'/> "+$("#seltype").find("option:selected").text());
}
$("#seltype").change(function(){
@@ -30,6 +32,7 @@
$(".Wdate").attr("value",'');
$("#level").attr("value",'');
$("#searchForm")[0].reset();
$("#intype").attr("placeholder","<spring:message code='input'/> "+$("#seltype").find("option:selected").text());
});
//异步获取voip相关信息
$("span[id^=open]").click(function(){
@@ -132,6 +135,7 @@
<form:select path="seltype" class="selectpicker select2 input-small" >
<form:option value="cfgDesc"><spring:message code="config_describe"></spring:message></form:option>
<form:option value="compileId"><spring:message code="cfg_id"></spring:message></form:option>
<%-- <form:option value="voipIp.srcIpAddress"><spring:message code="client_ip"/></form:option>
<form:option value="voipIp.srcPort"><spring:message code="client_port"/></form:option>
<form:option value="voipAccount.cfgKeywords"><spring:message code="key_word"/></form:option>
@@ -305,8 +309,10 @@
<thead>
<tr>
<th><input type="checkbox" class="i-checks" id="checkAll"></th>
<th style="display: none"><spring:message code="cfg_id"/></th>
<th class="cfgDesc"><spring:message code="config_describe"/></th>
<th><spring:message code="block_type"/></th>
<th><spring:message code="do_log"/></th>
<th><spring:message code="whether_area_block"/></th>
<th><spring:message code="letter"/></th>
<th><spring:message code="classification"/></th>
@@ -329,6 +335,7 @@
<span id="open${status.index}" class="" compileId="${indexCfg.compileId}" cfgId="${indexCfg.cfgId}"> ▷ </span><span style="display: none;" id="close${status.index}" > ▼ </span>
<input type="checkbox" class="i-checks child-checks" id="${indexCfg.cfgId}" value="${indexCfg.isAudit}">
</td>
<td>${indexCfg.compileId }</td>
<td>${indexCfg.cfgDesc }</td>
<td>
<c:forEach items="${fns:getDictList('SERVICE_ACTION') }" var="dict">
@@ -337,6 +344,13 @@
</c:if>
</c:forEach>
</td>
<td>
<c:forEach items="${fns:getDictList('DO_LOG') }" var="dict">
<c:if test="${dict.itemCode eq indexCfg.doLog }">
<spring:message code="${dict.itemValue }"/>
</c:if>
</c:forEach>
</td>
<td>
<c:if test="${indexCfg.isAreaEffective==0}"><spring:message code="no"/></c:if>
<c:if test="${indexCfg.isAreaEffective==1}">

View File

@@ -120,6 +120,60 @@
</c:if>
</c:forEach>
</c:if>
<c:if test="${region[0] eq 2 }">
<c:forEach items="${_cfg.ntcSubscribeIdCfgList}" var="cfg">
<c:if test="${region[1] eq cfg.cfgType }">
<div id="${region[1]}Info${index}" class="content" name="subCfg${index}">
<div class="row">
<div class="col-md-8">
<div class="form-group">
<label><spring:message code='keywords' />:</label><label>
${fn:replace(cfg.cfgKeywords, "***and***", " ")}</label>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label><spring:message code='expression_type' />:</label>
<label>
<c:choose>
<c:when test="${cfg.exprType eq 1}"><spring:message code='and_expression'/></c:when>
<c:when test="${cfg.exprType eq 0}"><spring:message code='null_expression'/></c:when>
</c:choose>
</label>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label><spring:message code='match_method' />:</label>
<label>
<c:forEach items="${fns:getDictList('MATCH_METHOD')}" var="matchMethodC">
<c:if test="${cfg.matchMethod==matchMethodC.itemCode }"><spring:message code="${matchMethodC.itemValue}"/></c:if>
</c:forEach>
</label>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label><spring:message code='whether_hexbinary' />:</label>
<label>
<c:forEach items="${fns:getDictList('WHETHER_HEXBINARY')}" var="isHexbinC">
<c:if test="${cfg.isHexbin==isHexbinC.itemCode }"><spring:message code="${isHexbinC.itemValue}"/></c:if>
</c:forEach>
</label>
</div>
</div>
</div>
</div>
</c:if>
</c:forEach>
</c:if>
<c:if test="${region[0] eq 3 }">
<c:forEach items="${_cfg.domainList}" var="cfg">
<c:if test="${region[1] eq cfg.cfgType }">