Commit ff4616d2 authored by jiaorz's avatar jiaorz

添加车辆状态限制接口

parent 551fc6f8
......@@ -69,10 +69,6 @@ public class VehicleActiveService {
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_DEPARTURE_VEHICLE_DISABLE.getDesc() + ", 车辆状态是:" + getVehicleStatus(vehicle.getStatus(), vehicle.getId()),
ResCode.VEHICLE_DEPARTURE_VEHICLE_DISABLE.getCode());
}
//添加出车时间过滤 再出车开始时间前一天至结束时间内可以出车,并且预定记录为已审核状态
checkDateInvalid(departureVo);
Integer MileageLift = vehicle.getMileageLastUpdate();
......
package com.xxfc.platform.vehicle.rest;
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.xxfc.platform.vehicle.biz.VehicleActiveService;
import com.xxfc.platform.vehicle.biz.VehicleBiz;
import com.xxfc.platform.vehicle.common.RestResponse;
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 org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
......@@ -17,7 +22,8 @@ public class VehicleActiveController {
@Autowired
VehicleActiveService vehicleActiveService;
@Autowired
VehicleBiz vehicleBiz;
/**
* 发车
......@@ -32,6 +38,19 @@ public class VehicleActiveController {
return RestResponse.codeAndMessage(ResCode.INVALID_REST_REQ_PARAM.getCode(),
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);
return RestResponse.suc();
}
......@@ -50,6 +69,19 @@ public class VehicleActiveController {
return RestResponse.codeAndMessage(ResCode.INVALID_REST_REQ_PARAM.getCode(),
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);
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