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 {
//金额
private Integer totalAmount;
private String appId;
private String redeemChannel;
//购物车商品列表
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 {
* @param cartGoods
* @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 {
hasGoodssCoupon,
couponPromotionVO.getOrderType(),
0,
shoppingCartInfoRequestVo.getAppId() );
shoppingCartInfoRequestVo.getAppId(),shoppingCartInfoRequestVo.getMenuType() );
if (Objects.equals(activityClassifyCouponBean, null)) {
// 构建一个空得订单券信息
activityClassifyCouponBean = createEmptyActivityCouponBean();
......
......@@ -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.response.MemberBaseRespVo;
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.Maps;
import com.google.gson.Gson;
......@@ -420,7 +421,7 @@ public class CouponServiceImpl implements CouponService {
, boolean hasGoodsCoupon
, Integer orderType
, int isNew
, String appId) {
, String appId,String menuType) {
GetMemberCouponListRequestDto getMemberCouponListRequestDto = new GetMemberCouponListRequestDto(partnerId, userId);
getMemberCouponListRequestDto.setStatusFlags(Arrays.asList(CouponStatus.STATUS_0.getCode()));
getMemberCouponListRequestDto.setPageNum(1);
......@@ -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)) {
return returnSuccessAvailiableCoupons(couponCode, hasGoodsCoupon, availableCouponResponseVo, usableCoupons, disableCoupons, memberCouponMap, couponStateList);
}
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);
// 最大15一提交
int maxNum = 15;
......@@ -484,6 +485,14 @@ public class CouponServiceImpl implements CouponService {
couponAvailableReqVo.setTotalAmount(Integer.valueOf(totalAmount + ""));
couponAvailableReqVo.setProductList(productList);
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
List<CouponStateVo> couponStateList = Lists.newArrayList();
for (int j = 0; j <= count; j++) {
......
......@@ -973,7 +973,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
List<CartGoods> cartGoodsList = orderItemList.stream().map(each -> convert2ShopCartGoods(each)).collect(toList());
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())){
List<GetMemberInfoResponseVo.Coupon> coupons = activityClassifyCouponBean.getUsableCoupons().stream().map(each -> convert2MemberCoupon(each)).collect(toList());
responseData.setCoupons(coupons);
......
......@@ -59,6 +59,7 @@ public class CouponSharingService {
, couponPromotionVO.getOrderType()
, 1
, shoppingCartInfoRequestVo.getAppId()
, shoppingCartInfoRequestVo.getMenuType()
);
if (Objects.equals(activityClassifyCouponBean, null)) {
// 构建一个空得订单券信息
......
......@@ -133,7 +133,7 @@ public class CouponServiceTest {
List<CartGoods> cartGoods = Lists.newArrayList();
CartGoods cartGood = new CartGoods();
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);
}
......
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