Commit 937a5384 authored by jiaorz's avatar jiaorz

Merge branch 'master-vehicle-status-limit' into dev

parents cb2cbdbe ff4616d2
...@@ -69,10 +69,6 @@ public class VehicleActiveService { ...@@ -69,10 +69,6 @@ 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_DEPARTURE_VEHICLE_DISABLE.getDesc() + ", 车辆状态是:" + getVehicleStatus(vehicle.getStatus(), vehicle.getId()),
ResCode.VEHICLE_DEPARTURE_VEHICLE_DISABLE.getCode());
}
//添加出车时间过滤 再出车开始时间前一天至结束时间内可以出车,并且预定记录为已审核状态 //添加出车时间过滤 再出车开始时间前一天至结束时间内可以出车,并且预定记录为已审核状态
checkDateInvalid(departureVo); checkDateInvalid(departureVo);
Integer MileageLift = vehicle.getMileageLastUpdate(); Integer MileageLift = vehicle.getMileageLastUpdate();
......
...@@ -497,7 +497,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR ...@@ -497,7 +497,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
* @return * @return
*/ */
public ObjectRestResponse checkVehicleStatus(String vehicleId) { public ObjectRestResponse checkVehicleStatus(String vehicleId) {
if (StringUtils.isNotBlank(vehicleId)) { if (StringUtils.isBlank(vehicleId)) {
return ObjectRestResponse.paramIsEmpty(); return ObjectRestResponse.paramIsEmpty();
} }
Vehicle vehicle = mapper.selectByPrimaryKey(vehicleId); Vehicle vehicle = mapper.selectByPrimaryKey(vehicleId);
......
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.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.*;
...@@ -17,7 +22,8 @@ public class VehicleActiveController { ...@@ -17,7 +22,8 @@ public class VehicleActiveController {
@Autowired @Autowired
VehicleActiveService vehicleActiveService; VehicleActiveService vehicleActiveService;
@Autowired
VehicleBiz vehicleBiz;
/** /**
* 发车 * 发车
...@@ -32,6 +38,19 @@ public class VehicleActiveController { ...@@ -32,6 +38,19 @@ 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();
} }
...@@ -50,6 +69,19 @@ public class VehicleActiveController { ...@@ -50,6 +69,19 @@ 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