|
|
|
|
@ -36,7 +36,7 @@ public class ProductQualifiedService { |
|
|
|
|
equipmentRegistryRespVO.setCylinderQuantity(1); |
|
|
|
|
|
|
|
|
|
//充装介质
|
|
|
|
|
boolean hasFillingMedium = texts.stream().anyMatch(t -> t.equals("液化天然气") || t.contains("LNG")); |
|
|
|
|
boolean hasFillingMedium = texts.stream().anyMatch(t -> t.contains("液化天然气") || t.contains("LNG")); |
|
|
|
|
if (hasFillingMedium) { |
|
|
|
|
equipmentRegistryRespVO.setFillingMedium("LNG"); |
|
|
|
|
} else { |
|
|
|
|
@ -60,11 +60,11 @@ public class ProductQualifiedService { |
|
|
|
|
cylinderVolumeOffset = 1; |
|
|
|
|
} |
|
|
|
|
String cylinderVolume = extractManufacturer(texts, fieldMap.get("cylinderVolume"), cylinderVolumeOffset); |
|
|
|
|
if (isNumeric(cylinderVolume)) { |
|
|
|
|
if (isNumeric(cylinderVolume) || isNumericL(cylinderVolume)) { |
|
|
|
|
equipmentRegistryRespVO.setCylinderVolume(cylinderVolume); |
|
|
|
|
return equipmentRegistryRespVO; |
|
|
|
|
} else { |
|
|
|
|
if (cylinderVolume.equals("L")) { |
|
|
|
|
if (cylinderVolume != null && cylinderVolume.equals("L")) { |
|
|
|
|
//处理识别到上一行的情况
|
|
|
|
|
cylinderVolume = extractManufacturer(texts, fieldMap.get("cylinderVolume"), -1); |
|
|
|
|
if (isNumeric(cylinderVolume)) { |
|
|
|
|
@ -73,7 +73,7 @@ public class ProductQualifiedService { |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
cylinderVolume = extractManufacturer(texts, "实测水容机: ", 1); |
|
|
|
|
if (isNumeric(cylinderVolume)) { |
|
|
|
|
if (isNumeric(cylinderVolume) || isNumericL(cylinderVolume)) { |
|
|
|
|
equipmentRegistryRespVO.setCylinderVolume(cylinderVolume); |
|
|
|
|
return equipmentRegistryRespVO; |
|
|
|
|
} |
|
|
|
|
@ -81,15 +81,29 @@ public class ProductQualifiedService { |
|
|
|
|
} |
|
|
|
|
//兜底方案,检测是否有符合特征的值
|
|
|
|
|
cylinderVolume = matchTexts(texts); |
|
|
|
|
if (isNumeric(cylinderVolume)) { |
|
|
|
|
if (cylinderVolume != null) { |
|
|
|
|
equipmentRegistryRespVO.setCylinderVolume(cylinderVolume); |
|
|
|
|
} |
|
|
|
|
return equipmentRegistryRespVO; |
|
|
|
|
} |
|
|
|
|
public static boolean isNumeric(String str) { |
|
|
|
|
return str.matches("-?\\d+(\\.\\d+)?"); |
|
|
|
|
if (str == null || str.isEmpty()) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
// 精确匹配0-3000的整数或小数
|
|
|
|
|
return str.matches("(3000(\\.0+)?)|([0-2]?\\d{1,3}(\\.\\d+)?)") && |
|
|
|
|
Double.parseDouble(str) <= 3000; |
|
|
|
|
} |
|
|
|
|
public static boolean isNumericL(String str) { |
|
|
|
|
if (str == null || str.isEmpty()) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
return str.matches("^(\\d+(\\.\\d+)?)(L)$"); |
|
|
|
|
} |
|
|
|
|
public static String matchTexts(List<String> texts) { |
|
|
|
|
if (texts == null || texts.isEmpty()) { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
// 定义正则表达式,用于匹配如 90.4L 这样的字符串
|
|
|
|
|
Pattern pattern = Pattern.compile("^(\\d+(\\.\\d+)?)(L)$"); |
|
|
|
|
for (String text : texts) { |
|
|
|
|
|