♻️ 门槛里的启用判断改用 BladeConstant.DB_STATUS_NORMAL
原先写死 Integer.valueOf(1),虽然值与常量一致,但读代码的人无从判断 「1 到底是启用还是别的什么」。改用框架常量后语义自明, 将来若有人改动状态取值也不会遗漏此处。 已核对:车辆表 status 实际取值为 1(18 辆)与 2(2 辆), BladeConstant.DB_STATUS_NORMAL 确为 1,判断逻辑未变。 73 个测试通过。
This commit is contained in:
+3
-1
@@ -31,6 +31,7 @@ import org.springblade.core.log.exception.ServiceException;
|
|||||||
import org.springblade.core.secure.utils.AuthUtil;
|
import org.springblade.core.secure.utils.AuthUtil;
|
||||||
import org.springblade.core.tool.jackson.JsonUtil;
|
import org.springblade.core.tool.jackson.JsonUtil;
|
||||||
import org.springblade.core.tool.utils.DateUtil;
|
import org.springblade.core.tool.utils.DateUtil;
|
||||||
|
import org.springblade.core.tool.constant.BladeConstant;
|
||||||
import org.springblade.core.tool.utils.Func;
|
import org.springblade.core.tool.utils.Func;
|
||||||
import org.springblade.transport.mapper.WaybillEnroutePunchMapper;
|
import org.springblade.transport.mapper.WaybillEnroutePunchMapper;
|
||||||
import org.springblade.transport.mapper.WaybillNodePunchMapper;
|
import org.springblade.transport.mapper.WaybillNodePunchMapper;
|
||||||
@@ -395,7 +396,8 @@ public class DriverWaybillServiceImpl implements IDriverWaybillService {
|
|||||||
.in(TransportVehicle::getPlateNo, currentBoundPlates(driver)));
|
.in(TransportVehicle::getPlateNo, currentBoundPlates(driver)));
|
||||||
boolean anyCertified = boundVehicles.stream().anyMatch(vehicle ->
|
boolean anyCertified = boundVehicles.stream().anyMatch(vehicle ->
|
||||||
certificationGate.isVehicleAvailable(
|
certificationGate.isVehicleAvailable(
|
||||||
Integer.valueOf(1).equals(vehicle.getStatus()), vehicle.getEffectiveCertRecordId()));
|
vehicle.getStatus() != null && vehicle.getStatus() == BladeConstant.DB_STATUS_NORMAL,
|
||||||
|
vehicle.getEffectiveCertRecordId()));
|
||||||
if (!anyCertified) {
|
if (!anyCertified) {
|
||||||
throw new ServiceException(certificationGate.vehicleUnavailableReason());
|
throw new ServiceException(certificationGate.vehicleUnavailableReason());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user