Commit 12f9a649 by ping.wu

取餐时间判断修改

parent 206c3f1d
...@@ -94,6 +94,11 @@ public class CreateOrderVo { ...@@ -94,6 +94,11 @@ public class CreateOrderVo {
* 取餐时间 * 取餐时间
*/ */
private String takeMealTime; private String takeMealTime;
/**
* 取餐标识 0=我已到店、尽快送出
*/
private String takeMealFlag;
/** /**
* 是否外带 ,打包 1 是 0 否 * 是否外带 ,打包 1 是 0 否
*/ */
......
...@@ -202,10 +202,6 @@ public class CheckOrder { ...@@ -202,10 +202,6 @@ public class CheckOrder {
.append(" ").append(createOrderVo.getTakeMealTime()).append(":00"); .append(" ").append(createOrderVo.getTakeMealTime()).append(":00");
takeMealDateTime = DateUtil.convert2Date(takeMealTime.toString(), "yyyy-MM-dd HH:mm:ss"); takeMealDateTime = DateUtil.convert2Date(takeMealTime.toString(), "yyyy-MM-dd HH:mm:ss");
} }
// System.out.println(takeMealDateTime.before(storeResponseDto.getBusinessHoursDayStartTime()));
// Date convert2Date = DateUtil.convert2Date(storeResponseDto.getBusinessHoursDayStartTime(), "yyyy-MM-dd");
// boolean before = takeMealDateTime.before(DateUtil.addDays(convert2Date, 1));
//隔天预约时间处理 8:00-2:00 预约1:00 ,下单时间在2:00 - 23:59加1天,00:00-1:59不加 //隔天预约时间处理 8:00-2:00 预约1:00 ,下单时间在2:00 - 23:59加1天,00:00-1:59不加
if(takeMealDateTime != null && takeMealDateTime.before(storeResponseDto.getBusinessHoursDayStartTime()) if(takeMealDateTime != null && takeMealDateTime.before(storeResponseDto.getBusinessHoursDayStartTime())
&& takeMealDateTime.before(DateUtil.addDays(DateUtil.convert2Date(storeResponseDto.getBusinessHoursDayStartTime(),"yyyy-MM-dd"),1))){ && takeMealDateTime.before(DateUtil.addDays(DateUtil.convert2Date(storeResponseDto.getBusinessHoursDayStartTime(),"yyyy-MM-dd"),1))){
...@@ -216,6 +212,15 @@ public class CheckOrder { ...@@ -216,6 +212,15 @@ public class CheckOrder {
|| takeMealDateTime.after(storeResponseDto.getBusinessHoursDayEndTime()))) { || takeMealDateTime.after(storeResponseDto.getBusinessHoursDayEndTime()))) {
throw new ServiceException(ResponseResult.ORDER_TAKEMEALTIME_INVAILD); throw new ServiceException(ResponseResult.ORDER_TAKEMEALTIME_INVAILD);
} }
//当顾客指定送达时间小于当前时间+提前预约时间时,订单记录类型为即时单
if (takeMealDateTime != null && storeResponseDto.getServiceTime() != null
&& takeMealDateTime.before(DateUtil.addMinutes(date,storeResponseDto.getServiceTime()))) {
takeMealDateTime = null;
}
//0=到店单我已到店、外卖单尽快送出
if (StringUtils.isNotBlank(createOrderVo.getTakeMealFlag()) && "0".equals(createOrderVo.getTakeMealFlag())) {
takeMealDateTime = null;
}
String appId = userLoginInfoDto.getWxAppId(); String appId = userLoginInfoDto.getWxAppId();
// 校验小程序是否支持到店或者外卖 // 校验小程序是否支持到店或者外卖
OpenPlatformIappWxappConfig config = openPlatformIappWxappConfigManager.selectIappWxappConfigByWxAppId(appId); OpenPlatformIappWxappConfig config = openPlatformIappWxappConfigManager.selectIappWxappConfigByWxAppId(appId);
...@@ -250,32 +255,32 @@ public class CheckOrder { ...@@ -250,32 +255,32 @@ public class CheckOrder {
String deliveryStr = storeResponseDto.getDeliveryHoursDay().replace("-", ",") String deliveryStr = storeResponseDto.getDeliveryHoursDay().replace("-", ",")
.replace("_", ","); .replace("_", ",");
String[] deliverys = deliveryStr.split(","); String[] deliverys = deliveryStr.split(",");
Date startDate = null; Date deliveryStartDate = null;
Date endDate = null; Date deliveryEndDate = null;
if (deliverys.length == 2) { if (deliverys.length == 2) {
SimpleDateFormat hhmmss = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat hhmmss = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
SimpleDateFormat yyyyMMdd = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat yyyyMMdd = new SimpleDateFormat("yyyy-MM-dd");
String startDateTimeStr = yyyyMMdd.format(date) + " " + deliverys[0] + ":00"; String startDateTimeStr = yyyyMMdd.format(date) + " " + deliverys[0] + ":00";
String endDateTimeStr = yyyyMMdd.format(date) + " " + deliverys[1] + ":00"; String endDateTimeStr = yyyyMMdd.format(date) + " " + deliverys[1] + ":00";
try { try {
endDate = hhmmss.parse(endDateTimeStr); deliveryEndDate = hhmmss.parse(endDateTimeStr);
startDate = hhmmss.parse(startDateTimeStr); deliveryStartDate = hhmmss.parse(startDateTimeStr);
storeDeliveryInfoDto.setDeliveryStartTime(hhmmss.parse(startDateTimeStr)); storeDeliveryInfoDto.setDeliveryStartTime(deliveryStartDate);
storeDeliveryInfoDto.setDeliveryEndTime(hhmmss.parse(endDateTimeStr)); storeDeliveryInfoDto.setDeliveryEndTime(deliveryEndDate);
} catch (ParseException e) { } catch (ParseException e) {
LogUtil.error("getStoreDeliveryInfo_error", endDateTimeStr, e.getMessage()); LogUtil.error("getStoreDeliveryInfo_error", endDateTimeStr, e.getMessage());
} }
} }
if (startDate == null || endDate == null || date.after(endDate)) { if (deliveryStartDate == null || deliveryEndDate == null || date.after(deliveryEndDate)) {
throw new ServiceException(ResponseResult.ORDER_CREATE_TIME_NOT_DELIVERY); throw new ServiceException(ResponseResult.ORDER_CREATE_TIME_NOT_DELIVERY);
} }
// 校验预约配送时间 // 校验预约配送时间
if (StringUtils.isBlank(createOrderVo.getTakeMealTime()) && date.before(startDate)) { if (StringUtils.isBlank(createOrderVo.getTakeMealTime()) && date.before(deliveryStartDate)) {
long takeAwayTime = startDate.getTime() + storeResponseDto.getServiceTime() * 60 * 1000L; long takeAwayTime = deliveryStartDate.getTime() + storeResponseDto.getServiceTime() * 60 * 1000L;
takeMealDateTime = new Date(takeAwayTime); takeMealDateTime = new Date(takeAwayTime);
// createOrderVo.setTakeMealTime(DateUtil.convert2Str(takeMealDateTime, "HH:mm")); // createOrderVo.setTakeMealTime(DateUtil.convert2Str(takeMealDateTime, "HH:mm"));
} }
if (takeMealDateTime != null && (takeMealDateTime.before(startDate) || takeMealDateTime.after(endDate))) { if (takeMealDateTime != null && (takeMealDateTime.before(deliveryStartDate) || takeMealDateTime.after(deliveryStartDate))) {
throw new ServiceException(ResponseResult.ORDER_CREATE_TIME_NOT_DELIVERY); throw new ServiceException(ResponseResult.ORDER_CREATE_TIME_NOT_DELIVERY);
} }
storeDeliveryInfoDto.setEnableTakeaway(true); storeDeliveryInfoDto.setEnableTakeaway(true);
......
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