(1)修复审核时json未携带tableName,userRegion的bug
(2)packet ip 限速修改导入模板 (3)packet ip 限速导入逻辑修改 (4)IP白名单导入添加
This commit is contained in:
@@ -7,13 +7,13 @@ import com.nis.util.excel.ExcelField;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class IpRateLimitTemplate extends IpAllTemplate {
|
public class IpRateLimitTemplate extends IpAllTemplate {
|
||||||
|
public static String userRegion1="0";
|
||||||
private String userRegion1;
|
private String userRegion2;
|
||||||
@ExcelField(title="ratelimit",dictType="RATE_LIMIT",align=2,sort=2)
|
@ExcelField(title="ratelimit",dictType="RATE_LIMIT",align=2,sort=2)
|
||||||
public String getUserRegion1() {
|
public String getUserRegion2() {
|
||||||
return userRegion1;
|
return userRegion2;
|
||||||
}
|
}
|
||||||
public void setUserRegion1(String userRegion1) {
|
public void setUserRegion2(String userRegion2) {
|
||||||
this.userRegion1 = userRegion1;
|
this.userRegion2 = userRegion2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1311,25 +1311,44 @@ public class BaseController {
|
|||||||
// 特殊字段验证
|
// 特殊字段验证
|
||||||
// packet ip ratelimit
|
// packet ip ratelimit
|
||||||
if (serviceDict!=null&&serviceDict.getFunctionId().intValue() == 5 && serviceDict.getAction().intValue() == 64) {
|
if (serviceDict!=null&&serviceDict.getFunctionId().intValue() == 5 && serviceDict.getAction().intValue() == 64) {
|
||||||
String userRegion1 = baseIpCfg.getUserRegion1();
|
String userRegion1 = IpRateLimitTemplate.userRegion1;
|
||||||
try {
|
baseIpCfg.setUserRegion1(userRegion1);
|
||||||
// Double ratelimt= Double.parseDouble(userRegion1);
|
if("0".equals(userRegion1)) {
|
||||||
List<SysDataDictionaryItem> ratelimtList = DictUtils.getDictList("RATE_LIMIT");
|
String userRegion2 = baseIpCfg.getUserRegion2();
|
||||||
boolean has = false;
|
try {
|
||||||
for (SysDataDictionaryItem ratelimit : ratelimtList) {
|
// Double ratelimt= Double.parseDouble(userRegion2);
|
||||||
if (ratelimit.getItemCode().equals(userRegion1)) {
|
List<SysDataDictionaryItem> ratelimtList = DictUtils.getDictList("RATE_LIMIT");
|
||||||
has = true;
|
boolean has = false;
|
||||||
break;
|
for (SysDataDictionaryItem ratelimit : ratelimtList) {
|
||||||
|
if (ratelimit.getItemCode().equals(userRegion2)) {
|
||||||
|
has = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (!has) {
|
||||||
|
errInfo.append(prop.getProperty("ratelimit") + "."
|
||||||
|
+ String.format(prop.getProperty("must_between"), 0.001, 0.009) + ";");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO: handle exception
|
||||||
|
errInfo.append(String.format(prop.getProperty("not_number"), prop.getProperty("ratelimit")) + ";");
|
||||||
}
|
}
|
||||||
if (!has) {
|
}else if("1".equals(userRegion1)) {
|
||||||
errInfo.append(prop.getProperty("ratelimit") + "."
|
String userRegion3 = baseIpCfg.getUserRegion3();
|
||||||
+ String.format(prop.getProperty("must_between"), 0.001, 0.009) + ";");
|
if (StringUtils.isNotBlank(userRegion3)) {
|
||||||
|
try {
|
||||||
|
Integer ratelimt=Integer.parseInt(userRegion3);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO: handle exception
|
||||||
|
errInfo.append(String.format(prop.getProperty("not_number"), prop.getProperty("bandwith")) + ";");
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
errInfo.append(
|
||||||
|
String.format(prop.getProperty("can_not_null"), prop.getProperty("bandwith")) + ";");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
|
||||||
// TODO: handle exception
|
|
||||||
errInfo.append(String.format(prop.getProperty("not_number"), prop.getProperty("ratelimit")) + ";");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// payload ip
|
// payload ip
|
||||||
if (regionDict.getFunctionId().equals(212)) {
|
if (regionDict.getFunctionId().equals(212)) {
|
||||||
@@ -3150,7 +3169,7 @@ public class BaseController {
|
|||||||
_cfg.setTableName(AsnIpCfg.getTablename());
|
_cfg.setTableName(AsnIpCfg.getTablename());
|
||||||
_cfg.setAction(0);
|
_cfg.setAction(0);
|
||||||
_cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
_cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||||
_cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
// _cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||||
_cfg.setCfgType(regionDict.getConfigRegionValue());
|
_cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||||
_cfg.setCreateTime(date);
|
_cfg.setCreateTime(date);
|
||||||
_cfg.setCreatorId(UserUtils.getUser().getId());
|
_cfg.setCreatorId(UserUtils.getUser().getId());
|
||||||
|
|||||||
@@ -556,7 +556,7 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(IpPortCfg cfg:entity.getIpPortList()) {
|
for(IpPortCfg cfg:entity.getIpPortList()) {
|
||||||
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
|
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId","cfgType","userRegion1","userRegion2","userRegion3","userRegion4","userRegion5"});
|
||||||
cfg.setTableName(IpPortCfg.getTablename());
|
cfg.setTableName(IpPortCfg.getTablename());
|
||||||
ipCfgDao.auditCfg(cfg);
|
ipCfgDao.auditCfg(cfg);
|
||||||
/*BeanUtils.copyProperties(entity, cfg, new String[]{"userRegion1","userRegion2","userRegion3","userRegion4","userRegion5","ipType","direction",
|
/*BeanUtils.copyProperties(entity, cfg, new String[]{"userRegion1","userRegion2","userRegion3","userRegion4","userRegion5","ipType","direction",
|
||||||
|
|||||||
2
src/main/resources/sql/20181030/update_region.sql
Normal file
2
src/main/resources/sql/20181030/update_region.sql
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
update function_region_dict set is_import=1 where function_id=3 and dict_id=7;
|
||||||
|
UPDATE function_service_dict SET is_import=1 WHERE function_id=3 AND dict_id=15;
|
||||||
@@ -91,6 +91,23 @@
|
|||||||
onClick="javascript:window.location='${ctx}/ntc/whitelist/ip/form?functionId=${cfg.functionId}'">
|
onClick="javascript:window.location='${ctx}/ntc/whitelist/ip/form?functionId=${cfg.functionId}'">
|
||||||
<i class="fa fa-plus"></i>
|
<i class="fa fa-plus"></i>
|
||||||
<spring:message code="add"></spring:message></button>
|
<spring:message code="add"></spring:message></button>
|
||||||
|
<c:set var="serviceImport" value="false"></c:set>
|
||||||
|
<c:set var="regionImport" value="false"></c:set>
|
||||||
|
<c:forEach items="${serviceList}" var="service" >
|
||||||
|
<c:if test="${(cfg.functionId eq service.functionId) && service.isImport eq 1}">
|
||||||
|
<c:set var="serviceImport" value="true"></c:set>
|
||||||
|
</c:if>
|
||||||
|
</c:forEach>
|
||||||
|
<c:forEach items="${regionList}" var="region" >
|
||||||
|
<c:if test="${(cfg.functionId eq region.functionId) && region.isImport eq 1}">
|
||||||
|
<c:set var="regionImport" value="true"></c:set>
|
||||||
|
</c:if>
|
||||||
|
</c:forEach>
|
||||||
|
<c:if test="${serviceImport eq 'true' && regionImport eq 'true'}">
|
||||||
|
<button type="button" class="btn btn-primary import" >
|
||||||
|
<i class="fa fa-plus"></i>
|
||||||
|
<spring:message code="import"></spring:message></button>
|
||||||
|
</c:if>
|
||||||
</shiro:hasPermission>
|
</shiro:hasPermission>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -462,6 +479,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<c:set var="importPath" value="/ntc/whitelist/ip/list?functionId=${cfg.functionId}"/>
|
||||||
|
<!-- 模板导入,start -->
|
||||||
|
<%@include file="/WEB-INF/include/excel/importModal.jsp" %>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Reference in New Issue
Block a user