适配北京汽车制造厂有限公司安装合格证

master
tyc 6 months ago
parent 03bdcd860d
commit 81e3672c62
  1. 108
      yudao-server/src/main/java/cn/iocoder/yudao/server/service/CertificateOfApprovalService.java
  2. 8
      yudao-server/src/main/java/cn/iocoder/yudao/server/service/FieldMappingService.java
  3. 5
      yudao-server/src/main/java/cn/iocoder/yudao/server/service/ProductQualifiedService.java
  4. 1
      yudao-server/src/main/java/cn/iocoder/yudao/server/service/SpecialGasCylinderService.java
  5. 12
      yudao-server/src/main/java/cn/iocoder/yudao/server/service/SupervisionService.java

@ -1,4 +1,5 @@
package cn.iocoder.yudao.server.service;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.module.special.controller.admin.equipmentregistry.vo.EquipmentRegistryRespVO;
@ -29,52 +30,88 @@ public class CertificateOfApprovalService {
EquipmentRegistryRespVO equipmentRegistryRespVO = new EquipmentRegistryRespVO();
equipmentRegistryRespVO.setEquipmentType("特种气瓶");
equipmentRegistryRespVO.setProductName("车用气瓶");
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);
}
int productIdOffset = 1;
if (!postfix.equals("pdf")) {
productIdOffset = 1;
}
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);
if (vehicleVin != null) {
equipmentRegistryRespVO.setVehicleVin(vehicleVin);
}
boolean oneNum = texts.stream().anyMatch(s -> s.contains("气瓶1编号"));
String productId = "";
if (oneNum) {
String one = extractManufacturer(texts, "气瓶1编号", 1);
String oneL = extractManufacturerContains(texts, "气瓶1:", 0);
String oneL = extractManufacturerContains(texts, "气瓶1:", 1);
String productId = "";
if (one != null) {
String two = extractManufacturer(texts, "气瓶2编号", 1);
if (two == null) {
if (oneL.endsWith("L")) {
// 移除末尾的"L"
oneL = oneL.substring(0, oneL.length() - 1);
}
// 转换为double并累加
equipmentRegistryRespVO.setCylinderVolume(oneL);
productId = one;
equipmentRegistryRespVO.setCylinderQuantity(1);
} else {
productId = one+"/"+two;
equipmentRegistryRespVO.setCylinderQuantity(2);
}
productId = matchAllowedChars(productId);
if (productId != null) {
equipmentRegistryRespVO.setProductId(productId);
String three = extractManufacturer(texts, "气瓶3编号", 1);
if (three == null) {
String twoL = extractManufacturerContains(texts, "气瓶2:", 1);
if (twoL.endsWith("L")) {
// 移除末尾的"L"
twoL = twoL.substring(0, twoL.length() - 1);
}
double oneNo = Double.parseDouble(oneL);
if (oneL.endsWith("L")) {
// 移除末尾的"L"
oneL = oneL.substring(0, oneL.length() - 1);
}
double twoNo = Double.parseDouble(twoL);
double total = oneNo + twoNo;
equipmentRegistryRespVO.setCylinderVolume(NumberUtil.toStr(total));
productId = one + "/" + two;
equipmentRegistryRespVO.setCylinderQuantity(2);
} else {
String twoL = extractManufacturerContains(texts, "气瓶2:", 1);
String threeL = extractManufacturerContains(texts, "气瓶3:", 1);
if (twoL.endsWith("L")) {
// 移除末尾的"L"
twoL = twoL.substring(0, twoL.length() - 1);
}
if (oneL.endsWith("L")) {
// 移除末尾的"L"
oneL = oneL.substring(0, oneL.length() - 1);
}
if (threeL.endsWith("L")) {
// 移除末尾的"L"
threeL = threeL.substring(0, threeL.length() - 1);
}
double oneNo = Double.parseDouble(oneL);
double twoNo = Double.parseDouble(twoL);
double threeNo = Double.parseDouble(threeL);
double total = oneNo + twoNo + threeNo;
equipmentRegistryRespVO.setCylinderVolume(NumberUtil.toStr(total));
productId = one + "/" + two + "/" + three;
equipmentRegistryRespVO.setCylinderQuantity(3);
}
}
}
return equipmentRegistryRespVO;
}
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);
productId = extractManufacturer(texts, fieldMap.get("productId"), productIdOffset);
}
int productIdOffset = 1;
if (!postfix.equals("pdf")) {
productIdOffset = 1;
}
String productId = extractManufacturer(texts, fieldMap.get("productId"), productIdOffset);
if (ObjectUtil.isNotEmpty(productId)) {
productId = matchAllowedChars(productId);
if (productId != null) {
@ -95,7 +132,16 @@ public class CertificateOfApprovalService {
}
equipmentRegistryRespVO.setVehicleVin(vehicleVin);
}
String contractor = extractManufacturer(texts, fieldMap.get("contractor"), 0);
String contractor = null;
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) {
//北京福田汽车股份有限公司特殊处理
contractor = "北京福田汽车股份有限公司";
} else {
contractor = extractManufacturer(texts, fieldMap.get("contractor"), 0);
}
if (contractor == null) {
return null;
} else {

@ -38,7 +38,7 @@ public class FieldMappingService {
);
//气瓶公称工作压力
private static final List<String> PRODUCTION_DATE_CANDIDATES_ZS = Arrays.asList(
"工作压力", "公称压力", "公称工作压力", "公称工作压力"
"公称工作压力", "公称工作压力","公称压力","工作压力"
);
//气瓶容积
private static final List<String> SUPERVISION_AGENCY_CANDIDATES_ZS = Arrays.asList(
@ -46,14 +46,14 @@ public class FieldMappingService {
);
//产品编号
private static final List<String> SUPERVISION_AGENCY_CANDIDATES_BH_ZS = Arrays.asList(
"产品编号:","产品编号", "产品编码", "气瓶编号"
"产品编号:","产品编号", "产品编码", "气瓶编号", "钢瓶编号"
);
//安装单位
private static final List<String> SUPERVISION_AGENCY_CANDIDATES_BH_AZDW = Arrays.asList(
"安装单位", "安装单位名称"
"安装单位", "安装单位名称","安装企业名称"
);
private static final List<String> VEHICLE_VIN = Arrays.asList(
"车辆识别代号","车架号码:"
"车辆识别代号","车辆识别号","车架号码:","车身号","车架号","车牌(架)号"
);
/**

@ -107,6 +107,11 @@ public class ProductQualifiedService {
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;
}

@ -29,6 +29,7 @@ public class SpecialGasCylinderService {
* @return
*/
public EquipmentRegistryRespVO getSpecialGasCylinder(List<String> texts, String postfix) {
int supervisionAgencyOffset = 1;
if (!postfix.equals("pdf")) {
supervisionAgencyOffset = 0;

@ -104,13 +104,21 @@ public class SupervisionService {
//表格返回参数table_res_list
if (CollectionUtil.isNotEmpty(result.getPrunedResult().getTable_res_list()) && result.getPrunedResult().getTable_res_list().size() == 1) {
texts = result.getPrunedResult().getTable_res_list().get(0).getTable_ocr_pred().getRec_texts();
List<String> rec_texts = result.getPrunedResult().getOverall_ocr_res().getRec_texts();
//判断table的list无效
if (texts.size() < rec_texts.size() - 36) {
texts = rec_texts;
}
} else {
texts = result.getPrunedResult().getOverall_ocr_res().getRec_texts();
}
EquipmentRegistryRespVO equipmentRegistryRespVO = null;
//监督检验
boolean supervisionAndInspection = texts.stream().anyMatch(t -> t.contains("设计单位名称") || t.contains("产品数量"));
if (supervisionAndInspection) {
//车用气瓶安装合格证
boolean CertificateOfApproval = texts.stream().anyMatch(t -> t.contains("安装合格证") || t.contains("安装单位") || t.contains("安装单位名称") || t.contains("减压器编号") || t.contains("安装检验合格证") || t.contains("安装企业名称"));
//需要排除多生成监督检验证书的情况
if (supervisionAndInspection && !CertificateOfApproval) {
equipmentRegistryRespVO = specialGasCylinderService.getSpecialGasCylinder(texts, postfix);
if (null == equipmentRegistryRespVO) {
continue;
@ -118,8 +126,6 @@ public class SupervisionService {
equipmentRegistryRespVO.setType("supervisionAndInspection");
equipmentRegistryRespVOS.add(equipmentRegistryRespVO);
}
//车用气瓶安装合格证
boolean CertificateOfApproval = texts.stream().anyMatch(t -> t.contains("安装合格证") || t.contains("安装单位") || t.contains("安装单位名称") || t.contains("减压器编号") || t.contains("安装检验合格证"));
if (CertificateOfApproval) {
equipmentRegistryRespVO = certificateOfApprovalService.getCertificateOfApproval(texts, postfix);
if (null == equipmentRegistryRespVO) {

Loading…
Cancel
Save