Commit 299a2394 by ping.wu
parents e8a4b035 ee5be573
......@@ -10,7 +10,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>assortment-ordercenter-sdk</artifactId>
<version>2.1.38-RELEASE</version>
<version>2.1.39-RELEASE</version>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
......@@ -20,7 +20,7 @@
<dependency>
<artifactId>assortment-data-manager</artifactId>
<groupId>com.freemud.sdk.api.assortment</groupId>
<version>3.5.RELEASE</version>
<version>5.4.3-RELEASE</version>
<scope>provided</scope>
</dependency>
<dependency>
......@@ -38,7 +38,7 @@
<dependency>
<groupId>cn.freemud</groupId>
<artifactId>ordercenter-sdk</artifactId>
<version>1.3.40.RELEASE</version>
<version>1.3.41.RELEASE</version>
</dependency>
<dependency>
<groupId>com.freemud.application.service.sdk</groupId>
......@@ -55,7 +55,7 @@
<dependency>
<groupId>com.freemud.application.service.sdk</groupId>
<artifactId>storecenter-sdk</artifactId>
<version>3.2.6.RELEASE</version>
<version>3.2.8.RELEASE</version>
<scope>provided</scope>
</dependency>
<dependency>
......
......@@ -115,3 +115,4 @@
| 2.1.36-RELEASE | 新增C端小程序配送显示地图配送距离字段 | 王航航 | 2021-03-09 |
| 2.1.37-RELEASE | 订单满赠优惠 | 张志恒 | 2021-03-11 |
| 2.1.38-RELEASE | 外卖配送自动流转 | 张志恒 | 2021-03-11 |
| 2.1.39-RELEASE | 美业 | 刘鹏飞 | 2021-03-12 |
\ No newline at end of file
......@@ -34,11 +34,13 @@ public class OrderAssortmentDtoConvertToDMVoAdapter {
public static DMOrderItemVo convertCreateOrderProductRequest(CreateOrderProductRequest createOrderProductRequest){
DMOrderItemVo dmOrderItemVo=new DMOrderItemVo();
dmOrderItemVo.setAddInfo(createOrderProductRequest.getAddInfo());
dmOrderItemVo.setForeignAddInfo(createOrderProductRequest.getForeignAddInfo());
dmOrderItemVo.setCategoryId(createOrderProductRequest.getCategoryId());
dmOrderItemVo.setCategoryName(createOrderProductRequest.getCategoryName());
dmOrderItemVo.setCustomerCode(createOrderProductRequest.getCustomerCode());
dmOrderItemVo.setDiscountId(createOrderProductRequest.getDiscountId());
dmOrderItemVo.setExtras(createOrderProductRequest.getExtras());
dmOrderItemVo.setForeignExtras(createOrderProductRequest.getForeignExtras());
dmOrderItemVo.setHasStockProduct(createOrderProductRequest.getHasStockProudct());
dmOrderItemVo.setWeight(createOrderProductRequest.getWeight());
dmOrderItemVo.setUnit(createOrderProductRequest.getUnit());
......
......@@ -925,15 +925,19 @@ public class OrderSdkAdapter {
productBean.setPrice(orderItemResp.getProductPrice().longValue());
productBean.setSalePrice(orderItemResp.getSalePrice().longValue());
productBean.setProductName(orderItemResp.getProductName());
productBean.setProductForeignName(orderItemResp.getProductForeignName());
productBean.setSpecification(orderItemResp.getProductSpec());
productBean.setSpecificationName(orderItemResp.getProductSpecName());
productBean.setSpecificationForeignName(orderItemResp.getProductForeignSpecName());
productBean.setProductSharePrice(orderItemResp.getProductSharePrice());
productBean.setSettlementPrice(orderItemResp.getSettlementPrice().longValue());
productBean.setUnit(orderItemResp.getProductUnit());
Map<String, String> map = new HashMap<String, String>();
map.put("attributeNames", orderItemResp.getProductProperty());
map.put("attributeForeignNames", orderItemResp.getProductForeignProperty());
productBean.setAddInfo(JSONObject.toJSONString(map));
productBean.setProductProperty(orderItemResp.getProductProperty());
productBean.setProductForeignProperty(orderItemResp.getProductForeignProperty());
productBean.setExtInfo(orderItemResp.getExtInfo());
productBean.setNote(orderItemResp.getNote());
......@@ -1073,6 +1077,11 @@ public class OrderSdkAdapter {
//【订单开放平台】订单详情查询接口增加配送类型字段
data.setExpressType(orderInfoReqs.getExpressType());
//围餐门店英文名称
if (orderInfoReqs.getOrderExtended() != null) {
data.setShopNameEn(orderInfoReqs.getOrderExtended().getStoreNameEn());
}
if (orderInfoReqs.getAfterSalesOrderList() != null && orderInfoReqs.getAfterSalesOrderList().size() >= 1) {
data.setAfterSalesOrderResp(orderInfoReqs.getAfterSalesOrderList().get(0));
}
......@@ -2499,6 +2508,7 @@ public class OrderSdkAdapter {
request.setOrderClient(requestVO.getOrderClient());
request.setCompanySelfCode(requestVO.getThirdOrderCode());
request.setStoreName(requestVO.getShopName());
request.setStoreNameEn(requestVO.getShopNameEn());
request.setPartnerName(requestVO.getCompanyName());
request.setStoreUnifyId(requestVO.getShopCode());
request.setUserId(requestVO.getUserId());
......@@ -2770,9 +2780,11 @@ public class OrderSdkAdapter {
orderItemCreateReq.setId(product.getId());
orderItemCreateReq.setPartnerId(partnerId);
orderItemCreateReq.setProductName(product.getProductName());
orderItemCreateReq.setProductForeignName(product.getProductForeignName());
orderItemCreateReq.setProductId(product.getProductId());
orderItemCreateReq.setProductSpec(product.getSpecification());
orderItemCreateReq.setProductSpecName(product.getSpecificationName());
orderItemCreateReq.setProductForeignSpecName(product.getSpecificationForeignName());
orderItemCreateReq.setProductSeq(product.getOpid());
orderItemCreateReq.setProductQuantity(product.getNumber());
orderItemCreateReq.setProductPrice(product.getPrice());
......@@ -2843,6 +2855,7 @@ public class OrderSdkAdapter {
OrderProductAddInfoDto addInfo = JSONObject.parseObject(product.getAddInfo(), OrderProductAddInfoDto.class);
if (addInfo !=null ) {
orderItemCreateReq.setProductProperty(addInfo.getAttributeNames());
orderItemCreateReq.setProductForeignProperty(addInfo.getAttributeForeignNames());
}
orderItemCreateReq.setProductPicUrl(product.getPicture());
orderItemCreateReq.setThirdProductId(product.getCustomerCode());
......@@ -3012,13 +3025,17 @@ public class OrderSdkAdapter {
CreateOrderProductRequest createOrderProductRequest = new CreateOrderProductRequest();
createOrderProductRequest.setProductCode(productBean.getProductCode());
createOrderProductRequest.setProductName(productBean.getProductName());
createOrderProductRequest.setProductForeignName(productBean.getProductForeignName());
createOrderProductRequest.setNumber(productBean.getNumber());
createOrderProductRequest.setParentProductId(productBean.getParentProductId());
createOrderProductRequest.setTrackingNo(trackingNo);
createOrderProductRequest.setAddInfo(productBean.getAddInfo());
createOrderProductRequest.setForeignAddInfo(productBean.getForeignAddInfo());
createOrderProductRequest.setProductId(productBean.getProductId());
createOrderProductRequest.setSpecification(productBean.getSpecification());
createOrderProductRequest.setSpecificationName(productBean.getSpecificationName());
createOrderProductRequest.setSpecificationForeignName(productBean.getSpecificationName());
createOrderProductRequest.setCustomerCode(productBean.getCustomerCode());
createOrderProductRequest.setSequence(productBean.getSequence());
createOrderProductRequest.setPrice(productBean.getPrice());
......
......@@ -42,6 +42,7 @@ public enum OrderSourceType {
FMWD("fmwd", "非码微店", 25),
Y_POS("ypos", "非码云POS", 26),
TIKTOKPAY("tiktokpay","抖音支付", 27),
BEAUTIFUL("beautiful","美业", 28),
parkingmanual("parkingmanual", "农工商停车手工录单", 98),
PARKING("parking", "农工商停车", 99),
SDG("sdg", "闪电购", 1000);
......
......@@ -42,6 +42,11 @@ public class AssortmentGroupCreateOrderRequest extends BaseConfig {
* 门店名称
*/
private String shopName;
/**
* 门店名称英文
*/
private String shopNameEn;
/**
* 用户ID
*/
......
......@@ -31,6 +31,10 @@ public class BaseCreateOrderRequest extends BaseConfig {
*/
private String shopName;
/**
* 门店英文名称
*/
private String shopNameEn;
/**
* 用户ID
*/
private String userId;
......@@ -213,6 +217,9 @@ public class BaseCreateOrderRequest extends BaseConfig {
private SendPoint point;
//门店英文名称
private String storeNameEn;
}
@Data
......
package com.freemud.sdk.api.assortment.order.request.order;
import lombok.Data;
/**
* @author wanghanghang
* @title: CreateOrderProductExpandRequest
* @projectName order-group
* @description: 订单商品信息字段拓展表
* @date 2021/3/3上午10:43
*/
@Data
public class CreateOrderProductExpandRequest {
/**订单主键id**/
private Long orderId;
/**订单item主键id**/
private Long orderItemId;
/**商品英文名**/
private String productForeignName;
/**
* 商品规格英文名称
*/
private String specificationForeignName;
}
......@@ -28,6 +28,11 @@ public class CreateOrderProductRequest extends BaseConfig {
* 商品名称
*/
private String productName;
/**商品英文名**/
private String productForeignName;
/**
* 商品数量
*/
......@@ -40,6 +45,11 @@ public class CreateOrderProductRequest extends BaseConfig {
* 商品规格名称
*/
private String specificationName;
/**
* 商品规格英文名称
*/
private String specificationForeignName;
/**
* 第三方商品编号,商品服务唯一
*/
......@@ -76,10 +86,14 @@ public class CreateOrderProductRequest extends BaseConfig {
* 属性 温|半糖|甜
*/
private String addInfo;
private String foreignAddInfo;
/**
* 属性
*/
private String extras;
private String foreignExtras;
/**
* 第三方菜品分类Id
*/
......
......@@ -27,6 +27,11 @@ public class OrderProductAddInfoDto extends BaseConfig {
private String attributeNames;
/**
* 属性英文名称 多糖/冷/常温
*/
private String attributeForeignNames;
/**
* 是否是套餐内固定商品
*/
private Boolean isFixedProduct;
......
......@@ -19,6 +19,10 @@ public class OrderSpecialExtraAttrRequest {
*/
private String attributeName;
/**
* 属性英文名
*/
private String attributeForeignName;
/**
* 入机code
*/
private String specialCode;
......
......@@ -210,6 +210,7 @@ public class QueryOrdersResponse {
*/
private String thirdShopId;
private String shopName;
private String shopNameEn;
private String source;
private String sourceName;
/**
......@@ -577,6 +578,10 @@ public class QueryOrdersResponse {
*/
private String productName;
/**
* 商品英文名称
*/
private String productForeignName;
/**
* 商品排序
*/
private int sequence;
......@@ -585,16 +590,20 @@ public class QueryOrdersResponse {
*/
private String specification;
private String specificationName;
private String specificationForeignName;
private String unit;
/**
* 商品扩展字段 保存为
*/
private String addInfo;
private String foreignAddInfo;
/**
* 商品属性
*/
private String productProperty;
private String productForeignProperty;
/**
* 数据库字段(保存套餐商品是否为固定商品)
......
......@@ -1314,7 +1314,7 @@ public class OrderCenterSdkServiceImpl implements OrderCenterSdkService {
public OrderDetailResponse updateOrderItem(AssortmentSdkUpdateOrderProductInfoRequest updateOrderProductInfoRequest) {
QueryOrderByIdResponse queryOrderByIdResponse = null;
/**
* 若先清除再更新先清除现有订单商品信息
* 若先清除再更新 先清除现有订单商品信息
*/
if (AssortmentSdkUpdateOrderProductInfoRequest.OpUpdateOrderItemEnum.deleteAndUpdate == updateOrderProductInfoRequest.getOpUpdateOrderItemEnum()) {
this.orderSdkService.clearGroupOrder(this.orderSdkAdapter.convertAssortmentSdkUpdateOrderProductInfoRequestTo(updateOrderProductInfoRequest), updateOrderProductInfoRequest.getTrackingNo());
......
......@@ -40,7 +40,7 @@
<dependency>
<groupId>com.freemud.application.service.sdk</groupId>
<artifactId>productcenter-sdk</artifactId>
<version>3.7.6-SNAPSHOT</version>
<version>4.0.3.RELEASE</version>
<scope>provided</scope>
</dependency>
<dependency>
......@@ -57,7 +57,7 @@
</dependency>
<dependency>
<groupId>com.freemud.application.service.sdk</groupId>
<version>2.6.1-SNAPSHOT</version>
<version>3.2.8.RELEASE</version>
<artifactId>storecenter-sdk</artifactId>
<scope>provided</scope>
</dependency>
......
......@@ -40,6 +40,7 @@ import java.util.stream.Collectors;
public class ShoppingCartAdapter {
private static final String ATTRIBUTEID = "attributeId";
private static final String ATTRIBUTENAME = "attributeName";
private static final String ATTRIBUTEFOREIGNNAME = "attributeForeignName";
public GetProductInfoRequest convertGetProductInfoRequest(String partnerId, String storeId, List<String> goodsIds, String trackingNo) {
GetProductInfoRequest request = new GetProductInfoRequest();
......@@ -89,6 +90,7 @@ public class ShoppingCartAdapter {
ProductAttributeValueType productAttributeValueType = new ProductAttributeValueType();
productAttributeValueType.setAttributeId(cartGoodsExtra.getAttributeId());
productAttributeValueType.setAttributeValue(cartGoodsExtra.getAttributeName());
productAttributeValueType.setForeignAttributeValue(cartGoodsExtra.getAttributeForeignName());
attributeValueTypes.add(productAttributeValueType);
}
}
......@@ -280,8 +282,12 @@ public class ShoppingCartAdapter {
if(!"早餐啡常搭".equals(cartGoods.getName()) && !"早餐啡常搭".equals(cartGoods.getSkuName()) && !"早餐啡常搭".equals(cartGoods.getSpuName())
&& !"啡常搭".equals(cartGoods.getName()) && !"啡常搭".equals(cartGoods.getSkuName()) && !"啡常搭".equals(cartGoods.getSpuName())) {
cartGoods.setName(spuProduct.getName());
cartGoods.setForeignName(spuProduct.getForeignName());
cartGoods.setSpuName(spuProduct.getName());
cartGoods.setSpuForeignName(spuProduct.getForeignName());
cartGoods.setSkuName(isSkuProduct ? skuProduct.getProductName() : spuProduct.getName());
cartGoods.setSkuForeignName(isSkuProduct ? skuProduct.getForeignProductName() : spuProduct.getForeignName());
}
cartGoods.setSpecProductId(attributes.get(ATTRIBUTEID));
cartGoods.setPic(spuProduct.getPicture());
......@@ -292,17 +298,29 @@ public class ShoppingCartAdapter {
cartGoods.setMemberDiscount(spuProduct.getMemberDiscountResult());
cartGoods.setClassificationId(spuProduct.getCategory());
cartGoods.setClassificationName(spuProduct.getCategoryName());
cartGoods.setClassificationForeignName(spuProduct.getCategoryName());
cartGoods.setTax(spuProduct.getTax());
cartGoods.setTaxId(spuProduct.getTaxId());
String skuSpecName = "";
String skuForeignSpecName = "";
if (isSkuProduct && CollectionUtils.isNotEmpty(skuProduct.getSkuSpecValues())) {
List<String> skuSpecValus = skuProduct.getSkuSpecValues().stream().map(p -> p.getSpecValue()).collect(Collectors.toList());
skuSpecName = StringUtils.join(skuSpecValus, "/");
}
if (isSkuProduct && CollectionUtils.isNotEmpty(skuProduct.getSkuSpecValues())) {
List<String> skuSpecValus = skuProduct.getSkuSpecValues().stream().map(p -> p.getForeignSpecValue()).collect(Collectors.toList());
skuForeignSpecName = StringUtils.join(skuSpecValus, "/");
}
String attributeName = attributes.get(ATTRIBUTENAME) == null ? "" : attributes.get(ATTRIBUTENAME);
String attributeForeignName = attributes.get(ATTRIBUTEFOREIGNNAME) == null ? "" : attributes.get(ATTRIBUTEFOREIGNNAME);
//购物车小标题
cartGoods.setSubName(StringUtils.isNotEmpty(skuSpecName) && StringUtils.isNotEmpty(attributeName) ?
skuSpecName + "/" + attributeName : skuSpecName + attributeName);
//购物车英文小标题
cartGoods.setSubForeignName(StringUtils.isNotEmpty(skuForeignSpecName) && StringUtils.isNotEmpty(attributeForeignName) ?
skuForeignSpecName + "/" + attributeForeignName : skuForeignSpecName + attributeForeignName);
if (isSetMealProduct) {
if (CollectionUtils.isNotEmpty(cartGoods.getProductComboList())) {
......@@ -383,6 +401,7 @@ public class ShoppingCartAdapter {
CartGoods.MaterialGoods material = new CartGoods.MaterialGoods();
material.setQty(materialGoods.getQty());
material.setSpuName(detail.getProductName());
material.setSpuForeignName(detail.getForeignProductName());
material.setSpuId(detail.getProductId());
//行单价 \ 行总价
material.setFinalPrice(detail.getProductFinalPrice().longValue());
......@@ -479,9 +498,13 @@ public class ShoppingCartAdapter {
// 设置商品详情
Map<String, String> attributes = getAttributesNew(comboxGoods.getExtra());
comboxGoods.setName(isComboxGoods ? productComboType.getProductName() : groupDetailType.getProductName());
comboxGoods.setForeignName(isComboxGoods ? productComboType.getForeignProductName() : groupDetailType.getForeignProductName());
comboxGoods.setSpuName(comboxGoods.getName());
comboxGoods.setSpuForeignName(comboxGoods.getForeignName());
comboxGoods.setSpecProductId(attributes.get(ATTRIBUTEID));
comboxGoods.setSubName(attributes.get(ATTRIBUTENAME));
comboxGoods.setSubForeignName(attributes.get(ATTRIBUTEFOREIGNNAME));
comboxGoods.setPic(isComboxGoods ? productComboType.getPicture() : groupDetailType.getPicture());
comboxGoods.setOriginalPrice(isComboxGoods ? productComboType.getFinalPrice().longValue() : groupDetailType.getProductFinalPrice().longValue());
comboxGoods.setOriginalAmount(comboxGoods.getOriginalPrice() * comboxGoods.getQty());
......@@ -537,9 +560,11 @@ public class ShoppingCartAdapter {
}
List<String> attributeIds = extra.stream().map(CartGoods.CartGoodsExtra::getAttributeId).collect(Collectors.toList());
List<String> attributeNames = extra.stream().map(CartGoods.CartGoodsExtra::getAttributeName).collect(Collectors.toList());
List<String> attributeForeignNames = extra.stream().map(CartGoods.CartGoodsExtra::getAttributeForeignName).collect(Collectors.toList());
Map<String, String> result = new HashMap<>();
result.put(ATTRIBUTEID, StringUtils.join(attributeIds, "/"));
result.put(ATTRIBUTENAME, StringUtils.join(attributeNames, "/"));
result.put(ATTRIBUTEFOREIGNNAME, StringUtils.join(attributeForeignNames, "/"));
return result;
}
......
......@@ -73,11 +73,6 @@ public class CartGoods {
* 单位
*/
private String unit;
/**
* 商品券code
*/
private String couponCode;
/**
* 是否是月享卡商品
*/
......@@ -91,6 +86,10 @@ public class CartGoods {
*/
private int isSunnyCoupon;
/**
* 商品券code
*/
private String couponCode;
/**
* 商品券门槛金额
*/
private Long couponThresholdAmount;
......@@ -102,6 +101,12 @@ public class CartGoods {
* 商品券名称
*/
private String couponName;
/**
* 购物车商品券商品价格
*/
private Long couponProductPrice;
private String spuId;
private String skuId;
/**
......@@ -146,9 +151,18 @@ public class CartGoods {
private String name;
/**
* 购物车一行商品英文名称
*/
private String foreignName;
/**
* 商品的spuName
*/
private String spuName;
/**
* 商品的spuForeignName
*/
private String spuForeignName;
/**
* 商品的skuName
......@@ -156,10 +170,19 @@ public class CartGoods {
private String skuName;
/**
* skuForeignName
*/
private String skuForeignName;
/**
* 购物车一行商品的副名称
*/
private String subName;
/**
* 购物车一行商品的英文副名称
*/
private String subForeignName;
/**
* 商品图片URL
*/
private String pic;
......@@ -198,6 +221,7 @@ public class CartGoods {
* 统计分类名称
*/
private String classificationName;
private String classificationForeignName;
/**
* 是否限制库存
* 用于创建订单时,是否扣减库存
......@@ -252,6 +276,8 @@ public class CartGoods {
* 属性名
*/
private String attributeName;
private String attributeForeignName;
}
@Data
......@@ -265,6 +291,8 @@ public class CartGoods {
*/
private String attributeName;
private String attributeForeignName;
/**
* 麦咖啡特定属性入机code
*/
......@@ -297,6 +325,7 @@ public class CartGoods {
private String spuId;
private String skuId;
private String skuName;
private String skuForeignName;
/**
* 所有属性attributeId的拼接
*/
......@@ -337,15 +366,17 @@ public class CartGoods {
* 购物车一行商品的名称
*/
private String name;
private String foreignName;
/**
* 商品的spuName
*/
private String spuName;
private String spuForeignName;
/**
* 购物车一行商品的副名称
*/
private String subName;
private String subForeignName;
/**
* 商品图片URL
*/
......@@ -432,6 +463,7 @@ public class CartGoods {
* 加料名称
*/
private String spuName;
private String spuForeignName;
/**
* 购物车一行商品的现单价
*/
......
......@@ -46,12 +46,12 @@
<dependency>
<groupId>cn.freemud</groupId>
<artifactId>assortment-ordercenter-sdk</artifactId>
<version>2.1.38-RELEASE</version>
<version>2.1.39-RELEASE</version>
</dependency>
<dependency>
<groupId>com.freemud.application.service.sdk</groupId>
<artifactId>productcenter-sdk</artifactId>
<version>2.8.4-SNAPSHOT</version>
<version>4.0.3.RELEASE</version>
</dependency>
<dependency>
<artifactId>membercenter-sdk</artifactId>
......@@ -93,7 +93,7 @@
<!-- 商户门店sdk -->
<dependency>
<groupId>com.freemud.application.service.sdk</groupId>
<version>3.2.6.RELEASE</version>
<version>3.2.8.RELEASE</version>
<artifactId>storecenter-sdk</artifactId>
</dependency>
<dependency>
......@@ -125,7 +125,7 @@
<dependency>
<artifactId>assortment-data-manager</artifactId>
<groupId>com.freemud.sdk.api.assortment</groupId>
<version>5.2.7.RELEASE</version>
<version>5.4.4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>cn.freemud.commons</groupId>
......
......@@ -53,4 +53,26 @@ public class ShoppingCartAdapter {
}
return extraName.toString();
}
public String getForeignExtras(String skuNameEn, String attributeNamesEn) {
if (StringUtils.isBlank(skuNameEn)) {
skuNameEn = "";
}
if (StringUtils.isBlank(attributeNamesEn)) {
attributeNamesEn = "";
}
skuNameEn = skuNameEn.replace("|", "/") + "/" + attributeNamesEn;
String[] names = skuNameEn.split("/");
StringBuilder extraName = new StringBuilder("");
if (names.length >= 2) {
for (int i = 1; i < names.length; i++) {
if (i == names.length - 1) {
extraName.append(names[i]);
} else {
extraName.append(names[i]).append("/");
}
}
}
return extraName.toString();
}
}
......@@ -14,6 +14,8 @@ public class OrderProductAddInfo {
* 属性名称 多糖/冷/常温
*/
private String attributeNames;
private String attributeForeignNames;
/**
* 活动商品集合
*/
......
......@@ -32,6 +32,7 @@ public class ProductGroupDto {
private Long productFinalPrice;
private String productId;
private String productName;
private String productForeignName;
private Long productPrice;
private Integer sequence;
private Integer status;
......
......@@ -40,6 +40,8 @@ public class ProductListDto {
*/
private Long finalPrice;
private String name;
private String foreignName;
/**
* 原始价格 单位分
*/
......@@ -94,6 +96,7 @@ public class ProductListDto {
private Long finalPrice;
private Long originalPrice;
private String productName;
private String productForeignName;
private Integer productType;
private Integer sequence;
private String skuCode;
......@@ -109,6 +112,7 @@ public class ProductListDto {
private Integer sequence;
private String specId;
private String specName;
private String specForeignName;
private String specValue;
private String specValueId;
}
......@@ -121,6 +125,8 @@ public class ProductListDto {
private Integer sequence;
private String specId;
private String specName;
private String specForeignName;
private List<SpecificationGroupBean.SpecValueVo> specValueVos;
@NoArgsConstructor
......@@ -138,6 +144,8 @@ public class ProductListDto {
public static class ProductLabelNameListBean {
private String id;
private String name;
private String foreignName;
private String partnerId;
List<?> productList;
private String storeId;
......@@ -157,6 +165,8 @@ public class ProductListDto {
* 属性名称
*/
private String attributeName;
private String attributeForeignName;
/**
* 属性类型
*/
......
......@@ -14,6 +14,7 @@ public class StoreDeliveryInfoDto {
private String storeId;
private String storeName;
private String storeNameEn;
/**
* 门店是否可配送
*/
......
......@@ -30,6 +30,8 @@ public class AttributeValue {
private String attributeId;
private String attributeValue;
private String attributeForeignValue;
/**
* 属性ID
*/
......
......@@ -23,6 +23,7 @@ public class GroupDetail {
private Long productFinalPrice;
private String productId;
private String productName;
private String productForeignName;
private Long productPrice;
private Integer sequence;
private Integer status;
......
......@@ -29,6 +29,8 @@ public class ProductAttributeGroup {
* 属性名称
*/
private String attributeName;
private String attributeForeignName;
/**
* 属性类型
*/
......
......@@ -19,6 +19,7 @@ public class ActivityDiscountsDto {
private String activityCode;
private String activityName;
private String activityForeignName;
private Integer discountAmount;
private Integer activityType;
private Integer actualActivityGoodsNumber;
......
......@@ -121,10 +121,12 @@ public class ShoppingCartGoodsDto {
* 商品的名称
*/
private String spuName;
private String spuForeignName;
/**
* 如果是单品 skuName=spuName
*/
private String skuName;
private String skuForeignName;
/**
* 商品行原始价格
*/
......@@ -163,6 +165,7 @@ public class ShoppingCartGoodsDto {
* 1.6.0 版本增加 分类名
*/
private String categoryName;
private String categoryForeignName;
/**
* 套餐--父级商品Id
......@@ -191,6 +194,7 @@ public class ShoppingCartGoodsDto {
private String classificationId;
private String classificationName;
private String classificationForeignName;
/**
* 是否限制库存
* 用于创建订单时,是否扣减库存
......@@ -296,6 +300,7 @@ public class ShoppingCartGoodsDto {
* 属性名
*/
private String attributeName;
private String attributeForeignName;
/**
* 入机code
*/
......@@ -308,10 +313,12 @@ public class ShoppingCartGoodsDto {
*/
public String getAttributeNames() {
String extras = "";
String foreignExtras = "";
if (CollectionUtils.isNotEmpty(this.extraList)) {
extras = extraList.stream().map(CartGoodsDetailDto.CartGoodsExtra::getAttributeName).collect(Collectors.joining("/"));
foreignExtras = extraList.stream().map(CartGoodsDetailDto.CartGoodsExtra::getAttributeForeignName).collect(Collectors.joining("/"));
}
return JSON.toJSONString(OrderProductAddInfo.builder().attributeNames(extras).build());
return JSON.toJSONString(OrderProductAddInfo.builder().attributeNames(extras).attributeForeignNames(foreignExtras).build());
}
}
......
......@@ -66,6 +66,8 @@ public class CreateOrderVo {
private String storeName;
private String storeNameEn;
//入参不需要传
private String storeAddress;
......@@ -319,6 +321,8 @@ public class CreateOrderVo {
@NotNull(message = "商品名称不能为空")
private String skuName;
private String skuForeignName;
@NotNull(message = "商品数量不能为空")
private Integer qty;
......@@ -350,6 +354,9 @@ public class CreateOrderVo {
* 属性名称
*/
private String attributeValue;
private String attributeForeignValue;
}
}
......@@ -390,6 +397,9 @@ public class CreateOrderVo {
*/
private String goodsName;
private String goodsForeignName;
/**
* 赠送商品数量
*/
......
......@@ -40,4 +40,8 @@ public class PayGiftCouponVo {
* 折扣券的折扣率 例如8.8折
*/
private String benefitRebate;
/**
* 券log
*/
private String logo;
}
......@@ -39,12 +39,22 @@ public class ProductVo {
* 商品名称
*/
private String name;
/**
* 商品名称
*/
private String foreignName;
/**
* 商品spu名称
*/
private String spuName;
/**
* 商品spu名称
*/
private String spuForeignName;
/**
* 加购人ID
*/
private String userId;
......@@ -73,6 +83,9 @@ public class ProductVo {
* 商品的规格信息加属性信息
*/
private String extras;
private String foreignExtras;
/**
* 标准价格 精确到分
*/
......@@ -139,6 +152,11 @@ public class ProductVo {
* 属性名称 订单详情展示 V1.5.2版本增加
*/
private String attributeNames;
/**
* 属性名称英文
*/
private String attributeNamesEn;
/**
* 是否包含商品券 V1.5.2版本增加
*/
......
......@@ -37,6 +37,8 @@ public class QueryOrderResponseVo {
private String shopName;
private String shopNameEn;
private String shopAddress;
private String shopPhone;
......
......@@ -34,7 +34,7 @@ public class QueryOrderVo {
*/
private String oid;
/**
* 订单状态 enum queryOrderStatus 全部订单 1 待取餐 2 已完成 3 全部 4.退款,5 待支付 ,6 已取消 7未支付取消
* 订单状态 enum queryOrderStatus 全部订单 1 待取餐 2 已完成 3 全部 4.退款,5 待支付 ,6 已取消 7未支付取消 8待使用(美业)
*/
private Integer queryOrderStatus;
/**
......
......@@ -86,6 +86,8 @@ public class PreviewOrderInfoVo {
*/
private String shopName;
private String shopNameEn;
private List<PromotionMessageDto> promotionMessages;
/**
......
......@@ -22,6 +22,8 @@ public enum OrderChannelType {
SAASMALL("saasmall", "微商城"),
BEAUTIFUL("beautiful", "美业"),
APP("app", "APP");
private String code;
......
......@@ -22,7 +22,10 @@ public enum QueryOrderStatus {
NO_PAY(5, "待支付"),
ORDER_CANCEL(6, "已取消"),
//密雪
ORDER_CANCEL_MIXUE(7, "未支付已取消");
ORDER_CANCEL_MIXUE(7, "未支付已取消"),
// 美业专用
WAIT_USE(8, "待使用");
private Integer code;
......
......@@ -256,9 +256,10 @@ public class AppOrderServiceImpl implements AppOrderService {
if (!PayStatus.NOT_PAY.getCode().equals(orderBean.getPayStatus()) || !OrderStatus.WAIT_PAY.getCode().equals(orderBean.getStatus())) {
throw new ServiceException(ResponseResult.ORDER_STATUS_PRE_PAYMENT_NOT_SUPPORT);
}
//蜜雪sessionId不一致的跳过验证
OrderExtInfoDto extInfo = JSONObject.parseObject(orderBean.getExtInfo(), OrderExtInfoDto.class);
if (extInfo == null || StringUtils.isBlank(extInfo.getSessionId()) || !extInfo.getSessionId().equals(createPrepayVo.getSessionId())) {
// if (extInfo == null || StringUtils.isBlank(extInfo.getSessionId()) || !extInfo.getSessionId().equals(createPrepayVo.getSessionId())) {
if (extInfo == null || StringUtils.isBlank(extInfo.getSessionId())) {
throw new ServiceException(ResponseResult.ORDER_OWNER_ERROR);
}
}
......
......@@ -43,6 +43,7 @@ import com.freemud.api.assortment.datamanager.manager.AssortmentOpenPlatformIapp
import com.freemud.api.assortment.datamanager.manager.AssortmentOpenPlatformPartnerStoreDeliveryConfigManager;
import com.freemud.api.assortment.datamanager.manager.customer.AssortmentCustomerInfoManager;
import com.freemud.application.sdk.api.base.BaseResponse;
import com.freemud.application.sdk.api.log.ApiLog;
import com.freemud.application.sdk.api.log.LogThreadLocal;
import com.freemud.application.sdk.api.membercenter.request.QueryReceiveAddressRequest;
import com.freemud.application.sdk.api.membercenter.request.StatisticalPropertyRequest;
......@@ -204,6 +205,7 @@ public class CheckOrder {
createOrderVo.setStoreName(storeResponseDto.getStoreName());
createOrderVo.setStoreAddress(storeResponseDto.getAddress());
createOrderVo.setThirdShopId(storeResponseDto.getThirdPartCode());
createOrderVo.setStoreNameEn(storeResponseDto.getStoreNameEn());
return storeResponseDto;
}
......@@ -623,6 +625,8 @@ public class CheckOrder {
if (this.isCollageOrder(createOrderVo)) {
apportionResponse = shoppingCartClient.getCollageShoppingCartGoodsApportion(requestDto);
} else {
// log.info(JSONObject.toJSON(requestDto));
apportionResponse = shoppingCartClient.getShoppingCartGoodsApportionNew(requestDto);
}
......@@ -723,6 +727,7 @@ public class CheckOrder {
storeDeliveryInfoDto.setPartnerId(storeResponseDto.getPartnerId());
storeDeliveryInfoDto.setStoreId(storeResponseDto.getStoreCode());
storeDeliveryInfoDto.setStoreName(storeResponseDto.getStoreName());
storeDeliveryInfoDto.setStoreNameEn(storeResponseDto.getStoreNameEn());
// 查询外卖配送信息
AssortmentOpenPlatformPartnerStoreDeliveryConfig deliveryConfig = deliveryConfigManager.findByPartnerIdAndStoreCode(storeResponseDto.getPartnerId(),
storeResponseDto.getStoreCode());
......
......@@ -59,6 +59,7 @@ import com.freemud.sdk.api.assortment.order.response.order.QueryOrdersResponse;
import com.freemud.sdk.api.assortment.order.service.OrderCenterSdkService;
import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableMap;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils;
......@@ -82,6 +83,7 @@ import java.util.stream.Collectors;
* @Copyright: ${DATE.YARE} www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
@Slf4j
@Service
public class EncircleOrderServiceImpl implements EncircleOrderService {
......@@ -142,10 +144,14 @@ public class EncircleOrderServiceImpl implements EncircleOrderService {
storeTableListRequest.setStoreCode(createOrderVo.getShopId());
storeTableListRequest.setTableCode(assortmentCustomerInfoVo.getTableNumber());
com.freemud.application.sdk.api.base.BaseResponse<GetStoreTableResponse> storeTable = storeCenterService.getStoreTable(storeTableListRequest,LogThreadLocal.getTrackingNo());
//activeFlag 是否有效 0无效 1有效
//orderState 点餐状态 1开台 2清台
if(ObjectUtils.notEqual(ResponseResult.SUCCESS.getCode(),storeTable.getCode()) || storeTable.getData() == null) return ResponseUtil.error(ResponseResult.STORE_NOT_TABLE_INFO);
if(storeTable.getData().getActiveFlag() == 0) return ResponseUtil.error(ResponseResult.QUERY_TABLESTATUS_ACTIVEFLAG_ERROR);
if(storeTable.getData().getOrderState() == 1) return ResponseUtil.success();
if(storeTable.getData().getOrderState() == 1) {
log.info("门店返回1,已开台");
return ResponseUtil.success();
}
/**
* 尝试获取Redis锁 ==>获取锁失败直接提示用户有人正在开台或桌号已被占用
* 锁过期时间 24小时
......@@ -203,7 +209,7 @@ public class EncircleOrderServiceImpl implements EncircleOrderService {
throw e;
}finally {
//释放锁
RedisLock.getInstance(redisTemplate).unlock(orderCommonService.redisLockInfo(assortmentCustomerInfoVo,RedisCacheEnum.CREATERESERVEORDER_LOCKKEY_PREFIX));
redisTemplate.delete(orderCommonService.redisLockInfo(assortmentCustomerInfoVo,RedisCacheEnum.CREATERESERVEORDER_LOCKKEY_PREFIX));
}
/**
* 开台成功
......@@ -222,6 +228,7 @@ public class EncircleOrderServiceImpl implements EncircleOrderService {
groupCreateOrderRequest.setCompanyId(assortmentCustomerInfoVo.getPartnerId());
groupCreateOrderRequest.setShopId(assortmentCustomerInfoVo.getStoreId());
groupCreateOrderRequest.setShopName(storeResponseDto.getStoreName());
groupCreateOrderRequest.setShopNameEn(storeResponseDto.getStoreNameEn());
groupCreateOrderRequest.setBarCounter(assortmentCustomerInfoVo.getTableNumber());
groupCreateOrderRequest.setOrderClient(OrderClientType.WAI_MEAL.getIndex()); //默认围餐
//开台不存用户信息
......@@ -332,7 +339,7 @@ public class EncircleOrderServiceImpl implements EncircleOrderService {
throw new ServiceException(ResponseResult.UPDATE_ORDER_INFO_ERROR);
}finally {
//释放锁
RedisLock.getInstance(redisTemplate).unlock(orderCommonService.redisLockInfo(assortmentCustomerInfoVo,RedisCacheEnum.ORDER_PLUS_DISH_LOCKKEY_PREFIX));
redisTemplate.delete(orderCommonService.redisLockInfo(assortmentCustomerInfoVo,RedisCacheEnum.ORDER_PLUS_DISH_LOCKKEY_PREFIX));
try {
ShoppingCartBaseResponse cartBaseResponse = shoppingCartClient.clearShoppingCart(shoppingCartClearDto);
if(cartBaseResponse == null || ObjectUtils.notEqual(cartBaseResponse.getCode(),RESPONSE_SUCCESS_CODE)){
......@@ -579,7 +586,7 @@ public class EncircleOrderServiceImpl implements EncircleOrderService {
throw new ServiceException(ResponseResult.PAY_BACKEND_CONFIG_ERROR);
}finally {
//释放锁
RedisLock.getInstance(redisTemplate).unlock(orderCommonService.redisLockInfo(assortmentCustomerInfoVo,RedisCacheEnum.CREATE_PRE_PAYMENTORDER_LOCKKEY_PREFIX));
redisTemplate.delete(orderCommonService.redisLockInfo(assortmentCustomerInfoVo,RedisCacheEnum.CREATE_PRE_PAYMENTORDER_LOCKKEY_PREFIX));
if(orderResponseVo != null && Objects.equals(orderResponseVo.getPaySuccess(), false) && updateDiscountApportion) {
//记录订单支付状态,防止用户在唤起支付后继续下单,同时也防止重复进行促销计算
mealCacheManager.setOrderCreatePreParmentLock(assortmentCustomerInfoVo.getPartnerId(),assortmentCustomerInfoVo.getStoreId(),assortmentCustomerInfoVo.getTableNumber());
......
......@@ -932,14 +932,15 @@ public class OrderServiceImpl implements Orderservice {
Integer totalSumTime = 0;
String progress = "0" ; //进度
Integer orderProgressBarStatus = 2;
StoreResponse.Configuration configuration = storeResponseDto.getStoreConfig();
if(null != configuration) {
log.info("StoreResponse.Configuration {}", JSONObject.toJSONString(configuration));
String configurationStr = storeResponseDto.getConfiguration();
if(StringUtils.isNotEmpty(configurationStr)) {
try{
StoreResponse.Configuration configuration = JSONObject.parseObject(configurationStr).toJavaObject(StoreResponse.Configuration.class);
if (null != configuration) {
orderProgressBarStatus = configuration.getOrderProgressBarStatus();
; //默认关闭
//订单状态为已接单并且无售后单展示进度条
if (OrderStatus.RECEIPT.getCode() == orderBean.getStatus() && null == orderBean.getAfterSalesOrderResp() && null != orderProgressBarStatus && null != configuration.getTurnOnTimeOfMaking()) {
try {
// 查询订单的排队人数
QueryLineUpOrderReq queryLineUpOrderReq = new QueryLineUpOrderReq();
queryLineUpOrderReq.setPartnerId(orderBean.getCompanyId());
......@@ -948,7 +949,6 @@ public class OrderServiceImpl implements Orderservice {
queryLineUpOrderReq.setEndTime(orderBean.getGmtCreate());
// 取餐排队人数查询代码去除
QueryLineUpResponse response = orderCenterSdkService.queryLineUpOrder(queryLineUpOrderReq);
;
if (RESPONSE_SUCCESS_CODE.equals(response.getErrcode())) {
if (null == response.getOrderCodes()) {
progress = "100";
......@@ -975,10 +975,11 @@ public class OrderServiceImpl implements Orderservice {
}
}
}
} catch (Exception e) {
log.error("get returnWords error :{},StoreResponse.Configuration:{}", e.getMessage(), JSONObject.toJSONString(configuration));
}
}
}catch (Exception e){
log.error("get returnWords error :{},StoreResponse.Configuration:{}", e.getMessage(), configurationStr);
}
}
orderBean.setProgress(String.valueOf(progress));
orderBean.setReturnWords(returnWords);
......@@ -2724,6 +2725,12 @@ public class OrderServiceImpl implements Orderservice {
createOrderVo.setPayChannelType(PayChannelType.TIKTOKPAY.getIndex());
orderClient = OrderClientType.TIKTOKPAY;
}
// 美业
if (OrderChannelType.BEAUTIFUL.getCode().equals(createOrderVo.getChannelType())) {
orderClient = OrderClientType.BEAUTIFUL;
}
long totalAmount = 0;
int cardAmount = 0;
QueryOrdersResponse.DataBean.OrderBean fatherBeanListOne = new QueryOrdersResponse.DataBean.OrderBean();
......@@ -3581,6 +3588,8 @@ public class OrderServiceImpl implements Orderservice {
channelType = OrderChannelType.SAASMALL.getCode();
} else if (UserLoginChannelEnum.APP.getCode().equals(userLoginInfoDto.getChannel())) {
channelType = OrderChannelType.APP.getCode();
}else if(OrderChannelType.BEAUTIFUL.getCode().equals(queryOrderVo.getChannelType())){
channelType = OrderChannelType.BEAUTIFUL.getCode();
}
return channelType;
}
......@@ -4022,8 +4031,7 @@ public class OrderServiceImpl implements Orderservice {
private Boolean isQueryEs(Integer queryOrderStatus) {
if(ObjectUtils.equals(QueryOrderStatus.TAKE_MEAL.getCode(),queryOrderStatus) || ObjectUtils.equals(QueryOrderStatus.NO_PAY.getCode(),queryOrderStatus)
|| ObjectUtils.equals(QueryOrderStatus.REFUND_BILL.getCode(),queryOrderStatus)){
if(ObjectUtils.equals(QueryOrderStatus.TAKE_MEAL.getCode(),queryOrderStatus) || ObjectUtils.equals(QueryOrderStatus.NO_PAY.getCode(),queryOrderStatus)){
return Boolean.FALSE;
}
......
......@@ -8,7 +8,7 @@
<version>1.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<version>1.3.40.RELEASE</version>
<version>1.3.41.RELEASE</version>
<artifactId>ordercenter-sdk</artifactId>
<dependencies>
......
......@@ -72,3 +72,4 @@
| 1.3.38.RELEASE | 麦咖啡增加新的促销类型 | 徐康 | 2021-03-02 |
| 1.3.39.RELEASE | 订单满赠优惠 | 张志恒 | 2021-03-11 |
| 1.3.40.RELEASE | 外卖配送自动流转 | 李小二 | 2021-03-11 |
| 1.3.41.RELEASE | 美业 | 刘鹏飞 | 2021-03-12 |
\ No newline at end of file
......@@ -37,6 +37,7 @@ public enum OrderClientType {
DPZHCT(24, "美团点评智慧餐厅"),
FMWD(25, "非码微店"),
TIKTOKPAY(27, "抖音小程序"),
BEAUTIFUL(28, "美业"),
PARKING(99 , "农工商停车"),
;
......
......@@ -40,6 +40,9 @@ public class GroupCreateOrderRequest {
//门店名
private String storeName;
//英文门店名
private String storeNameEn;
//商户名
private String partnerName;
......
......@@ -22,4 +22,7 @@ public class OrderExtendedReq {
//渠道分组编号
private String orderClientGroupCode;
//订单门店英文名称
private String storeNameEn;
}
......@@ -39,6 +39,8 @@ public class CreateOrderRequest extends BaseRequest {
//门店名
private String storeName;
//门店名
private String storeNameEn;
//门店全局唯一编号
private String storeUnifyId;
......@@ -193,6 +195,7 @@ public class CreateOrderRequest extends BaseRequest {
//订单商品信息
List<OrderItemCreateReq> orderItemList;
//订单费用信息
List<OrderCostCreateReq> orderCostDetailList;
......
......@@ -45,6 +45,9 @@ public class OrderItemCreateReq {
//商品名称
private String productName;
/**商品英文名**/
private String productForeignName;
//商品序号
private Integer productSeq;
......@@ -54,6 +57,8 @@ public class OrderItemCreateReq {
//商品规格名称
private String productSpecName;
private String productForeignSpecName;
//商品UPC码
private String productUpc;
......@@ -81,6 +86,9 @@ public class OrderItemCreateReq {
//商品属性
private String productProperty;
//商品英文属性
private String productForeignProperty;
//重量
private Double weight;
......
......@@ -88,6 +88,9 @@ public class OrderInfoReqs {
//门店名
private String storeName;
//门店英文名
private String storeNameEn;
//门店全局唯一编号
private String storeUnifyId;
......
......@@ -46,6 +46,9 @@ public class OrderItemResp {
//商品名称
private String productName;
//商品英文名称
private String productForeignName;
//商品序号
private Integer productSeq;
......@@ -54,6 +57,9 @@ public class OrderItemResp {
//商品规格名称
private String productSpecName;
//商品规格英文名称
private String productForeignSpecName;
//商品UPC码
private String productUpc;
......@@ -82,6 +88,9 @@ public class OrderItemResp {
//商品属性
private String productProperty;
//商品属性
private String productForeignProperty;
//重量
private BigDecimal weight;
......
......@@ -705,6 +705,7 @@ public class OrderSdkService {
* @return
*/
public QueryByCodeResponse updateGroupOrder(GroupOrderUpdateReq groupOrderAffirmReq, String trackingNo){
log.info(JSONArray.toJSONString(groupOrderAffirmReq));
QueryByCodeResponse queryByCodeResponse = RequestThirdPartyUtils.httpJsonReqComplexNew(this.restTemplate, InterfaceAddressConstant.GROUP_UPDATEORDER, createBaseRequest(groupOrderAffirmReq, trackingNo), new ParameterizedTypeReference<QueryByCodeResponse>() {});
return queryByCodeResponse;
}
......
......@@ -35,7 +35,7 @@
<dependency>
<groupId>com.freemud.application.service.sdk</groupId>
<artifactId>productcenter-sdk</artifactId>
<version>3.7.6-SNAPSHOT</version>
<version>4.0.3.RELEASE</version>
</dependency>
<dependency>
<groupId>com.freemud.application.service.sdk</groupId>
......@@ -51,7 +51,7 @@
<dependency>
<groupId>cn.freemud</groupId>
<artifactId>ordercenter-sdk</artifactId>
<version>1.3.28.RELEASE</version>
<version>1.9.6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.freemud.application.service.sdk</groupId>
......@@ -61,11 +61,11 @@
<dependency>
<artifactId>assortment-data-manager</artifactId>
<groupId>com.freemud.sdk.api.assortment</groupId>
<version>4.6.8.RELEASE</version>
<version>5.4.4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.freemud.application.service.sdk</groupId>
<version>2.10.RELEASE</version>
<version>3.2.8.RELEASE</version>
<artifactId>storecenter-sdk</artifactId>
</dependency>
......
......@@ -553,6 +553,7 @@ public class CouponAdapter {
couponPromotionVO.setCouponCode(shoppingCartInfoRequestVo.getCouponCode());
couponPromotionVO.setOrderType(shoppingCartInfoRequestVo.getOrderType());
couponPromotionVO.setFlg(shoppingCartInfoRequestVo.getFlag());
couponPromotionVO.setUnChooseCouponCode(shoppingCartInfoRequestVo.getUnChooseCouponCode());
return couponPromotionVO;
}
}
......@@ -99,8 +99,10 @@ public class ShoppingCartConvertAdapter {
cartGoodsDetailDto.setTax(cartGoods.getTax());
cartGoodsDetailDto.setSpuId(cartGoods.getSpuId());
cartGoodsDetailDto.setSpuName(cartGoods.getSpuName());
cartGoodsDetailDto.setSpuForeignName(cartGoods.getSpuForeignName());
cartGoodsDetailDto.setSkuId(StringUtils.isEmpty(cartGoods.getSkuId()) ? cartGoods.getSpuId() : cartGoods.getSkuId());
cartGoodsDetailDto.setSkuName(StringUtils.isEmpty(cartGoods.getSkuName()) ? cartGoods.getSpuName() : cartGoods.getSkuName());
cartGoodsDetailDto.setSkuForeignName(StringUtils.isEmpty(cartGoods.getSkuForeignName()) ? cartGoods.getSpuForeignName() : cartGoods.getSkuForeignName());
cartGoodsDetailDto.setOriginalPrice(cartGoods.getOriginalPrice());
// cartGoodsDetailDto.setTotalDiscountAmount(0);
cartGoodsDetailDto.setUserId(cartGoods.getUserId());
......@@ -140,6 +142,7 @@ public class ShoppingCartConvertAdapter {
ShoppingCartGoodsDto.CartGoodsDetailDto.MaterialGoods goods = new ShoppingCartGoodsDto.CartGoodsDetailDto.MaterialGoods();
goods.setSpuId(materialGoods.getSpuId());
goods.setSpuName(materialGoods.getSpuName());
goods.setSpuForeignName(materialGoods.getSpuForeignName());
goods.setOriginalPrice(materialGoods.getOriginalPrice());
goods.setSalePrice(materialGoods.getFinalPrice());
goods.setCustomerCode(materialGoods.getCustomerCode());
......
......@@ -90,6 +90,10 @@ public class ActivityCalculationDiscountResponseDto {
*/
private Map<String, CheckSpqInfoResponseDto> validCouponMap;
/**
* 校验后有效的spqid对应的uuid
*/
private Map<String, List<String>> spqIdToCartUuid;
/**
* 扣减库存
*/
private List<SubtractStockVO> stocks;
......
......@@ -10,7 +10,9 @@ public class CheckSpqInfoResponseDto {
private String spuId;
private String skuId;
private String spuName;
private String spuForeignName;
private String skuName;
private String skuForeignName;
/**
* 活动名称
*/
......@@ -32,6 +34,7 @@ public class CheckSpqInfoResponseDto {
private String picture;
private String defaultSpecId;
private String defaultSpecName;
private String defaultForeignSpecName;
/**
* 券商品类型 : 0 -> 商品券,4,换购券
*/
......
......@@ -129,6 +129,12 @@ public class GetMemberCouponListResponseDto {
* 商品信息(商品id)
*/
private List<String> activeProducts;
/**
* 券图片地址
*/
private String logo;
}
}
......
......@@ -143,6 +143,7 @@ public class GetMenuResponseDto {
*/
private Integer isSkuProduct;
private String name;
private String foreignName;
/**
* 原始价格 单位分
*/
......@@ -200,6 +201,7 @@ public class GetMenuResponseDto {
private Long finalPrice;
private Long originalPrice;
private String productName;
private String foreignProductName;
private Integer productType;
private Integer sequence;
private String skuCode;
......@@ -220,7 +222,9 @@ public class GetMenuResponseDto {
private Integer sequence;
private String specId;
private String specName;
private String foreignSpecName;
private String specValue;
private String foreignSpecValue;
private String specValueId;
}
}
......@@ -232,6 +236,7 @@ public class GetMenuResponseDto {
private Integer sequence;
private String specId;
private String specName;
private String foreignSpecName;
private List<SpecValueVo> specValueVos;
@NoArgsConstructor
......@@ -240,6 +245,7 @@ public class GetMenuResponseDto {
private Integer sequence;
private String specId;
private String specValue;
private String foreignSpecValue;
private String specValueId;
}
}
......@@ -249,6 +255,7 @@ public class GetMenuResponseDto {
public static class ProductLabelNameListBean {
private String id;
private String name;
private String foreignName;
private String partnerId;
List<?> productList;
private String storeId;
......@@ -268,6 +275,10 @@ public class GetMenuResponseDto {
* 属性名称
*/
private String attributeName;
private String foreignAttributeName;
/**
* 属性类型
*/
......@@ -293,6 +304,8 @@ public class GetMenuResponseDto {
private String attributeId;
private String attributeValue;
private String foreignAttributeValue;
/**
* 属性ID
*/
......
......@@ -11,6 +11,8 @@ public class OrderProductAddInfo {
* 属性名称 多糖/冷/常温
*/
private String attributeNames;
private String attributeForeignNames;
/**
* 活动商品集合
*/
......
......@@ -88,6 +88,11 @@ public class CalculationSharingDiscountResponseDto {
*/
private Map<String, CheckSpqInfoResponseDto> validCouponMap;
/**
* 校验后有效的spqid对应的uuid
*/
private Map<String, List<String>> spqIdToCartUuid;
/**
* 扣减库存
*/
private List<SubtractStockVO> stocks;
......
......@@ -158,10 +158,13 @@ public class ShoppingCartGoodsDto {
* 商品的名称
*/
private String spuName;
private String spuForeignName;
/**
* 如果是单品 skuName=spuName
*/
private String skuName;
private String skuForeignName;
/**
* 商品行原始价格(单价)
*/
......@@ -291,6 +294,7 @@ public class ShoppingCartGoodsDto {
*/
private String classificationName;
/**
* 税率代码
*/
......@@ -331,6 +335,7 @@ public class ShoppingCartGoodsDto {
* 属性名
*/
private String attributeName;
private String attributeForeignName;
}
@Data
......@@ -340,6 +345,7 @@ public class ShoppingCartGoodsDto {
*/
private String spuId;
private String spuName;
private String spuForeignName;
/**
* 商品行记录:当前元售价
*/
......@@ -371,10 +377,13 @@ public class ShoppingCartGoodsDto {
*/
public String getAttributeNames() {
String extras = "";
String foreignExtras = "";
if (CollectionUtils.isNotEmpty(this.extraList)) {
extras = extraList.stream().map(CartGoodsDetailDto.CartGoodsExtra::getAttributeName).collect(Collectors.joining("/"));
foreignExtras = extraList.stream().map(CartGoodsDetailDto.CartGoodsExtra::getAttributeForeignName).collect(Collectors.joining("/"));
}
return JSON.toJSONString(OrderProductAddInfo.builder().attributeNames(extras).build());
return JSON.toJSONString(OrderProductAddInfo.builder().attributeNames(extras).attributeForeignNames(foreignExtras).build());
}
}
......
......@@ -54,6 +54,12 @@ public class ActivityCouponBean {
* 0-商品券 1-代金券 3-折扣券
*/
private Integer couponType;
/**
* 券图片地址
*/
private String couponPic;
/**
* 日期描述
*/
......
......@@ -141,19 +141,37 @@ public class CartGoods {
private String name;
/**
* 购物车一行商品英文名称
*/
private String foreignName;
/**
* 商品的spuName
*/
private String spuName;
/**
* 商品的spuForeignName
*/
private String spuForeignName;
/**
* 商品的skuName
*/
private String skuName;
/**
* skuForeignName
*/
private String skuForeignName;
/**
* 购物车一行商品的副名称
*/
private String subName;
/**
* 购物车一行商品的英文副名称
*/
private String subForeignName;
/**
* 商品图片URL
*/
......@@ -276,6 +294,7 @@ public class CartGoods {
*/
private String attributeName;
private String attributeForeignName;
}
@Data
......@@ -288,6 +307,8 @@ public class CartGoods {
* 属性名
*/
private String attributeName;
private String attributeForeignName;
/**
* 麦咖啡特定属性入机code
......@@ -304,6 +325,7 @@ public class CartGoods {
private String spuId;
private String skuId;
private String skuName;
private String skuForeignName;
/**
* 所有属性attributeId的拼接
*/
......@@ -346,14 +368,18 @@ public class CartGoods {
*/
private String name;
private String foreignName;
/**
* 商品的spuName
*/
private String spuName;
private String spuForeignName;
/**
* 购物车一行商品的副名称
*/
private String subName;
private String subForeignName;
/**
* 商品图片URL
*/
......@@ -576,6 +602,8 @@ public class CartGoods {
* 加料名称
*/
private String spuName;
private String spuForeignName;
/**
* 购物车一行商品的原单价
*/
......
......@@ -22,4 +22,5 @@ public class CouponPromotionVO {
private String couponCode;
private Integer flg;
private Integer orderType;
private String unChooseCouponCode;
}
......@@ -61,6 +61,11 @@ public class ShoppingCartInfoRequestVo extends BaseRequestVo {
private String couponCode;
/**
* 取消选择的商品券
*/
private String unChooseCouponCode;
/**
* 优惠券code列表
*/
private List<couponCode> couponCodes;
......
......@@ -80,7 +80,7 @@ public interface CouponService {
* @param cartGoods
* @return
*/
ActivityClassifyCouponBean availableCoupon(List<CartGoods> cartGoods, String partnerId, String userId, String storeId, String couponCode, boolean hasGoodsCoupon, Integer orderType, int isNew,String appId,String MenuType);
ActivityClassifyCouponBean availableCoupon(List<CartGoods> cartGoods, String partnerId, String userId, String storeId, String couponCode, boolean hasGoodsCoupon, Integer orderType, int isNew,String appId,String MenuType, String unChooseCouponCode);
/**
* 获取卡券服务商户密钥
......@@ -102,6 +102,11 @@ public interface CouponService {
CheckSpqInfoResponseDto checkSpqInfo(CheckSpqInfoRequestDto requestDto, String goodsId);
GetProductsVo getSpqProductInfo(CheckSpqInfoRequestDto requestDto);
GetProductsVo getSpqProductInfo(CheckSpqInfoRequestDto requestDto, String goodsId);
/**
* 领券
*
......
......@@ -10,11 +10,15 @@ import cn.freemud.entities.vo.ShoppingCartGoodsBaseResponseVo;
import cn.freemud.enums.ResponseResult;
import cn.freemud.interceptor.ServiceException;
import cn.freemud.service.thirdparty.StoreItemClient;
import cn.freemud.service.thirdparty.StoreItemClient;
import cn.freemud.utils.LogUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.freemud.application.sdk.api.base.SDKCommonBaseContextWare;
import com.freemud.application.sdk.api.constant.ResponseResultEnum;
import com.freemud.application.sdk.api.log.ApiLog;
import com.freemud.application.sdk.api.log.ApiLog;
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;
......@@ -27,6 +31,8 @@ import com.freemud.sdk.api.assortment.shoppingcart.service.impl.ShoppingCartBase
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import cn.freemud.entities.dto.GetMenuResponseDto.DataBean.RootNodeBean.ChildrenBeanFirst.ChildrenBeanSecond.ProductBean;
......
......@@ -13,6 +13,7 @@ import cn.freemud.enums.*;
import cn.freemud.service.CouponService;
import cn.freemud.service.IPromotionService;
import com.freemud.sdk.api.assortment.shoppingcart.constant.CommonsConstant;
import com.freemud.sdk.api.assortment.shoppingcart.service.impl.ShoppingCartBaseServiceImpl;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
......@@ -42,14 +43,29 @@ public class CouponPromotionService implements IPromotionService {
@Autowired
private CouponService couponService;
@Autowired
private AssortmentSdkService assortmentSdkService;
@Autowired
private ShoppingCartBaseServiceImpl shoppingCartBaseService;
@Override
public void updateShoppingCartGoodsDiscount(CouponPromotionVO couponPromotionVO, ActivityQueryDto activityQueryDto, ActivityCalculationDiscountResponseDto.CalculationDiscountResult calculationDiscountResult, List<CartGoods> cartGoodsList, ShoppingCartGoodsResponseVo shoppingCartGoodsResponseVo, UserLoginInfoDto userLoginInfoDto, ShoppingCartInfoRequestVo shoppingCartInfoRequestVo) {
public void updateShoppingCartGoodsDiscount(CouponPromotionVO couponPromotionVO, ActivityQueryDto activityQueryDto,
ActivityCalculationDiscountResponseDto.CalculationDiscountResult calculationDiscountResult, List<CartGoods> cartGoodsList,
ShoppingCartGoodsResponseVo shoppingCartGoodsResponseVo, UserLoginInfoDto userLoginInfoDto,
ShoppingCartInfoRequestVo shoppingCartInfoRequestVo) {
// 用户选择了查询优惠券信息
if (couponPromotionVO != null && ObjectUtils.equals(CouponFlag.YES.getCode(), couponPromotionVO.getFlg())) {
List<CartGoods> tmpCartGoods = cartGoodsList.parallelStream().filter(k -> (k.getCartGoodsUid()
.startsWith(CommonsConstant.COUPON_PREFIX) || StringUtils.isNotBlank(k.getCouponCode()))).collect(Collectors.toList());
// 是否存在商品券
String chooseCouponCode = "";
boolean hasGoodssCoupon = CollectionUtils.isNotEmpty(tmpCartGoods);
if (StringUtils.isBlank(couponPromotionVO.getUnChooseCouponCode()) && hasGoodssCoupon){
chooseCouponCode = tmpCartGoods.get(0).getGoodsId().substring(CommonsConstant.COUPON_PREFIX.length());
} else {
chooseCouponCode = couponPromotionVO.getUnChooseCouponCode();
}
// 构建可用不可用优惠券
ActivityClassifyCouponBean activityClassifyCouponBean = couponService.availableCoupon(cartGoodsList,
couponPromotionVO.getPartnerId(),
......@@ -59,7 +75,7 @@ public class CouponPromotionService implements IPromotionService {
hasGoodssCoupon,
couponPromotionVO.getOrderType(),
0,
shoppingCartInfoRequestVo.getAppId(),shoppingCartInfoRequestVo.getMenuType() );
shoppingCartInfoRequestVo.getAppId(),shoppingCartInfoRequestVo.getMenuType(), chooseCouponCode);
if (Objects.equals(activityClassifyCouponBean, null)) {
// 构建一个空得订单券信息
activityClassifyCouponBean = createEmptyActivityCouponBean();
......@@ -83,6 +99,28 @@ public class CouponPromotionService implements IPromotionService {
}
}
shoppingCartGoodsResponseVo.setCouponDiscount(couponDiscount);
Map<String, CheckSpqInfoResponseDto> validCouponMap = calculationDiscountResult == null ? new HashMap<>() : calculationDiscountResult.getValidCouponMap();
Map<String, List<String>> spqIdToCartUuid = calculationDiscountResult == null ? new HashMap<>() : calculationDiscountResult.getSpqIdToCartUuid();
if (MapUtils.isNotEmpty(validCouponMap) && MapUtils.isNotEmpty(spqIdToCartUuid) && calculationDiscountResult != null){
List<String> activityCodeList = calculationDiscountResult.getCouponDiscounts().stream().map(p -> p.getCouponCode()).collect(Collectors.toList());
for (String spqId : validCouponMap.keySet()) {
CheckSpqInfoResponseDto sqpInfo = validCouponMap.get(spqId);
if (!activityCodeList.contains(sqpInfo.getCouponCode())){ // 表示商品券不够启用金额
List<String> uuidList = spqIdToCartUuid.get(sqpInfo.getCouponCode());
if (CollectionUtils.isNotEmpty(uuidList)){
List<CartGoods> newCartList = cartGoodsList.stream().filter(p -> !uuidList.contains(p.getCartGoodsUid())).collect(Collectors.toList());
assortmentSdkService.setShoppingCart(activityQueryDto.getPartnerId(), activityQueryDto.getStoreId(), userLoginInfoDto.getMemberId(), newCartList, null, null, this.shoppingCartBaseService);
cartGoodsList = newCartList;
CheckSpqInfoResponseDto checkSpqInfoResponseDto = validCouponMap.get(spqId);
shoppingCartGoodsResponseVo.setChanged(true);
shoppingCartGoodsResponseVo.setToastMsg("当前购物车金额低于【" + checkSpqInfoResponseDto.getCouponName() + "】优惠券起用金额门槛,券已自动移除购物车");
}
}
}
}
//循环购物车商品券
for (CartGoods cartGoods : cartGoodsList) {
String couponCode = cartGoods.getCouponCode();
......@@ -93,7 +131,6 @@ public class CouponPromotionService implements IPromotionService {
}
if (StringUtils.isNotBlank(couponCode)) {
// 计算优惠信息时,已将券校验过,放在map中
Map<String, CheckSpqInfoResponseDto> validCouponMap = calculationDiscountResult == null ? new HashMap<>() : calculationDiscountResult.getValidCouponMap();
if (MapUtils.isNotEmpty(validCouponMap)) {
CheckSpqInfoResponseDto checkSpqInfoResponseDto = null;
if(useCoupon){
......
......@@ -349,8 +349,11 @@ public class CalculationCommonService {
cartGoodsDetailDto.setTax(cartGoods.getTax());
cartGoodsDetailDto.setSpuId(cartGoods.getSpuId());
cartGoodsDetailDto.setSpuName(cartGoods.getSpuName());
cartGoodsDetailDto.setSpuForeignName(cartGoods.getSpuForeignName());
cartGoodsDetailDto.setSkuId(StringUtils.isEmpty(cartGoods.getSkuId()) ? cartGoods.getSpuId() : cartGoods.getSkuId());
cartGoodsDetailDto.setSkuName(StringUtils.isEmpty(cartGoods.getSkuName()) ? cartGoods.getSpuName() : cartGoods.getSkuName());
cartGoodsDetailDto.setSkuForeignName(StringUtils.isEmpty(cartGoods.getSkuForeignName()) ? cartGoods.getSpuForeignName() : cartGoods.getSkuForeignName());
cartGoodsDetailDto.setOriginalPrice(cartGoods.getOriginalPrice());
cartGoodsDetailDto.setSalePrice(cartGoods.getOriginalPrice());
cartGoodsDetailDto.setPicture(cartGoods.getPic());
......@@ -410,6 +413,7 @@ public class CalculationCommonService {
ShoppingCartGoodsDto.CartGoodsDetailDto.MaterialGoods goods = new ShoppingCartGoodsDto.CartGoodsDetailDto.MaterialGoods();
goods.setSpuId(mg.getSpuId());
goods.setSpuName(mg.getSpuName());
goods.setSpuForeignName(mg.getSpuForeignName());
goods.setSalePrice(mg.getFinalPrice());
goods.setQty(mg.getQty());
goods.setCustomerCode(cartGoods.getCustomerCode());
......@@ -488,8 +492,11 @@ public class CalculationCommonService {
ShoppingCartGoodsDto.CartGoodsDetailDto com = new ShoppingCartGoodsDto.CartGoodsDetailDto();
com.setSpuId(comb.getGoodsId());
com.setSpuName(comb.getSpuName());
com.setSpuForeignName(comb.getSpuForeignName());
com.setSkuId(comb.getGoodsId());
com.setSkuName(StringUtils.isEmpty(comb.getSkuName()) ? com.getSpuName() : com.getSkuName());
com.setSkuForeignName(StringUtils.isEmpty(comb.getSkuForeignName()) ? com.getSpuForeignName() : com.getSkuForeignName());
com.setPicture(comb.getPic());
com.setProductType(comb.isWeightType() ? ProductType.WEIGHT_PRODUCT.getCode() : ProductType.SETMEAL.getCode());
com.setParentProductId(cartGoods.getGoodsId());
......
......@@ -68,7 +68,9 @@ public class CalculationSharingCartService {
, Long deliveryAmount
, String opt
, String partnerId
, Integer flag) {
, Integer flag
, String userId
, String storeId) {
/**
* 用促销价格初始化购物车行记录成交价
......@@ -78,7 +80,7 @@ public class CalculationSharingCartService {
/**
* 可用券及券折扣
*/
promotionSharingService.updateShoppingCartGoodsDiscount(discountResult, cartGoodsList, shoppingCartGoodsResponseVo, couponPromotionVO,shoppingCartInfoRequestVo);
promotionSharingService.updateShoppingCartGoodsDiscount(discountResult, cartGoodsList, shoppingCartGoodsResponseVo, couponPromotionVO,shoppingCartInfoRequestVo, userId, partnerId, storeId);
/**
* 满减处理
......
......@@ -8,6 +8,7 @@ import cn.freemud.entities.dto.calculate.CalculationSharingDiscountRequestDto;
import cn.freemud.entities.dto.calculate.CalculationSharingDiscountResponseDto;
import cn.freemud.entities.dto.shoppingCart.SendPoint;
import cn.freemud.entities.vo.CartGoods;
import cn.freemud.entities.vo.ShoppingCartGoodsResponseVo;
import cn.freemud.entities.vo.ShoppingCartInfoRequestVo;
import cn.freemud.enums.*;
import cn.freemud.interceptor.BizServiceException;
......@@ -30,10 +31,7 @@ import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
/**
......@@ -82,6 +80,7 @@ public class CalculationSharingDiscountService {
HashMap<String, CheckSpqInfoResponseDto> validCouponMap = new HashMap<>(16);
List<CalculationSharingDiscountRequestDto.CalculationDiscountGoods> calculationDiscountGoodsList = new ArrayList<>();
int cartSize = cartGoodsList.size() - 1;
HashMap<String, List<String>> spqIdToCartUuid = new HashMap<>(16);
for (int i = cartSize; i >= 0; i--) {
CartGoods cartGoods = cartGoodsList.get(i);
if (StringUtils.isBlank(cartGoods.getCouponCode()) && !cartGoods.getCartGoodsUid().startsWith(CommonsConstant.COUPON_PREFIX)) {//非商品券
......@@ -113,6 +112,16 @@ public class CalculationSharingDiscountService {
} else{
validCouponMap.put(couponCode, checkSpqInfo);
}
if (spqIdToCartUuid.containsKey(couponCode)){
List<String> uuidList = spqIdToCartUuid.get(couponCode);
uuidList.add(cartGoods.getCartGoodsUid());
spqIdToCartUuid.put(couponCode, uuidList);
} else {
List<String> uuidList = new ArrayList<>();
uuidList.add(cartGoods.getCartGoodsUid());
spqIdToCartUuid.put(couponCode, uuidList);
}
validCouponMap.put(couponCode, checkSpqInfo);
cartGoods.setName(checkSpqInfo.getCouponName());
cartGoods.setSpuName(checkSpqInfo.getCouponName());
cartGoods.setStockLimit(checkSpqInfo.isStockLimit());
......@@ -205,6 +214,7 @@ public class CalculationSharingDiscountService {
convert2SendPoint(result, discountDTO);
}
result.setValidCouponMap(validCouponMap);
result.setSpqIdToCartUuid(spqIdToCartUuid);
result.setDeliveryAmount(deliveryAmount);
result.setDistributionFee(result.getDistributionFee());
return result;
......
......@@ -9,7 +9,9 @@ import cn.freemud.entities.vo.*;
import cn.freemud.enums.CouponFlag;
import cn.freemud.enums.GoodsTypeEnum;
import cn.freemud.service.CouponService;
import cn.freemud.service.impl.AssortmentSdkService;
import com.freemud.sdk.api.assortment.shoppingcart.constant.CommonsConstant;
import com.freemud.sdk.api.assortment.shoppingcart.service.impl.ShoppingCartBaseServiceImpl;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
......@@ -38,17 +40,28 @@ public class CouponSharingService {
@Autowired
private CouponService couponService;
@Autowired
private AssortmentSdkService assortmentSdkService;
@Autowired
private ShoppingCartBaseServiceImpl shoppingCartBaseService;
public void updateShoppingCartGoodsDiscount(CalculationSharingDiscountResponseDto.CalculationDiscountResult calculationDiscountResult
, List<CartGoods> cartGoodsList
, ShoppingCartGoodsResponseVo shoppingCartGoodsResponseVo
, CouponPromotionVO couponPromotionVO
,ShoppingCartInfoRequestVo shoppingCartInfoRequestVo) {
,ShoppingCartInfoRequestVo shoppingCartInfoRequestVo, String userId, String partnerId, String storeId) {
// 用户选择了查询优惠券信息
if (couponPromotionVO != null && ObjectUtils.equals(CouponFlag.YES.getCode(), couponPromotionVO.getFlg())) {
List<CartGoods> tmpCartGoods = cartGoodsList.parallelStream().filter(k -> (StringUtils.isNotBlank(k.getCouponCode()) || k.getCartGoodsUid()
.startsWith(CommonsConstant.COUPON_PREFIX))).collect(Collectors.toList());
// 是否存在商品券
boolean hasGoodssCoupon = CollectionUtils.isNotEmpty(tmpCartGoods);
String chooseCouponCode = "";
if (StringUtils.isBlank(couponPromotionVO.getUnChooseCouponCode()) && hasGoodssCoupon){
chooseCouponCode = tmpCartGoods.get(0).getGoodsId().substring(CommonsConstant.COUPON_PREFIX.length());
}
// 构建可用不可用优惠券
ActivityClassifyCouponBean activityClassifyCouponBean = couponService.availableCoupon(cartGoodsList
, couponPromotionVO.getPartnerId()
......@@ -60,6 +73,7 @@ public class CouponSharingService {
, 1
, shoppingCartInfoRequestVo.getAppId()
, shoppingCartInfoRequestVo.getMenuType()
, chooseCouponCode
);
if (Objects.equals(activityClassifyCouponBean, null)) {
// 构建一个空得订单券信息
......@@ -83,6 +97,27 @@ public class CouponSharingService {
if (first!=null) couponDiscount = first.getDiscount().longValue();
}
shoppingCartGoodsResponseVo.setCouponDiscount(couponDiscount);
Map<String, CheckSpqInfoResponseDto> validCouponMap = calculationDiscountResult == null ? new HashMap<>() : calculationDiscountResult.getValidCouponMap();
Map<String, List<String>> spqIdToCartUuid = calculationDiscountResult == null ? new HashMap<>() : calculationDiscountResult.getSpqIdToCartUuid();
if (MapUtils.isNotEmpty(validCouponMap) && MapUtils.isNotEmpty(spqIdToCartUuid) && calculationDiscountResult != null){
List<String> activityCodeList = calculationDiscountResult.getDiscounts().stream().map(p -> p.getActivityCode()).collect(Collectors.toList());
for (String spqId : validCouponMap.keySet()) {
CheckSpqInfoResponseDto sqpInfo = validCouponMap.get(spqId);
if (!activityCodeList.contains(sqpInfo.getCouponCode())){ // 表示商品券不够启用金额
List<String> uuidList = spqIdToCartUuid.get(sqpInfo.getCouponCode());
if (CollectionUtils.isNotEmpty(uuidList)){
List<CartGoods> newCartList = cartGoodsList.stream().filter(p -> !uuidList.contains(p.getCartGoodsUid())).collect(Collectors.toList());
assortmentSdkService.setShoppingCart(partnerId, storeId, userId, newCartList, null, null, this.shoppingCartBaseService);
cartGoodsList = newCartList;
CheckSpqInfoResponseDto checkSpqInfoResponseDto = validCouponMap.get(spqId);
shoppingCartGoodsResponseVo.setChanged(true);
shoppingCartGoodsResponseVo.setToastMsg("当前购物车金额低于【" + checkSpqInfoResponseDto.getCouponName() + "】优惠券起用金额门槛,券已自动移除购物车");
}
}
}
}
//循环购物车商品券
for (CartGoods cartGoods : cartGoodsList) {
if (StringUtils.isNotBlank(cartGoods.getCouponCode()) || cartGoods.getCartGoodsUid().startsWith(CommonsConstant.COUPON_PREFIX)) {
......@@ -93,7 +128,6 @@ public class CouponSharingService {
useCoupon = false;
}
// 计算优惠信息时,已将券校验过,放在map中
Map<String, CheckSpqInfoResponseDto> validCouponMap = calculationDiscountResult == null ? new HashMap<>() : calculationDiscountResult.getValidCouponMap();
if (MapUtils.isNotEmpty(validCouponMap)) {
CheckSpqInfoResponseDto checkSpqInfoResponseDto;
if(useCoupon){
......@@ -161,8 +195,10 @@ public class CouponSharingService {
cartGoods.setQty(cartGoods.getQty());
cartGoods.setCouponCode(checkSpqInfoResponseDto.getCouponCode());
cartGoods.setSpuName(checkSpqInfoResponseDto.getSpuName());
cartGoods.setSpuForeignName(checkSpqInfoResponseDto.getSpuForeignName());
cartGoods.setSpecProductId(checkSpqInfoResponseDto.getDefaultSpecId());
cartGoods.setSubName(checkSpqInfoResponseDto.getDefaultSpecName());
cartGoods.setSubForeignName(checkSpqInfoResponseDto.getDefaultForeignSpecName());
cartGoods.setExtra(checkSpqInfoResponseDto.getExtras());
if (GoodsTypeEnum.HG_COUPON_GOODS.getGoodsType().equals(cartGoods.getGoodsType())) {
CalculationSharingDiscountResponseDto.CalculationDiscountResult.Goods discountGoods = discountResult.getGoods()
......
......@@ -133,7 +133,7 @@ public class CouponServiceTest {
List<CartGoods> cartGoods = Lists.newArrayList();
CartGoods cartGood = new CartGoods();
cartGoods.add(cartGood);
ActivityClassifyCouponBean activityClassifyCouponBean = couponService.availableCoupon(cartGoods, "1864", "122424124", "1011", "88123124", true, 1, 1, "","");
ActivityClassifyCouponBean activityClassifyCouponBean = couponService.availableCoupon(cartGoods, "1864", "122424124", "1011", "88123124", true, 1, 1, "","", "");
assertTrue(activityClassifyCouponBean.getCouponNum() >= 1);
}
......
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