Commit 2d458c19 by 吕明尚

套餐判断增加

parent bad5cf83
...@@ -386,16 +386,26 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -386,16 +386,26 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
&&(!StringUtils.equals(pack.getPackaStartPeriod(),"0")||!StringUtils.equals(pack.getPackaEndPeriod(),"23"))) { &&(!StringUtils.equals(pack.getPackaStartPeriod(),"0")||!StringUtils.equals(pack.getPackaEndPeriod(),"23"))) {
String preStartHour = DateUtils.parseDateToStr("HHmm", request.getPreStartDate()); String preStartHour = DateUtils.parseDateToStr("HHmm", request.getPreStartDate());
String preEndHour = DateUtils.parseDateToStr("HHmm", request.getPreEndDate()); String preEndHour = DateUtils.parseDateToStr("HHmm", request.getPreEndDate());
String packaStartPeriod = pack.getPackaStartPeriod() + "00"; String packaStartPeriod1 = pack.getPackaStartPeriod();
String packaEndPeriod = pack.getPackaEndPeriod() + "00"; //只有一位时,在前面补0
if (packaStartPeriod1.length() == 1) {
packaStartPeriod1 = "0" + packaStartPeriod1;
}
String packaStartPeriod = packaStartPeriod1 + "00";
String packaEndPeriod1 = pack.getPackaEndPeriod();
//只有一位时,在前面补0
if (packaEndPeriod1.length() == 1) {
packaEndPeriod1 = "0" + packaEndPeriod1;
}
String packaEndPeriod = packaEndPeriod1 + "00";
//1 可用开始时段<结束时段,则应该预约开始时间>可用开始时间,预约结束时间<可用结束时间 //1 可用开始时段<结束时段,则应该预约开始时间>可用开始时间,预约结束时间<可用结束时间
if (preEndHour.compareTo(packaStartPeriod) > 0) { if (preEndHour.compareTo(packaStartPeriod) > 0) {
if (preStartHour.compareTo(packaStartPeriod) > 0 || preEndHour.compareTo(packaEndPeriod) > 0) { if (preStartHour.compareTo(packaStartPeriod) < 0 || packaEndPeriod.compareTo(preEndHour) < 0) {
throw new BaseException("预约时段非套餐可用时段!"); throw new BaseException("预约时段非套餐可用时段!");
} }
//1 可用开始时段>结束时段,代表可用时段跨日,则应该预约开始时间<可用开始时间,预约结束时间>可用结束时间 //1 可用开始时段>结束时段,代表可用时段跨日,则应该预约开始时间<可用开始时间,预约结束时间>可用结束时间
}else{ }else{
if (packaStartPeriod.compareTo(preStartHour) < 0 || preEndHour.compareTo(packaEndPeriod) > 0) { if (packaStartPeriod.compareTo(preStartHour) < 0 || preEndHour.compareTo(packaEndPeriod) < 0) {
throw new BaseException("预约时段非套餐可用时段!"); throw new BaseException("预约时段非套餐可用时段!");
} }
} }
......
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