Commit 8e216fe3 authored by jiaorz's avatar jiaorz

修改还车未取消预定数据bug

parent 62f4bd15
...@@ -29,6 +29,7 @@ public enum ResCode { ...@@ -29,6 +29,7 @@ public enum ResCode {
VEHICLE_DEPARTURE_VEHICLE_UNEXIST(104001,"车辆不存在"), VEHICLE_DEPARTURE_VEHICLE_UNEXIST(104001,"车辆不存在"),
VEHICLE_DEPARTURE_VEHICLE_DISABLE(104002,"车辆不可用"), VEHICLE_DEPARTURE_VEHICLE_DISABLE(104002,"车辆不可用"),
VEHICLE_DEPARTURE_VEHICLE_UNDEPARTURE(104003,"车辆未出车"), VEHICLE_DEPARTURE_VEHICLE_UNDEPARTURE(104003,"车辆未出车"),
VEHICLE_DEPARTURE_DATE_IS_NOT_ABLED(104006,"车辆不在出车范围内,请按照预定日期出车!"),
VEHICLE_BOOK_RECORD_IS_NOT_EXIST(104004, "预约记录不存在"), VEHICLE_BOOK_RECORD_IS_NOT_EXIST(104004, "预约记录不存在"),
VEHICLE_UNBOOK_FAIL(104005, "取消预定失败!"), VEHICLE_UNBOOK_FAIL(104005, "取消预定失败!"),
......
...@@ -76,6 +76,8 @@ public class VehicleActiveService { ...@@ -76,6 +76,8 @@ public class VehicleActiveService {
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());
} }
//添加出车时间过滤 再出车开始时间前一天至结束时间内可以出车,并且预定记录为已审核状态
checkDateInvalide(departureVo);
Integer MileageLift=vehicle.getMileageLastUpdate(); Integer MileageLift=vehicle.getMileageLastUpdate();
Integer MileageLift1=departureVo.getMileage(); Integer MileageLift1=departureVo.getMileage();
if(MileageLift1==null){ if(MileageLift1==null){
...@@ -241,7 +243,7 @@ public class VehicleActiveService { ...@@ -241,7 +243,7 @@ public class VehicleActiveService {
departureLog.setArrivalPic(arrivalVo.getArrivalPic()); departureLog.setArrivalPic(arrivalVo.getArrivalPic());
departureLog.setArrivalRemark(arrivalVo.getRemark()); departureLog.setArrivalRemark(arrivalVo.getRemark());
if(vehicleBookRecord != null) { if(vehicleBookRecord != null) {
departureLog.setDepartureBranchCompanyId(vehicleBookRecord.getRetCompany()); departureLog.setArrivalBranchCompanyId(vehicleBookRecord.getRetCompany());
} }
vehicleDepartureLogMapper.updateByPrimaryKeySelective(departureLog); vehicleDepartureLogMapper.updateByPrimaryKeySelective(departureLog);
// 车辆活动日志 // 车辆活动日志
...@@ -276,6 +278,22 @@ public class VehicleActiveService { ...@@ -276,6 +278,22 @@ public class VehicleActiveService {
} }
} }
//添加出车时间过滤 再出车开始时间前一天至结束时间内可以出车,并且预定记录为已审核状态
public void checkDateInvalide(VehicleDepartureVo arrivalVo) {
if(arrivalVo.getBookRecordId() != null) {
VehicleBookRecord vehicleBookRecord = vehicleBookRecordBiz.selectById(arrivalVo.getBookRecordId());
if(vehicleBookRecord != null) {
DateTime startDate = new DateTime(vehicleBookRecord.getBookStartDate());
DateTime endDate = new DateTime(vehicleBookRecord.getBookEndDate());
if(!startDate.plusDays(-1).isBefore(DateTime.now()) && DateTime.now().isBefore(endDate) && vehicleBookRecord.getStatus() == VehicleBookRecordStatus.APPROVE.getCode()) {
throw new BaseException(ResCode.VEHICLE_DEPARTURE_DATE_IS_NOT_ABLED.getDesc(),
ResCode.VEHICLE_DEPARTURE_DATE_IS_NOT_ABLED.getCode());
}
}
}
}
public void updateBookRecordStatus(VehicleBookRecord vehicleBookRecord, Integer type) { public void updateBookRecordStatus(VehicleBookRecord vehicleBookRecord, Integer type) {
if(vehicleBookRecord != null) { if(vehicleBookRecord != null) {
......
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