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) { if (equCode.length() >= 22) {
result.append("设备代码不能大于20位"); result.append("设备代码不能大于22位");
}
} else {
result.append("设备代码不能包含特殊字符");
} }
// 去掉设备代码不能有特殊字符校验
// 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("设备代码不能包含特殊字符;");
// } else {
// //this.checkEquCodeUniqueness(equCode, result);
// }
String code = equCode.trim(); String code = equCode.trim();
Stream.of(code.length() < 17 ? "设备代码不能小于17位;" : "", Stream.of(code.length() < 16 ? "设备代码不能小于16位;" : "",
code.length() > 20 ? "设备代码不能大于20位;" : "" code.length() > 22 ? "设备代码不能大于22位;" : ""
).filter(msg -> !msg.isEmpty()) ).filter(msg -> !msg.isEmpty())
.forEach(result::append); .forEach(result::append);
if (equCodeList.contains(code)) { if (equCodeList.contains(code)) {
result.append("设备代码不能重复").append(code); result.append("设备代码不能重复").append(code);
} }
equCodeList.add(data.getEquCode()); equCodeList.add(data.getEquCode());
//this.checkEquCodeUniqueness(equCode, result);
}
}); });
} 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