修复了已知问题

master
tyc 6 months ago
parent cbf03cd9fd
commit 90fd2c19ad
  1. 41
      yudao-server/src/main/java/cn/iocoder/yudao/server/service/CertificateOfApprovalService.java
  2. 29
      yudao-server/src/main/java/cn/iocoder/yudao/server/service/ProductQualifiedService.java

@ -112,7 +112,7 @@ public class CertificateOfApprovalService {
productId = extractManufacturer(texts, fieldMap.get("productId"), productIdOffset);
}
if (ObjectUtil.isNotEmpty(productId)) {
if (ObjectUtil.isNotEmpty(productId)&&isLengthGreaterThan3(productId)) {
productId = matchAllowedChars(productId);
if (productId != null) {
productId = productId.replaceAll("\\s", "");
@ -123,7 +123,7 @@ public class CertificateOfApprovalService {
}
}
String nominalWorkingPressure = extractManufacturer(texts, fieldMap.get("nominalWorkingPressure"), 1);
if (ObjectUtil.isNotEmpty(nominalWorkingPressure)) {
if (ObjectUtil.isNotEmpty(nominalWorkingPressure)&&isAlphaNumeric(nominalWorkingPressure)) {
//公称压力
equipmentRegistryRespVO.setNominalWorkingPressure(nominalWorkingPressure);
}
@ -150,7 +150,8 @@ public class CertificateOfApprovalService {
return null;
} else {
contractor = matchInstallationUnit(fieldMap.get("contractor"), contractor);
if (contractor != null) {
if (contractor != null && isEndWithOrgSuffix(contractor)) {
equipmentRegistryRespVO.setContractor(contractor);
} else {
int contractorOffset = 1;
@ -158,7 +159,7 @@ public class CertificateOfApprovalService {
contractorOffset = 1;
}
contractor = extractManufacturer(texts, fieldMap.get("contractor"), contractorOffset);
if (ObjectUtil.isNotEmpty(contractor)) {
if (ObjectUtil.isNotEmpty(contractor) && isEndWithOrgSuffix(contractor)) {
//安装单位
equipmentRegistryRespVO.setContractor(contractor);
}
@ -166,6 +167,38 @@ public class CertificateOfApprovalService {
}
return equipmentRegistryRespVO;
}
/**
* 判断字符串是否仅由字母和数字组成
*/
public static boolean isAlphaNumeric(String input) {
if (StrUtil.isBlank(input)) {
return false;
}
return input.matches("^[a-zA-Z0-9]+$");
}
/**
* 判断字符串长度是否大于3即长度 >= 4
*
* @param input 输入字符串
* @return 是否长度大于3
*/
public static boolean isLengthGreaterThan3(String input) {
return !StrUtil.isBlank(input) && input.length() > 3;
}
/**
* 判断字符串是否以 "公司""厂""机构" "中心" 结尾
*
* @param input 输入字符串
* @return 是否匹配
*/
public static boolean isEndWithOrgSuffix(String input) {
if (StrUtil.isBlank(input)) {
return false;
}
// 使用正则表达式判断是否以指定的词结尾
return input.matches(".*(公司|厂|机构|中心)$");
}
/**
* 检查productId字符串是否仅包含大小写字母"/" "-"
* @param input 待检查的字符串

@ -40,7 +40,7 @@ public class ProductQualifiedService {
productIdOffset = 1;
}
String productId = extractManufacturer(texts, fieldMap.get("productId"), productIdOffset);
if (ObjectUtil.isNotEmpty(productId)) {
if (ObjectUtil.isNotEmpty(productId)&&isLengthGreaterThan3(productId)) {
productId = matchAllowedChars(productId);
if (productId != null) {
productId = productId.replaceAll("\\s", "");
@ -67,7 +67,7 @@ public class ProductQualifiedService {
String nominalWorkingPressure = extractManufacturer(texts, fieldMap.get("nominalWorkingPressure"), 0);
if (nominalWorkingPressure != null) {
nominalWorkingPressure = matchWaterVolume(fieldMap.get("nominalWorkingPressure"), nominalWorkingPressure, "MPa");
if (nominalWorkingPressure != null) {
if (nominalWorkingPressure != null && isAlphaNumeric(nominalWorkingPressure)) {
equipmentRegistryRespVO.setNominalWorkingPressure(nominalWorkingPressure);
} else {
nominalWorkingPressure = extractManufacturer(texts, fieldMap.get("nominalWorkingPressure"), nominalWorkingPressureOffset);
@ -75,8 +75,11 @@ public class ProductQualifiedService {
if (nominalWorkingPressure.equals("MPa")) {
nominalWorkingPressure = extractManufacturer(texts, fieldMap.get("nominalWorkingPressure"), 2);
}
//气瓶公称工作压力
equipmentRegistryRespVO.setNominalWorkingPressure(nominalWorkingPressure);
if (isAlphaNumeric(nominalWorkingPressure)) {
//气瓶公称工作压力
equipmentRegistryRespVO.setNominalWorkingPressure(nominalWorkingPressure);
}
}
}
}
@ -121,6 +124,24 @@ public class ProductQualifiedService {
}
return equipmentRegistryRespVO;
}
/**
* 判断字符串是否仅由字母和数字组成
*/
public static boolean isAlphaNumeric(String input) {
if (StrUtil.isBlank(input)) {
return false;
}
return input.matches("^[a-zA-Z0-9]+$");
}
/**
* 判断字符串长度是否大于3即长度 >= 4
*
* @param input 输入字符串
* @return 是否长度大于3
*/
public static boolean isLengthGreaterThan3(String input) {
return !StrUtil.isBlank(input) && input.length() > 3;
}
/**
* 检查productId字符串是否仅包含大小写字母"/" "-"
* @param input 待检查的字符串

Loading…
Cancel
Save