Commit 68932a1c authored by tianbo's avatar tianbo

feat(jg): 调整设备代码校验规则

- 移除设备代码特殊字符校验 - 修改设备代码长度校验范围为16-22位
parent bd8b650d
...@@ -103,16 +103,17 @@ public class PressureVesselListener extends AnalysisEventListener<EquipInfoCylin ...@@ -103,16 +103,17 @@ public class PressureVesselListener extends AnalysisEventListener<EquipInfoCylin
if ("1".equals(data.getEquCodeType())) { if ("1".equals(data.getEquCodeType())) {
checkNotBlank(data.getEquCode(), "设备代码不能为空"); checkNotBlank(data.getEquCode(), "设备代码不能为空");
String equCode = data.getEquCode(); String equCode = data.getEquCode();
if (equCode.matches("[a-zA-Z0-9]+")) { if (equCode.length() <= 16) {
if (equCode.length() <= 17) { result.append("设备代码不能小于16位");
result.append("设备代码不能小于17位");
}
if (equCode.length() >= 20) {
result.append("设备代码不能大于20位");
}
} else {
result.append("设备代码不能包含特殊字符");
} }
if (equCode.length() >= 22) {
result.append("设备代码不能大于22位");
}
// 去掉设备代码不能有特殊字符校验
// if (equCode.matches("[a-zA-Z0-9]+")) {
// } else {
// result.append("设备代码不能包含特殊字符");
// }
if (equCodeList.contains(data.getEquCode())) { if (equCodeList.contains(data.getEquCode())) {
result.append("设备代码不能重复;"); result.append("设备代码不能重复;");
} }
......
...@@ -5011,20 +5011,21 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -5011,20 +5011,21 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
checkNotBlank(data.getEquCode(), "设备代码不能为空;", result); checkNotBlank(data.getEquCode(), "设备代码不能为空;", result);
Optional.ofNullable(data.getEquCode()) Optional.ofNullable(data.getEquCode())
.ifPresent(equCode -> { .ifPresent(equCode -> {
if (!equCode.matches("[a-zA-Z0-9]+")) { // 设备代码去掉特殊字符校验
result.append("设备代码不能包含特殊字符;"); // if (!equCode.matches("[a-zA-Z0-9]+")) {
} else { // result.append("设备代码不能包含特殊字符;");
String code = equCode.trim(); // } else {
Stream.of(code.length() < 17 ? "设备代码不能小于17位;" : "", // //this.checkEquCodeUniqueness(equCode, result);
code.length() > 20 ? "设备代码不能大于20位;" : "" // }
).filter(msg -> !msg.isEmpty()) String code = equCode.trim();
.forEach(result::append); Stream.of(code.length() < 16 ? "设备代码不能小于16位;" : "",
if (equCodeList.contains(code)) { code.length() > 22 ? "设备代码不能大于22位;" : ""
result.append("设备代码不能重复").append(code); ).filter(msg -> !msg.isEmpty())
} .forEach(result::append);
equCodeList.add(data.getEquCode()); if (equCodeList.contains(code)) {
//this.checkEquCodeUniqueness(equCode, result); result.append("设备代码不能重复").append(code);
} }
equCodeList.add(data.getEquCode());
}); });
} else { } else {
data.setEquCode(""); data.setEquCode("");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment