Commit 62f4bd15 authored by jiaorz's avatar jiaorz

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

parent 8bbe8e7c
......@@ -3,12 +3,16 @@ package com.xxfc.platform.vehicle.biz;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.constant.*;
import com.xxfc.platform.vehicle.constant.ResCode.ResCode;
import com.xxfc.platform.vehicle.entity.*;
import com.xxfc.platform.vehicle.mapper.*;
import com.xxfc.platform.vehicle.pojo.*;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......@@ -39,6 +43,12 @@ public class VehicleActiveService {
@Autowired
VehicleBookRecordBiz vehicleBookRecordBiz;
@Autowired
VehicleBiz vehicleBiz;
public static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
@Value("${vehicle.mileage}")
private Integer Mileage;
......@@ -244,6 +254,22 @@ public class VehicleActiveService {
activeLog.setUpdateTime(new Date());
vehicleActiveLogMapper.updateByPrimaryKeySelective(activeLog);
//取消预定时间 bookInfo和bookRecord
BookVehicleVO bookVehicleVo = new BookVehicleVO();
BeanUtils.copyProperties(vehicleBookRecord, bookVehicleVo);
bookVehicleVo.setNotCheckTimeLegal(Boolean.TRUE);
bookVehicleVo.setBookStartDate(null);
bookVehicleVo.setBookEndDate(null);
bookVehicleVo.setUnbookStartDate(new DateTime(vehicleBookRecord.getBookStartDate()).toString(DATE_TIME_FORMATTER));
bookVehicleVo.setUnbookEndDate(new DateTime(vehicleBookRecord.getBookEndDate()).toString(DATE_TIME_FORMATTER));
try {
Boolean hasSuc = vehicleBiz.unbookVehicle(bookVehicleVo);
if(!hasSuc){
throw new BaseException(ResCode.VEHICLE_UNBOOK_FAIL.getDesc(), ResCode.VEHICLE_UNBOOK_FAIL.getCode());
}
} catch ( Exception e) {
e.printStackTrace();
}
} else {
throw new BaseException(ResCode.VEHICLE_BOOKED_RECORD_MILEAGE_CHANGED.getDesc(),
ResCode.VEHICLE_BOOKED_RECORD_MILEAGE_CHANGED.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