Commit ca618c19 by 张洪旺

Merge branch '20200806-10000' of gitlab.freemud.com:order-group-application/order-group

# 请输入一个提交信息以解释此合并的必要性,尤其是将一个更新后的上游分支
# 合并到主题分支。
#
# 以 '#' 开头的行将被忽略,而且空提交说明将会终止提交。
parent 96c82dc0
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
<dependency> <dependency>
<groupId>com.freemud.application.service.sdk</groupId> <groupId>com.freemud.application.service.sdk</groupId>
<artifactId>storecenter-sdk</artifactId> <artifactId>storecenter-sdk</artifactId>
<version>3.1.1.RELEASE</version> <version>3.2.1-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>cn.freemud</groupId> <groupId>cn.freemud</groupId>
......
...@@ -102,7 +102,7 @@ public class CreateOrderVo { ...@@ -102,7 +102,7 @@ public class CreateOrderVo {
private String expectTime; private String expectTime;
/** /**
* 取餐标识 0=我已到店、尽快送出 * 取餐标识 0=我已到店、尽快送出 1预约单
*/ */
private String takeMealFlag; private String takeMealFlag;
/** /**
......
...@@ -61,6 +61,8 @@ public enum ResponseResult { ...@@ -61,6 +61,8 @@ public enum ResponseResult {
STORE_BIND_MALL_NOT_FOUND("43014", "商城门店存在"), STORE_BIND_MALL_NOT_FOUND("43014", "商城门店存在"),
STORE_DISCONTENT_DELIVERY_CONDITION("43015", "门店起送条件设置错误"), STORE_DISCONTENT_DELIVERY_CONDITION("43015", "门店起送条件设置错误"),
STORE_DISCONTENT_DELIVERY_CUP("43016", "不满足起送杯数"), STORE_DISCONTENT_DELIVERY_CUP("43016", "不满足起送杯数"),
STORE_MAKE_AN_APPOINTMENT_STOP_BUSINESS("43017", "预约失败,请重新下单"),
STORE_MAKE_AN_APPOINTMENT_OPEN_BUSINESS("43018", "门店不支持预约,请重新选择"),
/** /**
* 购物车状态码 * 购物车状态码
......
package cn.freemud.service.adapter;
import cn.freemud.enums.ResponseResult;
import cn.freemud.interceptor.ServiceException;
import com.freemud.application.sdk.api.storecenter.response.StoreResponse;
import java.util.Objects;
public abstract class AbstractOrderCheck implements OrderCheck {
/**
* 校验门店状态
* @param bizVO
*/
void doStoreStateCheck(StoreResponse.BizVO bizVO) {
// 校验门店是否停业 1 营业 2 停业 3 繁忙置休
if (!Objects.equals(bizVO.getState(), "1")) {
throw new ServiceException(ResponseResult.STORE_MAKE_AN_APPOINTMENT_STOP_BUSINESS);
// 营业
} else {
throw new ServiceException(ResponseResult.STORE_MAKE_AN_APPOINTMENT_OPEN_BUSINESS);
}
}
}
package cn.freemud.service.adapter;
import cn.freemud.entities.vo.CreateOrderVo;
import cn.freemud.enums.CreateOrderType;
import cn.freemud.interceptor.ServiceException;
import com.freemud.application.sdk.api.storecenter.response.StoreResponse;
/**
* 订单检查
*/
public interface OrderCheck {
/***
* 是否匹配
* @param orderType {@link CreateOrderType}
* @return
*/
boolean support(int orderType);
/**
* 检查
* @param vo
* @param storeResponse
*/
void check(CreateOrderVo vo, StoreResponse storeResponse) throws ServiceException;
}
package cn.freemud.service.adapter;
import cn.freemud.entities.vo.CreateOrderVo;
import cn.freemud.enums.ResponseResult;
import cn.freemud.interceptor.ServiceException;
import com.freemud.application.sdk.api.storecenter.response.StoreResponse;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import java.util.ArrayList;
import java.util.Objects;
/**
* 订单校验
*/
@Slf4j
public class OrderCheckAdapter {
static ArrayList<OrderCheck> orderCheckList = Lists.newArrayList(new ToStoreCheck(), new TakeOutOrderCheck());
/***
* 校验预约单门店数据
* @param vo
* @param storeResponse
* @throws ServiceException 抛出异常校验异常数据
*/
public static void check(CreateOrderVo vo, StoreResponse storeResponse) throws ServiceException {
//非预约单的过滤
if (Objects.isNull(vo.getOrderType()) ||
(!Objects.equals(vo.getTakeMealFlag(), "1"))) {
return;
}
StoreResponse.Configuration configuration = storeResponse.getBizVO().getStoreConfig();
log.info("门店:{},外卖预约单状态:{},自提预约单状态:{}", vo.getShopId(), configuration.getDeliveryAppoint(), configuration.getSelfMentionSwitch());
for (OrderCheck orderCheck : orderCheckList) {
if (orderCheck.support(vo.getOrderType())) {
orderCheck.check(vo, storeResponse);
return;
}
}
}
}
package cn.freemud.service.adapter;
import cn.freemud.entities.vo.CreateOrderVo;
import cn.freemud.enums.CreateOrderType;
import com.freemud.application.sdk.api.storecenter.response.StoreResponse;
import java.util.Objects;
/**
* 外卖订单检查
*/
public class TakeOutOrderCheck extends AbstractOrderCheck {
@Override
public boolean support(int orderType) {
return CreateOrderType.TAKE_OUT.getCode() == orderType;
}
@Override
public void check(CreateOrderVo vo, StoreResponse storeResponse) {
StoreResponse.BizVO bizVO = storeResponse.getBizVO();
StoreResponse.Configuration storeConfig = bizVO.getStoreConfig();
// 关闭预约单
if (Objects.equals(storeConfig.getDeliveryAppoint(), 0)) {
super.doStoreStateCheck(bizVO);
}
}
}
package cn.freemud.service.adapter;
import cn.freemud.entities.vo.CreateOrderVo;
import cn.freemud.enums.CreateOrderType;
import com.freemud.application.sdk.api.storecenter.response.StoreResponse;
import java.util.Objects;
/**
* 到店订单检查
*/
public class ToStoreCheck extends AbstractOrderCheck {
@Override
public boolean support(int orderType) {
return CreateOrderType.COLLECT_GOODS.getCode() == orderType;
}
@Override
public void check(CreateOrderVo vo, StoreResponse storeResponse) {
StoreResponse.BizVO bizVO = storeResponse.getBizVO();
StoreResponse.Configuration storeConfig = bizVO.getStoreConfig();
// 关闭预约单
if (Objects.equals(storeConfig.getSelfMentionSwitch(), 0)) {
super.doStoreStateCheck(bizVO);
}
}
}
...@@ -31,6 +31,7 @@ import cn.freemud.manager.OpenPlatformIappWxappConfigManager; ...@@ -31,6 +31,7 @@ import cn.freemud.manager.OpenPlatformIappWxappConfigManager;
import cn.freemud.manager.OpenPlatformPartnerStoreDeliveryConfigManager; import cn.freemud.manager.OpenPlatformPartnerStoreDeliveryConfigManager;
import cn.freemud.manager.StoreTableNumberManager; 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.thirdparty.ShoppingCartClient; import cn.freemud.service.thirdparty.ShoppingCartClient;
import cn.freemud.service.thirdparty.StockClient; import cn.freemud.service.thirdparty.StockClient;
import cn.freemud.utils.LogUtil; import cn.freemud.utils.LogUtil;
...@@ -109,6 +110,7 @@ public class CheckOrder { ...@@ -109,6 +110,7 @@ public class CheckOrder {
@Autowired @Autowired
private CouponService couponService; private CouponService couponService;
private static Gson gson = new Gson(); private static Gson gson = new Gson();
/** /**
* 下单会员相关校验 * 下单会员相关校验
*/ */
...@@ -120,7 +122,7 @@ public class CheckOrder { ...@@ -120,7 +122,7 @@ public class CheckOrder {
throw new ServiceException(ResponseResult.NOT_LOGIN); throw new ServiceException(ResponseResult.NOT_LOGIN);
} }
//校验会员svc卡信息 //校验会员svc卡信息
checkCardCode(createOrderVo.getPartnerId(),userLoginInfoDto.getMemberId(),createOrderVo.getCardCode()); checkCardCode(createOrderVo.getPartnerId(), userLoginInfoDto.getMemberId(), createOrderVo.getCardCode());
createOrderVo.setUserId(userLoginInfoDto.getMemberId()); createOrderVo.setUserId(userLoginInfoDto.getMemberId());
return userLoginInfoDto; return userLoginInfoDto;
...@@ -134,7 +136,7 @@ public class CheckOrder { ...@@ -134,7 +136,7 @@ public class CheckOrder {
throw new ServiceException(ResponseResult.NOT_LOGIN); throw new ServiceException(ResponseResult.NOT_LOGIN);
} }
//校验会员svc卡信息 //校验会员svc卡信息
checkCardCode(userLoginInfoDto.getPartnerId(),userLoginInfoDto.getMemberId(),cardCode); checkCardCode(userLoginInfoDto.getPartnerId(), userLoginInfoDto.getMemberId(), cardCode);
return userLoginInfoDto; return userLoginInfoDto;
} }
...@@ -143,7 +145,7 @@ public class CheckOrder { ...@@ -143,7 +145,7 @@ public class CheckOrder {
*/ */
public StoreResponse getStoreInfo(String partnerId, String shopId, String trackingNo) { public StoreResponse getStoreInfo(String partnerId, String shopId, String trackingNo) {
// 获取门店信息 // 获取门店信息
StoreInfoRequest storeInfoRequest = new StoreInfoRequest(partnerId, shopId,null); StoreInfoRequest storeInfoRequest = new StoreInfoRequest(partnerId, shopId, null);
return storeCenterService.getStoreInfo(storeInfoRequest, trackingNo); return storeCenterService.getStoreInfo(storeInfoRequest, trackingNo);
} }
...@@ -159,6 +161,9 @@ public class CheckOrder { ...@@ -159,6 +161,9 @@ public class CheckOrder {
if (storeResponse == null || storeResponse.getBizVO() == null) { if (storeResponse == null || storeResponse.getBizVO() == null) {
throw new ServiceException(ResponseResult.STORE_NOT_FOUND); throw new ServiceException(ResponseResult.STORE_NOT_FOUND);
} }
//订单预约单检查
OrderCheckAdapter.check(createOrderVo, storeResponse);
StoreResponse.BizVO storeResponseDto = storeResponse.getBizVO(); StoreResponse.BizVO storeResponseDto = storeResponse.getBizVO();
// 校验门店是否停业 1 营业 2 停业 3 繁忙置休 // 校验门店是否停业 1 营业 2 停业 3 繁忙置休
if (storeResponseDto.getActiveFlag() == null || storeResponseDto.getActiveFlag() != 1) { if (storeResponseDto.getActiveFlag() == null || storeResponseDto.getActiveFlag() != 1) {
...@@ -186,25 +191,25 @@ public class CheckOrder { ...@@ -186,25 +191,25 @@ public class CheckOrder {
String takeMealTimes = createOrderVo.getTakeMealTime(); String takeMealTimes = createOrderVo.getTakeMealTime();
//立即送达 //立即送达
if("0".equals(takeMealFlag) || (StringUtils.isEmpty(createOrderVo.getExpectTime()) && StringUtils.isEmpty(takeMealTimes))) { if ("0".equals(takeMealFlag) || (StringUtils.isEmpty(createOrderVo.getExpectTime()) && StringUtils.isEmpty(takeMealTimes))) {
//未营业无预约时间无法下单 //未营业无预约时间无法下单
if (!StoreConstant.BUSINESS.equals(storeResponseDto.getState())) { if (!StoreConstant.BUSINESS.equals(storeResponseDto.getState())) {
throw new ServiceException(ResponseResult.STORE_ITEM_CHECK_CLOSE); throw new ServiceException(ResponseResult.STORE_ITEM_CHECK_CLOSE);
} }
// 外卖单选择立即送达的话,下单时间必须在店铺外卖时间内 // 外卖单选择立即送达的话,下单时间必须在店铺外卖时间内
if(createOrderVo.getOrderType().compareTo(CreateOrderType.TAKE_OUT.getCode()) == 0) { if (createOrderVo.getOrderType().compareTo(CreateOrderType.TAKE_OUT.getCode()) == 0) {
checkTakeOutTime(storeResponseDto, new Date(), new Date(), true); checkTakeOutTime(storeResponseDto, new Date(), new Date(), true);
} }
} }
//有预约时间 //有预约时间
if(StringUtils.isNotBlank(takeMealTimes) || StringUtils.isNotBlank(createOrderVo.getExpectTime())){ if (StringUtils.isNotBlank(takeMealTimes) || StringUtils.isNotBlank(createOrderVo.getExpectTime())) {
// 设置预约时间 // 设置预约时间
Date takeMealDateTime = getOrderExpectTime(takeMealFlag,takeMealTimes,createOrderVo.getExpectTime(), Date takeMealDateTime = getOrderExpectTime(takeMealFlag, takeMealTimes, createOrderVo.getExpectTime(),
CreateOrderType.getByCode(createOrderVo.getOrderType()),storeResponseDto.getServiceTime(),storeResponseDto); CreateOrderType.getByCode(createOrderVo.getOrderType()), storeResponseDto.getServiceTime(), storeResponseDto);
if(takeMealDateTime != null){ if (takeMealDateTime != null) {
//校验预约时间 //校验预约时间
checkOrderExpectTime(createOrderVo,storeResponseDto,takeMealDateTime); checkOrderExpectTime(createOrderVo, storeResponseDto, takeMealDateTime);
//重新赋值为yyyy-MM-dd HH:mm:ss格式字符串时间 //重新赋值为yyyy-MM-dd HH:mm:ss格式字符串时间
createOrderVo.setExpectTime(DateUtil.convert2String(takeMealDateTime, "yyyy-MM-dd HH:mm:ss")); createOrderVo.setExpectTime(DateUtil.convert2String(takeMealDateTime, "yyyy-MM-dd HH:mm:ss"));
} }
...@@ -324,9 +329,10 @@ public class CheckOrder { ...@@ -324,9 +329,10 @@ public class CheckOrder {
/** /**
* 检验订单是否在外卖时间内 * 检验订单是否在外卖时间内
* @param storeResponseDto 店铺信息 *
* @param now 当前时间 * @param storeResponseDto 店铺信息
* @param takeMealDateTime 预约单送达时间/即时单下单时间 * @param now 当前时间
* @param takeMealDateTime 预约单送达时间/即时单下单时间
* @param expectTimeInTodayBusinessTime 是否在当日营业时间内 * @param expectTimeInTodayBusinessTime 是否在当日营业时间内
*/ */
private void checkTakeOutTime(StoreResponse.BizVO storeResponseDto, Date now, Date takeMealDateTime, boolean expectTimeInTodayBusinessTime) { private void checkTakeOutTime(StoreResponse.BizVO storeResponseDto, Date now, Date takeMealDateTime, boolean expectTimeInTodayBusinessTime) {
...@@ -362,8 +368,8 @@ public class CheckOrder { ...@@ -362,8 +368,8 @@ public class CheckOrder {
} }
} }
public Date getOrderExpectTime(String takeMealFlag,String takeMealTimes,String expectTime, public Date getOrderExpectTime(String takeMealFlag, String takeMealTimes, String expectTime,
CreateOrderType createOrderType,Integer serviceTime,StoreResponse.BizVO storeResponseDto){ CreateOrderType createOrderType, Integer serviceTime, StoreResponse.BizVO storeResponseDto) {
Date takeMealDateTime = null; Date takeMealDateTime = null;
//0=到店单我已到店、外卖单尽快送出 //0=到店单我已到店、外卖单尽快送出
if (StringUtils.isNotBlank(takeMealFlag) && "0".equals(takeMealFlag)) { if (StringUtils.isNotBlank(takeMealFlag) && "0".equals(takeMealFlag)) {
...@@ -374,7 +380,7 @@ public class CheckOrder { ...@@ -374,7 +380,7 @@ public class CheckOrder {
} }
//兼容门店隔日预约单格式修改,HH:mm变yyyy-MM-dd HH:mm,前端未升级,未按要求传 //兼容门店隔日预约单格式修改,HH:mm变yyyy-MM-dd HH:mm,前端未升级,未按要求传
if (StringUtils.isNotBlank(takeMealTimes) && takeMealTimes.length() > 5) { if (StringUtils.isNotBlank(takeMealTimes) && takeMealTimes.length() > 5) {
expectTime = takeMealTimes+":00"; expectTime = takeMealTimes + ":00";
} }
Date date = new Date(); Date date = new Date();
...@@ -384,21 +390,21 @@ public class CheckOrder { ...@@ -384,21 +390,21 @@ public class CheckOrder {
takeMealTime = takeMealTime.append(DateUtil.convert2String(date, "yyyy-MM-dd")) takeMealTime = takeMealTime.append(DateUtil.convert2String(date, "yyyy-MM-dd"))
.append(" ").append(takeMealTimes).append(":00"); .append(" ").append(takeMealTimes).append(":00");
takeMealDateTime = DateUtil.convert2Date(takeMealTime.toString(), "yyyy-MM-dd HH:mm:ss"); takeMealDateTime = DateUtil.convert2Date(takeMealTime.toString(), "yyyy-MM-dd HH:mm:ss");
Date newDate = DateUtil.convert2Date(date,DateUtil.FORMAT_yyyyMMdd_date); Date newDate = DateUtil.convert2Date(date, DateUtil.FORMAT_yyyyMMdd_date);
newDate = DateUtil.addDays(newDate,1); newDate = DateUtil.addDays(newDate, 1);
//获取门店当天营业结束时间 //获取门店当天营业结束时间
Date todayEndDate =null; Date todayEndDate = null;
List<String> todayBusinessTimes = storeCenterService.getTodayBusinessTime(Integer.parseInt(storeResponseDto.getBusinessType()), storeResponseDto.getBusinessHoursDay()); List<String> todayBusinessTimes = storeCenterService.getTodayBusinessTime(Integer.parseInt(storeResponseDto.getBusinessType()), storeResponseDto.getBusinessHoursDay());
if(CollectionUtils.isEmpty(todayBusinessTimes)){ if (CollectionUtils.isEmpty(todayBusinessTimes)) {
throw new ServiceException(ResponseResult.STORE_BUSINESS_HOUR_ERROR); throw new ServiceException(ResponseResult.STORE_BUSINESS_HOUR_ERROR);
} }
BusinessDate businessDate = getStoreBusinessDate(todayBusinessTimes.get(todayBusinessTimes.size()-1),true); BusinessDate businessDate = getStoreBusinessDate(todayBusinessTimes.get(todayBusinessTimes.size() - 1), true);
todayEndDate = businessDate.getEndDate(); todayEndDate = businessDate.getEndDate();
//隔天营业的预约时间处理 计算出预约时间在当前时间之前,预约时间加1天 newDate.before(todayEndDate)=隔天营业 //隔天营业的预约时间处理 计算出预约时间在当前时间之前,预约时间加1天 newDate.before(todayEndDate)=隔天营业
if(takeMealDateTime != null && takeMealDateTime.before(date) && newDate.before(todayEndDate)){ if (takeMealDateTime != null && takeMealDateTime.before(date) && newDate.before(todayEndDate)) {
takeMealDateTime = DateUtil.addDays(takeMealDateTime,1); takeMealDateTime = DateUtil.addDays(takeMealDateTime, 1);
} }
} }
if (StringUtils.isNotBlank(expectTime)) { if (StringUtils.isNotBlank(expectTime)) {
...@@ -410,13 +416,13 @@ public class CheckOrder { ...@@ -410,13 +416,13 @@ public class CheckOrder {
} }
//当顾客指定送达时间小于当前时间+提前预约时间时,订单记录类型为即时单 //当顾客指定送达时间小于当前时间+提前预约时间时,订单记录类型为即时单
if (CreateOrderType.TAKE_OUT.equals(createOrderType) && takeMealDateTime != null if (CreateOrderType.TAKE_OUT.equals(createOrderType) && takeMealDateTime != null
&& serviceTime != null && takeMealDateTime.before(DateUtil.addMinutes(date,serviceTime))) { && serviceTime != null && takeMealDateTime.before(DateUtil.addMinutes(date, serviceTime))) {
takeMealDateTime = null; takeMealDateTime = null;
} }
return takeMealDateTime; return takeMealDateTime;
} }
public BusinessDate getStoreBusinessDate(String businessHoursDay, boolean today){ public BusinessDate getStoreBusinessDate(String businessHoursDay, boolean today) {
BusinessDate businessDate = new BusinessDate(); BusinessDate businessDate = new BusinessDate();
//设置营业开始和结束时间 //设置营业开始和结束时间
String businessHourStr = businessHoursDay.replace("-", ",").replace("_", ","); String businessHourStr = businessHoursDay.replace("-", ",").replace("_", ",");
...@@ -425,13 +431,13 @@ public class CheckOrder { ...@@ -425,13 +431,13 @@ public class CheckOrder {
throw new ServiceException(ResponseResult.STORE_NOT_FOUND); throw new ServiceException(ResponseResult.STORE_NOT_FOUND);
} }
Date date = new Date(); Date date = new Date();
if(!today){ if (!today) {
date = DateUtil.addDays(date,1); date = DateUtil.addDays(date, 1);
} }
String startDateTimeStr = DateUtil.convert2String(date, DateUtil.FORMAT_YMD) + " " + businessHours[0] + ":00"; String startDateTimeStr = DateUtil.convert2String(date, DateUtil.FORMAT_YMD) + " " + businessHours[0] + ":00";
String endDateTimeStr = DateUtil.convert2String(date, DateUtil.FORMAT_YMD) + " " + businessHours[1] + ":00"; String endDateTimeStr = DateUtil.convert2String(date, DateUtil.FORMAT_YMD) + " " + businessHours[1] + ":00";
Date startDateTime ; Date startDateTime;
Date endDateTime ; Date endDateTime;
startDateTime = DateUtil.convert2Date(startDateTimeStr, DateUtil.FORMAT_YYYY_MM_DD_HHMMSS); startDateTime = DateUtil.convert2Date(startDateTimeStr, DateUtil.FORMAT_YYYY_MM_DD_HHMMSS);
SimpleDateFormat hhmmss = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat hhmmss = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try { try {
...@@ -440,8 +446,8 @@ public class CheckOrder { ...@@ -440,8 +446,8 @@ public class CheckOrder {
throw new ServiceException(ResponseResult.STORE_BUSINESS_HOUR_ERROR); throw new ServiceException(ResponseResult.STORE_BUSINESS_HOUR_ERROR);
} }
//隔天营业时间处理 //隔天营业时间处理
if(startDateTime.after(endDateTime)){ if (startDateTime.after(endDateTime)) {
endDateTime = DateUtil.addDays(endDateTime,1); endDateTime = DateUtil.addDays(endDateTime, 1);
} }
// 校验门店是否打烊,打烊了则不让操作 // 校验门店是否打烊,打烊了则不让操作
if (startDateTime == null || endDateTime == null) { if (startDateTime == null || endDateTime == null) {
...@@ -481,14 +487,14 @@ public class CheckOrder { ...@@ -481,14 +487,14 @@ public class CheckOrder {
if (Objects.equals(getCouponDetailResponseDto, null) || CollectionUtils.isEmpty(getCouponDetailResponseDto.getDetails()) if (Objects.equals(getCouponDetailResponseDto, null) || CollectionUtils.isEmpty(getCouponDetailResponseDto.getDetails())
|| getCouponDetailResponseDto.getDetails().get(0).getActive() == null || getCouponDetailResponseDto.getDetails().get(0).getActive() == null
|| getCouponDetailResponseDto.getDetails().get(0).getActive().getActiveCode() == null) { || getCouponDetailResponseDto.getDetails().get(0).getActive().getActiveCode() == null) {
if ((CollectionUtils.isNotEmpty(getCouponDetailResponseDto.getDetails().get(0).getActiveRestrictionVOS()) if ((CollectionUtils.isNotEmpty(getCouponDetailResponseDto.getDetails().get(0).getActiveRestrictionVOS())
&& CollectionUtils.isEmpty(getCouponDetailResponseDto.getDetails().get(0).getActiveRestrictionVOS().stream() && CollectionUtils.isEmpty(getCouponDetailResponseDto.getDetails().get(0).getActiveRestrictionVOS().stream()
.filter(a -> Objects.equals(a.getStoreIdPartner(), createOrderVo.getShopId())).collect(Collectors.toList())) .filter(a -> Objects.equals(a.getStoreIdPartner(), createOrderVo.getShopId())).collect(Collectors.toList()))
)) { )) {
throw new ServiceException(ResponseResult.COUPON_SHOP_NOTSUPPORT); throw new ServiceException(ResponseResult.COUPON_SHOP_NOTSUPPORT);
} else { } else {
throw new ServiceException(ResponseResult.COUPON_GETINFO_INVAILD); throw new ServiceException(ResponseResult.COUPON_GETINFO_INVAILD);
} }
} }
String activeCode = getCouponDetailResponseDto.getDetails().get(0).getActive().getActiveCode(); String activeCode = getCouponDetailResponseDto.getDetails().get(0).getActive().getActiveCode();
// 校验点餐方式,查询购物车接口内部已校验 // 校验点餐方式,查询购物车接口内部已校验
...@@ -505,7 +511,7 @@ public class CheckOrder { ...@@ -505,7 +511,7 @@ public class CheckOrder {
cn.freemud.base.entity.BaseResponse<ShoppingCartGoodsDto> apportionResponse = shoppingCartClient.getShoppingCartGoodsApportionNew(requestDto); cn.freemud.base.entity.BaseResponse<ShoppingCartGoodsDto> apportionResponse = shoppingCartClient.getShoppingCartGoodsApportionNew(requestDto);
if (!ObjectUtils.equals(ResponseCodeConstant.RESPONSE_SUCCESS_STR, apportionResponse.getCode())) { if (!ObjectUtils.equals(ResponseCodeConstant.RESPONSE_SUCCESS_STR, apportionResponse.getCode())) {
ResponseResult responseResult = ResponseResult.getResponseResult(apportionResponse.getCode()); ResponseResult responseResult = ResponseResult.getResponseResult(apportionResponse.getCode());
throw new ServiceException(responseResult != null ? responseResult : ResponseResult.SHOPPING_CART_GETINFO_ERROR ); throw new ServiceException(responseResult != null ? responseResult : ResponseResult.SHOPPING_CART_GETINFO_ERROR);
} }
if (apportionResponse.getResult() == null || CollectionUtils.isEmpty(apportionResponse.getResult().getProducts())) { if (apportionResponse.getResult() == null || CollectionUtils.isEmpty(apportionResponse.getResult().getProducts())) {
throw new ServiceException(ResponseResult.SHOPPING_CART_GETINFO_INVAILD); throw new ServiceException(ResponseResult.SHOPPING_CART_GETINFO_INVAILD);
...@@ -682,31 +688,31 @@ public class CheckOrder { ...@@ -682,31 +688,31 @@ public class CheckOrder {
} }
public void checkCardCode(String partnerId,String memberId,String cardCode){ public void checkCardCode(String partnerId, String memberId, String cardCode) {
if(StringUtils.isBlank(cardCode)){ if (StringUtils.isBlank(cardCode)) {
return; return;
} }
StatisticalPropertyRequest request = new StatisticalPropertyRequest(); StatisticalPropertyRequest request = new StatisticalPropertyRequest();
request.setPartnerId(partnerId); request.setPartnerId(partnerId);
request.setMemberId(memberId); request.setMemberId(memberId);
BaseResponse<List<GetSvcInfoByMemberIdResponse>> responseDTO = memberPropertyService.getSvcInfoByMemberId(request,LogThreadLocal.getTrackingNo()); BaseResponse<List<GetSvcInfoByMemberIdResponse>> responseDTO = memberPropertyService.getSvcInfoByMemberId(request, LogThreadLocal.getTrackingNo());
if (!ResponseResult.SUCCESS.getCode().equals(responseDTO.getCode()) || responseDTO.getData() == null if (!ResponseResult.SUCCESS.getCode().equals(responseDTO.getCode()) || responseDTO.getData() == null
|| responseDTO.getData().size() == 0 ) { || responseDTO.getData().size() == 0) {
throw new ServiceException(ResponseResult.USER_SVC_CARD_ERROR); throw new ServiceException(ResponseResult.USER_SVC_CARD_ERROR);
} }
//svc卡无效 //svc卡无效
boolean b = true; boolean b = true;
for (GetSvcInfoByMemberIdResponse getSvcInfoByMemberIdResponse : responseDTO.getData()){ for (GetSvcInfoByMemberIdResponse getSvcInfoByMemberIdResponse : responseDTO.getData()) {
if(cardCode.equals(getSvcInfoByMemberIdResponse.getCardCode()) && getSvcInfoByMemberIdResponse.getStatusFlag() == 0){ if (cardCode.equals(getSvcInfoByMemberIdResponse.getCardCode()) && getSvcInfoByMemberIdResponse.getStatusFlag() == 0) {
b = false; b = false;
} }
} }
if(b){ if (b) {
throw new ServiceException(ResponseResult.USER_SVC_CARD_ERROR); throw new ServiceException(ResponseResult.USER_SVC_CARD_ERROR);
} }
} }
public void checkOrderByStore(StoreResponse.BizVO storeResponseDto){ public void checkOrderByStore(StoreResponse.BizVO storeResponseDto) {
// 校验门店是否停业 1 营业 2 停业 3 繁忙置休 // 校验门店是否停业 1 营业 2 停业 3 繁忙置休
if (storeResponseDto.getActiveFlag() == null || storeResponseDto.getActiveFlag() != 1) { if (storeResponseDto.getActiveFlag() == null || storeResponseDto.getActiveFlag() != 1) {
throw new ServiceException(ResponseResult.STORE_ITEM_STOP_BUSINESS); throw new ServiceException(ResponseResult.STORE_ITEM_STOP_BUSINESS);
......
...@@ -144,7 +144,7 @@ ...@@ -144,7 +144,7 @@
<dependency> <dependency>
<groupId>com.freemud.application.service.sdk</groupId> <groupId>com.freemud.application.service.sdk</groupId>
<artifactId>sdk-common-base</artifactId> <artifactId>sdk-common-base</artifactId>
<version>1.3.9-SNAPSHOT</version> <version>1.5.2.RELEASE</version>
</dependency> </dependency>
<!-- mybatis --> <!-- mybatis -->
......
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