From 98697af6df3b274dc618c2a1c91080dfc3cff8f1 Mon Sep 17 00:00:00 2001 From: "weicw1996@qq.com" Date: Sun, 20 Sep 2026 17:51:29 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E4=BF=AE=E5=A4=8D=E8=BF=9D=E7=AB=A0?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E5=AF=BC=E5=85=A5=E7=9A=84=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E4=B8=8E=E4=BA=8B=E9=A1=B9=E5=AD=97=E6=AE=B5=E6=B7=B7=E6=B7=86?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 导入模型将合并的"类型/事项"列拆分为"*类型"与"*事项"两列,与导出模型保持一致 - 校验与清空逻辑改为按车船类型严格匹配:车辆只允许填类型,船舶只允许填事项,误填对侧字段直接报错而非静默丢弃 - 将清空对侧字段的时机从 prepare 移到 validate 之后,避免用户误填内容被静默丢弃 - 提取 CAR/SHIP 常量,替换散落的"车辆"/"船舶"字面量 --- .../excel/ViolationRecordImportExcel.java | 7 +++- .../impl/ViolationRecordServiceImpl.java | 39 ++++++++++++------- 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/excel/ViolationRecordImportExcel.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/excel/ViolationRecordImportExcel.java index f3e7f6b..4eb3502 100644 --- a/blade-service/blade-transport/src/main/java/org/springblade/transport/excel/ViolationRecordImportExcel.java +++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/excel/ViolationRecordImportExcel.java @@ -60,8 +60,11 @@ public class ViolationRecordImportExcel implements Serializable { @ExcelProperty("*驾驶人") private String driverName; - @ExcelProperty("*类型/事项") - private String violationTypeOrItem; + @ExcelProperty("*类型") + private String violationType; + + @ExcelProperty("*事项") + private String violationItem; @ExcelProperty("*时间") @DateTimeFormat("yyyy-MM-dd HH:mm:ss") diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/ViolationRecordServiceImpl.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/ViolationRecordServiceImpl.java index ed9dfe9..4d99a4f 100644 --- a/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/ViolationRecordServiceImpl.java +++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/ViolationRecordServiceImpl.java @@ -67,6 +67,8 @@ public class ViolationRecordServiceImpl extends BaseServiceImpl selectViolationRecordPage(IPage page, ViolationRecordVO violationRecord) { @@ -81,6 +83,7 @@ public class ViolationRecordServiceImpl extends BaseServiceImpl + * 必须在 validate 之后执行:校验需要看到用户填了什么, + * 若提前清空,误填的内容会被静默丢弃,用户无从察觉。 + */ + private void clearIrrelevantField(ViolationRecord violationRecord) { + if (CAR.equals(violationRecord.getVehicleType())) { violationRecord.setViolationItem(null); } else { violationRecord.setViolationType(null); } - if (UNPROCESSED.equals(violationRecord.getProcessStatus())) { - violationRecord.setProcessResult(null); - } } private void validate(ViolationRecord violationRecord) { if (Func.isEmpty(violationRecord.getVehicleType())) { throw new ServiceException("车船类型不能为空"); } - if (!"车辆".equals(violationRecord.getVehicleType()) && !"船舶".equals(violationRecord.getVehicleType())) { + if (!CAR.equals(violationRecord.getVehicleType()) && !SHIP.equals(violationRecord.getVehicleType())) { throw new ServiceException("车船类型不正确"); } if (Func.isEmpty(violationRecord.getVehicleNo())) { @@ -155,12 +162,18 @@ public class ViolationRecordServiceImpl extends BaseServiceImpl