master
chenfeng 4 months ago
parent f488db793e
commit 307f448f82
  1. 103
      yudao-server/src/main/java/cn/iocoder/yudao/server/service/ProductQualifiedService.java
  2. 15
      yudao-server/src/main/java/cn/iocoder/yudao/server/service/SupervisionService.java

@ -124,6 +124,109 @@ public class ProductQualifiedService {
} }
return equipmentRegistryRespVO; return equipmentRegistryRespVO;
} }
public EquipmentRegistryRespVO getCertificateOfApprovalTwo(List<String> texts, String postfix) {
boolean productQualified = texts.stream().anyMatch(t -> t.equals("工作压力"));
Map<String, String> fieldMap = new HashMap<>();
if (productQualified) {
fieldMap = fieldMappingService.getCertificateMapping("工作压力", texts);
} else {
fieldMap = fieldMappingService.getCertificateMapping("公称工作压力:", texts);
}
EquipmentRegistryRespVO equipmentRegistryRespVO = new EquipmentRegistryRespVO();
equipmentRegistryRespVO.setEquipmentType("特种气瓶");
equipmentRegistryRespVO.setProductName("车用气瓶");
equipmentRegistryRespVO.setCylinderQuantity("1");
int productIdOffset = 1;
if (!postfix.equals("pdf")) {
productIdOffset = 1;
}
// String productId = extractManufacturer(texts, fieldMap.get("productId"), productIdOffset);
// if (ObjectUtil.isNotEmpty(productId)&&isLengthGreaterThan3(productId)) {
// productId = matchAllowedChars(productId);
// if (productId != null) {
// productId = productId.replaceAll("\\s", "");
// if (StrUtil.contains(productId, "瓶号")) {
// // 移除"瓶号"并返回
// productId = StrUtil.removePrefix(productId, "瓶号");
// }
// equipmentRegistryRespVO.setProductId(productId);
// }
// }
//充装介质
boolean hasFillingMedium = texts.stream().anyMatch(t -> t.contains("液化天然气") || t.contains("LNG"));
if (hasFillingMedium) {
equipmentRegistryRespVO.setFillingMedium("LNG");
} else {
equipmentRegistryRespVO.setFillingMedium("CNG");
}
int nominalWorkingPressureOffset = 1;
if (!postfix.equals("pdf")) {
nominalWorkingPressureOffset = 2;
}
String nominalWorkingPressure = extractManufacturer(texts, fieldMap.get("nominalWorkingPressure"), 0);
if (nominalWorkingPressure != null) {
nominalWorkingPressure = matchWaterVolume(fieldMap.get("nominalWorkingPressure"), nominalWorkingPressure, "MPa");
if (nominalWorkingPressure != null && isAlphaNumeric(nominalWorkingPressure)) {
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);
}
if (isAlphaNumeric(nominalWorkingPressure)) {
//气瓶公称工作压力
equipmentRegistryRespVO.setNominalWorkingPressure(nominalWorkingPressure);
}
}
}
}
// int cylinderVolumeOffset = 1;
// if (!postfix.equals("pdf")) {
// cylinderVolumeOffset = 1;
// }
// 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 {
// cylinderVolume = extractManufacturer(texts, fieldMap.get("cylinderVolume"), cylinderVolumeOffset);
// if (isNumeric(cylinderVolume) || isNumericL(cylinderVolume)) {
// return equipmentRegistryRespVO.setCylinderVolume(cylinderVolume);
// } else {
// 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);
// }
// }
// }
// }
// }
//兜底方案,检测是否有符合特征的值
// cylinderVolume = matchTexts(texts);
// if (cylinderVolume != null) {
// equipmentRegistryRespVO.setCylinderVolume(cylinderVolume);
// } else {
// cylinderVolume = extractManufacturer(texts, fieldMap.get("cylinderVolume"), -1);
// if (isNumeric(cylinderVolume)) {
// return equipmentRegistryRespVO.setCylinderVolume(cylinderVolume);
// }
// }
return equipmentRegistryRespVO;
}
/** /**
* 判断字符串是否符合 * 判断字符串是否符合
* - 纯数字含小数 * - 纯数字含小数

@ -169,16 +169,17 @@ public class SupervisionService {
equipmentRegistryRespVO.setType("productQualified"); equipmentRegistryRespVO.setType("productQualified");
equipmentRegistryRespVOS.add(equipmentRegistryRespVO); equipmentRegistryRespVOS.add(equipmentRegistryRespVO);
}else { }else {
boolean NoProduct = rec_texts.stream().anyMatch(t -> t.contains("登记表") || t.contains("特种设备使用登记表")); // boolean NoProduct = rec_texts.stream().anyMatch(t -> t.contains("登记表") || t.contains("特种设备使用登记表"));
//在循环检查一次 // //在循环检查一次
if (NoProduct){ // if (NoProduct){
equipmentRegistryRespVO = productQualifiedService.getCertificateOfApproval(rec_texts, postfix); // equipmentRegistryRespVO = productQualifiedService.getCertificateOfApprovalTwo(rec_texts, postfix);
} // }
equipmentRegistryRespVO.setType("productQualified"); // equipmentRegistryRespVO.setType("productQualified");
equipmentRegistryRespVOS.add(equipmentRegistryRespVO); // equipmentRegistryRespVOS.add(equipmentRegistryRespVO);
} }
} }
param.put("extractedData", equipmentRegistryRespVOS); param.put("extractedData", equipmentRegistryRespVOS);
LOGGER.warn("参数返回结果:{}",param);
return param; return param;
} }

Loading…
Cancel
Save