Commit 3d07ca58 by 周晓航

Merge branch 'KA-【华莱士】【半定制】一个订单多张优惠券使用场景-zxh' into qa

# Conflicts:
#	shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
parents 95a7e68d 3c9cb86b
...@@ -32,8 +32,10 @@ import cn.freemud.management.entities.dto.request.order.MCCafeProductRedeemVo; ...@@ -32,8 +32,10 @@ import cn.freemud.management.entities.dto.request.order.MCCafeProductRedeemVo;
import cn.freemud.management.entities.dto.request.order.MCCafeTransactionVo; import cn.freemud.management.entities.dto.request.order.MCCafeTransactionVo;
import cn.freemud.management.entities.dto.response.coupon.McdNetBatchQueryResponse; import cn.freemud.management.entities.dto.response.coupon.McdNetBatchQueryResponse;
import cn.freemud.management.entities.dto.response.coupon.McdNetCouponProductRespDto; import cn.freemud.management.entities.dto.response.coupon.McdNetCouponProductRespDto;
import cn.freemud.management.enums.OrderSource;
import cn.freemud.service.mccafe.CouponClientService; import cn.freemud.service.mccafe.CouponClientService;
import cn.freemud.utils.BeanUtil; import cn.freemud.utils.BeanUtil;
import cn.freemud.utils.PropertyConvertUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.freemud.application.sdk.api.ordercenter.entities.v1.AccountBeanV1; import com.freemud.application.sdk.api.ordercenter.entities.v1.AccountBeanV1;
import com.freemud.application.sdk.api.ordercenter.entities.v1.OrderBeanV1; import com.freemud.application.sdk.api.ordercenter.entities.v1.OrderBeanV1;
...@@ -787,4 +789,91 @@ public class CouponAdapter { ...@@ -787,4 +789,91 @@ public class CouponAdapter {
return mcCafeCouponLockRequest; return mcCafeCouponLockRequest;
} }
/**
* 新版本 支持多券 批量核销操作
* @param orderBean
* @param couponReqType
* @return
*/
public CouponCodeVerificationDto convert2CouponCodeVerificationDto(OrderBeanV1 orderBean, CouponReqType couponReqType) {
CouponCodeVerificationDto couponCodeVerificationDto = new CouponCodeVerificationDto();
couponCodeVerificationDto.setVer(Integer.valueOf(Version.VERSION_1));
couponCodeVerificationDto.setReqtype(couponReqType.getCode());
couponCodeVerificationDto.setPartnerId(orderBean.getCompanyId());
Integer orderType = orderBean.getType();
//商城单子用NewOrderType
if (Objects.equals(OrderSource.MALL.getSource(), orderBean.getSource())) {
orderType = orderBean.getNewOrderType();
}
ActivityChannelEnum activityChannelEnum = PropertyConvertUtil.orderTypeEnumConvert2ActivityChannel(orderType);
if (activityChannelEnum == null) {
activityChannelEnum = ActivityChannelEnum.pickup;
}
couponCodeVerificationDto.setChannel(activityChannelEnum.getCode());
couponCodeVerificationDto.setStation_id("-1");
couponCodeVerificationDto.setOperator_id("-1");
couponCodeVerificationDto.setStore_id(orderBean.getShopId());
couponCodeVerificationDto.setMemberId(orderBean.getUserId());
// 订单号 替换成唯一序号
couponCodeVerificationDto.setTrans_id(orderBean.getOid());
couponCodeVerificationDto.setBusiness_date(DateUtil.convert2Str(new Date(), DateUtil.FORMAT_yyyyMMdd));
List<CouponCodeVerificationTransDto> transactions = this.getTransactions(orderBean, couponCodeVerificationDto);
couponCodeVerificationDto.setTransactions(transactions);
return couponCodeVerificationDto;
}
/**
* 组装核销 参数
* @param orderBean
* @return
*/
private List<CouponCodeVerificationTransDto> getTransactions(OrderBeanV1 orderBean, CouponCodeVerificationDto couponCodeVerificationDto) {
List<AccountBeanV1> accountList = orderBean.getAccountList();
List<CouponCodeVerificationTransDto> transactions = new ArrayList<>();
long price = 0L;
for (AccountBeanV1 accountBean : accountList) {
if (OrderAccountType.verificationCoupon.contains(accountBean.getType())) {
List<CouponCodeVerificationProductDto> products = new ArrayList<>();
if (OrderAccountType.PRODUCT_COUPON.getCode().equals(accountBean.getType())) {
for (int i = 0; i < orderBean.getProductList().size(); i++) {
ProductBeanV1 productBean = orderBean.getProductList().get(i);
String pid = StringUtils.isNotBlank(productBean.getSpecification()) ? productBean.getSpecification() : productBean.getProductId();
if (!org.springframework.util.CollectionUtils.isEmpty(orderBean.getProductList().get(i).getDiscountList())) {
List<ProductDiscountV1> discounts = orderBean.getProductList().get(i).getDiscountList().stream().
filter(productDiscount -> productDiscount.getDiscountId().equals(accountBean.getAccountId())).collect(Collectors.toList());
for (ProductDiscountV1 productDiscount : discounts) {
if (productDiscount.getDiscountType() == null || productDiscount.getDiscountType() == 0) {
continue;
}
CouponCodeVerificationProductDto couponCodeVerificationProductDto = new CouponCodeVerificationProductDto();
couponCodeVerificationProductDto.setPID(pid);
couponCodeVerificationProductDto.setConsume_num(productDiscount.getDiscountQty());
couponCodeVerificationProductDto.setSeq(i + 1);
couponCodeVerificationProductDto.setRedeem_price(new BigDecimal(productBean.getPrice()));
products.add(couponCodeVerificationProductDto);
}
}
}
}
CouponCodeVerificationTransDto couponCodeVerificationTransDto = new CouponCodeVerificationTransDto();
if (!products.isEmpty()) {
couponCodeVerificationTransDto.setProducts(products);
}
couponCodeVerificationTransDto.setCode(accountBean.getAccountId());
Long discountPriceL = accountBean.getPrice();
if (discountPriceL != null) {
int abs = Math.abs(discountPriceL.intValue());
couponCodeVerificationTransDto.setTotalAmount(abs);
price += abs;
}
transactions.add(couponCodeVerificationTransDto);
}
}
// KA 【ID1032412】【订单聚合层】核销传入优惠金额之传劵优惠只设置券的优惠金额进行上报
couponCodeVerificationDto.setOrderDiscountAmount(price);
return transactions;
}
} }
...@@ -1463,7 +1463,9 @@ public class OrderAdapter { ...@@ -1463,7 +1463,9 @@ public class OrderAdapter {
//积分抵扣金额 //积分抵扣金额
Long customerScoreAmount = 0L; Long customerScoreAmount = 0L;
String customerScorePrompt = null; String customerScorePrompt = null;
List<CouponInfoVo> couponInfos = new ArrayList<>();
if (CollectionUtils.isNotEmpty(ordersBean.getAccountList())) { if (CollectionUtils.isNotEmpty(ordersBean.getAccountList())) {
// fisherman 组装一单多券 使用的券信息
for (AccountBeanV1 accountBean : ordersBean.getAccountList()) { for (AccountBeanV1 accountBean : ordersBean.getAccountList()) {
if (accountBean.getPrice() < 0 && !OldOrderAccountType.MONTH_CARD_TOTAL_DISCOUNT.getCode().equals(accountBean.getType())) { if (accountBean.getPrice() < 0 && !OldOrderAccountType.MONTH_CARD_TOTAL_DISCOUNT.getCode().equals(accountBean.getType())) {
discountTotalAmount = discountTotalAmount + (0 - accountBean.getPrice()); discountTotalAmount = discountTotalAmount + (0 - accountBean.getPrice());
...@@ -1494,6 +1496,7 @@ public class OrderAdapter { ...@@ -1494,6 +1496,7 @@ public class OrderAdapter {
couponInfoVo.setCouponCode(accountBean.getAccountId()); couponInfoVo.setCouponCode(accountBean.getAccountId());
couponInfoVo.setCouponName(accountBean.getName()); couponInfoVo.setCouponName(accountBean.getName());
couponInfoVo.setCouponAmount(accountBean.getPrice() < 0 ? 0 - accountBean.getPrice() : accountBean.getPrice()); couponInfoVo.setCouponAmount(accountBean.getPrice() < 0 ? 0 - accountBean.getPrice() : accountBean.getPrice());
// fisherman 后续已维护到 couponinfos ,请停止维护 该字段
responseVo.setCouponInfo(couponInfoVo); responseVo.setCouponInfo(couponInfoVo);
couponAmount = accountBean.getPrice() < 0 ? 0 - accountBean.getPrice() : accountBean.getPrice(); couponAmount = accountBean.getPrice() < 0 ? 0 - accountBean.getPrice() : accountBean.getPrice();
} }
...@@ -1510,8 +1513,16 @@ public class OrderAdapter { ...@@ -1510,8 +1513,16 @@ public class OrderAdapter {
if (OldOrderAccountType.FREIGHT_COUPON.getCode().equals(accountBean.getType())) { if (OldOrderAccountType.FREIGHT_COUPON.getCode().equals(accountBean.getType())) {
responseVo.setFreightCouponName(accountBean.getName()); responseVo.setFreightCouponName(accountBean.getName());
} }
if (OrderAccountType.verificationCoupon.contains(accountBean.getType())) {
CouponInfoVo couponInfoVo = new CouponInfoVo();
couponInfoVo.setCouponCode(accountBean.getAccountId());
couponInfoVo.setCouponName(accountBean.getName());
couponInfoVo.setCouponAmount(Math.abs(accountBean.getPrice()));
couponInfos.add(couponInfoVo);
}
} }
} }
responseVo.setCouponInfos(couponInfos);
responseVo.setDeliveryAmount(deliveryAmount); responseVo.setDeliveryAmount(deliveryAmount);
responseVo.setOriginalDeliveryAmount(originalDeliveryAmount); responseVo.setOriginalDeliveryAmount(originalDeliveryAmount);
responseVo.setPackageAmount(packageAmount); responseVo.setPackageAmount(packageAmount);
......
...@@ -16,7 +16,6 @@ import cn.freemud.entities.dto.PromotionMessageDto; ...@@ -16,7 +16,6 @@ import cn.freemud.entities.dto.PromotionMessageDto;
import cn.freemud.entities.dto.activity.PayGiftCheckAndJoinResponseDto; import cn.freemud.entities.dto.activity.PayGiftCheckAndJoinResponseDto;
import cn.freemud.entities.dto.activity.PayGiftCheckAndJoinResponseDtoNew; import cn.freemud.entities.dto.activity.PayGiftCheckAndJoinResponseDtoNew;
import cn.freemud.entities.dto.promotion.QueryHistoryGroupVO; import cn.freemud.entities.dto.promotion.QueryHistoryGroupVO;
import cn.freemud.entities.dto.promotion.QuerySpellGroupVo;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import com.freemud.application.sdk.api.ordercenter.response.orderInfo.AfterSalesOrderResp; import com.freemud.application.sdk.api.ordercenter.response.orderInfo.AfterSalesOrderResp;
...@@ -357,6 +356,8 @@ public class QueryOrderResponseVo { ...@@ -357,6 +356,8 @@ public class QueryOrderResponseVo {
/** /**
* 优惠券信息 * 优惠券信息
* 后续优惠券信息 以维护到 couponInfos 请停止使用该字段 20211026
* 记得和前端对接下 小程序版本 是否支持 couponInfos
*/ */
private CouponInfoVo couponInfo; private CouponInfoVo couponInfo;
...@@ -665,4 +666,12 @@ public class QueryOrderResponseVo { ...@@ -665,4 +666,12 @@ public class QueryOrderResponseVo {
//是否已开票,true已开票,默认false未开票 //是否已开票,true已开票,默认false未开票
private Boolean needInvoice; private Boolean needInvoice;
/**
* 可使用多张优惠券, 使用该字段展示所有使用的优惠券信息
* 包括 :
* cn.freemud.enums.OrderAccountType#verificationCoupon
* 后续 需要移除 该类里面的 couponinfo字段, 20211026
*/
private List<CouponInfoVo> couponInfos = new ArrayList<>();
} }
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
package cn.freemud.service.coupon.impl; package cn.freemud.service.coupon.impl;
import cn.freemud.adapter.CouponAdapter; import cn.freemud.adapter.CouponAdapter;
import cn.freemud.amp.body.OrderBody;
import cn.freemud.amqp.Header; import cn.freemud.amqp.Header;
import cn.freemud.amqp.MQAction; import cn.freemud.amqp.MQAction;
import cn.freemud.amqp.MQMessage; import cn.freemud.amqp.MQMessage;
...@@ -80,28 +81,30 @@ public class PlatformCouponRelationServiceImpl implements CouponRelationService ...@@ -80,28 +81,30 @@ public class PlatformCouponRelationServiceImpl implements CouponRelationService
@Override @Override
public BaseResponse verificationCoupon(List<AccountBeanV1> accountList, OrderBeanV1 orderBean, CouponReqType couponReqType) { public BaseResponse verificationCoupon(List<AccountBeanV1> accountList, OrderBeanV1 orderBean, CouponReqType couponReqType) {
// AppLogUtil.infoLog("fiserhman 券码核销 begin", JSON.toJSONString(accountList), JSON.toJSONString(orderBean));
if (CollectionUtils.isEmpty(accountList)) { if (CollectionUtils.isEmpty(accountList)) {
return ResponseUtil.success(); return ResponseUtil.success();
} }
// 需要判断 accountList 里面 是都 同时包含 配送券+ other券 // fisherman 【01测16灰18全,【华莱士】【疑难专项】一个订单多张优惠券使用场景】 https://www.tapd.cn/43862731/prong/stories/view/1143862731001037477
boolean isDoubleCoupon = checkAccountList(accountList); BaseResponse baseResponse = this.batchCouponHandle(orderBean, couponReqType);
if (isDoubleCoupon) { return baseResponse;
Integer code = OrderAccountType.FREIGHT_COUPON.getCode(); // // 需要判断 accountList 里面 是都 同时包含 配送券+ other券
// 运费券 塞进 核销接口里面, 这里真的是贼恶心 逻辑不敢动 // boolean isDoubleCoupon = checkAccountList(accountList);
AccountBeanV1 freightCouponAccountBean = accountList.stream().filter(accountBean -> code.equals(accountBean.getType())).findFirst().orElse(null); // if (isDoubleCoupon) {
CouponCodeVerificationTransDto couponCodeVerificationTransDto = null; // Integer code = OrderAccountType.FREIGHT_COUPON.getCode();
if (!Objects.isNull(freightCouponAccountBean)) { // // 运费券 塞进 核销接口里面, 这里真的是贼恶心 逻辑不敢动
couponCodeVerificationTransDto = new CouponCodeVerificationTransDto(); // AccountBeanV1 freightCouponAccountBean = accountList.stream().filter(accountBean -> code.equals(accountBean.getType())).findFirst().orElse(null);
couponCodeVerificationTransDto.setCode(freightCouponAccountBean.getAccountId()); // CouponCodeVerificationTransDto couponCodeVerificationTransDto = null;
couponCodeVerificationTransDto.setTotalAmount(freightCouponAccountBean.getPrice().intValue()); // if (!Objects.isNull(freightCouponAccountBean)) {
} // couponCodeVerificationTransDto = new CouponCodeVerificationTransDto();
// 过滤出配送券 // couponCodeVerificationTransDto.setCode(freightCouponAccountBean.getAccountId());
List<AccountBeanV1> collect = accountList.stream().filter(accountBean -> !code.equals(accountBean.getType())).collect(Collectors.toList()); // couponCodeVerificationTransDto.setTotalAmount(freightCouponAccountBean.getPrice().intValue());
return commonMethodVerification(couponCodeVerificationTransDto, collect, orderBean, couponReqType); // }
} else { // // 过滤出配送券
return commonMethodVerification(null, accountList, orderBean, couponReqType); // List<AccountBeanV1> collect = accountList.stream().filter(accountBean -> !code.equals(accountBean.getType())).collect(Collectors.toList());
} // return commonMethodVerification(couponCodeVerificationTransDto, collect, orderBean, couponReqType);
// } else {
// return commonMethodVerification(null, accountList, orderBean, couponReqType);
// }
} }
/** /**
...@@ -237,6 +240,47 @@ public class PlatformCouponRelationServiceImpl implements CouponRelationService ...@@ -237,6 +240,47 @@ public class PlatformCouponRelationServiceImpl implements CouponRelationService
return ResponseUtil.success(); return ResponseUtil.success();
} }
/**
* 单笔订单 多券核销
* @param orderBean
* @param couponReqType
* @return
*/
private BaseResponse batchCouponHandle(OrderBeanV1 orderBean, CouponReqType couponReqType) {
CouponCodeVerificationDto couponCodeVerificationDto = couponAdapter.convert2CouponCodeVerificationDto(orderBean, couponReqType);
if (Objects.isNull(couponCodeVerificationDto) || couponCodeVerificationDto.getTransactions().isEmpty()) {
return ResponseUtil.success();
}
couponCodeVerificationDto.setOrderTotalAmount(orderBean.getOriginalAmount() == null ? 0L : orderBean.getOriginalAmount().longValue());
couponCodeVerificationDto.setOrderPaymentAmount(orderBean.getAmount());
// 核销券新增参数:组织机构ID
couponCodeVerificationDto.setChannel_ids(storeService.getOrgIdsArr(orderBean.getCompanyId(), orderBean.getShopId()));
boolean ok = false;
Exception lastException = null;
CouponCodeResponseDto couponCodeResponseDto = null;
try {
couponCodeResponseDto = couponOfflineClient.verification(couponCodeVerificationDto);
ThirdPartyLog.infoConvertJson(System.currentTimeMillis(), System.currentTimeMillis(), "/api", couponCodeVerificationDto, couponCodeResponseDto);
if (Objects.nonNull(couponCodeResponseDto) && Objects.equals(couponCodeResponseDto.getStatusCode(), ResponseResult.SUCCESS.getCode())) {
ok = true;
}
} catch (Exception ex) {
lastException = ex;
ErrorLog.printErrorLog("verification_error", "/api", couponCodeVerificationDto, ex);
}
if (lastException != null) {
sendMessage(orderBean, LogThreadLocal.getTrackingNo(), couponCodeVerificationDto, lastException);
} else if (!ok || Objects.equals(baffleOpen, true)) {
sendMessage(orderBean, LogThreadLocal.getTrackingNo(), couponCodeVerificationDto, ok ? "模拟券核销失败" : couponCodeResponseDto);
}
if (!ok) {
emailAlertService.sendEmailAlert("核销券码失败", String.format("request:%s \r\nresponse:%s", JSONObject.toJSONString(couponCodeVerificationDto), JSONObject.toJSONString(lastException == null ? couponCodeResponseDto : lastException)));
return ResponseUtil.error(ResponseResult.COUPON_VERIFICATION_FAIL);
}
return ResponseUtil.success();
}
/** /**
* 发送消息 * 发送消息
......
...@@ -283,6 +283,17 @@ public class ShoppingCartController { ...@@ -283,6 +283,17 @@ public class ShoppingCartController {
return SDKCommonBaseContextWare.getBean(ShoppingCartNewServiceImpl.class).replaceGoodsByShop(request); return SDKCommonBaseContextWare.getBean(ShoppingCartNewServiceImpl.class).replaceGoodsByShop(request);
} }
/**
* 一单多券
* 券码需要知道配置的数据 是否是V3算价
*
*/
@PostMapping(value = "/getV3Promotion")
@ApiAnnotation(logMessage = "/getV3Promotion")
public BaseResponse getV3Promotion(@LogParams @RequestBody @Validated BaseRequestVo request) {
return SDKCommonBaseContextWare.getBean(ShoppingCartNewServiceImpl.class).getV3Promotion(request);
}
@Autowired @Autowired
private ShoppingCartBaseServiceImpl shoppingCartService; private ShoppingCartBaseServiceImpl shoppingCartService;
......
...@@ -5,7 +5,7 @@ import lombok.NoArgsConstructor; ...@@ -5,7 +5,7 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor @NoArgsConstructor
@Data @Data
public class ActivityBaseResponseDto { public class ActivityBaseResponseDto<T> {
private int ver; private int ver;
/** /**
...@@ -14,9 +14,9 @@ public class ActivityBaseResponseDto { ...@@ -14,9 +14,9 @@ public class ActivityBaseResponseDto {
private String statusCode; private String statusCode;
/** /**
*状态码描述 * 状态码描述
*/ */
private String msg; private String msg;
private T result;
} }
package cn.freemud.entities.dto.shoppingCart;
import lombok.Data;
/**
* @author : xh.Z
* @email : fisherman0510@163.com
* @Date : 2021/10/20 上午11:32
* @description :
*/
@Data
public class PromotionResultVO {
private boolean v3Promotion;
}
...@@ -315,4 +315,6 @@ public interface ShoppingCartNewService { ...@@ -315,4 +315,6 @@ public interface ShoppingCartNewService {
default BaseResponse<PremiumExchangeResponseVo> premiumExchange(PremiumExchangeRequestVo request){ default BaseResponse<PremiumExchangeResponseVo> premiumExchange(PremiumExchangeRequestVo request){
return null; return null;
}; };
BaseResponse getV3Promotion(BaseRequestVo request);
} }
...@@ -940,6 +940,11 @@ public class ShoppingCartCollageServiceImpl extends AbstractShoppingCartImpl imp ...@@ -940,6 +940,11 @@ public class ShoppingCartCollageServiceImpl extends AbstractShoppingCartImpl imp
return nowCartGoodsList; return nowCartGoodsList;
} }
@Override
public BaseResponse getV3Promotion(BaseRequestVo request) {
return null;
}
public List<CartGoods> getShoppingCart(AddShoppingCartGoodsRequestVo addShoppingCartGoodsRequestVo) { public List<CartGoods> getShoppingCart(AddShoppingCartGoodsRequestVo addShoppingCartGoodsRequestVo) {
return null; return null;
} }
......
...@@ -780,6 +780,11 @@ public class ShoppingCartMallServiceImpl implements ShoppingCartNewService { ...@@ -780,6 +780,11 @@ public class ShoppingCartMallServiceImpl implements ShoppingCartNewService {
return nowCartGoodsList; return nowCartGoodsList;
} }
@Override
public BaseResponse getV3Promotion(BaseRequestVo request) {
return null;
}
/** /**
* 添加非商品券商品 * 添加非商品券商品
* *
......
...@@ -678,6 +678,11 @@ public class ShoppingCartMealServiceImpl implements ShoppingCartNewService { ...@@ -678,6 +678,11 @@ public class ShoppingCartMealServiceImpl implements ShoppingCartNewService {
return oldAllCartGoodsList; return oldAllCartGoodsList;
} }
@Override
public BaseResponse getV3Promotion(BaseRequestVo request) {
return null;
}
private void checkBase(CustomerInfoVo assortmentCustomerInfoVo) { private void checkBase(CustomerInfoVo assortmentCustomerInfoVo) {
if (assortmentCustomerInfoVo == null || assortmentCustomerInfoVo.getMemberId() == null) { if (assortmentCustomerInfoVo == null || assortmentCustomerInfoVo.getMemberId() == null) {
......
...@@ -35,6 +35,7 @@ import cn.freemud.entities.dto.openplatform.WeixinProductRequestDto; ...@@ -35,6 +35,7 @@ import cn.freemud.entities.dto.openplatform.WeixinProductRequestDto;
import cn.freemud.entities.dto.openplatform.WeixinProductResponseDto; import cn.freemud.entities.dto.openplatform.WeixinProductResponseDto;
import cn.freemud.entities.dto.pay.*; import cn.freemud.entities.dto.pay.*;
import cn.freemud.entities.dto.product.CheckCartRequest; import cn.freemud.entities.dto.product.CheckCartRequest;
import cn.freemud.entities.dto.shoppingCart.PromotionResultVO;
import cn.freemud.entities.dto.shoppingCart.SendPoint; import cn.freemud.entities.dto.shoppingCart.SendPoint;
import cn.freemud.entities.dto.shoppingCart.ShoppingCartGoodsDto; import cn.freemud.entities.dto.shoppingCart.ShoppingCartGoodsDto;
import cn.freemud.entities.dto.user.*; import cn.freemud.entities.dto.user.*;
...@@ -3193,6 +3194,19 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -3193,6 +3194,19 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
} }
@Override
public BaseResponse getV3Promotion(BaseRequestVo request) {
boolean grayPush = grayPush(request.getPartnerId(), request.getShopId(), "2");
PromotionResultVO vo = new PromotionResultVO();
if (grayPush) {
ActivityBaseResponseDto<PromotionResultVO> responseDto = activityClient.getV3Promotion(request);
if (responseDto != null && StringUtils.equals(responseDto.getStatusCode(),ResponseCodeConstant.RESPONSE_SUCCESS_STR)) {
vo.setV3Promotion(responseDto.getResult().isV3Promotion());
}
}
return ResponseUtil.success(vo);
}
private void removeByProductStock(List<PremiumExchangeResponseVo.PremiumExchangeProduct> products, List<ValidateProductInfosDto.ProductData> productDataList, String partnerId, String storeId, String channel) { private void removeByProductStock(List<PremiumExchangeResponseVo.PremiumExchangeProduct> products, List<ValidateProductInfosDto.ProductData> productDataList, String partnerId, String storeId, String channel) {
List<Long> limitSkuIds = new ArrayList<>(); List<Long> limitSkuIds = new ArrayList<>();
productDataList.stream().forEach(ProductData -> { productDataList.stream().forEach(ProductData -> {
......
...@@ -19,6 +19,8 @@ import cn.freemud.entities.dto.*; ...@@ -19,6 +19,8 @@ import cn.freemud.entities.dto.*;
import cn.freemud.entities.dto.activity.ActivityQueryResponseDto; import cn.freemud.entities.dto.activity.ActivityQueryResponseDto;
import cn.freemud.entities.dto.calculate.ActivityCalculationDiscountRequestDto; import cn.freemud.entities.dto.calculate.ActivityCalculationDiscountRequestDto;
import cn.freemud.entities.dto.calculate.ActivityCalculationDiscountResponseDto; import cn.freemud.entities.dto.calculate.ActivityCalculationDiscountResponseDto;
import cn.freemud.entities.dto.shoppingCart.PromotionResultVO;
import cn.freemud.entities.vo.BaseRequestVo;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -73,4 +75,8 @@ public interface ActivityClient { ...@@ -73,4 +75,8 @@ public interface ActivityClient {
@PostMapping("/promotioncenter/calculateservice/discount/sharing") @PostMapping("/promotioncenter/calculateservice/discount/sharing")
//@IgnoreFeignLogAnnotation(excludeStatusCodes = {ResponseCodeConstant.RESPONSE_SUCCESS_STR},statusCodeFieldName= ResponseCodeKeyConstant.STATUS_CODE,messageFieldName=ResponseCodeKeyConstant.MEG) //@IgnoreFeignLogAnnotation(excludeStatusCodes = {ResponseCodeConstant.RESPONSE_SUCCESS_STR},statusCodeFieldName= ResponseCodeKeyConstant.STATUS_CODE,messageFieldName=ResponseCodeKeyConstant.MEG)
ActivityCalculationDiscountResponseDto calculationSharingDiscount(ActivityCalculationDiscountRequestDto shareDiscountRequestDto); ActivityCalculationDiscountResponseDto calculationSharingDiscount(ActivityCalculationDiscountRequestDto shareDiscountRequestDto);
@PostMapping("/activity/getV3Promotion")
@IgnoreFeignLogAnnotation(logMessage = "/activity/getV3Promotion",excludeStatusCodes = {ResponseCodeConstant.RESPONSE_SUCCESS_STR},statusCodeFieldName= ResponseCodeKeyConstant.STATUS_CODE,messageFieldName=ResponseCodeKeyConstant.MSG)
ActivityBaseResponseDto<PromotionResultVO> getV3Promotion(BaseRequestVo request);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment