Commit 6046cc06 by zhiheng.zhang

Merge remote-tracking branch 'origin/develop' into develop

parents e2d93ea0 629732ff
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>assortment-ordercenter-sdk</artifactId> <artifactId>assortment-ordercenter-sdk</artifactId>
<version>2.0.16-SNAPSHOT</version> <version>2.0.17-SNAPSHOT</version>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
<dependency> <dependency>
<groupId>cn.freemud</groupId> <groupId>cn.freemud</groupId>
<artifactId>ordercenter-sdk</artifactId> <artifactId>ordercenter-sdk</artifactId>
<version>1.4.37-SNAPSHOT</version> <version>1.4.38-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.freemud.application.service.sdk</groupId> <groupId>com.freemud.application.service.sdk</groupId>
......
...@@ -84,4 +84,5 @@ ...@@ -84,4 +84,5 @@
| 2.0.13-SNAPSHOT| 加料商品 | 谌会阳 |2020-08-14 | 2.0.13-SNAPSHOT| 加料商品 | 谌会阳 |2020-08-14
| 2.0.14-SNAPSHOT| 商品统计分类名称保存 | wuping | 2020-08-20 | | 2.0.14-SNAPSHOT| 商品统计分类名称保存 | wuping | 2020-08-20 |
| 2.0.15-SNAPSHOT| 升级ordercenter-sdk | 肖家炜 | 2020-08-25 | | 2.0.15-SNAPSHOT| 升级ordercenter-sdk | 肖家炜 | 2020-08-25 |
| 2.0.16-SNAPSHOT| 升级ordercenter-sdk,麦咖啡汇集回调 | 徐康 | 2020-09-02 | | 2.0.16-SNAPSHOT| 升级ordercenter-sdk,麦咖啡汇集回调 | 徐康 | 2020-09-02 |
\ No newline at end of file | 2.0.17-SNAPSHOT| 升级ordercenter-sdk,麦咖啡加料 | 徐康 | 2020-09-28 |
\ No newline at end of file
...@@ -177,4 +177,5 @@ public class CreateOrderProductRequest extends BaseConfig { ...@@ -177,4 +177,5 @@ public class CreateOrderProductRequest extends BaseConfig {
private String taxId; private String taxId;
private List<String> specialCodes;
} }
...@@ -70,5 +70,6 @@ public class OrderProductAddInfoDto extends BaseConfig { ...@@ -70,5 +70,6 @@ public class OrderProductAddInfoDto extends BaseConfig {
private double tax; private double tax;
private String taxId; private String taxId;
private List<String> specialCodes;
} }
...@@ -43,6 +43,16 @@ public interface OrderCenterSdkService { ...@@ -43,6 +43,16 @@ public interface OrderCenterSdkService {
QueryOrdersResponse queryOrders(QueryOrdersRequest queryOrdersRequest); QueryOrdersResponse queryOrders(QueryOrdersRequest queryOrdersRequest);
/** /**
* 根据订单编号查询订单信息 C端
*/
QueryOrderByIdResponse queryMCCafeOrderById(BaseQueryOrderRequest baseQueryOrderRequest);
/**
* 条件查询订单列表 C端
*/
QueryOrdersResponse queryMCCafeOrders(QueryOrdersRequest queryOrdersRequest);
/**
* 删除订单 C端 * 删除订单 C端
*/ */
BaseOrderResponse deleteOrder(DeleteOrderRequest deleteOrderRequest); BaseOrderResponse deleteOrder(DeleteOrderRequest deleteOrderRequest);
......
...@@ -464,6 +464,30 @@ public class OrderCenterSdkServiceImpl implements OrderCenterSdkService { ...@@ -464,6 +464,30 @@ public class OrderCenterSdkServiceImpl implements OrderCenterSdkService {
} }
@Override @Override
public QueryOrderByIdResponse queryMCCafeOrderById(BaseQueryOrderRequest request) {
QueryByCodeResponse orderInfo = orderSdkService.getOrderInfo(request.getOrderClient(), request.getOrderId(),
request.getThirdOrderCode(), request.getWithOperationHistory(), request.getTrackingNo());
QueryOrderByIdResponse response = new QueryOrderByIdResponse();
if (orderInfo == null || orderInfo.getResult() == null) {
return response;
}
response.setErrcode(Integer.parseInt(orderInfo.getCode()));
response.setErrmsg(orderInfo.getMessage());
if (orderInfo.getResult().getOrderCode() == null || "".equals(orderInfo.getResult().getOrderCode())) {
return response;
}
QueryOrderByIdResponse orderByIdResponse = orderSdkAdapter.convent2QueryOrderByIdResponse(orderInfo);
return orderByIdResponse;
}
@Override
public QueryOrdersResponse queryMCCafeOrders(QueryOrdersRequest queryOrdersRequest) {
OrderUserConditionsReq request = orderSdkAdapter.convent2QueryOrdersRequest(queryOrdersRequest);
com.freemud.application.sdk.api.ordercenter.response.BaseResponse<QueryOrderForUserResp> userorderResponse = orderSdkService.queryOrderForUser(request, queryOrdersRequest.getTrackingNo());
return orderSdkAdapter.convent2QueryOrdersResponse(userorderResponse);
}
@Override
public BaseOrderResponse deleteOrder(DeleteOrderRequest deleteOrderRequest) { public BaseOrderResponse deleteOrder(DeleteOrderRequest deleteOrderRequest) {
OrderDeleteReq request = new OrderDeleteReq(); OrderDeleteReq request = new OrderDeleteReq();
request.setOrderCode(deleteOrderRequest.getOrderId()); request.setOrderCode(deleteOrderRequest.getOrderId());
......
...@@ -67,4 +67,4 @@ ...@@ -67,4 +67,4 @@
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
package com.freemud.sdk.api.assortment.shoppingcart.adapter; package com.freemud.sdk.api.assortment.shoppingcart.adapter;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.freemud.application.sdk.api.log.ErrorLog; import com.freemud.application.sdk.api.log.ErrorLog;
import com.freemud.application.sdk.api.log.LogThreadLocal;
import com.freemud.application.sdk.api.productcenter.domain.ProductBeanDTO; import com.freemud.application.sdk.api.productcenter.domain.ProductBeanDTO;
import com.freemud.application.sdk.api.productcenter.request.product.valid.ProductAttributeValueType; import com.freemud.application.sdk.api.productcenter.request.product.valid.ProductAttributeValueType;
import com.freemud.application.sdk.api.productcenter.request.product.valid.ValidateShopProductRequest; import com.freemud.application.sdk.api.productcenter.request.product.valid.ValidateShopProductRequest;
...@@ -11,6 +14,7 @@ import com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoods; ...@@ -11,6 +14,7 @@ import com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoods;
import com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoodsStates; import com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoodsStates;
import com.freemud.sdk.api.assortment.shoppingcart.request.CheckCartRequest; 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.request.GetProductInfoRequest;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.ObjectUtils; import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
...@@ -32,6 +36,7 @@ import java.util.stream.Collectors; ...@@ -32,6 +36,7 @@ import java.util.stream.Collectors;
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目的 * 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目的
*/ */
@Component @Component
@Slf4j
public class ShoppingCartAdapter { public class ShoppingCartAdapter {
private static final String ATTRIBUTEID = "attributeId"; private static final String ATTRIBUTEID = "attributeId";
private static final String ATTRIBUTENAME = "attributeName"; private static final String ATTRIBUTENAME = "attributeName";
...@@ -258,6 +263,7 @@ public class ShoppingCartAdapter { ...@@ -258,6 +263,7 @@ public class ShoppingCartAdapter {
* @param productBeans 购物车中所有的productId对应的商品详情 * @param productBeans 购物车中所有的productId对应的商品详情
*/ */
public void updateCartGoodsInfoNew(CartGoods cartGoods, List<ProductBeanDTO> productBeans) { public void updateCartGoodsInfoNew(CartGoods cartGoods, List<ProductBeanDTO> productBeans) {
log.info("【updateCartGoodsInfoNew】: cartGoods: {}, productBeans: {} ,trackingNo:{}", JSONObject.toJSONString(cartGoods), JSONObject.toJSONString(productBeans), LogThreadLocal.getTrackingNo());
try { try {
Optional<ProductBeanDTO> firstProduct = productBeans.stream().filter(p -> ObjectUtils.equals(p.getPid(), cartGoods.getSpuId())).findFirst(); Optional<ProductBeanDTO> firstProduct = productBeans.stream().filter(p -> ObjectUtils.equals(p.getPid(), cartGoods.getSpuId())).findFirst();
if (!firstProduct.isPresent()) { if (!firstProduct.isPresent()) {
...@@ -271,9 +277,12 @@ public class ShoppingCartAdapter { ...@@ -271,9 +277,12 @@ public class ShoppingCartAdapter {
ProductBeanDTO.SkuProductBean skuProduct = isSkuProduct ? spuProduct.getSkuList().stream().filter(p -> ObjectUtils.equals(cartGoods.getSkuId(), p.getSkuId())).findFirst().get() : null; ProductBeanDTO.SkuProductBean skuProduct = isSkuProduct ? spuProduct.getSkuList().stream().filter(p -> ObjectUtils.equals(cartGoods.getSkuId(), p.getSkuId())).findFirst().get() : null;
Map<String, String> attributes = getAttributesNew(cartGoods.getExtra()); Map<String, String> attributes = getAttributesNew(cartGoods.getExtra());
cartGoods.setName(spuProduct.getName()); if(!"早餐啡常搭".equals(cartGoods.getName()) && !"早餐啡常搭".equals(cartGoods.getSkuName()) && !"早餐啡常搭".equals(cartGoods.getSpuName())
cartGoods.setSpuName(spuProduct.getName()); && !"啡常搭".equals(cartGoods.getName()) && !"啡常搭".equals(cartGoods.getSkuName()) && !"啡常搭".equals(cartGoods.getSpuName())) {
cartGoods.setSkuName(isSkuProduct ? skuProduct.getProductName() : spuProduct.getName()); cartGoods.setName(spuProduct.getName());
cartGoods.setSpuName(spuProduct.getName());
cartGoods.setSkuName(isSkuProduct ? skuProduct.getProductName() : spuProduct.getName());
}
cartGoods.setSpecProductId(attributes.get(ATTRIBUTEID)); cartGoods.setSpecProductId(attributes.get(ATTRIBUTEID));
cartGoods.setPic(spuProduct.getPicture()); cartGoods.setPic(spuProduct.getPicture());
cartGoods.setPackPrice(isSkuProduct ? skuProduct.getPackPrice() : spuProduct.getPackPrice()); cartGoods.setPackPrice(isSkuProduct ? skuProduct.getPackPrice() : spuProduct.getPackPrice());
......
...@@ -37,15 +37,18 @@ public class ShoppingCartConstant { ...@@ -37,15 +37,18 @@ public class ShoppingCartConstant {
* 商品价格校验失败 * 商品价格校验失败
*/ */
public static final int PRODUCT_PRICE_CHANGE = 102; public static final int PRODUCT_PRICE_CHANGE = 102;
public static final String CART_PRODUCT_PRICE_CHANGE = "您选择的【$spuName】商品价格将发生变化;";
/** /**
* 商品不存在 * 商品不存在
*/ */
public static final int PRODUCT_NOTFOUND= 103; public static final int PRODUCT_NOTFOUND= 103;
public static final String CART_PRODUCT_NOT_FOUND = "您选择的【$spuName】商品不在当前门店菜单中;";
/** /**
* 商品状态校验失败 * 商品状态校验失败
*/ */
public static final int PRODUCT_DOWN= 104; public static final int PRODUCT_DOWN= 104;
public static final String CART_PRODUCT_INVALID_STATE = "您选择的【$spuName】商品已失效;";
} }
...@@ -119,6 +119,11 @@ public class CartGoods { ...@@ -119,6 +119,11 @@ public class CartGoods {
private List<CartGoodsExtra> extra; private List<CartGoodsExtra> extra;
/** /**
* 麦咖啡定制属性
*/
private List<SpecialExtra> specialExtra;
/**
* 创建时间(mili) * 创建时间(mili)
*/ */
private long createTimeMili = System.currentTimeMillis(); private long createTimeMili = System.currentTimeMillis();
...@@ -200,11 +205,29 @@ public class CartGoods { ...@@ -200,11 +205,29 @@ public class CartGoods {
} }
@Data @Data
public final static class SpecialExtra {
/**
* 属性Id
*/
private String attributeId;
/**
* 属性名
*/
private String attributeName;
/**
* 麦咖啡特定属性入机code
*/
private String specialCode;
}
@Data
public final static class ComboxGoods{ public final static class ComboxGoods{
/** /**
* 单规格spuId,多规格skuId * 单规格spuId,多规格skuId
*/ */
private String goodsId; private String goodsId;
private String spuId;
private String skuId; private String skuId;
private String skuName; private String skuName;
/** /**
...@@ -286,6 +309,16 @@ public class CartGoods { ...@@ -286,6 +309,16 @@ public class CartGoods {
private List<CartGoodsExtra> extra; private List<CartGoodsExtra> extra;
/** /**
* 麦咖啡定制属性
*/
private List<SpecialExtra> specialExtra;
/**
* 麦咖啡套餐商品加料
*/
private List<MaterialGoods> productMaterialList;
/**
* 税率 * 税率
*/ */
private Double tax; private Double tax;
......
...@@ -38,6 +38,7 @@ import com.freemud.sdk.api.assortment.shoppingcart.request.CheckCartRequest; ...@@ -38,6 +38,7 @@ 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.request.GetProductInfoRequest;
import com.freemud.sdk.api.assortment.shoppingcart.util.CartResponseUtil; 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.DateTimeUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -231,7 +232,6 @@ public interface ShoppingCartBaseService { ...@@ -231,7 +232,6 @@ public interface ShoppingCartBaseService {
ValidateShopProductRequest validateShopProductRequest = shoppingCartAdapter.getValidateShopProductRequest(checkCartRequest); ValidateShopProductRequest validateShopProductRequest = shoppingCartAdapter.getValidateShopProductRequest(checkCartRequest);
com.freemud.application.sdk.api.base.BaseResponse<ValiadShopProductResponse> valiadResponse = productService.validateShopProductAboutReason(validateShopProductRequest); com.freemud.application.sdk.api.base.BaseResponse<ValiadShopProductResponse> valiadResponse = productService.validateShopProductAboutReason(validateShopProductRequest);
//TODO 疑问
if (valiadResponse == null || !CartResponseConstant.SUCCESS.getCode().equals(valiadResponse.getCode()) || valiadResponse.getData()==null) { if (valiadResponse == null || !CartResponseConstant.SUCCESS.getCode().equals(valiadResponse.getCode()) || valiadResponse.getData()==null) {
checkCartRequest.getCartGoodsList().clear(); checkCartRequest.getCartGoodsList().clear();
checkCartRequest.getShoppingCartGoodsResponseVo().setChanged(true); checkCartRequest.getShoppingCartGoodsResponseVo().setChanged(true);
...@@ -239,37 +239,67 @@ public interface ShoppingCartBaseService { ...@@ -239,37 +239,67 @@ public interface ShoppingCartBaseService {
return CartResponseUtil.error(valiadResponse.getMessage(),checkCartRequest); return CartResponseUtil.error(valiadResponse.getMessage(),checkCartRequest);
} }
ValiadShopProductResponse validateResult = valiadResponse.getData(); ValiadShopProductResponse validateResult = valiadResponse.getData();
CartGoodsStates cartGoodsStates = new CartGoodsStates();
//非法商品(商品是否存在、商品是否处于上架状态)自动移除,返回前端提示 //非法商品(商品是否存在、商品是否处于上架状态)自动移除,返回前端提示
if (CollectionUtils.isNotEmpty(validateResult.getFailureList())){ if (CollectionUtils.isNotEmpty(validateResult.getFailureList())){
List<String> invalidSpu = new ArrayList<>();
List<String> notFoundSpu = new ArrayList<>();
List<String> changePriceSpu = new ArrayList<>();
for (int i = 0; i < validateResult.getFailureList().size(); i++) { for (int i = 0; i < validateResult.getFailureList().size(); i++) {
checkCartRequest.getShoppingCartGoodsResponseVo().setChanged(true); ValiadShopProductResult validaProduct = validateResult.getFailureList().get(i);
switch (validateResult.getFailureList().get(i).getCode()){ for (CartGoods cartGoods : checkCartRequest.getCartGoodsList()) {
case PRODUCT_PRICE_CHANGE :
checkCartRequest.getShoppingCartGoodsResponseVo().setToastMsg(ShoppingCartConstant.SHOPPING_CART_ACTIVITY_CHANGE);
break;
case PRODUCT_NOTFOUND:
checkCartRequest.getShoppingCartGoodsResponseVo().setToastMsg(ShoppingCartConstant.SHOPPING_CART_EMPTY_GOODS_LIST);
break;
case PRODUCT_DOWN:
checkCartRequest.getShoppingCartGoodsResponseVo().setToastMsg(ShoppingCartConstant.SHOPPING_CART_INVALID_GOODS_EXIST);
break;
default:
break;
}
// return CartResponseUtil.error(valiadResponse.getMessage(),checkCartRequest);
}
setToastMsgIfNotExist(checkCartRequest.getShoppingCartGoodsResponseVo(), ShoppingCartConstant.SHOPPING_CART_GOODS_CHANGE);
for (CartGoods cartGoods :checkCartRequest.getCartGoodsList()) {
if (validateResult.getFailureList().stream().anyMatch(f->cartGoods.getCartGoodsUid().equals(f.getUuid()))){
cartGoods.setCartGoodsUid(null);
checkCartRequest.getShoppingCartGoodsResponseVo().setChanged(true); checkCartRequest.getShoppingCartGoodsResponseVo().setChanged(true);
checkCartRequest.getShoppingCartGoodsResponseVo().setToastMsg(ShoppingCartConstant.SHOPPING_CART_INVALIAD_GOODS); if (cartGoods.getSkuId().equals(validaProduct.getSkuId())) {
String spuName = null == validaProduct.getProductType() ? (StringUtils.isNotEmpty(cartGoods.getSkuName()) ? cartGoods.getSkuName() :
StringUtils.isNotEmpty(cartGoods.getName()) ? cartGoods.getName() : "") : validaProduct.getProductType().getName();
if (PRODUCT_DOWN == validaProduct.getCode()) {
if (StringUtils.isNotEmpty(spuName)){
invalidSpu.add(spuName);
}
cartGoodsStates.setHasInvalidGoods(true);
cartGoods.setCartGoodsUid(null);
break;
}
if (PRODUCT_NOTFOUND == validaProduct.getCode()) {
if (StringUtils.isNotEmpty(spuName)) {
notFoundSpu.add(spuName);
}
cartGoodsStates.setHasInvalidGoods(true);
cartGoods.setCartGoodsUid(null);
break;
}
if (PRODUCT_PRICE_CHANGE == validaProduct.getCode()) {
if (StringUtils.isNotEmpty(spuName)) {
changePriceSpu.add(spuName);
}
List<ProductBeanDTO> productList = validateResult.getFailureList().stream().filter(f-> f.getCode() == PRODUCT_PRICE_CHANGE).map(ValiadShopProductResult::getProductType).collect(Collectors.toList());
shoppingCartAdapter.updateCartGoodsInfoNew(cartGoods, productList);
break;
}
}
} }
} }
String toastMsg = "";
if (CollectionUtils.isNotEmpty(invalidSpu)){
toastMsg = toastMsg.concat(CART_PRODUCT_INVALID_STATE.replace("$spuName",StringUtils.join(invalidSpu,",")));
}
if (CollectionUtils.isNotEmpty(notFoundSpu)){
toastMsg = toastMsg.concat(CART_PRODUCT_NOT_FOUND.replace("$spuName",StringUtils.join(notFoundSpu,",")));
}
if (CollectionUtils.isNotEmpty(changePriceSpu)){
toastMsg = toastMsg.concat(CART_PRODUCT_PRICE_CHANGE.replace("$spuName",StringUtils.join(changePriceSpu,",")));
}
checkCartRequest.getShoppingCartGoodsResponseVo().setToastMsg(toastMsg);
setToastMsgIfNotExist(checkCartRequest.getShoppingCartGoodsResponseVo(), ShoppingCartConstant.SHOPPING_CART_GOODS_CHANGE);
checkCartRequest.getCartGoodsList().removeIf(k -> StringUtils.isEmpty(k.getCartGoodsUid())); checkCartRequest.getCartGoodsList().removeIf(k -> StringUtils.isEmpty(k.getCartGoodsUid()));
} }
List<ProductBeanDTO> productList = validateResult.getSuccessList().stream().map(ValiadShopProductResult::getProductType).collect(Collectors.toList()); List<ProductBeanDTO> productList = validateResult.getSuccessList().stream().map(ValiadShopProductResult::getProductType).collect(Collectors.toList());
CartGoodsStates cartGoodsStates = new CartGoodsStates();
for (CartGoods cartGoods : checkCartRequest.getCartGoodsList()) { for (CartGoods cartGoods : checkCartRequest.getCartGoodsList()) {
// 当goodsId为空或商品是商品券时直接跳过 // 当goodsId为空或商品是商品券时直接跳过
if (StringUtils.isEmpty(cartGoods.getGoodsId()) || Objects.equals(cartGoods.getGoodsType(), GoodsTypeEnum.COUPON_GOODS.getGoodsType())) { if (StringUtils.isEmpty(cartGoods.getGoodsId()) || Objects.equals(cartGoods.getGoodsType(), GoodsTypeEnum.COUPON_GOODS.getGoodsType())) {
...@@ -291,12 +321,11 @@ public interface ShoppingCartBaseService { ...@@ -291,12 +321,11 @@ public interface ShoppingCartBaseService {
checkCartRequest.getShoppingCartGoodsResponseVo().setChanged(true); checkCartRequest.getShoppingCartGoodsResponseVo().setChanged(true);
checkCartRequest.getShoppingCartGoodsResponseVo().setToastMsg(ShoppingCartConstant.SHOPPING_CART_INVALIAD_GOODS); checkCartRequest.getShoppingCartGoodsResponseVo().setToastMsg(ShoppingCartConstant.SHOPPING_CART_INVALIAD_GOODS);
} }
//todo 小料 // if (checkCartRequest.getCartGoodsList().stream().anyMatch(cart -> cart.getGoodsType().equals(GoodsTypeEnum.EXCEPTION_GOODS.getGoodsType()))) {
if (checkCartRequest.getCartGoodsList().stream().anyMatch(cart -> cart.getGoodsType().equals(GoodsTypeEnum.EXCEPTION_GOODS.getGoodsType()))) { // checkCartRequest.getCartGoodsList().removeIf(k -> k.getGoodsType().equals(GoodsTypeEnum.EXCEPTION_GOODS.getGoodsType()));
checkCartRequest.getCartGoodsList().removeIf(k -> k.getGoodsType().equals(GoodsTypeEnum.EXCEPTION_GOODS.getGoodsType())); // checkCartRequest.getShoppingCartGoodsResponseVo().setChanged(true);
checkCartRequest.getShoppingCartGoodsResponseVo().setChanged(true); // checkCartRequest.getShoppingCartGoodsResponseVo().setToastMsg(ShoppingCartConstant.SHOPPING_CART_MATERIAL_ERROR);
checkCartRequest.getShoppingCartGoodsResponseVo().setToastMsg(ShoppingCartConstant.SHOPPING_CART_MATERIAL_ERROR); // }
}
return CartResponseUtil.success(checkCartRequest); return CartResponseUtil.success(checkCartRequest);
} catch (Exception e) { } catch (Exception e) {
ErrorLog.printErrorLog("assortment-shoppingcart-sdk", checkCartRequest.getTrackingNo(), e.getMessage(), "checkAllCartGoods", checkCartRequest, e, Level.ERROR); ErrorLog.printErrorLog("assortment-shoppingcart-sdk", checkCartRequest.getTrackingNo(), e.getMessage(), "checkAllCartGoods", checkCartRequest, e, Level.ERROR);
...@@ -306,8 +335,6 @@ public interface ShoppingCartBaseService { ...@@ -306,8 +335,6 @@ public interface ShoppingCartBaseService {
} }
} }
/** /**
* 更新购物车详细信息 * 更新购物车详细信息
* 并check购物车中商品是否价格变更、是否非法(例如商品下架) * 并check购物车中商品是否价格变更、是否非法(例如商品下架)
...@@ -1009,5 +1036,4 @@ public interface ShoppingCartBaseService { ...@@ -1009,5 +1036,4 @@ public interface ShoppingCartBaseService {
} }
return null; return null;
} }
} }
...@@ -40,19 +40,7 @@ ...@@ -40,19 +40,7 @@
<dependency> <dependency>
<groupId>cn.freemud</groupId> <groupId>cn.freemud</groupId>
<artifactId>assortment-ordercenter-sdk</artifactId> <artifactId>assortment-ordercenter-sdk</artifactId>
<version>2.0.16-SNAPSHOT</version> <version>2.0.17-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>ordercenter-sdk</artifactId>
<groupId>cn.freemud</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<artifactId>ordercenter-sdk</artifactId>
<groupId>cn.freemud</groupId>
<version>1.4.37-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.freemud.application.service.sdk</groupId> <groupId>com.freemud.application.service.sdk</groupId>
......
...@@ -188,7 +188,7 @@ public class DeliveryAdapter { ...@@ -188,7 +188,7 @@ public class DeliveryAdapter {
deliveryProductInfo.setProductNumber(productList.getNumber()); deliveryProductInfo.setProductNumber(productList.getNumber());
deliveryProductInfo.setProductPrice(productList.getSalePrice().intValue()); deliveryProductInfo.setProductPrice(productList.getSalePrice().intValue());
//餐道使用 //餐道使用
deliveryProductInfo.setCumulatedTotal(productList.getNumber() * productList.getPrice().intValue()); deliveryProductInfo.setCumulatedTotal(productList.getNumber() * productList.getSalePrice().intValue());
OrderProductAddInfoDto orderProductAddInfoDto = JSON.parseObject(productList.getAddInfo(), OrderProductAddInfoDto.class); OrderProductAddInfoDto orderProductAddInfoDto = JSON.parseObject(productList.getAddInfo(), OrderProductAddInfoDto.class);
deliveryProductInfo.setTaxId(StringUtils.isNotEmpty(orderProductAddInfoDto.getTaxId()) ? orderProductAddInfoDto.getTaxId() : "10"); deliveryProductInfo.setTaxId(StringUtils.isNotEmpty(orderProductAddInfoDto.getTaxId()) ? orderProductAddInfoDto.getTaxId() : "10");
deliveryProductInfo.setTaxRate(orderProductAddInfoDto.getTax() > 0 ? orderProductAddInfoDto.getTax() : 6); deliveryProductInfo.setTaxRate(orderProductAddInfoDto.getTax() > 0 ? orderProductAddInfoDto.getTax() : 6);
...@@ -201,10 +201,10 @@ public class DeliveryAdapter { ...@@ -201,10 +201,10 @@ public class DeliveryAdapter {
ProductInfo deliveryComboProductInfo = new ProductInfo(); ProductInfo deliveryComboProductInfo = new ProductInfo();
deliveryComboProductInfo.setProductCode(comboProduct.getProductId()); deliveryComboProductInfo.setProductCode(comboProduct.getProductId());
deliveryComboProductInfo.setProductName(comboProduct.getProductName()); deliveryComboProductInfo.setProductName(comboProduct.getProductName());
deliveryComboProductInfo.setProductNumber(comboProduct.getNumber()); deliveryComboProductInfo.setProductNumber(comboProduct.getNumber()/productList.getNumber());
deliveryComboProductInfo.setProductPrice(comboProduct.getSalePrice().intValue()); deliveryComboProductInfo.setProductPrice(comboProduct.getSalePrice().intValue());
//餐道使用 //餐道使用
deliveryComboProductInfo.setCumulatedTotal(comboProduct.getNumber() * comboProduct.getPrice().intValue()); deliveryComboProductInfo.setCumulatedTotal(comboProduct.getNumber() * comboProduct.getSalePrice().intValue());
OrderProductAddInfoDto orderComboProductAddInfoDto = JSON.parseObject(comboProduct.getAddInfo(), OrderProductAddInfoDto.class); OrderProductAddInfoDto orderComboProductAddInfoDto = JSON.parseObject(comboProduct.getAddInfo(), OrderProductAddInfoDto.class);
deliveryComboProductInfo.setTaxId(StringUtils.isNotEmpty(orderComboProductAddInfoDto.getTaxId()) ? orderComboProductAddInfoDto.getTaxId() : "10"); deliveryComboProductInfo.setTaxId(StringUtils.isNotEmpty(orderComboProductAddInfoDto.getTaxId()) ? orderComboProductAddInfoDto.getTaxId() : "10");
deliveryComboProductInfo.setTaxRate(orderComboProductAddInfoDto.getTax() > 0 ? orderComboProductAddInfoDto.getTax() : 6); deliveryComboProductInfo.setTaxRate(orderComboProductAddInfoDto.getTax() > 0 ? orderComboProductAddInfoDto.getTax() : 6);
......
...@@ -169,17 +169,20 @@ public class OrderAdapter { ...@@ -169,17 +169,20 @@ public class OrderAdapter {
for (ShoppingCartGoodsDto.CartGoodsDetailDto cartGoodsDetailDto : cartGoodsDetailDtos) { for (ShoppingCartGoodsDto.CartGoodsDetailDto cartGoodsDetailDto : cartGoodsDetailDtos) {
Integer qty = cartGoodsDetailDto.getQty(); Integer qty = cartGoodsDetailDto.getQty();
if (qty > 0) { if (qty > 0) {
CreateOrderProductRequest createOrderProductDto = convent2OrderProduct(cartGoodsDetailDto); CreateOrderProductRequest createOrderProductDto = null;
if(mcCafePartnerId.equals(createOrderDto.getCompanyId())) {
createOrderProductDto = convent2MCCafeOrderProduct(cartGoodsDetailDto);
} else {
createOrderProductDto = convent2OrderProduct(cartGoodsDetailDto);
}
createOrderProductDto.setIgnoreProductPrice(1); createOrderProductDto.setIgnoreProductPrice(1);
products.add(createOrderProductDto); products.add(createOrderProductDto);
if (CollectionUtils.isNotEmpty(cartGoodsDetailDto.getActivityDiscountsDtos())) { if (CollectionUtils.isNotEmpty(cartGoodsDetailDto.getActivityDiscountsDtos())) {
List<CreateOrderAccountRequest> accounts = null;
if(mcCafePartnerId.equals(createOrderDto.getCompanyId())) { if(mcCafePartnerId.equals(createOrderDto.getCompanyId())) {
accounts = getMCCafeAccounts(createOrderProductDto, cartGoodsDetailDto.getActivityDiscountsDtos()); createOrderProductDto.setAccounts(getMCCafeAccounts(createOrderProductDto, cartGoodsDetailDto.getActivityDiscountsDtos()));
} else { } else {
accounts = getAccounts(createOrderProductDto, cartGoodsDetailDto.getActivityDiscountsDtos()); createOrderProductDto.setAccounts(getAccounts(createOrderProductDto, cartGoodsDetailDto.getActivityDiscountsDtos()));
} }
createOrderProductDto.setAccounts(accounts);
} }
} }
} }
...@@ -1844,7 +1847,20 @@ public class OrderAdapter { ...@@ -1844,7 +1847,20 @@ public class OrderAdapter {
List<ProductVo> setMealProducts = new ArrayList<>(); List<ProductVo> setMealProducts = new ArrayList<>();
productBean.getComboProduct().forEach(product -> { productBean.getComboProduct().forEach(product -> {
if(!"无".equals(product.getSpecificationName())) { if(!"无".equals(product.getSpecificationName())) {
setMealProducts.add(convent2ProductVo(product)); ProductVo comboProduct = convent2ProductVo(product);
setMealProducts.add(comboProduct);
if (ObjectUtils.equals(ProductTypeEnum.MATERIAL_PRODUCT.getCode(), comboProduct.getProductType()) && CollectionUtils.isNotEmpty(product.getMaterialProduct())) {
List<ProductVo> setMaterialProducts = new ArrayList<>();
product.getMaterialProduct().forEach(materialProduct -> {
ProductVo material = convent2ProductVo(materialProduct);
setMaterialProducts.add(material);
productVo.setOriginalPrice(new BigDecimal(productVo.getOriginalPrice()).subtract(new BigDecimal(material.getOriginalPrice())).longValue());
productVo.setFinalPrice(new BigDecimal(productVo.getFinalPrice()).subtract(new BigDecimal(material.getFinalPrice())).longValue());
productVo.setOriginalTotalAmount(new BigDecimal(productVo.getOriginalTotalAmount()).subtract(new BigDecimal(material.getOriginalTotalAmount())).longValue());
productVo.setSaleTotalAmount(new BigDecimal(productVo.getSaleTotalAmount()).subtract(new BigDecimal(product.getSettlementPrice())).longValue());
});
comboProduct.setSetMaterialProducts(setMaterialProducts);
}
} }
}); });
productVo.setSetMealProducts(setMealProducts); productVo.setSetMealProducts(setMealProducts);
...@@ -2149,6 +2165,41 @@ public class OrderAdapter { ...@@ -2149,6 +2165,41 @@ public class OrderAdapter {
return createOrderProductDemoDto; return createOrderProductDemoDto;
} }
public CreateOrderProductRequest convent2MCCafeOrderProduct(ShoppingCartGoodsDto.CartGoodsDetailDto cartGoodsDetailDto) {
CreateOrderProductRequest createOrderProductDemoDto = convent2MCCafeOrderProductDemo(cartGoodsDetailDto, cartGoodsDetailDto.getProductType());
if(cartGoodsDetailDto.getProductType() != null) {
if(cartGoodsDetailDto.getProductType() == ProductType.SETMEALPRODUCT.getCode()
|| cartGoodsDetailDto.getProductType() == ProductType.SETMEALPRODUCT_UPPRICE.getCode()) {
createOrderProductDemoDto.setPrice(0l);
//套餐
List<CreateOrderProductRequest> comboProducts = new ArrayList<>();
cartGoodsDetailDto.getComboProducts().forEach(product -> {
CreateOrderProductRequest createOrderComboProduct = convent2MCCafeOrderProductDemo(product, product.getProductType());
comboProducts.add(createOrderComboProduct);
if(CollectionUtils.isNotEmpty(product.getMaterialList())) {
//加料商品
List<CreateOrderProductRequest> materialProducts = new ArrayList<>();
product.getMaterialList().forEach(cartMaterial -> {
product.setProductType(ProductType.MATERIALPRODUCT_UPPRICE.getCode());
materialProducts.add(convent2MCCafeOrderProductDemo(cartMaterial, ProductType.LITTLE_MATERIAL_PRODUCT.getCode()));
});
createOrderComboProduct.setMaterialProduct(materialProducts);
}
});
createOrderProductDemoDto.setComboProduct(comboProducts);
} else if(CollectionUtils.isNotEmpty(cartGoodsDetailDto.getMaterialList())) {
//加料商品
List<CreateOrderProductRequest> materialProducts = new ArrayList<>();
cartGoodsDetailDto.getMaterialList().forEach(product -> {
product.setProductType(ProductType.MATERIALPRODUCT_UPPRICE.getCode());
materialProducts.add(convent2MCCafeOrderProductDemo(product, ProductType.LITTLE_MATERIAL_PRODUCT.getCode()));
});
createOrderProductDemoDto.setMaterialProduct(materialProducts);
}
}
return createOrderProductDemoDto;
}
private CreateOrderProductRequest convent2OrderProductMaterial(ShoppingCartGoodsDto.CartGoodsDetailDto cartGoodsDetailDto) { private CreateOrderProductRequest convent2OrderProductMaterial(ShoppingCartGoodsDto.CartGoodsDetailDto cartGoodsDetailDto) {
CreateOrderProductRequest createOrderProductDemoDto = new CreateOrderProductRequest(); CreateOrderProductRequest createOrderProductDemoDto = new CreateOrderProductRequest();
createOrderProductDemoDto.setProductId(cartGoodsDetailDto.getSpuId()); createOrderProductDemoDto.setProductId(cartGoodsDetailDto.getSpuId());
...@@ -2209,6 +2260,39 @@ public class OrderAdapter { ...@@ -2209,6 +2260,39 @@ public class OrderAdapter {
return createOrderProductDemoDto; return createOrderProductDemoDto;
} }
public CreateOrderProductRequest convent2MCCafeOrderProductDemo(ShoppingCartGoodsDto.CartGoodsDetailDto cartGoodsDetailDto, Integer productType) {
CreateOrderProductRequest createOrderProductDemoDto = new CreateOrderProductRequest();
createOrderProductDemoDto.setProductId(cartGoodsDetailDto.getSpuId());
createOrderProductDemoDto.setProductName(cartGoodsDetailDto.getSpuName());
createOrderProductDemoDto.setSpecification(cartGoodsDetailDto.getSkuId());
createOrderProductDemoDto.setSpecificationName(cartGoodsDetailDto.getSkuName());
createOrderProductDemoDto.setPrice(cartGoodsDetailDto.getOriginalPrice());
createOrderProductDemoDto.setSalePrice(cartGoodsDetailDto.getOriginalPrice());
createOrderProductDemoDto.setTotalDiscountAmount(cartGoodsDetailDto.getTotalDiscountAmount() == null ? 0 : cartGoodsDetailDto.getTotalDiscountAmount().longValue());
createOrderProductDemoDto.setNumber(cartGoodsDetailDto.getQty());
createOrderProductDemoDto.setPicture(cartGoodsDetailDto.getPicture());
createOrderProductDemoDto.setAddInfo(cartGoodsDetailDto.getAttributeNames());
createOrderProductDemoDto.setDiscountId(cartGoodsDetailDto.getCouponCode());
createOrderProductDemoDto.setProductType(productType);
createOrderProductDemoDto.setParentProductId(cartGoodsDetailDto.getParentProductId());
createOrderProductDemoDto.setIsFixedProduct(cartGoodsDetailDto.getIsFixedProduct());
createOrderProductDemoDto.setCustomerCode(cartGoodsDetailDto.getCustomerCode());
createOrderProductDemoDto.setProductCode(cartGoodsDetailDto.getProductCode());
createOrderProductDemoDto.setHasStockProudct(cartGoodsDetailDto.isStockLimit());
createOrderProductDemoDto.setWeight(cartGoodsDetailDto.getWeight());
createOrderProductDemoDto.setUnit(cartGoodsDetailDto.getUnit());
createOrderProductDemoDto.setStapleFood(0);
createOrderProductDemoDto.setCategory(cartGoodsDetailDto.getClassificationId());
createOrderProductDemoDto.setTax(cartGoodsDetailDto.getTax());
createOrderProductDemoDto.setTaxId(cartGoodsDetailDto.getTaxId());
createOrderProductDemoDto.setClassificationId(cartGoodsDetailDto.getClassificationId());
createOrderProductDemoDto.setClassificationName(cartGoodsDetailDto.getClassificationName());
if(CollectionUtils.isNotEmpty(cartGoodsDetailDto.getSpecialExtra())) {
createOrderProductDemoDto.setSpecialCodes(cartGoodsDetailDto.getExtraList().stream().map(ShoppingCartGoodsDto.CartGoodsDetailDto.CartGoodsExtra::getSpecialCode).collect(Collectors.toList()));
}
return createOrderProductDemoDto;
}
/** /**
* 将促销的枚举 ActivityTypeEnum 和orderAccountType 关联映射 * 将促销的枚举 ActivityTypeEnum 和orderAccountType 关联映射
*/ */
......
...@@ -210,6 +210,11 @@ public class ShoppingCartGoodsDto { ...@@ -210,6 +210,11 @@ public class ShoppingCartGoodsDto {
* 配料或属性 * 配料或属性
*/ */
private List<CartGoodsDetailDto.CartGoodsExtra> extraList = new ArrayList<>(0); private List<CartGoodsDetailDto.CartGoodsExtra> extraList = new ArrayList<>(0);
/**
* 配料或属性
*/
private List<CartGoodsDetailDto.CartGoodsExtra> specialExtra = new ArrayList<>(0);
/** /**
* 商品行享受的促销活动 * 商品行享受的促销活动
*/ */
...@@ -231,6 +236,10 @@ public class ShoppingCartGoodsDto { ...@@ -231,6 +236,10 @@ public class ShoppingCartGoodsDto {
* 属性名 * 属性名
*/ */
private String attributeName; private String attributeName;
/**
* 入机code
*/
private String specialCode;
} }
......
...@@ -17,7 +17,9 @@ public enum ProductType { ...@@ -17,7 +17,9 @@ public enum ProductType {
HAVESPEC(10, "有规格"), HAVESPEC(10, "有规格"),
SETMEALPRODUCT(6,"套餐商品"), SETMEALPRODUCT(6,"套餐商品"),
SETMEALPRODUCT_UPPRICE(7,"加价套餐商品"), SETMEALPRODUCT_UPPRICE(7,"加价套餐商品"),
MATERIALPRODUCT_UPPRICE(88,"加料商品"); MATERIALPRODUCT_UPPRICE(88,"加料商品"),
LITTLE_MATERIAL_PRODUCT(89,"小料"),
;
private int code; private int code;
......
...@@ -480,31 +480,6 @@ public class CheckMCCafeOrder { ...@@ -480,31 +480,6 @@ public class CheckMCCafeOrder {
.buyMemberCard(null) .buyMemberCard(null)
.menuType(createOrderVo.getMenuType()) .menuType(createOrderVo.getMenuType())
.build(); .build();
// 如果使用优惠券或者商品券,校验 couponCode
// if (StringUtils.isNotBlank(createOrderVo.getCouponCode())) {
// // 校验couponCode
// GetCouponDetailResponseDto getCouponDetailResponseDto = couponService.getMemberCoupon(GetMemberCouponRequestVo.builder()
// .partnerId(createOrderVo.getPartnerId())
// .couponCode(createOrderVo.getCouponCode()).build());
// if (Objects.equals(getCouponDetailResponseDto, null) || CollectionUtils.isEmpty(getCouponDetailResponseDto.getDetails())
// || getCouponDetailResponseDto.getDetails().get(0).getActive() == null
// || getCouponDetailResponseDto.getDetails().get(0).getActive().getActiveCode() == null) {
// if ((CollectionUtils.isNotEmpty(getCouponDetailResponseDto.getDetails().get(0).getActiveRestrictionVOS())
// && CollectionUtils.isEmpty(getCouponDetailResponseDto.getDetails().get(0).getActiveRestrictionVOS().stream()
// .filter(a -> Objects.equals(a.getStoreIdPartner(), createOrderVo.getShopId())).collect(Collectors.toList()))
// )) {
// throw new ServiceException(ResponseResult.COUPON_SHOP_NOTSUPPORT);
// } else {
// throw new ServiceException(ResponseResult.COUPON_GETINFO_INVAILD);
// }
// }
// String activeCode = getCouponDetailResponseDto.getDetails().get(0).getActive().getActiveCode();
// // 校验点餐方式,查询购物车接口内部已校验
// shoppingCartInfoRequestVo.setCouponCode(createOrderVo.getCouponCode());
// // 活动code
// shoppingCartInfoRequestVo.setActivityCode(activeCode);
// shoppingCartInfoRequestVo.setCardCode(createOrderVo.getCardCode());
// }
if (StringUtils.isNotBlank(createOrderVo.getCouponCode())) { if (StringUtils.isNotBlank(createOrderVo.getCouponCode())) {
// 校验couponCode // 校验couponCode
MCCafeCouponRequest mcCafeCouponRequest = MCCafeCouponRequest.builder() MCCafeCouponRequest mcCafeCouponRequest = MCCafeCouponRequest.builder()
......
...@@ -910,7 +910,7 @@ public class OrderServiceImpl implements Orderservice { ...@@ -910,7 +910,7 @@ public class OrderServiceImpl implements Orderservice {
QueryOrdersRequest queryOrdersRequest2 = new QueryOrdersRequest(); QueryOrdersRequest queryOrdersRequest2 = new QueryOrdersRequest();
BeanUtil.convertBean(queryOrdersDto, queryOrdersRequest2); BeanUtil.convertBean(queryOrdersDto, queryOrdersRequest2);
queryOrdersRequest2.setTrackingNo(LogTreadLocal.getTrackingNo()); queryOrdersRequest2.setTrackingNo(LogTreadLocal.getTrackingNo());
queryOrderResponse = orderCenterSdkService.queryOrders(queryOrdersRequest2); queryOrderResponse = orderCenterSdkService.queryMCCafeOrders(queryOrdersRequest2);
} catch (Exception e) { } catch (Exception e) {
LogUtil.error("queryOrders_error", gson.toJson(queryOrdersDto), e); LogUtil.error("queryOrders_error", gson.toJson(queryOrdersDto), e);
return ResponseUtil.error(ResponseResult.ORDER_QUERYORDER_ERROR); return ResponseUtil.error(ResponseResult.ORDER_QUERYORDER_ERROR);
...@@ -1276,7 +1276,7 @@ public class OrderServiceImpl implements Orderservice { ...@@ -1276,7 +1276,7 @@ public class OrderServiceImpl implements Orderservice {
BaseQueryOrderRequest baseQueryOrderRequest = new BaseQueryOrderRequest(); BaseQueryOrderRequest baseQueryOrderRequest = new BaseQueryOrderRequest();
baseQueryOrderRequest.setOrderId(oid); baseQueryOrderRequest.setOrderId(oid);
baseQueryOrderRequest.setTrackingNo(LogTreadLocal.getTrackingNo()); baseQueryOrderRequest.setTrackingNo(LogTreadLocal.getTrackingNo());
QueryOrderByIdResponse response = orderCenterSdkService.queryOrderById(baseQueryOrderRequest); QueryOrderByIdResponse response = orderCenterSdkService.queryMCCafeOrderById(baseQueryOrderRequest);
if (!RESPONSE_SUCCESS_CODE.equals(response.getErrcode()) || response.getData() == null) { if (!RESPONSE_SUCCESS_CODE.equals(response.getErrcode()) || response.getData() == null) {
return ResponseUtil.error(ResponseResult.ORDER_QUERYORDER_ERROR); return ResponseUtil.error(ResponseResult.ORDER_QUERYORDER_ERROR);
} }
......
...@@ -104,7 +104,7 @@ public class MCCafeOrderCenterSdkServiceImpl implements MCCafeOrderCenterSdkServ ...@@ -104,7 +104,7 @@ public class MCCafeOrderCenterSdkServiceImpl implements MCCafeOrderCenterSdkServ
@Override @Override
public CreateOrderResponse createMCCafeOrderFlow(CreateOrderRequest config) { public CreateOrderResponse createMCCafeOrderFlow(CreateOrderRequest config) {
com.freemud.application.sdk.api.ordercenter.request.create.CreateOrderRequest request = orderSdkAdapter.convent2NEWCreateOrderRequest(config.getBaseCreateOrderRequest()); com.freemud.application.sdk.api.ordercenter.request.create.CreateOrderRequest request = orderSdkAdapter.convent2NEWCreateMCCafeOrderRequest(config.getBaseCreateOrderRequest());
com.freemud.application.sdk.api.ordercenter.response.BaseResponse<OrderInfoReqs> order = orderSdkService.createOrder(request, config.getTrackingNo()); com.freemud.application.sdk.api.ordercenter.response.BaseResponse<OrderInfoReqs> order = orderSdkService.createOrder(request, config.getTrackingNo());
CreateOrderResponse createOrderResponse = orderSdkAdapter.convent2NEWOrderInfoReqs(order); CreateOrderResponse createOrderResponse = orderSdkAdapter.convent2NEWOrderInfoReqs(order);
if (!RESPONSE_SUCCESS.equals(createOrderResponse.getErrcode()) if (!RESPONSE_SUCCESS.equals(createOrderResponse.getErrcode())
......
package cn.freemud.service.impl; package cn.freemud.service.impl;
import cn.freemud.entities.dto.shoppingCart.ShoppingCartGoodsDto;
import cn.freemud.entities.vo.CreateOrderVo;
import cn.freemud.entities.vo.OrderAffirmRequestVO; import cn.freemud.entities.vo.OrderAffirmRequestVO;
import cn.freemud.entities.vo.PaysuccessNoticeMessage; import cn.freemud.entities.vo.PaysuccessNoticeMessage;
import cn.freemud.utils.ValidationCode; import cn.freemud.utils.ValidationCode;
import com.alibaba.fastjson.JSON;
import com.freemud.application.sdk.api.ordercenter.enums.OrderClientType;
import com.freemud.application.sdk.api.ordercenter.request.OrderExtendedReq;
import com.freemud.application.sdk.api.storecenter.response.StoreResponse;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
...@@ -24,6 +30,9 @@ public class MallOrderServiceImplTest { ...@@ -24,6 +30,9 @@ public class MallOrderServiceImplTest {
@Autowired @Autowired
private MallOrderServiceImpl mallOrderService; private MallOrderServiceImpl mallOrderService;
@Autowired
private MCCafeOrderServiceImpl mcCafeOrderService;
@Before @Before
public void before() throws Exception { public void before() throws Exception {
...@@ -33,6 +42,14 @@ public class MallOrderServiceImplTest { ...@@ -33,6 +42,14 @@ public class MallOrderServiceImplTest {
public void after() throws Exception { public void after() throws Exception {
} }
@Test
public void f1() {
mcCafeOrderService.createOrder(JSON.parseObject("{\"channelType\":\"saas\",\"couponCode\":\"\",\"menuType\":\"saasdelivery\",\"needInvoice\":0,\"needTableware\":0,\"orderRemark\":\"\",\"orderType\":2,\"partnerId\":\"1206\",\"payChannelType\":1,\"receiveId\":\"3599568180562003060\",\"sessionId\":\"c4377678dbcbd6cdf6e7df86ea112b6f82723023\",\"shopId\":\"1450026\",\"takeMealFlag\":\"0\"}", CreateOrderVo.class),
new StoreResponse.BizVO(),
JSON.parseObject("{\"activityDiscountsDtos\":[],\"deliveryAmount\":10,\"discountDeliveryAmount\":10,\"isDiscountDelivery\":false,\"originalTotalAmount\":4400,\"packageAmount\":0,\"products\":[{\"activityDiscountsDtos\":[],\"attributeNames\":\"{\\\"attributeNames\\\":\\\"\\\"}\",\"cartGoodsUid\":\"eb8c7260-8ecb-44d1-9234-8d8bed0b0875\",\"classificationId\":\"\",\"classificationName\":\"\",\"comboProducts\":[{\"attributeNames\":\"{\\\"attributeNames\\\":\\\"\\\"}\",\"customerCode\":\"501642\",\"extraList\":[],\"hasProductCoupon\":false,\"isFixedProduct\":false,\"materialList\":[],\"originalPrice\":1700,\"parentProductId\":\"184437853099519288\",\"picture\":\"https://picture.sandload.cn/1598678546485.png\",\"productType\":6,\"qty\":2,\"skuId\":\"184437494035639613\",\"skuName\":\"中杯热美式\",\"spuId\":\"184437494035639613\",\"spuName\":\"中杯热美式\",\"stockLimit\":false,\"tax\":0.01,\"taxId\":\"\",\"totalDiscountAmount\":0,\"unit\":\"\",\"weight\":0.0},{\"attributeNames\":\"{\\\"attributeNames\\\":\\\"\\\"}\",\"customerCode\":\"901290\",\"extraList\":[],\"hasProductCoupon\":false,\"isFixedProduct\":false,\"materialList\":[],\"originalPrice\":500,\"parentProductId\":\"184437853099519288\",\"picture\":\"https://picture.sandload.cn/1598677404074.png\",\"productType\":6,\"qty\":2,\"skuId\":\"184436294373469463\",\"skuName\":\"经典芝士蛋糕\",\"spuId\":\"184436294373469463\",\"spuName\":\"经典芝士蛋糕\",\"stockLimit\":false,\"tax\":0.01,\"taxId\":\"\",\"totalDiscountAmount\":0,\"unit\":\"\",\"weight\":0.0}],\"customerCode\":\"901280\",\"extraList\":[],\"hasProductCoupon\":false,\"materialList\":[],\"originalPrice\":4400,\"picture\":\"https://picture.sandload.cn/1598678861518.png\",\"productCode\":\"901280\",\"productType\":6,\"qty\":2,\"salePrice\":4400,\"skuId\":\"184437853099519288\",\"skuName\":\"早餐啡常搭\",\"spuId\":\"184437853099519288\",\"spuName\":\"早餐啡常搭\",\"stockLimit\":false,\"tax\":0.01,\"taxId\":\"\",\"totalDiscountAmount\":0,\"unit\":\"\",\"weight\":0.0}],\"shareDiscountActivityDtos\":[],\"totalAmount\":4400,\"totalDiscountAmount\":0}", ShoppingCartGoodsDto.class),
new OrderExtendedReq(),
OrderClientType.SAAS,"www");
}
@Test @Test
public void testPaySuccess() { public void testPaySuccess() {
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<version>1.0.0</version> <version>1.0.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<version>1.4.37-SNAPSHOT</version> <version>1.4.38-SNAPSHOT</version>
<artifactId>ordercenter-sdk</artifactId> <artifactId>ordercenter-sdk</artifactId>
<dependencies> <dependencies>
......
...@@ -19,4 +19,5 @@ ...@@ -19,4 +19,5 @@
| 1.4.33-SNAPSHOT | 新增修改取餐码接口| 谌会阳 |2020-08-08 | 1.4.33-SNAPSHOT | 新增修改取餐码接口| 谌会阳 |2020-08-08
| 1.4.35-SNAPSHOT | 麦咖啡| 谌会阳 |2020-08-08 | 1.4.35-SNAPSHOT | 麦咖啡| 谌会阳 |2020-08-08
| 1.4.36-SNAPSHOT | 修复queryRelatedOrderByCode反序列化报错| 肖家炜 |2020-08-25 | 1.4.36-SNAPSHOT | 修复queryRelatedOrderByCode反序列化报错| 肖家炜 |2020-08-25
| 1.4.37-SNAPSHOT | 麦咖啡汇集回调,调用基础服务方法 | 徐康 | 2020-09-02 | | 1.4.37-SNAPSHOT | 麦咖啡汇集回调,调用基础服务方法 | 徐康 | 2020-09-02 |
\ No newline at end of file | 1.4.38-SNAPSHOT | 麦咖啡加料 | 徐康 | 2020-09-28 |
\ No newline at end of file
...@@ -23,7 +23,9 @@ public enum ProductTypeEnum { ...@@ -23,7 +23,9 @@ public enum ProductTypeEnum {
MORD_SPECIFICATION_PRODUCT(10,"多规格商品"), MORD_SPECIFICATION_PRODUCT(10,"多规格商品"),
WEIGHT_PRODUCT(11,"称重商品"), WEIGHT_PRODUCT(11,"称重商品"),
TABLEWARE_PRODUCT(12,"餐具商品"), TABLEWARE_PRODUCT(12,"餐具商品"),
MATERIAL_PRODUCT(88,"加料商品"); MATERIAL_PRODUCT(88,"加料商品"),
LITTLE_MATERIAL_PRODUCT(89,"小料"),
;
......
...@@ -88,6 +88,10 @@ public class ActivityCalculationDiscountRequestDto { ...@@ -88,6 +88,10 @@ public class ActivityCalculationDiscountRequestDto {
*/ */
private String goodsCode; private String goodsCode;
/** /**
* 商品核销券号
*/
private String couponCode;
/**
* 商品ID * 商品ID
*/ */
private String goodsId; private String goodsId;
......
package cn.freemud.entities.dto.product;
import lombok.Data;
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @version V1.0
* @Title: ProductAttributeValueType
* @Package cn.freemud.entities.dto.product
* @Description:
* @author: ping1.wu
* @date: 2020/9/26 20:03
* @Copyright: 2020 www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
@Data
public class ProductAttributeValueType {
private String attributeId;
private String attributeValue;
}
package cn.freemud.entities.dto.product;
import lombok.Data;
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @version V1.0
* @Title: ProductSpecAttrValueGroupType
* @Package cn.freemud.entities.dto.product
* @Description:
* @author: ping1.wu
* @date: 2020/9/27 10:54
* @Copyright: 2020 www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
@Data
public class ProductSpecAttrValueGroupType {
//规格小类id
private String specValueId;
//规格小类属性名称
private String name;
//规格小类属性编号
private String qty;
}
package cn.freemud.entities.dto.product;
import lombok.Data;
import java.util.List;
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @version V1.0
* @Title: ValiadShopProductResponse
* @Package cn.freemud.entities.dto.product
* @Description:
* @author: ping1.wu
* @date: 2020/9/26 20:05
* @Copyright: 2020 www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
@Data
public class ValiadShopProductResponse {
private List<ValiadShopProductResult> failureList;
private List<ValiadShopProductResult> successList;
}
package cn.freemud.entities.dto.product;
import com.freemud.application.sdk.api.productcenter.domain.ProductBeanDTO;
import lombok.Data;
import java.util.Map;
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @version V1.0
* @Title: ValiadShopProductResult
* @Package cn.freemud.entities.dto.product
* @Description:
* @author: ping1.wu
* @date: 2020/9/26 20:05
* @Copyright: 2020 www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
@Data
public class ValiadShopProductResult {
private int code;
private String message;
private String skuId;
private String spuId;
private ProductBeanDTO productType;
private String uuid;
private Map<String,ProductBeanDTO> subProductTypeMap;
}
package cn.freemud.entities.dto.product;
import lombok.Data;
import java.util.List;
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @version V1.0
* @Title: ValidateShopProductRequest
* @Package cn.freemud.entities.dto.product
* @Description:
* @author: ping1.wu
* @date: 2020/9/26 20:01
* @Copyright: 2020 www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
@Data
public class ValidateShopProductRequest {
private String partnerId;
private String storeId;
private String channel;
private List<ValidateShopProductType> productTypeList;
}
package cn.freemud.entities.dto.product;
import lombok.Data;
import java.util.List;
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @version V1.0
* @Title: ValidateShopProductType
* @Package cn.freemud.entities.dto.product
* @Description:
* @author: ping1.wu
* @date: 2020/9/26 20:01
* @Copyright: 2020 www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
@Data
public class ValidateShopProductType {
private String uuid;
private String spuId;
private String skuId;
private List<ValidateSkuProductType> comboProductTypeList;
private List<ValidateSkuProductType> productGroupTypeList;
private Integer price;
private Integer memberDiscount;
private List<ProductAttributeValueType> attributeList;
private List<Integer> validateStatuses;
private Integer validatePrice = 1;
private Integer validateAttribute = 1;
}
package cn.freemud.entities.dto.product;
import lombok.Data;
import java.util.List;
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @version V1.0
* @Title: ValidateSkuProductType
* @Package cn.freemud.entities.dto.product
* @Description:
* @author: ping1.wu
* @date: 2020/9/26 20:02
* @Copyright: 2020 www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
@Data
public class ValidateSkuProductType {
private String skuId;
private String productId;
private Integer price;
private Integer markUpPrice;
private Integer qty;
private Long productGroupId;
private List<ProductAttributeValueType> attributeList;
private ProductSpecAttrValueGroupType productSpecAttrValueGroupType;
}
...@@ -3,6 +3,7 @@ package cn.freemud.entities.dto.shoppingCart; ...@@ -3,6 +3,7 @@ package cn.freemud.entities.dto.shoppingCart;
import cn.freemud.entities.dto.OrderProductAddInfo; import cn.freemud.entities.dto.OrderProductAddInfo;
import cn.freemud.entities.dto.activity.ActivityDiscountsDto; import cn.freemud.entities.dto.activity.ActivityDiscountsDto;
import cn.freemud.entities.dto.activity.ShareDiscountActivityDto; import cn.freemud.entities.dto.activity.ShareDiscountActivityDto;
import cn.freemud.entities.vo.CartGoods;
import cn.freemud.entities.vo.SubtractStockVO; import cn.freemud.entities.vo.SubtractStockVO;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import lombok.Builder; import lombok.Builder;
...@@ -245,6 +246,8 @@ public class ShoppingCartGoodsDto { ...@@ -245,6 +246,8 @@ public class ShoppingCartGoodsDto {
*/ */
private List<CartGoodsDetailDto.CartGoodsExtra> extraList = new ArrayList<>(0); private List<CartGoodsDetailDto.CartGoodsExtra> extraList = new ArrayList<>(0);
private List<CartGoods.SpecialExtra> specialExtra = new ArrayList<>();
/** /**
* 当前商品享受的促销活动 * 当前商品享受的促销活动
*/ */
......
...@@ -124,6 +124,11 @@ public class CartGoods { ...@@ -124,6 +124,11 @@ public class CartGoods {
private List<CartGoodsExtra> extra; private List<CartGoodsExtra> extra;
/** /**
* 麦咖啡定制属性
*/
private List<SpecialExtra> specialExtra;
/**
* 创建时间(mili) * 创建时间(mili)
*/ */
private long createTimeMili = System.currentTimeMillis(); private long createTimeMili = System.currentTimeMillis();
...@@ -206,11 +211,29 @@ public class CartGoods { ...@@ -206,11 +211,29 @@ public class CartGoods {
} }
@Data @Data
public final static class SpecialExtra {
/**
* 属性Id
*/
private String attributeId;
/**
* 属性名
*/
private String attributeName;
/**
* 麦咖啡特定属性入机code
*/
private String specialCode;
}
@Data
public final static class ComboxGoods { public final static class ComboxGoods {
/** /**
* 单规格spuId,多规格skuId * 单规格spuId,多规格skuId
*/ */
private String goodsId; private String goodsId;
private String spuId;
private String skuId; private String skuId;
private String skuName; private String skuName;
/** /**
...@@ -265,6 +288,11 @@ public class CartGoods { ...@@ -265,6 +288,11 @@ public class CartGoods {
* 配料或属性 * 配料或属性
*/ */
private List<CartGoodsExtra> extra; private List<CartGoodsExtra> extra;
/**
* 麦咖啡特定属性
*/
private List<SpecialExtra> specialExtra;
/** /**
* 1:称重菜 * 1:称重菜
*/ */
...@@ -295,6 +323,10 @@ public class CartGoods { ...@@ -295,6 +323,10 @@ public class CartGoods {
* 费率代码 * 费率代码
*/ */
private String taxId; private String taxId;
/**
* 商品原始加料数据
*/
private List<MaterialGoods> productMaterialList;
@Override @Override
public int hashCode() { public int hashCode() {
...@@ -313,6 +345,9 @@ public class CartGoods { ...@@ -313,6 +345,9 @@ public class CartGoods {
if (CollectionUtils.isNotEmpty(extra)) { if (CollectionUtils.isNotEmpty(extra)) {
extra.stream().sorted(Comparator.comparing(CartGoodsExtra::getAttributeId)).forEach(e -> sb.append(e.getAttributeId())); extra.stream().sorted(Comparator.comparing(CartGoodsExtra::getAttributeId)).forEach(e -> sb.append(e.getAttributeId()));
} }
if (CollectionUtils.isNotEmpty(specialExtra)) {
specialExtra.stream().sorted(Comparator.comparing(SpecialExtra::getAttributeId)).forEach(e -> sb.append(e.getAttributeId()));
}
return sb.toString(); return sb.toString();
} }
} }
...@@ -334,6 +369,9 @@ public class CartGoods { ...@@ -334,6 +369,9 @@ public class CartGoods {
if (CollectionUtils.isNotEmpty(productComboList)) { if (CollectionUtils.isNotEmpty(productComboList)) {
for (ComboxGoods goods : productComboList) { for (ComboxGoods goods : productComboList) {
originalString.append(goods.toString()); originalString.append(goods.toString());
if (CollectionUtils.isNotEmpty(goods.getSpecialExtra())) {
goods.getSpecialExtra().stream().sorted(Comparator.comparing(SpecialExtra::getAttributeId)).forEach(e -> originalString.append(e.getAttributeId()));
}
} }
} }
if (CollectionUtils.isNotEmpty(productGroupList)) { if (CollectionUtils.isNotEmpty(productGroupList)) {
...@@ -344,6 +382,9 @@ public class CartGoods { ...@@ -344,6 +382,9 @@ public class CartGoods {
if (CollectionUtils.isNotEmpty(productMaterialList)) { if (CollectionUtils.isNotEmpty(productMaterialList)) {
productMaterialList.stream().sorted(Comparator.comparing(MaterialGoods::getSpuId)).forEach(e -> originalString.append(e.getSpuId())); productMaterialList.stream().sorted(Comparator.comparing(MaterialGoods::getSpuId)).forEach(e -> originalString.append(e.getSpuId()));
} }
if (CollectionUtils.isNotEmpty(specialExtra)) {
specialExtra.stream().sorted(Comparator.comparing(SpecialExtra::getAttributeId)).forEach(e -> originalString.append(e.getAttributeId()));
}
//当前字符串 //当前字符串
CartGoods cartGoods = (CartGoods) o; CartGoods cartGoods = (CartGoods) o;
...@@ -356,6 +397,9 @@ public class CartGoods { ...@@ -356,6 +397,9 @@ public class CartGoods {
if (CollectionUtils.isNotEmpty(cartGoods.getProductComboList())) { if (CollectionUtils.isNotEmpty(cartGoods.getProductComboList())) {
for (ComboxGoods goods : cartGoods.getProductComboList()) { for (ComboxGoods goods : cartGoods.getProductComboList()) {
currentString.append(goods.toString()); currentString.append(goods.toString());
if (CollectionUtils.isNotEmpty(goods.getSpecialExtra())) {
goods.getSpecialExtra().stream().sorted(Comparator.comparing(SpecialExtra::getAttributeId)).forEach(e -> currentString.append(e.getAttributeId()));
}
} }
} }
if (CollectionUtils.isNotEmpty(cartGoods.getProductGroupList())) { if (CollectionUtils.isNotEmpty(cartGoods.getProductGroupList())) {
...@@ -366,6 +410,9 @@ public class CartGoods { ...@@ -366,6 +410,9 @@ public class CartGoods {
if (CollectionUtils.isNotEmpty(cartGoods.getProductMaterialList())) { if (CollectionUtils.isNotEmpty(cartGoods.getProductMaterialList())) {
cartGoods.getProductMaterialList().stream().sorted(Comparator.comparing(MaterialGoods::getSpuId)).forEach(e -> currentString.append(e.getSpuId())); cartGoods.getProductMaterialList().stream().sorted(Comparator.comparing(MaterialGoods::getSpuId)).forEach(e -> currentString.append(e.getSpuId()));
} }
if (CollectionUtils.isNotEmpty(cartGoods.getSpecialExtra())) {
cartGoods.getSpecialExtra().stream().sorted(Comparator.comparing(SpecialExtra::getAttributeId)).forEach(e -> currentString.append(e.getAttributeId()));
}
return StringUtils.equals(originalString.toString(), currentString.toString()); return StringUtils.equals(originalString.toString(), currentString.toString());
} }
......
...@@ -19,6 +19,11 @@ import java.util.List; ...@@ -19,6 +19,11 @@ import java.util.List;
@Data @Data
public class ComboxGoodsRequestVo { public class ComboxGoodsRequestVo {
/**
* 麦咖啡多规格商品spuid
*/
private String spuId;
private String skuId; private String skuId;
private Integer qty; private Integer qty;
/** /**
...@@ -30,4 +35,11 @@ public class ComboxGoodsRequestVo { ...@@ -30,4 +35,11 @@ public class ComboxGoodsRequestVo {
*/ */
List<CartGoods.CartGoodsExtra> extra; List<CartGoods.CartGoodsExtra> extra;
private List<CartGoods.SpecialExtra> specialExtra;
/**
* 麦咖啡多规格商品加料
*/
private List<MaterialRequestVo> productMaterialList;
} }
...@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.hibernate.validator.constraints.NotEmpty; import org.hibernate.validator.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
/** /**
* All rights Reserved, Designed By www.freemud.cn * All rights Reserved, Designed By www.freemud.cn
* *
...@@ -27,4 +28,21 @@ public class QueryCartInfoRequestVo { ...@@ -27,4 +28,21 @@ public class QueryCartInfoRequestVo {
@ApiModelProperty(value = "门店id",required = true) @ApiModelProperty(value = "门店id",required = true)
@NotEmpty(message = "门店id不可为空") @NotEmpty(message = "门店id不可为空")
private String storeId; private String storeId;
@ApiModelProperty(value = "sessionId",required = true)
@NotEmpty(message = "用户sessionId不可为空")
private String sessionId;
@ApiModelProperty(value = "appId",required = true)
@NotEmpty(message = "appId不可为空")
private String appId;
@ApiModelProperty(value = "menuType",notes = "业务类型: 0 : 自提 1:外卖 2:微商城",required = true)
@NotEmpty(message ="业务类型不可为空")
private String menuType ;
@ApiModelProperty(value = "订单类型")
@NotNull(message = "订单类型不可为空")
private Integer orderType;
@ApiModelProperty(value = "收货地址id",notes = "svc卡支付外卖订单必传")
private String receiveId;
} }
\ No newline at end of file
...@@ -115,4 +115,18 @@ public class ShoppingCartInfoRequestVo extends BaseRequestVo { ...@@ -115,4 +115,18 @@ public class ShoppingCartInfoRequestVo extends BaseRequestVo {
private String ruleId; private String ruleId;
} }
/**
* 万能券、咖啡月卡券
*/
private String coffeeCouponCode;
/**
*
*/
private String coffeeCouponName;
/**
* 咖啡月卡适用商品id
*/
private List<String> goodsId;
} }
...@@ -20,7 +20,7 @@ public enum GoodsTypeEnum { ...@@ -20,7 +20,7 @@ public enum GoodsTypeEnum {
SET_MEAL_GOODS(3, "套餐商品"), SET_MEAL_GOODS(3, "套餐商品"),
SKU_GOODS(4, "sku商品"), SKU_GOODS(4, "sku商品"),
SPU_GOODS(5, "spu商品"), SPU_GOODS(5, "spu商品"),
REDUCE_PRICE_GOODS(6,"加价购商品"), REDUCE_PRICE_GOODS(6,"超值加购商品"),
MATERIAL(88, "有加料的商品"), MATERIAL(88, "有加料的商品"),
EXCEPTION_GOODS(99, "异常商品:商品菜单变化导致和购物车不商品匹配"); EXCEPTION_GOODS(99, "异常商品:商品菜单变化导致和购物车不商品匹配");
private Integer goodsType; private Integer goodsType;
......
...@@ -87,8 +87,12 @@ public enum ResponseResult { ...@@ -87,8 +87,12 @@ public enum ResponseResult {
SHOPPING_CART_SEAT_EMPTY("44020", "键位为空"), SHOPPING_CART_SEAT_EMPTY("44020", "键位为空"),
SHOPPING_CART_COUPON_USED("44021", "优惠券已加入餐盘"), SHOPPING_CART_COUPON_USED("44021", "优惠券已加入餐盘"),
SHOPPING_CART_GOODS_COUPON_CAN_NOT_USE("44022", "已加入同样优惠券,第二张暂不可用"), SHOPPING_CART_GOODS_COUPON_CAN_NOT_USE("44022", "已加入同样优惠券,第二张暂不可用"),
SHOPPING_CART_LIMIT_ADD("44025", "加购数量超过限制"), SHOPPING_CART_LIMIT_ADD("44025", "加购数量超过限制"),
SHOPPING_CART_GOODS_CHECK_ERROR("44023", "当前餐盘中没有可用券的饮品"),
SHOPPING_CART_PRODUCT_CAN_NOT_USE("44023", "商品不可用"),
SHOPPING_CART_COUPON_CAN_NOT_USE("44024", "商品券不可用"),
/** /**
* 订单状态码 * 订单状态码
*/ */
......
...@@ -213,7 +213,7 @@ public class AssortmentSdkService { ...@@ -213,7 +213,7 @@ public class AssortmentSdkService {
checkCartRequest.setTrackingNo(LogThreadLocal.getTrackingNo()); checkCartRequest.setTrackingNo(LogThreadLocal.getTrackingNo());
checkCartRequest.setMenuType(BusinessTypeEnum.getByType(menuType).getCode()); checkCartRequest.setMenuType(BusinessTypeEnum.getByType(menuType).getCode());
BaseResponse<CheckCartRequest> baseResponse ; BaseResponse<CheckCartRequest> baseResponse ;
baseResponse= shoppingCartService.checkAllCartGoodsForMCoffee(checkCartRequest); baseResponse= shoppingCartService.checkAllCartGoodsNew(checkCartRequest);
if (baseResponse == null) { if (baseResponse == null) {
return null; return null;
} }
...@@ -221,7 +221,7 @@ public class AssortmentSdkService { ...@@ -221,7 +221,7 @@ public class AssortmentSdkService {
} }
/** /**
* 调用SDK校验购物车 * 【麦咖啡】调用SDK校验购物车
* *
* @param oldAllCartGoodsList * @param oldAllCartGoodsList
* @param partnerId * @param partnerId
...@@ -229,8 +229,7 @@ public class AssortmentSdkService { ...@@ -229,8 +229,7 @@ public class AssortmentSdkService {
* @param shoppingCartGoodsResponseVo * @param shoppingCartGoodsResponseVo
* @param orderType * @param orderType
*/ */
public CheckCartRequest checkShoppingCartSdkForMCoffee(List<CartGoods> oldAllCartGoodsList, String partnerId, public CheckCartRequest checkShoppingCartSdkForMCoffee(List<CartGoods> oldAllCartGoodsList, String partnerId, String storeId, ShoppingCartGoodsBaseResponseVo shoppingCartGoodsResponseVo
String storeId, ShoppingCartGoodsBaseResponseVo shoppingCartGoodsResponseVo
, Integer orderType, String tableNumber, String menuType ,ShoppingCartBaseService shoppingCartService) { , Integer orderType, String tableNumber, String menuType ,ShoppingCartBaseService shoppingCartService) {
CheckCartRequest checkCartRequest = new CheckCartRequest(); CheckCartRequest checkCartRequest = new CheckCartRequest();
checkCartRequest.setCartGoodsList(JSONArray.parseArray(JSONObject.toJSONString(oldAllCartGoodsList), com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoods.class)); checkCartRequest.setCartGoodsList(JSONArray.parseArray(JSONObject.toJSONString(oldAllCartGoodsList), com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoods.class));
...@@ -242,7 +241,7 @@ public class AssortmentSdkService { ...@@ -242,7 +241,7 @@ public class AssortmentSdkService {
checkCartRequest.setTrackingNo(LogThreadLocal.getTrackingNo()); checkCartRequest.setTrackingNo(LogThreadLocal.getTrackingNo());
checkCartRequest.setMenuType(BusinessTypeEnum.getByType(menuType).getCode()); checkCartRequest.setMenuType(BusinessTypeEnum.getByType(menuType).getCode());
BaseResponse<CheckCartRequest> baseResponse ; BaseResponse<CheckCartRequest> baseResponse ;
baseResponse= shoppingCartService.checkAllCartGoodsNew(checkCartRequest); baseResponse= shoppingCartService.checkAllCartGoodsForMCoffee(checkCartRequest);
if (baseResponse == null) { if (baseResponse == null) {
return null; return null;
} }
......
...@@ -265,7 +265,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -265,7 +265,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
*/ */
Integer checkQty = this.checkSkuQty(allCartGoodsList, cartGoods); Integer checkQty = this.checkSkuQty(allCartGoodsList, cartGoods);
//购物车添加数量限制 //购物车添加数量限制
limitGoodsQty(checkQty,appId); Integer productsCount = limitGoodsQty(allCartGoodsList,cartGoods,appId);
//查询多个商品库存信息 //查询多个商品库存信息
queryManyGoodsStocks(addShoppingCartGoodsRequestVo, productIds, productBeanListSpuClass, skuId, checkQty); queryManyGoodsStocks(addShoppingCartGoodsRequestVo, productIds, productBeanListSpuClass, skuId, checkQty);
String productName = null; String productName = null;
...@@ -284,7 +284,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -284,7 +284,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
ActivityCalculationDiscountResponseDto.CalculationDiscountResult calculationDiscountResult ActivityCalculationDiscountResponseDto.CalculationDiscountResult calculationDiscountResult
=getCalculationDiscountResult(menuType,partnerId,storeId,userId,appId,userLoginInfoDto.getWxAppid(),orderType,assortmentCustomerInfoVo.isMemberPaid(), allCartGoodsList,new ArrayList(),new ArrayList<>(),null,deliveryAmount); =getCalculationDiscountResult(menuType,partnerId,storeId,userId,appId,userLoginInfoDto.getWxAppid(),orderType,assortmentCustomerInfoVo.isMemberPaid(), allCartGoodsList,new ArrayList(),new ArrayList<>(),null,deliveryAmount);
sendGoodsQtyCheck(checkQty,appId,partnerId, userId, storeId,tableNumber, oldCartGoodsList,shoppingCartBaseService,calculationDiscountResult.getSendGoods()); sendGoodsQtyCheck(productsCount,appId,partnerId, userId, storeId,tableNumber, oldCartGoodsList,shoppingCartBaseService,calculationDiscountResult.getSendGoods());
// 当商品数量被设为0时 // 当商品数量被设为0时
if (Objects.equals(cartGoods.getQty(), 0)) { if (Objects.equals(cartGoods.getQty(), 0)) {
assortmentSdkService.updateGoodsQtyBySdk(partnerId, userId, storeId, cartGoods.getCartGoodsUid(), 0, "", shoppingCartBaseService); assortmentSdkService.updateGoodsQtyBySdk(partnerId, userId, storeId, cartGoods.getCartGoodsUid(), 0, "", shoppingCartBaseService);
...@@ -357,11 +357,9 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -357,11 +357,9 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
if (cartGoods == null) { if (cartGoods == null) {
throw new ServiceException(ResponseResult.SHOPPING_CART_UPDATE_ERROR); throw new ServiceException(ResponseResult.SHOPPING_CART_UPDATE_ERROR);
} }
//购物车添加数量限制
limitGoodsQty(qty,appId);
// 检查购物车商品库存数量 // 检查购物车商品库存数量
checkUpdateStock(updateShoppingCartGoodsQtyRequestVo, cartGoods); checkUpdateStock(updateShoppingCartGoodsQtyRequestVo, cartGoods);
Integer oldQty = cartGoods.getQty();
// 更新购物车中数量 // 更新购物车中数量
List<CartGoods> cartGoodsList = assortmentSdkService.updateGoodsQtyBySdk(partnerId, userId, storeId, cartGoodsUid, qty<0?0:qty, "", shoppingCartBaseService); List<CartGoods> cartGoodsList = assortmentSdkService.updateGoodsQtyBySdk(partnerId, userId, storeId, cartGoodsUid, qty<0?0:qty, "", shoppingCartBaseService);
...@@ -385,7 +383,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -385,7 +383,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
shoppingCartGoodsResponseVo.setProducts(cartGoodsList); shoppingCartGoodsResponseVo.setProducts(cartGoodsList);
// return shoppingCartGoodsResponseVo; // return shoppingCartGoodsResponseVo;
} }
sendGoodsQtyCheckForUpdate(qty,cartGoods.getQty(),appId,partnerId, userId, storeId,null, cartGoodsUid,shoppingCartBaseService,calculationDiscountResult.getSendGoods()); sendGoodsQtyCheckForUpdate(cartGoodsList,oldQty,appId,partnerId, userId, storeId,null, cartGoodsUid,shoppingCartBaseService,calculationDiscountResult.getSendGoods());
ActivityQueryDto activityQueryDto = activityAdapter.getActivityQueryDto(partnerId, storeId, userId, appId, updateShoppingCartGoodsQtyRequestVo.getOrderType()); ActivityQueryDto activityQueryDto = activityAdapter.getActivityQueryDto(partnerId, storeId, userId, appId, updateShoppingCartGoodsQtyRequestVo.getOrderType());
...@@ -1652,12 +1650,19 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -1652,12 +1650,19 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
/** /**
* 查询生态配置限制加购开关与限制数量 * 查询生态配置限制加购开关与限制数量
*/ */
public void limitGoodsQty(Integer qty,String appid){ public Integer limitGoodsQty(List<CartGoods> oldCartGoodsList, CartGoods cartGoods,String appid){
Integer qty = 0;
if(CollectionUtils.isNotEmpty(oldCartGoodsList)){
for (CartGoods goods : oldCartGoodsList) {
qty += goods.getQty();
}
}
qty += cartGoods.getQty();
String redisKey = limitCartKey + appid; String redisKey = limitCartKey + appid;
Object value = redisCache.hashGet(redisKey, "2"); Object value = redisCache.hashGet(redisKey, "2");
if (value == null) { if (value == null) {
return ; return qty;
} else { } else {
JSONArray jsonArray = (JSONArray)value; JSONArray jsonArray = (JSONArray)value;
int cartLimitFlag = 0; int cartLimitFlag = 0;
...@@ -1666,9 +1671,15 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -1666,9 +1671,15 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
JSONObject jsonObject = (JSONObject)object; JSONObject jsonObject = (JSONObject)object;
HashMap hashMap = JSONObject.parseObject(jsonObject.toJSONString(),HashMap.class); HashMap hashMap = JSONObject.parseObject(jsonObject.toJSONString(),HashMap.class);
if("cartLimitFlag".equals(hashMap.get("appKey"))){ if("cartLimitFlag".equals(hashMap.get("appKey"))){
if (StringUtils.isBlank((String)hashMap.get("appValue"))) {
return qty;
}
cartLimitFlag = Integer.parseInt((String)hashMap.get("appValue")); cartLimitFlag = Integer.parseInt((String)hashMap.get("appValue"));
} }
if("cartLimitCount".equals(hashMap.get("appKey"))){ if("cartLimitCount".equals(hashMap.get("appKey"))){
if (StringUtils.isBlank((String)hashMap.get("appValue"))) {
return qty;
}
cartLimitCount = Integer.parseInt((String)hashMap.get("appValue")); cartLimitCount = Integer.parseInt((String)hashMap.get("appValue"));
} }
} }
...@@ -1676,7 +1687,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -1676,7 +1687,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
throw new ServiceException(ResponseResult.SHOPPING_CART_LIMIT_ADD); throw new ServiceException(ResponseResult.SHOPPING_CART_LIMIT_ADD);
} }
} }
return qty;
} }
...@@ -1706,9 +1717,15 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -1706,9 +1717,15 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
JSONObject jsonObject = (JSONObject)object; JSONObject jsonObject = (JSONObject)object;
HashMap hashMap = JSONObject.parseObject(jsonObject.toJSONString(),HashMap.class); HashMap hashMap = JSONObject.parseObject(jsonObject.toJSONString(),HashMap.class);
if("cartLimitFlag".equals(hashMap.get("appKey"))){ if("cartLimitFlag".equals(hashMap.get("appKey"))){
if (StringUtils.isBlank((String)hashMap.get("appValue"))) {
return;
}
cartLimitFlag = Integer.parseInt((String)hashMap.get("appValue")); cartLimitFlag = Integer.parseInt((String)hashMap.get("appValue"));
} }
if("cartLimitCount".equals(hashMap.get("appKey"))){ if("cartLimitCount".equals(hashMap.get("appKey"))){
if (StringUtils.isBlank((String)hashMap.get("appValue"))) {
return;
}
cartLimitCount = Integer.parseInt((String)hashMap.get("appValue")); cartLimitCount = Integer.parseInt((String)hashMap.get("appValue"));
} }
} }
...@@ -1723,16 +1740,14 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -1723,16 +1740,14 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
/** /**
* 购物车添加完成后促销返回赠送商品总数量校验 * 购物车添加完成后促销返回赠送商品总数量校验
*/ */
public void sendGoodsQtyCheckForUpdate(Integer updateQty,Integer goodsQty,String appid,String partnerId, String userId, String storeId, String cartGoodsUid,String tableNumber, ShoppingCartBaseService shoppingCartService,List<ActivityCalculationDiscountResponseDto.CalculationDiscountResult.SendActivity> sendActivitys){ public void sendGoodsQtyCheckForUpdate(List<CartGoods> cartGoodsList,Integer goodsQty,String appid,String partnerId, String userId, String storeId, String cartGoodsUid,String tableNumber, ShoppingCartBaseService shoppingCartService,List<ActivityCalculationDiscountResponseDto.CalculationDiscountResult.SendActivity> sendActivitys){
if(CollectionUtils.isEmpty(sendActivitys)){ Integer updateQty = 0;
return; if(CollectionUtils.isNotEmpty(cartGoodsList)){
} for (CartGoods goods : cartGoodsList) {
int sendQty = 0; updateQty += goods.getQty();
for (ActivityCalculationDiscountResponseDto.CalculationDiscountResult.SendActivity sendActivity : sendActivitys){
for (ActivityCalculationDiscountResponseDto.CalculationDiscountResult.SendActivity.SendGoods sendGoods : sendActivity.getSendGoods()){
sendQty += sendGoods.getSendNumber();
} }
} }
String redisKey = limitCartKey + appid; String redisKey = limitCartKey + appid;
Object value = redisCache.hashGet(redisKey, "2"); Object value = redisCache.hashGet(redisKey, "2");
...@@ -1746,12 +1761,27 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -1746,12 +1761,27 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
JSONObject jsonObject = (JSONObject)object; JSONObject jsonObject = (JSONObject)object;
HashMap hashMap = JSONObject.parseObject(jsonObject.toJSONString(),HashMap.class); HashMap hashMap = JSONObject.parseObject(jsonObject.toJSONString(),HashMap.class);
if("cartLimitFlag".equals(hashMap.get("appKey"))){ if("cartLimitFlag".equals(hashMap.get("appKey"))){
if (StringUtils.isBlank((String)hashMap.get("appValue"))) {
return;
}
cartLimitFlag = Integer.parseInt((String)hashMap.get("appValue")); cartLimitFlag = Integer.parseInt((String)hashMap.get("appValue"));
} }
if("cartLimitCount".equals(hashMap.get("appKey"))){ if("cartLimitCount".equals(hashMap.get("appKey"))){
if (StringUtils.isBlank((String)hashMap.get("appValue"))) {
return;
}
cartLimitCount = Integer.parseInt((String)hashMap.get("appValue")); cartLimitCount = Integer.parseInt((String)hashMap.get("appValue"));
} }
} }
int sendQty = 0;
if(CollectionUtils.isNotEmpty(sendActivitys)){
for (ActivityCalculationDiscountResponseDto.CalculationDiscountResult.SendActivity sendActivity : sendActivitys){
for (ActivityCalculationDiscountResponseDto.CalculationDiscountResult.SendActivity.SendGoods sendGoods : sendActivity.getSendGoods()){
sendQty += sendGoods.getSendNumber();
}
}
}
if(cartLimitFlag == 1 && cartLimitCount != 0 && updateQty+sendQty > cartLimitCount){ if(cartLimitFlag == 1 && cartLimitCount != 0 && updateQty+sendQty > cartLimitCount){
assortmentSdkService.updateGoodsQtyBySdk(partnerId, userId, storeId, cartGoodsUid, goodsQty, "", shoppingCartBaseService); assortmentSdkService.updateGoodsQtyBySdk(partnerId, userId, storeId, cartGoodsUid, goodsQty, "", shoppingCartBaseService);
throw new ServiceException(ResponseResult.SHOPPING_CART_LIMIT_ADD); throw new ServiceException(ResponseResult.SHOPPING_CART_LIMIT_ADD);
......
...@@ -115,7 +115,13 @@ public class CalculationServiceImpl { ...@@ -115,7 +115,13 @@ public class CalculationServiceImpl {
List<ActivityCalculationDiscountRequestDto.CalculationDiscountGoods> calculationDiscountGoodsList = new ArrayList<>(); List<ActivityCalculationDiscountRequestDto.CalculationDiscountGoods> calculationDiscountGoodsList = new ArrayList<>();
for (CartGoods cartGoods : cartGoodsList) { for (CartGoods cartGoods : cartGoodsList) {
addCalculationDiscountGoods(calculationDiscountGoodsList, cartGoods.getCustomerCode(),cartGoods.getGoodsId(), cartGoods.getQty(), cartGoods.getFinalPrice(), cartGoods.getMemberDiscount(),cartGoods); addCalculationDiscountGoods(calculationDiscountGoodsList,
StringUtils.isNotEmpty(cartGoods.getCustomerCode()) ? cartGoods.getCustomerCode() : "",
StringUtils.isNotEmpty(cartGoods.getGoodsId()) ? cartGoods.getGoodsId() : "",
null != cartGoods.getQty() ? cartGoods.getQty() : 0 ,
null != cartGoods.getFinalPrice() ? cartGoods.getFinalPrice() : 0,
null != cartGoods.getMemberDiscount() ? cartGoods.getMemberDiscount() : 0,
cartGoods);
} }
// 当加价购商品不为空时 // 当加价购商品不为空时
...@@ -199,18 +205,18 @@ public class CalculationServiceImpl { ...@@ -199,18 +205,18 @@ public class CalculationServiceImpl {
} }
//订单级别券优惠 //订单级别券优惠
for (ActivityCalculationDiscountResponseDto.CalculationDiscountResult.CouponResults discount : calculationDiscountResult.getCouponDiscounts()) { // for (ActivityCalculationDiscountResponseDto.CalculationDiscountResult.CouponResults discount : calculationDiscountResult.getCouponDiscounts()) {
int discountAmount = (discount.getDiscountAmount() == null) ? 0 : discount.getDiscountAmount(); // int discountAmount = (discount.getDiscountAmount() == null) ? 0 : discount.getDiscountAmount();
Integer discountType = discount.getActivityType(); // Integer discountType = discount.getActivityType();
if (discountType != null && discountAmount > 0) { // if (discountType != null && discountAmount > 0) {
ActivityDiscountsDto activityDiscountsDto = new ActivityDiscountsDto(); // ActivityDiscountsDto activityDiscountsDto = new ActivityDiscountsDto();
activityDiscountsDto.setActivityCode(discount.getCouponCode()); // activityDiscountsDto.setActivityCode(discount.getCouponCode());
activityDiscountsDto.setActivityName(discount.getActivityName()); // activityDiscountsDto.setActivityName(discount.getActivityName());
activityDiscountsDto.setActivityType(discountType); // activityDiscountsDto.setActivityType(discountType);
activityDiscountsDto.setDiscountAmount(0 - discountAmount); // activityDiscountsDto.setDiscountAmount(0 - discountAmount);
activityDiscountsDtos.add(activityDiscountsDto); // activityDiscountsDtos.add(activityDiscountsDto);
} // }
} // }
//过滤出加价购 //过滤出加价购
List<ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Discount> addMoneyDiscounts = discounts.stream().filter(discount -> ActivityTypeEnum.TYPE_81.getCode().equals(discount.getType())).collect(Collectors.toList()); List<ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Discount> addMoneyDiscounts = discounts.stream().filter(discount -> ActivityTypeEnum.TYPE_81.getCode().equals(discount.getType())).collect(Collectors.toList());
...@@ -366,11 +372,12 @@ public class CalculationServiceImpl { ...@@ -366,11 +372,12 @@ public class CalculationServiceImpl {
calculationDiscountGoods.setGoodsQuantity(goodsQuantity); calculationDiscountGoods.setGoodsQuantity(goodsQuantity);
calculationDiscountGoods.setOriginalPrice(originalPrice); calculationDiscountGoods.setOriginalPrice(originalPrice);
calculationDiscountGoods.setMemberDiscount(memberDiscount); calculationDiscountGoods.setMemberDiscount(memberDiscount);
//新增咖啡月卡券券号
calculationDiscountGoods.setCouponCode(cartGoods.getCouponCode());
ArrayList<ActivityCalculationDiscountRequestDto.CalculationDiscountGoods.Material> materials = new ArrayList<>();
//可选搭配 //可选搭配
if (cartGoods != null && CollectionUtils.isNotEmpty(cartGoods.getProductGroupList())) { if (cartGoods != null && CollectionUtils.isNotEmpty(cartGoods.getProductGroupList())) {
ArrayList<ActivityCalculationDiscountRequestDto.CalculationDiscountGoods.Material> materials = new ArrayList<>();
for (CartGoods.ComboxGoods materialGoods : cartGoods.getProductGroupList()) { for (CartGoods.ComboxGoods materialGoods : cartGoods.getProductGroupList()) {
ActivityCalculationDiscountRequestDto.CalculationDiscountGoods.Material material = new ActivityCalculationDiscountRequestDto.CalculationDiscountGoods.Material(); ActivityCalculationDiscountRequestDto.CalculationDiscountGoods.Material material = new ActivityCalculationDiscountRequestDto.CalculationDiscountGoods.Material();
material.setType(2); material.setType(2);
...@@ -379,9 +386,37 @@ public class CalculationServiceImpl { ...@@ -379,9 +386,37 @@ public class CalculationServiceImpl {
material.setOriginalPrice(materialGoods.getFinalPrice()); material.setOriginalPrice(materialGoods.getFinalPrice());
materials.add(material); materials.add(material);
} }
calculationDiscountGoods.setSmallMaterial(materials);
} }
//固定商品
if (cartGoods != null && CollectionUtils.isNotEmpty(cartGoods.getProductComboList())) {
for (CartGoods.ComboxGoods materialGoods : cartGoods.getProductComboList()) {
//加料
if (CollectionUtils.isNotEmpty(materialGoods.getProductMaterialList())) {
for (CartGoods.MaterialGoods materialGoods2 : materialGoods.getProductMaterialList()) {
ActivityCalculationDiscountRequestDto.CalculationDiscountGoods.Material material = new ActivityCalculationDiscountRequestDto.CalculationDiscountGoods.Material();
material.setType(1);
material.setGoodsId(materialGoods2.getSpuId());
material.setGoodsQuantity(cartGoods.getQty());
material.setOriginalPrice(materialGoods2.getFinalPrice());
materials.add(material);
}
}
}
}
//加料
if (cartGoods != null && CollectionUtils.isNotEmpty(cartGoods.getProductMaterialList())) {
for (CartGoods.MaterialGoods materialGoods : cartGoods.getProductMaterialList()) {
ActivityCalculationDiscountRequestDto.CalculationDiscountGoods.Material material = new ActivityCalculationDiscountRequestDto.CalculationDiscountGoods.Material();
material.setType(1);
material.setGoodsId(materialGoods.getSpuId());
material.setGoodsQuantity(cartGoods.getQty());
material.setOriginalPrice(materialGoods.getFinalPrice());
materials.add(material);
}
}
calculationDiscountGoods.setSmallMaterial(materials);
calculationDiscountGoodsList.add(calculationDiscountGoods); calculationDiscountGoodsList.add(calculationDiscountGoods);
// //累加需加入计算的商品 // //累加需加入计算的商品
...@@ -402,9 +437,9 @@ public class CalculationServiceImpl { ...@@ -402,9 +437,9 @@ public class CalculationServiceImpl {
long totalPackgeAmount = 0L; long totalPackgeAmount = 0L;
for (CartGoods cartGoods : cartGoodsList) { for (CartGoods cartGoods : cartGoodsList) {
// 设置商品原价与商品现价的初始值 // 设置商品原价与商品现价的初始值
long originalAmount = cartGoods.getOriginalPrice() * cartGoods.getQty(); long originalAmount = null != cartGoods.getOriginalPrice() ? cartGoods.getOriginalPrice() : 0;
long amount = cartGoods.getOriginalPrice() * cartGoods.getQty(); long amount = null != cartGoods.getOriginalPrice() ? cartGoods.getOriginalPrice() : 0;
long packAmount = cartGoods.getPackPrice() * cartGoods.getQty(); long packAmount = null != cartGoods.getPackPrice() ? cartGoods.getPackPrice() : 0;
totalOriginalAmount += originalAmount; totalOriginalAmount += originalAmount;
totalAmount += amount; totalAmount += amount;
totalPackgeAmount += packAmount; totalPackgeAmount += packAmount;
...@@ -419,11 +454,8 @@ public class CalculationServiceImpl { ...@@ -419,11 +454,8 @@ public class CalculationServiceImpl {
shoppingCartGoodsResponseVo.setTotalAmount(shoppingCartGoodsResponseVo.getTotalAmount() + totalPackgeAmount); shoppingCartGoodsResponseVo.setTotalAmount(shoppingCartGoodsResponseVo.getTotalAmount() + totalPackgeAmount);
shoppingCartGoodsResponseVo.setNewPackAmount(totalPackgeAmount); shoppingCartGoodsResponseVo.setNewPackAmount(totalPackgeAmount);
shoppingCartGoodsResponseVo.setTotalDiscountAmount(calculationDiscount == null ? 0L : calculationDiscount.getTotalDiscountAmount()); shoppingCartGoodsResponseVo.setTotalDiscountAmount(calculationDiscount == null ? 0L : calculationDiscount.getTotalDiscountAmount());
if(calculationDiscount != null && calculationDiscount.getDeliveryAmount() == null){ shoppingCartGoodsResponseVo.setDeliveryAmount(deliveryAmount);
shoppingCartGoodsResponseVo.setDeliveryAmount(deliveryAmount); shoppingCartGoodsResponseVo.setDiscountDeliveryAmount(calculationDiscount == null ? 0L :calculationDiscount.getDistributionFee());
shoppingCartGoodsResponseVo.setDiscountDeliveryAmount(deliveryAmount);
}
} }
} }
...@@ -279,7 +279,7 @@ public class CouponDiscountCalculation { ...@@ -279,7 +279,7 @@ public class CouponDiscountCalculation {
private List<CouponState> buildAvailableCoupons(List<CartGoods> cartGoods, String partnerId, String storeId, List<String> couponCodes) { public List<CouponState> buildAvailableCoupons(List<CartGoods> cartGoods, String partnerId, String storeId, List<String> couponCodes) {
// String appSecret = getAppSecret(partnerId); // String appSecret = getAppSecret(partnerId);
// 最大15一提交 // 最大15一提交
int maxNum = 15; int maxNum = 15;
...@@ -326,21 +326,28 @@ public class CouponDiscountCalculation { ...@@ -326,21 +326,28 @@ public class CouponDiscountCalculation {
} }
public List<CouponAvailableReq> buildAvailableCoupons(QueryCartInfoRequestVo requestVo,List<CartGoods> cartGoods){ public List<CouponAvailableReq> buildAvailableCoupons(QueryCartInfoRequestVo requestVo,List<CartGoods> cartGoods,String moneyCoupon){
List<CouponAvailableReq> resList = new ArrayList<>(); List<CouponAvailableReq> resList = new ArrayList<>();
CouponAvailableReq res = new CouponAvailableReq(); CouponAvailableReq res = new CouponAvailableReq();
res.setProviderId(requestVo.getPartnerId()); res.setProviderId(requestVo.getPartnerId());
res.setMerchantId(requestVo.getPartnerId()); res.setMerchantId(requestVo.getPartnerId());
res.setStoreId(requestVo.getStoreId()); res.setStoreId(requestVo.getStoreId());
List<String> couponList = new ArrayList<>();
res.setChannelIdList(commonService.getOrgCodes(requestVo.getPartnerId(), requestVo.getStoreId())); res.setChannelIdList(commonService.getOrgCodes(requestVo.getPartnerId(), requestVo.getStoreId()));
List<CouponProductVo> productList = new ArrayList<>(); List<CouponProductVo> productList = new ArrayList<>();
res.setCouponCodes(StringUtils.isNotEmpty(moneyCoupon) ? Arrays.asList(moneyCoupon) :null);
if (CollectionUtils.isNotEmpty(cartGoods)) { if (CollectionUtils.isNotEmpty(cartGoods)) {
cartGoods.forEach(cartGood -> { cartGoods.forEach(cartGood -> {
if (StringUtils.isNotEmpty(cartGood.getCouponCode())) { if (StringUtils.isNotEmpty(cartGood.getCouponCode())) {
couponList.add(cartGood.getCouponCode()); CouponProductVo couponProductVo = new CouponProductVo();
res.setCouponCodes(couponList); couponProductVo.setAmount(cartGood.getAmount().intValue());
couponProductVo.setKeyProductCode(cartGood.getCustomerCode());
couponProductVo.setQuantity(cartGood.getQty());
couponProductVo.setProductId(cartGood.getGoodsId());
couponProductVo.setCouponCode(cartGood.getCouponCode());
couponProductVo.setCategoryCode(null);
productList.add(couponProductVo);
} }
if (CollectionUtils.isNotEmpty(cartGood.getProductComboList())) { if (CollectionUtils.isNotEmpty(cartGood.getProductComboList())) {
cartGood.getProductComboList().forEach(comboxGoods -> { cartGood.getProductComboList().forEach(comboxGoods -> {
CouponProductVo couponProductVo = new CouponProductVo(); CouponProductVo couponProductVo = new CouponProductVo();
...@@ -370,8 +377,7 @@ public class CouponDiscountCalculation { ...@@ -370,8 +377,7 @@ public class CouponDiscountCalculation {
resList.add(res); resList.add(res);
} }
return resList; return resList;
} }
......
...@@ -61,6 +61,7 @@ public class SetMealCalculation { ...@@ -61,6 +61,7 @@ public class SetMealCalculation {
// cartGoods.setOriginalAmount(cartGoods.getOriginalPrice() * cartGoods.getQty()); // cartGoods.setOriginalAmount(cartGoods.getOriginalPrice() * cartGoods.getQty());
cartGoods.setPackPrice(cartGoods.getPackPrice() * cartGoods.getQty()); cartGoods.setPackPrice(cartGoods.getPackPrice() * cartGoods.getQty());
// 可选商品现总价 // 可选商品现总价
productGroupTotalAmount = 0l;
long productGroupAmount = cartGoods.getProductGroupList().stream().mapToLong(t -> t.getFinalPrice() * t.getQty()).sum(); long productGroupAmount = cartGoods.getProductGroupList().stream().mapToLong(t -> t.getFinalPrice() * t.getQty()).sum();
productGroupTotalAmount += productGroupAmount * cartGoods.getQty(); productGroupTotalAmount += productGroupAmount * cartGoods.getQty();
......
...@@ -58,6 +58,7 @@ public class TimeSaleCalculation { ...@@ -58,6 +58,7 @@ public class TimeSaleCalculation {
Map<String, Integer> numberMap = new HashMap<>(); Map<String, Integer> numberMap = new HashMap<>();
List<Integer> discounts = Arrays.asList(ActivityTypeEnum.TYPE_2.getCode(), ActivityTypeEnum.TYPE_21.getCode(),ActivityTypeEnum.TYPE_23.getCode()); List<Integer> discounts = Arrays.asList(ActivityTypeEnum.TYPE_2.getCode(), ActivityTypeEnum.TYPE_21.getCode(),ActivityTypeEnum.TYPE_23.getCode());
for (CartGoods cartGoods : cartGoodsList) { for (CartGoods cartGoods : cartGoodsList) {
cartGoods.setOriginalPrice( null != cartGoods.getOriginalPrice() ? cartGoods.getOriginalPrice() : 0);
ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Goods goods; ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Goods goods;
if ((goods = goodsMap.get(cartGoods.getGoodsId())) == null) { if ((goods = goodsMap.get(cartGoods.getGoodsId())) == null) {
continue; continue;
......
...@@ -22,6 +22,6 @@ public class CouponProductVo { ...@@ -22,6 +22,6 @@ public class CouponProductVo {
private String productId; private String productId;
private Integer amount; private Integer amount;
private Integer quantity; private Integer quantity;
private String couponCode;
private String categoryCode; private String categoryCode;
} }
...@@ -2,6 +2,7 @@ package cn.freemud.service.impl.mcoffee.entity; ...@@ -2,6 +2,7 @@ package cn.freemud.service.impl.mcoffee.entity;
import cn.freemud.entities.vo.CartGoods; import cn.freemud.entities.vo.CartGoods;
import cn.freemud.entities.vo.ComboxGoodsRequestVo; import cn.freemud.entities.vo.ComboxGoodsRequestVo;
import cn.freemud.entities.vo.MaterialRequestVo;
import cn.freemud.entities.vo.ShoppingCartInfoRequestVo; import cn.freemud.entities.vo.ShoppingCartInfoRequestVo;
import lombok.Data; import lombok.Data;
import org.hibernate.validator.constraints.NotEmpty; import org.hibernate.validator.constraints.NotEmpty;
...@@ -59,10 +60,6 @@ public class MCoffeeAddGoodsRequestVo { ...@@ -59,10 +60,6 @@ public class MCoffeeAddGoodsRequestVo {
private String spuId; private String spuId;
private String skuId; private String skuId;
/**
* 商品额外的属性
*/
private List<CartGoods.CartGoodsExtra> extra;
private String version; private String version;
...@@ -75,6 +72,10 @@ public class MCoffeeAddGoodsRequestVo { ...@@ -75,6 +72,10 @@ public class MCoffeeAddGoodsRequestVo {
*/ */
private String categoryName; private String categoryName;
/** /**
* 商品额外的属性
*/
private List<CartGoods.CartGoodsExtra> extra;
/**
* 套餐固定商品 * 套餐固定商品
*/ */
private List<ComboxGoodsRequestVo> productComboList; private List<ComboxGoodsRequestVo> productComboList;
...@@ -83,6 +84,16 @@ public class MCoffeeAddGoodsRequestVo { ...@@ -83,6 +84,16 @@ public class MCoffeeAddGoodsRequestVo {
*/ */
private List<ComboxGoodsRequestVo> productGroupList; private List<ComboxGoodsRequestVo> productGroupList;
/**
* 加料
*/
private List<MaterialRequestVo> productMaterialList;
/**
* 麦咖啡定制属性
*/
private List<CartGoods.SpecialExtra> specialExtra;
private String appType; private String appType;
......
...@@ -2,6 +2,8 @@ package cn.freemud.service.thirdparty; ...@@ -2,6 +2,8 @@ package cn.freemud.service.thirdparty;
import cn.freemud.entities.dto.ProductBaseResponse; import cn.freemud.entities.dto.ProductBaseResponse;
import cn.freemud.entities.dto.RequiredProductRequest; import cn.freemud.entities.dto.RequiredProductRequest;
import cn.freemud.entities.dto.product.ValiadShopProductResponse;
import cn.freemud.entities.dto.product.ValidateShopProductRequest;
import org.springframework.cloud.netflix.feign.FeignClient; import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
...@@ -29,4 +31,8 @@ public interface ProductClient { ...@@ -29,4 +31,8 @@ public interface ProductClient {
@PostMapping({"/Shop/ListMenuMustProduct"}) @PostMapping({"/Shop/ListMenuMustProduct"})
ProductBaseResponse<List<String>> getRequiredProductList(@RequestBody RequiredProductRequest request); ProductBaseResponse<List<String>> getRequiredProductList(@RequestBody RequiredProductRequest request);
@PostMapping({"/Shop/ValidateShopProduct/Reason"})
ProductBaseResponse<ValiadShopProductResponse> validateShopProductAboutReason(@RequestBody ValidateShopProductRequest request);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment