From ffed7d328ce76629bc214ff6e8fad2941971c4fe Mon Sep 17 00:00:00 2001 From: "weicw1996@qq.com" Date: Tue, 6 Oct 2026 00:29:28 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E6=89=93=E5=8D=A1=E7=85=A7?= =?UTF-8?q?=E7=89=87=E6=94=B9=E4=B8=BA=E5=BF=85=E5=A1=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 节点打卡与在途打卡都必须上传照片,缺照片直接拒绝。前端已做必填校验,此处拦的是 绕过客户端直接调接口的情况;空白字符串不算已上传。 --- .../service/impl/DriverWaybillServiceImpl.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/DriverWaybillServiceImpl.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/DriverWaybillServiceImpl.java index 0ee9d7ab..dec19dae 100644 --- a/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/DriverWaybillServiceImpl.java +++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/DriverWaybillServiceImpl.java @@ -279,6 +279,7 @@ public class DriverWaybillServiceImpl implements IDriverWaybillService { // 在途也是过程节点之一,占过程配置顺序里的位置,同样受异常门禁约束 assertNodeNotBlocked(processJson, waybill.getId(), WaybillProcessSupport.transitNodeKey(processJson)); // 不做频次/时段门禁;定位按前端是否传参落库 + assertPunchPhoto(dto.getPhoto() == null ? null : List.of(dto.getPhoto())); Date now = new Date(); WaybillEnroutePunch punch = new WaybillEnroutePunch(); @@ -328,6 +329,7 @@ public class DriverWaybillServiceImpl implements IDriverWaybillService { } assertNodeNotBlocked(processJson, waybill.getId(), WaybillProcessSupport.nodeKey(nodeCfg)); assertPrerequisitePunched(processJson, waybill.getId(), nodeCfg); + assertPunchPhoto(dto.getPhotos()); Date now = new Date(); WaybillNodePunch punch = new WaybillNodePunch(); @@ -898,6 +900,22 @@ public class DriverWaybillServiceImpl implements IDriverWaybillService { } } + /** + * 断言打卡照片已上传。 + *

+ * 照片是打卡的必填项(每个节点至少 1 张),此处拦的是绕过客户端直接调接口的情况 + * ——前端的必填提示不构成约束。 + */ + private void assertPunchPhoto(List photos) { + boolean hasPhoto = photos != null && photos.stream() + .filter(Objects::nonNull) + .map(String::trim) + .anyMatch(Func::isNotEmpty); + if (!hasPhoto) { + throw new ServiceException("请上传打卡照片"); + } + } + /** * 断言该运单没有未了结的异常。 *