导入提示信息null情况处理
导入界面非空校验,以及界面单个service或region处理
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
*/
|
||||
package com.nis.util.excel;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
@@ -40,6 +41,7 @@ import org.apache.poi.xssf.usermodel.XSSFClientAnchor;
|
||||
import org.apache.poi.xssf.usermodel.XSSFRichTextString;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
@@ -241,7 +243,7 @@ public class ExportExcel {
|
||||
index++;
|
||||
}
|
||||
if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){
|
||||
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_SUBNET_VALUE+"("+msgProp.getProperty("ipv4_mask")+")"+"\n";
|
||||
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_SUBNET_VALUE+"("+msgProp.getProperty("ipv4_subnet")+")"+"\n";
|
||||
index++;
|
||||
}
|
||||
}
|
||||
@@ -255,7 +257,7 @@ public class ExportExcel {
|
||||
index++;
|
||||
}
|
||||
if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){
|
||||
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_SUBNET_VALUE+"("+msgProp.getProperty("ipv6_mask")+")"+"\n";
|
||||
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_SUBNET_VALUE+"("+msgProp.getProperty("ipv6_subnet")+")"+"\n";
|
||||
index++;
|
||||
}
|
||||
}
|
||||
@@ -269,9 +271,12 @@ public class ExportExcel {
|
||||
}else{
|
||||
commentStr=msgProp.getProperty("example")+":\n"+commentStr;
|
||||
index++;
|
||||
|
||||
/**TODO
|
||||
规则:
|
||||
index++;
|
||||
commentStr=msgProp.getProperty("example")+":\n"+commentStr;
|
||||
index++;
|
||||
1、源ip和目的ip不能相等
|
||||
index++;
|
||||
2、源ip和目的ip格式必须一致
|
||||
@@ -313,7 +318,7 @@ public class ExportExcel {
|
||||
index++;
|
||||
}
|
||||
if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){
|
||||
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_SUBNET_VALUE+"("+msgProp.getProperty("ipv6_mask")+")"+"\n";
|
||||
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_SUBNET_VALUE+"("+msgProp.getProperty("ipv6_subnet")+")"+"\n";
|
||||
index++;
|
||||
}
|
||||
}
|
||||
@@ -351,7 +356,7 @@ public class ExportExcel {
|
||||
index++;
|
||||
}
|
||||
if((","+region.getConfigPortPattern()+",").indexOf(",2,") > -1){
|
||||
commentStr=commentStr+Constants.PORT_MASK_DEFAULT+"(Port/"+msgProp.getProperty("port_mask")+")"+"\n";
|
||||
commentStr=commentStr+Constants.PORT_MASK_DEFAULT+"(Port/"+msgProp.getProperty("port_subnet")+")"+"\n";
|
||||
index++;
|
||||
}
|
||||
}else{
|
||||
@@ -386,7 +391,7 @@ public class ExportExcel {
|
||||
index++;
|
||||
}
|
||||
if((","+region.getConfigPortPattern()+",").indexOf(",2,") > -1){
|
||||
commentStr=commentStr+Constants.PORT_MASK_DEFAULT+"(Port/"+msgProp.getProperty("port_mask")+")"+"\n";
|
||||
commentStr=commentStr+Constants.PORT_MASK_DEFAULT+"(Port/"+msgProp.getProperty("port_subnet")+")"+"\n";
|
||||
index++;
|
||||
}
|
||||
}else{
|
||||
@@ -1761,7 +1766,6 @@ public class ExportExcel {
|
||||
}else{
|
||||
fileName="export.xlsx";
|
||||
}
|
||||
|
||||
final String userAgent = request.getHeader("USER-AGENT");
|
||||
String finalFileName = null;
|
||||
if(StringUtils.contains(userAgent, "MSIE")){//IE浏览器
|
||||
|
||||
@@ -1269,6 +1269,7 @@ public_file_error=Wrong format of public key file
|
||||
private_file_error=Wrong format of private key file
|
||||
keyframe_pic_required=No keyframe pictures have been selected.
|
||||
ipv4_range=IPv4 Range
|
||||
ipv4_subnet=IPv4/Subnet mask
|
||||
ipv4_subnet=IPv4/Subnet Mask
|
||||
ipv6_range=IPv6 Range
|
||||
ipv6_subnet=IPv6/Subnet mask
|
||||
ipv6_subnet=IPv6/Subnet Mask
|
||||
example=For Example
|
||||
@@ -1291,4 +1291,5 @@ keyframe_pic_required=No keyframe pictures have been selected.
|
||||
ipv4_range=IPv4 Range
|
||||
ipv4_subnet=IPv4/Subnet mask
|
||||
ipv6_range=IPv6 Range
|
||||
ipv6_subnet=IPv6/Subnet mask
|
||||
ipv6_subnet=IPv6/Subnet mask
|
||||
example=For Example
|
||||
@@ -1266,4 +1266,5 @@ keyframe_pic_required=\u5C1A\u672A\u9009\u62E9\u5173\u952E\u5E27\u56FE\u7247
|
||||
ipv4_range=IPv4 Range
|
||||
ipv4_subnet=IPv4/Subnet mask
|
||||
ipv6_range=IPv6 Range
|
||||
ipv6_subnet=IPv6/Subnet mask
|
||||
ipv6_subnet=IPv6/Subnet mask
|
||||
example=\u4F8B\u5982
|
||||
@@ -22,7 +22,8 @@
|
||||
<span></span>
|
||||
</div>
|
||||
<input type="hidden" name="fucntionId" id="fucntionId" value="${cfg.functionId }">
|
||||
<div class="form-group">
|
||||
</br>
|
||||
<div class="form-group service">
|
||||
<label class="control-label col-md-3"> <spring:message
|
||||
code="action" />
|
||||
</label>
|
||||
@@ -54,7 +55,7 @@
|
||||
</div>
|
||||
<div for="action"></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-group region">
|
||||
<label class="control-label col-md-3"> <spring:message
|
||||
code="cfg_type" />
|
||||
</label>
|
||||
@@ -109,16 +110,19 @@
|
||||
<c:if test="${cfg.functionId eq 63 }">
|
||||
<c:set var="cfgType" value="1"></c:set>
|
||||
<c:set var="spec_service_id"><spring:message code="social_app"/></c:set>
|
||||
<input type="hidden" name="appError" id="appError" value="${spec_service_id } <spring:message code="required" />">
|
||||
</c:if>
|
||||
<!-- 408 tunnel behavior -->
|
||||
<c:if test="${cfg.functionId eq 408 }">
|
||||
<c:set var="cfgType" value="2"></c:set>
|
||||
<c:set var="spec_service_id"><spring:message code="encrypted_tunnel_behavior"/></c:set>
|
||||
<input type="hidden" name="appError" id="appError" value="${spec_service_id } <spring:message code="required" />">
|
||||
</c:if>
|
||||
<!-- 407 basic -->
|
||||
<c:if test="${cfg.functionId eq 407 }">
|
||||
<c:set var="cfgType" value="3"></c:set>
|
||||
<c:set var="spec_service_id"><spring:message code="basic_protocol"/></c:set>
|
||||
<input type="hidden" name="appError" id="appError" value="${spec_service_id } <spring:message code="required" />">
|
||||
</c:if>
|
||||
|
||||
<c:if test="${!empty cfgType }">
|
||||
@@ -131,16 +135,15 @@
|
||||
<c:set var="isShowBusinessType" value="false"/>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
<c:set var="spec_service_id"><spring:message code="social_app"/></c:set>
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="social_app"/></label>
|
||||
<label class="control-label col-md-3"><font color="red">*</font>${spec_service_id }</label>
|
||||
<div class="col-md-6">
|
||||
<sys:treeselect id="appId" name="appId" value=""
|
||||
labelName="parent.specServiceName" notAllowSelectParent="true" enableSearch="true"
|
||||
labelValue=""
|
||||
labelName="parent.appIdName" notAllowSelectParent="true" enableSearch="true"
|
||||
labelValue="${spec_service_id }"
|
||||
title="${spec_service_id}" url="/specific/specificServiceCfg/treeData?isLeafShow=false&cfgType=${cfgType }&specific=${!isShowBusinessType}" extId="0"
|
||||
notAllowSelectRoot="true" cssClass="form-control required"/>
|
||||
</div>
|
||||
<div for="parent.specServiceName"></div>
|
||||
<div for="parent.appIdName"></div>
|
||||
</div>
|
||||
</br>
|
||||
<c:if test="${cfgType eq 3}">
|
||||
|
||||
@@ -16,6 +16,7 @@ $(function(){
|
||||
});
|
||||
$("input[name='regionDictIds']").click(function(){
|
||||
});
|
||||
|
||||
});
|
||||
/**
|
||||
* action动作切换
|
||||
@@ -29,7 +30,25 @@ function switchService(){
|
||||
$("input[name='regionDictIds'][cfgRegionCodeR!='"+cfgRegionCode+"']").parents(".radio-inline").addClass("hidden");
|
||||
$("input[name='regionDictIds'][cfgRegionCodeR='"+cfgRegionCode+"']").prop("checked",true);
|
||||
$("input[name='regionDictIds'][cfgRegionCodeR='"+cfgRegionCode+"']").parents(".radio-inline").removeClass("hidden");
|
||||
if(cfgRegionCodeS.split(",").length==1){
|
||||
$(".region").addClass("hidden");
|
||||
}else{
|
||||
$(".region").removeClass("hidden");
|
||||
}
|
||||
}else{
|
||||
if($("input[name='regionDictIds']").length==1){
|
||||
$(".region").addClass("hidden");
|
||||
}else{
|
||||
$(".region").removeClass("hidden");
|
||||
}
|
||||
}
|
||||
|
||||
if($("input[name='serviceDictId']").length==1){
|
||||
$(".service").addClass("hidden");
|
||||
}else{
|
||||
$(".service").removeClass("hidden");
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* 模板下载
|
||||
@@ -94,10 +113,23 @@ var importCfg=function(){
|
||||
alert("请选择action");
|
||||
return ;
|
||||
}
|
||||
var appFlag=true;
|
||||
if(($("#functionId").val() == 63)||($("#functionId").val() == 408)||($("#functionId").val() == 407)){
|
||||
var appIdValue=$("#appIdName").val();
|
||||
if(appIdValue == null || appIdValue ==''){
|
||||
appFlag=false;
|
||||
}
|
||||
}
|
||||
var fileName = $(".fileupload-preview", $("#importForm1")).text();
|
||||
var $error = $('.alert-error', $("#importForm1"));
|
||||
if(!appFlag){
|
||||
$("span",$error).html($("#appError").val());
|
||||
$error.removeClass("hide");
|
||||
$error.addClass("show");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(fileName==""){
|
||||
|
||||
$("span",$error).html("请选择xls或者xlsx格式文件进行导入...");
|
||||
$error.removeClass("hide");
|
||||
$error.addClass("show");
|
||||
|
||||
Reference in New Issue
Block a user