From 307f448f820f4fae2c934f6c3433be74530f6071 Mon Sep 17 00:00:00 2001 From: chenfeng <214759371@qq.com> Date: Thu, 3 Jul 2025 11:05:01 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/ProductQualifiedService.java | 103 ++++++++++++++++++ .../server/service/SupervisionService.java | 15 +-- 2 files changed, 111 insertions(+), 7 deletions(-) diff --git a/yudao-server/src/main/java/cn/iocoder/yudao/server/service/ProductQualifiedService.java b/yudao-server/src/main/java/cn/iocoder/yudao/server/service/ProductQualifiedService.java index b97b9272fe..fb1c253339 100644 --- a/yudao-server/src/main/java/cn/iocoder/yudao/server/service/ProductQualifiedService.java +++ b/yudao-server/src/main/java/cn/iocoder/yudao/server/service/ProductQualifiedService.java @@ -124,6 +124,109 @@ public class ProductQualifiedService { } return equipmentRegistryRespVO; } + + public EquipmentRegistryRespVO getCertificateOfApprovalTwo(List texts, String postfix) { + boolean productQualified = texts.stream().anyMatch(t -> t.equals("工作压力")); + Map 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; + } + /** * 判断字符串是否符合: * - 纯数字(含小数) diff --git a/yudao-server/src/main/java/cn/iocoder/yudao/server/service/SupervisionService.java b/yudao-server/src/main/java/cn/iocoder/yudao/server/service/SupervisionService.java index ad4492d92f..31af1ade2e 100644 --- a/yudao-server/src/main/java/cn/iocoder/yudao/server/service/SupervisionService.java +++ b/yudao-server/src/main/java/cn/iocoder/yudao/server/service/SupervisionService.java @@ -169,16 +169,17 @@ public class SupervisionService { equipmentRegistryRespVO.setType("productQualified"); equipmentRegistryRespVOS.add(equipmentRegistryRespVO); }else { - boolean NoProduct = rec_texts.stream().anyMatch(t -> t.contains("登记表") || t.contains("特种设备使用登记表")); - //在循环检查一次 - if (NoProduct){ - equipmentRegistryRespVO = productQualifiedService.getCertificateOfApproval(rec_texts, postfix); - } - equipmentRegistryRespVO.setType("productQualified"); - equipmentRegistryRespVOS.add(equipmentRegistryRespVO); +// boolean NoProduct = rec_texts.stream().anyMatch(t -> t.contains("登记表") || t.contains("特种设备使用登记表")); +// //在循环检查一次 +// if (NoProduct){ +// equipmentRegistryRespVO = productQualifiedService.getCertificateOfApprovalTwo(rec_texts, postfix); +// } +// equipmentRegistryRespVO.setType("productQualified"); +// equipmentRegistryRespVOS.add(equipmentRegistryRespVO); } } param.put("extractedData", equipmentRegistryRespVOS); + LOGGER.warn("参数返回结果:{}",param); return param; }