(1)导入模板生成取消将function_region_dict中字段只只有一个的时候,方向,协议,大小写敏感等字段隐藏

(2)ip导入方向协议导入时填入默认值
This commit is contained in:
wangxin
2018-12-18 14:58:48 +06:00
parent 317cb9ab28
commit ad5107928d
3 changed files with 52 additions and 35 deletions

View File

@@ -244,7 +244,7 @@ public class ImportBigExcel extends XLSXCovertCSVReader{
continue;
}
}
if(!directionShow) {
/*if(!directionShow) {
if(f.getName().equalsIgnoreCase("direction")) {
continue;
}
@@ -273,7 +273,7 @@ public class ImportBigExcel extends XLSXCovertCSVReader{
if(f.getName().equalsIgnoreCase("district")) {
continue;
}
}
}*/
ExcelField ef = f.getAnnotation(ExcelField.class);
if (ef != null && (ef.type()==0 || ef.type()==2)){
if (groups!=null && groups.length>0){
@@ -323,7 +323,7 @@ public class ImportBigExcel extends XLSXCovertCSVReader{
continue;
}
}
if(!directionShow) {
/*if(!directionShow) {
if(m.getName().equalsIgnoreCase("get"+"direction")||m.getName().equalsIgnoreCase("set"+"direction")) {
continue;
}
@@ -352,7 +352,7 @@ public class ImportBigExcel extends XLSXCovertCSVReader{
if(m.getName().equalsIgnoreCase("get"+"district")||m.getName().equalsIgnoreCase("set"+"district")) {
continue;
}
}
}*/
ExcelField ef = m.getAnnotation(ExcelField.class);
if (ef != null && (ef.type()==0 || ef.type()==2)){
if (groups!=null && groups.length>0){
@@ -451,29 +451,29 @@ public class ImportBigExcel extends XLSXCovertCSVReader{
//log.debug("Import value type: ["+i+","+column+"] " + valType);
try {
if (valType == String.class){
String s = String.valueOf(val.toString());
String s = String.valueOf(val.toString().trim());
//0.0.0.0表示任意IP的含义
if(StringUtils.endsWith(s, ".0") && !s.endsWith("0.0.0.0")){
val = StringUtils.substringBefore(s, ".0");
}else{
val = String.valueOf(val.toString());
val = String.valueOf(val.toString().trim());
}
}else if (valType == Integer.class){
val = Double.valueOf(val.toString()).intValue();
val = Double.valueOf(val.toString().trim()).intValue();
}else if (valType == Long.class){
val = Double.valueOf(val.toString()).longValue();
val = Double.valueOf(val.toString().trim()).longValue();
}else if (valType == Double.class){
val = Double.valueOf(val.toString());
val = Double.valueOf(val.toString().trim());
}else if (valType == Float.class){
val = Float.valueOf(val.toString());
val = Float.valueOf(val.toString().trim());
}else if (valType == Date.class){
val = DateUtil.getJavaDate((Double)val);
}else{
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{
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) {