适配北京福田汽车有限公司的安装合格证、三江航天的产品合格证

master
tyc 6 months ago
parent c1dc11d541
commit 986ac6df31
  1. 26
      yudao-server/src/main/java/cn/iocoder/yudao/server/service/CertificateOfApprovalService.java
  2. 26
      yudao-server/src/main/java/cn/iocoder/yudao/server/service/ProductQualifiedService.java

@ -29,10 +29,12 @@ public class CertificateOfApprovalService {
EquipmentRegistryRespVO equipmentRegistryRespVO = new EquipmentRegistryRespVO();
equipmentRegistryRespVO.setEquipmentType("特种气瓶");
equipmentRegistryRespVO.setProductName("车用气瓶");
equipmentRegistryRespVO.setCylinderQuantity(1);
boolean beijingfute = texts.stream().anyMatch(t -> t.equals("减压器编号") && t.equals("生产厂家") && t.equals("容积、数量"));
if (beijingfute) {
boolean containsNumber = texts.stream().anyMatch(s -> s.contains("减压器编号"));
boolean containsManufacturer = texts.stream().anyMatch(s -> s.contains("生产厂家"));
boolean containsVolumeAndQuantity = texts.stream().anyMatch(s -> s.contains("容积、数量"));
if (containsNumber && containsManufacturer && containsVolumeAndQuantity) {
//北京福田汽车股份有限公司特殊处理
equipmentRegistryRespVO.setContractor("北京福田汽车股份有限公司");
String vehicleVin = extractManufacturer(texts, "车架号", 1);
@ -48,27 +50,13 @@ public class CertificateOfApprovalService {
String two = extractManufacturer(texts, "气瓶2编号", 1);
if (two == null) {
productId = one;
equipmentRegistryRespVO.setCylinderQuantity(1);
} else {
productId = one+"/"+two;
equipmentRegistryRespVO.setCylinderQuantity(2);
}
equipmentRegistryRespVO.setProductId(productId);
}
if (oneL != null) {
//气瓶1:65.4L
String numStr1 = StrUtil.subBetween(oneL, ":", "L");
String twoL = extractManufacturerContains(texts, "气瓶2:", 0);
if (twoL == null) {
equipmentRegistryRespVO.setCylinderVolume(numStr1);
} else {
String numStr2 = StrUtil.subBetween(twoL, ":", "L");
double num1 = Double.parseDouble(numStr1);
double num2 = Double.parseDouble(numStr2);
double sum = num1 + num2;
String resultStr = String.valueOf(sum);
equipmentRegistryRespVO.setCylinderVolume(resultStr);
}
}
return equipmentRegistryRespVO;
}
boolean productQualified = texts.stream().anyMatch(t -> t.equals("安装单位名称"));

@ -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) {

Loading…
Cancel
Save