✨ 打卡照片改为必填
节点打卡与在途打卡都必须上传照片,缺照片直接拒绝。前端已做必填校验,此处拦的是 绕过客户端直接调接口的情况;空白字符串不算已上传。
This commit is contained in:
+18
@@ -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 {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 断言打卡照片已上传。
|
||||
* <p>
|
||||
* 照片是打卡的必填项(每个节点至少 1 张),此处拦的是绕过客户端直接调接口的情况
|
||||
* ——前端的必填提示不构成约束。
|
||||
*/
|
||||
private void assertPunchPhoto(List<String> photos) {
|
||||
boolean hasPhoto = photos != null && photos.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.map(String::trim)
|
||||
.anyMatch(Func::isNotEmpty);
|
||||
if (!hasPhoto) {
|
||||
throw new ServiceException("请上传打卡照片");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 断言该运单没有未了结的异常。
|
||||
* <p>
|
||||
|
||||
Reference in New Issue
Block a user