(1)导入模板生成取消将function_region_dict中字段只只有一个的时候,方向,协议,大小写敏感等字段隐藏
(2)ip导入方向协议导入时填入默认值
This commit is contained in:
@@ -773,9 +773,9 @@ public class ExportExcel {
|
||||
/**
|
||||
*block 只有TCP不需要导入
|
||||
* */
|
||||
headerStr="";
|
||||
commentStr="";
|
||||
/*List<SysDataDictionaryItem> protocol=DictUtils.getDictList("PROTOCOL");
|
||||
/*headerStr="";
|
||||
commentStr="";*/
|
||||
List<SysDataDictionaryItem> protocol=DictUtils.getDictList("PROTOCOL");
|
||||
if(protocol !=null && protocol.size()>0){
|
||||
for (SysDataDictionaryItem sysDataDictionaryItem : protocol) {
|
||||
if(sysDataDictionaryItem.getItemCode().equals("6")){
|
||||
@@ -783,7 +783,7 @@ public class ExportExcel {
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
if(StringUtil.isEmpty(defaultValue)){
|
||||
defaultValue="6";
|
||||
}
|
||||
@@ -819,10 +819,10 @@ public class ExportExcel {
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(StringUtil.isEmpty(region.getConfigProtocol())){
|
||||
/*if(StringUtil.isEmpty(region.getConfigProtocol())){
|
||||
headerStr="";
|
||||
commentStr="";
|
||||
}else{
|
||||
}else{*/
|
||||
commentStr="";
|
||||
List<SysDataDictionaryItem> protocol=DictUtils.getDictList("PROTOCOL");
|
||||
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)){
|
||||
headerStr="";
|
||||
commentStr="";
|
||||
}else{
|
||||
}else{*/
|
||||
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
|
||||
index++;
|
||||
index++;
|
||||
@@ -873,16 +873,16 @@ public class ExportExcel {
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("default_value")+":"+defaultValue+"\n";
|
||||
index++;
|
||||
}
|
||||
}
|
||||
/*}*/
|
||||
}
|
||||
|
||||
//Direction
|
||||
if("direction".equals(headerStr)){
|
||||
if(StringUtil.isEmpty(region.getConfigDirection())
|
||||
/*if(StringUtil.isEmpty(region.getConfigDirection())
|
||||
||(region.getConfigDirection().split(",").length==1)){
|
||||
headerStr="";
|
||||
commentStr="";
|
||||
}else{
|
||||
}else{*/
|
||||
commentStr="";
|
||||
List<SysDataDictionaryItem> direction=DictUtils.getDictList("DIRECTION");
|
||||
if(direction !=null && direction.size()>0){
|
||||
@@ -904,11 +904,11 @@ public class ExportExcel {
|
||||
defaultValue="0";
|
||||
}
|
||||
}
|
||||
}
|
||||
if(StringUtil.isEmpty(commentStr)){
|
||||
/*}*/
|
||||
/*if(StringUtil.isEmpty(commentStr)){
|
||||
headerStr="";
|
||||
commentStr="";
|
||||
}else{
|
||||
}else{*/
|
||||
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
|
||||
index++;
|
||||
index++;
|
||||
@@ -919,7 +919,7 @@ public class ExportExcel {
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("default_value")+":"+defaultValue+"\n";
|
||||
index++;
|
||||
}
|
||||
}
|
||||
/*}*/
|
||||
}
|
||||
|
||||
//字符串或摘要字符串
|
||||
@@ -927,7 +927,7 @@ public class ExportExcel {
|
||||
if(region.getRegionType().equals(3)){
|
||||
if("district".equals(headerStr)){
|
||||
if(StringUtil.isEmpty(region.getConfigDistrict())
|
||||
||(region.getConfigDistrict().split(",").length==1)){
|
||||
/*||(region.getConfigDistrict().split(",").length==1)*/){
|
||||
headerStr="";
|
||||
commentStr="";
|
||||
}else{
|
||||
@@ -1032,7 +1032,7 @@ public class ExportExcel {
|
||||
//match method
|
||||
if("match_method".equals(headerStr)){
|
||||
if(StringUtil.isEmpty(region.getConfigMatchMethod())
|
||||
||(region.getConfigMatchMethod().split(",").length==1)){
|
||||
/*||(region.getConfigMatchMethod().split(",").length==1)*/){
|
||||
headerStr="";
|
||||
commentStr="";
|
||||
}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="";
|
||||
commentStr="";
|
||||
}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="";
|
||||
commentStr="";
|
||||
}else{
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -609,6 +609,17 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
}
|
||||
}
|
||||
// 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);
|
||||
// 验证protocol与port是否符合逻辑
|
||||
if (validProtocol && validPort) {
|
||||
@@ -624,7 +635,13 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
} else {
|
||||
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的值
|
||||
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)
|
||||
throws ServiceException {
|
||||
if (protocol == null) {
|
||||
/*if (protocol == null) {
|
||||
errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("protocol")) + ";");
|
||||
return false;
|
||||
}
|
||||
}*/
|
||||
boolean has = false;
|
||||
for (String p : protocolPattern.split(",")) {
|
||||
if (p.equals(protocol.toString())) {
|
||||
|
||||
Reference in New Issue
Block a user