Commit 6cf60c76 by 徐康

Merge branch 'feature/xukang_20211110_野萃山商品券黑白名单问题'

# Conflicts:
#	shopping-cart-application-service/src/main/java/cn/freemud/service/impl/CouponServiceImpl.java
parents afa04ae9 6fe5ca66
...@@ -26,6 +26,8 @@ public class GetCouponDetailResponseDto { ...@@ -26,6 +26,8 @@ public class GetCouponDetailResponseDto {
private String activeCode; private String activeCode;
private String title; private String title;
private Integer type; private Integer type;
//type=0时,subType=1为黑名单,否则为白名单
private Integer subType;
private Integer status; private Integer status;
private String create_time; private String create_time;
private String redeem_time; private String redeem_time;
......
...@@ -26,6 +26,7 @@ import cn.freemud.entities.vo.coupon.CouponAvailableReqVo; ...@@ -26,6 +26,7 @@ import cn.freemud.entities.vo.coupon.CouponAvailableReqVo;
import cn.freemud.entities.vo.coupon.CouponStateVo; import cn.freemud.entities.vo.coupon.CouponStateVo;
import cn.freemud.entities.vo.coupon.Product; import cn.freemud.entities.vo.coupon.Product;
import cn.freemud.enums.*; import cn.freemud.enums.*;
import cn.freemud.interceptor.ServiceException;
import cn.freemud.redis.RedisCache; import cn.freemud.redis.RedisCache;
import cn.freemud.service.CommonService; import cn.freemud.service.CommonService;
import cn.freemud.service.CouponService; import cn.freemud.service.CouponService;
...@@ -563,6 +564,12 @@ public class CouponServiceImpl implements CouponService { ...@@ -563,6 +564,12 @@ public class CouponServiceImpl implements CouponService {
&& !Objects.equals(couponDetailResponseDto.getDetails().get(0).getStatus(), CouponStatus.STATUS_2.getCode())) { && !Objects.equals(couponDetailResponseDto.getDetails().get(0).getStatus(), CouponStatus.STATUS_2.getCode())) {
return null; return null;
} }
if(CouponTypeEnum.TYPE_0.getCode().equals(couponDetailResponseDto.getDetails().get(0).getType())
&& Integer.valueOf(1).equals(couponDetailResponseDto.getDetails().get(0).getSubType())) {
throw new ServiceException(ResponseResult.SHOPPING_CART_PRODUCT_CAN_NOT_USE, "老版本不支持商品券黑名单商品,请升级小程序。");
}
// List<String> couPonstoreIds = Lists.newArrayList(); // List<String> couPonstoreIds = Lists.newArrayList();
//TODO 判断该券是否在这个门店下(一个券可以在多个门店下使用) //TODO 判断该券是否在这个门店下(一个券可以在多个门店下使用)
if (CollectionUtils.isNotEmpty(couponDetailResponseDto.getDetails().get(0).getActiveRestrictionVOS())) { if (CollectionUtils.isNotEmpty(couponDetailResponseDto.getDetails().get(0).getActiveRestrictionVOS())) {
...@@ -752,6 +759,17 @@ public class CouponServiceImpl implements CouponService { ...@@ -752,6 +759,17 @@ public class CouponServiceImpl implements CouponService {
for (GetCouponDetailResponseDto.Details detail : couponDetailResponseDto.getDetails()) { for (GetCouponDetailResponseDto.Details detail : couponDetailResponseDto.getDetails()) {
if (productValid) break; if (productValid) break;
if (!CouponStatus.STATUS_0.getCode().equals(detail.getStatus()) && !CouponStatus.STATUS_2.getCode().equals(detail.getStatus())) continue; if (!CouponStatus.STATUS_0.getCode().equals(detail.getStatus()) && !CouponStatus.STATUS_2.getCode().equals(detail.getStatus())) continue;
if(CouponTypeEnum.TYPE_0.getCode().equals(detail.getType()) && Integer.valueOf(1).equals(detail.getSubType())) {
//黑名单商品券处理
for (GetCouponDetailResponseDto.ActiveProduct activeProduct : detail.getActiveProduct()) {
if (goodsId.equals(activeProduct.getProductIdPartner())) {
throw new ServiceException(ResponseResult.SHOPPING_CART_COUPON_NOT_EXIST, "加购商品在商品券商品黑名单中。");
}
}
productValid = true;
couponActivityDetail = detail;
couponType = CouponTypeEnum.TYPE_4.getCode();
} else {
for (GetCouponDetailResponseDto.ActiveProduct activeProduct : detail.getActiveProduct()) { for (GetCouponDetailResponseDto.ActiveProduct activeProduct : detail.getActiveProduct()) {
if (goodsId.equals(activeProduct.getProductIdPartner())) { if (goodsId.equals(activeProduct.getProductIdPartner())) {
productValid = true; productValid = true;
...@@ -760,6 +778,7 @@ public class CouponServiceImpl implements CouponService { ...@@ -760,6 +778,7 @@ public class CouponServiceImpl implements CouponService {
break; break;
} }
} }
}
if(CouponTypeEnum.TYPE_7.getCode().equals(detail.getType())){ if(CouponTypeEnum.TYPE_7.getCode().equals(detail.getType())){
for (GetCouponDetailResponseDto.ActiveProduct activeProduct : detail.getActiveProduct()) { for (GetCouponDetailResponseDto.ActiveProduct activeProduct : detail.getActiveProduct()) {
if (goodsId.equals(activeProduct.getProductIdPartner())) { if (goodsId.equals(activeProduct.getProductIdPartner())) {
...@@ -873,6 +892,7 @@ public class CouponServiceImpl implements CouponService { ...@@ -873,6 +892,7 @@ public class CouponServiceImpl implements CouponService {
if (couponDetailResponseDto == null || !couponDetailResponseDto.getResult().equals(ResponseCodeConstant.RESPONSE_SUCCESS_1) || CollectionUtils.isEmpty(couponDetailResponseDto.getDetails())) { if (couponDetailResponseDto == null || !couponDetailResponseDto.getResult().equals(ResponseCodeConstant.RESPONSE_SUCCESS_1) || CollectionUtils.isEmpty(couponDetailResponseDto.getDetails())) {
return null; return null;
} }
if (CollectionUtils.isEmpty(couponDetailResponseDto.getDetails())) { if (CollectionUtils.isEmpty(couponDetailResponseDto.getDetails())) {
return null; return null;
} }
...@@ -880,6 +900,10 @@ public class CouponServiceImpl implements CouponService { ...@@ -880,6 +900,10 @@ public class CouponServiceImpl implements CouponService {
String skuId ; String skuId ;
List<String> skuIds = Lists.newArrayList(); List<String> skuIds = Lists.newArrayList();
if (StringUtils.isEmpty(goodsId)) { if (StringUtils.isEmpty(goodsId)) {
if(CouponTypeEnum.TYPE_0.getCode().equals(couponDetailResponseDto.getDetails().get(0).getType())
&& Integer.valueOf(1).equals(couponDetailResponseDto.getDetails().get(0).getSubType())) {
throw new ServiceException(ResponseResult.SHOPPING_CART_PRODUCT_CAN_NOT_USE, "老版本不支持商品券黑名单商品,请升级小程序。");
}
//券返回的商品id //券返回的商品id
skuId = couponDetailResponseDto.getDetails().get(0).getActiveProduct().get(0).getProductIdPartner(); skuId = couponDetailResponseDto.getDetails().get(0).getActiveProduct().get(0).getProductIdPartner();
skuIds.add(String.valueOf(skuId)); skuIds.add(String.valueOf(skuId));
......
...@@ -25,7 +25,7 @@ public interface CardBinClient { ...@@ -25,7 +25,7 @@ public interface CardBinClient {
GetAppKeyResponseDto getAppKey(GetAppKeyRequestDto requestDto); GetAppKeyResponseDto getAppKey(GetAppKeyRequestDto requestDto);
/** /**
* 活动信息批量查询 * 活动信息批量查询 疑似黑白名单接口但是出参没有商品信息
* @param requestDto * @param requestDto
* @return * @return
*/ */
......
...@@ -27,7 +27,7 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -27,7 +27,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
public interface CouponAdapterClient { public interface CouponAdapterClient {
/** /**
* 获取可用券信息 * 获取可用券信息 需要券码改造为黑白名单接口,出参中的商品信息没有使用
* *
* @param couponAvailableReqVo * @param couponAvailableReqVo
* @return * @return
......
...@@ -21,7 +21,7 @@ import java.util.Map; ...@@ -21,7 +21,7 @@ import java.util.Map;
@FeignClient(name = "OPEN-STORE-ONLINE-COUPON-SERVICE", url = "${saas.coupononlineclient.feign.url}", configuration = FormSupportConfig.class) @FeignClient(name = "OPEN-STORE-ONLINE-COUPON-SERVICE", url = "${saas.coupononlineclient.feign.url}", configuration = FormSupportConfig.class)
public interface CouponOnlineClient { public interface CouponOnlineClient {
/** /**
* 查询券详情 * 查询券详情 黑白名单接口
*/ */
@IgnoreFeignLogAnnotation(logMessage = "getCouponDetails",excludeStatusCodes = {ResponseCodeConstant.RESPONSE_SUCCESS_STR},statusCodeFieldName= ResponseCodeKeyConstant.STATUS_CODE) @IgnoreFeignLogAnnotation(logMessage = "getCouponDetails",excludeStatusCodes = {ResponseCodeConstant.RESPONSE_SUCCESS_STR},statusCodeFieldName= ResponseCodeKeyConstant.STATUS_CODE)
@PostMapping(value = "/code_v4", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, @PostMapping(value = "/code_v4", produces = MediaType.APPLICATION_JSON_UTF8_VALUE,
......
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