Commit c8656813 by 吕明尚

下单判断时分

parent 1d4191a2
...@@ -371,18 +371,18 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -371,18 +371,18 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
} }
if(Objects.nonNull(pack.getPackaStartPeriod())&&Objects.nonNull(pack.getPackaEndPeriod()) if(Objects.nonNull(pack.getPackaStartPeriod())&&Objects.nonNull(pack.getPackaEndPeriod())
&&(!StringUtils.equals(pack.getPackaStartPeriod(),"0")||!StringUtils.equals(pack.getPackaEndPeriod(),"23"))) { &&(!StringUtils.equals(pack.getPackaStartPeriod(),"0")||!StringUtils.equals(pack.getPackaEndPeriod(),"23"))) {
String preStartHour = DateUtils.parseDateToStr("H", request.getPreStartDate()); String preStartHour = DateUtils.parseDateToStr("HHmm", request.getPreStartDate());
String preEndHour = DateUtils.parseDateToStr("H", request.getPreEndDate()); String preEndHour = DateUtils.parseDateToStr("HHmm", request.getPreEndDate());
String packaStartPeriod = pack.getPackaStartPeriod() + "00";
String packaEndPeriod = pack.getPackaEndPeriod() + "00";
//1 可用开始时段<结束时段,则应该预约开始时间>可用开始时间,预约结束时间<可用结束时间 //1 可用开始时段<结束时段,则应该预约开始时间>可用开始时间,预约结束时间<可用结束时间
if(Integer.parseInt(pack.getPackaStartPeriod()) < Integer.parseInt(pack.getPackaEndPeriod())) { if (packaEndPeriod.compareTo(packaStartPeriod) < 0) {
if (Integer.parseInt(pack.getPackaStartPeriod()) > Integer.parseInt(preStartHour) if (packaStartPeriod.compareTo(preStartHour) < 0 || packaEndPeriod.compareTo(preEndHour) < 0) {
|| Integer.parseInt(pack.getPackaEndPeriod()) < Integer.parseInt(preEndHour)) {
throw new BaseException("预约时段非套餐可用时段!"); throw new BaseException("预约时段非套餐可用时段!");
} }
//1 可用开始时段>结束时段,代表可用时段跨日,则应该预约开始时间<可用开始时间,预约结束时间>可用结束时间 //1 可用开始时段>结束时段,代表可用时段跨日,则应该预约开始时间<可用开始时间,预约结束时间>可用结束时间
}else{ }else{
if (Integer.parseInt(pack.getPackaStartPeriod()) < Integer.parseInt(preStartHour) if (packaStartPeriod.compareTo(preStartHour) < 0 || packaEndPeriod.compareTo(preEndHour) > 0) {
|| Integer.parseInt(pack.getPackaEndPeriod()) > Integer.parseInt(preEndHour)) {
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