|
|
|
@ -47,35 +47,48 @@ public class ProductQualifiedService { |
|
|
|
|
if (!postfix.equals("pdf")) { |
|
|
|
|
nominalWorkingPressureOffset = 2; |
|
|
|
|
} |
|
|
|
|
String nominalWorkingPressure = extractManufacturer(texts, fieldMap.get("nominalWorkingPressure"), nominalWorkingPressureOffset); |
|
|
|
|
if (ObjectUtil.isNotEmpty(nominalWorkingPressure)) { |
|
|
|
|
if (nominalWorkingPressure.equals("MPa")) { |
|
|
|
|
nominalWorkingPressure = extractManufacturer(texts, fieldMap.get("nominalWorkingPressure"), 2); |
|
|
|
|
String nominalWorkingPressure = extractManufacturer(texts, fieldMap.get("nominalWorkingPressure"), 0); |
|
|
|
|
if (nominalWorkingPressure != null) { |
|
|
|
|
nominalWorkingPressure = matchWaterVolume(fieldMap.get("nominalWorkingPressure"), nominalWorkingPressure, "MPa"); |
|
|
|
|
if (nominalWorkingPressure != null) { |
|
|
|
|
equipmentRegistryRespVO.setNominalWorkingPressure(nominalWorkingPressure); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
nominalWorkingPressure = extractManufacturer(texts, fieldMap.get("nominalWorkingPressure"), nominalWorkingPressureOffset); |
|
|
|
|
if (ObjectUtil.isNotEmpty(nominalWorkingPressure)) { |
|
|
|
|
if (nominalWorkingPressure.equals("MPa")) { |
|
|
|
|
nominalWorkingPressure = extractManufacturer(texts, fieldMap.get("nominalWorkingPressure"), 2); |
|
|
|
|
} |
|
|
|
|
//气瓶公称工作压力
|
|
|
|
|
equipmentRegistryRespVO.setNominalWorkingPressure(nominalWorkingPressure); |
|
|
|
|
} |
|
|
|
|
//气瓶公称工作压力
|
|
|
|
|
equipmentRegistryRespVO.setNominalWorkingPressure(nominalWorkingPressure); |
|
|
|
|
} |
|
|
|
|
int cylinderVolumeOffset = 1; |
|
|
|
|
if (!postfix.equals("pdf")) { |
|
|
|
|
cylinderVolumeOffset = 1; |
|
|
|
|
} |
|
|
|
|
String cylinderVolume = extractManufacturer(texts, fieldMap.get("cylinderVolume"), cylinderVolumeOffset); |
|
|
|
|
if (isNumeric(cylinderVolume) || isNumericL(cylinderVolume)) { |
|
|
|
|
equipmentRegistryRespVO.setCylinderVolume(cylinderVolume); |
|
|
|
|
return equipmentRegistryRespVO; |
|
|
|
|
String cylinderVolume = extractManufacturer(texts, fieldMap.get("cylinderVolume"), 0); |
|
|
|
|
if (cylinderVolume != null) { |
|
|
|
|
cylinderVolume = matchWaterVolume(fieldMap.get("cylinderVolume"), cylinderVolume, "L"); |
|
|
|
|
if (cylinderVolume != null) { |
|
|
|
|
return equipmentRegistryRespVO.setCylinderVolume(cylinderVolume); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
if (cylinderVolume != null && cylinderVolume.equals("L")) { |
|
|
|
|
//处理识别到上一行的情况
|
|
|
|
|
cylinderVolume = extractManufacturer(texts, fieldMap.get("cylinderVolume"), -1); |
|
|
|
|
if (isNumeric(cylinderVolume)) { |
|
|
|
|
equipmentRegistryRespVO.setCylinderVolume(cylinderVolume); |
|
|
|
|
return equipmentRegistryRespVO; |
|
|
|
|
} |
|
|
|
|
cylinderVolume = extractManufacturer(texts, fieldMap.get("cylinderVolume"), cylinderVolumeOffset); |
|
|
|
|
if (isNumeric(cylinderVolume) || isNumericL(cylinderVolume)) { |
|
|
|
|
return equipmentRegistryRespVO.setCylinderVolume(cylinderVolume); |
|
|
|
|
} else { |
|
|
|
|
cylinderVolume = extractManufacturer(texts, "实测水容机: ", 1); |
|
|
|
|
if (isNumeric(cylinderVolume) || isNumericL(cylinderVolume)) { |
|
|
|
|
equipmentRegistryRespVO.setCylinderVolume(cylinderVolume); |
|
|
|
|
return equipmentRegistryRespVO; |
|
|
|
|
if (cylinderVolume != null && cylinderVolume.equals("L")) { |
|
|
|
|
//处理识别到上一行的情况
|
|
|
|
|
cylinderVolume = extractManufacturer(texts, fieldMap.get("cylinderVolume"), -1); |
|
|
|
|
if (isNumeric(cylinderVolume)) { |
|
|
|
|
return equipmentRegistryRespVO.setCylinderVolume(cylinderVolume); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
cylinderVolume = extractManufacturer(texts, "实测水容机: ", 1); |
|
|
|
|
if (isNumeric(cylinderVolume) || isNumericL(cylinderVolume)) { |
|
|
|
|
return equipmentRegistryRespVO.setCylinderVolume(cylinderVolume); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -86,6 +99,35 @@ public class ProductQualifiedService { |
|
|
|
|
} |
|
|
|
|
return equipmentRegistryRespVO; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 匹配获取的内容和关键字在一行的情况 |
|
|
|
|
* @param keyword |
|
|
|
|
* @param input |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
public static String matchWaterVolume(String keyword, String input,String unitStr) { |
|
|
|
|
// 构建正则表达式,冒号可选(全角或半角),数字部分必须存在,L可选
|
|
|
|
|
String regex = keyword + "[::]?\\s*(\\d+(?:\\.\\d+)?)\\s*("+unitStr+")?"; |
|
|
|
|
Pattern pattern = Pattern.compile(regex); |
|
|
|
|
Matcher matcher = pattern.matcher(input); |
|
|
|
|
|
|
|
|
|
if (matcher.find()) { |
|
|
|
|
String numberStr = matcher.group(1); |
|
|
|
|
String unit = matcher.group(2); // 可选的 "L"
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
double number = Double.parseDouble(numberStr); |
|
|
|
|
if (number > 0 && number < 3000) { |
|
|
|
|
return numberStr + (unit != null ? unit : ""); // 返回数字 + L(如果有)
|
|
|
|
|
} |
|
|
|
|
} catch (NumberFormatException e) { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static boolean isNumeric(String str) { |
|
|
|
|
if (str == null || str.isEmpty()) { |
|
|
|
|
return false; |
|
|
|
|