Commit 43396f46 by ping.wu

查询门店信息接口统一

parent ae86142d
...@@ -47,7 +47,9 @@ public class UserDeliveryInfoDto { ...@@ -47,7 +47,9 @@ public class UserDeliveryInfoDto {
private Boolean userEnableTakeaway; private Boolean userEnableTakeaway;
/** /**
* 实际需要支付配送费 * 实际需要支付配送费
* 都从购物车计算出配送费
*/ */
@Deprecated
private Long realDeliveryAmount; private Long realDeliveryAmount;
/** /**
* 起送费单位分 * 起送费单位分
......
...@@ -77,4 +77,8 @@ public class DeliveryInfoDTO { ...@@ -77,4 +77,8 @@ public class DeliveryInfoDTO {
private DeliveryInfoExpFields expandFields; private DeliveryInfoExpFields expandFields;
// TODO: 21-11-15 参数待送门店新接口获取
// private String minOrderPrice;
// private String deliveryFee;
} }
package cn.freemud.manager; //package cn.freemud.manager;
//
import cn.freemud.entities.db.StoreTableNumber; //import cn.freemud.entities.db.StoreTableNumber;
import cn.freemud.manager.dao.StoreTableNumberDao; //import cn.freemud.manager.dao.StoreTableNumberDao;
import org.apache.commons.collections4.CollectionUtils; //import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; //import org.springframework.stereotype.Component;
//
import java.util.List; //import java.util.List;
//
@Component //@Component
public class StoreTableNumberManager { //public class StoreTableNumberManager {
@Autowired // @Autowired
private StoreTableNumberDao storeTableNumberDao; // private StoreTableNumberDao storeTableNumberDao;
//
public StoreTableNumber selectOne(String partnerId, String storeId, String tableNumber) { // public StoreTableNumber selectOne(String partnerId, String storeId, String tableNumber) {
StoreTableNumber storeTableNumber = new StoreTableNumber(); // StoreTableNumber storeTableNumber = new StoreTableNumber();
storeTableNumber.setPartnerId(partnerId); // storeTableNumber.setPartnerId(partnerId);
storeTableNumber.setStoreId(storeId); // storeTableNumber.setStoreId(storeId);
storeTableNumber.setTableNumber(tableNumber); // storeTableNumber.setTableNumber(tableNumber);
List<StoreTableNumber> storeTableNumberList = storeTableNumberDao.select(storeTableNumber); // List<StoreTableNumber> storeTableNumberList = storeTableNumberDao.select(storeTableNumber);
if(CollectionUtils.isNotEmpty(storeTableNumberList)) { // if(CollectionUtils.isNotEmpty(storeTableNumberList)) {
return storeTableNumberList.get(0); // return storeTableNumberList.get(0);
} // }
return null; // return null;
} // }
} //}
...@@ -212,7 +212,7 @@ public abstract class CheckOrderUniversal { ...@@ -212,7 +212,7 @@ public abstract class CheckOrderUniversal {
String shopId = createOrderBaseVo.getShopId(); String shopId = createOrderBaseVo.getShopId();
// 获取门店信息 // 获取门店信息
StoreMixResponseDto storeMixResponseDto = storeService.getStoreInfoNew(partnerId, shopId, false); StoreMixResponseDto storeMixResponseDto = storeService.getStoreInfoNew(partnerId, shopId, false,false);
if (storeMixResponseDto == null || storeMixResponseDto.getStoreInfo() == null) { if (storeMixResponseDto == null || storeMixResponseDto.getStoreInfo() == null) {
throw new ServiceException(ResponseResult.STORE_NOT_FOUND); throw new ServiceException(ResponseResult.STORE_NOT_FOUND);
} }
......
...@@ -190,7 +190,7 @@ public class AppOrderServiceImpl implements AppOrderService { ...@@ -190,7 +190,7 @@ public class AppOrderServiceImpl implements AppOrderService {
String partnerId = createOrderReq.getPartnerId(); String partnerId = createOrderReq.getPartnerId();
String shopId = createOrderReq.getShopId(); String shopId = createOrderReq.getShopId();
// 获取门店信息 // 获取门店信息
StoreMixResponseDto storeMixResponseDto = storeService.getStoreInfoNew(partnerId, shopId, false); StoreMixResponseDto storeMixResponseDto = storeService.getStoreInfoNew(partnerId, shopId, false,false);
if (storeMixResponseDto == null || storeMixResponseDto.getStoreInfo() == null) { if (storeMixResponseDto == null || storeMixResponseDto.getStoreInfo() == null) {
throw new ServiceException(ResponseResult.STORE_NOT_FOUND); throw new ServiceException(ResponseResult.STORE_NOT_FOUND);
} }
......
...@@ -146,7 +146,7 @@ public class CheckMCCafeOrder { ...@@ -146,7 +146,7 @@ public class CheckMCCafeOrder {
String shopId = createOrderVo.getShopId(); String shopId = createOrderVo.getShopId();
// 获取门店信息 // 获取门店信息
StoreMixResponseDto storeMixResponseDto = storeService.getStoreInfoNew(partnerId, shopId, true); StoreMixResponseDto storeMixResponseDto = storeService.getStoreInfoNew(partnerId, shopId, true,false);
if (storeMixResponseDto == null || storeMixResponseDto.getStoreInfo() == null) { if (storeMixResponseDto == null || storeMixResponseDto.getStoreInfo() == null) {
throw new ServiceException(ResponseResult.STORE_NOT_FOUND); throw new ServiceException(ResponseResult.STORE_NOT_FOUND);
} }
......
...@@ -107,7 +107,7 @@ public class CheckMallOrder { ...@@ -107,7 +107,7 @@ public class CheckMallOrder {
String shopId = createOrderVo.getShopId(); String shopId = createOrderVo.getShopId();
// 获取门店信息 // 获取门店信息
StoreMixResponseDto storeMixResponseDto = storeService.getStoreInfoNew(partnerId, shopId, false); StoreMixResponseDto storeMixResponseDto = storeService.getStoreInfoNew(partnerId, shopId, false,false);
if (storeMixResponseDto == null || storeMixResponseDto.getStoreInfo() == null) { if (storeMixResponseDto == null || storeMixResponseDto.getStoreInfo() == null) {
throw new ServiceException(ResponseResult.STORE_NOT_FOUND); throw new ServiceException(ResponseResult.STORE_NOT_FOUND);
} }
......
...@@ -21,9 +21,6 @@ import cn.freemud.entities.dto.GetCouponDetailResponseDto; ...@@ -21,9 +21,6 @@ import cn.freemud.entities.dto.GetCouponDetailResponseDto;
import cn.freemud.entities.dto.StoreDeliveryInfoDto; import cn.freemud.entities.dto.StoreDeliveryInfoDto;
import cn.freemud.entities.dto.StoreResponseDto; import cn.freemud.entities.dto.StoreResponseDto;
import cn.freemud.entities.dto.UserDeliveryInfoDto; import cn.freemud.entities.dto.UserDeliveryInfoDto;
import cn.freemud.entities.dto.delivery.DeliveryBaseResponse;
import cn.freemud.entities.dto.delivery.GetDeliveryFlagRequest;
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;
...@@ -37,12 +34,11 @@ import cn.freemud.entities.vo.SellCouponCreateOrderVo; ...@@ -37,12 +34,11 @@ import cn.freemud.entities.vo.SellCouponCreateOrderVo;
import cn.freemud.entities.vo.ShoppingCartInfoRequestVo; import cn.freemud.entities.vo.ShoppingCartInfoRequestVo;
import cn.freemud.enums.*; import cn.freemud.enums.*;
import cn.freemud.interceptor.ServiceException; import cn.freemud.interceptor.ServiceException;
import cn.freemud.manager.StoreTableNumberManager;
import cn.freemud.service.CouponService; import cn.freemud.service.CouponService;
import cn.freemud.service.adapter.OrderCheckAdapter; import cn.freemud.service.adapter.OrderCheckAdapter;
import cn.freemud.service.order.OrderRelationFactory; import cn.freemud.service.thirdparty.CustomerPropertyClient;
import cn.freemud.service.order.OrderRelationService; import cn.freemud.service.thirdparty.ShoppingCartClient;
import cn.freemud.service.thirdparty.*; import cn.freemud.service.thirdparty.StoreBaseApiClient;
import cn.freemud.utils.AppLogUtil; import cn.freemud.utils.AppLogUtil;
import cn.freemud.utils.ResponseUtil; import cn.freemud.utils.ResponseUtil;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
...@@ -60,7 +56,6 @@ import com.freemud.application.sdk.api.membercenter.response.QueryReceiveAddress ...@@ -60,7 +56,6 @@ import com.freemud.application.sdk.api.membercenter.response.QueryReceiveAddress
import com.freemud.application.sdk.api.membercenter.service.MemberCenterService; import com.freemud.application.sdk.api.membercenter.service.MemberCenterService;
import com.freemud.application.sdk.api.ordercenter.enums.BizTypeEnum; import com.freemud.application.sdk.api.ordercenter.enums.BizTypeEnum;
import com.freemud.application.sdk.api.ordercenter.request.OrderExtInfoDto; import com.freemud.application.sdk.api.ordercenter.request.OrderExtInfoDto;
import com.freemud.application.sdk.api.paymentcenter.client.service.PaymentNewService;
import com.freemud.application.sdk.api.storecenter.request.QueryDeliveryRequest; import com.freemud.application.sdk.api.storecenter.request.QueryDeliveryRequest;
import com.freemud.application.sdk.api.storecenter.request.StoreInfoRequest; import com.freemud.application.sdk.api.storecenter.request.StoreInfoRequest;
import com.freemud.application.sdk.api.storecenter.response.QueryDeliverDetailResponse; import com.freemud.application.sdk.api.storecenter.response.QueryDeliverDetailResponse;
...@@ -69,11 +64,9 @@ import com.freemud.application.sdk.api.storecenter.service.StoreCenterService; ...@@ -69,11 +64,9 @@ import com.freemud.application.sdk.api.storecenter.service.StoreCenterService;
import com.freemud.sdk.api.assortment.order.enums.StoreDeliveryMethod; import com.freemud.sdk.api.assortment.order.enums.StoreDeliveryMethod;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import com.google.gson.Gson;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.ObjectUtils; import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -89,19 +82,11 @@ import java.util.stream.Collectors; ...@@ -89,19 +82,11 @@ import java.util.stream.Collectors;
@Component @Component
public class CheckOrder { public class CheckOrder {
// 配送费逻辑是否使用旧的
@Value("${store.delivery.use.old}")
private boolean storeDeliveryUseOld;
@Autowired @Autowired
private StoreTableNumberManager storeTableNumberManager;
@Autowired
private AssortmentOpenPlatformIappWxappConfigManager openPlatformIappWxappConfigManager; private AssortmentOpenPlatformIappWxappConfigManager openPlatformIappWxappConfigManager;
@Autowired @Autowired
private AssortmentOpenPlatformPartnerStoreDeliveryConfigManager deliveryConfigManager; private AssortmentOpenPlatformPartnerStoreDeliveryConfigManager deliveryConfigManager;
// 缓存取用户数据用
// @Autowired
// private UserServiceImpl userService;
@Autowired @Autowired
private AssortmentCustomerInfoManager customerInfoManager; private AssortmentCustomerInfoManager customerInfoManager;
//门店SDK //门店SDK
...@@ -110,43 +95,23 @@ public class CheckOrder { ...@@ -110,43 +95,23 @@ public class CheckOrder {
//会员SDK //会员SDK
@Autowired @Autowired
private MemberCenterService memberCenterService; private MemberCenterService memberCenterService;
//会员SDK
// @Autowired
// private MemberPropertyService memberPropertyService;
@Autowired @Autowired
private CustomerPropertyClient customerPropertyClient; private CustomerPropertyClient customerPropertyClient;
@Autowired @Autowired
private ShoppingCartClient shoppingCartClient; private ShoppingCartClient shoppingCartClient;
// @Autowired
// private OrderAdapter orderAdapter;
@Autowired @Autowired
private StoreServiceImpl storeService; private StoreServiceImpl storeService;
@Autowired @Autowired
private CouponService couponService; private CouponService couponService;
private static Gson gson = new Gson();
@Autowired
private PaymentNewService paymentNewService;
@Autowired @Autowired
private OrderAdapter orderAdapter; private OrderAdapter orderAdapter;
@Autowired @Autowired
private OrderRelationFactory orderRelationFactory;
@Autowired
private DeliveryFeiginClient deliveryFeiginClient;
@Value("${coco.partnerId}")
private String cocoPartnerId;
@Autowired
private StoreBaseApiClient storeBaseApiClient; private StoreBaseApiClient storeBaseApiClient;
@Autowired
private StoreClient storeClient;
// 【华莱士】【订单C端记录不分账的卡面编号】不让走分账,卡面编号--11840,11845,11846,11853,11854,11855,11857,11858,11859,11860,11861,11862,11863,11864,11865,11866,11906 // 【华莱士】【订单C端记录不分账的卡面编号】不让走分账,卡面编号--11840,11845,11846,11853,11854,11855,11857,11858,11859,11860,11861,11862,11863,11864,11865,11866,11906
@Value("${card.pay.unDistribution.applyId:}") @Value("${card.pay.unDistribution.applyId:}")
private List<Integer> unDistributions; private List<Integer> unDistributions;
...@@ -162,11 +127,11 @@ public class CheckOrder { ...@@ -162,11 +127,11 @@ public class CheckOrder {
if (ObjectUtils.notEqual(baseResponse.getCode(), ResponseResult.SUCCESS.getCode())) { if (ObjectUtils.notEqual(baseResponse.getCode(), ResponseResult.SUCCESS.getCode())) {
return baseResponse; return baseResponse;
} }
// 查询用户信息校验svc卡,余额购物车校验 // 查询用户信息 校验svc卡,余额购物车校验
AssortmentCustomerInfoVo userLoginInfoDto = this.checkOrderByMember(createOrderVo); AssortmentCustomerInfoVo userLoginInfoDto = this.checkOrderByMember(createOrderVo);
createOrderBO.setUserLoginInfoDto(userLoginInfoDto); createOrderBO.setUserLoginInfoDto(userLoginInfoDto);
// 查询门店信息 营业时间营业状态,服务器当前时间在营业时间内 点餐桌号 // 查询门店信息 营业时间 营业状态,服务器当前时间在营业时间内 点餐桌号
StoreMixResponseDto storeMixResponseDto = this.checkOrderByStore(createOrderBO); StoreMixResponseDto storeMixResponseDto = this.checkOrderByStore(createOrderBO);
createOrderBO.setStoreMixResponseDto(storeMixResponseDto); createOrderBO.setStoreMixResponseDto(storeMixResponseDto);
StoreResponseDto storeInfo = storeMixResponseDto.getStoreInfo(); StoreResponseDto storeInfo = storeMixResponseDto.getStoreInfo();
...@@ -284,18 +249,18 @@ public class CheckOrder { ...@@ -284,18 +249,18 @@ public class CheckOrder {
/** /**
* 查询门店信息新接口 * 查询门店信息新接口
*/ */
public StoreMixResponseDto getStoreInfoNew(String partnerId, String shopId, StoreInfoRequestDto.QueryInfo query) { // public StoreMixResponseDto getStoreInfoNew(String partnerId, String shopId, StoreInfoRequestDto.QueryInfo query) {
// 获取门店信息 // // 获取门店信息
StoreInfoRequestDto request = new StoreInfoRequestDto(); // StoreInfoRequestDto request = new StoreInfoRequestDto();
request.setPartnerId(partnerId); // request.setPartnerId(partnerId);
request.setStoreCode(shopId); // request.setStoreCode(shopId);
request.setQuery(query); // request.setQuery(query);
StoreBaseResponseDto<StoreMixResponseDto> storeInfoNew = storeClient.getStoreInfoNew(request); // StoreBaseResponseDto<StoreMixResponseDto> storeInfoNew = storeClient.getStoreInfoNew(request);
if (storeInfoNew == null || storeInfoNew.getBizVO() == null) { // if (storeInfoNew == null || storeInfoNew.getBizVO() == null) {
throw new ServiceException(ResponseResult.STORE_NOT_FOUND); // throw new ServiceException(ResponseResult.STORE_NOT_FOUND);
} // }
return storeInfoNew.getBizVO(); // return storeInfoNew.getBizVO();
} // }
/** /**
* 下单门店相关校验 * 下单门店相关校验
...@@ -304,9 +269,12 @@ public class CheckOrder { ...@@ -304,9 +269,12 @@ public class CheckOrder {
CreateOrderVo createOrderVo = createOrderBO.getCreateOrderVo(); CreateOrderVo createOrderVo = createOrderBO.getCreateOrderVo();
String partnerId = createOrderVo.getPartnerId(); String partnerId = createOrderVo.getPartnerId();
String shopId = createOrderVo.getShopId(); String shopId = createOrderVo.getShopId();
Boolean queryDeliveryInfo = false;
if (CreateOrderType.TAKE_OUT.getCode().equals(createOrderVo.getOrderType())) {
queryDeliveryInfo = true;
}
// 获取门店信息 // 获取门店信息
StoreMixResponseDto storeMixResponseDto = storeService.getStoreInfoNew(partnerId, shopId, true); StoreMixResponseDto storeMixResponseDto = storeService.getStoreInfoNew(partnerId, shopId, true,queryDeliveryInfo);
createOrderBO.setStoreMixResponseDto(storeMixResponseDto); createOrderBO.setStoreMixResponseDto(storeMixResponseDto);
StoreResponseDto storeResponseDto = storeMixResponseDto.getStoreInfo(); StoreResponseDto storeResponseDto = storeMixResponseDto.getStoreInfo();
...@@ -330,29 +298,29 @@ public class CheckOrder { ...@@ -330,29 +298,29 @@ public class CheckOrder {
/** /**
* queryBusinessInfoNew * queryBusinessInfoNew
*/ */
public BusinessInfoDto queryBusinessInfoNew(CreateOrderVo createOrderVo) { // public BusinessInfoDto queryBusinessInfoNew(CreateOrderVo createOrderVo) {
String partnerId = createOrderVo.getPartnerId(); // String partnerId = createOrderVo.getPartnerId();
String shopId = createOrderVo.getShopId(); // String shopId = createOrderVo.getShopId();
//
// 获取门店信息 // // 获取门店信息
StoreMixResponseDto storeInfoNew = storeService.getStoreInfoNew(partnerId, shopId, true); // StoreMixResponseDto storeInfoNew = storeService.getStoreInfoNew(partnerId, shopId, true);
//
BusinessInfoDto businessInfo = storeInfoNew.getBusinessInfo(); // BusinessInfoDto businessInfo = storeInfoNew.getBusinessInfo();
return businessInfo; // return businessInfo;
} // }
/** // /**
* 调用该方法 需要自己判断 业务对象是否为null // * 调用该方法 需要自己判断 业务对象是否为null
* @param partnerId // * @param partnerId
* @param shopId // * @param shopId
* @param query // * @param query
* @return // * @return
*/ // */
public StoreMixResponseDto getStoremixDto(String partnerId, String shopId, StoreInfoRequestDto.QueryInfo query) { // public StoreMixResponseDto getStoremixDto(String partnerId, String shopId, StoreInfoRequestDto.QueryInfo query) {
// 获取门店信息 // // 获取门店信息
StoreMixResponseDto storeInfoNew = getStoreInfoNew(partnerId, shopId, query); // StoreMixResponseDto storeInfoNew = getStoreInfoNew(partnerId, shopId, query);
return storeInfoNew; // return storeInfoNew;
} // }
/** /**
* 下单订单类型校验 * 下单订单类型校验
...@@ -371,7 +339,6 @@ public class CheckOrder { ...@@ -371,7 +339,6 @@ public class CheckOrder {
throw new ServiceException(ResponseResult.PARAMETER_MISSING); throw new ServiceException(ResponseResult.PARAMETER_MISSING);
} }
// TODO: 2020/6/16 门店校验处理
// 取餐标识 -> 0 我已到店 1预约单 // 取餐标识 -> 0 我已到店 1预约单
String takeMealFlag = createOrderVo.getTakeMealFlag(); String takeMealFlag = createOrderVo.getTakeMealFlag();
// 取餐时间 // 取餐时间
...@@ -409,7 +376,7 @@ public class CheckOrder { ...@@ -409,7 +376,7 @@ public class CheckOrder {
String appId = userLoginInfoDto.getWxAppId(); String appId = userLoginInfoDto.getWxAppId();
AssortmentOpenPlatformIappWxappConfig config = openPlatformIappWxappConfigManager.selectIappWxappConfigByWxAppId(appId); AssortmentOpenPlatformIappWxappConfig config = openPlatformIappWxappConfigManager.selectIappWxappConfigByWxAppId(appId);
// 自提校验 // 自提校验
BusinessInfoDto businessInfoDto = null; BusinessInfoDto businessInfoDto = storeMixResponseDto.getBusinessInfo();
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);
...@@ -418,9 +385,9 @@ public class CheckOrder { ...@@ -418,9 +385,9 @@ public class CheckOrder {
throw new ServiceException(ResponseResult.STORE_NOT_ENABLE_COLLECT_GOODS); throw new ServiceException(ResponseResult.STORE_NOT_ENABLE_COLLECT_GOODS);
} }
//扫桌码下单开关判断 //扫桌码下单开关判断
businessInfoDto = this.queryBusinessInfoNew(createOrderVo); // businessInfoDto = storeMixResponseDto.getBusinessInfo();
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().toString())
&& StringUtils.isBlank(createOrderVo.getTableNumber())) { && StringUtils.isBlank(createOrderVo.getTableNumber())) {
throw new ServiceException(ResponseResult.ORDER_TABLE_BINDING_ERROR); throw new ServiceException(ResponseResult.ORDER_TABLE_BINDING_ERROR);
} }
...@@ -440,9 +407,9 @@ public class CheckOrder { ...@@ -440,9 +407,9 @@ public class CheckOrder {
} else { } else {
if (isAdvanceOrder) { if (isAdvanceOrder) {
//fisherman-ka 预定单校验是否在预计开业时间范围内, 2. 校验 营业结束前十分钟,不允许下预约单(上面有代码,可以复用) //fisherman-ka 预定单校验是否在预计开业时间范围内, 2. 校验 营业结束前十分钟,不允许下预约单(上面有代码,可以复用)
if (Objects.isNull(businessInfoDto)) { // if (Objects.isNull(businessInfoDto)) {
businessInfoDto = this.queryBusinessInfoNew(createOrderVo); // businessInfoDto = this.queryBusinessInfoNew(createOrderVo);
} // }
// 传递过来的时间格式为 : 2021-08-17 17:38 // 传递过来的时间格式为 : 2021-08-17 17:38
Date date = DateUtil.convert2Date(takeMealTimes, "yyyy-MM-dd HH:mm"); Date date = DateUtil.convert2Date(takeMealTimes, "yyyy-MM-dd HH:mm");
if (Objects.isNull(date)) { if (Objects.isNull(date)) {
...@@ -466,30 +433,8 @@ public class CheckOrder { ...@@ -466,30 +433,8 @@ public class CheckOrder {
throw new ServiceException(ResponseResult.STORE_ITEM_NOT_DELIVERY); throw new ServiceException(ResponseResult.STORE_ITEM_NOT_DELIVERY);
} }
//获取门店配送信息 //获取门店配送信息
StoreDeliveryInfoDto storeDeliveryInfoDto = null; StoreDeliveryInfoDto storeDeliveryInfoDto = getNewStoreDeliveryInfo(storeResponseDto, config);
if (storeDeliveryUseOld) { //coco自配送提前45分钟,禁止下单 代码已删除
storeDeliveryInfoDto = getStoreDeliveryInfo(storeResponseDto, config, appId);
} else {
storeDeliveryInfoDto = getNewStoreDeliveryInfo(appId,storeResponseDto, config);
}
//coco自配送提前45分钟,禁止下单
if (cocoPartnerId.equals(createOrderVo.getPartnerId()) &&
CreateOrderType.TAKE_OUT.getCode().equals(createOrderVo.getOrderType()) &&
"self".equals(storeDeliveryInfoDto.getDeliveryType())
) {
//即时单是下单时间,预约单是预约单时间
Date orderDate = createOrderVo.getExpectTime() != null
? DateUtil.convert2Date(createOrderVo.getExpectTime(), DateUtil.FORMAT_YYYY_MM_DD_HHMMSS)
: new Date();
Date todayEnd = DateUtil.setEndDay(new Date());
boolean toDay = orderDate.before(todayEnd);
BusinessDate businessDate = getStoreBusinessDate(storeResponseDto, toDay);
boolean businessEndDate = (DateUtils.addMinutes(orderDate, 45).compareTo(businessDate.getEndDate()) >= 0);
if (businessEndDate) {
throw new ServiceException(ResponseResult.STORE_SELF_ERROR);
}
}
//todo : 这里不再支持从表中获取门店配送信息 改用接口方式调用
//外卖起送条件(1:杯数,2:金额) //外卖起送条件(1:杯数,2:金额)
if (!Arrays.asList(1, 2).contains(storeDeliveryInfoDto.getDeliveryCondition())) { if (!Arrays.asList(1, 2).contains(storeDeliveryInfoDto.getDeliveryCondition())) {
throw new ServiceException(ResponseResult.STORE_DISCONTENT_DELIVERY_CONDITION); throw new ServiceException(ResponseResult.STORE_DISCONTENT_DELIVERY_CONDITION);
...@@ -501,14 +446,13 @@ public class CheckOrder { ...@@ -501,14 +446,13 @@ public class CheckOrder {
} }
} }
//订单金额小于起送费提示 //订单金额小于起送费提示
else if (2 == storeDeliveryInfoDto.getDeliveryCondition() else if (2 == storeDeliveryInfoDto.getDeliveryCondition()) {
&& !cocoPartnerId.contains(createOrderVo.getPartnerId())) {
// fisherman 【ID1037103】【野翠山】【B】外卖起送价规则取订单总金额 这特么用sdk就很吊, 得重新调用接口 // fisherman 【ID1037103】【野翠山】【B】外卖起送价规则取订单总金额 这特么用sdk就很吊, 得重新调用接口
// 先暂时这么写, 到时候需要优化这一块 对于门店的请求操作 // 先暂时这么写, 到时候需要优化这一块 对于门店的请求操作
StoreInfoRequestDto.QueryInfo query = new StoreInfoRequestDto.QueryInfo(); // StoreInfoRequestDto.QueryInfo query = new StoreInfoRequestDto.QueryInfo();
query.setQueryDeliveryInfo(Boolean.TRUE); // query.setQueryDeliveryInfo(Boolean.TRUE);
StoreMixResponseDto storemixDto = storeService.getStoremixDto(createOrderVo.getPartnerId(), createOrderVo.getShopId(), query); // StoreMixResponseDto storemixDto = storeService.getStoremixDto(createOrderVo.getPartnerId(), createOrderVo.getShopId(), query);
DeliveryInfoDTO deliveryInfo = storemixDto.getDeliveryInfo(); DeliveryInfoDTO deliveryInfo = storeMixResponseDto.getDeliveryInfo();
Long deliveryLimitAmount = storeDeliveryInfoDto.getDeliveryLimitAmount(); Long deliveryLimitAmount = storeDeliveryInfoDto.getDeliveryLimitAmount();
Long totalAmount = shoppingCartGoodsDto.getTotalAmount(); Long totalAmount = shoppingCartGoodsDto.getTotalAmount();
if (Objects.nonNull(deliveryInfo) && Objects.nonNull(deliveryInfo.getExpandFields())) { if (Objects.nonNull(deliveryInfo) && Objects.nonNull(deliveryInfo.getExpandFields())) {
...@@ -939,6 +883,7 @@ public class CheckOrder { ...@@ -939,6 +883,7 @@ public class CheckOrder {
/** /**
* 获取门店配送信息 * 获取门店配送信息
*/ */
@Deprecated
public StoreDeliveryInfoDto getStoreDeliveryInfo(StoreResponseDto storeResponseDto, public StoreDeliveryInfoDto getStoreDeliveryInfo(StoreResponseDto storeResponseDto,
AssortmentOpenPlatformIappWxappConfig openPlatformIappWxappConfig, String wxAppid) { AssortmentOpenPlatformIappWxappConfig openPlatformIappWxappConfig, String wxAppid) {
StoreDeliveryInfoDto storeDeliveryInfoDto = new StoreDeliveryInfoDto(); StoreDeliveryInfoDto storeDeliveryInfoDto = new StoreDeliveryInfoDto();
...@@ -977,26 +922,26 @@ public class CheckOrder { ...@@ -977,26 +922,26 @@ public class CheckOrder {
storeDeliveryInfoDto.setPushOrderTime(0); storeDeliveryInfoDto.setPushOrderTime(0);
} else { } else {
//如果是coco查询配送服务判断是平台配送还是自配送 //如果是coco查询配送服务判断是平台配送还是自配送
if (cocoPartnerId.equals(storeResponseDto.getPartnerId())) { // if (cocoPartnerId.equals(storeResponseDto.getPartnerId())) {
GetDeliveryFlagRequest getDeliveryFlagRequest = new GetDeliveryFlagRequest(); // GetDeliveryFlagRequest getDeliveryFlagRequest = new GetDeliveryFlagRequest();
getDeliveryFlagRequest.setPartnerId(storeResponseDto.getPartnerId()); // getDeliveryFlagRequest.setPartnerId(storeResponseDto.getPartnerId());
getDeliveryFlagRequest.setStoreId(storeResponseDto.getStoreId()); // getDeliveryFlagRequest.setStoreId(storeResponseDto.getStoreId());
DeliveryBaseResponse<GetDeliveryFlagResponseDto> deliveryBaseResponse = deliveryFeiginClient.getThirdDeliveryFlag(getDeliveryFlagRequest); // DeliveryBaseResponse<GetDeliveryFlagResponseDto> deliveryBaseResponse = deliveryFeiginClient.getThirdDeliveryFlag(getDeliveryFlagRequest);
if (deliveryBaseResponse.getCode() == 100 && deliveryBaseResponse.getData() != null && deliveryBaseResponse.getData().isThirdDeliveryFlag()) { // if (deliveryBaseResponse.getCode() == 100 && deliveryBaseResponse.getData() != null && deliveryBaseResponse.getData().isThirdDeliveryFlag()) {
storeDeliveryInfoDto.setDeliveryType("third"); // storeDeliveryInfoDto.setDeliveryType("third");
storeDeliveryInfoDto.setPushOrderTime(0); // storeDeliveryInfoDto.setPushOrderTime(0);
} else { // } else {
storeDeliveryInfoDto.setDeliveryType("self"); // storeDeliveryInfoDto.setDeliveryType("self");
storeDeliveryInfoDto.setPushOrderTime(0); // storeDeliveryInfoDto.setPushOrderTime(0);
} // }
} else { // } else {
if (ObjectUtils.equals(openPlatformIappWxappConfig.getTakeType(), 1)) { if (ObjectUtils.equals(openPlatformIappWxappConfig.getTakeType(), 1)) {
storeDeliveryInfoDto.setDeliveryType("self"); storeDeliveryInfoDto.setDeliveryType("self");
storeDeliveryInfoDto.setPushOrderTime(0); storeDeliveryInfoDto.setPushOrderTime(0);
} else { } else {
storeDeliveryInfoDto.setDeliveryType("third"); storeDeliveryInfoDto.setDeliveryType("third");
storeDeliveryInfoDto.setPushOrderTime(0); storeDeliveryInfoDto.setPushOrderTime(0);
} // }
} }
} }
return storeDeliveryInfoDto; return storeDeliveryInfoDto;
...@@ -1005,7 +950,7 @@ public class CheckOrder { ...@@ -1005,7 +950,7 @@ public class CheckOrder {
/** /**
* 获取门店配送信息 * 获取门店配送信息
*/ */
public StoreDeliveryInfoDto getNewStoreDeliveryInfo(String wxAppid,StoreResponseDto storeResponseDto, public StoreDeliveryInfoDto getNewStoreDeliveryInfo(StoreResponseDto storeResponseDto,
AssortmentOpenPlatformIappWxappConfig openPlatformIappWxappConfig) { AssortmentOpenPlatformIappWxappConfig openPlatformIappWxappConfig) {
String trackingNo = LogThreadLocal.getTrackingNo(); String trackingNo = LogThreadLocal.getTrackingNo();
StoreDeliveryInfoDto storeDeliveryInfoDto = new StoreDeliveryInfoDto(); StoreDeliveryInfoDto storeDeliveryInfoDto = new StoreDeliveryInfoDto();
...@@ -1037,28 +982,28 @@ public class CheckOrder { ...@@ -1037,28 +982,28 @@ public class CheckOrder {
} else { } else {
storeDeliveryInfoDto.setDeliveryRadius(0); storeDeliveryInfoDto.setDeliveryRadius(0);
} }
// 只有小程序设置了外卖,并且开通了第三方配送账户,才是第三方配送单 // 只有小程序设置了外卖,并且开通了第三方配送账户,才是第三方配送单 不可能为空,调用地方已查
if (openPlatformIappWxappConfig == null) { // if (openPlatformIappWxappConfig == null) {
openPlatformIappWxappConfig = openPlatformIappWxappConfigManager.selectIappWxappConfigByWxAppId(wxAppid); // openPlatformIappWxappConfig = openPlatformIappWxappConfigManager.selectIappWxappConfigByWxAppId(wxAppid);
} // }
if (openPlatformIappWxappConfig == null) { if (openPlatformIappWxappConfig == null) {
storeDeliveryInfoDto.setDeliveryType("self"); storeDeliveryInfoDto.setDeliveryType("self");
storeDeliveryInfoDto.setPushOrderTime(0); storeDeliveryInfoDto.setPushOrderTime(0);
} else { } else {
//如果是coco查询配送服务判断是平台配送还是自配送 //如果是coco查询配送服务判断是平台配送还是自配送
if (cocoPartnerId.equals(storeResponseDto.getPartnerId())) { // if (cocoPartnerId.equals(storeResponseDto.getPartnerId())) {
GetDeliveryFlagRequest getDeliveryFlagRequest = new GetDeliveryFlagRequest(); // GetDeliveryFlagRequest getDeliveryFlagRequest = new GetDeliveryFlagRequest();
getDeliveryFlagRequest.setPartnerId(storeResponseDto.getPartnerId()); // getDeliveryFlagRequest.setPartnerId(storeResponseDto.getPartnerId());
getDeliveryFlagRequest.setStoreId(storeResponseDto.getStoreId()); // getDeliveryFlagRequest.setStoreId(storeResponseDto.getStoreId());
DeliveryBaseResponse<GetDeliveryFlagResponseDto> deliveryBaseResponse = deliveryFeiginClient.getThirdDeliveryFlag(getDeliveryFlagRequest); // DeliveryBaseResponse<GetDeliveryFlagResponseDto> deliveryBaseResponse = deliveryFeiginClient.getThirdDeliveryFlag(getDeliveryFlagRequest);
if (deliveryBaseResponse.getCode() == 100 && deliveryBaseResponse.getData() != null && deliveryBaseResponse.getData().isThirdDeliveryFlag()) { // if (deliveryBaseResponse.getCode() == 100 && deliveryBaseResponse.getData() != null && deliveryBaseResponse.getData().isThirdDeliveryFlag()) {
storeDeliveryInfoDto.setDeliveryType("third"); // storeDeliveryInfoDto.setDeliveryType("third");
storeDeliveryInfoDto.setPushOrderTime(0); // storeDeliveryInfoDto.setPushOrderTime(0);
} else { // } else {
storeDeliveryInfoDto.setDeliveryType("self"); // storeDeliveryInfoDto.setDeliveryType("self");
storeDeliveryInfoDto.setPushOrderTime(0); // storeDeliveryInfoDto.setPushOrderTime(0);
} // }
} else { // } else {
if (ObjectUtils.equals(openPlatformIappWxappConfig.getTakeType(), 1)) { if (ObjectUtils.equals(openPlatformIappWxappConfig.getTakeType(), 1)) {
storeDeliveryInfoDto.setDeliveryType("self"); storeDeliveryInfoDto.setDeliveryType("self");
storeDeliveryInfoDto.setPushOrderTime(0); storeDeliveryInfoDto.setPushOrderTime(0);
...@@ -1066,7 +1011,7 @@ public class CheckOrder { ...@@ -1066,7 +1011,7 @@ public class CheckOrder {
storeDeliveryInfoDto.setDeliveryType("third"); storeDeliveryInfoDto.setDeliveryType("third");
storeDeliveryInfoDto.setPushOrderTime(0); storeDeliveryInfoDto.setPushOrderTime(0);
} }
} // }
} }
storeDeliveryInfoDto.setDeliveryCondition(deliveryDetail.getDeliveryType()); storeDeliveryInfoDto.setDeliveryCondition(deliveryDetail.getDeliveryType());
storeDeliveryInfoDto.setFreeDeliveryCup(deliveryDetail.getFreeDeliveryCup()); storeDeliveryInfoDto.setFreeDeliveryCup(deliveryDetail.getFreeDeliveryCup());
...@@ -1110,14 +1055,26 @@ public class CheckOrder { ...@@ -1110,14 +1055,26 @@ public class CheckOrder {
throw new ServiceException(ResponseResult.USER_GETRECEIVEADDRESS_ERROR); throw new ServiceException(ResponseResult.USER_GETRECEIVEADDRESS_ERROR);
} }
QueryReceiveAddressResponse receiveAddressResult = queryReceiveAddressResponse.getData(); QueryReceiveAddressResponse receiveAddressResult = queryReceiveAddressResponse.getData();
UserDeliveryInfoDto userDeliveryInfoDto = storeService.getUserDeliveryInfo(storeDeliveryInfoDto, receiveAddressResult.getLongitude(),
receiveAddressResult.getLatitude()); //组装代码移出来了
if (!userDeliveryInfoDto.getUserEnableTakeaway()) { UserDeliveryInfoDto userDeliveryInfoDto = UserDeliveryInfoDto.builder()
throw new ServiceException(ResponseResult.ORDER_TAKE_OUT_ADDRESS_NOT_DELIVERY); .userLongitude(receiveAddressResult.getLongitude())
} .userLatitude(receiveAddressResult.getLatitude())
.deliveryLimitAmount(storeDeliveryInfoDto.getDeliveryLimitAmount())
.userEnableTakeaway(true)
.realDeliveryAmount(0L)
.storeId(storeDeliveryInfoDto.getStoreId())
.storeName(storeDeliveryInfoDto.getStoreName())
.storeDeliveryInfoDto(storeDeliveryInfoDto).build();
// if (!userDeliveryInfoDto.getUserEnableTakeaway()) {
// throw new ServiceException(ResponseResult.ORDER_TAKE_OUT_ADDRESS_NOT_DELIVERY);
// }
if (BusinessTypeEnum.SAAS_DELIVERY.getCode().equals(createOrderVo.getMenuType())) { if (BusinessTypeEnum.SAAS_DELIVERY.getCode().equals(createOrderVo.getMenuType())) {
String s = this.checkDeliveryType(createOrderVo, storeCode, trackingNo); /**
userDeliveryInfoDto.getStoreDeliveryInfoDto().setDeliveryType(s); * @see StoreDeliveryMethod
*/
String deliveryTypeCode = this.checkDeliveryType(createOrderVo, storeCode, trackingNo);
userDeliveryInfoDto.getStoreDeliveryInfoDto().setDeliveryType(deliveryTypeCode);
// 【ID1030916】订单查询门店获取预计送达时间 并且不是预约单 // 【ID1030916】订单查询门店获取预计送达时间 并且不是预约单
if (StringUtils.isEmpty(createOrderVo.getExpectTime()) if (StringUtils.isEmpty(createOrderVo.getExpectTime())
......
...@@ -199,7 +199,7 @@ public class SellCouponOrderServiceImpl implements OrderFactoryService { ...@@ -199,7 +199,7 @@ public class SellCouponOrderServiceImpl implements OrderFactoryService {
} }
String storeId = wxAppStore.getStoreId(); String storeId = wxAppStore.getStoreId();
// 获取门店信息 // 获取门店信息
StoreMixResponseDto storeMixResponseDto = storeService.getStoreInfoNew(partnerId, storeId, false); StoreMixResponseDto storeMixResponseDto = storeService.getStoreInfoNew(partnerId, storeId, false,false);
if (storeMixResponseDto == null || storeMixResponseDto.getStoreInfo() == null) { if (storeMixResponseDto == null || storeMixResponseDto.getStoreInfo() == null) {
throw new ServiceException(ResponseResult.STORE_NOT_FOUND); throw new ServiceException(ResponseResult.STORE_NOT_FOUND);
} }
...@@ -311,7 +311,7 @@ public class SellCouponOrderServiceImpl implements OrderFactoryService { ...@@ -311,7 +311,7 @@ public class SellCouponOrderServiceImpl implements OrderFactoryService {
return ResponseUtil.error(ResponseResult.PAY_SVC_CONFIG_ERROR); return ResponseUtil.error(ResponseResult.PAY_SVC_CONFIG_ERROR);
} }
// 获取门店信息 // 获取门店信息
StoreMixResponseDto storeMixResponseDto = storeService.getStoreInfoNew(partnerId, storeId, false); StoreMixResponseDto storeMixResponseDto = storeService.getStoreInfoNew(partnerId, storeId, false,false);
if (storeMixResponseDto == null || storeMixResponseDto.getStoreInfo() == null) { if (storeMixResponseDto == null || storeMixResponseDto.getStoreInfo() == null) {
throw new ServiceException(ResponseResult.STORE_NOT_FOUND); throw new ServiceException(ResponseResult.STORE_NOT_FOUND);
} }
......
...@@ -11,6 +11,7 @@ import cn.freemud.enums.ScopeConfigType; ...@@ -11,6 +11,7 @@ import cn.freemud.enums.ScopeConfigType;
import cn.freemud.interceptor.ServiceException; import cn.freemud.interceptor.ServiceException;
import cn.freemud.redis.RedisCache; import cn.freemud.redis.RedisCache;
import cn.freemud.service.StoreService; import cn.freemud.service.StoreService;
import cn.freemud.service.store.StoreManager;
import cn.freemud.service.thirdparty.StoreClient; import cn.freemud.service.thirdparty.StoreClient;
import cn.freemud.utils.SpringBeanUtil; import cn.freemud.utils.SpringBeanUtil;
import cn.freemud.utils.WebUtil; import cn.freemud.utils.WebUtil;
...@@ -42,6 +43,9 @@ public class StoreServiceImpl implements StoreService { ...@@ -42,6 +43,9 @@ public class StoreServiceImpl implements StoreService {
@Autowired @Autowired
private RedisCache redisCache; private RedisCache redisCache;
@Autowired
private StoreManager storeManager;
/** /**
...@@ -63,14 +67,15 @@ public class StoreServiceImpl implements StoreService { ...@@ -63,14 +67,15 @@ public class StoreServiceImpl implements StoreService {
/** /**
* 查询门店信息新接口 * 查询门店信息新接口
*/ */
public StoreMixResponseDto getStoreInfoNew(String partnerId, String shopId, Boolean queryBusinessInfo) { public StoreMixResponseDto getStoreInfoNew(String partnerId, String shopId, Boolean queryBusinessInfo,Boolean queryDeliveryInfo) {
// 获取门店信息 // 获取门店信息
StoreInfoRequestDto request = new StoreInfoRequestDto(); StoreInfoRequestDto request = new StoreInfoRequestDto();
request.setPartnerId(partnerId); request.setPartnerId(partnerId);
request.setStoreCode(shopId); request.setStoreCode(shopId);
StoreInfoRequestDto.QueryInfo query = new StoreInfoRequestDto.QueryInfo(); StoreInfoRequestDto.QueryInfo query = new StoreInfoRequestDto.QueryInfo();
// query.setQueryStoreInfo(true); query.setQueryStoreInfo(true);
query.setQueryBusinessInfo(queryBusinessInfo); query.setQueryBusinessInfo(queryBusinessInfo);
query.setQueryDeliveryInfo(queryDeliveryInfo);
request.setQuery(query); request.setQuery(query);
StoreBaseResponseDto<StoreMixResponseDto> storeInfoNew = storeClient.getStoreInfoNew(request); StoreBaseResponseDto<StoreMixResponseDto> storeInfoNew = storeClient.getStoreInfoNew(request);
...@@ -134,8 +139,8 @@ public class StoreServiceImpl implements StoreService { ...@@ -134,8 +139,8 @@ public class StoreServiceImpl implements StoreService {
.userLongitude(userLongitude) .userLongitude(userLongitude)
.userLatitude(userLatitude) .userLatitude(userLatitude)
.deliveryLimitAmount(storeDeliveryInfoDto.getDeliveryLimitAmount()) .deliveryLimitAmount(storeDeliveryInfoDto.getDeliveryLimitAmount())
.userEnableTakeaway(checkUserEnableDelivery(storeDeliveryInfoDto, userLongitude, userLatitude)) .userEnableTakeaway(true)
.realDeliveryAmount(getUserRealDeliveryAmount(storeDeliveryInfoDto, userLongitude, userLatitude)) .realDeliveryAmount(0L)
.storeId(storeDeliveryInfoDto.getStoreId()) .storeId(storeDeliveryInfoDto.getStoreId())
.storeName(storeDeliveryInfoDto.getStoreName()) .storeName(storeDeliveryInfoDto.getStoreName())
.storeDeliveryInfoDto(storeDeliveryInfoDto).build(); .storeDeliveryInfoDto(storeDeliveryInfoDto).build();
...@@ -193,9 +198,9 @@ public class StoreServiceImpl implements StoreService { ...@@ -193,9 +198,9 @@ public class StoreServiceImpl implements StoreService {
* @return * @return
*/ */
public Long getUserRealDeliveryAmount(StoreDeliveryInfoDto storeDeliveryInfoDto, String userLongitude, String userLatitude) { public Long getUserRealDeliveryAmount(StoreDeliveryInfoDto storeDeliveryInfoDto, String userLongitude, String userLatitude) {
if (!checkUserEnableDelivery(storeDeliveryInfoDto, userLongitude, userLatitude)) { // if (!checkUserEnableDelivery(storeDeliveryInfoDto, userLongitude, userLatitude)) {
return 0L; // return 0L;
} // }
// TODO 用户收货地址距离门店距离 单位米 如果门店没有设置阶层配送费,配送费默认=基础配送费 // TODO 用户收货地址距离门店距离 单位米 如果门店没有设置阶层配送费,配送费默认=基础配送费
if (storeDeliveryInfoDto.getAddRangeCount() == null || storeDeliveryInfoDto.getAddRangeCount() <= 0) { if (storeDeliveryInfoDto.getAddRangeCount() == null || storeDeliveryInfoDto.getAddRangeCount() <= 0) {
return storeDeliveryInfoDto.getDeliveryAmount(); return storeDeliveryInfoDto.getDeliveryAmount();
......
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