Commit e9a97813 by 周晓航

预约单配置校验

Signed-off-by: 周晓航 <xiaohang.zhou@freemud.com>
parent cd292c3a
...@@ -3,7 +3,6 @@ package cn.freemud.service.adapter; ...@@ -3,7 +3,6 @@ package cn.freemud.service.adapter;
import cn.freemud.entities.vo.CreateOrderBaseVo; import cn.freemud.entities.vo.CreateOrderBaseVo;
import cn.freemud.entities.vo.CreateOrderVo; import cn.freemud.entities.vo.CreateOrderVo;
import com.freemud.application.sdk.api.ordercenter.enums.BizTypeEnum;
import cn.freemud.interceptor.ServiceException; import cn.freemud.interceptor.ServiceException;
import cn.freemud.utils.AppLogUtil; import cn.freemud.utils.AppLogUtil;
import com.freemud.application.sdk.api.storecenter.response.StoreResponse; import com.freemud.application.sdk.api.storecenter.response.StoreResponse;
...@@ -26,13 +25,13 @@ public class OrderCheckAdapter { ...@@ -26,13 +25,13 @@ public class OrderCheckAdapter {
* @throws ServiceException 抛出异常校验异常数据 * @throws ServiceException 抛出异常校验异常数据
*/ */
public static void check(CreateOrderVo vo, StoreResponse storeResponse) throws ServiceException { public static void check(CreateOrderVo vo, StoreResponse storeResponse) throws ServiceException {
// fisherman-ka 预定单的校验 未完成 // fisherman-ka 预定单的校验 未完成 --> 这里移动了位置
if (Objects.nonNull(vo.getBizType()) // if (Objects.nonNull(vo.getBizType())
&& BizTypeEnum.ADVANCE_ORDER.getBizType().compareTo(vo.getBizType()) == 0) { // && BizTypeEnum.ADVANCE_ORDER.getBizType().compareTo(vo.getBizType()) == 0) {
// 伪代码 判断 门店是否开启了 预定单服务 // // 伪代码 判断 门店是否开启了 预定单服务
// 开启了预定单服务, 不走下面的检验 // // 开启了预定单服务, 不走下面的检验
// 没开启 抛出异常 // // 没开启 抛出异常
} // }
//非预约单的过滤 //非预约单的过滤
if (Objects.isNull(vo.getOrderType()) || if (Objects.isNull(vo.getOrderType()) ||
(!Objects.equals(vo.getTakeMealFlag(), "1"))) { (!Objects.equals(vo.getTakeMealFlag(), "1"))) {
......
...@@ -296,28 +296,11 @@ public class CheckOrder { ...@@ -296,28 +296,11 @@ public class CheckOrder {
checkTakeOutTime(storeResponseDto, new Date(), new Date(), true); checkTakeOutTime(storeResponseDto, new Date(), new Date(), true);
} }
} }
//有预约时间
if (StringUtils.isNotBlank(takeMealTimes) || StringUtils.isNotBlank(createOrderVo.getExpectTime())) {
// 设置预约时间
Date takeMealDateTime = getOrderExpectTime(takeMealFlag, takeMealTimes, createOrderVo.getExpectTime(),
CreateOrderType.getByCode(createOrderVo.getOrderType()), storeResponseDto.getServiceTime(), storeResponseDto);
if (takeMealDateTime != null) {
//校验预约时间 -->
if (!isAdvanceOrder) {
checkOrderExpectTime(createOrderVo, storeResponseDto, takeMealDateTime);
}else {
//fisherman-ka 预定单校验是否在预计开业时间范围内, 2. 校验 营业结束前十分钟,不允许下预约单(上面有代码,可以复用)
// checkAdvanceOrderExpectTime();
}
//重新赋值为yyyy-MM-dd HH:mm:ss格式字符串时间
createOrderVo.setExpectTime(DateUtil.convert2String(takeMealDateTime, "yyyy-MM-dd HH:mm:ss"));
}
}
String appId = userLoginInfoDto.getWxAppId();
// 校验小程序是否支持到店或者外卖 // 校验小程序是否支持到店或者外卖
String appId = userLoginInfoDto.getWxAppId();
AssortmentOpenPlatformIappWxappConfig config = openPlatformIappWxappConfigManager.selectIappWxappConfigByWxAppId(appId); AssortmentOpenPlatformIappWxappConfig config = openPlatformIappWxappConfigManager.selectIappWxappConfigByWxAppId(appId);
// 自提校验 // 自提校验
BusinessInfoDto businessInfoDto = null;
if (CreateOrderType.COLLECT_GOODS.getCode().equals(createOrderVo.getOrderType())) { if (CreateOrderType.COLLECT_GOODS.getCode().equals(createOrderVo.getOrderType())) {
if (config == null || config.getTakeInside() == null || config.getTakeInside() != 1) { if (config == null || config.getTakeInside() == null || config.getTakeInside() != 1) {
throw new ServiceException(ResponseResult.ORDER_WXAPP_NOT_ENABLE_COLLECT_GOODS); throw new ServiceException(ResponseResult.ORDER_WXAPP_NOT_ENABLE_COLLECT_GOODS);
...@@ -326,7 +309,7 @@ public class CheckOrder { ...@@ -326,7 +309,7 @@ public class CheckOrder {
throw new ServiceException(ResponseResult.STORE_NOT_ENABLE_COLLECT_GOODS); throw new ServiceException(ResponseResult.STORE_NOT_ENABLE_COLLECT_GOODS);
} }
//扫桌码下单开关判断 //扫桌码下单开关判断
BusinessInfoDto businessInfoDto = queryBusinessInfoNew(createOrderVo); businessInfoDto = this.queryBusinessInfoNew(createOrderVo);
if(businessInfoDto != null && businessInfoDto.getExpandFields() != null if(businessInfoDto != null && businessInfoDto.getExpandFields() != null
&& ScanOrderSwitchEnum.TRUE.getCode().equals(businessInfoDto.getExpandFields().getScanOrderSwitch()) && ScanOrderSwitchEnum.TRUE.getCode().equals(businessInfoDto.getExpandFields().getScanOrderSwitch())
&& StringUtils.isBlank(createOrderVo.getTableNumber())){ && StringUtils.isBlank(createOrderVo.getTableNumber())){
...@@ -335,6 +318,27 @@ public class CheckOrder { ...@@ -335,6 +318,27 @@ public class CheckOrder {
createOrderVo.setUserName(userLoginInfoDto.getNickName()); createOrderVo.setUserName(userLoginInfoDto.getNickName());
createOrderVo.setMobile(userLoginInfoDto.getMobile()); createOrderVo.setMobile(userLoginInfoDto.getMobile());
} }
//有预约时间
if (StringUtils.isNotBlank(takeMealTimes) || StringUtils.isNotBlank(createOrderVo.getExpectTime())) {
// 设置预约时间
Date takeMealDateTime = getOrderExpectTime(takeMealFlag, takeMealTimes, createOrderVo.getExpectTime(),
CreateOrderType.getByCode(createOrderVo.getOrderType()), storeResponseDto.getServiceTime(), storeResponseDto);
if (takeMealDateTime != null) {
//校验预约时间 -->
if (!isAdvanceOrder) {
checkOrderExpectTime(createOrderVo, storeResponseDto, takeMealDateTime);
}else {
//fisherman-ka 预定单校验是否在预计开业时间范围内, 2. 校验 营业结束前十分钟,不允许下预约单(上面有代码,可以复用)
if (Objects.isNull(businessInfoDto)) {
businessInfoDto = this.queryBusinessInfoNew(createOrderVo);
}
this.checkAdvanceOrderExpectTime(businessInfoDto);
}
//重新赋值为yyyy-MM-dd HH:mm:ss格式字符串时间
createOrderVo.setExpectTime(DateUtil.convert2String(takeMealDateTime, "yyyy-MM-dd HH:mm:ss"));
}
}
// 校验外卖信息 // 校验外卖信息
if (CreateOrderType.TAKE_OUT.getCode().equals(createOrderVo.getOrderType())) { if (CreateOrderType.TAKE_OUT.getCode().equals(createOrderVo.getOrderType())) {
if (config == null || config.getTakeaway() == null || config.getTakeaway() == 0) { if (config == null || config.getTakeaway() == null || config.getTakeaway() == 0) {
...@@ -396,6 +400,20 @@ public class CheckOrder { ...@@ -396,6 +400,20 @@ public class CheckOrder {
} }
/** /**
* 预定单的 额外校验:
* 是否支持预定单
* 预定单校验是否在预计开业时间范围内,
* 营业结束前十分钟,不允许下预约单(上面有代码,可以复用)
* @param queryBusinessInfoNew
*/
private void checkAdvanceOrderExpectTime(BusinessInfoDto queryBusinessInfoNew) {
// fisherman-ka 预定单的校验 未完成
// 伪代码 判断 门店是否开启了 预定单服务
// 开启了预定单服务, 不走下面的检验
// 没开启 抛出异常
}
/**
* 是否是 预定单 * 是否是 预定单
* @param bizType=7 就是预定单 * @param bizType=7 就是预定单
* @return true 预定单 * @return 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