Commit a08694cc by 徐康

Merge branch 'feature/20201209_xukang_麦咖啡p4v2' into develop

# Conflicts:
#	shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/ShoppingCartMCoffeeServiceImpl.java
parents 7e6a3fe8 4687f2c3
...@@ -2098,15 +2098,16 @@ public class OrderAdapter { ...@@ -2098,15 +2098,16 @@ public class OrderAdapter {
discountTotalAmount = discountTotalAmount + productDiscount.getDiscountAmount()*productDiscount.getDiscountQty(); discountTotalAmount = discountTotalAmount + productDiscount.getDiscountAmount()*productDiscount.getDiscountQty();
if (OrderAccountType.PRODUCT_COUPON.getCode().equals(productDiscount.getDiscountType())) { if (OrderAccountType.PRODUCT_COUPON.getCode().equals(productDiscount.getDiscountType())) {
hasProductCoupon = true; hasProductCoupon = true;
Integer extendType = StringUtils.isBlank(productDiscount.getAddInfo())?null:JSON.parseObject(productDiscount.getAddInfo()).getInteger("extendType"); productVo.setCouponName(productDiscount.getDiscountDesc());
if(null != extendType && (3 == extendType || 4 == extendType || 5 == extendType)) { // Integer extendType = StringUtils.isBlank(productDiscount.getAddInfo())?null:JSON.parseObject(productDiscount.getAddInfo()).getInteger("extendType");
productVo.setCouponName(productDiscount.getDiscountDesc()); // if(null != extendType && (3 == extendType || 4 == extendType || 5 == extendType)) {
} else { // productVo.setCouponName(productDiscount.getDiscountDesc());
productVo.setName(productDiscount.getDiscountDesc()); // } else {
productVo.setSpuName(productDiscount.getDiscountDesc()); // productVo.setName(productDiscount.getDiscountDesc());
productVo.setExtras(""); // productVo.setSpuName(productDiscount.getDiscountDesc());
productVo.setSpecification(""); // productVo.setExtras("");
} // productVo.setSpecification("");
// }
} }
if (OrderAccountType.BUYM_SENDN.getCode().equals(productDiscount.getDiscountType())) { if (OrderAccountType.BUYM_SENDN.getCode().equals(productDiscount.getDiscountType())) {
activityType = ActivityTypeEnum.TYPE_61.getCode(); activityType = ActivityTypeEnum.TYPE_61.getCode();
...@@ -2136,6 +2137,9 @@ public class OrderAdapter { ...@@ -2136,6 +2137,9 @@ public class OrderAdapter {
//套餐 //套餐
productVo.setParentProductId(productBean.getParentProductId()); productVo.setParentProductId(productBean.getParentProductId());
productVo.setProductType(productBean.getProductType()); productVo.setProductType(productBean.getProductType());
if(ProductTypeEnum.TABLEWARE_PRODUCT.getCode().equals(productBean.getProductType())) {
productVo.setIsTableware(true);
}
productVo.setUnit(productBean.getUnit()); productVo.setUnit(productBean.getUnit());
productVo.setWeight(productBean.getWeight() != null ? productBean.getWeight().doubleValue() : 0); productVo.setWeight(productBean.getWeight() != null ? productBean.getWeight().doubleValue() : 0);
return productVo; return productVo;
...@@ -2455,7 +2459,11 @@ public class OrderAdapter { ...@@ -2455,7 +2459,11 @@ public class OrderAdapter {
createOrderProductDemoDto.setPicture(cartGoodsDetailDto.getPicture()); createOrderProductDemoDto.setPicture(cartGoodsDetailDto.getPicture());
createOrderProductDemoDto.setAddInfo(cartGoodsDetailDto.getAttributeNames()); createOrderProductDemoDto.setAddInfo(cartGoodsDetailDto.getAttributeNames());
createOrderProductDemoDto.setDiscountId(cartGoodsDetailDto.getCouponCode()); createOrderProductDemoDto.setDiscountId(cartGoodsDetailDto.getCouponCode());
createOrderProductDemoDto.setProductType(productType); if(cartGoodsDetailDto.getIsTableware() == 0) {
createOrderProductDemoDto.setProductType(productType);
} else {
createOrderProductDemoDto.setProductType(ProductTypeEnum.TABLEWARE_PRODUCT.getCode());
}
createOrderProductDemoDto.setParentProductId(cartGoodsDetailDto.getParentProductId()); createOrderProductDemoDto.setParentProductId(cartGoodsDetailDto.getParentProductId());
createOrderProductDemoDto.setIsFixedProduct(cartGoodsDetailDto.getIsFixedProduct()); createOrderProductDemoDto.setIsFixedProduct(cartGoodsDetailDto.getIsFixedProduct());
createOrderProductDemoDto.setCustomerCode(cartGoodsDetailDto.getCustomerCode()); createOrderProductDemoDto.setCustomerCode(cartGoodsDetailDto.getCustomerCode());
......
...@@ -203,6 +203,10 @@ public class ShoppingCartGoodsDto { ...@@ -203,6 +203,10 @@ public class ShoppingCartGoodsDto {
*/ */
private boolean isStockLimit; private boolean isStockLimit;
/** /**
* 是否餐具商品
*/
private Integer isTableware = 0;
/**
* 商品重量 * 商品重量
*/ */
private Double weight; private Double weight;
......
...@@ -154,6 +154,11 @@ public class ProductVo { ...@@ -154,6 +154,11 @@ public class ProductVo {
private Integer productType; private Integer productType;
/** /**
* 是否餐具商品
*/
private Boolean isTableware = false;
/**
* 商品单位 * 商品单位
*/ */
private String unit; private String unit;
......
...@@ -708,6 +708,9 @@ public class CheckMCCafeOrder { ...@@ -708,6 +708,9 @@ public class CheckMCCafeOrder {
//校验收货地址是否可配送 //校验收货地址是否可配送
String receiveId = createOrderVo.getReceiveId(); String receiveId = createOrderVo.getReceiveId();
String trackingNo = LogThreadLocal.getTrackingNo(); String trackingNo = LogThreadLocal.getTrackingNo();
if(StringUtils.isBlank(receiveId)) {
throw new ServiceException(ResponseResult.ORDER_TAKE_OUT_ADDRESS_INVAILD, "收货地址不能为空");
}
QueryReceiveAddressRequest request = new QueryReceiveAddressRequest(receiveId, storeDeliveryInfoDto.getPartnerId()); QueryReceiveAddressRequest request = new QueryReceiveAddressRequest(receiveId, storeDeliveryInfoDto.getPartnerId());
BaseResponse<QueryReceiveAddressResponse> queryReceiveAddressResponse = memberCenterService.queryReceiveAddressById(request, trackingNo); BaseResponse<QueryReceiveAddressResponse> queryReceiveAddressResponse = memberCenterService.queryReceiveAddressById(request, trackingNo);
if (!ResponseResult.SUCCESS.getCode().equals(queryReceiveAddressResponse.getCode()) || queryReceiveAddressResponse.getData() == null) { if (!ResponseResult.SUCCESS.getCode().equals(queryReceiveAddressResponse.getCode()) || queryReceiveAddressResponse.getData() == null) {
......
...@@ -30,6 +30,7 @@ import com.google.common.collect.Lists; ...@@ -30,6 +30,7 @@ import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.ObjectUtils; import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.*; import java.util.*;
...@@ -42,6 +43,9 @@ public class ShoppingCartConvertAdapter { ...@@ -42,6 +43,9 @@ public class ShoppingCartConvertAdapter {
private static final String ATTRIBUTEID = "attributeId"; private static final String ATTRIBUTEID = "attributeId";
private static final String ATTRIBUTENAME = "attributeName"; private static final String ATTRIBUTENAME = "attributeName";
@Value("${mccafe.tableware.skuId}")
private String mcCafeTablewareSkuId;
public ShoppingCartGoodsDto.CartGoodsDetailDto getCartGoodsDetailDto(CreateOrderVo.PremiumExchangeActivity.Product product, GetProductsVo getProductsVo, String goodsId, ActivityCalculationDiscountResponseDto.CalculationDiscountResult.SendActivity.SendGoods sendGoods) { public ShoppingCartGoodsDto.CartGoodsDetailDto getCartGoodsDetailDto(CreateOrderVo.PremiumExchangeActivity.Product product, GetProductsVo getProductsVo, String goodsId, ActivityCalculationDiscountResponseDto.CalculationDiscountResult.SendActivity.SendGoods sendGoods) {
ShoppingCartGoodsDto.CartGoodsDetailDto cartGoodsDetailDto = new ShoppingCartGoodsDto.CartGoodsDetailDto(); ShoppingCartGoodsDto.CartGoodsDetailDto cartGoodsDetailDto = new ShoppingCartGoodsDto.CartGoodsDetailDto();
cartGoodsDetailDto.setOriginalPrice(getProductsVo.getFinalPrice()); cartGoodsDetailDto.setOriginalPrice(getProductsVo.getFinalPrice());
...@@ -121,6 +125,9 @@ public class ShoppingCartConvertAdapter { ...@@ -121,6 +125,9 @@ public class ShoppingCartConvertAdapter {
cartGoodsDetailDto.setSpecialExtra(cartGoods.getSpecialExtra()); cartGoodsDetailDto.setSpecialExtra(cartGoods.getSpecialExtra());
cartGoodsDetailDto.setClassificationId(cartGoods.getClassificationId()); cartGoodsDetailDto.setClassificationId(cartGoods.getClassificationId());
cartGoodsDetailDto.setClassificationName(cartGoods.getClassificationName()); cartGoodsDetailDto.setClassificationName(cartGoods.getClassificationName());
if(mcCafeTablewareSkuId.equals(cartGoods.getSkuId())) {
cartGoodsDetailDto.setIsTableware(1);
}
if (GoodsTypeEnum.SET_MEAL_GOODS.getGoodsType().equals(cartGoods.getGoodsType())) { if (GoodsTypeEnum.SET_MEAL_GOODS.getGoodsType().equals(cartGoods.getGoodsType())) {
cartGoodsDetailDto.setProductType(ProductType.SETMEAL.getCode()); cartGoodsDetailDto.setProductType(ProductType.SETMEAL.getCode());
} else if (cartGoods.isWeightType()) { } else if (cartGoods.isWeightType()) {
......
...@@ -255,6 +255,10 @@ public class ShoppingCartGoodsDto { ...@@ -255,6 +255,10 @@ public class ShoppingCartGoodsDto {
*/ */
private boolean isStockLimit; private boolean isStockLimit;
/** /**
* 是否餐具商品
*/
private Integer isTableware = 0;
/**
* 商品货号 * 商品货号
*/ */
private String productCode; private String productCode;
......
...@@ -196,6 +196,10 @@ public class CartGoods { ...@@ -196,6 +196,10 @@ public class CartGoods {
*/ */
private boolean isStockLimit; private boolean isStockLimit;
/** /**
* 是否餐具商品
*/
private Boolean isTableware = false;
/**
* 第三方商品编码 * 第三方商品编码
*/ */
private String customerCode; private String customerCode;
......
...@@ -123,6 +123,8 @@ public class ShoppingCartMCoffeeServiceImpl { ...@@ -123,6 +123,8 @@ public class ShoppingCartMCoffeeServiceImpl {
private String mcCafeUniversalCouponCode; private String mcCafeUniversalCouponCode;
@Value("${mccafe.pay.card.fee}") @Value("${mccafe.pay.card.fee}")
private String payCardFee; private String payCardFee;
@Value("${mccafe.tableware.skuId}")
private String mcCafeTablewareSkuId;
/** /**
* 添加商品、超值加购、商品券 * 添加商品、超值加购、商品券
...@@ -175,6 +177,14 @@ public class ShoppingCartMCoffeeServiceImpl { ...@@ -175,6 +177,14 @@ public class ShoppingCartMCoffeeServiceImpl {
if (CollectionUtils.isEmpty(oldCartGoodsList)) { if (CollectionUtils.isEmpty(oldCartGoodsList)) {
oldCartGoodsList = new ArrayList<>(); oldCartGoodsList = new ArrayList<>();
} }
if(mcCafeTablewareSkuId.equals(skuId)) {
for(CartGoods cartGoods : oldCartGoodsList) {
if(mcCafeTablewareSkuId.equals(cartGoods.getSkuId())) {
return ResponseUtil.error(ResponseResult.SHOPPING_CART_ADD_ERROR.getCode(), "不能重复添加餐具商品");
}
}
}
//商品券已添加情况校验 //商品券已添加情况校验
List<ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon> coupons = checkGoodsCoupon(oldCartGoodsList, operationType, couponCode,goodsId, addShoppingCartGoodsRequestVo); List<ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon> coupons = checkGoodsCoupon(oldCartGoodsList, operationType, couponCode,goodsId, addShoppingCartGoodsRequestVo);
CartGoods addCartGoods = convent2CartGoods(addShoppingCartGoodsRequestVo, goodsId ,vo); CartGoods addCartGoods = convent2CartGoods(addShoppingCartGoodsRequestVo, goodsId ,vo);
...@@ -331,6 +341,8 @@ public class ShoppingCartMCoffeeServiceImpl { ...@@ -331,6 +341,8 @@ public class ShoppingCartMCoffeeServiceImpl {
// 先验证商品是否存在 // 先验证商品是否存在
List<CartGoods> cartGoodsList = assortmentSdkService.getShoppingCart(partnerId, storeId, userId, null, null, shoppingCartBaseService); List<CartGoods> cartGoodsList = assortmentSdkService.getShoppingCart(partnerId, storeId, userId, null, null, shoppingCartBaseService);
CartGoods cartGoods = null; CartGoods cartGoods = null;
String skuId = "";
Integer finalQty = qty;
for (CartGoods cartGoods_ : cartGoodsList) { for (CartGoods cartGoods_ : cartGoodsList) {
if (cartGoodsUid.equals(cartGoods_.getCartGoodsUid())) { if (cartGoodsUid.equals(cartGoods_.getCartGoodsUid())) {
cartGoods = cartGoods_; cartGoods = cartGoods_;
...@@ -339,10 +351,20 @@ public class ShoppingCartMCoffeeServiceImpl { ...@@ -339,10 +351,20 @@ public class ShoppingCartMCoffeeServiceImpl {
}else { }else {
cartGoods_.setQty(cartGoods_.getQty() - (oldQty - qty)); cartGoods_.setQty(cartGoods_.getQty() - (oldQty - qty));
} }
skuId = cartGoods_.getSkuId();
finalQty = cartGoods_.getQty();
break; break;
} }
} }
if(!mcCafeTablewareSkuId.equals(skuId) && finalQty == 0 && CollectionUtils.isNotEmpty(cartGoodsList) && cartGoodsList.size() == 2) {
for (CartGoods cartGoods_ : cartGoodsList) {
if(mcCafeTablewareSkuId.equals(cartGoods_.getSkuId())) {
cartGoods_.setQty(0);
}
}
}
if (cartGoods == null) { if (cartGoods == null) {
throw new ServiceException(ResponseResult.SHOPPING_CART_UPDATE_ERROR); throw new ServiceException(ResponseResult.SHOPPING_CART_UPDATE_ERROR);
} }
...@@ -426,6 +448,21 @@ public class ShoppingCartMCoffeeServiceImpl { ...@@ -426,6 +448,21 @@ public class ShoppingCartMCoffeeServiceImpl {
temList.addAll(checkCartGoods(partnerId, storeId, orderType, menuType, shoppingCartGoodsResponseVo, Arrays.asList(goods))); temList.addAll(checkCartGoods(partnerId, storeId, orderType, menuType, shoppingCartGoodsResponseVo, Arrays.asList(goods)));
} }
cartGoodsList = temList; cartGoodsList = temList;
//如果是餐具商品,则放到最后
if (CollectionUtils.isNotEmpty(cartGoodsList)) {
int size = cartGoodsList.size();
for(int i=0;i<size;i++) {
if(cartGoodsList.get(i).getSkuId().equals(mcCafeTablewareSkuId)) {
CartGoods cartGoods = cartGoodsList.get(i);
cartGoods.setIsTableware(true);
if(i != size-1) {
cartGoodsList.remove(i);
cartGoodsList.add(cartGoods);
break;
}
}
}
}
// 重新存储最新购物车 // 重新存储最新购物车
assortmentSdkService.setShoppingCart(partnerId, storeId, userId, cartGoodsList, sessionId, "", shoppingCartBaseService); assortmentSdkService.setShoppingCart(partnerId, storeId, userId, cartGoodsList, sessionId, "", shoppingCartBaseService);
} }
...@@ -806,6 +843,22 @@ public class ShoppingCartMCoffeeServiceImpl { ...@@ -806,6 +843,22 @@ public class ShoppingCartMCoffeeServiceImpl {
//设置均摊信息 //设置均摊信息
calculationService.updateShoppingCartGoodsApportion(shoppingCartGoodsResponseVo, calculationDiscount, shoppingCartGoodsDto, premiumExchangeActivity, shoppingCartInfoRequestVo); calculationService.updateShoppingCartGoodsApportion(shoppingCartGoodsResponseVo, calculationDiscount, shoppingCartGoodsDto, premiumExchangeActivity, shoppingCartInfoRequestVo);
//如果是餐具商品,则放到最后
if (CollectionUtils.isNotEmpty(shoppingCartGoodsDto.getProducts())) {
int size = shoppingCartGoodsDto.getProducts().size();
for(int i=0;i<size;i++) {
if(shoppingCartGoodsDto.getProducts().get(i).getSkuId().equals(mcCafeTablewareSkuId)) {
ShoppingCartGoodsDto.CartGoodsDetailDto cartGoodsDetailDto = shoppingCartGoodsDto.getProducts().get(i);
cartGoodsDetailDto.setIsTableware(1);
if(i != size-1) {
shoppingCartGoodsDto.getProducts().remove(i);
shoppingCartGoodsDto.getProducts().add(cartGoodsDetailDto);
break;
}
}
}
}
return ResponseUtil.success(shoppingCartGoodsDto); return ResponseUtil.success(shoppingCartGoodsDto);
} }
...@@ -834,6 +887,14 @@ public class ShoppingCartMCoffeeServiceImpl { ...@@ -834,6 +887,14 @@ public class ShoppingCartMCoffeeServiceImpl {
// 如果购物车商品不为空, 则check购物车中所有商品 // 如果购物车商品不为空, 则check购物车中所有商品
if (CollectionUtils.isEmpty(cartGoodsList)) { if (CollectionUtils.isEmpty(cartGoodsList)) {
return ResponseUtil.success(shoppingCartGoodsResponseVo); return ResponseUtil.success(shoppingCartGoodsResponseVo);
} else {
//移除餐具商品
for(int i=0;i<cartGoodsList.size();i++) {
if(mcCafeTablewareSkuId.equals(cartGoodsList.get(i).getSkuId())) {
cartGoodsList.remove(i);
break;
}
}
} }
List<CartGoods> onlyCheckGoodsList = new ArrayList<>(); List<CartGoods> onlyCheckGoodsList = new ArrayList<>();
...@@ -1595,6 +1656,23 @@ public class ShoppingCartMCoffeeServiceImpl { ...@@ -1595,6 +1656,23 @@ public class ShoppingCartMCoffeeServiceImpl {
if (CollectionUtils.isNotEmpty(reduceGoods)) { if (CollectionUtils.isNotEmpty(reduceGoods)) {
allCartGoodsList.addAll(reduceGoods); allCartGoodsList.addAll(reduceGoods);
} }
//如果是餐具商品,则放到最后
if (CollectionUtils.isNotEmpty(allCartGoodsList)) {
int size = allCartGoodsList.size();
for(int i=0;i<size;i++) {
if(allCartGoodsList.get(i).getSkuId().equals(mcCafeTablewareSkuId)) {
CartGoods cartGoods = allCartGoodsList.get(i);
cartGoods.setIsTableware(true);
if(i != size-1) {
allCartGoodsList.remove(i);
allCartGoodsList.add(cartGoods);
break;
}
}
}
}
return allCartGoodsList; return allCartGoodsList;
} }
......
...@@ -21,6 +21,4 @@ management.endpoints.web.exposure.include=prometheus,info,health,shutdown ...@@ -21,6 +21,4 @@ management.endpoints.web.exposure.include=prometheus,info,health,shutdown
management.metrics.tags.application=${spring.application.name} management.metrics.tags.application=${spring.application.name}
management.endpoint.shutdown.enabled=true management.endpoint.shutdown.enabled=true
management.security.enabled=false management.security.enabled=false
management.health.rabbit.enabled=false management.health.rabbit.enabled=false
\ No newline at end of file
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