(1)导入模板生成取消将function_region_dict中字段只只有一个的时候,方向,协议,大小写敏感等字段隐藏
(2)ip导入方向协议导入时填入默认值
This commit is contained in:
@@ -773,9 +773,9 @@ public class ExportExcel {
|
|||||||
/**
|
/**
|
||||||
*block 只有TCP不需要导入
|
*block 只有TCP不需要导入
|
||||||
* */
|
* */
|
||||||
headerStr="";
|
/*headerStr="";
|
||||||
commentStr="";
|
commentStr="";*/
|
||||||
/*List<SysDataDictionaryItem> protocol=DictUtils.getDictList("PROTOCOL");
|
List<SysDataDictionaryItem> protocol=DictUtils.getDictList("PROTOCOL");
|
||||||
if(protocol !=null && protocol.size()>0){
|
if(protocol !=null && protocol.size()>0){
|
||||||
for (SysDataDictionaryItem sysDataDictionaryItem : protocol) {
|
for (SysDataDictionaryItem sysDataDictionaryItem : protocol) {
|
||||||
if(sysDataDictionaryItem.getItemCode().equals("6")){
|
if(sysDataDictionaryItem.getItemCode().equals("6")){
|
||||||
@@ -783,7 +783,7 @@ public class ExportExcel {
|
|||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
if(StringUtil.isEmpty(defaultValue)){
|
if(StringUtil.isEmpty(defaultValue)){
|
||||||
defaultValue="6";
|
defaultValue="6";
|
||||||
}
|
}
|
||||||
@@ -819,10 +819,10 @@ public class ExportExcel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if(StringUtil.isEmpty(region.getConfigProtocol())){
|
/*if(StringUtil.isEmpty(region.getConfigProtocol())){
|
||||||
headerStr="";
|
headerStr="";
|
||||||
commentStr="";
|
commentStr="";
|
||||||
}else{
|
}else{*/
|
||||||
commentStr="";
|
commentStr="";
|
||||||
List<SysDataDictionaryItem> protocol=DictUtils.getDictList("PROTOCOL");
|
List<SysDataDictionaryItem> protocol=DictUtils.getDictList("PROTOCOL");
|
||||||
if(protocol !=null && protocol.size()>0){
|
if(protocol !=null && protocol.size()>0){
|
||||||
@@ -856,13 +856,13 @@ public class ExportExcel {
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
/*}*/
|
||||||
}
|
}
|
||||||
if(StringUtil.isEmpty(commentStr)
|
/*if(StringUtil.isEmpty(commentStr)
|
||||||
||(region.getConfigProtocol().split(",").length==1)){
|
||(region.getConfigProtocol().split(",").length==1)){
|
||||||
headerStr="";
|
headerStr="";
|
||||||
commentStr="";
|
commentStr="";
|
||||||
}else{
|
}else{*/
|
||||||
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
|
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
|
||||||
index++;
|
index++;
|
||||||
index++;
|
index++;
|
||||||
@@ -873,16 +873,16 @@ public class ExportExcel {
|
|||||||
commentStr=commentStr+"▶"+msgProp.getProperty("default_value")+":"+defaultValue+"\n";
|
commentStr=commentStr+"▶"+msgProp.getProperty("default_value")+":"+defaultValue+"\n";
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
}
|
/*}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
//Direction
|
//Direction
|
||||||
if("direction".equals(headerStr)){
|
if("direction".equals(headerStr)){
|
||||||
if(StringUtil.isEmpty(region.getConfigDirection())
|
/*if(StringUtil.isEmpty(region.getConfigDirection())
|
||||||
||(region.getConfigDirection().split(",").length==1)){
|
||(region.getConfigDirection().split(",").length==1)){
|
||||||
headerStr="";
|
headerStr="";
|
||||||
commentStr="";
|
commentStr="";
|
||||||
}else{
|
}else{*/
|
||||||
commentStr="";
|
commentStr="";
|
||||||
List<SysDataDictionaryItem> direction=DictUtils.getDictList("DIRECTION");
|
List<SysDataDictionaryItem> direction=DictUtils.getDictList("DIRECTION");
|
||||||
if(direction !=null && direction.size()>0){
|
if(direction !=null && direction.size()>0){
|
||||||
@@ -904,11 +904,11 @@ public class ExportExcel {
|
|||||||
defaultValue="0";
|
defaultValue="0";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
/*}*/
|
||||||
if(StringUtil.isEmpty(commentStr)){
|
/*if(StringUtil.isEmpty(commentStr)){
|
||||||
headerStr="";
|
headerStr="";
|
||||||
commentStr="";
|
commentStr="";
|
||||||
}else{
|
}else{*/
|
||||||
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
|
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
|
||||||
index++;
|
index++;
|
||||||
index++;
|
index++;
|
||||||
@@ -919,7 +919,7 @@ public class ExportExcel {
|
|||||||
commentStr=commentStr+"▶"+msgProp.getProperty("default_value")+":"+defaultValue+"\n";
|
commentStr=commentStr+"▶"+msgProp.getProperty("default_value")+":"+defaultValue+"\n";
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
}
|
/*}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
//字符串或摘要字符串
|
//字符串或摘要字符串
|
||||||
@@ -927,7 +927,7 @@ public class ExportExcel {
|
|||||||
if(region.getRegionType().equals(3)){
|
if(region.getRegionType().equals(3)){
|
||||||
if("district".equals(headerStr)){
|
if("district".equals(headerStr)){
|
||||||
if(StringUtil.isEmpty(region.getConfigDistrict())
|
if(StringUtil.isEmpty(region.getConfigDistrict())
|
||||||
||(region.getConfigDistrict().split(",").length==1)){
|
/*||(region.getConfigDistrict().split(",").length==1)*/){
|
||||||
headerStr="";
|
headerStr="";
|
||||||
commentStr="";
|
commentStr="";
|
||||||
}else{
|
}else{
|
||||||
@@ -1032,7 +1032,7 @@ public class ExportExcel {
|
|||||||
//match method
|
//match method
|
||||||
if("match_method".equals(headerStr)){
|
if("match_method".equals(headerStr)){
|
||||||
if(StringUtil.isEmpty(region.getConfigMatchMethod())
|
if(StringUtil.isEmpty(region.getConfigMatchMethod())
|
||||||
||(region.getConfigMatchMethod().split(",").length==1)){
|
/*||(region.getConfigMatchMethod().split(",").length==1)*/){
|
||||||
headerStr="";
|
headerStr="";
|
||||||
commentStr="";
|
commentStr="";
|
||||||
}else{
|
}else{
|
||||||
@@ -1111,7 +1111,7 @@ public class ExportExcel {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(StringUtil.isEmpty(commentStr) || (!StringUtil.isEmpty(list) && list.size()==1)){
|
if(StringUtil.isEmpty(commentStr) /*|| (!StringUtil.isEmpty(list) && list.size()==1)*/){
|
||||||
headerStr="";
|
headerStr="";
|
||||||
commentStr="";
|
commentStr="";
|
||||||
}else{
|
}else{
|
||||||
@@ -1161,7 +1161,7 @@ public class ExportExcel {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(StringUtil.isEmpty(commentStr) || (!StringUtil.isEmpty(list) && list.size()==1)){
|
if(StringUtil.isEmpty(commentStr) /*|| (!StringUtil.isEmpty(list) && list.size()==1)*/){
|
||||||
headerStr="";
|
headerStr="";
|
||||||
commentStr="";
|
commentStr="";
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ public class ImportBigExcel extends XLSXCovertCSVReader{
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!directionShow) {
|
/*if(!directionShow) {
|
||||||
if(f.getName().equalsIgnoreCase("direction")) {
|
if(f.getName().equalsIgnoreCase("direction")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -273,7 +273,7 @@ public class ImportBigExcel extends XLSXCovertCSVReader{
|
|||||||
if(f.getName().equalsIgnoreCase("district")) {
|
if(f.getName().equalsIgnoreCase("district")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
ExcelField ef = f.getAnnotation(ExcelField.class);
|
ExcelField ef = f.getAnnotation(ExcelField.class);
|
||||||
if (ef != null && (ef.type()==0 || ef.type()==2)){
|
if (ef != null && (ef.type()==0 || ef.type()==2)){
|
||||||
if (groups!=null && groups.length>0){
|
if (groups!=null && groups.length>0){
|
||||||
@@ -323,7 +323,7 @@ public class ImportBigExcel extends XLSXCovertCSVReader{
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!directionShow) {
|
/*if(!directionShow) {
|
||||||
if(m.getName().equalsIgnoreCase("get"+"direction")||m.getName().equalsIgnoreCase("set"+"direction")) {
|
if(m.getName().equalsIgnoreCase("get"+"direction")||m.getName().equalsIgnoreCase("set"+"direction")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -352,7 +352,7 @@ public class ImportBigExcel extends XLSXCovertCSVReader{
|
|||||||
if(m.getName().equalsIgnoreCase("get"+"district")||m.getName().equalsIgnoreCase("set"+"district")) {
|
if(m.getName().equalsIgnoreCase("get"+"district")||m.getName().equalsIgnoreCase("set"+"district")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
ExcelField ef = m.getAnnotation(ExcelField.class);
|
ExcelField ef = m.getAnnotation(ExcelField.class);
|
||||||
if (ef != null && (ef.type()==0 || ef.type()==2)){
|
if (ef != null && (ef.type()==0 || ef.type()==2)){
|
||||||
if (groups!=null && groups.length>0){
|
if (groups!=null && groups.length>0){
|
||||||
@@ -451,29 +451,29 @@ public class ImportBigExcel extends XLSXCovertCSVReader{
|
|||||||
//log.debug("Import value type: ["+i+","+column+"] " + valType);
|
//log.debug("Import value type: ["+i+","+column+"] " + valType);
|
||||||
try {
|
try {
|
||||||
if (valType == String.class){
|
if (valType == String.class){
|
||||||
String s = String.valueOf(val.toString());
|
String s = String.valueOf(val.toString().trim());
|
||||||
//0.0.0.0表示任意IP的含义
|
//0.0.0.0表示任意IP的含义
|
||||||
if(StringUtils.endsWith(s, ".0") && !s.endsWith("0.0.0.0")){
|
if(StringUtils.endsWith(s, ".0") && !s.endsWith("0.0.0.0")){
|
||||||
val = StringUtils.substringBefore(s, ".0");
|
val = StringUtils.substringBefore(s, ".0");
|
||||||
}else{
|
}else{
|
||||||
val = String.valueOf(val.toString());
|
val = String.valueOf(val.toString().trim());
|
||||||
}
|
}
|
||||||
}else if (valType == Integer.class){
|
}else if (valType == Integer.class){
|
||||||
val = Double.valueOf(val.toString()).intValue();
|
val = Double.valueOf(val.toString().trim()).intValue();
|
||||||
}else if (valType == Long.class){
|
}else if (valType == Long.class){
|
||||||
val = Double.valueOf(val.toString()).longValue();
|
val = Double.valueOf(val.toString().trim()).longValue();
|
||||||
}else if (valType == Double.class){
|
}else if (valType == Double.class){
|
||||||
val = Double.valueOf(val.toString());
|
val = Double.valueOf(val.toString().trim());
|
||||||
}else if (valType == Float.class){
|
}else if (valType == Float.class){
|
||||||
val = Float.valueOf(val.toString());
|
val = Float.valueOf(val.toString().trim());
|
||||||
}else if (valType == Date.class){
|
}else if (valType == Date.class){
|
||||||
val = DateUtil.getJavaDate((Double)val);
|
val = DateUtil.getJavaDate((Double)val);
|
||||||
}else{
|
}else{
|
||||||
if (ef.fieldType() != Class.class){
|
if (ef.fieldType() != Class.class){
|
||||||
val = ef.fieldType().getMethod("getValue", String.class).invoke(null, val.toString());
|
val = ef.fieldType().getMethod("getValue", String.class).invoke(null, val.toString().trim());
|
||||||
}else{
|
}else{
|
||||||
val = Class.forName(this.getClass().getName().replaceAll(this.getClass().getSimpleName(),
|
val = Class.forName(this.getClass().getName().replaceAll(this.getClass().getSimpleName(),
|
||||||
"fieldtype."+valType.getSimpleName()+"Type")).getMethod("getValue", String.class).invoke(null, val.toString());
|
"fieldtype."+valType.getSimpleName()+"Type")).getMethod("getValue", String.class).invoke(null, val.toString().trim());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
|||||||
@@ -609,6 +609,17 @@ public class CheckIpFormatThread implements Callable<String>{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO 判断Protocol的值
|
// TODO 判断Protocol的值
|
||||||
|
if(baseIpCfg.getProtocol()==null) {
|
||||||
|
if(protocol.indexOf("0")>-1) {
|
||||||
|
baseIpCfg.setProtocol(0);
|
||||||
|
}else if(protocol.indexOf("6")>-1) {
|
||||||
|
baseIpCfg.setProtocol(6);
|
||||||
|
}else if(protocol.indexOf("17")>-1) {
|
||||||
|
baseIpCfg.setProtocol(17);
|
||||||
|
}else if(StringUtils.isNotBlank(protocol)) {
|
||||||
|
baseIpCfg.setProtocol(Integer.parseInt(protocol.split(",")[0]));
|
||||||
|
}
|
||||||
|
}
|
||||||
boolean validProtocol = this.validProtocol(errInfo, baseIpCfg.getProtocol(), protocol);
|
boolean validProtocol = this.validProtocol(errInfo, baseIpCfg.getProtocol(), protocol);
|
||||||
// 验证protocol与port是否符合逻辑
|
// 验证protocol与port是否符合逻辑
|
||||||
if (validProtocol && validPort) {
|
if (validProtocol && validPort) {
|
||||||
@@ -624,7 +635,13 @@ public class CheckIpFormatThread implements Callable<String>{
|
|||||||
} else {
|
} else {
|
||||||
baseIpCfg.setDirection(baseIpCfg.getDirection());
|
baseIpCfg.setDirection(baseIpCfg.getDirection());
|
||||||
}
|
}
|
||||||
|
if(baseIpCfg.getDirection()==null) {
|
||||||
|
if(direction.indexOf("0")>-1) {
|
||||||
|
baseIpCfg.setDirection(0);
|
||||||
|
}else if(StringUtils.isNotBlank(direction)) {
|
||||||
|
baseIpCfg.setDirection(Integer.parseInt(direction.split(",")[0]));
|
||||||
|
}
|
||||||
|
}
|
||||||
// TODO 判断Direction的值
|
// TODO 判断Direction的值
|
||||||
this.validDirection(errInfo, baseIpCfg.getDirection(), direction);
|
this.validDirection(errInfo, baseIpCfg.getDirection(), direction);
|
||||||
}
|
}
|
||||||
@@ -706,10 +723,10 @@ public class CheckIpFormatThread implements Callable<String>{
|
|||||||
*/
|
*/
|
||||||
public boolean validProtocol(StringBuffer errInfo, Integer protocol, String protocolPattern)
|
public boolean validProtocol(StringBuffer errInfo, Integer protocol, String protocolPattern)
|
||||||
throws ServiceException {
|
throws ServiceException {
|
||||||
if (protocol == null) {
|
/*if (protocol == null) {
|
||||||
errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("protocol")) + ";");
|
errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("protocol")) + ";");
|
||||||
return false;
|
return false;
|
||||||
}
|
}*/
|
||||||
boolean has = false;
|
boolean has = false;
|
||||||
for (String p : protocolPattern.split(",")) {
|
for (String p : protocolPattern.split(",")) {
|
||||||
if (p.equals(protocol.toString())) {
|
if (p.equals(protocol.toString())) {
|
||||||
|
|||||||
Reference in New Issue
Block a user