(1)域名列表配置状态一列替换为系统字典
(2)ip配置新增/修改时cfg_region_code,cfg_type两个字段的值修复 (3)ip审核不再调用maat_service字典,改为根据配置的cfg_type字段结合function_region_dict字典的is_maat字段判断下发方式。maat_service字典只有ip导入时使用。
This commit is contained in:
@@ -4,15 +4,16 @@ import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.SysDataDictionaryItem;
|
||||
import com.nis.domain.callback.InlineIp;
|
||||
import com.nis.domain.configuration.AreaIpCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
@@ -27,6 +28,7 @@ import com.nis.domain.maat.ToMaatBean;
|
||||
import com.nis.domain.maat.ToMaatResult;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Configurations;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
@@ -161,20 +163,16 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
List<FunctionRegionDict> dictList = DictUtils.getFunctionRegionDictList(cfg.getFunctionId());
|
||||
int maatType=0;
|
||||
//判断下发类型是走maat还是callback
|
||||
|
||||
List<SysDataDictionaryItem> maatServiceList = DictUtils.getDictList("MAAT_SERVICE");
|
||||
for(SysDataDictionaryItem maatService:maatServiceList){
|
||||
if(Integer.parseInt(maatService.getItemCode())==cfg.getServiceId().intValue()){
|
||||
for(FunctionRegionDict f:dictList){
|
||||
if(maatService.getItemValue().equals(f.getConfigRegionValue())){
|
||||
maatType=f.getIsMaat();
|
||||
break;
|
||||
}
|
||||
String regionValue=cfg.getCfgType();
|
||||
if(regionValue!=null) {
|
||||
for(FunctionRegionDict region:dictList) {
|
||||
if(regionValue.equals(region.getConfigRegionValue())) {
|
||||
maatType=region.getIsMaat();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Properties props=this.getMsgProp();
|
||||
if(cfg.getIsAudit()==Constants.AUDIT_YES){
|
||||
if(maatType==Constants.CALLBACK_TYPE){
|
||||
List<InlineIp> ipList=new ArrayList<>();
|
||||
@@ -251,6 +249,8 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
logger.error("IP配置配置下发失败",e);
|
||||
throw e;
|
||||
}
|
||||
}else {
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+props.getProperty("unknown_cfg_type"));
|
||||
}
|
||||
}else if(cfg.getIsAudit()==Constants.AUDIT_NOT_YES){
|
||||
if(maatType==Constants.CALLBACK_TYPE){
|
||||
@@ -291,6 +291,8 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
logger.info("IP管控取消配置失败");
|
||||
throw e;
|
||||
}
|
||||
}else {
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+props.getProperty("unknown_cfg_type"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -483,4 +485,26 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
// TODO Auto-generated method stub
|
||||
return ipCfgDao.getListByCfgIdWithName(tablename,functionId,ids);
|
||||
}
|
||||
/**
|
||||
* 获取国际化配置文件
|
||||
* @return
|
||||
*/
|
||||
public Properties getMsgProp(){
|
||||
Properties msgProp = new Properties();
|
||||
try {
|
||||
String language = LocaleContextHolder.getLocale().getLanguage();
|
||||
if(language.equals("zh_cn")||language.equals("zh")){
|
||||
msgProp.load(Configurations.class.getResourceAsStream("/messages/message_zh_CN.properties"));
|
||||
}else if(language.equals("ru")){
|
||||
msgProp.load(Configurations.class.getResourceAsStream("/messages/message_ru.properties"));
|
||||
}else{
|
||||
msgProp.load(Configurations.class.getResourceAsStream("/messages/message_en.properties"));
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
msgProp = null;
|
||||
logger.error("未知i18n消息配置文件,请确定文件是否存在!",e);
|
||||
}
|
||||
return msgProp;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1056,4 +1056,5 @@ Maintenance=Advanced
|
||||
Proxy=Proxy
|
||||
selective=Selective
|
||||
ip_protocol=IP Protocol
|
||||
max_shouldnot_less_than_min=The max item should not be less than the min item.
|
||||
max_shouldnot_less_than_min=The max item should not be less than the min item.
|
||||
unknown_cfg_type=Unknown configuration type.
|
||||
@@ -860,4 +860,5 @@ isp_report=Isp Report
|
||||
show_more=Show More
|
||||
ratelimit_limit=Limit Rate must between 0 and 100
|
||||
|
||||
max_shouldnot_less_than_min=The max item should not be less than the min item.
|
||||
max_shouldnot_less_than_min=The max item should not be less than the min item.
|
||||
unknown_cfg_type=Unknown configuration type.
|
||||
@@ -1049,4 +1049,5 @@ traffic_website_type_chart=\u7F51\u7AD9\u5206\u7C7B\u6D41\u91CF\u7EDF\u8BA1\u56F
|
||||
website=\u7F51\u7AD9\u540D\u79F0
|
||||
#===============dashboard end===================================
|
||||
ratelimit_limit=\u9650\u901F\u6BD4\u4F8B\u5FC5\u987B\u4ECB\u4E8E0\u5230100\#\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=dashboard end\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=
|
||||
max_shouldnot_less_than_min=\u6700\u5927\u9879\u4E0D\u80FD\u5C0F\u4E8E\u6700\u5C0F\u9879
|
||||
max_shouldnot_less_than_min=\u6700\u5927\u9879\u4E0D\u80FD\u5C0F\u4E8E\u6700\u5C0F\u9879
|
||||
unknown_cfg_type=\u672A\u77E5\u7684\u914D\u7F6E\u7C7B\u578B
|
||||
@@ -88,10 +88,9 @@
|
||||
<div class="pull-left">
|
||||
<form:select path="isAudit" class="selectpicker select2 input-small">
|
||||
<form:option value=""><spring:message code="all_states"/></form:option>
|
||||
<form:option value="0"><spring:message code="created"></spring:message></form:option>
|
||||
<form:option value="1"><spring:message code="approved"></spring:message></form:option>
|
||||
<form:option value="2"><spring:message code="unapproved"></spring:message></form:option>
|
||||
<form:option value="3"><spring:message code="cancel_approved"></spring:message></form:option>
|
||||
<c:forEach items="${fns:getDictList('AUDIT_STATUS')}" var="auditC">
|
||||
<form:option value="${auditC.itemCode}"><spring:message code="${auditC.itemValue}"></spring:message></form:option>
|
||||
</c:forEach>
|
||||
</form:select>
|
||||
</div>
|
||||
|
||||
@@ -402,12 +401,12 @@
|
||||
<c:if test="${cfg.isValid==-1}"><spring:message code="deleted"/></c:if>
|
||||
</td>
|
||||
<td>
|
||||
<c:choose>
|
||||
<c:when test="${cfg.isAudit eq '0'}"><span class="label label-danger"><spring:message code="created"></spring:message></span></c:when>
|
||||
<c:when test="${cfg.isAudit eq '1'}"><span class="label label-success"><spring:message code="approved"></spring:message></span></c:when>
|
||||
<c:when test="${cfg.isAudit eq '2'}"><span class="label label-warning"><spring:message code="unapproved"></spring:message></span></c:when>
|
||||
<c:when test="${cfg.isAudit eq '3'}"><span class="label label-warning"><spring:message code="cancel_approved"></spring:message></span></c:when>
|
||||
</c:choose>
|
||||
<c:forEach items="${fns:getDictList('AUDIT_STATUS')}" var="auditC">
|
||||
<c:if test="${cfg.isAudit eq auditC.itemCode and auditC.itemValue eq 'created'}"><span class="label label-danger"><spring:message code="created"></spring:message></span></c:if>
|
||||
<c:if test="${cfg.isAudit eq auditC.itemCode and auditC.itemValue eq 'approved'}"><span class="label label-success"><spring:message code="approved"></spring:message></span></c:if>
|
||||
<c:if test="${cfg.isAudit eq auditC.itemCode and auditC.itemValue eq 'unapproved'}"><span class="label label-warning"><spring:message code="unapproved"></spring:message></span></c:if>
|
||||
<c:if test="${cfg.isAudit eq auditC.itemCode and auditC.itemValue eq 'cancel'}"><span class="label label-warning"><spring:message code="cancel_approved"></spring:message></span></c:if>
|
||||
</c:forEach>
|
||||
</td>
|
||||
<td>${cfg.creatorName }</td>
|
||||
<td><fmt:formatDate value="${cfg.createTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
|
||||
|
||||
@@ -51,7 +51,7 @@ $(function(){
|
||||
$(element).parents(".form-group").find("div[for='"+element.attr("name")+"']").append(error);
|
||||
},
|
||||
submitHandler: function(form){
|
||||
if($("#dnsStrategyId")){
|
||||
if($("#dnsStrategyId")&&$("#dnsStrategyId").val()){
|
||||
$("#cfgRegionCode").val($("#cfgRegionCodeMaat").val());
|
||||
$("#cfgType").val($("#cfgTypeMaat").val());
|
||||
}
|
||||
@@ -106,7 +106,7 @@ $(function(){
|
||||
<input type="hidden" id="cfgTypeMaat" value="${region.configRegionValue}">
|
||||
<input type="hidden" id="cfgRegionCodeMaat" value="${region.configRegionCode}">
|
||||
</c:if>
|
||||
<c:if test="${region.isMaat==0}">
|
||||
<c:if test="${region.isMaat==2}">
|
||||
<input type="hidden" id="cfgTypeCallback" value="${region.configRegionValue}">
|
||||
<input type="hidden" id="cfgRegionCodeCallback" value="${region.configRegionCode}">
|
||||
</c:if>
|
||||
|
||||
@@ -62,10 +62,6 @@ $(function(){
|
||||
$(element).parents(".form-group").find("div[for='"+element.attr("name")+"']").append(error);
|
||||
},
|
||||
submitHandler: function(form){
|
||||
if($("#dnsStrategyId")){
|
||||
$("#cfgRegionCode").val($("#cfgRegionCodeMaat").val());
|
||||
$("#cfgType").val($("#cfgTypeMaat").val());
|
||||
}
|
||||
loading('<spring:message code="onloading"/>');
|
||||
form.submit();
|
||||
},
|
||||
@@ -117,7 +113,7 @@ $(function(){
|
||||
<input type="hidden" id="cfgTypeMaat" value="${region.configRegionValue}">
|
||||
<input type="hidden" id="cfgRegionCodeMaat" value="${region.configRegionCode}">
|
||||
</c:if>
|
||||
<c:if test="${region.isMaat==0}">
|
||||
<c:if test="${region.isMaat==2}">
|
||||
<input type="hidden" id="cfgTypeCallback" value="${region.configRegionValue}">
|
||||
<input type="hidden" id="cfgRegionCodeCallback" value="${region.configRegionCode}">
|
||||
</c:if>
|
||||
|
||||
@@ -55,10 +55,6 @@ $(function(){
|
||||
$(element).parents(".form-group").find("div[for='"+element.attr("name")+"']").append(error);
|
||||
},
|
||||
submitHandler: function(form){
|
||||
if($("#dnsStrategyId")){
|
||||
$("#cfgRegionCode").val($("#cfgRegionCodeMaat").val());
|
||||
$("#cfgType").val($("#cfgTypeMaat").val());
|
||||
}
|
||||
loading('<spring:message code="onloading"/>');
|
||||
form.submit();
|
||||
},
|
||||
@@ -111,7 +107,7 @@ $(function(){
|
||||
<input type="hidden" id="cfgTypeMaat" value="${region.configRegionValue}">
|
||||
<input type="hidden" id="cfgRegionCodeMaat" value="${region.configRegionCode}">
|
||||
</c:if>
|
||||
<c:if test="${region.isMaat==0}">
|
||||
<c:if test="${region.isMaat==2}">
|
||||
<input type="hidden" id="cfgTypeCallback" value="${region.configRegionValue}">
|
||||
<input type="hidden" id="cfgRegionCodeCallback" value="${region.configRegionCode}">
|
||||
</c:if>
|
||||
|
||||
@@ -71,10 +71,9 @@
|
||||
<div class="pull-left">
|
||||
<form:select path="isAudit" class="selectpicker select2 input-small">
|
||||
<form:option value=""><spring:message code="all_states"/></form:option>
|
||||
<form:option value="0"><spring:message code="created"></spring:message></form:option>
|
||||
<form:option value="1"><spring:message code="approved"></spring:message></form:option>
|
||||
<form:option value="2"><spring:message code="unapproved"></spring:message></form:option>
|
||||
<form:option value="3"><spring:message code="cancel_approved"></spring:message></form:option>
|
||||
<c:forEach items="${fns:getDictList('AUDIT_STATUS')}" var="auditC">
|
||||
<form:option value="${auditC.itemCode}"><spring:message code="${auditC.itemValue}"></spring:message></form:option>
|
||||
</c:forEach>
|
||||
</form:select>
|
||||
</div>
|
||||
|
||||
@@ -217,12 +216,12 @@
|
||||
<c:if test="${cfg.isValid==-1}"><spring:message code="deleted"/></c:if>
|
||||
</td>
|
||||
<td>
|
||||
<c:choose>
|
||||
<c:when test="${cfg.isAudit eq '0'}"><span class="label label-danger"><spring:message code="created"></spring:message></span></c:when>
|
||||
<c:when test="${cfg.isAudit eq '1'}"><span class="label label-success"><spring:message code="approved"></spring:message></span></c:when>
|
||||
<c:when test="${cfg.isAudit eq '2'}"><span class="label label-warning"><spring:message code="unapproved"></spring:message></span></c:when>
|
||||
<c:when test="${cfg.isAudit eq '3'}"><span class="label label-warning"><spring:message code="cancel_approved"></spring:message></span></c:when>
|
||||
</c:choose>
|
||||
<c:forEach items="${fns:getDictList('AUDIT_STATUS')}" var="auditC">
|
||||
<c:if test="${cfg.isAudit eq auditC.itemCode and auditC.itemValue eq 'created'}"><span class="label label-danger"><spring:message code="created"></spring:message></span></c:if>
|
||||
<c:if test="${cfg.isAudit eq auditC.itemCode and auditC.itemValue eq 'approved'}"><span class="label label-success"><spring:message code="approved"></spring:message></span></c:if>
|
||||
<c:if test="${cfg.isAudit eq auditC.itemCode and auditC.itemValue eq 'unapproved'}"><span class="label label-warning"><spring:message code="unapproved"></spring:message></span></c:if>
|
||||
<c:if test="${cfg.isAudit eq auditC.itemCode and auditC.itemValue eq 'cancel'}"><span class="label label-warning"><spring:message code="cancel_approved"></spring:message></span></c:if>
|
||||
</c:forEach>
|
||||
</td>
|
||||
<td>${cfg.creatorName }</td>
|
||||
<td><fmt:formatDate value="${cfg.createTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
|
||||
|
||||
Reference in New Issue
Block a user