Commit 6c1d788d authored by jiaorz's avatar jiaorz

添加车辆状态限制接口

parent ff4616d2
...@@ -60,7 +60,7 @@ public class VehicleActiveService { ...@@ -60,7 +60,7 @@ public class VehicleActiveService {
*/ */
public void departure(VehicleDepartureVo departureVo) { public void departure(VehicleDepartureVo departureVo) {
log.info("出车参数: departureVo = {}", departureVo.toString()); log.info("出车参数: departureVo = {}", departureVo.toString());
Vehicle vehicle = vehicleMapper.selectByPrimaryKey(departureVo.getVehicleId()); Vehicle vehicle = vehicleBiz.selectById(departureVo.getVehicleId());
if (vehicle == null) { if (vehicle == null) {
throw new BaseException(ResCode.VEHICLE_DEPARTURE_VEHICLE_UNEXIST.getDesc(), throw new BaseException(ResCode.VEHICLE_DEPARTURE_VEHICLE_UNEXIST.getDesc(),
ResCode.VEHICLE_DEPARTURE_VEHICLE_UNEXIST.getCode()); ResCode.VEHICLE_DEPARTURE_VEHICLE_UNEXIST.getCode());
...@@ -69,6 +69,10 @@ public class VehicleActiveService { ...@@ -69,6 +69,10 @@ 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 || vehicle.getStatus().equals(VehicleStatus.DEPARTURE.getCode())) {
throw new BaseException(ResCode.VEHICLE_STATUS_IS_NOT_NORMAL.getDesc(),
ResCode.VEHICLE_STATUS_IS_NOT_NORMAL.getCode());
}
//添加出车时间过滤 再出车开始时间前一天至结束时间内可以出车,并且预定记录为已审核状态 //添加出车时间过滤 再出车开始时间前一天至结束时间内可以出车,并且预定记录为已审核状态
checkDateInvalid(departureVo); checkDateInvalid(departureVo);
Integer MileageLift = vehicle.getMileageLastUpdate(); Integer MileageLift = vehicle.getMileageLastUpdate();
......
package com.xxfc.platform.vehicle.rest; package com.xxfc.platform.vehicle.rest;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken; import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
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.xxfc.platform.vehicle.biz.VehicleActiveService; import com.xxfc.platform.vehicle.biz.VehicleActiveService;
import com.xxfc.platform.vehicle.biz.VehicleBiz; import com.xxfc.platform.vehicle.biz.VehicleBiz;
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.pojo.*; import com.xxfc.platform.vehicle.pojo.*;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -38,19 +34,7 @@ public class VehicleActiveController { ...@@ -38,19 +34,7 @@ public class VehicleActiveController {
return RestResponse.codeAndMessage(ResCode.INVALID_REST_REQ_PARAM.getCode(), return RestResponse.codeAndMessage(ResCode.INVALID_REST_REQ_PARAM.getCode(),
ResCode.INVALID_REST_REQ_PARAM.getDesc()); ResCode.INVALID_REST_REQ_PARAM.getDesc());
} }
Vehicle vehicle = vehicleBiz.selectById(departureVo.getVehicleId());
if (vehicle == null) {
throw new BaseException(ResCode.VEHICLE_DEPARTURE_VEHICLE_UNEXIST.getDesc(),
ResCode.VEHICLE_DEPARTURE_VEHICLE_UNEXIST.getCode());
}
if (StringUtils.isBlank(departureVo.getCheckMan()) || StringUtils.isBlank(departureVo.getCheckManTel())) {
throw new BaseException(ResCode.CHECKUSER_AND_PHONE_NOT_NULL.getDesc(),
ResCode.CHECKUSER_AND_PHONE_NOT_NULL.getCode());
}
if (vehicle.getStatus().equals(VehicleStatus.DISCARD.getCode()) || vehicle.getIsDel() == 1 || vehicle.getStatus().equals(VehicleStatus.DEPARTURE.getCode())) {
throw new BaseException(ResCode.VEHICLE_STATUS_IS_NOT_NORMAL.getDesc(),
ResCode.VEHICLE_STATUS_IS_NOT_NORMAL.getCode());
}
vehicleActiveService.departure(departureVo); vehicleActiveService.departure(departureVo);
return RestResponse.suc(); return RestResponse.suc();
} }
...@@ -69,19 +53,6 @@ public class VehicleActiveController { ...@@ -69,19 +53,6 @@ public class VehicleActiveController {
return RestResponse.codeAndMessage(ResCode.INVALID_REST_REQ_PARAM.getCode(), return RestResponse.codeAndMessage(ResCode.INVALID_REST_REQ_PARAM.getCode(),
ResCode.INVALID_REST_REQ_PARAM.getDesc()); ResCode.INVALID_REST_REQ_PARAM.getDesc());
} }
Vehicle vehicle = vehicleBiz.selectById(departureVo.getVehicleId());
if (vehicle == null) {
throw new BaseException(ResCode.VEHICLE_DEPARTURE_VEHICLE_UNEXIST.getDesc(),
ResCode.VEHICLE_DEPARTURE_VEHICLE_UNEXIST.getCode());
}
if (StringUtils.isBlank(departureVo.getCheckMan()) || StringUtils.isBlank(departureVo.getCheckManTel())) {
throw new BaseException(ResCode.CHECKUSER_AND_PHONE_NOT_NULL.getDesc(),
ResCode.CHECKUSER_AND_PHONE_NOT_NULL.getCode());
}
if (vehicle.getStatus().equals(VehicleStatus.DISCARD.getCode()) || vehicle.getIsDel() == 1) {
throw new BaseException(ResCode.VEHICLE_DEPARTURE_VEHICLE_DISABLE.getDesc(),
ResCode.VEHICLE_DEPARTURE_VEHICLE_DISABLE.getCode());
}
vehicleActiveService.departure(departureVo); vehicleActiveService.departure(departureVo);
return RestResponse.suc(); return RestResponse.suc();
} }
......
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