Commit fd7cfdf0 by 徐康

Merge branch 'feature/20200915_麦咖啡p2v3活动入机增加TENDERID字段'

# Conflicts:
#	assortment-ordercenter-sdk/pom.xml
#	order-application-service/pom.xml
#	ordercenter-sdk/pom.xml
#	shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/ShoppingCartInfoRequestVo.java
#	shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/ShoppingCartMCoffeeServiceImpl.java
parents 64938d3c 5c45f291
...@@ -1265,6 +1265,9 @@ public class OrderSdkAdapter { ...@@ -1265,6 +1265,9 @@ public class OrderSdkAdapter {
case "COUPON": case "COUPON":
type = 10; type = 10;
break; break;
case "FREIGHT_COUPON":
type = 99;
break;
case "PRODUCT_COUPON": case "PRODUCT_COUPON":
type = 118; type = 118;
break; break;
...@@ -2620,7 +2623,7 @@ public class OrderSdkAdapter { ...@@ -2620,7 +2623,7 @@ public class OrderSdkAdapter {
combo.setOpid(comboIndex); combo.setOpid(comboIndex);
updateOrderItemAndSettlement(orderItemList, orderSettlementCreateReqList, combo, partnerId, parentProductId, false); updateOrderItemAndSettlement(orderItemList, orderSettlementCreateReqList, combo, partnerId, parentProductId, false);
if(CollectionUtils.isNotEmpty(combo.getMaterialProduct())) { if(CollectionUtils.isNotEmpty(combo.getMaterialProduct())) {
String addProductId = productRequest.getProductId() + "_" + comboIndex; String addProductId = combo.getProductId() + "_" + comboIndex;
for(CreateOrderProductRequest material : combo.getMaterialProduct()) { for(CreateOrderProductRequest material : combo.getMaterialProduct()) {
material.setSpecification(material.getProductId()); material.setSpecification(material.getProductId());
material.setSpecificationName(material.getProductName()); material.setSpecificationName(material.getProductName());
......
...@@ -23,6 +23,7 @@ public enum OldOrderAccountType { ...@@ -23,6 +23,7 @@ public enum OldOrderAccountType {
PRODUCT_COUPON(6, "商品券", "PRODUCT_COUPON"), PRODUCT_COUPON(6, "商品券", "PRODUCT_COUPON"),
DISCOUNT_COUPON(7, "折扣券", "DISCOUNT_COUPON"), DISCOUNT_COUPON(7, "折扣券", "DISCOUNT_COUPON"),
DRIVER_FEE(7, "骑手小费", "DRIVER_FEE"), DRIVER_FEE(7, "骑手小费", "DRIVER_FEE"),
FREIGHT_COUPON(99, "运费券", "FREIGHT_COUPON"),
DISCOUNT_AMOUNT(21, "限时折扣", "DISCOUNT_AMOUNT"), DISCOUNT_AMOUNT(21, "限时折扣", "DISCOUNT_AMOUNT"),
PREMIUM_EXCHANGE(22, "加价购", "PREMIUM_EXCHANGE"), PREMIUM_EXCHANGE(22, "加价购", "PREMIUM_EXCHANGE"),
SECOND_DISCOUNT(23, "第二件N折", "SECOND_DISCOUNT"), SECOND_DISCOUNT(23, "第二件N折", "SECOND_DISCOUNT"),
......
...@@ -22,6 +22,7 @@ public enum QueryOrderAccountType { ...@@ -22,6 +22,7 @@ public enum QueryOrderAccountType {
BUY_DISCOUNT("BUY_DISCOUNT", "满减优惠"), BUY_DISCOUNT("BUY_DISCOUNT", "满减优惠"),
PACK_AMOUNT("PACK_AMOUNT", "包装费"), PACK_AMOUNT("PACK_AMOUNT", "包装费"),
COUPON("COUPON", "代金券"), COUPON("COUPON", "代金券"),
FREIGHT_COUPON("FREIGHT_COUPON", "运费券"),
PRODUCT_COUPON("PRODUCT_COUPON", "商品券"), PRODUCT_COUPON("PRODUCT_COUPON", "商品券"),
DISCOUNT_COUPON("DISCOUNT_COUPON", "折扣券"), DISCOUNT_COUPON("DISCOUNT_COUPON", "折扣券"),
DISCOUNT_AMOUNT("DISCOUNT_AMOUNT", "限时折扣金额"), DISCOUNT_AMOUNT("DISCOUNT_AMOUNT", "限时折扣金额"),
......
...@@ -40,4 +40,5 @@ public class CartParamDto { ...@@ -40,4 +40,5 @@ public class CartParamDto {
private MealClearOperationEnum operationType; private MealClearOperationEnum operationType;
private Integer couponType;
} }
package com.freemud.sdk.api.assortment.shoppingcart.enums;
public enum SaveCouponType {
COUPON(1, "代金券"),
FREIGHT_COUPON(2, "运费券"),
;
private Integer code;
private String desc;
SaveCouponType(Integer code, String desc) {
this.code = code;
this.desc = desc;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
}
...@@ -5,6 +5,7 @@ import cn.freemud.base.entity.BaseResponse; ...@@ -5,6 +5,7 @@ import cn.freemud.base.entity.BaseResponse;
import cn.freemud.redis.RedisCache; import cn.freemud.redis.RedisCache;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.freemud.application.sdk.api.couponcenter.enums.CouponTypeEnum;
import com.freemud.application.sdk.api.couponcenter.online.domain.*; import com.freemud.application.sdk.api.couponcenter.online.domain.*;
import com.freemud.application.sdk.api.couponcenter.online.request.ActiveBatchQueryRequest; import com.freemud.application.sdk.api.couponcenter.online.request.ActiveBatchQueryRequest;
import com.freemud.application.sdk.api.couponcenter.online.request.CouponDetailRequest; import com.freemud.application.sdk.api.couponcenter.online.request.CouponDetailRequest;
...@@ -26,6 +27,7 @@ import com.freemud.application.sdk.api.productcenter.service.ProductService; ...@@ -26,6 +27,7 @@ import com.freemud.application.sdk.api.productcenter.service.ProductService;
import com.freemud.sdk.api.assortment.shoppingcart.adapter.ShoppingCartAdapter; import com.freemud.sdk.api.assortment.shoppingcart.adapter.ShoppingCartAdapter;
import com.freemud.sdk.api.assortment.shoppingcart.constant.*; import com.freemud.sdk.api.assortment.shoppingcart.constant.*;
import com.freemud.sdk.api.assortment.shoppingcart.domain.*; import com.freemud.sdk.api.assortment.shoppingcart.domain.*;
import com.freemud.sdk.api.assortment.shoppingcart.enums.SaveCouponType;
import com.freemud.sdk.api.assortment.shoppingcart.request.CheckCartRequest; import com.freemud.sdk.api.assortment.shoppingcart.request.CheckCartRequest;
import com.freemud.sdk.api.assortment.shoppingcart.request.GetProductInfoRequest; import com.freemud.sdk.api.assortment.shoppingcart.request.GetProductInfoRequest;
import com.freemud.sdk.api.assortment.shoppingcart.service.ShoppingCartBaseService; import com.freemud.sdk.api.assortment.shoppingcart.service.ShoppingCartBaseService;
...@@ -203,6 +205,9 @@ public class ShoppingCartBaseServiceImpl implements ShoppingCartBaseService { ...@@ -203,6 +205,9 @@ public class ShoppingCartBaseServiceImpl implements ShoppingCartBaseService {
try { try {
redisTemplate.delete(this.getShoppingCartGoodsKey(cartParamDto)); redisTemplate.delete(this.getShoppingCartGoodsKey(cartParamDto));
redisTemplate.delete(this.getShoppingCartGoodsAmountKey(cartParamDto)); redisTemplate.delete(this.getShoppingCartGoodsAmountKey(cartParamDto));
cartParamDto.setCouponType(SaveCouponType.COUPON.getCode());
redisTemplate.delete(this.getShoppingCartCouponCodeKey(cartParamDto));
cartParamDto.setCouponType(SaveCouponType.FREIGHT_COUPON.getCode());
redisTemplate.delete(this.getShoppingCartCouponCodeKey(cartParamDto)); redisTemplate.delete(this.getShoppingCartCouponCodeKey(cartParamDto));
return new BaseResponse(VersionUtils.VER_1, CartResponseConstant.SUCCESS.getCode(), CartResponseConstant.SUCCESS.getMessage()); return new BaseResponse(VersionUtils.VER_1, CartResponseConstant.SUCCESS.getCode(), CartResponseConstant.SUCCESS.getMessage());
} catch (Exception e) { } catch (Exception e) {
...@@ -328,12 +333,12 @@ public class ShoppingCartBaseServiceImpl implements ShoppingCartBaseService { ...@@ -328,12 +333,12 @@ public class ShoppingCartBaseServiceImpl implements ShoppingCartBaseService {
/** /**
* 获取记录购物车信息的key * 获取记录购物车coupon的key
* *
* @return * @return
*/ */
private String getShoppingCartCouponCodeKey(CartParamDto cartParamDto) { private String getShoppingCartCouponCodeKey(CartParamDto cartParamDto) {
return RedisKeyConstant.SAAS_SHOPPINGCART_COUPON_KEY_PREFIX + cartParamDto.getPartnerId() + "_" + cartParamDto.getStoreId() + "_" + cartParamDto.getUserId(); return RedisKeyConstant.SAAS_SHOPPINGCART_COUPON_KEY_PREFIX + cartParamDto.getPartnerId() + "_" + cartParamDto.getStoreId() + "_" + cartParamDto.getUserId() + "_" + cartParamDto.getCouponType();
} }
/** /**
......
...@@ -14,11 +14,10 @@ package cn.freemud.adapter; ...@@ -14,11 +14,10 @@ package cn.freemud.adapter;
import cn.freemud.base.constant.Version; import cn.freemud.base.constant.Version;
import cn.freemud.base.util.DateUtil; import cn.freemud.base.util.DateUtil;
import cn.freemud.constant.ResponseCodeConstant;
import cn.freemud.entities.dto.*; import cn.freemud.entities.dto.*;
import cn.freemud.management.entities.dto.request.order.MCCafeCouponRequest; import cn.freemud.interceptor.ServiceException;
import cn.freemud.management.entities.dto.request.order.MCCafeCouponLockRequest; import cn.freemud.management.entities.dto.request.order.*;
import cn.freemud.management.entities.dto.request.order.MCCafeProductRedeemVo;
import cn.freemud.management.entities.dto.request.order.MCCafeTransactionVo;
import cn.freemud.entities.dto.openplatform.AddWeixinCardCodeRequestDto; import cn.freemud.entities.dto.openplatform.AddWeixinCardCodeRequestDto;
import cn.freemud.entities.dto.openplatform.AddWeixinCardCodeResponseDto; import cn.freemud.entities.dto.openplatform.AddWeixinCardCodeResponseDto;
import cn.freemud.entities.dto.openplatform.AddWeixinCardJudgeRequestDto; import cn.freemud.entities.dto.openplatform.AddWeixinCardJudgeRequestDto;
...@@ -27,7 +26,12 @@ import cn.freemud.entities.dto.promotion.CouponPromotionDto; ...@@ -27,7 +26,12 @@ import cn.freemud.entities.dto.promotion.CouponPromotionDto;
import cn.freemud.entities.dto.promotion.OrderBeanRequest; import cn.freemud.entities.dto.promotion.OrderBeanRequest;
import cn.freemud.entities.vo.*; import cn.freemud.entities.vo.*;
import cn.freemud.enums.*; import cn.freemud.enums.*;
import cn.freemud.management.entities.dto.response.coupon.McdNetBatchQueryResponse;
import cn.freemud.management.entities.dto.response.coupon.McdNetCouponProductRespDto;
import cn.freemud.management.enums.OrderSource;
import cn.freemud.service.mccafe.CouponClientService;
import cn.freemud.utils.BeanUtil; import cn.freemud.utils.BeanUtil;
import cn.freemud.utils.LogUtil;
import com.freemud.application.sdk.api.ordercenter.enums.OrderClientType; import com.freemud.application.sdk.api.ordercenter.enums.OrderClientType;
import com.freemud.card.sdk.vo.coupon.request.MemberAddCouponVo; import com.freemud.card.sdk.vo.coupon.request.MemberAddCouponVo;
import com.freemud.sdk.api.assortment.order.enums.OldOrderAccountType; import com.freemud.sdk.api.assortment.order.enums.OldOrderAccountType;
...@@ -52,6 +56,9 @@ public class CouponAdapter { ...@@ -52,6 +56,9 @@ public class CouponAdapter {
@Autowired @Autowired
private OrderAdapter orderAdapter; private OrderAdapter orderAdapter;
@Autowired
private CouponClientService couponClientService;
public CouponListDto convert2CouponListDto(String userId, String partnerId) { public CouponListDto convert2CouponListDto(String userId, String partnerId) {
CouponListDto couponListDto = new CouponListDto(); CouponListDto couponListDto = new CouponListDto();
couponListDto.setPartnerCode(partnerId); couponListDto.setPartnerCode(partnerId);
...@@ -684,6 +691,37 @@ public class CouponAdapter { ...@@ -684,6 +691,37 @@ public class CouponAdapter {
mcCafeProductRedeemVo.setSeq(i + 1); mcCafeProductRedeemVo.setSeq(i + 1);
products.add(mcCafeProductRedeemVo); products.add(mcCafeProductRedeemVo);
} }
} else if (QueryOrderAccountType.FREIGHT_COUPON.equals(orderAdapter.getQueryOrderAccountType(OldOrderAccountType.getByCode(accountBean.getType())))) {
MCCafeCouponRequest mcCafeCouponRequest = MCCafeCouponRequest.builder()
.ver(88)
.reqtype(CouponReqTypeEnum.BATCH_QUERY.getCode())
.partnerId(Integer.parseInt(orderBean.getCompanyId()))
.store_id(orderBean.getShopId())
.station_id("1")
.operator_id(orderBean.getUserId())
.channel(OrderSource.ALIPAY.getSource().equals(orderBean.getSource())?MCCafeChannelEnum.MOCOFFEE_ZFB.getName():MCCafeChannelEnum.MOCOFFEE_WX.getName())
.couponlist(Arrays.asList(new MCCafeCouponVo(accountBean.getAccountId())))
.sign("skip")
.build();
McdNetBatchQueryResponse mcdNetBatchQueryResponse = couponClientService.batchQuery(mcCafeCouponRequest);
if (mcdNetBatchQueryResponse == null || !ResponseCodeConstant.RESPONSE_SUCCESS.equals(mcdNetBatchQueryResponse.getStatusCode())
|| CollectionUtils.isEmpty(mcdNetBatchQueryResponse.getCouponlist())) {
LogUtil.error("获取运费券绑定商品异常,无法核销", mcCafeCouponRequest, mcdNetBatchQueryResponse);
return null;
} else {
try {
McdNetCouponProductRespDto mcdNetCouponProductRespDto = mcdNetBatchQueryResponse.getCouponlist().get(0).getCodeInfo().getProducts().get(0);
MCCafeProductRedeemVo mcCafeProductRedeemVo = new MCCafeProductRedeemVo();
mcCafeProductRedeemVo.setKeyProductCode(mcdNetCouponProductRespDto.getPid());
mcCafeProductRedeemVo.setCustomer_code(mcdNetCouponProductRespDto.getPid());
mcCafeProductRedeemVo.setConsume_num(mcdNetCouponProductRespDto.getNumber());
mcCafeProductRedeemVo.setSeq(1);
products.add(mcCafeProductRedeemVo);
} catch (Exception e) {
LogUtil.error("获取运费券绑定商品异常,无法核销", mcCafeCouponRequest, mcdNetBatchQueryResponse);
return null;
}
}
} }
MCCafeCouponRequest mcCafeCouponRequest = new MCCafeCouponRequest(); MCCafeCouponRequest mcCafeCouponRequest = new MCCafeCouponRequest();
mcCafeCouponRequest.setVer(Integer.valueOf(Version.VERSION_1)); mcCafeCouponRequest.setVer(Integer.valueOf(Version.VERSION_1));
......
...@@ -187,11 +187,14 @@ public class OrderAdapter { ...@@ -187,11 +187,14 @@ public class OrderAdapter {
.accountType(getQueryOrderAccountType(getOrderAccountType(activityDiscountsDto.getActivityType()))) .accountType(getQueryOrderAccountType(getOrderAccountType(activityDiscountsDto.getActivityType())))
.sequence(orderAccountIndex++) .sequence(orderAccountIndex++)
.build(); .build();
if(mcCafePartnerId.equals(createOrderDto.getCompanyId()) if(mcCafePartnerId.equals(createOrderDto.getCompanyId())) {
&& (ActivityTypeEnum.TYPE_11.getCode().equals(activityDiscountsDto.getActivityType())
|| ActivityTypeEnum.TYPE_12.getCode().equals(activityDiscountsDto.getActivityType()))) {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("tenderId", activityDiscountsDto.getTenderId()); if(ActivityTypeEnum.TYPE_11.getCode().equals(activityDiscountsDto.getActivityType())
|| ActivityTypeEnum.TYPE_12.getCode().equals(activityDiscountsDto.getActivityType())) {
jsonObject.put("tenderId", activityDiscountsDto.getTenderId());
} else if(ActivityTypeEnum.TYPE_34.getCode().equals(activityDiscountsDto.getActivityType())) {
jsonObject.put("customerCode", activityDiscountsDto.getTenderId());
}
createOrderAccountDto.setAddInfo(jsonObject.toJSONString()); createOrderAccountDto.setAddInfo(jsonObject.toJSONString());
} }
orderAccountDtos.add(createOrderAccountDto); orderAccountDtos.add(createOrderAccountDto);
...@@ -2176,9 +2179,9 @@ public class OrderAdapter { ...@@ -2176,9 +2179,9 @@ public class OrderAdapter {
comboProducts.add(createOrderComboProduct); comboProducts.add(createOrderComboProduct);
if(CollectionUtils.isNotEmpty(product.getMaterialList())) { if(CollectionUtils.isNotEmpty(product.getMaterialList())) {
//加料商品 //加料商品
createOrderComboProduct.setProductType(ProductType.MATERIALPRODUCT_UPPRICE.getCode());
List<CreateOrderProductRequest> materialProducts = new ArrayList<>(); List<CreateOrderProductRequest> materialProducts = new ArrayList<>();
product.getMaterialList().forEach(cartMaterial -> { product.getMaterialList().forEach(cartMaterial -> {
product.setProductType(ProductType.MATERIALPRODUCT_UPPRICE.getCode());
materialProducts.add(convent2MCCafeOrderProductDemo(cartMaterial, ProductType.LITTLE_MATERIAL_PRODUCT.getCode())); materialProducts.add(convent2MCCafeOrderProductDemo(cartMaterial, ProductType.LITTLE_MATERIAL_PRODUCT.getCode()));
}); });
createOrderComboProduct.setMaterialProduct(materialProducts); createOrderComboProduct.setMaterialProduct(materialProducts);
...@@ -2187,9 +2190,9 @@ public class OrderAdapter { ...@@ -2187,9 +2190,9 @@ public class OrderAdapter {
createOrderProductDemoDto.setComboProduct(comboProducts); createOrderProductDemoDto.setComboProduct(comboProducts);
} else if(CollectionUtils.isNotEmpty(cartGoodsDetailDto.getMaterialList())) { } else if(CollectionUtils.isNotEmpty(cartGoodsDetailDto.getMaterialList())) {
//加料商品 //加料商品
createOrderProductDemoDto.setProductType(ProductType.MATERIALPRODUCT_UPPRICE.getCode());
List<CreateOrderProductRequest> materialProducts = new ArrayList<>(); List<CreateOrderProductRequest> materialProducts = new ArrayList<>();
cartGoodsDetailDto.getMaterialList().forEach(product -> { cartGoodsDetailDto.getMaterialList().forEach(product -> {
product.setProductType(ProductType.MATERIALPRODUCT_UPPRICE.getCode());
materialProducts.add(convent2MCCafeOrderProductDemo(product, ProductType.LITTLE_MATERIAL_PRODUCT.getCode())); materialProducts.add(convent2MCCafeOrderProductDemo(product, ProductType.LITTLE_MATERIAL_PRODUCT.getCode()));
}); });
createOrderProductDemoDto.setMaterialProduct(materialProducts); createOrderProductDemoDto.setMaterialProduct(materialProducts);
...@@ -2316,6 +2319,9 @@ public class OrderAdapter { ...@@ -2316,6 +2319,9 @@ public class OrderAdapter {
if (ActivityTypeEnum.TYPE_32.getCode().equals(activityType)) { if (ActivityTypeEnum.TYPE_32.getCode().equals(activityType)) {
return OldOrderAccountType.PRODUCT_COUPON; return OldOrderAccountType.PRODUCT_COUPON;
} }
if (ActivityTypeEnum.TYPE_34.getCode().equals(activityType)) {
return OldOrderAccountType.FREIGHT_COUPON;
}
if (ActivityTypeEnum.TYPE_31.getCode().equals(activityType)) { if (ActivityTypeEnum.TYPE_31.getCode().equals(activityType)) {
return OldOrderAccountType.DISCOUNT_COUPON; return OldOrderAccountType.DISCOUNT_COUPON;
} }
......
...@@ -30,6 +30,7 @@ public enum ActivityTypeEnum { ...@@ -30,6 +30,7 @@ public enum ActivityTypeEnum {
TYPE_3(3, "代金券"), TYPE_3(3, "代金券"),
TYPE_31(31, "折扣券"), TYPE_31(31, "折扣券"),
TYPE_32(32, "商品券"), TYPE_32(32, "商品券"),
TYPE_34(34, "运费券"),
TYPE_5(5, "整单满金额折"), TYPE_5(5, "整单满金额折"),
TYPE_51(51, "每满金额折"), TYPE_51(51, "每满金额折"),
TYPE_52(52, "阶梯满金额折"), TYPE_52(52, "阶梯满金额折"),
......
...@@ -549,7 +549,7 @@ public class CheckMCCafeOrder { ...@@ -549,7 +549,7 @@ public class CheckMCCafeOrder {
} }
if(CollectionUtils.isNotEmpty(mcCafeCouponVos)) { if(CollectionUtils.isNotEmpty(mcCafeCouponVos)) {
MCCafeCouponRequest mcCafeCouponRequest = MCCafeCouponRequest.builder() MCCafeCouponRequest mcCafeCouponRequest = MCCafeCouponRequest.builder()
.ver(Integer.valueOf(Version.VERSION_1)) .ver(88)
.reqtype(CouponReqTypeEnum.BATCH_QUERY.getCode()) .reqtype(CouponReqTypeEnum.BATCH_QUERY.getCode())
.partnerId(Integer.parseInt(createOrderVo.getPartnerId())) .partnerId(Integer.parseInt(createOrderVo.getPartnerId()))
.store_id(createOrderVo.getShopId()) .store_id(createOrderVo.getShopId())
...@@ -578,6 +578,9 @@ public class CheckMCCafeOrder { ...@@ -578,6 +578,9 @@ public class CheckMCCafeOrder {
}); });
} }
} }
if(shoppingCartGoodsDto.getDeliveryAmount().longValue() != shoppingCartGoodsDto.getDiscountDeliveryAmount().longValue()) {
shoppingCartGoodsDto.setIsDiscountDelivery(true);
}
return shoppingCartGoodsDto; return shoppingCartGoodsDto;
} }
......
...@@ -426,7 +426,6 @@ public class MCCafeOrderServiceImpl implements MCCafeOrderService { ...@@ -426,7 +426,6 @@ public class MCCafeOrderServiceImpl implements MCCafeOrderService {
if(CollectionUtils.isNotEmpty(productDto.getComboProduct())){ if(CollectionUtils.isNotEmpty(productDto.getComboProduct())){
for (CreateOrderProductRequest comboProduct : productDto.getComboProduct()){ for (CreateOrderProductRequest comboProduct : productDto.getComboProduct()){
String comboSkuId = comboProduct.getSpecification(); String comboSkuId = comboProduct.getSpecification();
System.out.println(comboSkuId);
if (products.get(comboSkuId) != null) { if (products.get(comboSkuId) != null) {
comboProduct.setThirdProductSpecId(products.get(comboSkuId).getThirdProductSpecId()); comboProduct.setThirdProductSpecId(products.get(comboSkuId).getThirdProductSpecId());
comboProduct.setThirdProductPropertyId(getThirdPropertyId(products.get(comboSkuId).getProductAttributeGroupList(),comboProduct.getAddInfo())); comboProduct.setThirdProductPropertyId(getThirdPropertyId(products.get(comboSkuId).getProductAttributeGroupList(),comboProduct.getAddInfo()));
......
...@@ -166,14 +166,15 @@ public class CouponClientServiceImpl implements CouponClientService { ...@@ -166,14 +166,15 @@ public class CouponClientServiceImpl implements CouponClientService {
List<QueryOrdersResponseDto.DataBean.OrderBean.AccountBean> accountList = orderBean.getAccountList().stream().filter( List<QueryOrdersResponseDto.DataBean.OrderBean.AccountBean> accountList = orderBean.getAccountList().stream().filter(
account -> (orderAdapter.getQueryOrderAccountType(OldOrderAccountType.getByCode(account.getType())).equals(QueryOrderAccountType.COUPON) account -> (orderAdapter.getQueryOrderAccountType(OldOrderAccountType.getByCode(account.getType())).equals(QueryOrderAccountType.COUPON)
|| orderAdapter.getQueryOrderAccountType(OldOrderAccountType.getByCode(account.getType())).equals(QueryOrderAccountType.PRODUCT_COUPON) || orderAdapter.getQueryOrderAccountType(OldOrderAccountType.getByCode(account.getType())).equals(QueryOrderAccountType.PRODUCT_COUPON)
|| orderAdapter.getQueryOrderAccountType(OldOrderAccountType.getByCode(account.getType())).equals(QueryOrderAccountType.DISCOUNT_COUPON)) || orderAdapter.getQueryOrderAccountType(OldOrderAccountType.getByCode(account.getType())).equals(QueryOrderAccountType.DISCOUNT_COUPON)
&& account.getPrice() != 0l).collect(Collectors.toList()); || orderAdapter.getQueryOrderAccountType(OldOrderAccountType.getByCode(account.getType())).equals(QueryOrderAccountType.FREIGHT_COUPON))
).collect(Collectors.toList());
if (CollectionUtils.isEmpty(accountList)) { if (CollectionUtils.isEmpty(accountList)) {
return null; return null;
} }
List<MCCafeCouponRequest> list = List<MCCafeCouponRequest> list =
accountList.stream().map(accountBean -> couponAdapter.convert2MCCafeCouponRequest(orderBean, accountBean)).collect(Collectors.toList()); accountList.stream().map(accountBean -> couponAdapter.convert2MCCafeCouponRequest(orderBean, accountBean)).filter(o -> o!=null).collect(Collectors.toList());
List<CouponRedeemResponse> couponRedeemResponseList = new ArrayList<>(); List<CouponRedeemResponse> couponRedeemResponseList = new ArrayList<>();
List<CouponRedeemResponse> couponRedeemResponseListAll = new ArrayList<>(); List<CouponRedeemResponse> couponRedeemResponseListAll = new ArrayList<>();
...@@ -291,7 +292,8 @@ public class CouponClientServiceImpl implements CouponClientService { ...@@ -291,7 +292,8 @@ public class CouponClientServiceImpl implements CouponClientService {
List<QueryOrdersResponseDto.DataBean.OrderBean.AccountBean> accountList = orderBean.getAccountList().stream().filter( List<QueryOrdersResponseDto.DataBean.OrderBean.AccountBean> accountList = orderBean.getAccountList().stream().filter(
account -> (orderAdapter.getQueryOrderAccountType(OldOrderAccountType.getByCode(account.getType())).equals(QueryOrderAccountType.COUPON) account -> (orderAdapter.getQueryOrderAccountType(OldOrderAccountType.getByCode(account.getType())).equals(QueryOrderAccountType.COUPON)
|| orderAdapter.getQueryOrderAccountType(OldOrderAccountType.getByCode(account.getType())).equals(QueryOrderAccountType.PRODUCT_COUPON) || orderAdapter.getQueryOrderAccountType(OldOrderAccountType.getByCode(account.getType())).equals(QueryOrderAccountType.PRODUCT_COUPON)
|| orderAdapter.getQueryOrderAccountType(OldOrderAccountType.getByCode(account.getType())).equals(QueryOrderAccountType.DISCOUNT_COUPON)) && account.getPrice() != 0l).collect(Collectors.toList()); || orderAdapter.getQueryOrderAccountType(OldOrderAccountType.getByCode(account.getType())).equals(QueryOrderAccountType.DISCOUNT_COUPON))
).collect(Collectors.toList());
if (CollectionUtils.isEmpty(accountList)) { if (CollectionUtils.isEmpty(accountList)) {
return null; return null;
} }
......
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
<dependency> <dependency>
<groupId>cn.freemud</groupId> <groupId>cn.freemud</groupId>
<artifactId>assortment-ordercenter-sdk</artifactId> <artifactId>assortment-ordercenter-sdk</artifactId>
<version>2.0.9-RELEASE</version> <version>2.0.17-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
......
...@@ -34,7 +34,8 @@ public class McCafeCouponAdapter { ...@@ -34,7 +34,8 @@ public class McCafeCouponAdapter {
List<QueryOrdersResponse.DataBean.OrderBean.AccountBean> accountList = orderBean.getAccountList().stream().filter( List<QueryOrdersResponse.DataBean.OrderBean.AccountBean> accountList = orderBean.getAccountList().stream().filter(
account -> (getQueryOrderAccountType(OldOrderAccountType.getByCode(account.getType())).equals(QueryOrderAccountType.COUPON) account -> (getQueryOrderAccountType(OldOrderAccountType.getByCode(account.getType())).equals(QueryOrderAccountType.COUPON)
|| getQueryOrderAccountType(OldOrderAccountType.getByCode(account.getType())).equals(QueryOrderAccountType.PRODUCT_COUPON) || getQueryOrderAccountType(OldOrderAccountType.getByCode(account.getType())).equals(QueryOrderAccountType.PRODUCT_COUPON)
|| getQueryOrderAccountType(OldOrderAccountType.getByCode(account.getType())).equals(QueryOrderAccountType.DISCOUNT_COUPON)) && account.getPrice() != 0l).collect(Collectors.toList()); || getQueryOrderAccountType(OldOrderAccountType.getByCode(account.getType())).equals(QueryOrderAccountType.DISCOUNT_COUPON))
).collect(Collectors.toList());
if (CollectionUtils.isEmpty(accountList) ) { if (CollectionUtils.isEmpty(accountList) ) {
return null; return null;
} }
...@@ -124,7 +125,8 @@ public class McCafeCouponAdapter { ...@@ -124,7 +125,8 @@ public class McCafeCouponAdapter {
List<QueryOrdersResponse.DataBean.OrderBean.AccountBean> accountList = orderBean.getAccountList().stream().filter( List<QueryOrdersResponse.DataBean.OrderBean.AccountBean> accountList = orderBean.getAccountList().stream().filter(
account -> (getQueryOrderAccountType(OldOrderAccountType.getByCode(account.getType())).equals(QueryOrderAccountType.COUPON) account -> (getQueryOrderAccountType(OldOrderAccountType.getByCode(account.getType())).equals(QueryOrderAccountType.COUPON)
|| getQueryOrderAccountType(OldOrderAccountType.getByCode(account.getType())).equals(QueryOrderAccountType.PRODUCT_COUPON) || getQueryOrderAccountType(OldOrderAccountType.getByCode(account.getType())).equals(QueryOrderAccountType.PRODUCT_COUPON)
|| getQueryOrderAccountType(OldOrderAccountType.getByCode(account.getType())).equals(QueryOrderAccountType.DISCOUNT_COUPON)) && account.getPrice() != 0l).collect(Collectors.toList()); || getQueryOrderAccountType(OldOrderAccountType.getByCode(account.getType())).equals(QueryOrderAccountType.DISCOUNT_COUPON))
).collect(Collectors.toList());
if (CollectionUtils.isEmpty(accountList) ) { if (CollectionUtils.isEmpty(accountList) ) {
return null; return null;
} }
......
...@@ -98,6 +98,8 @@ public class McdNetCouponInfoRespDto { ...@@ -98,6 +98,8 @@ public class McdNetCouponInfoRespDto {
* 券状态 * 券状态
*/ */
private Integer status; private Integer status;
private Integer extend_type;
/** /**
* 只有商品券时返回 * 只有商品券时返回
*/ */
......
...@@ -23,6 +23,13 @@ public class McdNetCouponProductRespDto { ...@@ -23,6 +23,13 @@ public class McdNetCouponProductRespDto {
private String mcd_productCode; private String mcd_productCode;
/** /**
* 开个店商品id
*/
private String sku_id;
private String spu_id;
/**
* 商品名称 * 商品名称
*/ */
private String name; private String name;
......
...@@ -129,4 +129,9 @@ public class ShoppingCartGoodsResponseVo extends ShoppingCartGoodsBaseResponseV ...@@ -129,4 +129,9 @@ public class ShoppingCartGoodsResponseVo extends ShoppingCartGoodsBaseResponseV
* 代金券 * 代金券
*/ */
private String couponCode; private String couponCode;
/**
* 运费券
*/
private String freightCouponCode;
} }
...@@ -116,7 +116,7 @@ public class ShoppingCartInfoRequestVo extends BaseRequestVo { ...@@ -116,7 +116,7 @@ public class ShoppingCartInfoRequestVo extends BaseRequestVo {
} }
/** /**
* 运费卡券 * 运费券code
*/ */
private String freightCouponCode; private String freightCouponCode;
......
...@@ -136,8 +136,9 @@ public class AssortmentSdkService { ...@@ -136,8 +136,9 @@ public class AssortmentSdkService {
* @param useId * @param useId
* @return * @return
*/ */
public String getShoppingCartCoupon(String partnerId, String storeId, String useId, ShoppingCartBaseService shoppingCartService) { public String getShoppingCartCoupon(String partnerId, String storeId, String useId, ShoppingCartBaseService shoppingCartService, Integer type) {
com.freemud.sdk.api.assortment.shoppingcart.domain.CartParamDto cartParamDto = getCartParamDto(partnerId, storeId, useId); com.freemud.sdk.api.assortment.shoppingcart.domain.CartParamDto cartParamDto = getCartParamDto(partnerId, storeId, useId);
cartParamDto.setCouponType(type);
BaseResponse<String> baseResponse = shoppingCartService.getCartCouponCode(cartParamDto, LogThreadLocal.getTrackingNo()); BaseResponse<String> baseResponse = shoppingCartService.getCartCouponCode(cartParamDto, LogThreadLocal.getTrackingNo());
if (baseResponse == null || !ResponseResult.SUCCESS.getCode().equals(baseResponse.getCode()) || StringUtils.isEmpty(baseResponse.getResult())) { if (baseResponse == null || !ResponseResult.SUCCESS.getCode().equals(baseResponse.getCode()) || StringUtils.isEmpty(baseResponse.getResult())) {
...@@ -176,9 +177,10 @@ public class AssortmentSdkService { ...@@ -176,9 +177,10 @@ public class AssortmentSdkService {
* @param useId * @param useId
* @return * @return
*/ */
public List<CartGoods> setShoppingCartCouponCode(String partnerId, String storeId, String useId, String couponCode, ShoppingCartBaseService shoppingCartService) { public List<CartGoods> setShoppingCartCouponCode(String partnerId, String storeId, String useId, String couponCode, ShoppingCartBaseService shoppingCartService, Integer type) {
com.freemud.sdk.api.assortment.shoppingcart.domain.CartParamDto cartParamDto = getCartParamDto(partnerId, storeId, useId); com.freemud.sdk.api.assortment.shoppingcart.domain.CartParamDto cartParamDto = getCartParamDto(partnerId, storeId, useId);
cartParamDto.setCouponCode(couponCode); cartParamDto.setCouponCode(couponCode);
cartParamDto.setCouponType(type);
BaseResponse<String> baseResponse = shoppingCartService.setCartCouponCode(cartParamDto, LogThreadLocal.getTrackingNo()); BaseResponse<String> baseResponse = shoppingCartService.setCartCouponCode(cartParamDto, LogThreadLocal.getTrackingNo());
if (baseResponse == null || !ResponseResult.SUCCESS.getCode().equals(baseResponse.getCode())) { if (baseResponse == null || !ResponseResult.SUCCESS.getCode().equals(baseResponse.getCode())) {
return null; return null;
......
...@@ -47,6 +47,7 @@ import com.freemud.sdk.api.assortment.shoppingcart.constant.CartResponseConstant ...@@ -47,6 +47,7 @@ import com.freemud.sdk.api.assortment.shoppingcart.constant.CartResponseConstant
import com.freemud.sdk.api.assortment.shoppingcart.constant.CommonsConstant; import com.freemud.sdk.api.assortment.shoppingcart.constant.CommonsConstant;
import com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoodsStates; import com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoodsStates;
import com.freemud.sdk.api.assortment.shoppingcart.enums.BusinessTypeEnum; import com.freemud.sdk.api.assortment.shoppingcart.enums.BusinessTypeEnum;
import com.freemud.sdk.api.assortment.shoppingcart.enums.SaveCouponType;
import com.freemud.sdk.api.assortment.shoppingcart.request.CheckCartRequest; import com.freemud.sdk.api.assortment.shoppingcart.request.CheckCartRequest;
import com.freemud.sdk.api.assortment.shoppingcart.service.ShoppingCartBaseService; import com.freemud.sdk.api.assortment.shoppingcart.service.ShoppingCartBaseService;
import com.freemud.sdk.api.assortment.shoppingcart.service.impl.ShoppingCartBaseServiceImpl; import com.freemud.sdk.api.assortment.shoppingcart.service.impl.ShoppingCartBaseServiceImpl;
...@@ -320,6 +321,7 @@ public class ShoppingCartMCoffeeServiceImpl { ...@@ -320,6 +321,7 @@ public class ShoppingCartMCoffeeServiceImpl {
String storeId = shoppingCartInfoRequestVo.getShopId(); String storeId = shoppingCartInfoRequestVo.getShopId();
String appId = shoppingCartInfoRequestVo.getAppId(); String appId = shoppingCartInfoRequestVo.getAppId();
String couponCode = shoppingCartInfoRequestVo.getCouponCode(); String couponCode = shoppingCartInfoRequestVo.getCouponCode();
String freightCouponCode = shoppingCartInfoRequestVo.getFreightCouponCode();
// String activityCode = shoppingCartInfoRequestVo.getActivityCode(); // String activityCode = shoppingCartInfoRequestVo.getActivityCode();
String menuType = shoppingCartInfoRequestVo.getMenuType(); String menuType = shoppingCartInfoRequestVo.getMenuType();
Integer orderType = shoppingCartInfoRequestVo.getOrderType(); Integer orderType = shoppingCartInfoRequestVo.getOrderType();
...@@ -340,25 +342,50 @@ public class ShoppingCartMCoffeeServiceImpl { ...@@ -340,25 +342,50 @@ public class ShoppingCartMCoffeeServiceImpl {
* 如果couponCode为空,则从缓存里尝试获取 * 如果couponCode为空,则从缓存里尝试获取
* 如果couponCode不为空,则设置到缓存里 * 如果couponCode不为空,则设置到缓存里
*/ */
// if(StringUtils.isEmpty(couponCode)) { // List<String> couponList = new ArrayList<>();
// couponCode = assortmentSdkService.getShoppingCartCoupon(partnerId, storeId, userId, shoppingCartBaseService); if(StringUtils.isEmpty(couponCode)) {
couponCode = assortmentSdkService.getShoppingCartCoupon(partnerId, storeId, userId, shoppingCartBaseService, SaveCouponType.COUPON.getCode());
// if(StringUtils.isNotEmpty(couponCode)) { // if(StringUtils.isNotEmpty(couponCode)) {
// List<CouponState> couponStates = couponDiscountCalculation.buildAvailableCoupons(cartGoodsList, partnerId, storeId, Lists.newArrayList(couponCode)); // couponList.add(couponCode);
// if(CollectionUtils.isNotEmpty(couponStates)) { // }
// if(Objects.equals(couponStates.get(0).getState(), CouponStateEnum.STATE_1.getCode())) { } else {
// couponCode = ""; if("remove".equals(couponCode)) {
// } couponCode = "";
// } else { }
assortmentSdkService.setShoppingCartCouponCode(partnerId, storeId, userId, couponCode, shoppingCartBaseService, SaveCouponType.COUPON.getCode());
}
if(StringUtils.isEmpty(freightCouponCode)) {
freightCouponCode = assortmentSdkService.getShoppingCartCoupon(partnerId, storeId, userId, shoppingCartBaseService, SaveCouponType.FREIGHT_COUPON.getCode());
// if(StringUtils.isNotEmpty(freightCouponCode)) {
// couponList.add(freightCouponCode);
// }
} else {
if("remove".equals(freightCouponCode)) {
freightCouponCode = "";
}
assortmentSdkService.setShoppingCartCouponCode(partnerId, storeId, userId, freightCouponCode, shoppingCartBaseService, SaveCouponType.FREIGHT_COUPON.getCode());
}
//校验代金券和运费券是否可用
// if(CollectionUtils.isNotEmpty(couponList)) {
// List<CouponState> couponStates = couponDiscountCalculation.buildAvailableCoupons(cartGoodsList, partnerId, storeId, couponList);
// if(CollectionUtils.isNotEmpty(couponStates)) {
// Map<String, Integer> couponStateMap = couponStates.stream().collect(Collectors.toMap(CouponState::getCouponCode, CouponState::getState, (k1, k2) -> k1));
// if(null == couponStateMap.get(couponCode) || Objects.equals(couponStateMap.get(couponCode), CouponStateEnum.STATE_1.getCode())) {
// couponCode = ""; // couponCode = "";
// } // }
// } // if(null == couponStateMap.get(freightCouponCode) || Objects.equals(couponStateMap.get(freightCouponCode), CouponStateEnum.STATE_1.getCode())) {
// } else { // freightCouponCode = "";
// if("remove".equals(couponCode)) { // }
// } else {
// couponCode = ""; // couponCode = "";
// freightCouponCode = "";
// } // }
// assortmentSdkService.setShoppingCartCouponCode(partnerId, storeId, userId, couponCode, shoppingCartBaseService);
// } // }
shoppingCartInfoRequestVo.setFreightCouponCode(freightCouponCode);
// 当couponCode不为空时,需参与价格计算 // 当couponCode不为空时,需参与价格计算
List<ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon> coupons = getCoupon(couponCode, null, cartGoodsList,shoppingCartInfoRequestVo.getFreightCouponCode()); List<ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon> coupons = getCoupon(couponCode, null, cartGoodsList,shoppingCartInfoRequestVo.getFreightCouponCode());
...@@ -369,6 +396,7 @@ public class ShoppingCartMCoffeeServiceImpl { ...@@ -369,6 +396,7 @@ public class ShoppingCartMCoffeeServiceImpl {
setAddAndUpdateResponse(shoppingCartGoodsResponseVo, cartGoodsList, shoppingCartGoodsResponseVo.getToastMsg(), ShoppingCartConstant.QUERY_INFO, shoppingCartInfoRequestVo); setAddAndUpdateResponse(shoppingCartGoodsResponseVo, cartGoodsList, shoppingCartGoodsResponseVo.getToastMsg(), ShoppingCartConstant.QUERY_INFO, shoppingCartInfoRequestVo);
shoppingCartGoodsResponseVo.setCouponCode(couponCode); shoppingCartGoodsResponseVo.setCouponCode(couponCode);
shoppingCartGoodsResponseVo.setFreightCouponCode(freightCouponCode);
return ResponseUtil.success(shoppingCartGoodsResponseVo); return ResponseUtil.success(shoppingCartGoodsResponseVo);
} }
......
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