Commit 6dda8073 by 周晓航

Merge branch 'KA-2.0.41-爱马哥预订单开发-zxh' into master-amg-pre

# Conflicts:
#	assortment-ordercenter-sdk/pom.xml
#	order-application-service/pom.xml
#	order-application-service/src/main/java/cn/freemud/adapter/OrderAdapter.java
#	order-application-service/src/main/java/cn/freemud/service/impl/CheckOrder.java
#	ordercenter-sdk/pom.xml
#	pom.xml
#	shopping-cart-application-service/pom.xml
#	shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
parents 505c396e 4e9e2986
......@@ -21,6 +21,7 @@ import com.freemud.application.sdk.api.promotioncenter.request.promotion.Activit
import com.freemud.application.sdk.api.stockapi.domain.ProductStocksVO;
import com.freemud.application.sdk.api.stockapi.request.UpdateStocksRequest;
import com.freemud.application.sdk.api.util.DateUtil;
import com.freemud.sdk.api.assortment.order.constant.CommonConstant;
import com.freemud.sdk.api.assortment.order.domain.OrderStatesVO;
import com.freemud.sdk.api.assortment.order.domain.ResponseCodeConstant;
import com.freemud.sdk.api.assortment.order.entities.OrderEditInfo;
......@@ -217,10 +218,17 @@ public class OrderSdkAdapter {
} else {
request.setOrderClient(StringUtils.isEmpty(requestVO.getSource()) ? OrderClientType.SAAS.getIndex() : getNewOrderClient(requestVO.getSource()));
}
//订单业务类型 1:普通订单 2:虚拟订单
request.setBizType(1);
// fisherman->预定单场景 bizType = 7 other:普通订单
Integer bizType = requestVO.getBizType();
// 双重判断,防止前端乱传参搞事情
if (Objects.nonNull(bizType) && BizTypeEnum.ADVANCE_ORDER.getBizType().compareTo(bizType) == 0) {
request.setBizType(BizTypeEnum.ADVANCE_ORDER.getBizType());
} else {
// 20210730之前 默认设置为1
request.setBizType(CommonConstant.INTEGER_ONE);
}
request.setOrderType(getNewOrderType(requestVO.getOrderType(), requestVO.getGmtExpect(),request.getBizType()));
request.setNote(requestVO.getRemark());
request.setOrderType(getNewOrderType(requestVO.getOrderType(), requestVO.getGmtExpect()));
request.setBarCounter(requestVO.getBarCounter());
//订单market类型
......@@ -357,7 +365,7 @@ public class OrderSdkAdapter {
//订单业务类型 1:普通订单 2:虚拟订单
request.setBizType(1);
request.setNote(requestVO.getRemark());
request.setOrderType(getNewOrderType(requestVO.getOrderType(), requestVO.getGmtExpect()));
request.setOrderType(getNewOrderType(requestVO.getOrderType(), requestVO.getGmtExpect(),request.getBizType()));
request.setBarCounter(requestVO.getBarCounter());
//商品信息转换
......@@ -468,7 +476,7 @@ public class OrderSdkAdapter {
createOrderRequest.setBizType(orderInfo.getBizType());
createOrderRequest.setIsParent(orderInfo.getIsParent());
createOrderRequest.setNote(orderInfo.getRemark());
createOrderRequest.setOrderType(getNewOrderType(orderInfo.getOrderType(), orderInfo.getGmtExpect()));
createOrderRequest.setOrderType(getNewOrderType(orderInfo.getOrderType(), orderInfo.getGmtExpect(),createOrderRequest.getBizType()));
createOrderRequest.setBarCounter(orderInfo.getBarCounter());
//商品信息转换
......@@ -1333,9 +1341,25 @@ public class OrderSdkAdapter {
// 买一赠一寄件信息
data.setOrderSendCouponRespList(orderInfoReqs.getOrderSendCouponRespList());
// 设置 额外拓展字段信息
OrderExtended orderExtended = this.getOrderExtendedObj(orderInfoReqs.getOrderExtended());
data.setOrderExtended(orderExtended);
return data;
}
private OrderExtended getOrderExtendedObj(OrderExtendedReq orderExtended){
if (Objects.isNull(orderExtended)) {
return null;
}
return OrderExtended.builder().orderClientGroup(orderExtended.getOrderClientGroup())
.orderClientGroupCode(orderExtended.getOrderClientGroupCode())
.storeNameEn(orderExtended.getStoreNameEn())
.spellGroupCode(orderExtended.getSpellGroupCode())
.userPhone(orderExtended.getUserPhone())
.sendWord(orderExtended.getSendWord())
.build();
}
/**
* 混合支付转换
*
......@@ -1375,6 +1399,7 @@ public class OrderSdkAdapter {
dataBean.setCount(queryOrderForUserResp.getTotal());
List<QueryOrdersResponse.DataBean.OrderBean> orders = new ArrayList<>();
for (OrderInfoReqs orderInfoReqs : queryOrderForUserResp.getItemList()) {
// fisherman 需要开放 private OrderExtendedReq orderExtended 用于订单页面数据展示
QueryOrdersResponse.DataBean.OrderBean data = convent2NEWOrderInfo(orderInfoReqs);
orders.add(data);
}
......@@ -1538,10 +1563,32 @@ public class OrderSdkAdapter {
/**
* 老订单类型转换新订单类型
*/
public Integer getNewOrderType(QueryOrderType orderType, Long gmtExpect) {
public Integer getNewOrderType(QueryOrderType orderType, Long gmtExpect,Integer bizType) {
//订单服务订单类型 1=外卖 4=自提,5=堂食
//外卖平台订单类型 1=常规堂食,2=预约堂食,3=常规外送,4=预约外送,5=常规自取,6=预约自取
boolean isAdvance = bizType != null && bizType.compareTo(BizTypeEnum.ADVANCE_ORDER.getBizType()) == 0;
Integer type = 0;
// 预定单 是额外的逻辑 --> 需要走实时单
if (isAdvance) {
switch (orderType) {
case TAKE_OUT:
type = 3;
break;
case COLLECT_GOODS:
type = 5;
break;
case EAT_IN:
type = 1;
break;
case MALL:
type = 3;
break;
default:
break;
}
return type;
}
switch (orderType) {
case TAKE_OUT:
if (gmtExpect == null || gmtExpect == 0L) {
......@@ -2649,7 +2696,7 @@ public class OrderSdkAdapter {
public GroupCreateOrderRequest conventGroupCreateOrderRequest(AssortmentGroupCreateOrderRequest requestVO) {
GroupCreateOrderRequest request = new GroupCreateOrderRequest();
//围餐不存在预约时间
request.setOrderType(requestVO.getOrderType() == null ? 1 : getNewOrderType(requestVO.getOrderType(), null));
request.setOrderType(requestVO.getOrderType() == null ? 1 : getNewOrderType(requestVO.getOrderType(), null, null));
request.setPartnerId(requestVO.getCompanyId());
request.setStoreId(requestVO.getShopId());
request.setOrderClient(requestVO.getOrderClient());
......
......@@ -16,4 +16,6 @@ public class CommonConstant {
* 4:星期四
*/
public static List<Integer> weekDay = Arrays.asList(2, 4);
public static Integer INTEGER_ONE = 1;
}
......@@ -12,6 +12,11 @@ import java.util.List;
@Data
public class BaseCreateOrderRequest extends BaseConfig {
/**
* 爱马哥蛋糕预定
* 预定单需求, bizType= 7 其他的场景默认传递null
*/
private Integer bizType;
/**
* 商户ID 必填
......
package com.freemud.sdk.api.assortment.order.response.order;
import lombok.Builder;
import lombok.Data;
/**
* @author : xh.Z
* @email : fisherman0510@163.com
* @Date : 2021/8/2 下午2:26
* @description : OrderBean 反馈 拓展字段信息
*
*/
@Data
@Builder
public class OrderExtended {
/**
* 渠道分组
*/
private String orderClientGroup;
/**
* 渠道分组编号
*/
private String orderClientGroupCode;
/**
* 订单门店英文名称
*/
private String storeNameEn;
/**
* 团号
*/
private String spellGroupCode;
/**
* 预定单的 您的电话
*/
private String userPhone;
/**
* 预定单 蛋糕寄语(额外祝福语)
*/
private String sendWord;
}
......@@ -14,8 +14,6 @@ package com.freemud.sdk.api.assortment.order.response.order;
import com.freemud.application.sdk.api.ordercenter.response.orderInfo.*;
import com.freemud.application.sdk.api.ordercenter.response.orderInfo.OrderCostResp;
import io.swagger.annotations.ApiModelProperty;
import com.rabbitmq.tools.json.JSONUtil;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang.builder.ToStringBuilder;
......@@ -446,6 +444,8 @@ public class QueryOrdersResponse {
*/
private String spellGroupActivityCode;
private OrderExtended orderExtended;
@NoArgsConstructor
@Data
public static class AddDeliveryInfo {
......
......@@ -137,7 +137,6 @@ public class OrderCenterSdkServiceImpl implements OrderCenterSdkService {
@Override
public CreateOrderResponse createOrderFlow(CreateOrderRequest config) {
com.freemud.application.sdk.api.ordercenter.request.create.CreateOrderRequest request = orderSdkAdapter.convent2NEWCreateOrderRequest(config.getBaseCreateOrderRequest());
// AssortOrderLogUtil.info("fisherman 请求基础服务,最终构建 04",config!=null?JSON.toJSONString(config):null);
com.freemud.application.sdk.api.ordercenter.response.BaseResponse<OrderInfoReqs> order = orderSdkService.createOrder(request, config.getTrackingNo());
CreateOrderResponse createOrderResponse = orderSdkAdapter.convent2NEWOrderInfoReqs(order);
if (!RESPONSE_SUCCESS.equals(createOrderResponse.getErrcode())
......
......@@ -19,6 +19,10 @@ public class RedisKeyConstant {
*/
public final static String SAAS_SHOPPINGCART_KEY_PREFIX = "saas:user:info:cart:goods:";
/**
* 用户购物车在redis的key前缀 爱马哥蛋糕预定
*/
public final static String SAAS_SHOPPINGCART_AIMAGE_KEY_PREFIX = "saas:user:info:advance:cart:goods:";
/**
* 用户购物车在redis的key前缀
*/
public final static String SAAS_SHOPPINGCART_SENDGOODS_KEY_PREFIX = "saas:user:info:cart:sendgoods:";
......
......@@ -43,4 +43,9 @@ public class CartParamDto {
private Integer couponType;
private int buyType;
/**
* 业务类型 7-预定单 爱马哥蛋糕预定场景使用(2.0.41迭代 1032929)
*/
private Integer bizType;
}
package cn.freemud.enums;
package com.freemud.sdk.api.assortment.shoppingcart.enums;
/**
......@@ -19,6 +19,11 @@ public enum BizTypeEnum {
MEMBERS(3, "会员订单"),
INTEGRAL_MALL(4, "积分商城订单"),
SVC(5, "储值卡订单"),
SALE_COUPON(6, "卖券订单"),
/**
* 增对 爱马哥的蛋糕预定出的需求,
*/
ADVANCE_ORDER(7, "预订单"),
LGS_SELF_HELP_PARKING(97, "农工商停车自助积分订单"),
LGS_MANUAL_RECORD_PARKING(98, "农工商停车手工录单"),
LGS_PARKING(99, "农工商停车订单");
......@@ -32,8 +37,8 @@ public enum BizTypeEnum {
this.desc = desc;
}
public static cn.freemud.enums.BizTypeEnum getByCode(Integer code) {
for (cn.freemud.enums.BizTypeEnum bizTypeEnum : values()) {
public static BizTypeEnum getByCode(Integer code) {
for (BizTypeEnum bizTypeEnum : values()) {
if (bizTypeEnum.getBizType().equals(code)) {
return bizTypeEnum;
}
......
......@@ -3,41 +3,27 @@ package com.freemud.sdk.api.assortment.shoppingcart.service.impl;
import ch.qos.logback.classic.Level;
import cn.freemud.base.entity.BaseResponse;
import cn.freemud.redis.RedisCache;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.freemud.application.sdk.api.couponcenter.enums.CouponTypeEnum;
import com.freemud.application.sdk.api.couponcenter.online.domain.*;
import com.freemud.application.sdk.api.couponcenter.online.domain.ActiveDetailVO;
import com.freemud.application.sdk.api.couponcenter.online.request.ActiveBatchQueryRequest;
import com.freemud.application.sdk.api.couponcenter.online.request.CouponDetailRequest;
import com.freemud.application.sdk.api.couponcenter.online.request.PartnerRequest;
import com.freemud.application.sdk.api.couponcenter.online.response.CouponDetailResponse;
import com.freemud.application.sdk.api.couponcenter.online.service.FMActiveSdkService;
import com.freemud.application.sdk.api.couponcenter.online.service.OnlineCouponSdkService;
import com.freemud.application.sdk.api.productcenter.constant.ResponseConstant;
import com.freemud.application.sdk.api.productcenter.domain.ProductBeanDTO;
import com.freemud.application.sdk.api.productcenter.domain.ProductInfosDTO;
import com.freemud.application.sdk.api.productcenter.request.menu.GetMenuCategoryByIdsRequest;
import com.freemud.application.sdk.api.productcenter.request.product.GetProductRequest;
import com.freemud.application.sdk.api.productcenter.response.menu.GetMenuCategoryByIdsResponse;
import com.freemud.application.sdk.api.productcenter.response.menu.GetMenuCategoryInfoResponse;
import com.freemud.application.sdk.api.productcenter.response.product.GetProductInfosResponse;
import com.freemud.application.sdk.api.productcenter.service.MenuService;
import com.freemud.application.sdk.api.productcenter.service.ProductService;
import com.freemud.sdk.api.assortment.shoppingcart.adapter.ShoppingCartAdapter;
import com.freemud.sdk.api.assortment.shoppingcart.constant.*;
import com.freemud.sdk.api.assortment.shoppingcart.constant.ActivityChannelEnum;
import com.freemud.sdk.api.assortment.shoppingcart.constant.CartResponseConstant;
import com.freemud.sdk.api.assortment.shoppingcart.constant.RedisKeyConstant;
import com.freemud.sdk.api.assortment.shoppingcart.constant.VersionUtils;
import com.freemud.sdk.api.assortment.shoppingcart.domain.*;
import com.freemud.sdk.api.assortment.shoppingcart.enums.BizTypeEnum;
import com.freemud.sdk.api.assortment.shoppingcart.enums.SaveCouponType;
import com.freemud.sdk.api.assortment.shoppingcart.request.CheckCartRequest;
import com.freemud.sdk.api.assortment.shoppingcart.request.GetProductInfoRequest;
import com.freemud.sdk.api.assortment.shoppingcart.service.ShoppingCartBaseService;
import com.freemud.sdk.api.assortment.shoppingcart.util.CartResponseUtil;
import com.freemud.sdk.api.assortment.shoppingcart.util.DateTimeUtils;
import com.freemud.sdk.api.assortment.shoppingcart.util.PropertyConvertUtil;
import com.freemud.sdk.api.assortment.shoppingcart.util.ShoppingSdkLogUtil;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.BoundHashOperations;
......@@ -45,7 +31,6 @@ import org.springframework.data.redis.core.BoundValueOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
......@@ -428,6 +413,9 @@ public class ShoppingCartBaseServiceImpl implements ShoppingCartBaseService {
* @return
*/
private String getShoppingCartGoodsKey(CartParamDto cartParamDto) {
if(Objects.equals(cartParamDto.getBizType(), BizTypeEnum.ADVANCE_ORDER.getBizType())){
return RedisKeyConstant.SAAS_SHOPPINGCART_AIMAGE_KEY_PREFIX + cartParamDto.getPartnerId() + "_" + cartParamDto.getStoreId() + "_" + cartParamDto.getUserId();
}
return RedisKeyConstant.SAAS_SHOPPINGCART_KEY_PREFIX + cartParamDto.getPartnerId() + "_" + cartParamDto.getStoreId() + "_" + cartParamDto.getUserId();
}
......
......@@ -19,9 +19,9 @@ import cn.freemud.constant.RedisKeyConstant;
import cn.freemud.constant.ResponseCodeConstant;
import cn.freemud.entities.dto.*;
import cn.freemud.entities.dto.activity.ShareDiscountActivityDto;
import cn.freemud.entities.dto.order.*;
import cn.freemud.entities.dto.order.CreateOrderAccountDto;
import cn.freemud.entities.dto.order.CreateOrderProductDto;
import cn.freemud.entities.dto.order.*;
import cn.freemud.entities.dto.pay.CombPayResponse;
import cn.freemud.entities.dto.promotion.OrderBeanRequest;
import cn.freemud.entities.dto.promotion.ShoppingCartGoodsResponse;
......@@ -31,7 +31,6 @@ import cn.freemud.entities.ttpay.OrderInfo;
import cn.freemud.entities.vo.*;
import cn.freemud.entities.vo.encircle.CreateReserveOrderVo;
import cn.freemud.entities.vo.encircle.PreviewOrderInfoVo;
import cn.freemud.enums.*;
import cn.freemud.enums.ActivityTypeEnum;
import cn.freemud.enums.OrderChannelType;
import cn.freemud.enums.OrderSourceType;
......@@ -40,6 +39,7 @@ import cn.freemud.enums.PayStatus;
import cn.freemud.enums.QueryOrderStatus;
import cn.freemud.enums.RefundStatus;
import cn.freemud.enums.ResponseResult;
import cn.freemud.enums.*;
import cn.freemud.interceptor.ServiceException;
import cn.freemud.management.entities.dto.request.BatchOrderRefundV2Request;
import cn.freemud.redis.RedisCache;
......@@ -55,7 +55,6 @@ import com.freemud.api.assortment.datamanager.entity.vo.AssortmentCustomerInfoVo
import com.freemud.api.assortment.datamanager.enums.IappIdType;
import com.freemud.api.assortment.datamanager.manager.AssortmentOpenPlatformPartnerConfigManager;
import com.freemud.api.assortment.datamanager.manager.cache.CacheOpenPlatformPartnerWxappConfigManager;
//import com.freemud.application.sdk.api.log.LogThreadLocal;
import com.freemud.application.sdk.api.log.LogThreadLocal;
import com.freemud.application.sdk.api.ordercenter.entities.PayItem;
import com.freemud.application.sdk.api.ordercenter.enums.*;
......@@ -76,6 +75,7 @@ import com.freemud.sdk.api.assortment.order.request.payment.CombPayRequest;
import com.freemud.sdk.api.assortment.order.request.payment.PayPlatformVO;
import com.freemud.sdk.api.assortment.order.request.payment.ProductVO;
import com.freemud.sdk.api.assortment.order.response.order.CreateOrderFlowResponse;
import com.freemud.sdk.api.assortment.order.response.order.OrderExtended;
import com.freemud.sdk.api.assortment.order.response.order.QueryOrderByIdResponse;
import com.freemud.sdk.api.assortment.order.response.order.QueryOrdersResponse;
import com.freemud.sdk.api.assortment.order.response.payment.OrderPayResponse;
......@@ -106,6 +106,8 @@ import java.util.stream.Stream;
import static cn.freemud.constant.OrderRefundConstant.ALLOW_REFUND;
//import com.freemud.application.sdk.api.log.LogThreadLocal;
@Component
public class OrderAdapter {
private static FastDateFormat yyyyMMddHHmmss = FastDateFormat.getInstance("yyyy-MM-dd HH:mm:ss", Locale.CHINA);
......@@ -687,6 +689,7 @@ public class OrderAdapter {
// log.debug("getCreateOrderDto sessionId:{},createOrderVo:{}",createOrderVo.getSessionId(),JSON.toJSONString(createOrderVo));
Integer orderType;
String receiveAddress = createOrderVo.getStoreAddress();
// fisherman -> 爱马哥 orderType落库的类型处理
if (Objects.equals(createOrderVo.getOrderType(), CreateOrderType.TAKE_OUT.getCode())) {
orderType = OrderType.TAKE_OUT.getCode();
receiveAddress = (userDeliveryInfoDto != null ? userDeliveryInfoDto.getReceiveOfficeName() + "," + userDeliveryInfoDto.getReceiveAddress() : "");
......@@ -723,6 +726,8 @@ public class OrderAdapter {
createOrderDto.setLongitude(longitude);
createOrderDto.setOrderType(convent2OrderTypeEnum(orderType));
createOrderDto.setPayType(QueryPayType.ONLINE_PAY);
// 爱马哥蛋糕预定 预定单需求, bizType= 7 其他的场景默认传递null(到基础服务默认设置为1)
createOrderDto.setBizType(createOrderVo.getBizType());
//电子风味卡
if (Objects.nonNull(createOrderVo.getUnionPayCard())) {
createOrderDto.setPayChannel(PayChannelType.USVCP.getEbcode());
......@@ -1090,7 +1095,9 @@ public class OrderAdapter {
// queryOrdersDto.setType(new Integer[]{});
}
//商品订单和卖券订单
queryOrdersDto.setBizTypes(Arrays.asList(1, 6));
queryOrdersDto.setBizTypes(Arrays.asList(BizTypeEnum.ORDINARY.getBizType(),
BizTypeEnum.SALE_COUPON.getBizType(),
BizTypeEnum.ADVANCE_ORDER.getBizType()));
return queryOrdersDto;
}
......@@ -1532,9 +1539,15 @@ public class OrderAdapter {
responseVo.setExpressNo(ordersBean.getExpressNo());
responseVo.setAutoReviceTime(null == orderExtInfoDto ? null : orderExtInfoDto.getAutoReceiveTime());
responseVo.setAfterSalesOrderResp(ordersBean.getAfterSalesOrderResp());
// bizType = 7 预定单的 额外信息返回
OrderExtended orderExtended = ordersBean.getOrderExtended();
if (Objects.nonNull(orderExtended)) {
responseVo.setUserPhone(orderExtended.getUserPhone());
responseVo.setSendWord(orderExtended.getSendWord());
}
list.add(responseVo);
});
AppLogUtil.infoLog("fisherman orderBean:", JSON.toJSONString(ordersBeans), JSON.toJSONString(list));
return list;
}
......@@ -2080,8 +2093,11 @@ public class OrderAdapter {
// 除 未支付 拒单 和 取消外,其他可退款
return Stream.of(OrderStatus.WAIT_PAY, OrderStatus.REFUSE, OrderStatus.CALCEL).noneMatch(s -> Objects.equals(status, s));
}
// 爱马哥 预定单 付款之后 预定当天之前的时间都可退款
if (orderBean.getBizType().compareTo(BizTypeEnum.ADVANCE_ORDER.getBizType()) == 0) {
return this.checkAdvanceOrder(orderBean.getGmtExpect());
}
// 查询小程序配置的退款设置
boolean canRefund = false;
String hkey = OrderType.TAKE_OUT.getCode().equals(orderBean.getOrderType()) ? KgdRedisKeyConstant.REFUND_CFG_TAKE_OUT : KgdRedisKeyConstant.REFUND_CFG_EAT_IN;
String configStr = redisCache.hashGet(MessageFormat.format(KgdRedisKeyConstant.ORDER_REFUND_CONFIG, orderBean.getCompanyId(), wxAppId), hkey);
......@@ -2163,6 +2179,20 @@ public class OrderAdapter {
return canRefund;
}
/**
* 预约时间
* @param gmtExpect
* @return true 可退 false不可操作
*/
public boolean checkAdvanceOrder(Long gmtExpect) {
if (Objects.isNull(gmtExpect)) {
throw new ServiceException(ResponseResult.PARAMETER_MISSING, "gmtExpect参数有异常");
}
// 只有在 预约时间当天不可取消订单
Date expectDate = DateUtil.convert2Date(new Date(gmtExpect), DateUtil.FORMAT_YMD);
return new Date().before(expectDate);
}
public List<OrderAccountVo> convent2OrderAccountVo(List<QueryOrdersResponse.DataBean.OrderBean.OrderSettlement> orderSettlements) {
List<OrderAccountVo> orderAccountVos = new ArrayList<>();
if (CollectionUtils.isEmpty(orderSettlements)) {
......@@ -4295,7 +4325,9 @@ public class OrderAdapter {
// queryOrdersDto.setType(new Integer[]{});
}
//商品订单和卖券订单
queryOrdersDto.setBizTypes(Arrays.asList(1, 6));
queryOrdersDto.setBizTypes(Arrays.asList(BizTypeEnum.ORDINARY.getBizType(),
BizTypeEnum.SALE_COUPON.getBizType(),
BizTypeEnum.ADVANCE_ORDER.getBizType()));
// 新老兼容
if (queryOrdersDto.getOrderStatuses() != null && !queryOrdersDto.getOrderStatuses().isEmpty()) {
......
......@@ -34,4 +34,9 @@ public class NewShoppingCartClearDto {
*/
private String channelType;
/**
* 爱马哥蛋糕预定
* 预定单需求, bizType= 7 其他的场景默认传递null
*/
private Integer bizType;
}
......@@ -26,5 +26,9 @@ public class ExpandFields {
//每增加一公里增加的时长(分钟)
private String appendMinutePerKilometer;
/**
* 是否开启 预定单功能 1开 0关
*/
private Integer preOrderSwitch;
}
......@@ -43,6 +43,12 @@ public class CreateOrderVo {
private String thirdShopId;
/**
* 爱马哥蛋糕预定
* 预定单需求, bizType= 7 其他的场景默认传递null
*/
private Integer bizType;
/**
* 就餐人数
*/
private Integer peopleNumber;
......@@ -264,6 +270,17 @@ public class CreateOrderVo {
private String monthlyCardCode;
/**
* 预定单的 您的电话
*/
private String userPhone;
/**
* 预定单 蛋糕寄语(额外祝福语) 最多20个字
*/
private String sendWord;
/**
* 是否使用电子风味卡,如果不为空则为使用
*/
@Valid
......
......@@ -625,6 +625,15 @@ public class QueryOrderResponseVo {
private AfterSalesOrderResp afterSalesOrderResp;
/**
* 预定单的 您的电话
*/
private String userPhone;
/**
* 预定单 蛋糕寄语(额外祝福语)
*/
private String sendWord;
/**
* 用户申请退款原因 1=退款退货 2=只退款不退货
......
......@@ -27,6 +27,13 @@ import java.util.List;
@Builder
public class ShoppingCartInfoRequestVo {
/**
* 爱马哥蛋糕预定
* 预定单需求, bizType= 7 其他的场景默认传递null
*/
private Integer bizType;
private String version;
/**
......
......@@ -71,6 +71,7 @@ public enum ResponseResult {
STORE_DDELIVERY_METHOD("43021", "获取门店外卖配送方式异常",""),
STORE_QUERYEXPECTARRIVETIME("43022", "获取门店计算预计送达时间失败",""),
STORE_DATE_ERROR("43023", "门店数据错误",""),
STORE_ITEM_NOT_ADVANCE("43024", "门店未开启预约单配置",""),
/**
* 购物车状态码
......@@ -175,6 +176,8 @@ public enum ResponseResult {
STORE_SELF_ERROR("45069", "请选择截止营业时间大于45分钟下单",""),
COUPON_INVALID("45070", "券已锁定,请先支付或取消待支付订单",""),
ORDER_RECEIVE_ERR("45071", "确认收货失败,请稍后再试",""),
STORE_NO_OPEN("45072", "选择时间不在门店营业时间范围内",""),
STORE_SELF_ERROR_10("45073", "请在营业结束时间前10分钟下单",""),
/**
* 售后单
......
......@@ -5,6 +5,7 @@ import cn.freemud.entities.vo.CreateOrderBaseVo;
import cn.freemud.entities.vo.CreateOrderVo;
import cn.freemud.interceptor.ServiceException;
import cn.freemud.utils.AppLogUtil;
import com.freemud.application.sdk.api.ordercenter.enums.BizTypeEnum;
import com.freemud.application.sdk.api.storecenter.response.StoreResponse;
import com.google.common.collect.Lists;
......@@ -25,11 +26,23 @@ public class OrderCheckAdapter {
* @throws ServiceException 抛出异常校验异常数据
*/
public static void check(CreateOrderVo vo, StoreResponse storeResponse) throws ServiceException {
// fisherman-ka 预定单的校验 未完成 --> 这里移动了位置
// if (Objects.nonNull(vo.getBizType())
// && BizTypeEnum.ADVANCE_ORDER.getBizType().compareTo(vo.getBizType()) == 0) {
// // 伪代码 判断 门店是否开启了 预定单服务
// // 开启了预定单服务, 不走下面的检验
// // 没开启 抛出异常
// }
//非预约单的过滤
if (Objects.isNull(vo.getOrderType()) ||
(!Objects.equals(vo.getTakeMealFlag(), "1"))) {
return;
}
// 预定单 不校验 下面的预约单
if (Objects.nonNull(vo.getBizType())
&& BizTypeEnum.ADVANCE_ORDER.getBizType().compareTo(vo.getBizType()) == 0) {
return;
}
StoreResponse.Configuration configuration = storeResponse.getBizVO().getStoreConfig();
if(Objects.isNull(configuration)){
//针对老数据没有配置 预约单默认支持,直接返回不校验
......
......@@ -3,7 +3,6 @@ package cn.freemud.service.impl;
import cn.freemud.adapter.OrderAdapter;
import cn.freemud.base.entity.BaseResponse;
import cn.freemud.constant.ResponseCodeConstant;
import cn.freemud.constant.ShoppingCartConstant;
import cn.freemud.entities.dto.ConfirmOrderDto;
import cn.freemud.entities.dto.QueryOrdersResponseDto;
import cn.freemud.entities.dto.coupon.InvalidCouponsRequestDto;
......@@ -29,6 +28,7 @@ import com.freemud.application.sdk.api.base.SDKCommonBaseContextWare;
import com.freemud.application.sdk.api.constant.ResponseResultEnum;
import com.freemud.application.sdk.api.log.LogThreadLocal;
import com.freemud.application.sdk.api.ordercenter.enums.AfterSalesType;
import com.freemud.application.sdk.api.ordercenter.enums.BizTypeEnum;
import com.freemud.application.sdk.api.ordercenter.enums.OrderClientType;
import com.freemud.application.sdk.api.ordercenter.request.OrderExtInfoDto;
import com.freemud.application.sdk.api.ordercenter.request.create.CreateOrderRequest;
......@@ -63,7 +63,6 @@ import org.springframework.stereotype.Service;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
@Service
......
......@@ -46,6 +46,7 @@ import cn.freemud.entities.dto.shoppingCart.NewShoppingCartClearDto;
import cn.freemud.entities.dto.shoppingCart.ShoppingCartGoodsDto;
import cn.freemud.entities.vo.*;
import cn.freemud.enums.*;
import cn.freemud.enums.OrderType;
import cn.freemud.interceptor.ServiceException;
import cn.freemud.management.entities.dto.request.BatchOrderRefundV2Request;
import cn.freemud.management.entities.dto.response.activity.GroupWorkRefundResponse;
......@@ -80,11 +81,9 @@ import com.freemud.application.sdk.api.constant.ResponseResultEnum;
import com.freemud.application.sdk.api.couponcenter.offline.service.OfflineCouponSdkService;
import com.freemud.application.sdk.api.log.ErrorLog;
import com.freemud.application.sdk.api.log.LogThreadLocal;
import com.freemud.application.sdk.api.ordercenter.common.OrderAndShoppingCommonRedisKey;
import com.freemud.application.sdk.api.ordercenter.entities.PayItem;
import com.freemud.application.sdk.api.ordercenter.enums.AfterSalesType;
import com.freemud.application.sdk.api.ordercenter.enums.OrderClientType;
import com.freemud.application.sdk.api.ordercenter.enums.PayChannelType;
import com.freemud.application.sdk.api.ordercenter.enums.RefundModeEnum;
import com.freemud.application.sdk.api.ordercenter.enums.*;
import com.freemud.application.sdk.api.ordercenter.request.*;
import com.freemud.application.sdk.api.ordercenter.request.carpark.ParkingOrderCreateReq;
import com.freemud.application.sdk.api.ordercenter.response.BaseDownLoadResponse;
......@@ -521,7 +520,9 @@ public class OrderServiceImpl implements Orderservice {
//var1.setMealCodeRule(getMealCodeRule(wxappid));
if (StringUtils.isNotBlank(payCode)) {
var1.setPayChannel(payCode);
var1.setPayChannelName(PayChannel.getByCode(payCode).getDesc());
//fisherman 看着会出现NPE 就给修改了下
PayChannel byCode = PayChannel.getByCode(payCode);
var1.setPayChannelName(Objects.isNull(byCode) ? null : byCode.getDesc());
}
if (orderBean.getGmtExpect() != null && orderBean.getGmtExpect() != 0) {
var1.setExpectTime(DateUtil.convert2String(new Date(orderBean.getGmtExpect()), DateUtil.FORMAT_YYYY_MM_DD_HHMMSS));
......@@ -570,7 +571,27 @@ public class OrderServiceImpl implements Orderservice {
newShoppingCartClearDto.setAppId(wxappid);
newShoppingCartClearDto.setSessionId(sessionId);
newShoppingCartClearDto.setOperationType(1);
// fisherman 清楚 爱马哥蛋糕预定 类型购物车 bizType = 7
newShoppingCartClearDto.setBizType(orderBean.getBizType());
shoppingCartClient.clearShoppingCart(newShoppingCartClearDto);
/**
主要 根据 ShoppingCartNewServiceImpl 次要 ShoppingCartMallServiceImpl
这里不处理商城
根据sessionId 判断是否是 围餐 , 标准点餐
看看围餐 是不是也可以 直接处理
*/
AssortmentCustomerInfoVo userLoginInfoDto = customerInfoManager.getCustomerInfoByObject(sessionId);
if (Objects.nonNull(userLoginInfoDto)) {
String iappId = userLoginInfoDto.getIappId();
if (IappIdType.WC_XCX.getCode().equals(iappId)) {
// 围餐依然调用接口处理
shoppingCartClient.clearShoppingCart(newShoppingCartClearDto);
}else {
// saas订单, 直接订单服务清空购物车
redisCache.delete(OrderAndShoppingCommonRedisKey.getShoppingCartGoodsKey(partnerId,storeId,userId, orderBean.getBizType()));
}
}
}
if (StringUtils.isNotBlank(daySeq) && orderExtInfoDto != null && !OrderType.TAKE_OUT.getCode().equals(orderBean.getType())) {
......@@ -1870,6 +1891,16 @@ public class OrderServiceImpl implements Orderservice {
}
}
// fisherman 预定单前置校验-> bizType=7
if (BizTypeEnum.ADVANCE_ORDER.getBizType().compareTo(orderBean.getBizType()) == 0) {
// 预定时间 前一天都可退款
boolean b = orderAdapter.checkAdvanceOrder(orderBean.getGmtExpect());
if (!b) {
return ResponseUtil.error(ResponseResult.ORDER__ERRORREFUND.getCode(), "预约时间当天不可退款");
}
}
/**
* 已接单,制作完成,配送中,未接单,用户可申请退款
*
......@@ -1995,6 +2026,7 @@ public class OrderServiceImpl implements Orderservice {
}
/**
* 商家未接单,取消订单逻辑处理 1.调用支付退款 2.根据支付退款返回状态组装订单取消参数,调用订单取消接口
*
......@@ -2519,6 +2551,9 @@ public class OrderServiceImpl implements Orderservice {
AssortmentCustomerInfoVo userLoginInfoDto) {
CreateOrderOperateDto response = new CreateOrderOperateDto();
OrderExtendedReq orderExtendedReq = orderAdapter.saveStoreInfo(storeResponseDto);
// fisherman 爱马哥蛋糕 预定 额外字段存储
orderExtendedReq.setUserPhone(createOrderVo.getUserPhone());
orderExtendedReq.setSendWord(createOrderVo.getSendWord());
OrderClientType orderClient = OrderClientType.SAAS;
String appId = userLoginInfoDto.getWxAppId();
if ("2".equals(userLoginInfoDto.getChannel())) {
......
......@@ -452,7 +452,7 @@ public class SaasMallOrderService extends UniversalOrderService {
//订单业务类型 1:普通订单 2:虚拟订单
request.setBizType(1);
request.setNote(requestVO.getRemark());
request.setOrderType(orderSdkAdapter.getNewOrderType(requestVO.getOrderType(), requestVO.getGmtExpect()));
request.setOrderType(orderSdkAdapter.getNewOrderType(requestVO.getOrderType(), requestVO.getGmtExpect(),null));
request.setBarCounter(requestVO.getBarCounter());
//订单market类型
......
package com.freemud.application.sdk.api.ordercenter.common;
import com.freemud.application.sdk.api.ordercenter.enums.BizTypeEnum;
import java.util.Objects;
/**
* @author : xh.Z
* @email : fisherman0510@163.com
* @Date : 2021/8/2 下午8:06
* @description : 订单和 购物车 共同使用方法
*/
public abstract class OrderAndShoppingCommonRedisKey {
/**
* 用户购物车在redis的key前缀 爱马哥蛋糕预定
*/
private final static String SAAS_SHOPPINGCART_AIMAGE_KEY_PREFIX = "saas:user:info:advance:cart:goods:";
/**
* 用户购物车在redis的key前缀
*/
private final static String SAAS_SHOPPINGCART_KEY_PREFIX = "saas:user:info:cart:goods:";
/**
* 获取记录购物车信息的key
*
* @param partnerId
* @param storeId
* @param userId
* @return
*/
public static String getShoppingCartGoodsKey(String partnerId, String storeId, String userId,Integer bizType) {
if(Objects.equals(BizTypeEnum.ADVANCE_ORDER.getBizType(),bizType)){
return SAAS_SHOPPINGCART_AIMAGE_KEY_PREFIX + partnerId + "_" + storeId + "_" + userId;
}
return SAAS_SHOPPINGCART_KEY_PREFIX + partnerId + "_" + storeId + "_" + userId;
}
}
package com.freemud.application.sdk.api.ordercenter.enums;
/**
* @author wanghanghang
* @title: QueryHeardServiceImpl
* @projectName order_group
* @description: 订单BizType枚举类
* @date 2021/7/15下午10:50
*/
public enum BizTypeEnum {
//字段6代表卖券订单。
//蜜雪APP和平台通用。
//后续使用此字段需注意。名称APP_COUPON取得有些误导,由于有地方使用,暂时不更改
APP_COUPON(6, "卖券订单"),
ORDINARY(1, "普通订单"),
VIRTUAL(2, "虚拟订单"),
MEMBERS(3, "会员订单"),
INTEGRAL_MALL(4, "积分商城订单"),
SVC(5, "储值卡订单"),
SALE_COUPON(6, "卖券订单"),
/**
* 增对 爱马哥的蛋糕预定出的需求,
*/
ADVANCE_ORDER(7, "预订单"),
LGS_SELF_HELP_PARKING(97, "农工商停车自助积分订单"),
LGS_MANUAL_RECORD_PARKING(98, "农工商停车手工录单"),
LGS_PARKING(99, "农工商停车订单");
private Integer bizType;
private String desc;
BizTypeEnum(Integer bizType, String desc) {
this.bizType = bizType;
this.desc = desc;
}
public static BizTypeEnum getByCode(Integer code) {
for (BizTypeEnum bizTypeEnum : values()) {
if (bizTypeEnum.getBizType().equals(code)) {
return bizTypeEnum;
}
}
return null;
}
public Integer getBizType() {
return bizType;
}
public void setBizType(Integer bizType) {
this.bizType = bizType;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
}
\ No newline at end of file
......@@ -36,4 +36,13 @@ public class OrderExtendedReq {
* 团号
*/
private String spellGroupCode;
/**
* 预定单的 您的电话
*/
private String userPhone;
/**
* 预定单 蛋糕寄语(额外祝福语)
*/
private String sendWord;
}
......@@ -13,6 +13,8 @@
package cn.freemud.constant;
import com.freemud.application.sdk.api.ordercenter.common.OrderAndShoppingCommonRedisKey;
public class RedisKeyConstant {
/**
* userInfoMap的redisKey前缀
......@@ -23,10 +25,18 @@ public class RedisKeyConstant {
*/
public final static String SAAS_VERIFICATION_CODE_KEY_PREFIX = "saas:userSmsCode:mobile_";
/**
* 用户购物车在redis的key前缀
* 用户购物车在redis的key前缀 弃用
* @see OrderAndShoppingCommonRedisKey
*/
@Deprecated
public final static String SAAS_SHOPPINGCART_KEY_PREFIX = "saas:user:info:cart:goods:";
/**
* 用户购物车在redis的key前缀 爱马哥蛋糕预定 弃用
* @see OrderAndShoppingCommonRedisKey
*/
@Deprecated
public final static String SAAS_SHOPPINGCART_AIMAGE_KEY_PREFIX = "saas:user:info:advance:cart:goods:";
/**
* 用户购物车总价在redis的key前缀
*/
public final static String SAAS_SHOPPINGCART_AMOUNT_PREFIX = "saas:user:info:cart:amount:goods:";
......
......@@ -115,7 +115,7 @@ public class DistributeAdapter {
List<String> uuidList = spqIdToCartUuid.get(sqpInfo.getCouponCode());
if (CollectionUtils.isNotEmpty(uuidList)){
List<CartGoods> newCartList = cartGoodsList.stream().filter(p -> !uuidList.contains(p.getCartGoodsUid())).collect(Collectors.toList());
assortmentSdkService.setShoppingCart(bo.getPartnerId(), bo.getShopId(), bo.getUserId(), newCartList, null, null, this.shoppingCartBaseService);
assortmentSdkService.setShoppingCart(bo.getPartnerId(), bo.getShopId(), bo.getUserId(), newCartList, null, null, this.shoppingCartBaseService,null);
cartGoodsList = newCartList;
CheckSpqInfoResponseDto checkSpqInfoResponseDto = validCouponMap.get(spqId);
commonSetMessageBO.setChanged(true);
......
......@@ -216,7 +216,7 @@ public abstract class AbstractAddGoodsService implements AddGoodsService {
// 获取购物车信息
// 注意,围餐和点餐redis数据结构不一样
List<CartGoods> allCartGoodsList = assortmentSdkService.getShoppingCart(baseRequestBO.getPartnerId(), baseRequestBO.getShopId(), userInfo.getUserId(), baseRequestBO.getSessionId(), null, shoppingCartBaseService);
List<CartGoods> allCartGoodsList = assortmentSdkService.getShoppingCart(baseRequestBO.getPartnerId(), baseRequestBO.getShopId(), userInfo.getUserId(), baseRequestBO.getSessionId(), null, shoppingCartBaseService,null);
if (CollectionUtils.isEmpty(allCartGoodsList)) {
allCartGoodsList = new ArrayList<>();
}
......
......@@ -207,7 +207,7 @@ public class AbstractApportionService implements GetShoppingCartGoodsApportionSe
// 获取购物车信息
// 注意,围餐和点餐redis数据结构不一样
List<CartGoods> allCartGoodsList = assortmentSdkService.getShoppingCart(baseRequestBO.getPartnerId(), baseRequestBO.getShopId(), userInfo.getUserId(), baseRequestBO.getSessionId(), null, shoppingCartBaseService);
List<CartGoods> allCartGoodsList = assortmentSdkService.getShoppingCart(baseRequestBO.getPartnerId(), baseRequestBO.getShopId(), userInfo.getUserId(), baseRequestBO.getSessionId(), null, shoppingCartBaseService,null);
if (CollectionUtils.isEmpty(allCartGoodsList)) {
throw new ServiceException(ResponseResult.SHOPPING_CART_GETINFO_INVAILD);
}
......@@ -345,7 +345,7 @@ public class AbstractApportionService implements GetShoppingCartGoodsApportionSe
ShoppingCartContext cartContext = addGoodsToShoppingCartBO.getShoppingCartContext();
assortmentSdkService.setShoppingCart(cartContext.getPartnerId(), cartContext.getShopId(), cartContext.getUserId(),
addGoodsToShoppingCartBO.getCartGoods(), baseRequestDTO.getSessionId(), "", shoppingCartBaseService);
addGoodsToShoppingCartBO.getCartGoods(), baseRequestDTO.getSessionId(), "", shoppingCartBaseService,null);
calCostBO.setCartGoods(addGoodsToShoppingCartBO.getCartGoods());
calCostBO.setChanged(addGoodsToShoppingCartBO.getChanged());
......
......@@ -211,7 +211,7 @@ public class AbstractListCartGoodsService implements ListCartGoodsService {
// 获取购物车信息
// 注意,围餐和点餐redis数据结构不一样
List<CartGoods> allCartGoodsList = assortmentSdkService.getShoppingCart(baseRequestBO.getPartnerId(), baseRequestBO.getShopId(), userInfo.getUserId(), baseRequestBO.getSessionId(), null, shoppingCartBaseService);
List<CartGoods> allCartGoodsList = assortmentSdkService.getShoppingCart(baseRequestBO.getPartnerId(), baseRequestBO.getShopId(), userInfo.getUserId(), baseRequestBO.getSessionId(), null, shoppingCartBaseService,null);
if (CollectionUtils.isEmpty(allCartGoodsList)) {
allCartGoodsList = new ArrayList<>();
} else {
......@@ -309,7 +309,7 @@ public class AbstractListCartGoodsService implements ListCartGoodsService {
ShoppingCartContext cartContext = addGoodsToShoppingCartBO.getShoppingCartContext();
assortmentSdkService.setShoppingCart(cartContext.getPartnerId(), cartContext.getShopId(), cartContext.getUserId(),
addGoodsToShoppingCartBO.getCartGoods(), baseRequestDTO.getSessionId(), "", shoppingCartBaseService);
addGoodsToShoppingCartBO.getCartGoods(), baseRequestDTO.getSessionId(), "", shoppingCartBaseService,null);
calCostBO.setCartGoods(addGoodsToShoppingCartBO.getCartGoods());
calCostBO.setChanged(addGoodsToShoppingCartBO.getChanged());
......
......@@ -197,7 +197,7 @@ public abstract class AbstractUpdateGoodsQtyService implements UpdateGoodsQtySer
// 先验证商品是否存在
CartGoods cartGoods = assortmentSdkService.getCartGoodsBySdk(baseRequestBO.getPartnerId(), userInfo.getUserId(), baseRequestBO.getShopId(),
baseRequestBO.getCartGoodsUid(), "", shoppingCartBaseService);
baseRequestBO.getCartGoodsUid(), "", shoppingCartBaseService,null);
if (cartGoods == null) {
throw new ServiceException(ResponseResult.SHOPPING_CART_UPDATE_ERROR);
}
......@@ -282,7 +282,7 @@ public abstract class AbstractUpdateGoodsQtyService implements UpdateGoodsQtySer
// 更新购物车信息
List<CartGoods> cartGoodsList = assortmentSdkService.updateGoodsQtyBySdk(baseRequestDTO.getPartnerId(), checkBussinessRulesBO.getUserId(),
baseRequestDTO.getShopId(), cartGoods.getCartGoodsUid(), cartGoods.getQty()<0?0:cartGoods.getQty(), "", shoppingCartBaseService);
baseRequestDTO.getShopId(), cartGoods.getCartGoodsUid(), cartGoods.getQty()<0?0:cartGoods.getQty(), "", shoppingCartBaseService,null);
CheckCartRequest checkCartRequest = shoppingBaseService.checkShoppingCart(cartGoodsList, null, cartContext);
......@@ -304,7 +304,7 @@ public abstract class AbstractUpdateGoodsQtyService implements UpdateGoodsQtySer
ShoppingCartContext cartContext = addGoodsToShoppingCartBO.getShoppingCartContext();
assortmentSdkService.setShoppingCart(cartContext.getPartnerId(), cartContext.getShopId(), cartContext.getUserId(),
addGoodsToShoppingCartBO.getCartGoods(), baseRequestDTO.getSessionId(), "", shoppingCartBaseService);
addGoodsToShoppingCartBO.getCartGoods(), baseRequestDTO.getSessionId(), "", shoppingCartBaseService,null);
calCostBO.setCartGoods(addGoodsToShoppingCartBO.getCartGoods());
calCostBO.setChanged(addGoodsToShoppingCartBO.getChanged());
......
......@@ -43,7 +43,7 @@ public class ShoppingBaseServiceImpl implements ShoppingCartService {
});
// 重新set购物车信息到缓存中
assortmentSdkService.setShoppingCart(cartContext.getPartnerId(), cartContext.getShopId(),
cartContext.getUserId(), nowCartGoodsList, cartContext.getSessionId(), cartContext.getTableNumber(), this.shoppingCartBaseService);
cartContext.getUserId(), nowCartGoodsList, cartContext.getSessionId(), cartContext.getTableNumber(), this.shoppingCartBaseService,null);
cartGoodsList.clear();
cartGoodsList.addAll(nowCartGoodsList);
return nowCartGoodsList;
......
......@@ -25,4 +25,9 @@ public class ActivityQueryDto {
private ActivityQueryResponseDto activityQueryResponseDto;
/**
* 业务类型 7-预定单 爱马哥蛋糕预定场景使用(2.0.41迭代 1032929)
*/
private Integer bizType;
}
......@@ -30,4 +30,9 @@ public class BaseRequestVo {
* 渠道类型 OrderChannelType
*/
private String channelType;
/**
* 业务类型 7-预定单 爱马哥蛋糕预定场景使用(2.0.41迭代 1032929)
*/
private Integer bizType;
}
......@@ -48,6 +48,11 @@ public class PremiumExchangeRequestVo {
private String menuType;
/**
* 业务类型 7-预定单 爱马哥蛋糕预定场景使用(2.0.41迭代 1032929)
*/
private Integer bizType;
/**
* 优惠券code列表
*/
private List<couponCode> couponCodes;
......
......@@ -38,4 +38,9 @@ public class CouponAvailableRequestVo {
@ApiModelProperty(value = "收货地址id",notes = "svc卡支付外卖订单必传")
private String receiveId;
/**
* 业务类型 7-预定单 爱马哥蛋糕预定场景使用(2.0.41迭代 1032929)
*/
private Integer bizType;
}
\ No newline at end of file
......@@ -340,9 +340,9 @@ public abstract class AbstractShoppingCartImpl implements ShoppingCartNewService
//外卖场景下 查询门店配送信息
if(BusinessTypeEnum.SAAS_DELIVERY.getCode().equals(menuType)){
calculationDiscountResult = this.getActivityCalculationDiscountResponse(partnerId, storeId, userId, appId, orderType,isMember, cartGoodsList, coupons, sendGoodsList,BusinessTypeEnum.getByType(menuType).getCode(),deliveryAmount);
calculationDiscountResult = this.getActivityCalculationDiscountResponse(partnerId, storeId, userId, appId, orderType,isMember, cartGoodsList, coupons, sendGoodsList,BusinessTypeEnum.getByType(menuType).getCode(),deliveryAmount,null);
}else{
calculationDiscountResult = this.getActivityCalculationDiscountResponse(partnerId, storeId, userId, appId, orderType,isMember, cartGoodsList, coupons, sendGoodsList,BusinessTypeEnum.getByType(menuType).getCode(),null);
calculationDiscountResult = this.getActivityCalculationDiscountResponse(partnerId, storeId, userId, appId, orderType,isMember, cartGoodsList, coupons, sendGoodsList,BusinessTypeEnum.getByType(menuType).getCode(),null,null);
}
return calculationDiscountResult;
......
......@@ -21,6 +21,6 @@ public interface ShoppingCartNewBaseService {
List<CartGoods> add(String partnerId, String storeId, String useId, CartGoods cartGoods);
void clear(String partnerId, String storeId, String useId);
void clear(String partnerId, String storeId, String useId,Integer bizType);
}
......@@ -97,7 +97,7 @@ public interface ShoppingCartNewService {
boolean isMember,
List<CartGoods> cartGoodsList,
List<ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon> coupons,
List<ShoppingCartInfoRequestVo.SendGoods> sendGoodsList,String menuType,Long distributionFee);
List<ShoppingCartInfoRequestVo.SendGoods> sendGoodsList,String menuType,Long distributionFee,Integer bizType);
List<CartGoods> updateCartGoodsLegal(CartGoods cartGoods, String userId, ShoppingCartGoodsBaseResponseVo shoppingCartGoodsResponseVo, AddShoppingCartGoodsRequestVo addShoppingCartGoodsRequestVo, List<CartGoods> oldAllCartGoodsList);
......
......@@ -72,11 +72,12 @@ public class AssortmentSdkService {
* @param cartGoodsUid
* @return
*/
public CartGoods getCartGoodsBySdk(String partnerId, String userId, String storeId, String cartGoodsUid, String tableNumber, ShoppingCartBaseService shoppingCartService) {
public CartGoods getCartGoodsBySdk(String partnerId, String userId, String storeId, String cartGoodsUid, String tableNumber, ShoppingCartBaseService shoppingCartService,Integer bizType) {
com.freemud.sdk.api.assortment.shoppingcart.domain.CartParamDto cartParamDto = getCartParamDto(partnerId, storeId, userId);
cartParamDto.setCartGoodsUid(cartGoodsUid);
cartParamDto.setTableNumber(tableNumber);
cartParamDto.setUserId(userId);
cartParamDto.setBizType(bizType);
BaseResponse<com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoods> baseResponse = shoppingCartService.getCartGoods(cartParamDto, LogThreadLocal.getTrackingNo());
if (baseResponse == null || !ResponseResult.SUCCESS.getCode().equals(baseResponse.getCode()) || baseResponse.getResult() == null) {
return null;
......@@ -95,9 +96,9 @@ public class AssortmentSdkService {
* @param qty
* @return
*/
public List<CartGoods> updateGoodsQtyBySdk(String partnerId, String userId, String storeId, String cartGoodsUid, Integer qty, String tableNumber, ShoppingCartBaseService shoppingCartService) {
public List<CartGoods> updateGoodsQtyBySdk(String partnerId, String userId, String storeId, String cartGoodsUid, Integer qty, String tableNumber, ShoppingCartBaseService shoppingCartService,Integer bizType) {
int buyType = 0 ;
return updateNowBuyGoodsQtyBySdk(buyType,partnerId, userId, storeId, cartGoodsUid, qty, tableNumber, shoppingCartService);
return updateNowBuyGoodsQtyBySdk(buyType,partnerId, userId, storeId, cartGoodsUid, qty, tableNumber, shoppingCartService,bizType);
}
/**
......@@ -108,9 +109,9 @@ public class AssortmentSdkService {
* @param useId
* @return
*/
public List<CartGoods> getShoppingCart(String partnerId, String storeId, String useId, String sessionId, String tableNumber, ShoppingCartBaseService shoppingCartService) {
public List<CartGoods> getShoppingCart(String partnerId, String storeId, String useId, String sessionId, String tableNumber, ShoppingCartBaseService shoppingCartService,Integer bizType) {
int buyType = 0 ;
return getNowBuyShoppingCart( buyType, partnerId, storeId, useId, sessionId, tableNumber, shoppingCartService);
return getNowBuyShoppingCart( buyType, partnerId, storeId, useId, sessionId, tableNumber, shoppingCartService,bizType);
}
public List<CartGoods> getShoppingCartSendGoods(String partnerId, String storeId, String useId, String sessionId, String tableNumber, ShoppingCartBaseService shoppingCartService) {
......@@ -126,9 +127,10 @@ public class AssortmentSdkService {
* @param useId
* @return
*/
public List<CartGoods> getShoppingCartForCoupon(String partnerId, String storeId, String useId, String tableNumber, ShoppingCartBaseService shoppingCartService) {
public List<CartGoods> getShoppingCartForCoupon(String partnerId, String storeId, String useId, String tableNumber, ShoppingCartBaseService shoppingCartService,Integer bizType) {
com.freemud.sdk.api.assortment.shoppingcart.domain.CartParamDto cartParamDto = getCartParamDto(partnerId, storeId, useId);
cartParamDto.setTableNumber(tableNumber);
cartParamDto.setBizType(bizType);
// 根据不同点餐类型获取不同购物车实例
BaseResponse<List<com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoods>> baseResponse = shoppingCartService.getCartGoodsList(cartParamDto, LogThreadLocal.getTrackingNo());
if (baseResponse == null || !ResponseResult.SUCCESS.getCode().equals(baseResponse.getCode()) || CollectionUtils.isEmpty(baseResponse.getResult())) {
......@@ -166,9 +168,9 @@ public class AssortmentSdkService {
* @param useId
* @return
*/
public List<CartGoods> setShoppingCart(String partnerId, String storeId, String useId, List<CartGoods> cartGoodsList, String sessionId, String tableNumber, ShoppingCartBaseService shoppingCartService) {
public List<CartGoods> setShoppingCart(String partnerId, String storeId, String useId, List<CartGoods> cartGoodsList, String sessionId, String tableNumber, ShoppingCartBaseService shoppingCartService,Integer bizType) {
int buyType = 0;
return setNowBuyShoppingCart(buyType,partnerId, storeId, useId , cartGoodsList, sessionId, tableNumber, shoppingCartService);
return setNowBuyShoppingCart(buyType,partnerId, storeId, useId , cartGoodsList, sessionId, tableNumber, shoppingCartService,bizType);
}
......@@ -185,11 +187,12 @@ public class AssortmentSdkService {
* @param useId
* @return
*/
public List<CartGoods> setNowBuyShoppingCart(int buyType,String partnerId, String storeId, String useId, List<CartGoods> cartGoodsList, String sessionId, String tableNumber, ShoppingCartBaseService shoppingCartService) {
public List<CartGoods> setNowBuyShoppingCart(int buyType,String partnerId, String storeId, String useId, List<CartGoods> cartGoodsList, String sessionId, String tableNumber, ShoppingCartBaseService shoppingCartService,Integer bizType) {
com.freemud.sdk.api.assortment.shoppingcart.domain.CartParamDto cartParamDto = getCartParamDto(partnerId, storeId, useId);
cartParamDto.setSessionId(sessionId);
cartParamDto.setTableNumber(tableNumber);
cartParamDto.setUserId(useId);
cartParamDto.setBizType(bizType);
//立即购买==1 ,设置新的缓存key
if(buyType == ShoppingCartConstant.NOW_BUY_TYPE) {
cartParamDto.setBuyType(buyType);
......@@ -346,11 +349,12 @@ public class AssortmentSdkService {
* @param buyType 购买类型
* @return
*/
public List<CartGoods> getNowBuyShoppingCart(int buyType,String partnerId, String storeId, String useId, String sessionId, String tableNumber, ShoppingCartBaseService shoppingCartService) {
public List<CartGoods> getNowBuyShoppingCart(int buyType,String partnerId, String storeId, String useId, String sessionId, String tableNumber, ShoppingCartBaseService shoppingCartService,Integer bizType) {
com.freemud.sdk.api.assortment.shoppingcart.domain.CartParamDto cartParamDto = getCartParamDto(partnerId, storeId, useId);
cartParamDto.setSessionId(sessionId);
cartParamDto.setTableNumber(tableNumber);
cartParamDto.setUserId(useId);
cartParamDto.setBizType(bizType);
if(buyType == ShoppingCartConstant.NOW_BUY_TYPE) {
cartParamDto.setBuyType(buyType);
}
......@@ -388,12 +392,13 @@ public class AssortmentSdkService {
* @param qty
* @return
*/
public List<CartGoods> updateNowBuyGoodsQtyBySdk(int buyType,String partnerId, String userId, String storeId, String cartGoodsUid, Integer qty, String tableNumber, ShoppingCartBaseService shoppingCartService) {
public List<CartGoods> updateNowBuyGoodsQtyBySdk(int buyType,String partnerId, String userId, String storeId, String cartGoodsUid, Integer qty, String tableNumber, ShoppingCartBaseService shoppingCartService,Integer bizType) {
com.freemud.sdk.api.assortment.shoppingcart.domain.CartParamDto cartParamDto = getCartParamDto(partnerId, storeId, userId);
cartParamDto.setCartGoodsUid(cartGoodsUid);
cartParamDto.setQty(qty);
cartParamDto.setTableNumber(tableNumber);
cartParamDto.setUserId(userId);
cartParamDto.setBizType(bizType);
//立即购买==1 ,设置新的缓存key
if(buyType == ShoppingCartConstant.NOW_BUY_TYPE) {
cartParamDto.setBuyType(buyType);
......
......@@ -131,7 +131,7 @@ public class CouponPromotionService implements IPromotionService {
List<String> uuidList = spqIdToCartUuid.get(sqpInfo.getCouponCode());
if (CollectionUtils.isNotEmpty(uuidList)){
List<CartGoods> newCartList = cartGoodsList.stream().filter(p -> !uuidList.contains(p.getCartGoodsUid())).collect(Collectors.toList());
assortmentSdkService.setShoppingCart(activityQueryDto.getPartnerId(), activityQueryDto.getStoreId(), userLoginInfoDto.getMemberId(), newCartList, null, null, this.shoppingCartBaseService);
assortmentSdkService.setShoppingCart(activityQueryDto.getPartnerId(), activityQueryDto.getStoreId(), userLoginInfoDto.getMemberId(), newCartList, null, null, this.shoppingCartBaseService,activityQueryDto.getBizType());
cartGoodsList = newCartList;
CheckSpqInfoResponseDto checkSpqInfoResponseDto = validCouponMap.get(spqId);
shoppingCartGoodsResponseVo.setChanged(true);
......
......@@ -1331,7 +1331,7 @@ public class CouponServiceImpl implements CouponService {
List<String> uuidList = spqIdToCartUuid.get(couponCode);
if (CollectionUtils.isNotEmpty(uuidList)){
List<CartGoods> newCartList = cartGoodsList.stream().filter(p -> !uuidList.contains(p.getCartGoodsUid())).collect(Collectors.toList());
assortmentSdkService.setShoppingCart(couponPromotionVO.getPartnerId(), couponPromotionVO.getStoreId(), couponPromotionVO.getUserId(), newCartList, null, null, this.shoppingCartBaseService);
assortmentSdkService.setShoppingCart(couponPromotionVO.getPartnerId(), couponPromotionVO.getStoreId(), couponPromotionVO.getUserId(), newCartList, null, null, this.shoppingCartBaseService,null);
throw new ServiceException(ResponseResult.SHOPPING_CART_USER_HAVE_NO_COUPON, ResponseResult.SHOPPING_CART_USER_HAVE_NO_COUPON.getMessage());
}
} else {
......@@ -1341,7 +1341,7 @@ public class CouponServiceImpl implements CouponService {
List<String> uuidList = spqIdToCartUuid.get(memberCouponCode);
if (CollectionUtils.isNotEmpty(uuidList)){
List<CartGoods> newCartList = cartGoodsList.stream().filter(p -> !uuidList.contains(p.getCartGoodsUid())).collect(Collectors.toList());
assortmentSdkService.setShoppingCart(couponPromotionVO.getPartnerId(), couponPromotionVO.getStoreId(), couponPromotionVO.getUserId(), newCartList, null, null, this.shoppingCartBaseService);
assortmentSdkService.setShoppingCart(couponPromotionVO.getPartnerId(), couponPromotionVO.getStoreId(), couponPromotionVO.getUserId(), newCartList, null, null, this.shoppingCartBaseService,null);
throw new ServiceException(ResponseResult.SHOPPING_CART_USER_HAVE_NO_COUPON, ResponseResult.SHOPPING_CART_USER_HAVE_NO_COUPON.getMessage());
}
}
......
......@@ -6,10 +6,8 @@ import cn.freemud.base.entity.BaseResponse;
import cn.freemud.constant.ResponseCodeConstant;
import cn.freemud.entities.dto.ActivityCalculationDiscountRequestDto;
import cn.freemud.entities.dto.ActivityCalculationDiscountResponseDto;
import cn.freemud.entities.dto.UserLoginInfoDto;
import cn.freemud.entities.dto.activity.ActivityQueryDto;
import cn.freemud.entities.dto.shoppingCart.ShoppingCartGoodsDto;
import cn.freemud.entities.dto.user.GetSessionUserInfoDto;
import cn.freemud.entities.vo.*;
import cn.freemud.enums.ActivityChannelEnum;
import cn.freemud.enums.ProductType;
......@@ -21,7 +19,10 @@ import cn.freemud.service.CommonService;
import cn.freemud.service.ShoppingCartNewService;
import cn.freemud.service.thirdparty.ActivityClient;
import cn.freemud.service.thirdparty.CustomerApplicationClient;
import cn.freemud.utils.*;
import cn.freemud.utils.PromotionFactory;
import cn.freemud.utils.PropertyConvertUtil;
import cn.freemud.utils.RedisLock;
import cn.freemud.utils.ResponseUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
......@@ -32,7 +33,6 @@ import com.freemud.api.assortment.datamanager.meal.MealCacheManager;
import com.freemud.api.assortment.datamanager.meal.dto.MealNumberDto;
import com.freemud.application.sdk.api.base.SDKCommonBaseContextWare;
import com.freemud.application.sdk.api.log.ErrorLog;
//import com.freemud.application.sdk.api.log.LogThreadLocal;
import com.freemud.application.sdk.api.log.LogThreadLocal;
import com.freemud.application.sdk.api.productcenter.domain.ProductBeanDTO;
import com.freemud.sdk.api.assortment.shoppingcart.constant.CartResponseConstant;
......@@ -51,6 +51,8 @@ import org.springframework.util.CollectionUtils;
import java.util.*;
import java.util.stream.Collectors;
//import com.freemud.application.sdk.api.log.LogThreadLocal;
/**
* All rights Reserved, Designed By www.freemud.com
*
......@@ -134,7 +136,7 @@ public class ShoppingCartMealServiceImpl implements ShoppingCartNewService {
}
//缓存中获取购物车商品信息
// 注意,围餐和点餐redis数据结构不一样
List<CartGoods> allCartGoodsList = assortmentSdkService.getShoppingCart(partnerId, storeId, userId, requestVo.getSessionId(), tableNumber, mealCartBaseService);
List<CartGoods> allCartGoodsList = assortmentSdkService.getShoppingCart(partnerId, storeId, userId, requestVo.getSessionId(), tableNumber, mealCartBaseService,null);
if (CollectionUtils.isEmpty(allCartGoodsList)) {
allCartGoodsList = new ArrayList<>();
}
......@@ -195,7 +197,7 @@ public class ShoppingCartMealServiceImpl implements ShoppingCartNewService {
}
try {
CartGoods goods = assortmentSdkService.getCartGoodsBySdk(customerInfo.getPartnerId(), customerInfo.getMemberId(),
customerInfo.getStoreId(), requestVo.getCartGoodsUid(), customerInfo.getTableNumber(), this.mealCartBaseService);
customerInfo.getStoreId(), requestVo.getCartGoodsUid(), customerInfo.getTableNumber(), this.mealCartBaseService,null);
if (goods == null) {
doUnlock(requestVo.getCartGoodsUid());
buildMealResponse(requestVo.getOrderType(), customerInfo, userCartsMap, responseVo);
......@@ -203,7 +205,7 @@ public class ShoppingCartMealServiceImpl implements ShoppingCartNewService {
}
// 更新购物车中数量
assortmentSdkService.updateGoodsQtyBySdk(customerInfo.getPartnerId(), customerInfo.getMemberId(),
customerInfo.getStoreId(), requestVo.getCartGoodsUid(), requestVo.getQty(), customerInfo.getTableNumber(), this.mealCartBaseService);
customerInfo.getStoreId(), requestVo.getCartGoodsUid(), requestVo.getQty(), customerInfo.getTableNumber(), this.mealCartBaseService,null);
} catch (Exception e) {
// ErrorLog.errorConvertJson(SDKCommonBaseContextWare.getAppName(), LogThreadLocal.getTrackingNo(), getClass(), "updateGoodsQty:" + e.getMessage(), e);
ErrorLog.errorConvertJson(getClass(),"updateGoodsQty:", e);
......@@ -264,7 +266,7 @@ public class ShoppingCartMealServiceImpl implements ShoppingCartNewService {
return;
}
//sessionId为空时,查询所有的
List<CartGoods> cartGoodsList = assortmentSdkService.getShoppingCart(customerInfo.getPartnerId(), customerInfo.getStoreId(), "", "", customerInfo.getTableNumber(), this.mealCartBaseService);
List<CartGoods> cartGoodsList = assortmentSdkService.getShoppingCart(customerInfo.getPartnerId(), customerInfo.getStoreId(), "", "", customerInfo.getTableNumber(), this.mealCartBaseService,null);
if (CollectionUtils.isEmpty(cartGoodsList)) {
return;
}
......@@ -425,7 +427,7 @@ public class ShoppingCartMealServiceImpl implements ShoppingCartNewService {
if (CollectionUtils.isEmpty(cartGoodsList)) {
return;
}
ActivityCalculationDiscountResponseDto.CalculationDiscountResult calculationDiscountResult = this.getActivityCalculationDiscountResponse(partnerId, storeId, userId, appId, orderType, isMember, cartGoodsList, new ArrayList<>(), new ArrayList<>(), BusinessTypeEnum.SAAS_MALL.getCode(), 0L);
ActivityCalculationDiscountResponseDto.CalculationDiscountResult calculationDiscountResult = this.getActivityCalculationDiscountResponse(partnerId, storeId, userId, appId, orderType, isMember, cartGoodsList, new ArrayList<>(), new ArrayList<>(), BusinessTypeEnum.SAAS_MALL.getCode(), 0L,null);
if(calculationDiscountResult == null) {
return;
}
......@@ -516,7 +518,7 @@ public class ShoppingCartMealServiceImpl implements ShoppingCartNewService {
return check;
}
//sessionId为空时,查询所有的
List<CartGoods> cartGoodsList = assortmentSdkService.getShoppingCart(customerInfo.getPartnerId(), customerInfo.getStoreId(), customerInfo.getMemberId(), "", customerInfo.getTableNumber(), this.mealCartBaseService);
List<CartGoods> cartGoodsList = assortmentSdkService.getShoppingCart(customerInfo.getPartnerId(), customerInfo.getStoreId(), customerInfo.getMemberId(), "", customerInfo.getTableNumber(), this.mealCartBaseService,null);
if (CollectionUtils.isEmpty(cartGoodsList)) {
return ResponseUtil.error(ResponseResult.SHOPPING_CART_ADD_INVAILD, result);
}
......@@ -554,7 +556,7 @@ public class ShoppingCartMealServiceImpl implements ShoppingCartNewService {
@Override
public ActivityCalculationDiscountResponseDto.CalculationDiscountResult getActivityCalculationDiscountResponse(String partnerId, String storeId, String userId, String appId, Integer orderType, boolean isMember,
List<CartGoods> cartGoodsList, List<ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon> coupons, List<ShoppingCartInfoRequestVo.SendGoods> sendGoodsList,String menuType,Long distributionFee) {
List<CartGoods> cartGoodsList, List<ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon> coupons, List<ShoppingCartInfoRequestVo.SendGoods> sendGoodsList,String menuType,Long distributionFee,Integer bizType) {
ActivityCalculationDiscountRequestDto activityCalculationDiscountRequestDto = getActivityCalculationDiscountRequestDto(partnerId, storeId, userId, appId, orderType);
List<ActivityCalculationDiscountRequestDto.CalculationDiscountGoods> calculationDiscountGoodsList = new ArrayList<>();
cartGoodsList = cartGoodsList.stream().filter(t -> !isWeightProduct(t)).collect(Collectors.toList());
......
......@@ -16,6 +16,8 @@ import cn.freemud.constant.RedisKeyConstant;
import cn.freemud.entities.vo.CartGoods;
import cn.freemud.service.ShoppingCartNewBaseService;
import com.freemud.application.sdk.api.base.SDKCommonBaseContextWare;
import com.freemud.application.sdk.api.ordercenter.common.OrderAndShoppingCommonRedisKey;
import com.freemud.application.sdk.api.ordercenter.enums.BizTypeEnum;
import com.freemud.sdk.api.assortment.shoppingcart.service.impl.ShoppingCartBaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.BoundHashOperations;
......@@ -24,6 +26,7 @@ import org.springframework.stereotype.Service;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
@Service
public class ShoppingCartNewBaseServiceImpl implements ShoppingCartNewBaseService {
......@@ -39,18 +42,20 @@ public class ShoppingCartNewBaseServiceImpl implements ShoppingCartNewBaseServic
public List<CartGoods> add(String partnerId, String storeId, String userId, CartGoods cartGoods) {
BoundHashOperations<String, String, CartGoods> operations = this.getShoppingCartGoodsZSetOperations(partnerId, storeId, userId);
operations.put(cartGoods.getCartGoodsUid(), cartGoods);
return assortmentSdkService.getShoppingCart(partnerId, storeId, userId,null,null, SDKCommonBaseContextWare.getBean(ShoppingCartBaseServiceImpl.class));
return assortmentSdkService.getShoppingCart(partnerId, storeId, userId,null,null, SDKCommonBaseContextWare.getBean(ShoppingCartBaseServiceImpl.class),null);
}
@Override
public void clear(String partnerId, String storeId, String userId) {
redisTemplate.delete(this.getShoppingCartGoodsKey(partnerId, storeId, userId));
public void clear(String partnerId, String storeId, String userId,Integer bizType) {
// fisherman 提供 订单 & 购物车 公共方法
// redisTemplate.delete(this.getShoppingCartGoodsKey(partnerId, storeId, userId,bizType));
redisTemplate.delete(OrderAndShoppingCommonRedisKey.getShoppingCartGoodsKey(partnerId,storeId,userId, bizType));
//redisTemplate.delete(this.getShoppingCartGoodsAmountKey(partnerId, storeId, userId));
}
private BoundHashOperations getShoppingCartGoodsZSetOperations(String partnerId, String storeId, String userId) {
String key = this.getShoppingCartGoodsKey(partnerId, storeId, userId);
String key = this.getShoppingCartGoodsKey(partnerId, storeId, userId,null);
return redisTemplate.boundHashOps(key);
}
......@@ -62,8 +67,8 @@ public class ShoppingCartNewBaseServiceImpl implements ShoppingCartNewBaseServic
* @param userId
* @return
*/
private String getShoppingCartGoodsKey(String partnerId, String storeId, String userId) {
return RedisKeyConstant.SAAS_SHOPPINGCART_KEY_PREFIX + partnerId + "_" + storeId + "_" + userId;
private String getShoppingCartGoodsKey(String partnerId, String storeId, String userId,Integer bizType) {
return OrderAndShoppingCommonRedisKey.getShoppingCartGoodsKey(partnerId,storeId,userId, bizType);
}
/**
......
......@@ -85,7 +85,7 @@ public class CalculationSharingCartService {
/**
* 可用券及券折扣
*/
promotionSharingService.updateShoppingCartGoodsDiscount(discountResult, cartGoodsList, shoppingCartGoodsResponseVo, couponPromotionVO,shoppingCartInfoRequestVo, userId, partnerId, storeId, activityQueryDto.getOrderType());
promotionSharingService.updateShoppingCartGoodsDiscount(discountResult, cartGoodsList, shoppingCartGoodsResponseVo, couponPromotionVO,shoppingCartInfoRequestVo, userId, partnerId, storeId, activityQueryDto.getOrderType(),activityQueryDto.getBizType());
/**
* 满减处理
......
......@@ -85,7 +85,7 @@ public class CalculationSharingDiscountService {
, List<CalculationSharingDiscountRequestDto.CalculationDiscountCoupon> coupons
, List<ShoppingCartInfoRequestVo.SendGoods> sendGoodsList
, Long deliveryAmount
, ShoppingCartInfoRequestVo shoppingCartInfoRequestVo) {
, ShoppingCartInfoRequestVo shoppingCartInfoRequestVo,Integer bizType) {
CalculationSharingDiscountRequestDto calculationSharingDiscountRequestDto = this.commonSharingDto(partnerId, storeId, userId, appId, orderType);
......@@ -115,7 +115,7 @@ public class CalculationSharingDiscountService {
}
if (null == checkSpqInfo) {
cartGoodsList.remove(i);
assortmentSdkService.setShoppingCart(partnerId, storeId, userId, cartGoodsList, null, null, this.shoppingCartBaseService);
assortmentSdkService.setShoppingCart(partnerId, storeId, userId, cartGoodsList, null, null, this.shoppingCartBaseService,bizType);
//跑业务异常 商品券不存
} else {
if(useCoupon){
......@@ -156,7 +156,7 @@ public class CalculationSharingDiscountService {
if (GoodsTypeEnum.SET_MEAL_GOODS.getGoodsType().equals(cartGoods.getGoodsType())) {
if (CollectionUtils.isEmpty(cartGoods.getProductGroupList()) && CollectionUtils.isEmpty(cartGoods.getProductComboList())) {
cartGoodsList.remove(i);
assortmentSdkService.setShoppingCart(partnerId, storeId, userId, cartGoodsList, null, null, this.shoppingCartBaseService);
assortmentSdkService.setShoppingCart(partnerId, storeId, userId, cartGoodsList, null, null, this.shoppingCartBaseService,bizType);
throw new ServiceException(ResponseResult.SHOPPING_CART_NO_MEAL);
}
}
......
......@@ -48,7 +48,7 @@ public class CouponSharingService {
, List<CartGoods> cartGoodsList
, ShoppingCartGoodsResponseVo shoppingCartGoodsResponseVo
, CouponPromotionVO couponPromotionVO
,ShoppingCartInfoRequestVo shoppingCartInfoRequestVo, String userId, String partnerId, String storeId, Integer orderType) {
,ShoppingCartInfoRequestVo shoppingCartInfoRequestVo, String userId, String partnerId, String storeId, Integer orderType,Integer bizType) {
// 用户选择了查询优惠券信息
if (couponPromotionVO != null && !ObjectUtils.equals(AvailableCouponQueryFlagEnum.NO.getCode(), couponPromotionVO.getAvailableCouponQueryFlag())) {
List<CartGoods> tmpCartGoods = cartGoodsList.parallelStream().filter(k -> (StringUtils.isNotBlank(k.getCouponCode()) || k.getCartGoodsUid()
......@@ -119,7 +119,7 @@ public class CouponSharingService {
List<String> uuidList = spqIdToCartUuid.get(sqpInfo.getCouponCode());
if (CollectionUtils.isNotEmpty(uuidList)){
List<CartGoods> newCartList = cartGoodsList.stream().filter(p -> !uuidList.contains(p.getCartGoodsUid())).collect(Collectors.toList());
assortmentSdkService.setShoppingCart(partnerId, storeId, userId, newCartList, null, null, this.shoppingCartBaseService);
assortmentSdkService.setShoppingCart(partnerId, storeId, userId, newCartList, null, null, this.shoppingCartBaseService,bizType);
cartGoodsList = newCartList;
CheckSpqInfoResponseDto checkSpqInfoResponseDto = validCouponMap.get(spqId);
shoppingCartGoodsResponseVo.setChanged(true);
......
......@@ -66,7 +66,7 @@ public class AssortmentSdkServiceTest {
String storeId = "1000189";
String useId = "115547751030883080";
List<CartGoods> result = assortmentSdkService.setShoppingCart(partnerId, storeId, useId, cartGoodsList,"","",shoppingCartBaseService);
List<CartGoods> result = assortmentSdkService.setShoppingCart(partnerId, storeId, useId, cartGoodsList,"","",shoppingCartBaseService,null);
System.out.println(JSONObject.toJSONString(result));
}
......@@ -76,7 +76,7 @@ public class AssortmentSdkServiceTest {
String storeId = "1000189";
String useId = "115547751030883080";
List<CartGoods> result = assortmentSdkService.getShoppingCart(partnerId, storeId, useId,"","",shoppingCartBaseService);
List<CartGoods> result = assortmentSdkService.getShoppingCart(partnerId, storeId, useId,"","",shoppingCartBaseService,null);
System.out.println(JSONObject.toJSONString(result));
}
......
......@@ -76,19 +76,19 @@ public class ShoppingCartNewBaseServiceTest {
@Test
public void updateGoodsQty() {
List<CartGoods> list = assortmentSdkService.updateGoodsQtyBySdk("1864", "1011", "123", "4srwtergew", 1, "", this.shoppingCartBaseService);
List<CartGoods> list = assortmentSdkService.updateGoodsQtyBySdk("1864", "1011", "123", "4srwtergew", 1, "", this.shoppingCartBaseService,null);
assertTrue(CollectionUtils.isNotEmpty(list));
}
@Test
public void getCartGoods() {
CartGoods cartGoods = assortmentSdkService.getCartGoodsBySdk("1864", "1011", "123", "142sfdrasr", "", this.shoppingCartBaseService);
CartGoods cartGoods = assortmentSdkService.getCartGoodsBySdk("1864", "1011", "123", "142sfdrasr", "", this.shoppingCartBaseService,null);
assertFalse(Objects.equals(cartGoods, null));
}
@Test
public void clearTest() {
shoppingCartNewBaseService.clear("1864", "1011", "123");
shoppingCartNewBaseService.clear("1864", "1011", "123",null);
}
}
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