Commit 4678c6e9 authored by jiaorz's avatar jiaorz

添加车辆状态限制

parent 3ad39b1a
...@@ -12,7 +12,6 @@ import com.github.wxiaoqi.security.common.exception.BaseException; ...@@ -12,7 +12,6 @@ import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode; import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.xxfc.platform.activity.user.UserInfoBiz; import com.xxfc.platform.activity.user.UserInfoBiz;
import com.xxfc.platform.order.biz.inner.OrderCalculateBiz;
import com.xxfc.platform.order.biz.inner.OrderMsgBiz; import com.xxfc.platform.order.biz.inner.OrderMsgBiz;
import com.xxfc.platform.order.contant.enumerate.CrosstownTypeEnum; import com.xxfc.platform.order.contant.enumerate.CrosstownTypeEnum;
import com.xxfc.platform.order.contant.enumerate.DepositRefundStatus; import com.xxfc.platform.order.contant.enumerate.DepositRefundStatus;
...@@ -27,6 +26,7 @@ import com.xxfc.platform.universal.entity.Dictionary; ...@@ -27,6 +26,7 @@ import com.xxfc.platform.universal.entity.Dictionary;
import com.xxfc.platform.universal.feign.ThirdFeign; import com.xxfc.platform.universal.feign.ThirdFeign;
import com.xxfc.platform.vehicle.common.RestResponse; import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.constant.ResCode.ResCode; import com.xxfc.platform.vehicle.constant.ResCode.ResCode;
import com.xxfc.platform.vehicle.constant.VehicleStatus;
import com.xxfc.platform.vehicle.entity.Vehicle; import com.xxfc.platform.vehicle.entity.Vehicle;
import com.xxfc.platform.vehicle.feign.VehicleFeign; import com.xxfc.platform.vehicle.feign.VehicleFeign;
import com.xxfc.platform.vehicle.pojo.CompanyDetail; import com.xxfc.platform.vehicle.pojo.CompanyDetail;
...@@ -183,16 +183,19 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp ...@@ -183,16 +183,19 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
return ObjectRestResponse.createFailedResult(3503, "无收车权限"); return ObjectRestResponse.createFailedResult(3503, "无收车权限");
} }
} }
if (baseOrder.getStatus() != -1) {
Vehicle vehicle = null; Vehicle vehicle = null;
RestResponse<Vehicle> restResponse = vehicleFeign.findById(orderRentVehicleDetail.getVehicleId()); RestResponse<Vehicle> vehicleRestResponse = vehicleFeign.findById(orderRentVehicleDetail.getVehicleId());
log.info("获取车辆信息返回消息:{}", restResponse.getMessage()); log.info("获取车辆信息返回消息:{}", vehicleRestResponse.getMessage());
if (restResponse.getData() != null) { if (vehicleRestResponse.getData() != null) {
vehicle = restResponse.getData(); vehicle = vehicleRestResponse.getData();
} }
if (vehicle == null) { if (vehicle == null) {
return ObjectRestResponse.createFailedResult(ResCode.VEHICLE_DEPARTURE_VEHICLE_UNEXIST.getCode(), ResCode.VEHICLE_DEPARTURE_VEHICLE_UNEXIST.getDesc()); return ObjectRestResponse.createFailedResult(ResCode.VEHICLE_DEPARTURE_VEHICLE_UNEXIST.getCode(), ResCode.VEHICLE_DEPARTURE_VEHICLE_UNEXIST.getDesc());
} }
if (vehicle.getStatus().equals(VehicleStatus.DEPARTURE.getCode())) {
return ObjectRestResponse.createFailedResult(ResCode.VEHICLE_DEPARTURE_VEHICLE_DISABLE.getCode(), ResCode.VEHICLE_DEPARTURE_VEHICLE_DISABLE.getDesc());
}
if (baseOrder.getStatus() != -1) {
if (vehicle.getMileageLastUpdate() != null) { if (vehicle.getMileageLastUpdate() != null) {
//判断车辆公里数 //判断车辆公里数
if (orderVehicleCrosstownDto.getMileage() == null || orderVehicleCrosstownDto.getMileage() < vehicle.getMileageLastUpdate()) { if (orderVehicleCrosstownDto.getMileage() == null || orderVehicleCrosstownDto.getMileage() < vehicle.getMileageLastUpdate()) {
......
...@@ -69,7 +69,7 @@ public class VehicleActiveService { ...@@ -69,7 +69,7 @@ public class VehicleActiveService {
throw new BaseException(ResCode.CHECKUSER_AND_PHONE_NOT_NULL.getDesc(), throw new BaseException(ResCode.CHECKUSER_AND_PHONE_NOT_NULL.getDesc(),
ResCode.CHECKUSER_AND_PHONE_NOT_NULL.getCode()); ResCode.CHECKUSER_AND_PHONE_NOT_NULL.getCode());
} }
if (vehicle.getStatus().equals(VehicleStatus.DISCARD.getCode()) || vehicle.getIsDel() == 1) { if (vehicle.getStatus().equals(VehicleStatus.DISCARD.getCode()) || vehicle.getIsDel() == 1 || vehicle.getStatus().equals(VehicleStatus.DEPARTURE.getCode())) {
throw new BaseException(ResCode.VEHICLE_DEPARTURE_VEHICLE_DISABLE.getDesc() + ", 车辆状态是:" + getVehicleStatus(vehicle.getStatus(), vehicle.getId()), throw new BaseException(ResCode.VEHICLE_DEPARTURE_VEHICLE_DISABLE.getDesc() + ", 车辆状态是:" + getVehicleStatus(vehicle.getStatus(), vehicle.getId()),
ResCode.VEHICLE_DEPARTURE_VEHICLE_DISABLE.getCode()); ResCode.VEHICLE_DEPARTURE_VEHICLE_DISABLE.getCode());
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment