Commit 80162e8a by ping.wu

Merge branch 'feature/20210727_扫桌码下单校验_wuping' of…

Merge branch 'feature/20210727_扫桌码下单校验_wuping' of http://gitlab.freemud.com/order-group-application/order-group
parents 4242bf2b 30ea6d68
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 { ...@@ -23,10 +23,27 @@ public class StoreInfoRequestDto {
private String storeCode; private String storeCode;
private QueryInfo query;
public StoreInfoRequestDto(String partnerId, String storeCode) { public StoreInfoRequestDto(String partnerId, String storeCode) {
this.partnerId = partnerId; this.partnerId = partnerId;
this.storeCode = storeCode; 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 { ...@@ -139,7 +139,7 @@ public enum ResponseResult {
UPDATE_ORDER_INFO_ERROR("45043","下单失败","Order failed"), UPDATE_ORDER_INFO_ERROR("45043","下单失败","Order failed"),
CLEAR_SHOPPING_INFO_ERROR("45044","操作购物车失败","Failed to operate shopping cart"), CLEAR_SHOPPING_INFO_ERROR("45044","操作购物车失败","Failed to operate shopping cart"),
ORDER_CREATE_TABLE_ERROR("45046","开台异常","Abnormal opening"), 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_TABLENUMBER_LOCK("45048","当前桌号正在开台或已开台","The current table number is being opened or has been opened"),
ENCIRCLEORDER_PRE_PAYMENT_SUCCESS("45049","订单已支付","Order paid"), ENCIRCLEORDER_PRE_PAYMENT_SUCCESS("45049","订单已支付","Order paid"),
CLEAR_SHOPPING_INFO_SYSTEM_ERROR("45048","清空购物车异常","Empty shopping cart abnormal"), 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; ...@@ -25,9 +25,7 @@ import cn.freemud.entities.dto.delivery.GetDeliveryFlagResponseDto;
import cn.freemud.entities.dto.order.BusinessDate; import cn.freemud.entities.dto.order.BusinessDate;
import cn.freemud.entities.dto.shoppingCart.GetShoppingCartGoodsApportionDto; import cn.freemud.entities.dto.shoppingCart.GetShoppingCartGoodsApportionDto;
import cn.freemud.entities.dto.shoppingCart.ShoppingCartGoodsDto; import cn.freemud.entities.dto.shoppingCart.ShoppingCartGoodsDto;
import cn.freemud.entities.dto.store.GetEstimateDeliveryRequest; import cn.freemud.entities.dto.store.*;
import cn.freemud.entities.dto.store.StoreCBaseResponse;
import cn.freemud.entities.dto.store.StoreCBaseResponseDto;
import cn.freemud.entities.vo.CreateOrderVo; import cn.freemud.entities.vo.CreateOrderVo;
import cn.freemud.entities.vo.GetMemberCouponRequestVo; import cn.freemud.entities.vo.GetMemberCouponRequestVo;
import cn.freemud.entities.vo.ShoppingCartInfoRequestVo; import cn.freemud.entities.vo.ShoppingCartInfoRequestVo;
...@@ -41,6 +39,7 @@ import cn.freemud.service.order.OrderRelationService; ...@@ -41,6 +39,7 @@ import cn.freemud.service.order.OrderRelationService;
import cn.freemud.service.thirdparty.DeliveryFeiginClient; import cn.freemud.service.thirdparty.DeliveryFeiginClient;
import cn.freemud.service.thirdparty.ShoppingCartClient; import cn.freemud.service.thirdparty.ShoppingCartClient;
import cn.freemud.service.thirdparty.StoreBaseApiClient; import cn.freemud.service.thirdparty.StoreBaseApiClient;
import cn.freemud.service.thirdparty.StoreClient;
import cn.freemud.utils.AppLogUtil; import cn.freemud.utils.AppLogUtil;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
...@@ -51,6 +50,7 @@ import com.freemud.api.assortment.datamanager.manager.AssortmentOpenPlatformIapp ...@@ -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.AssortmentOpenPlatformPartnerStoreDeliveryConfigManager;
import com.freemud.api.assortment.datamanager.manager.customer.AssortmentCustomerInfoManager; import com.freemud.api.assortment.datamanager.manager.customer.AssortmentCustomerInfoManager;
import com.freemud.application.sdk.api.base.BaseResponse; 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.log.LogThreadLocal;
import com.freemud.application.sdk.api.membercenter.request.QueryReceiveAddressRequest; import com.freemud.application.sdk.api.membercenter.request.QueryReceiveAddressRequest;
import com.freemud.application.sdk.api.membercenter.request.StatisticalPropertyRequest; import com.freemud.application.sdk.api.membercenter.request.StatisticalPropertyRequest;
...@@ -83,7 +83,6 @@ import java.time.LocalTime; ...@@ -83,7 +83,6 @@ import java.time.LocalTime;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Component @Component
public class CheckOrder { public class CheckOrder {
...@@ -138,6 +137,10 @@ public class CheckOrder { ...@@ -138,6 +137,10 @@ public class CheckOrder {
@Autowired @Autowired
private StoreBaseApiClient storeBaseApiClient; private StoreBaseApiClient storeBaseApiClient;
@Autowired
private StoreClient storeClient;
/** /**
* 下单会员相关校验 * 下单会员相关校验
*/ */
...@@ -186,6 +189,29 @@ public class CheckOrder { ...@@ -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) { public StoreResponse.BizVO checkOrderByStore(CreateOrderVo createOrderVo, String trackingNo) {
...@@ -217,6 +243,20 @@ public class CheckOrder { ...@@ -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, public Integer checkOrderByOrderType(CreateOrderVo createOrderVo, AssortmentCustomerInfoVo userLoginInfoDto,
...@@ -271,6 +311,13 @@ public class CheckOrder { ...@@ -271,6 +311,13 @@ public class CheckOrder {
if (storeResponseDto.getIsSelfMention() == null || storeResponseDto.getIsSelfMention() != 1) { if (storeResponseDto.getIsSelfMention() == null || storeResponseDto.getIsSelfMention() != 1) {
throw new ServiceException(ResponseResult.STORE_NOT_ENABLE_COLLECT_GOODS); 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.setUserName(userLoginInfoDto.getNickName());
createOrderVo.setMobile(userLoginInfoDto.getMobile()); createOrderVo.setMobile(userLoginInfoDto.getMobile());
} }
...@@ -288,7 +335,6 @@ public class CheckOrder { ...@@ -288,7 +335,6 @@ public class CheckOrder {
//获取门店配送信息 //获取门店配送信息
StoreDeliveryInfoDto storeDeliveryInfoDto = null; StoreDeliveryInfoDto storeDeliveryInfoDto = null;
if (storeDeliveryUseOld) { if (storeDeliveryUseOld) {
//todo storeDeliveryUseOld 配置删除,老逻辑删除
storeDeliveryInfoDto = getStoreDeliveryInfo(storeResponseDto, config, appId); storeDeliveryInfoDto = getStoreDeliveryInfo(storeResponseDto, config, appId);
} else { } else {
storeDeliveryInfoDto = getNewStoreDeliveryInfo(storeResponseDto, config, appId, trackingNo); storeDeliveryInfoDto = getNewStoreDeliveryInfo(storeResponseDto, config, appId, trackingNo);
...@@ -822,7 +868,6 @@ public class CheckOrder { ...@@ -822,7 +868,6 @@ public class CheckOrder {
storeDeliveryInfoDto.setDeliveryRadius(0); storeDeliveryInfoDto.setDeliveryRadius(0);
} }
// 只有小程序设置了外卖,并且开通了第三方配送账户,才是第三方配送单 // 只有小程序设置了外卖,并且开通了第三方配送账户,才是第三方配送单
//todo 判断多余
if (openPlatformIappWxappConfig == null) { if (openPlatformIappWxappConfig == null) {
openPlatformIappWxappConfig = openPlatformIappWxappConfigManager.selectIappWxappConfigByWxAppId(wxAppid); openPlatformIappWxappConfig = openPlatformIappWxappConfigManager.selectIappWxappConfigByWxAppId(wxAppid);
} }
...@@ -933,7 +978,6 @@ public class CheckOrder { ...@@ -933,7 +978,6 @@ public class CheckOrder {
* @param storeCode 门店号 * @param storeCode 门店号
* @return * @return
*/ */
//todo 预计送达时间购物车接口返回,免去多调用一次接口
private Date getEstimateDeliveryCompleteTime(String userLat, private Date getEstimateDeliveryCompleteTime(String userLat,
String userLong, String userLong,
String partnerId, String partnerId,
...@@ -950,7 +994,7 @@ public class CheckOrder { ...@@ -950,7 +994,7 @@ public class CheckOrder {
request.setPartnerId(partnerId); request.setPartnerId(partnerId);
request.setStoreCode(storeCode); request.setStoreCode(storeCode);
StoreCBaseResponse<StoreCBaseResponseDto> responseDto = storeBaseApiClient.queryDeliverDetail(request); StoreCBaseResponse<StoreCBaseResponseDto> responseDto = storeBaseApiClient.queryDeliverDetail(request);
// AppLogUtil.infoLog("fisherman 获取门店预计送达时间",request,responseDto); AppLogUtil.infoLog("fisherman 获取门店预计送达时间",request,responseDto);
if (responseDto == null) { if (responseDto == null) {
throw new ServiceException(ResponseResult.SYSTEM_BUSINESS_ERROR); throw new ServiceException(ResponseResult.SYSTEM_BUSINESS_ERROR);
} }
......
///** /**
// * All rights Reserved, Designed By www.freemud.cn * All rights Reserved, Designed By www.freemud.cn
// * *
// * @Title: StoreController * @Title: StoreController
// * @Package cn.freemud.controller * @Package cn.freemud.controller
// * @Description: * @Description:
// * @author: ping.wu * @author: ping.wu
// * @date: 2018/5/11 19:14 * @date: 2018/5/11 19:14
// * @version V1.0 * @version V1.0
// * @Copyright: 2018 www.freemud.cn Inc. All rights reserved. * @Copyright: 2018 www.freemud.cn Inc. All rights reserved.
// * 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目 * 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
// */ */
//package cn.freemud.service.thirdparty; package cn.freemud.service.thirdparty;
//
//import cn.freemud.entities.dto.*; import cn.freemud.entities.dto.*;
//import com.freemud.application.sdk.api.storecenter.request.ChangeTableOrderStateRequest; import cn.freemud.entities.dto.store.SoreMixResponseDto;
//import com.freemud.application.sdk.api.storecenter.response.StoreBaseResponse; import cn.freemud.entities.dto.store.StoreBaseResponseDto;
//import org.springframework.cloud.openfeign.FeignClient; import cn.freemud.entities.dto.store.StoreInfoRequestDto;
//import org.springframework.http.MediaType; import com.freemud.application.sdk.api.storecenter.request.ChangeTableOrderStateRequest;
//import org.springframework.web.bind.annotation.PostMapping; import com.freemud.application.sdk.api.storecenter.response.StoreBaseResponse;
//import org.springframework.web.bind.annotation.RequestBody; import org.springframework.cloud.openfeign.FeignClient;
//import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.http.MediaType;
// import org.springframework.web.bind.annotation.PostMapping;
//@FeignClient(name = "CONSOLE-API") import org.springframework.web.bind.annotation.RequestBody;
//@RequestMapping(produces = {"application/json;charset=UTF-8"}) import org.springframework.web.bind.annotation.RequestMapping;
//public interface StoreClient {
// @FeignClient(name = "CONSOLE-API",url="${saas.storeitemclient.feign.url}")
@RequestMapping(produces = {"application/json;charset=UTF-8"})
public interface StoreClient {
// /** // /**
// * 查询附近门店 // * 查询附近门店
// * // *
...@@ -54,4 +57,11 @@ ...@@ -54,4 +57,11 @@
// //
// @PostMapping(value = "/storecenter/storetable/v2/tableActiveFlagChange", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) // @PostMapping(value = "/storecenter/storetable/v2/tableActiveFlagChange", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
// StoreBaseResponseDto<StoreBaseResponse> changeTableNumberStatus(@RequestBody ChangeTableOrderStateRequest changeTableOrderStateRequest); // 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