Commit 64eef2b2 authored by 周健威's avatar 周健威

Merge branch 'feature-delay-add' into dev

parents 52ecdd3d 01fa0357
......@@ -402,7 +402,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
DateTime startDay = DateTime.parse(bookVehicleVo.getBookStartDate(), DATE_TIME_FORMATTER);
DateTime endDay = DateTime.parse(bookVehicleVo.getBookEndDate(), DATE_TIME_FORMATTER);
//转换日期范围为列表,并检查是否合法
fillDateList4DatePeriod(yearMonthAndDate, DateTime.parse(startDay.toString(DEFAULT_DATE_TIME_FORMATTER), DEFAULT_DATE_TIME_FORMATTER), DateTime.parse(endDay.toString(DEFAULT_DATE_TIME_FORMATTER), DEFAULT_DATE_TIME_FORMATTER));
fillDateList4DatePeriod(yearMonthAndDate, DateTime.parse(startDay.toString(DEFAULT_DATE_TIME_FORMATTER), DEFAULT_DATE_TIME_FORMATTER), DateTime.parse(endDay.toString(DEFAULT_DATE_TIME_FORMATTER), DEFAULT_DATE_TIME_FORMATTER), bookVehicleVo.getNotCheckTimeLegal());
if (yearMonthAndDate.size() > 3) {//连续的日期最多夸3个月
throw new BaseException(ResultCode.ONLY_BOOK_TWO_MONTH);
}
......@@ -705,7 +705,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
DateTime startDay = DateTime.parse(bookVehicleVo.getBookStartDate(), DATE_TIME_FORMATTER);
DateTime endDay = DateTime.parse(bookVehicleVo.getBookEndDate(), DATE_TIME_FORMATTER);
//转换日期范围为列表,并检查是否合法
fillDateList4DatePeriod(yearMonthAndDate, DateTime.parse(startDay.toString(DEFAULT_DATE_TIME_FORMATTER), DEFAULT_DATE_TIME_FORMATTER), DateTime.parse(endDay.toString(DEFAULT_DATE_TIME_FORMATTER), DEFAULT_DATE_TIME_FORMATTER));
fillDateList4DatePeriod(yearMonthAndDate, DateTime.parse(startDay.toString(DEFAULT_DATE_TIME_FORMATTER), DEFAULT_DATE_TIME_FORMATTER), DateTime.parse(endDay.toString(DEFAULT_DATE_TIME_FORMATTER), DEFAULT_DATE_TIME_FORMATTER), bookVehicleVo.getNotCheckTimeLegal());
if (yearMonthAndDate.size() > 3) {//连续的日期最多夸3个月
throw new BaseException(ResultCode.ONLY_BOOK_TWO_MONTH);
}
......@@ -827,12 +827,15 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
* @param startDay
* @param endDay
*/
private void fillDateList4DatePeriod(Map<String, List<String>> yearMonthAndDate, DateTime startDay, DateTime endDay) {
private void fillDateList4DatePeriod(Map<String, List<String>> yearMonthAndDate, DateTime startDay, DateTime endDay, Boolean notCheckTimeLegal) {
for (DateTime curDate = startDay; curDate.compareTo(endDay) <= 0; curDate = curDate.plusDays(1)) {
String curDateStr = curDate.toString(DEFAULT_DATE_TIME_FORMATTER);
if (!Boolean.TRUE.equals(notCheckTimeLegal)) {
//判定时间是否合法
if (curDateStr.compareTo(DateTime.now().toString(DEFAULT_DATE_TIME_FORMATTER)) < 0) {
throw new BaseException(ResultCode.ONLY_BOOK_FROM_TODAY);
}
}
String curYearMonth = curDate.toString(YEARMONTH_DATE_TIME_FORMATTER);
if (!yearMonthAndDate.containsKey(curYearMonth)) {
yearMonthAndDate.put(curYearMonth, Lists.newArrayList());
......
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