Commit f5ba0150 by yu.sun

Merge branch 'master' of gitlab.freemud.com:order-group-application/order-group

parents 53b007f4 0a13adba
...@@ -32,6 +32,7 @@ public class CouponAvailableReqVo { ...@@ -32,6 +32,7 @@ public class CouponAvailableReqVo {
//金额 //金额
private Integer totalAmount; private Integer totalAmount;
private String appId; private String appId;
private String redeemChannel;
//购物车商品列表 //购物车商品列表
private List<Product> productList; private List<Product> productList;
} }
package cn.freemud.enums;
public enum CouponRedeemChannel {
PICKUP("saas","pickup"),
DELIVERY("saasdelivery","delivery");
String type;
String channel;
CouponRedeemChannel(String type,String channel) {
this.type = type;
this.channel = channel;
}
public static String getChannelByType(String type) {
String channel = "";
for (CouponRedeemChannel value : CouponRedeemChannel.values()) {
if (value.getType().equals(type)) {
channel = value.getChannel();
break;
}
}
return channel;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getChannel() {
return channel;
}
public void setChannel(String channel) {
this.channel = channel;
}
}
...@@ -80,7 +80,7 @@ public interface CouponService { ...@@ -80,7 +80,7 @@ public interface CouponService {
* @param cartGoods * @param cartGoods
* @return * @return
*/ */
ActivityClassifyCouponBean availableCoupon(List<CartGoods> cartGoods, String partnerId, String userId, String storeId, String couponCode, boolean hasGoodsCoupon, Integer orderType, int isNew,String appId); ActivityClassifyCouponBean availableCoupon(List<CartGoods> cartGoods, String partnerId, String userId, String storeId, String couponCode, boolean hasGoodsCoupon, Integer orderType, int isNew,String appId,String MenuType);
/** /**
* 获取卡券服务商户密钥 * 获取卡券服务商户密钥
......
...@@ -59,7 +59,7 @@ public class CouponPromotionService implements IPromotionService { ...@@ -59,7 +59,7 @@ public class CouponPromotionService implements IPromotionService {
hasGoodssCoupon, hasGoodssCoupon,
couponPromotionVO.getOrderType(), couponPromotionVO.getOrderType(),
0, 0,
shoppingCartInfoRequestVo.getAppId() ); shoppingCartInfoRequestVo.getAppId(),shoppingCartInfoRequestVo.getMenuType() );
if (Objects.equals(activityClassifyCouponBean, null)) { if (Objects.equals(activityClassifyCouponBean, null)) {
// 构建一个空得订单券信息 // 构建一个空得订单券信息
activityClassifyCouponBean = createEmptyActivityCouponBean(); activityClassifyCouponBean = createEmptyActivityCouponBean();
......
...@@ -62,6 +62,7 @@ import com.freemud.card.sdk.vo.coupon.CreateCouponVo; ...@@ -62,6 +62,7 @@ import com.freemud.card.sdk.vo.coupon.CreateCouponVo;
import com.freemud.card.sdk.vo.coupon.request.MemberAddCouponVo; import com.freemud.card.sdk.vo.coupon.request.MemberAddCouponVo;
import com.freemud.card.sdk.vo.coupon.response.MemberBaseRespVo; import com.freemud.card.sdk.vo.coupon.response.MemberBaseRespVo;
import com.freemud.sdk.api.assortment.shoppingcart.constant.CartResponseConstant; import com.freemud.sdk.api.assortment.shoppingcart.constant.CartResponseConstant;
import com.freemud.sdk.api.assortment.shoppingcart.enums.BusinessTypeEnum;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.gson.Gson; import com.google.gson.Gson;
...@@ -420,7 +421,7 @@ public class CouponServiceImpl implements CouponService { ...@@ -420,7 +421,7 @@ public class CouponServiceImpl implements CouponService {
, boolean hasGoodsCoupon , boolean hasGoodsCoupon
, Integer orderType , Integer orderType
, int isNew , int isNew
, String appId) { , String appId,String menuType) {
GetMemberCouponListRequestDto getMemberCouponListRequestDto = new GetMemberCouponListRequestDto(partnerId, userId); GetMemberCouponListRequestDto getMemberCouponListRequestDto = new GetMemberCouponListRequestDto(partnerId, userId);
getMemberCouponListRequestDto.setStatusFlags(Arrays.asList(CouponStatus.STATUS_0.getCode())); getMemberCouponListRequestDto.setStatusFlags(Arrays.asList(CouponStatus.STATUS_0.getCode()));
getMemberCouponListRequestDto.setPageNum(1); getMemberCouponListRequestDto.setPageNum(1);
...@@ -459,14 +460,14 @@ public class CouponServiceImpl implements CouponService { ...@@ -459,14 +460,14 @@ public class CouponServiceImpl implements CouponService {
} }
} }
}); });
List<CouponStateVo> couponStateList = buildAvailiableCoupons(cartGoods, partnerId, storeId, couponCodes, isNew,appId); List<CouponStateVo> couponStateList = buildAvailiableCoupons(cartGoods, partnerId, storeId, couponCodes, isNew,appId,menuType);
if (CollectionUtils.isNotEmpty(couponStateList)) { if (CollectionUtils.isNotEmpty(couponStateList)) {
return returnSuccessAvailiableCoupons(couponCode, hasGoodsCoupon, availableCouponResponseVo, usableCoupons, disableCoupons, memberCouponMap, couponStateList); return returnSuccessAvailiableCoupons(couponCode, hasGoodsCoupon, availableCouponResponseVo, usableCoupons, disableCoupons, memberCouponMap, couponStateList);
} }
return null; return null;
} }
private List<CouponStateVo> buildAvailiableCoupons(List<CartGoods> cartGoods, String partnerId, String storeId, List<String> couponCodes, int isNew,String appId) { private List<CouponStateVo> buildAvailiableCoupons(List<CartGoods> cartGoods, String partnerId, String storeId, List<String> couponCodes, int isNew,String appId,String menuType) {
String appSecret = getAppSecret(partnerId); String appSecret = getAppSecret(partnerId);
// 最大15一提交 // 最大15一提交
int maxNum = 15; int maxNum = 15;
...@@ -484,6 +485,14 @@ public class CouponServiceImpl implements CouponService { ...@@ -484,6 +485,14 @@ public class CouponServiceImpl implements CouponService {
couponAvailableReqVo.setTotalAmount(Integer.valueOf(totalAmount + "")); couponAvailableReqVo.setTotalAmount(Integer.valueOf(totalAmount + ""));
couponAvailableReqVo.setProductList(productList); couponAvailableReqVo.setProductList(productList);
couponAvailableReqVo.setChannelCodeList(commonService.getOrgCodes(partnerId, storeId)); couponAvailableReqVo.setChannelCodeList(commonService.getOrgCodes(partnerId, storeId));
if (StringUtils.isNotBlank(menuType)) {
String code = BusinessTypeEnum.getByType(menuType).getCode();
String channel = CouponRedeemChannel.getChannelByType(code);
if (StringUtils.isNotBlank(channel)) {
couponAvailableReqVo.setRedeemChannel(channel);
}
}
// 构建计算SDK // 构建计算SDK
List<CouponStateVo> couponStateList = Lists.newArrayList(); List<CouponStateVo> couponStateList = Lists.newArrayList();
for (int j = 0; j <= count; j++) { for (int j = 0; j <= count; j++) {
......
...@@ -973,7 +973,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -973,7 +973,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
List<CartGoods> cartGoodsList = orderItemList.stream().map(each -> convert2ShopCartGoods(each)).collect(toList()); List<CartGoods> cartGoodsList = orderItemList.stream().map(each -> convert2ShopCartGoods(each)).collect(toList());
ActivityClassifyCouponBean activityClassifyCouponBean = couponService.availableCoupon(cartGoodsList, partnerId ActivityClassifyCouponBean activityClassifyCouponBean = couponService.availableCoupon(cartGoodsList, partnerId
, memberId, request.getStoreId(), "", false, request.getOrderType(), 0,""); , memberId, request.getStoreId(), "", false, request.getOrderType(), 0,"","");
if (activityClassifyCouponBean != null && CollectionUtils.isNotEmpty(activityClassifyCouponBean.getUsableCoupons())){ if (activityClassifyCouponBean != null && CollectionUtils.isNotEmpty(activityClassifyCouponBean.getUsableCoupons())){
List<GetMemberInfoResponseVo.Coupon> coupons = activityClassifyCouponBean.getUsableCoupons().stream().map(each -> convert2MemberCoupon(each)).collect(toList()); List<GetMemberInfoResponseVo.Coupon> coupons = activityClassifyCouponBean.getUsableCoupons().stream().map(each -> convert2MemberCoupon(each)).collect(toList());
responseData.setCoupons(coupons); responseData.setCoupons(coupons);
......
...@@ -59,6 +59,7 @@ public class CouponSharingService { ...@@ -59,6 +59,7 @@ public class CouponSharingService {
, couponPromotionVO.getOrderType() , couponPromotionVO.getOrderType()
, 1 , 1
, shoppingCartInfoRequestVo.getAppId() , shoppingCartInfoRequestVo.getAppId()
, shoppingCartInfoRequestVo.getMenuType()
); );
if (Objects.equals(activityClassifyCouponBean, null)) { if (Objects.equals(activityClassifyCouponBean, null)) {
// 构建一个空得订单券信息 // 构建一个空得订单券信息
......
...@@ -133,7 +133,7 @@ public class CouponServiceTest { ...@@ -133,7 +133,7 @@ public class CouponServiceTest {
List<CartGoods> cartGoods = Lists.newArrayList(); List<CartGoods> cartGoods = Lists.newArrayList();
CartGoods cartGood = new CartGoods(); CartGoods cartGood = new CartGoods();
cartGoods.add(cartGood); cartGoods.add(cartGood);
ActivityClassifyCouponBean activityClassifyCouponBean = couponService.availableCoupon(cartGoods, "1864", "122424124", "1011", "88123124", true, 1, 1, ""); ActivityClassifyCouponBean activityClassifyCouponBean = couponService.availableCoupon(cartGoods, "1864", "122424124", "1011", "88123124", true, 1, 1, "","");
assertTrue(activityClassifyCouponBean.getCouponNum() >= 1); assertTrue(activityClassifyCouponBean.getCouponNum() >= 1);
} }
......
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