group添加默认空的选项,列表与导出添加协议

This commit is contained in:
wangxin
2019-06-25 14:34:10 +08:00
parent 98477b8e08
commit 28c9d6d107
5 changed files with 58 additions and 16 deletions

View File

@@ -14,6 +14,9 @@ public class ObjGroupCfg extends BaseCfg<ObjGroupCfg> {
private String domainGroup;
@ExcelField(title="block_type",sort=2)//这里没有使用公共方法处理直接将字典值set进去了不用使用dictType
protected String actionCode;
@ExcelField(title="protocol",sort=3)
protected String userRegion1;
public String getActionCode() {
return actionCode;
}

View File

@@ -103,17 +103,17 @@ public class ObjectGroupController extends BaseController {
urlGroup=formatMultSelect(request.getParameterValues("urlGroup"));
Map<String,Object> map = new HashMap();
if(StringUtils.isNotBlank(ipGroup)){
map.put("ipGroup", ipGroup.toString());
if(StringUtils.isNotBlank(ipGroup)&&StringUtils.isNotBlank(ipGroup.replaceAll(",",""))){
map.put("ipGroup", ipGroup);
}
if(StringUtils.isNotBlank(subscribeIdGroup)){
map.put("subscribeIdGroup", subscribeIdGroup.toString());
if(StringUtils.isNotBlank(subscribeIdGroup)&&StringUtils.isNotBlank(subscribeIdGroup.replaceAll(",",""))){
map.put("subscribeIdGroup", subscribeIdGroup);
}
if(StringUtils.isNotBlank(domainGroup)){
map.put("domainGroup", domainGroup.toString());
if(StringUtils.isNotBlank(domainGroup)&&StringUtils.isNotBlank(domainGroup.replaceAll(",",""))){
map.put("domainGroup", domainGroup);
}
if(StringUtils.isNotBlank(urlGroup)){
map.put("urlGroup", urlGroup.toString());
if(StringUtils.isNotBlank(urlGroup)&&StringUtils.isNotBlank(urlGroup.replaceAll(",",""))){
map.put("urlGroup", urlGroup);
}
cfg.setUserRegion(map);
objectGroupService.saveOrUpdate(cfg);

View File

@@ -209,7 +209,10 @@ public class ObjectGroupService extends BaseService {
}else{
if(StringUtils.isNotBlank(e.getValue().toString())){
String val=e.getValue().toString().substring(0,e.getValue().toString().length()-1);
canceledGroup.append(val);
if(StringUtils.isNotBlank(val)){
canceledGroup.append(val);
}
}
}
}
@@ -219,20 +222,32 @@ public class ObjectGroupService extends BaseService {
for(Object val:newMap.values()){
String _val=(String)val;
if(StringUtils.isNotBlank(_val)){
if(_val.startsWith(",")){
if(_val.startsWith(",")&&!",".equals(_val.trim())){
okGroup.append(_val.substring(1));
}else{
}else if(StringUtils.isNotBlank(_val)){
okGroup.append(_val);
}
}
}
//取消勾选的组更新UD_FLAG
if(StringUtils.isNotBlank(canceledGroup.toString())){
policyGroupInfoDao.updateUdFlag(canceledGroup.toString().substring(1),1,null);
if(canceledGroup.toString().startsWith(",")){
canceledGroup.deleteCharAt(0);
}
if(canceledGroup.toString().endsWith(",")){
canceledGroup.deleteCharAt(canceledGroup.toString().length()-1);
}
policyGroupInfoDao.updateUdFlag(canceledGroup.toString(),1,null);
}
//新选择的组更新UD_FALG
if(StringUtils.isNotBlank(okGroup.toString())){
okGroup.deleteCharAt(okGroup.toString().length()-1);
if(okGroup.toString().startsWith(",")){
okGroup.deleteCharAt(0);
}
if(okGroup.toString().endsWith(",")){
okGroup.deleteCharAt(okGroup.toString().length()-1);
}
policyGroupInfoDao.updateUdFlag(okGroup.toString(),2,null);
}
}else if(MapUtils.isNotEmpty(entity.getUserRegion())){
@@ -545,9 +560,9 @@ public class ObjectGroupService extends BaseService {
StringBuffer buf=new StringBuffer();
for(Object val:dataMap.values()){
String _val=(String)val;
if(_val.startsWith(",")){
if(_val.startsWith(",")&&!",".equals(_val)){
buf.append(_val.substring(1));
}else{
}else if(StringUtils.isNotBlank(_val)){
buf.append(_val);
}
}
@@ -577,6 +592,13 @@ public class ObjectGroupService extends BaseService {
c.setActionCode(msgProp.getProperty("action_"+service.getActionCode(),"action_"+service.getActionCode()));
}
}
if(c.getUserRegion1().equalsIgnoreCase("https")){
c.setUserRegion1("HTTPS");
}else if(c.getUserRegion1().equalsIgnoreCase("http")){
c.setUserRegion1("HTTP");
}else if(c.getUserRegion1().equalsIgnoreCase("intercept")){
c.setUserRegion1("Intercept");
}
}
if(StringUtils.isNotBlank(groupIds.toString())){
groupIds.deleteCharAt(groupIds.toString().length()-1);
@@ -639,6 +661,13 @@ public class ObjectGroupService extends BaseService {
c.setActionCode(msgProp.getProperty("action_"+service.getActionCode(),"action_"+service.getActionCode()));
}
}
if(c.getUserRegion1().equalsIgnoreCase("https")){
c.setUserRegion1("HTTPS");
}else if(c.getUserRegion1().equalsIgnoreCase("http")){
c.setUserRegion1("HTTP");
}else if(c.getUserRegion1().equalsIgnoreCase("intercept")){
c.setUserRegion1("Intercept");
}
}
if(StringUtils.isNotBlank(groupIds.toString())){
groupIds.deleteCharAt(groupIds.toString().length()-1);

View File

@@ -144,7 +144,7 @@ $(function(){
// return;
//}
//限制组必选一个并且最多选择8个组
var ipGroupLen=$("[name='ipGroup'] option:selected").length,subscribeIdGroupLen=$("[name='subscribeIdGroup'] option:selected").length,urlGroupLen=$("[name='urlGroup'] option:selected").length,domainGroupLen=$("[name='domainGroup'] option:selected").length;
var ipGroupLen=$("[name='ipGroup'] option[value!='']:selected").length,subscribeIdGroupLen=$("[name='subscribeIdGroup'] option[value!='']:selected").length,urlGroupLen=$("[name='urlGroup'] option[value!='']:selected").length,domainGroupLen=$("[name='domainGroup'] option[value!='']:selected").length;
var grouplen=0;
if($(".ipGroup").is(":visible")){
grouplen+=ipGroupLen;
@@ -356,6 +356,7 @@ var delContent = function(contentClassName, addBtnClassName) {
<label class="control-label col-md-3"><spring:message code="ip_group"/></label>
<div class="col-md-6">
<select name="ipGroup" data-live-search="true" class="selectpicker form-control">
<option value="" <c:if test="${fn:indexOf(_cfg.commonGroupIds,'ipGroup')==-1}">selected</c:if>> <spring:message code="select"/></option>
<c:forEach items="${ipGroups}" var="ipGroup">
<option value="${ipGroup.serviceGroupId}" <c:if test="${fn:indexOf(_cfg.commonGroupIds,','.concat(ipGroup.serviceGroupId).concat(','))>-1}">selected</c:if>> <spring:message code="${ipGroup.groupName}"/></option>
</c:forEach>
@@ -369,6 +370,7 @@ var delContent = function(contentClassName, addBtnClassName) {
<label class="control-label col-md-3"><spring:message code="subscribe_id_group"/></label>
<div class="col-md-6">
<select name="subscribeIdGroup" data-live-search="true" class="selectpicker form-control ">
<option value="" <c:if test="${fn:indexOf(_cfg.commonGroupIds,'subscribeIdGroup')==-1}">selected</c:if>> <spring:message code="select"/></option>
<c:forEach items="${subscribeIdGroups}" var="subscribeIdGroup">
<option value="${subscribeIdGroup.serviceGroupId}" <c:if test="${fn:indexOf(_cfg.commonGroupIds,','.concat(subscribeIdGroup.serviceGroupId).concat(','))>-1}">selected</c:if> ><spring:message code="${subscribeIdGroup.groupName}"/></option>
</c:forEach>
@@ -385,6 +387,7 @@ var delContent = function(contentClassName, addBtnClassName) {
<label class="control-label col-md-3"><spring:message code="url_group"/></label>
<div class="col-md-6">
<select name="urlGroup" data-live-search="true" class="selectpicker form-control " >
<option value="" <c:if test="${fn:indexOf(_cfg.commonGroupIds,'urlGroup')==-1}">selected</c:if>> <spring:message code="select"/></option>
<c:forEach items="${urlGroups}" var="urlGroup">
<option value="${urlGroup.serviceGroupId}" <c:if test="${fn:indexOf(_cfg.commonGroupIds,','.concat(urlGroup.serviceGroupId).concat(','))>-1}">selected</c:if> ><spring:message code="${urlGroup.groupName}"/></option>
</c:forEach>
@@ -398,6 +401,7 @@ var delContent = function(contentClassName, addBtnClassName) {
<label class="control-label col-md-3"><spring:message code="domain_group"/></label>
<div class="col-md-6">
<select name="domainGroup" data-live-search="true" class="selectpicker form-control " >
<option value="" <c:if test="${fn:indexOf(_cfg.commonGroupIds,'domainGroup')==-1}">selected</c:if>> <spring:message code="select"/></option>
<c:forEach items="${domainGroups}" var="domainGroup">
<option value="${domainGroup.serviceGroupId}" <c:if test="${fn:indexOf(_cfg.commonGroupIds,','.concat(domainGroup.serviceGroupId).concat(','))>-1}">selected</c:if> ><spring:message code="${domainGroup.groupName}"/></option>
</c:forEach>

View File

@@ -435,6 +435,7 @@
<th column="cfg_id" class="sort-column a.compile_id" style="display: none"><spring:message code="cfg_id"/></th>
<th column="config_describe" class="sort-column a.cfg_desc cfgDesc"><spring:message code="config_describe"/></th>
<th column="block_type" class="sort-column a.action"><spring:message code="block_type"/></th>
<th column="userRegion1" ><spring:message code="protocol"/></th>
<th column="ip_group" ><spring:message code="ip_group"/></th>
<th column="subscribe_id_group" ><spring:message code="subscribe_id_group"/></th>
<th column="url_group" ><spring:message code="url_group"/></th>
@@ -480,6 +481,11 @@
</c:if>
</c:forEach>
</td>
<td>
<c:if test="${cfg.userRegion1 eq 'http'}">HTTP</c:if>
<c:if test="${cfg.userRegion1 eq 'https'}">HTTPS</c:if>
<c:if test="${cfg.userRegion1 eq 'intercept'}">Intercept</c:if>
</td>
<td commonGroupIds='${cfg.commonGroupIds}'>${fn:substring(cfg.userRegion.ipGroup,1,fn:length(cfg.userRegion.ipGroup)-1)}</td>
<td subscribeIdGroup>${fn:substring(cfg.userRegion.subscribeIdGroup,1,fn:length(cfg.userRegion.subscribeIdGroup)-1)}</td>
<td urlGroup>${fn:substring(cfg.userRegion.urlGroup,1,fn:length(cfg.userRegion.urlGroup)-1)}</td>