Commit 86423b00 authored by hanfeng's avatar hanfeng

Merge branch 'dev' of http://10.5.52.3/youjj/cloud-platform into dev2

parents e369ec69 51110dfb
...@@ -66,10 +66,6 @@ public class VehicleActiveService { ...@@ -66,10 +66,6 @@ public class VehicleActiveService {
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());
} }
if(StringUtils.isBlank(departureVo.getUser()) || StringUtils.isBlank(departureVo.getUserTel())) {
throw new BaseException(ResCode.USERNAME_AND_TELE_NOT_NULL.getDesc(),
ResCode.USERNAME_AND_TELE_NOT_NULL.getCode());
}
if(StringUtils.isBlank(departureVo.getCheckMan()) || StringUtils.isBlank(departureVo.getCheckManTel())) { if(StringUtils.isBlank(departureVo.getCheckMan()) || StringUtils.isBlank(departureVo.getCheckManTel())) {
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());
...@@ -261,21 +257,21 @@ public class VehicleActiveService { ...@@ -261,21 +257,21 @@ public class VehicleActiveService {
vehicleActiveLogMapper.updateByPrimaryKeySelective(activeLog); vehicleActiveLogMapper.updateByPrimaryKeySelective(activeLog);
//取消预定时间 bookInfo和bookRecord //取消预定时间 bookInfo和bookRecord
BookVehicleVO bookVehicleVo = new BookVehicleVO(); // BookVehicleVO bookVehicleVo = new BookVehicleVO();
BeanUtils.copyProperties(vehicleBookRecord, bookVehicleVo); // BeanUtils.copyProperties(vehicleBookRecord, bookVehicleVo);
bookVehicleVo.setNotCheckTimeLegal(Boolean.TRUE); // bookVehicleVo.setNotCheckTimeLegal(Boolean.TRUE);
bookVehicleVo.setBookStartDate(null); // bookVehicleVo.setBookStartDate(null);
bookVehicleVo.setBookEndDate(null); // bookVehicleVo.setBookEndDate(null);
bookVehicleVo.setUnbookStartDate(new DateTime(vehicleBookRecord.getBookStartDate()).toString(DATE_TIME_FORMATTER)); // bookVehicleVo.setUnbookStartDate(new DateTime(vehicleBookRecord.getBookStartDate()).toString(DATE_TIME_FORMATTER));
bookVehicleVo.setUnbookEndDate(new DateTime(vehicleBookRecord.getBookEndDate()).toString(DATE_TIME_FORMATTER)); // bookVehicleVo.setUnbookEndDate(new DateTime(vehicleBookRecord.getBookEndDate()).toString(DATE_TIME_FORMATTER));
try { // try {
Boolean hasSuc = vehicleBiz.unbookVehicle(bookVehicleVo); // Boolean hasSuc = vehicleBiz.unbookVehicle(bookVehicleVo);
if(!hasSuc){ // if(!hasSuc){
throw new BaseException(ResCode.VEHICLE_UNBOOK_FAIL.getDesc(), ResCode.VEHICLE_UNBOOK_FAIL.getCode()); // throw new BaseException(ResCode.VEHICLE_UNBOOK_FAIL.getDesc(), ResCode.VEHICLE_UNBOOK_FAIL.getCode());
} // }
} catch ( Exception e) { // } catch ( Exception e) {
e.printStackTrace(); // e.printStackTrace();
} // }
} else { } else {
throw new BaseException(ResCode.VEHICLE_BOOKED_RECORD_MILEAGE_CHANGED.getDesc(), throw new BaseException(ResCode.VEHICLE_BOOKED_RECORD_MILEAGE_CHANGED.getDesc(),
ResCode.VEHICLE_BOOKED_RECORD_MILEAGE_CHANGED.getCode()); ResCode.VEHICLE_BOOKED_RECORD_MILEAGE_CHANGED.getCode());
...@@ -289,19 +285,17 @@ public class VehicleActiveService { ...@@ -289,19 +285,17 @@ public class VehicleActiveService {
if(vehicleBookRecord != null) { if(vehicleBookRecord != null) {
DateTime startDate = new DateTime(vehicleBookRecord.getBookStartDate()); DateTime startDate = new DateTime(vehicleBookRecord.getBookStartDate());
DateTime endDate = new DateTime(vehicleBookRecord.getBookEndDate()); DateTime endDate = new DateTime(vehicleBookRecord.getBookEndDate());
if(!(startDate.minusDays(1).compareTo(DateTime.now()) <= 0 && DateTime.now().compareTo(endDate) <= 0 && vehicleBookRecord.getStatus() == VehicleBookRecordStatus.APPROVE.getCode())) {
Map<String, Object> param = new HashMap<>(); Map<String, Object> param = new HashMap<>();
param.put("vehicleId", vehicleBookRecord.getVehicleId()); param.put("vehicleId", vehicleBookRecord.getVehicleId());
param.put("time", vehicleBookRecord.getBookStartDate()); param.put("bookedEndDate", vehicleBookRecord.getBookStartDate());
List<VehicleBookRecord> list = vehicleBookRecordBiz.selectByVehicleIdAndTime(param); List<VehicleBookRecord> list = vehicleBookRecordBiz.selectByVehicleIdAndTime(param);
if(list != null && list.size() > 0) { if(!(startDate.minusDays(1).compareTo(DateTime.now()) <= 0 && DateTime.now().compareTo(endDate) <= 0 && vehicleBookRecord.getStatus() == VehicleBookRecordStatus.APPROVE.getCode() && (list == null || list.size() <= 0))) {
throw new BaseException(ResCode.VEHICLE_DEPARTURE_DATE_IS_NOT_ABLED.getDesc(), throw new BaseException(ResCode.VEHICLE_DEPARTURE_DATE_IS_NOT_ABLED.getDesc(),
ResCode.VEHICLE_DEPARTURE_DATE_IS_NOT_ABLED.getCode()); ResCode.VEHICLE_DEPARTURE_DATE_IS_NOT_ABLED.getCode());
} }
} }
} }
} }
}
public void updateBookRecordStatus(VehicleBookRecord vehicleBookRecord, Integer type) { public void updateBookRecordStatus(VehicleBookRecord vehicleBookRecord, Integer type) {
...@@ -416,4 +410,12 @@ public class VehicleActiveService { ...@@ -416,4 +410,12 @@ public class VehicleActiveService {
} }
public static void main(String[] args) {
DateTime startDate = DateTime.parse("2019-08-21 17:00:00", DATE_TIME_FORMATTER);
DateTime endDate = DateTime.parse("2019-08-21 21:00:00", DATE_TIME_FORMATTER);
System.out.println();
System.out.println(!(DateTime.now().compareTo(endDate) <= 0) && (startDate.minusDays(1).compareTo(DateTime.now()) <= 0));
}
} }
...@@ -327,7 +327,7 @@ ...@@ -327,7 +327,7 @@
<select id="selectByVehicleIdAndTime" parameterType="java.util.Map" resultType="com.xxfc.platform.vehicle.entity.VehicleBookRecord"> <select id="selectByVehicleIdAndTime" parameterType="java.util.Map" resultType="com.xxfc.platform.vehicle.entity.VehicleBookRecord">
select v1.* from vehicle_book_record v1 select v1.* from vehicle_book_record v1
where v1.vehicle_id = #{vehicleId} and v1.status BETWEEN 1 and 2 and v1.book_end_date >= #{time} where v1.vehicle_id = #{vehicleId} and v1.book_end_date &lt;= #{bookedEndDate} and v1.status BETWEEN 1 and 2
</select> </select>
<select id="getById" parameterType="java.util.Map" resultType="com.xxfc.platform.vehicle.entity.VehicleBookRecord"> <select id="getById" parameterType="java.util.Map" resultType="com.xxfc.platform.vehicle.entity.VehicleBookRecord">
......
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