1、多域配置时,增强字符串类的配置,多个匹配区域可组合设置为一条功能更配置域字典,也可单独设置为多条功能配置域字典【单独匹配区域设置字典时,每个匹配区域下拉列表只有一项内容,这种设置,可以灵活组合配置,但取决于具体业务是否允许这种情况】;2、关键字内容与表达式的分隔符使用特殊字符串***and***分隔,提交审核配置时下发服务的配置关键字进行特殊转义处理;3、存在与表达式的关键字内容,在界面静态显示时需处理,将***and***替换为空格。
This commit is contained in:
@@ -131,7 +131,7 @@ public class BaseStringCfg extends BaseCfg<BaseStringCfg> {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public String getCfgKeywords() {
|
public String getCfgKeywords() {
|
||||||
cfgKeywords = StringEscapeUtils.unescapeHtml4(cfgKeywords);
|
// cfgKeywords = StringEscapeUtils.unescapeHtml4(cfgKeywords);
|
||||||
/*cfgKeywords = cfgKeywords.replace("&", "\\&");
|
/*cfgKeywords = cfgKeywords.replace("&", "\\&");
|
||||||
cfgKeywords = cfgKeywords.replace(" ", "\\b");
|
cfgKeywords = cfgKeywords.replace(" ", "\\b");
|
||||||
cfgKeywords = cfgKeywords.replace("\\", "\\\\");
|
cfgKeywords = cfgKeywords.replace("\\", "\\\\");
|
||||||
|
|||||||
@@ -8,6 +8,8 @@
|
|||||||
*/
|
*/
|
||||||
package com.nis.domain.configuration;
|
package com.nis.domain.configuration;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringEscapeUtils;
|
||||||
|
|
||||||
import com.google.gson.annotations.Expose;
|
import com.google.gson.annotations.Expose;
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
@@ -73,6 +75,7 @@ public class ComplexkeywordCfg extends BaseCfg<ComplexkeywordCfg>{
|
|||||||
this.district = district;
|
this.district = district;
|
||||||
}
|
}
|
||||||
public String getCfgKeywords() {
|
public String getCfgKeywords() {
|
||||||
|
// cfgKeywords = StringEscapeUtils.unescapeHtml4(cfgKeywords);
|
||||||
return cfgKeywords;
|
return cfgKeywords;
|
||||||
}
|
}
|
||||||
public void setCfgKeywords(String cfgKeywords) {
|
public void setCfgKeywords(String cfgKeywords) {
|
||||||
|
|||||||
@@ -302,4 +302,5 @@ public final class Constants {
|
|||||||
public static final String SSL_SAN_REGION = Configurations.getStringProperty("ssl_san_region","ssl_san");
|
public static final String SSL_SAN_REGION = Configurations.getStringProperty("ssl_san_region","ssl_san");
|
||||||
public static final String SSL_CA_REGION = Configurations.getStringProperty("ssl_ca_region","ssl_ca");
|
public static final String SSL_CA_REGION = Configurations.getStringProperty("ssl_ca_region","ssl_ca");
|
||||||
|
|
||||||
|
public static final String KEYWORD_EXPR = Configurations.getStringProperty("keyword_expr","***and***");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ public class WebsiteController extends BaseController{
|
|||||||
CfgIndexInfo entity = new CfgIndexInfo();
|
CfgIndexInfo entity = new CfgIndexInfo();
|
||||||
String[] idArray = ids.split(",");
|
String[] idArray = ids.split(",");
|
||||||
for(String id :idArray){
|
for(String id :idArray){
|
||||||
entity = websiteCfgService.getHttpCfg(Long.parseLong(id));
|
entity = websiteCfgService.getSslCfg(Long.parseLong(id));
|
||||||
entity.setIsAudit(isAudit);
|
entity.setIsAudit(isAudit);
|
||||||
entity.setIsValid(isValid);
|
entity.setIsValid(isValid);
|
||||||
entity.setAuditorId(UserUtils.getUser().getId());
|
entity.setAuditorId(UserUtils.getUser().getId());
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
<if test="configRegionCode != null">
|
<if test="configRegionCode != null">
|
||||||
AND config_region_code=#{configRegionCode,jdbcType=VARCHAR}
|
AND config_region_code=#{configRegionCode,jdbcType=VARCHAR}
|
||||||
</if>
|
</if>
|
||||||
order by dict_id
|
order by dict_id,config_region_code
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -8,6 +8,7 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringEscapeUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
@@ -336,13 +337,8 @@ public abstract class BaseService {
|
|||||||
cfg.setRegionId(ConfigServiceUtil.getId(3, 1).get(0));
|
cfg.setRegionId(ConfigServiceUtil.getId(3, 1).get(0));
|
||||||
cfg.setAuditTime(baseCfg.getAuditTime());
|
cfg.setAuditTime(baseCfg.getAuditTime());
|
||||||
cfg.setIsValid(baseCfg.getIsValid());
|
cfg.setIsValid(baseCfg.getIsValid());
|
||||||
String cfgKeywords = cfg.getCfgKeywords();
|
//处理配置关键字转译
|
||||||
cfgKeywords=cfgKeywords.replace("\\", "\\\\");
|
cfg.setCfgKeywords(keywordsEscape(cfg.getCfgKeywords()));
|
||||||
cfgKeywords=cfgKeywords.replace("&", "\\&");
|
|
||||||
cfgKeywords=cfgKeywords.replace(" ", "\\b");
|
|
||||||
//英文逗号在界面表示多个关键字的与表达式,maat端以&表示
|
|
||||||
cfgKeywords=cfgKeywords.replace(",", "&");
|
|
||||||
cfg.setCfgKeywords(cfgKeywords);
|
|
||||||
dstList.add(cfg);
|
dstList.add(cfg);
|
||||||
regionValue = cfg.getCfgType();
|
regionValue = cfg.getCfgType();
|
||||||
}
|
}
|
||||||
@@ -560,4 +556,14 @@ public abstract class BaseService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public static String keywordsEscape(String cfgKeywords){
|
||||||
|
//不转译特殊字符
|
||||||
|
cfgKeywords = StringEscapeUtils.unescapeHtml4(cfgKeywords);
|
||||||
|
cfgKeywords=cfgKeywords.replace("\\", "\\\\");
|
||||||
|
cfgKeywords=cfgKeywords.replace("&", "\\&");
|
||||||
|
cfgKeywords=cfgKeywords.replace(" ", "\\b");
|
||||||
|
//***and***在界面表示多个关键字的与表达式,此特殊字符串在common.js中使用定义,maat端以&表示
|
||||||
|
cfgKeywords=cfgKeywords.replace(Constants.KEYWORD_EXPR, "&");
|
||||||
|
return cfgKeywords;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -263,3 +263,5 @@ ssl_sni_region=ssl_sni
|
|||||||
ssl_san_region=ssl_san
|
ssl_san_region=ssl_san
|
||||||
ssl_ca_region=ssl_ca
|
ssl_ca_region=ssl_ca
|
||||||
ssl_ip_region=ssl_ip
|
ssl_ip_region=ssl_ip
|
||||||
|
#存在与表达式的关键字特殊分隔符
|
||||||
|
keyword_expr=***and***
|
||||||
@@ -115,7 +115,8 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label><spring:message code='keywords' />:</label><label>${cfg.cfgKeywords }</label>
|
<label><spring:message code='keywords' />:</label><label>
|
||||||
|
${fn:replace(cfg.cfgKeywords, "***and***", " ")}</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
|
|||||||
@@ -77,15 +77,6 @@
|
|||||||
/* $("span[title='add']").on("click", function() {
|
/* $("span[title='add']").on("click", function() {
|
||||||
$(".ipPort0").removeClass("hidden");
|
$(".ipPort0").removeClass("hidden");
|
||||||
}); */
|
}); */
|
||||||
$(".district").each(function(){
|
|
||||||
if($(this).siblings(".otherValue").val()!=''){
|
|
||||||
if($(this).val()!=$(this).siblings(".otherValue").val()){
|
|
||||||
$(this).find("option[value=others]").attr("selected","selected");
|
|
||||||
$(this).siblings(".otherValue").prop("type","text");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -225,7 +216,7 @@
|
|||||||
<c:set var="isBreak" value="false" ></c:set>
|
<c:set var="isBreak" value="false" ></c:set>
|
||||||
<c:forEach items="${_cfg.complexList}" var="complexCfg">
|
<c:forEach items="${_cfg.complexList}" var="complexCfg">
|
||||||
<c:choose>
|
<c:choose>
|
||||||
<c:when test="${region.configRegionValue eq complexCfg.cfgType and !isBreak}">
|
<c:when test="${region.configRegionCode eq complexCfg.cfgRegionCode and !isBreak}">
|
||||||
<div class="row boxSolid ${tabName}${status.index}">
|
<div class="row boxSolid ${tabName}${status.index}">
|
||||||
<%@include file="/WEB-INF/views/cfg/complexCfgForm.jsp"%>
|
<%@include file="/WEB-INF/views/cfg/complexCfgForm.jsp"%>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -121,7 +121,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label><spring:message code='keywords' />:</label><label>${cfg.cfgKeywords }</label>
|
<label><spring:message code='keywords' />:</label>
|
||||||
|
<label>
|
||||||
|
${fn:replace(cfg.cfgKeywords, "***and***", " ")}
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
|
|||||||
@@ -120,7 +120,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label><spring:message code='keywords' />:</label><label>${cfg.cfgKeywords }</label>
|
<label><spring:message code='keywords' />:</label>
|
||||||
|
<label>
|
||||||
|
${fn:replace(cfg.cfgKeywords, "***and***", " ")}
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
|
|||||||
@@ -143,7 +143,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label><spring:message code='keywords' />:</label><label>${cfg.cfgKeywords }</label>
|
<label><spring:message code='keywords' />:</label><label>${fn:replace(cfg.cfgKeywords, "***and***", " ")}</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
@@ -198,7 +198,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label><spring:message code='keywords' />:</label><label>${cfg.cfgKeywords }</label>
|
<label><spring:message code='keywords' />:</label><label>${fn:replace(cfg.cfgKeywords, "***and***", " ")}</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
@@ -247,7 +247,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label><spring:message code='keywords' />:</label><label>${cfg.cfgKeywords }</label>
|
<label><spring:message code='keywords' />:</label><label>${fn:replace(cfg.cfgKeywords, "***and***", " ")}</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
@@ -302,7 +302,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label><spring:message code='keywords' />:</label><label>${cfg.cfgKeywords }</label>
|
<label><spring:message code='keywords' />:</label><label>${fn:replace(cfg.cfgKeywords, "***and***", " ")}</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
@@ -352,7 +352,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label><spring:message code='keywords' />:</label><label>${cfg.cfgKeywords }</label>
|
<label><spring:message code='keywords' />:</label><label>${fn:replace(cfg.cfgKeywords, "***and***", " ")}</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -115,7 +115,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label><spring:message code='keywords' />:</label><label>${cfg.cfgKeywords }</label>
|
<label><spring:message code='keywords' />:</label><label>${fn:replace(cfg.cfgKeywords, "***and***", " ")}</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
|
|||||||
@@ -22551,4 +22551,16 @@ transition: background-color .1s ease-in-out;
|
|||||||
border: 1px solid #c2cad8;
|
border: 1px solid #c2cad8;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
}
|
}
|
||||||
|
.keyword_tag{
|
||||||
|
border: 1px solid #a5d24a;
|
||||||
|
-moz-border-radius:2px;
|
||||||
|
-webkit-border-radius:2px;
|
||||||
|
display: block;
|
||||||
|
float: left;
|
||||||
|
padding: 5px;
|
||||||
|
text-decoration:none;
|
||||||
|
background: #cde69c;
|
||||||
|
color: #638421;
|
||||||
|
margin-right: 5px;
|
||||||
|
margin-bottom:-15px;
|
||||||
|
}
|
||||||
|
|||||||
@@ -215,6 +215,7 @@ $(function(){
|
|||||||
$(tagsInputSettings).tagsInput({
|
$(tagsInputSettings).tagsInput({
|
||||||
width:$(".form-control").width(),
|
width:$(".form-control").width(),
|
||||||
defaultText:'please input keywords',
|
defaultText:'please input keywords',
|
||||||
|
'delimiter':'***and***',//特殊字符串分隔与表达式的多关键词
|
||||||
onAddTag:function(tag,size){
|
onAddTag:function(tag,size){
|
||||||
//var keywordValue = "";
|
//var keywordValue = "";
|
||||||
var objNamePrefix = $(this).attr("name").split("cfgKeywords")[0];
|
var objNamePrefix = $(this).attr("name").split("cfgKeywords")[0];
|
||||||
@@ -260,6 +261,18 @@ $(function(){
|
|||||||
}
|
}
|
||||||
})*/
|
})*/
|
||||||
|
|
||||||
|
//处理增强字符串配置的匹配区域
|
||||||
|
$(".district").each(function(){
|
||||||
|
if($(this).siblings(".otherValue").val()!=''){
|
||||||
|
if($(this).val()!=$(this).siblings(".otherValue").val()){
|
||||||
|
$(this).find("option[value=others]").attr("selected","selected");
|
||||||
|
$(this).siblings(".otherValue").prop("type","text");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
var switchIpType=function(obj){
|
var switchIpType=function(obj){
|
||||||
var type=$(obj).val();
|
var type=$(obj).val();
|
||||||
|
|||||||
@@ -297,7 +297,7 @@
|
|||||||
|
|
||||||
//if (event.which==event.data.delimiter.charCodeAt(0) || event.which==38 || event.which==13) {
|
//if (event.which==event.data.delimiter.charCodeAt(0) || event.which==38 || event.which==13) {
|
||||||
//38Ϊ&
|
//38Ϊ&
|
||||||
if (event.which==event.data.delimiter.charCodeAt(0)||event.which==13) {
|
if (event.which==13) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
if( (event.data.minChars <= $(event.data.fake_input).val().length) && (!event.data.maxChars || (event.data.maxChars >= $(event.data.fake_input).val().length)) )
|
if( (event.data.minChars <= $(event.data.fake_input).val().length) && (!event.data.maxChars || (event.data.maxChars >= $(event.data.fake_input).val().length)) )
|
||||||
$(event.data.real_input).addTag($(event.data.fake_input).val(),{focus:true,unique:(settings.unique)});
|
$(event.data.real_input).addTag($(event.data.fake_input).val(),{focus:true,unique:(settings.unique)});
|
||||||
|
|||||||
Reference in New Issue
Block a user