Commit c08b69ac authored by jiaorz's avatar jiaorz

修改租車訂單地址,修改车辆预定时添加订单号

parent 77adbcaf
......@@ -23,6 +23,19 @@ public class ResultCode {
// 预定时间不能小于当前时间
public static int ONLY_BOOK_FROM_TODAY = Integer.valueOf(SystemProperty.getResultConfig("ONLY_BOOK_FROM_TODAY"));
// 只能预定两个月内的车辆
public static int ONLY_BOOK_TWO_MONTH = Integer.valueOf(SystemProperty.getResultConfig("ONLY_BOOK_TWO_MONTH"));
// 只能取消预定两个月内的车辆
public static int ONLY_UNBOOK_TWO_MONTH = Integer.valueOf(SystemProperty.getResultConfig("ONLY_UNBOOK_TWO_MONTH"));
// 选择日期不可取消预定
public static int VEHICLE_CAN_NOT_UNBOOK = Integer.valueOf(SystemProperty.getResultConfig("VEHICLE_CAN_NOT_UNBOOK"));
//预定日期为空
public static int BOOKED_DATE_IS_EMPTY = Integer.valueOf(SystemProperty.getResultConfig("BOOKED_DATE_IS_EMPTY"));
public static int TODAY_CAN_NOT_BOOK = Integer.valueOf(SystemProperty.getResultConfig("TODAY_CAN_NOT_BOOK"));
// 添加车辆失败,请重试
public static int ADD_VEHICLE_FAIL = Integer.valueOf(SystemProperty.getResultConfig("ADD_VEHICLE_FAIL"));
......
......@@ -225,3 +225,17 @@ UPDATE_VEHICLE_FAIL = 4010
DATE_TIME_IS_NULL = 4011
4011 = 预定时间不能为空
ONLY_BOOK_TWO_MONTH = 4012
4012 = 只能预定两月内的车辆
ONLY_UNBOOK_TWO_MONTH = 4013
4013 = 只能取消预定两月内的车辆
VEHICLE_CAN_NOT_UNBOOK = 4014
4014 = 选择日期不可取消预定
BOOKED_DATE_IS_EMPTY = 4015
4015 = 预定日期为空
TODAY_CAN_NOT_BOOK = 4016
4016 = 当天不可预定
\ No newline at end of file
......@@ -830,7 +830,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
for( DateTime curDate = startDay;curDate.compareTo(endDay)<=0;curDate=curDate.plusDays(1)){
String curDateStr = curDate.toString(DEFAULT_DATE_TIME_FORMATTER);
if(curDateStr.compareTo(DateTime.now().toString(DEFAULT_DATE_TIME_FORMATTER))<0){
throw new CustomIllegalParamException("只可以取消当前时间之后的车辆");
throw new BaseException(ResultCode.ONLY_BOOK_FROM_TODAY);
}
String curYearMonth = curDate.toString(YEARMONTH_DATE_TIME_FORMATTER);
if(!yearMonthAndDate.containsKey(curYearMonth)){
......@@ -841,7 +841,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
}
if(yearMonthAndDate.size()>3){//连续的日期最多夸3个月
throw new CustomIllegalParamException(" 只可以预约两个月内的车辆");
throw new BaseException(ResultCode.ONLY_BOOK_TWO_MONTH);
}
}
......@@ -860,7 +860,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
fillDateList4DatePeriod(yearMonthAndDate,startDay,endDay);
if(yearMonthAndDate.size()>3){//连续的日期最多夸3个月
throw new CustomIllegalParamException(" 只可以预约两个月内的车辆");
throw new BaseException(ResultCode.ONLY_UNBOOK_TWO_MONTH);
}
Boolean rs = Boolean.TRUE;
for(Map.Entry<String,List<String>> entry:yearMonthAndDate.entrySet()){
......@@ -881,7 +881,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
params.put("yearMonth",yearMonth);
//加入更新条件
if(CollectionUtils.isEmpty(unbookDates)){
throw new CustomIllegalParamException(" 车辆不可预定");
throw new BaseException(ResultCode.VEHICLE_CAN_NOT_UNBOOK);
}
Map<String,List<String>> yearMonthAndDate = new HashMap<>();
yearMonthAndDate.put(yearMonth,unbookDates);
......@@ -908,7 +908,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
public void fillBookedDateSearchParam(Map<String, Object> params,
Map<String,List<String>> yearMonthAndDate,Map<String,List<String>> yearMonthAndDateNotBooked){
if(MapUtils.isEmpty(yearMonthAndDate)&&MapUtils.isEmpty(yearMonthAndDateNotBooked)){//没有预定信息查询条件
throw new CustomIllegalParamException("没有预订信息!");
throw new BaseException(ResultCode.BOOKED_DATE_IS_EMPTY);
}
Map<String,Map<String,Integer>> yearMonthAndParam = new HashMap<>();
......@@ -953,7 +953,8 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
}
for (String dateStr:entry.getValue()) {//已预定作为条件,该位与1作与运算必定为1
if(bookedYearMonth.contains(dateStr)){
throw new CustomIllegalParamException("同一天既作为未预定查询条件又作为已预定查询条件");
log.info("当天不可预定,日期为:dateStr = {}", dateStr);
throw new BaseException(ResultCode.TODAY_CAN_NOT_BOOK);
}
DateTime dateTime = DateTime.parse(dateStr, DEFAULT_DATE_TIME_FORMATTER);
//仅对应位为1的整形值
......
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