一辆车同时被不同人切换

This commit is contained in:
2026-05-28 14:41:08 +08:00
parent 0cc73dc267
commit 4a77f3e431

View File

@@ -21,6 +21,7 @@ import com.hotwj.platform.flow.service.ISysFlowService;
import com.hotwj.platform.integration.ocr.SignatureVerifyService; import com.hotwj.platform.integration.ocr.SignatureVerifyService;
import com.hotwj.platform.noticeManagerment.systemNotification.domain.bo.HotSystemNotificationGroupBo; import com.hotwj.platform.noticeManagerment.systemNotification.domain.bo.HotSystemNotificationGroupBo;
import com.hotwj.platform.noticeManagerment.systemNotification.service.IHotSystemNotificationService; import com.hotwj.platform.noticeManagerment.systemNotification.service.IHotSystemNotificationService;
import com.hotwj.platform.resourceManagement.vehicleManagement.domain.HotVehicle;
import com.hotwj.platform.resourceManagement.vehicleManagement.domain.vo.HotVehicleVo; import com.hotwj.platform.resourceManagement.vehicleManagement.domain.vo.HotVehicleVo;
import com.hotwj.platform.resourceManagement.vehicleManagement.mapper.HotVehicleMapper; import com.hotwj.platform.resourceManagement.vehicleManagement.mapper.HotVehicleMapper;
import com.hotwj.platform.securityManagement.hiddenDanger.mapper.HotHiddenDangerMapper; import com.hotwj.platform.securityManagement.hiddenDanger.mapper.HotHiddenDangerMapper;
@@ -247,18 +248,12 @@ public class HotVehicleThreeInspectServiceImpl implements IHotVehicleThreeInspec
// 校验该车辆三检流程逻辑 // 校验该车辆三检流程逻辑
if (add.getVehicleId() != null) { if (add.getVehicleId() != null) {
// 获取该车辆最近的一条三检记录
List<HotVehicleThreeInspect> list = baseMapper.selectList(
Wrappers.<HotVehicleThreeInspect>lambdaQuery()
.eq(HotVehicleThreeInspect::getVehicleId, add.getVehicleId())
.orderByDesc(HotVehicleThreeInspect::getCreateTime)
.last("LIMIT 1")
);
Long currentPhase = add.getInspectPhase(); Long currentPhase = add.getInspectPhase();
// 获取该车辆最近的一条三检记录
HotVehicleThreeInspect last = selectLatestInspect(add.getVehicleId());
validateOutboundVehicleDriver(add, last);
if (list != null && !list.isEmpty()) { if (last != null) {
HotVehicleThreeInspect last = list.get(0);
Long lastPhase = last.getInspectPhase(); Long lastPhase = last.getInspectPhase();
// 1. 如果上一条是收车检查(第3阶段),则本次必须是新一轮的出车检查(第1阶段) // 1. 如果上一条是收车检查(第3阶段),则本次必须是新一轮的出车检查(第1阶段)
if (lastPhase == 3) { if (lastPhase == 3) {
@@ -340,6 +335,32 @@ public class HotVehicleThreeInspectServiceImpl implements IHotVehicleThreeInspec
return flag; return flag;
} }
private void validateOutboundVehicleDriver(HotVehicleThreeInspect currentInspect, HotVehicleThreeInspect latestInspect) {
if (currentInspect == null || !Objects.equals(currentInspect.getInspectPhase(), 1L) || latestInspect == null) {
return;
}
if (Objects.equals(latestInspect.getInspectPhase(), 3L)) {
return;
}
if (StringUtils.equals(StringUtils.trimToEmpty(currentInspect.getDriverId()),
StringUtils.trimToEmpty(latestInspect.getDriverId()))) {
return;
}
throw new ServiceException(buildVehicleOccupiedMessage(currentInspect.getVehicleId()));
}
private String buildVehicleOccupiedMessage(Long vehicleId) {
if (vehicleId == null) {
return "该车辆已出任务,请重新选择其他车辆";
}
HotVehicle vehicle = hotVehicleMapper.selectById(String.valueOf(vehicleId));
String plateNumber = vehicle == null ? null : StringUtils.trimToNull(vehicle.getPlateNumber());
if (plateNumber == null) {
return "该车辆已出任务,请重新选择其他车辆";
}
return "'" + plateNumber + "'车辆已出任务,请重新选择其他车辆";
}
private void validateInspectorSignatureByPhase(HotVehicleThreeInspectBo bo) { private void validateInspectorSignatureByPhase(HotVehicleThreeInspectBo bo) {
Long inspectPhase = bo.getInspectPhase(); Long inspectPhase = bo.getInspectPhase();
if (inspectPhase == null) { if (inspectPhase == null) {