Commit 30ea6d68 by ping.wu

扫桌码下单校验

parent f451c2fa
package cn.freemud.entities.dto.store;
import lombok.Data;
@Data
public class BusinessInfoDto {
private String autoSelfmentionTakeOrderWorkflowFinishTime;
private String autoSelfmentionMakerWorkflowFinishTime;
private String autoTakeOutTakeOrderWorkflowFinishTime;
private String autoDeliveryTakeOrderWorkflowFinishTime;
private String appointAutoSelfmentionTakeOrderWorkflowFinishTime;
private String appointAutoSelfmentionMakerWorkflowFinishTime;
private String appointAutoTakeOutTakeOrderWorkflowFinishTime;
private String appointAutoDeliveryTakeOrderWorkflowFinishTime;
private Integer autoThirdDeliveryTakeOrderWorkflowFinishTime;
private Integer appointThirdDeliveryTakeOrderWorkflowFinishTime;
private String autoChargebackOrderTime;
private String autoChargebackOrderType;
private String autoOrderPrintConfig;
private String overTimeCloseOrder;
private String overTimeCloseOrderTime;
private String pickUpAutomaticOrderTime;
private String takeOutAutomaticOrderTime;
private Integer automaticRefund;
private Integer deliveryAppoint;
private Integer selfMentionSwitch;
private Integer deliveryAppointTime;
private String deliveryOrderWarnTime;
private Integer tableware;
private Integer autoThirdDeliveryPickCompleteWorkflowFinishTime;
private Integer appointThirdDeliveryPickCompleteWorkflowFinishTime;
private String timeOfRefund;
private Integer timeTypeOfRefund;
private Integer turnOnTimeOfMaking;
private Integer goodsAvgTimeOfMaking;
private Integer deliveryFinishedAfterMinute;
private Integer deliveryProcessingAfterMinute;
private Integer deliveryProcessingBeforeMinute;
private Integer orderProgressBarStatus;
private ExpandFields expandFields;
}
package cn.freemud.entities.dto.store;
import lombok.Data;
@Data
public class ExpandFields {
//月销量配置值
private String monthlySalesConfigValue;
//月销量是否展示(1-是;0-否)
private String monthlySalesShow;
//点赞数是否展示(1-是;0-否)
private String likesShow;
//点赞数配置值
private String likesConfigValue;
//扫桌码下单(1-开启;0-关闭) 开启该配置的门店在下单的时候,需要判断有没有桌号,如果没有桌号需要扫码获取桌号后再下单
private String scanOrderSwitch;
//高峰时间配送时间
private Object[] peakTimeDelivery;
//每增加一公里增加的时长(分钟)
private String appendMinutePerKilometer;
}
package cn.freemud.entities.dto.store;
import cn.freemud.entities.dto.StoreResponseDto;
import lombok.Data;
@Data
public class SoreMixResponseDto {
private StoreResponseDto storeInfo;
private BusinessInfoDto businessInfo;
private Object deliveryInfo;
private Object parentUntilTop;
private Object storeBusyTimeInfoList;
private Object storeImageList;
}
......@@ -23,10 +23,27 @@ public class StoreInfoRequestDto {
private String storeCode;
private QueryInfo query;
public StoreInfoRequestDto(String partnerId, String storeCode) {
this.partnerId = partnerId;
this.storeCode = storeCode;
}
@Data
public static class QueryInfo{
//查询门店基本信息
private Boolean queryStoreInfo;
// 查询门店的渠道上级列表
private Boolean queryParentUntilTop;
//查询配送设置信息
private Boolean queryDeliveryInfo;
//查询业务设置信息
private Boolean queryBusinessInfo;
//查询门店图片
private Boolean queryStoreImage;
//查询门店繁忙时间
private Boolean queryStoreBusyTime;
}
}
......@@ -139,7 +139,7 @@ public enum ResponseResult {
UPDATE_ORDER_INFO_ERROR("45043","下单失败","Order failed"),
CLEAR_SHOPPING_INFO_ERROR("45044","操作购物车失败","Failed to operate shopping cart"),
ORDER_CREATE_TABLE_ERROR("45046","开台异常","Abnormal opening"),
ORDER_TABLE_BINDING_ERROR("45047","用户未绑定桌号","The user is not bound with the table number"),//改code与前端有强关联,不可重复
ORDER_TABLE_BINDING_ERROR("45047","未绑定桌号","The user is not bound with the table number"),//改code与前端有强关联,不可重复
ENCIRCLEORDER_TABLENUMBER_LOCK("45048","当前桌号正在开台或已开台","The current table number is being opened or has been opened"),
ENCIRCLEORDER_PRE_PAYMENT_SUCCESS("45049","订单已支付","Order paid"),
CLEAR_SHOPPING_INFO_SYSTEM_ERROR("45048","清空购物车异常","Empty shopping cart abnormal"),
......
package cn.freemud.enums;
public enum ScanOrderSwitchEnum {
TRUE("1", "开启"),
FALSE("0", "关闭");
ScanOrderSwitchEnum(String code, String message) {
this.code = code;
this.message = message;
}
private String code;
private String message;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
......@@ -25,9 +25,7 @@ import cn.freemud.entities.dto.delivery.GetDeliveryFlagResponseDto;
import cn.freemud.entities.dto.order.BusinessDate;
import cn.freemud.entities.dto.shoppingCart.GetShoppingCartGoodsApportionDto;
import cn.freemud.entities.dto.shoppingCart.ShoppingCartGoodsDto;
import cn.freemud.entities.dto.store.GetEstimateDeliveryRequest;
import cn.freemud.entities.dto.store.StoreCBaseResponse;
import cn.freemud.entities.dto.store.StoreCBaseResponseDto;
import cn.freemud.entities.dto.store.*;
import cn.freemud.entities.vo.CreateOrderVo;
import cn.freemud.entities.vo.GetMemberCouponRequestVo;
import cn.freemud.entities.vo.ShoppingCartInfoRequestVo;
......@@ -41,6 +39,7 @@ import cn.freemud.service.order.OrderRelationService;
import cn.freemud.service.thirdparty.DeliveryFeiginClient;
import cn.freemud.service.thirdparty.ShoppingCartClient;
import cn.freemud.service.thirdparty.StoreBaseApiClient;
import cn.freemud.service.thirdparty.StoreClient;
import cn.freemud.utils.AppLogUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
......@@ -51,6 +50,7 @@ import com.freemud.api.assortment.datamanager.manager.AssortmentOpenPlatformIapp
import com.freemud.api.assortment.datamanager.manager.AssortmentOpenPlatformPartnerStoreDeliveryConfigManager;
import com.freemud.api.assortment.datamanager.manager.customer.AssortmentCustomerInfoManager;
import com.freemud.application.sdk.api.base.BaseResponse;
import com.freemud.application.sdk.api.log.ApiLog;
import com.freemud.application.sdk.api.log.LogThreadLocal;
import com.freemud.application.sdk.api.membercenter.request.QueryReceiveAddressRequest;
import com.freemud.application.sdk.api.membercenter.request.StatisticalPropertyRequest;
......@@ -83,7 +83,6 @@ import java.time.LocalTime;
import java.util.*;
import java.util.stream.Collectors;
@Component
public class CheckOrder {
......@@ -138,6 +137,10 @@ public class CheckOrder {
@Autowired
private StoreBaseApiClient storeBaseApiClient;
@Autowired
private StoreClient storeClient;
/**
* 下单会员相关校验
*/
......@@ -186,6 +189,29 @@ public class CheckOrder {
}
/**
* 查询门店信息新接口
*/
public SoreMixResponseDto getStoreInfoNew(String partnerId, String shopId,Boolean queryBusinessInfo) {
// 获取门店信息
StoreInfoRequestDto request = new StoreInfoRequestDto();
request.setPartnerId(partnerId);
request.setStoreCode(shopId);
StoreInfoRequestDto.QueryInfo query = new StoreInfoRequestDto.QueryInfo();
// query.setQueryStoreInfo(true);
query.setQueryBusinessInfo(queryBusinessInfo);
request.setQuery(query);
StoreBaseResponseDto<SoreMixResponseDto> storeInfoNew = storeClient.getStoreInfoNew(request);
if (storeInfoNew == null || storeInfoNew.getBizVO() == null) {
throw new ServiceException(ResponseResult.STORE_NOT_FOUND);
}
if (queryBusinessInfo && storeInfoNew.getBizVO().getBusinessInfo() == null) {
throw new ServiceException(ResponseResult.STORE_DATE_ERROR);
}
return storeInfoNew.getBizVO();
}
/**
* 下单门店相关校验
*/
public StoreResponse.BizVO checkOrderByStore(CreateOrderVo createOrderVo, String trackingNo) {
......@@ -217,6 +243,20 @@ public class CheckOrder {
}
/**
* queryBusinessInfoNew
*/
public BusinessInfoDto queryBusinessInfoNew(CreateOrderVo createOrderVo) {
String partnerId = createOrderVo.getPartnerId();
String shopId = createOrderVo.getShopId();
// 获取门店信息
SoreMixResponseDto storeInfoNew = getStoreInfoNew(partnerId, shopId, true);
BusinessInfoDto businessInfo =storeInfoNew.getBusinessInfo();
return businessInfo;
}
/**
* 下单订单类型校验
*/
public Integer checkOrderByOrderType(CreateOrderVo createOrderVo, AssortmentCustomerInfoVo userLoginInfoDto,
......@@ -271,6 +311,13 @@ public class CheckOrder {
if (storeResponseDto.getIsSelfMention() == null || storeResponseDto.getIsSelfMention() != 1) {
throw new ServiceException(ResponseResult.STORE_NOT_ENABLE_COLLECT_GOODS);
}
//扫桌码下单开关判断
BusinessInfoDto businessInfoDto = queryBusinessInfoNew(createOrderVo);
if(businessInfoDto != null && businessInfoDto.getExpandFields() != null
&& ScanOrderSwitchEnum.TRUE.getCode().equals(businessInfoDto.getExpandFields().getScanOrderSwitch())
&& StringUtils.isBlank(createOrderVo.getTableNumber())){
throw new ServiceException(ResponseResult.ORDER_TABLE_BINDING_ERROR);
}
createOrderVo.setUserName(userLoginInfoDto.getNickName());
createOrderVo.setMobile(userLoginInfoDto.getMobile());
}
......@@ -288,7 +335,6 @@ public class CheckOrder {
//获取门店配送信息
StoreDeliveryInfoDto storeDeliveryInfoDto = null;
if (storeDeliveryUseOld) {
//todo storeDeliveryUseOld 配置删除,老逻辑删除
storeDeliveryInfoDto = getStoreDeliveryInfo(storeResponseDto, config, appId);
} else {
storeDeliveryInfoDto = getNewStoreDeliveryInfo(storeResponseDto, config, appId, trackingNo);
......@@ -822,7 +868,6 @@ public class CheckOrder {
storeDeliveryInfoDto.setDeliveryRadius(0);
}
// 只有小程序设置了外卖,并且开通了第三方配送账户,才是第三方配送单
//todo 判断多余
if (openPlatformIappWxappConfig == null) {
openPlatformIappWxappConfig = openPlatformIappWxappConfigManager.selectIappWxappConfigByWxAppId(wxAppid);
}
......@@ -933,7 +978,6 @@ public class CheckOrder {
* @param storeCode 门店号
* @return
*/
//todo 预计送达时间购物车接口返回,免去多调用一次接口
private Date getEstimateDeliveryCompleteTime(String userLat,
String userLong,
String partnerId,
......@@ -950,7 +994,7 @@ public class CheckOrder {
request.setPartnerId(partnerId);
request.setStoreCode(storeCode);
StoreCBaseResponse<StoreCBaseResponseDto> responseDto = storeBaseApiClient.queryDeliverDetail(request);
// AppLogUtil.infoLog("fisherman 获取门店预计送达时间",request,responseDto);
AppLogUtil.infoLog("fisherman 获取门店预计送达时间",request,responseDto);
if (responseDto == null) {
throw new ServiceException(ResponseResult.SYSTEM_BUSINESS_ERROR);
}
......
///**
// * All rights Reserved, Designed By www.freemud.cn
// *
// * @Title: StoreController
// * @Package cn.freemud.controller
// * @Description:
// * @author: ping.wu
// * @date: 2018/5/11 19:14
// * @version V1.0
// * @Copyright: 2018 www.freemud.cn Inc. All rights reserved.
// * 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
// */
//package cn.freemud.service.thirdparty;
//
//import cn.freemud.entities.dto.*;
//import com.freemud.application.sdk.api.storecenter.request.ChangeTableOrderStateRequest;
//import com.freemud.application.sdk.api.storecenter.response.StoreBaseResponse;
//import org.springframework.cloud.openfeign.FeignClient;
//import org.springframework.http.MediaType;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//
//@FeignClient(name = "CONSOLE-API")
//@RequestMapping(produces = {"application/json;charset=UTF-8"})
//public interface StoreClient {
//
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @Title: StoreController
* @Package cn.freemud.controller
* @Description:
* @author: ping.wu
* @date: 2018/5/11 19:14
* @version V1.0
* @Copyright: 2018 www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
package cn.freemud.service.thirdparty;
import cn.freemud.entities.dto.*;
import cn.freemud.entities.dto.store.SoreMixResponseDto;
import cn.freemud.entities.dto.store.StoreBaseResponseDto;
import cn.freemud.entities.dto.store.StoreInfoRequestDto;
import com.freemud.application.sdk.api.storecenter.request.ChangeTableOrderStateRequest;
import com.freemud.application.sdk.api.storecenter.response.StoreBaseResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
@FeignClient(name = "CONSOLE-API",url="${saas.storeitemclient.feign.url}")
@RequestMapping(produces = {"application/json;charset=UTF-8"})
public interface StoreClient {
// /**
// * 查询附近门店
// *
......@@ -54,4 +57,11 @@
//
// @PostMapping(value = "/storecenter/storetable/v2/tableActiveFlagChange", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
// StoreBaseResponseDto<StoreBaseResponse> changeTableNumberStatus(@RequestBody ChangeTableOrderStateRequest changeTableOrderStateRequest);
//}
/**
* 查询门店信息
*/
@PostMapping(value = "/api/v2/organization/getStoreMix", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
StoreBaseResponseDto<SoreMixResponseDto> getStoreInfoNew(@RequestBody StoreInfoRequestDto request);
}
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