🐛 已结束运单的在途打卡卡不可展开

This commit is contained in:
2026-10-20 16:26:10 +08:00
parent baefdc1cd7
commit a1a741481c
2 changed files with 25 additions and 1 deletions
@@ -1658,9 +1658,14 @@ public class DriverWaybillServiceImpl implements IDriverWaybillService {
// 是否允许展开:顺序门禁不允许展开(还没轮到,展开也没用);
// 异常门禁允许展开——那里出过事,司机需要看到回填内容与「异常详情」。
// 已结束的运单:在途卡一律不可展开(结束之后没有在途打卡可做,展开也无内容);
// 未打卡的节点展开同样一无所有;已打卡的普通节点保留展开,供司机回看时间与照片。
for (DriverPunchNodeVO vo : nodes) {
boolean blockedByOrder = Boolean.TRUE.equals(vo.getBlockedByOrder());
vo.setExpandable(!blockedByOrder);
boolean ended = Boolean.TRUE.equals(vo.getEnded());
boolean done = Boolean.TRUE.equals(vo.getDone());
boolean transitCard = Boolean.TRUE.equals(vo.getTransit());
vo.setExpandable(!blockedByOrder && (!ended || (done && !transitCard)));
}
// 「异常」标签:只挂**存在未处理完成异常**的节点(与异常门禁同一口径,结案即消失)。
@@ -184,6 +184,25 @@ class DriverPunchNodeCardTest {
assertTrue(json.contains("\"9007199254740993\""), json);
}
@Test
@DisplayName("运单已完成:在途卡不可展开,已打卡的普通节点仍可展开回看")
void completedWaybillTransitNodeIsNotExpandable() {
Waybill completed = waybill();
completed.setBusinessStatus("completed");
when(waybillService.getById(WAYBILL_ID)).thenReturn(completed);
Map<String, DriverPunchNodeVO> nodes = punchNodes();
DriverPunchNodeVO transit = nodes.get("transit");
assertTrue(Boolean.TRUE.equals(transit.getEnded()), "已完成运单的在途卡要进结束态");
assertFalse(Boolean.TRUE.equals(transit.getExpandable()), "已完成运单的在途卡不允许展开");
assertFalse(Boolean.TRUE.equals(transit.getActionable()));
assertTrue(Boolean.TRUE.equals(nodes.get("load").getExpandable()),
"已打卡的普通节点仍可展开回看时间与照片");
assertFalse(Boolean.TRUE.equals(nodes.get("sign").getExpandable()),
"未打卡节点展开没有内容,也不可展开");
}
// ------------------------------------------------------------ 夹具
private void stubUnresolved(ExceptionDisposal... disposals) {