Commit 4d7f91ac by ping.wu

查询券校验门店是否可用

parent 7dc97176
...@@ -35,6 +35,7 @@ public class GetCouponDetailResponseDto { ...@@ -35,6 +35,7 @@ public class GetCouponDetailResponseDto {
private Integer storeChannelLimit; private Integer storeChannelLimit;
private Active active; private Active active;
private List<ActiveProduct> activeProduct; private List<ActiveProduct> activeProduct;
//活动门店限制(非发券指定门店活动使用)
private List<ActiveRestrictionVOS> activeRestrictionVOS; private List<ActiveRestrictionVOS> activeRestrictionVOS;
/** /**
* 可核销周,时间段设置 * 可核销周,时间段设置
...@@ -66,6 +67,8 @@ public class GetCouponDetailResponseDto { ...@@ -66,6 +67,8 @@ public class GetCouponDetailResponseDto {
private List<ActiveChannel> activeChannels; private List<ActiveChannel> activeChannels;
// private List<ActiveRedeemTimeIntervalVO> activeRedeemTimeIntervalList; // private List<ActiveRedeemTimeIntervalVO> activeRedeemTimeIntervalList;
private Integer storeLimitLevel; private Integer storeLimitLevel;
//为0可用
private Integer storelimit;
private String limitStoreId; private String limitStoreId;
// private Integer today_available_times; // private Integer today_available_times;
private Integer total_available_times; private Integer total_available_times;
......
...@@ -18,4 +18,7 @@ public class GetMemberCouponRequestVo { ...@@ -18,4 +18,7 @@ public class GetMemberCouponRequestVo {
private String couponCode; private String couponCode;
// 门店ID // 门店ID
private String storeId; private String storeId;
//是否 校验券门店是否可用
private Boolean checkStoreId = false;
} }
...@@ -39,6 +39,7 @@ import com.freemud.application.sdk.api.productcenter.constant.ResponseConstant; ...@@ -39,6 +39,7 @@ import com.freemud.application.sdk.api.productcenter.constant.ResponseConstant;
import com.freemud.application.sdk.api.util.SignUtil; import com.freemud.application.sdk.api.util.SignUtil;
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.service.impl.ShoppingCartBaseServiceImpl; import com.freemud.sdk.api.assortment.shoppingcart.service.impl.ShoppingCartBaseServiceImpl;
import com.freemud.sdk.api.assortment.shoppingcart.util.ShoppingSdkLogUtil;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.ObjectUtils; import org.apache.commons.lang.ObjectUtils;
...@@ -144,6 +145,10 @@ public class CouponServiceImpl implements CouponService { ...@@ -144,6 +145,10 @@ public class CouponServiceImpl implements CouponService {
// 券码接口新增参数:组织机构(多个用英文逗号分离) // 券码接口新增参数:组织机构(多个用英文逗号分离)
String channelIds = commonService.getOrgIdsAsString(requestVo.getPartnerId(), requestVo.getStoreId()); String channelIds = commonService.getOrgIdsAsString(requestVo.getPartnerId(), requestVo.getStoreId());
map.put(Finals.CHANNEL_ID_LIST, channelIds); map.put(Finals.CHANNEL_ID_LIST, channelIds);
if(requestVo.getCheckStoreId()){
map.put(Finals.STOREID, requestVo.getStoreId());
map.put(Finals.STORECHECK, "0");
}
String appSecret = getAppSecret(requestVo.getPartnerId()); String appSecret = getAppSecret(requestVo.getPartnerId());
String sign = SignUtil.createMD5Sign(map, appSecret); String sign = SignUtil.createMD5Sign(map, appSecret);
map.put(Finals.SIGN, sign); map.put(Finals.SIGN, sign);
...@@ -540,6 +545,7 @@ public class CouponServiceImpl implements CouponService { ...@@ -540,6 +545,7 @@ public class CouponServiceImpl implements CouponService {
* 老版本券校验 * 老版本券校验
*/ */
public CheckSpqInfoResponseDto checkSpqInfo(CheckSpqInfoRequestDto requestDto) { public CheckSpqInfoResponseDto checkSpqInfo(CheckSpqInfoRequestDto requestDto) {
ShoppingSdkLogUtil.infoLog("OldCheckSpqInfo","requestDto");
String partnerId = requestDto.getPartnerId(); String partnerId = requestDto.getPartnerId();
String couponCode = requestDto.getCouponCode(); String couponCode = requestDto.getCouponCode();
String storeId = requestDto.getStoreId(); String storeId = requestDto.getStoreId();
...@@ -548,6 +554,7 @@ public class CouponServiceImpl implements CouponService { ...@@ -548,6 +554,7 @@ public class CouponServiceImpl implements CouponService {
requestVo.setPartnerId(partnerId); requestVo.setPartnerId(partnerId);
requestVo.setCouponCode(couponCode); requestVo.setCouponCode(couponCode);
requestVo.setStoreId(requestDto.getStoreId()); requestVo.setStoreId(requestDto.getStoreId());
requestVo.setCheckStoreId(true);
GetCouponDetailResponseDto couponDetailResponseDto = this.getMemberCoupon(requestVo); GetCouponDetailResponseDto couponDetailResponseDto = this.getMemberCoupon(requestVo);
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;
...@@ -557,16 +564,20 @@ public class CouponServiceImpl implements CouponService { ...@@ -557,16 +564,20 @@ 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;
} }
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())) {
couponDetailResponseDto.getDetails().get(0).getActiveRestrictionVOS().forEach(activeRestrictionVOS -> { // couponDetailResponseDto.getDetails().get(0).getActiveRestrictionVOS().forEach(activeRestrictionVOS -> {
couPonstoreIds.add(activeRestrictionVOS.getStoreIdPartner()); // couPonstoreIds.add(activeRestrictionVOS.getStoreIdPartner());
}); // });
} GetCouponDetailResponseDto.Details detail = couponDetailResponseDto.getDetails().get(0);
if (CollectionUtils.isNotEmpty(couPonstoreIds) && !couPonstoreIds.contains(storeId)) { if (detail.getStorelimit() != 0 || detail.getStoreChannelLimit() != 0) {
return null; return null;
} }
}
// if (CollectionUtils.isNotEmpty(couPonstoreIds) && !couPonstoreIds.contains(storeId)) {
// return null;
// }
//券返回的商品id //券返回的商品id
List<String> skuIds = Lists.newArrayList(); List<String> skuIds = Lists.newArrayList();
String skuId = couponDetailResponseDto.getDetails().get(0).getActiveProduct().get(0).getProductIdPartner(); String skuId = couponDetailResponseDto.getDetails().get(0).getActiveProduct().get(0).getProductIdPartner();
...@@ -731,6 +742,7 @@ public class CouponServiceImpl implements CouponService { ...@@ -731,6 +742,7 @@ public class CouponServiceImpl implements CouponService {
requestVo.setPartnerId(partnerId); requestVo.setPartnerId(partnerId);
requestVo.setCouponCode(couponCode); requestVo.setCouponCode(couponCode);
requestVo.setStoreId(requestDto.getStoreId()); requestVo.setStoreId(requestDto.getStoreId());
requestVo.setCheckStoreId(true);
GetCouponDetailResponseDto couponDetailResponseDto = this.getMemberCoupon(requestVo); GetCouponDetailResponseDto couponDetailResponseDto = this.getMemberCoupon(requestVo);
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;
...@@ -765,16 +777,17 @@ public class CouponServiceImpl implements CouponService { ...@@ -765,16 +777,17 @@ public class CouponServiceImpl implements CouponService {
return null; return null;
} }
//判断该券是否在这个门店下(一个券可以在多个门店下使用) //判断该券是否在这个门店下(一个券可以在多个门店下使用)
List<String> couponStoreIds = Lists.newArrayList(); // List<String> couponStoreIds = Lists.newArrayList();
for (GetCouponDetailResponseDto.Details detail : couponDetailResponseDto.getDetails()) { for (GetCouponDetailResponseDto.Details detail : couponDetailResponseDto.getDetails()) {
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;
for (GetCouponDetailResponseDto.ActiveRestrictionVOS activeRestrictionVO : detail.getActiveRestrictionVOS()) { // for (GetCouponDetailResponseDto.ActiveRestrictionVOS activeRestrictionVO : detail.getActiveRestrictionVOS()) {
couponStoreIds.add(activeRestrictionVO.getStoreIdPartner()); // couponStoreIds.add(activeRestrictionVO.getStoreIdPartner());
} // }
} if (detail.getStorelimit() != 0 || detail.getStoreChannelLimit() != 0) {
if (CollectionUtils.isNotEmpty(couponStoreIds) && !couponStoreIds.contains(storeId)) {
return null; return null;
} }
}
//券返回的商品id //券返回的商品id
List<String> skuIds = Lists.newArrayList(); List<String> skuIds = Lists.newArrayList();
String skuId = goodsId; String skuId = goodsId;
......
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