Commit 247853a5 by zhiheng.zhang

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

parents 38d3cd00 ed6e7bef
......@@ -1220,7 +1220,7 @@ public class OrderAdapter {
responseVo.setOidBase64Image(oidBase64Image);
}
//设置是否是第三方配送单
if (ordersBean.getAddInfo() !=null && StringUtils.isNotEmpty(ordersBean.getAddInfo().getDeliveryId())&& "0".equals(ordersBean.getAddInfo().getDeliveryId())) {
if (ordersBean.getAddInfo() !=null && StringUtils.isNotEmpty(ordersBean.getAddInfo().getDeliveryId())&& !"0".equals(ordersBean.getAddInfo().getDeliveryId())) {
responseVo.setHasThirdDelivery(true);
responseVo.setDeliveryId(ordersBean.getAddInfo().getDeliveryId());
}
......@@ -2088,6 +2088,11 @@ public class OrderAdapter {
}
productVo.setInventedParentActivitiesVo(inventedParentActivityVos);
}
// 购物车行id
productVo.setCid(orderProductAddInfoDto.getCartGoodsUid());
// 购物车行父id
productVo.setOcid(orderProductAddInfoDto.getOriginalGoodsUid());
}
productVo.setOriginalPrice(productBean.getPrice());
productVo.setFinalPrice(productBean.getSalePrice());
......@@ -2114,15 +2119,16 @@ public class OrderAdapter {
discountTotalAmount = discountTotalAmount + productDiscount.getDiscountAmount()*productDiscount.getDiscountQty();
if (OrderAccountType.PRODUCT_COUPON.getCode().equals(productDiscount.getDiscountType())) {
hasProductCoupon = true;
Integer extendType = StringUtils.isBlank(productDiscount.getAddInfo())?null:JSON.parseObject(productDiscount.getAddInfo()).getInteger("extendType");
if(null != extendType && (3 == extendType || 4 == extendType || 5 == extendType)) {
productVo.setCouponName(productDiscount.getDiscountDesc());
} else {
productVo.setName(productDiscount.getDiscountDesc());
productVo.setSpuName(productDiscount.getDiscountDesc());
productVo.setExtras("");
productVo.setSpecification("");
}
// Integer extendType = StringUtils.isBlank(productDiscount.getAddInfo())?null:JSON.parseObject(productDiscount.getAddInfo()).getInteger("extendType");
// if(null != extendType && (3 == extendType || 4 == extendType || 5 == extendType)) {
// productVo.setCouponName(productDiscount.getDiscountDesc());
// } else {
// productVo.setName(productDiscount.getDiscountDesc());
// productVo.setSpuName(productDiscount.getDiscountDesc());
// productVo.setExtras("");
// productVo.setSpecification("");
// }
}
if (OrderAccountType.BUYM_SENDN.getCode().equals(productDiscount.getDiscountType())) {
activityType = ActivityTypeEnum.TYPE_61.getCode();
......@@ -2152,6 +2158,9 @@ public class OrderAdapter {
//套餐
productVo.setParentProductId(productBean.getParentProductId());
productVo.setProductType(productBean.getProductType());
if(ProductTypeEnum.TABLEWARE_PRODUCT.getCode().equals(productBean.getProductType())) {
productVo.setIsTableware(true);
}
productVo.setUnit(productBean.getUnit());
productVo.setWeight(productBean.getWeight() != null ? productBean.getWeight().doubleValue() : 0);
return productVo;
......@@ -2484,7 +2493,11 @@ public class OrderAdapter {
createOrderProductDemoDto.setPicture(cartGoodsDetailDto.getPicture());
createOrderProductDemoDto.setAddInfo(cartGoodsDetailDto.getAttributeNames());
createOrderProductDemoDto.setDiscountId(cartGoodsDetailDto.getCouponCode());
if(cartGoodsDetailDto.getIsTableware() == 0) {
createOrderProductDemoDto.setProductType(productType);
} else {
createOrderProductDemoDto.setProductType(ProductTypeEnum.TABLEWARE_PRODUCT.getCode());
}
createOrderProductDemoDto.setParentProductId(cartGoodsDetailDto.getParentProductId());
createOrderProductDemoDto.setIsFixedProduct(cartGoodsDetailDto.getIsFixedProduct());
createOrderProductDemoDto.setCustomerCode(cartGoodsDetailDto.getCustomerCode());
......
......@@ -26,4 +26,7 @@ public class PayGitCheckAndJoinRequestDto {
private Integer orderWay;
private List<String> skuIds;
// 版本号
private Integer ver;
}
......@@ -197,6 +197,10 @@ public class ShoppingCartGoodsDto {
*/
private boolean isStockLimit;
/**
* 是否餐具商品
*/
private Integer isTableware = 0;
/**
* 商品重量
*/
private Double weight;
......
......@@ -154,6 +154,11 @@ public class ProductVo {
private Integer productType;
/**
* 是否餐具商品
*/
private Boolean isTableware = false;
/**
* 商品单位
*/
private String unit;
......
......@@ -192,6 +192,8 @@ public class OrderServiceImpl implements Orderservice {
private String fnStoreId;
@Value("${collage.pre_order_pay.goods_tag}")
private String collageGoodsTag;
@Value("${collage.pre_order_pay.goods_tag_list}")
private String collageGoodsTagList;
/**
* coco商户
......@@ -940,7 +942,7 @@ public class OrderServiceImpl implements Orderservice {
// 所以在这个地方排除掉coco,在下边单独实现
//参与支付有礼活动
if(!cocoPartnerId.contains(queryOrderVo.getPartnerId())){
joinPayGift(queryOrderVo.getSessionId(), queryOrderResponseVo);
joinPayGift(queryOrderVo.getSessionId(), queryOrderResponseVo,partnerId);
}
} catch (Exception e) {
......@@ -953,7 +955,7 @@ public class OrderServiceImpl implements Orderservice {
if(cocoPartnerId.contains(queryOrderVo.getPartnerId())){
queryOrderResponseVos.forEach(queryOrderResponseVo -> {
try {
joinPayGift(queryOrderVo.getSessionId(), queryOrderResponseVo);
joinPayGift(queryOrderVo.getSessionId(), queryOrderResponseVo,partnerId);
} catch (Exception e) {
LogUtil.error("coco_queryOrders_activity_error", gson.toJson(queryOrdersDto), gson.toJson(queryOrderResponseVo), e);
......@@ -1277,7 +1279,7 @@ public class OrderServiceImpl implements Orderservice {
}
//参与支付有礼活动
private void joinPayGift(String sessionId, QueryOrderResponseVo queryOrderResponseVo) {
private void joinPayGift(String sessionId, QueryOrderResponseVo queryOrderResponseVo,String partnerId) {
PayGitCheckAndJoinRequestDto payGitRequestDto = new PayGitCheckAndJoinRequestDto();
payGitRequestDto.setStoreId(queryOrderResponseVo.getShopId());
payGitRequestDto.setSessionId(sessionId);
......@@ -1298,6 +1300,11 @@ public class OrderServiceImpl implements Orderservice {
} else {
payGitRequestDto.setOrderWay(2);
}
if(cocoPartnerId.contains(partnerId)){
payGitRequestDto.setVer(1);
}
BaseResponse<PayGiftCheckAndJoinResponseDto> payGiftBaseResponse = activityApplicationClient.payGiftCheckAndJoin(payGitRequestDto);
if (String.valueOf(RESPONSE_SUCCESS_CODE).equals(payGiftBaseResponse.getCode()) && payGiftBaseResponse.getResult() != null) {
PayGiftCheckAndJoinResponseDto payGiftResponse = payGiftBaseResponse.getResult();
......@@ -1463,7 +1470,7 @@ public class OrderServiceImpl implements Orderservice {
// 支付有礼
// 目前只有coco在订单详情参加支付有礼,且不检查订单的状态
if(cocoPartnerId.contains(partnerId)){
joinPayGift(sessionId, queryOrderResponseVo);
joinPayGift(sessionId, queryOrderResponseVo,partnerId);
}
......@@ -2746,7 +2753,9 @@ public class OrderServiceImpl implements Orderservice {
if (null != orderBean.getMarketingType() && OrderMarketType.COLLAGE.getIndex() == orderBean.getMarketingType()) {
// 拼单人数大于1人时参加拼单补贴
if (null != orderBean.getProductList() && orderBean.getProductList().stream().map(QueryOrdersResponse.DataBean.OrderBean.ProductBean::getUserId).distinct().collect(Collectors.toList()).size() > 1) {
request.setGoodsTag(collageGoodsTag);
Map<String, String> goodsTagMap = this.goodsTagMap();
String goodsTag = goodsTagMap.get(orderBean.getCompanyId());
request.setGoodsTag(StringUtils.isBlank(goodsTag) ? collageGoodsTag : goodsTag);
}
}
// add by miaohui for 拼单群收款判断拼单人数大于1时参与微信平台补贴活动,创建预支付时上送goodsTag,后续抽成促销服务活动时删除此逻辑 end
......@@ -3673,4 +3682,16 @@ public class OrderServiceImpl implements Orderservice {
return false;
}
}
private Map<String, String> goodsTagMap() {
Map<String, String> map = new HashMap<>();
try {
for (String pg : collageGoodsTagList.split(",")) {
map.put(pg.split(":")[0], pg.split(":")[1]);
}
} catch (Exception e) {
log.error("goodsTag解析失败:" + collageGoodsTagList);
}
return map;
}
}
......@@ -28,6 +28,7 @@ import com.freemud.application.sdk.api.ordercenter.response.orderInfo.OrderSendC
import com.freemud.application.sdk.api.storecenter.response.StoreResponse;
import com.freemud.application.sdk.api.storecenter.service.StoreCenterService;
import com.freemud.sdk.api.assortment.order.enums.OldOrderAccountType;
import com.freemud.sdk.api.assortment.order.request.order.OrderProductAddInfoDto;
import com.freemud.sdk.api.assortment.order.response.order.QueryOrderByIdResponse;
import com.freemud.sdk.api.assortment.order.response.order.QueryOrdersResponse;
import io.swagger.models.auth.In;
......@@ -109,7 +110,14 @@ public class CocoOrderRelationServiceImpl implements OrderRelationService {
Map<String,QueryOrdersResponse.DataBean.OrderBean.ProductBean> productMap = new HashMap<>();
List<QueryOrdersResponse.DataBean.OrderBean.ProductBean> productList = response.getData().getProductList();
if(productList != null && !productList.isEmpty()){
productMap = productList.stream().collect(Collectors.toMap(QueryOrdersResponse.DataBean.OrderBean.ProductBean::getCartGoodsUid, g -> g,(k1,k2)->k1));
for(QueryOrdersResponse.DataBean.OrderBean.ProductBean productBean : productList){
if(StringUtils.isEmpty(productBean.getExtInfo())){
continue;
}
OrderProductAddInfoDto orderProductAddInfoDto = JSONObject.parseObject(productBean.getExtInfo(),OrderProductAddInfoDto.class);
productMap.put(orderProductAddInfoDto.getCartGoodsUid(),productBean);
}
}
......@@ -129,10 +137,27 @@ public class CocoOrderRelationServiceImpl implements OrderRelationService {
});
}
List<ProductVo> productVos = new ArrayList<>();
if(null != masterProducts && !masterProducts.isEmpty()){
for(ProductVo product : masterProducts){
Integer giftQty = giftMap.get(product.getCid()) == null ? 0 : giftMap.get(product.getCid());
product.setQty(product.getQty() + giftQty);
// 商品原单价=商品原单价+小料原单价
List<ProductVo> smallMaterial = product.getSetMaterialProducts();
Long smallMaterialOriTotal = 0L;
if(smallMaterial != null && !smallMaterial.isEmpty()){
for(ProductVo sm : smallMaterial){
smallMaterialOriTotal = smallMaterialOriTotal + sm.getOriginalPrice();
}
}
// 商品现单价 = 商品现单价+小料现单价
smallMaterialOriTotal = smallMaterialOriTotal == null ? 0 : smallMaterialOriTotal;
product.setOriginalPrice(smallMaterialOriTotal + (product.getOriginalPrice() == null ? 0L : product.getOriginalPrice()));
// 如果商品参加了第二件半价活动,要把该行拆成数量为1的多行
QueryOrdersResponse.DataBean.OrderBean.ProductBean productBean = productMap.get(product.getCid());
if(productBean == null || productBean.getDiscountList() == null || productBean.getDiscountList().isEmpty()){
......@@ -141,7 +166,7 @@ public class CocoOrderRelationServiceImpl implements OrderRelationService {
boolean halfFlag = false;
List<QueryOrdersResponse.DataBean.OrderBean.ProductBean.ProductDiscount> discountList = productBean.getDiscountList();
for(QueryOrdersResponse.DataBean.OrderBean.ProductBean.ProductDiscount productDiscount : discountList){
if(ObjectUtils.equals(productDiscount.getDiscountType(), 20)){
if(ObjectUtils.equals(productDiscount.getDiscountType(), OldOrderAccountType.SECOND_DISCOUNT.getCode())){
halfFlag = true;
break;
}
......@@ -151,14 +176,20 @@ public class CocoOrderRelationServiceImpl implements OrderRelationService {
for(int i = 0 ; i < num-1 ; i++){
ProductVo newProduct = JSONObject.parseObject(JSONObject.toJSONString(product),ProductVo.class);
newProduct.setQty(1);
productVos.add(newProduct);
}
product.setQty(1);
}
}
}
masterProducts.addAll(productVos);
queryOrderResponseVo.setProducts(masterProducts);
}
}
......@@ -23,6 +23,7 @@ public class CheckSpqInfoResponseDto {
* 券名称
*/
private String couponName;
private boolean stockLimit;
/**
* 商品券code
*/
......
......@@ -266,6 +266,11 @@ public class CalculationSharingDiscountResponseDto {
* 当前活动实际优惠的商品数量
*/
private Integer actualGoodsNumber;
/**
* 优惠现单价
*/
private Long signleDiscount;
}
/**
......
......@@ -255,6 +255,10 @@ public class ShoppingCartGoodsDto {
*/
private boolean isStockLimit;
/**
* 是否餐具商品
*/
private Integer isTableware = 0;
/**
* 商品货号
*/
private String productCode;
......
......@@ -196,6 +196,10 @@ public class CartGoods {
*/
private boolean isStockLimit;
/**
* 是否餐具商品
*/
private Boolean isTableware = false;
/**
* 第三方商品编码
*/
private String customerCode;
......
......@@ -25,6 +25,7 @@ public enum ActivityTypeEnum {
*/
TYPE_2(2, "单品特价"),
TYPE_21(21, "单品折扣"),
TYPE_22(22, "单品立减"),
TYPE_23(23, "超值加购"),
/**
* 优惠券
......
......@@ -22,6 +22,7 @@ import cn.freemud.service.impl.*;
import cn.freemud.service.thirdparty.CustomerApplicationClient;
import cn.freemud.service.thirdparty.StockClient;
import cn.freemud.utils.PromotionFactory;
import com.alibaba.fastjson.JSON;
import com.freemud.api.assortment.datamanager.entity.db.AssortmentOpenPlatformPartnerStoreDeliveryConfig;
import com.freemud.api.assortment.datamanager.manager.AssortmentOpenPlatformPartnerStoreDeliveryConfigManager;
import com.freemud.application.sdk.api.base.SDKCommonBaseContextWare;
......@@ -354,6 +355,9 @@ public abstract class AbstractShoppingCartImpl implements ShoppingCartNewService
*/
public void updateShoppingCartGoodsDiscount(CouponPromotionVO couponPromotionVO, ActivityQueryDto activityQueryDto, ActivityCalculationDiscountResponseDto.CalculationDiscountResult calculationDiscountResult, List<CartGoods> cartGoodsList
, ShoppingCartGoodsResponseVo shoppingCartGoodsResponseVo, ShoppingCartInfoRequestVo shoppingCartInfoRequestVo, UserLoginInfoDto userLoginInfoDto,String menuType,Long deliveryAmount) {
log.info("pindantest calculationDiscountResult->" + JSON.toJSONString(calculationDiscountResult));
log.info("pindantest cartGoodsList->" + JSON.toJSONString(cartGoodsList));
log.info("pindantest activityQueryDto->" + JSON.toJSONString(activityQueryDto));
//默认计算优惠
DefaultPromotionService defaultPromotionService = (DefaultPromotionService) PromotionFactory.getPromotionService(ShoppingCartPromotionEnum.DEFAULT_PROMOTION);
defaultPromotionService.updateShoppingCartGoodsDiscount(couponPromotionVO, activityQueryDto, calculationDiscountResult, cartGoodsList, shoppingCartGoodsResponseVo, userLoginInfoDto, shoppingCartInfoRequestVo);
......@@ -500,7 +504,7 @@ public abstract class AbstractShoppingCartImpl implements ShoppingCartNewService
*/
MaterialPromotionService materialPromotionService = (MaterialPromotionService) PromotionFactory.getPromotionService(ShoppingCartPromotionEnum.Material);
materialPromotionService.updateShoppingCartGoodsDiscount(couponPromotionVO, activityQueryDto, calculationDiscountResult, cartGoodsList, shoppingCartGoodsResponseVo, userLoginInfoDto, shoppingCartInfoRequestVo);
log.info("pindantest shoppingCartGoodsResponseVo->" + JSON.toJSONString(shoppingCartGoodsResponseVo));
}
/**
......
......@@ -147,6 +147,7 @@ public class CocoActiveServiceImpl implements ActiveService {
newCartGoods.setClassificationName(cgs.getClassificationName());
newCartGoods.setActivityType(discount.getType());
newCartGoods.setQty(discountForGift.get(cgs.getCartGoodsUid()).getGoodsQuantity());
newCartGoods.setProductMaterialList(cgs.getProductMaterialList());
addcartGoodsList.add(newCartGoods);
}
}
......
......@@ -48,10 +48,12 @@ import com.alibaba.fastjson.JSON;
import com.freemud.application.sdk.api.couponcenter.offline.domain.CodeInfoVO;
import com.freemud.application.sdk.api.couponcenter.offline.response.CouponQueryResponse;
import com.freemud.application.sdk.api.productcenter.constant.ResponseConstant;
import com.freemud.application.sdk.api.productcenter.domain.ProductBeanDTO;
import com.freemud.application.sdk.api.productcenter.request.product.valid.ValidateShopProductRequest;
import com.freemud.application.sdk.api.productcenter.request.product.valid.ValidateShopProductType;
import com.freemud.application.sdk.api.productcenter.response.ProductResponseDTO;
import com.freemud.application.sdk.api.productcenter.response.valid.ValiadShopProductResponse;
import com.freemud.application.sdk.api.productcenter.response.valid.ValiadShopProductResult;
import com.freemud.card.sdk.comm.Finals;
import com.freemud.card.sdk.comm.SignUtil;
import com.freemud.card.sdk.service.CouponAvailableService;
......@@ -691,6 +693,7 @@ public class CouponServiceImpl implements CouponService {
dto.setPrice(productsVo.getFinalPrice());
dto.setSpuId(productsVo.getSpuId());
dto.setSpuName(productsVo.getSkuName());
dto.setStockLimit(ObjectUtils.equals(1, productsVo.getStockLimit()));
dto.setSkuId(productsVo.getSkuId());
dto.setSkuName(StringUtils.isNotBlank(productsVo.getSkuName()) ? productsVo.getSkuName() : productsVo.getSpuName());
dto.setPicture(productsVo.getSpuPicture());
......@@ -783,7 +786,6 @@ public class CouponServiceImpl implements CouponService {
return null;
}
//券返回的商品id
List<String> skuIds = Lists.newArrayList();
String skuId = goodsId;
......@@ -814,6 +816,7 @@ public class CouponServiceImpl implements CouponService {
dto.setPicture(productsVo.getSpuPicture());
dto.setDefaultSpecName(productsVo.getDefaultSpecName());
dto.setDefaultSpecId(productsVo.getDefaultSpecId());
dto.setStockLimit(ObjectUtils.equals(1, productsVo.getStockLimit()));
dto.setExtras(productsVo.getExtra());
dto.setCouponType(couponType);
log.info("dto***" + dto);
......
......@@ -693,7 +693,7 @@ public class ShoppingCartCollageServiceImpl extends AbstractShoppingCartImpl imp
//设置更新响应信息
setAddAndUpdateResponse(shoppingCartGoodsResponseVo, calculationDiscountResult, cartGoodsList, shoppingCartGoodsResponseVo.getToastMsg(), partnerId, storeId, userId, ShoppingCartConstant.QUERY_INFO, shoppingCartInfoRequestVo);
//设置均摊信息,商品行信息
//设置均摊信息
updateShoppingCartGoodsApportion(shoppingCartGoodsResponseVo, calculationDiscountResult, shoppingCartGoodsDto, premiumExchangeActivity, shoppingCartInfoRequestVo);
// 计算第一次使用会员卡需多支付的金额 单位:分
getNeedCardAmount(shoppingCartInfoRequestVo, shoppingCartGoodsDto);
......@@ -703,13 +703,13 @@ public class ShoppingCartCollageServiceImpl extends AbstractShoppingCartImpl imp
shoppingCartGoodsDto.setThresholdAmount(shoppingCartGoodsResponseVo.getThresholdAmount());
shoppingCartGoodsDto.setIsDiscountDelivery(shoppingCartGoodsResponseVo.getIsDiscountDelivery());
shoppingCartGoodsDto.setDiscountDeliveryActivityCode(shoppingCartGoodsResponseVo.getDiscountDeliveryActivityCode());
if (calculationDiscountResult != null){
shoppingCartGoodsDto.setSendPoint(calculationDiscountResult.getSendPointVo());
}
// 购物车购买人包装费计算
updatePackPrice(shoppingCartGoodsResponseVo, shoppingCartGoodsDto);
// 重新计算购物车行折扣总金额
updateTotalDiscountAmount(calculationDiscountResult, shoppingCartGoodsDto);
return ResponseUtil.success(shoppingCartGoodsDto);
}
......@@ -734,22 +734,6 @@ public class ShoppingCartCollageServiceImpl extends AbstractShoppingCartImpl imp
}
}
/**
* 重新计算拼单购物车行总折扣金额
*/
private void updateTotalDiscountAmount(ActivityCalculationDiscountResponseDto.CalculationDiscountResult calculationDiscountResult, ShoppingCartGoodsDto shoppingCartGoodsDto) {
if (null != shoppingCartGoodsDto && null != shoppingCartGoodsDto.getProducts() && null != calculationDiscountResult && null != calculationDiscountResult.getGoods()) {
shoppingCartGoodsDto.getProducts().stream().forEach(product -> {
calculationDiscountResult.getGoods().stream().forEach(goods -> {
if (goods.getCartGoodsUid().equals(product.getCartGoodsUid())) {
long totalDiscountAmount = product.getOriginalPrice() * product.getQty() - goods.getRealAmount();
product.setTotalDiscountAmount(Integer.valueOf(String.valueOf(totalDiscountAmount)));
}
});
});
}
}
@Override
public ActivityCalculationDiscountResponseDto.CalculationDiscountResult getActivityCalculationDiscountResponse(String partnerId, String storeId, String userId, String appId, Integer orderType, boolean isMember, List<CartGoods> cartGoodsList, List<ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon> coupons, List<ShoppingCartInfoRequestVo.SendGoods> sendGoodsList, String menuType, Long distributionFee) {
ActivityCalculationDiscountRequestDto activityCalculationDiscountRequestDto = getActivityCalculationDiscountRequestDto(partnerId, storeId, userId, appId, orderType);
......
......@@ -791,6 +791,9 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
CheckCartRequest checkCartRequest = assortmentSdkService.checkShoppingCartSdk(cartGoodsList, partnerId, storeId, shoppingCartGoodsResponseVo,
shoppingCartInfoRequestVo.getOrderType(), tableNumber, shoppingCartInfoRequestVo.getMenuType() ,shoppingCartBaseService);
com.freemud.sdk.api.assortment.shoppingcart.domain.ShoppingCartGoodsResponseVo cartGoodsResponseVo = checkCartRequest.getShoppingCartGoodsResponseVo();
// 校验商品券库存
//商品不再售卖状态或价格变动,直接返回报错
if (cartGoodsResponseVo != null) {
if (cartGoodsResponseVo.getCartGoodsStates() != null && cartGoodsResponseVo.getCartGoodsStates().isHasInvalidGoods()) {
......@@ -1004,6 +1007,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
validCouponMap.put(spqId, checkSpqInfoResponseDto);
cartGoods.setName(checkSpqInfoResponseDto.getCouponName());
cartGoods.setSpuName(checkSpqInfoResponseDto.getCouponName());
cartGoods.setStockLimit(checkSpqInfoResponseDto.isStockLimit());
// 添加请求的优惠券信息
ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon coupon = new ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon();
coupon.setCode(checkSpqInfoResponseDto.getCouponCode());
......
......@@ -106,7 +106,7 @@ public class CalculationSharingDiscountService {
validCouponMap.put(spqId, checkSpqInfo);
cartGoods.setName(checkSpqInfo.getCouponName());
cartGoods.setSpuName(checkSpqInfo.getCouponName());
cartGoods.setStockLimit(checkSpqInfo.isStockLimit());
CalculationSharingDiscountRequestDto.CalculationDiscountCoupon coupon = new CalculationSharingDiscountRequestDto.CalculationDiscountCoupon();
coupon.setCode(checkSpqInfo.getCouponCode());
coupon.setActivityCode(checkSpqInfo.getActiveCode());
......
......@@ -123,6 +123,8 @@ public class ShoppingCartMCoffeeServiceImpl {
private String mcCafeUniversalCouponCode;
@Value("${mccafe.pay.card.fee}")
private String payCardFee;
@Value("${mccafe.tableware.skuId}")
private String mcCafeTablewareSkuId;
/**
* 添加商品、超值加购、商品券
......@@ -174,6 +176,14 @@ public class ShoppingCartMCoffeeServiceImpl {
if (CollectionUtils.isEmpty(oldCartGoodsList)) {
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);
CartGoods addCartGoods = convent2CartGoods(addShoppingCartGoodsRequestVo, goodsId ,vo);
......@@ -833,6 +843,14 @@ public class ShoppingCartMCoffeeServiceImpl {
// 如果购物车商品不为空, 则check购物车中所有商品
if (CollectionUtils.isEmpty(cartGoodsList)) {
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<>();
......@@ -1589,6 +1607,23 @@ public class ShoppingCartMCoffeeServiceImpl {
if (CollectionUtils.isNotEmpty(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);
i--;
}
}
}
}
return allCartGoodsList;
}
......
......@@ -19,6 +19,7 @@ import cn.freemud.service.CommonService;
import cn.freemud.service.impl.ItemServiceImpl;
import cn.freemud.service.thirdparty.ActivityClient;
import cn.freemud.utils.PropertyConvertUtil;
import com.alibaba.fastjson.JSON;
import com.freemud.application.sdk.api.log.ErrorLog;
import com.freemud.application.sdk.api.log.LogThreadLocal;
import com.freemud.application.sdk.api.membercenter.request.QueryReceiveAddressRequest;
......@@ -30,6 +31,7 @@ import com.freemud.application.sdk.api.storecenter.response.QueryDeliverDetailRe
import com.freemud.application.sdk.api.storecenter.response.StoreResponse;
import com.freemud.application.sdk.api.storecenter.service.StoreCenterService;
import com.freemud.sdk.api.assortment.shoppingcart.enums.BusinessTypeEnum;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -53,6 +55,7 @@ import java.util.stream.Collectors;
*/
@Service
@Slf4j
public class CalculationServiceImpl {
......@@ -171,6 +174,7 @@ public class CalculationServiceImpl {
public void updateShoppingCartGoodsApportion(ShoppingCartGoodsResponseVo shoppingCartGoodsResponseVo, ActivityCalculationDiscountResponseDto.CalculationDiscountResult calculationDiscountResult,
ShoppingCartGoodsDto shoppingCartGoodsDto, CreateOrderVo.PremiumExchangeActivity premiumExchangeActivity, ShoppingCartInfoRequestVo shoppingCartInfoRequestVo){
log.info(111111+JSON.toJSONString(shoppingCartGoodsDto));
List<ShoppingCartGoodsDto.CartGoodsDetailDto> cartGoodsDetailDtoList = CollectionUtils.isEmpty(shoppingCartGoodsDto.getProducts()) ? new ArrayList<>() : shoppingCartGoodsDto.getProducts();
List<ShareDiscountActivityDto> shareDiscountActivityDtoList = CollectionUtils.isEmpty(shoppingCartGoodsDto.getShareDiscountActivityDtos()) ? new ArrayList<>() : shoppingCartGoodsDto.getShareDiscountActivityDtos();
//设置空
......@@ -208,6 +212,7 @@ public class CalculationServiceImpl {
List<ShoppingCartGoodsDto.CartGoodsDetailDto> cartGoodsDetailDtos = shoppingCartConvertAdapter.convertCartGoods2DetailGoodsList(cartGoods, apportionGoodsList,duplicateGoodsMap);
cartGoodsDetailDtoList.addAll(cartGoodsDetailDtos);
}
log.info(22222222+JSON.toJSONString(shoppingCartGoodsDto));
List<ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Discount> discounts = calculationDiscountResult == null ? new ArrayList<>() : calculationDiscountResult.getDiscounts();
List<ActivityDiscountsDto> activityDiscountsDtos = shoppingCartGoodsDto.getActivityDiscountsDtos() == null ? new ArrayList<>() : shoppingCartGoodsDto.getActivityDiscountsDtos();
for (ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Discount discount : discounts) {
......@@ -267,6 +272,7 @@ public class CalculationServiceImpl {
// fullPromotionCalculation.updateShoppingCartGoodsApportion(shoppingCartGoodsResponseVo, calculationDiscountResult, shoppingCartGoodsDto,premiumExchangeActivity,shoppingCartInfoRequestVo);
//限时特价
timeSaleCalculation.updateShoppingCartGoodsApportion(calculationDiscountResult, shoppingCartGoodsDto);
log.info(333333333+JSON.toJSONString(shoppingCartGoodsDto));
CouponPromotionVO couponPromotionVO = new CouponPromotionVO();
// couponPromotionVO.setPartnerId("1206");
......@@ -277,8 +283,10 @@ public class CalculationServiceImpl {
// couponPromotionVO.setFlg(CouponFlag.YES.getCode());
//优惠券
couponDiscountCalculation.updateShoppingCartGoodsApportion(calculationDiscountResult, shoppingCartGoodsDto, shoppingCartInfoRequestVo);
log.info(444444444+JSON.toJSONString(shoppingCartGoodsDto));
setMealCalculation.updateShoppingCartGoodsApportion(shoppingCartGoodsResponseVo, calculationDiscountResult, shoppingCartGoodsDto);
log.info(555555555+JSON.toJSONString(shoppingCartGoodsDto));
}
......
......@@ -23,4 +23,3 @@ management.endpoint.shutdown.enabled=true
management.security.enabled=false
management.health.rabbit.enabled=false
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