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