Commit 11701220 by shuhu.hou@freemud.cn

会员价联调

parent 5cb8e634
...@@ -1166,6 +1166,9 @@ public class OrderSdkAdapter { ...@@ -1166,6 +1166,9 @@ public class OrderSdkAdapter {
case "FULL_DISTRIBUTION_FEE": case "FULL_DISTRIBUTION_FEE":
type=1014; type=1014;
break; break;
case "MEMBER_PRICE_DISCOUNT":
type=220;
break;
default: default:
break; break;
} }
...@@ -1867,6 +1870,8 @@ public class OrderSdkAdapter { ...@@ -1867,6 +1870,8 @@ public class OrderSdkAdapter {
break; break;
case 205: case 205:
newOrderAccountType=OldOrderAccountType.TOTAL_DISCOUNT.getCode(); newOrderAccountType=OldOrderAccountType.TOTAL_DISCOUNT.getCode();
case 220:
newOrderAccountType=OldOrderAccountType.MEMBER_PRICE_DISCOUNT.getCode();
default: default:
break; break;
} }
......
...@@ -37,7 +37,8 @@ public enum OldOrderAccountType { ...@@ -37,7 +37,8 @@ public enum OldOrderAccountType {
FULL_DISTRIBUTION_FEE(1014, "满减配送费", "FULL_DISTRIBUTION_FEE"), FULL_DISTRIBUTION_FEE(1014, "满减配送费", "FULL_DISTRIBUTION_FEE"),
NEW_USER_DISCOUNT(101, "新用户立减", "NEW_USER_DISCOUNT"), NEW_USER_DISCOUNT(101, "新用户立减", "NEW_USER_DISCOUNT"),
PRICE_DEDUCTION_COUPON(103, "抵价券", "PRICE_DEDUCTION_COUPON"), PRICE_DEDUCTION_COUPON(103, "抵价券", "PRICE_DEDUCTION_COUPON"),
TOTAL_DISCOUNT(205, "优惠总金额", "TOTAL_DISCOUNT"); TOTAL_DISCOUNT(205, "优惠总金额", "TOTAL_DISCOUNT"),
MEMBER_PRICE_DISCOUNT(220, "会员价优惠", "MEMBER_PRICE_DISCOUNT");
private Integer code; private Integer code;
private String desc; private String desc;
......
...@@ -36,7 +36,8 @@ public enum QueryOrderAccountType { ...@@ -36,7 +36,8 @@ public enum QueryOrderAccountType {
TOTAL_DISCOUNT("TOTAL_DISCOUNT", "优惠总金额"), TOTAL_DISCOUNT("TOTAL_DISCOUNT", "优惠总金额"),
ONLINE_PAY("ONLINE_PAY", "线上支付"), ONLINE_PAY("ONLINE_PAY", "线上支付"),
FULL_DISTRIBUTION_FEE("FULL_DISTRIBUTION_FEE", "满减配送费"), FULL_DISTRIBUTION_FEE("FULL_DISTRIBUTION_FEE", "满减配送费"),
OFFLINE_PAY("OFFLINE_PAY", "线下支付"); OFFLINE_PAY("OFFLINE_PAY", "线下支付"),
MEMBER_PRICE_DISCOUNT("MEMBER_PRICE_DISCOUNT","会员价优惠");
private String code; private String code;
private String desc; private String desc;
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
<dependency> <dependency>
<groupId>com.freemud.application.service.sdk</groupId> <groupId>com.freemud.application.service.sdk</groupId>
<artifactId>productcenter-sdk</artifactId> <artifactId>productcenter-sdk</artifactId>
<version>2.8.0-SNAPSHOT</version> <version>2.9.3-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
......
...@@ -71,6 +71,7 @@ public class ShoppingCartAdapter { ...@@ -71,6 +71,7 @@ public class ShoppingCartAdapter {
//可选搭配&固定搭配 //可选搭配&固定搭配
productType.setComboProductTypeList(getValidateSkuProductType(cartGoods.getProductComboList())); productType.setComboProductTypeList(getValidateSkuProductType(cartGoods.getProductComboList()));
productType.setProductGroupTypeList(getValidateSkuProductType(cartGoods.getProductGroupList())); productType.setProductGroupTypeList(getValidateSkuProductType(cartGoods.getProductGroupList()));
productType.setMemberDiscount(cartGoods.getMemberDiscount());
validateShopProductRequest.getProductTypeList().add(productType); validateShopProductRequest.getProductTypeList().add(productType);
} }
return validateShopProductRequest; return validateShopProductRequest;
...@@ -279,6 +280,7 @@ public class ShoppingCartAdapter { ...@@ -279,6 +280,7 @@ public class ShoppingCartAdapter {
cartGoods.setStockLimit(isSkuProduct ? ObjectUtils.equals(1, skuProduct.getStockLimit()) : ObjectUtils.equals(1, spuProduct.getStockLimit())); cartGoods.setStockLimit(isSkuProduct ? ObjectUtils.equals(1, skuProduct.getStockLimit()) : ObjectUtils.equals(1, spuProduct.getStockLimit()));
cartGoods.setCustomerCode(isSkuProduct ? skuProduct.getCustomerCode() : spuProduct.getCustomerCode()); cartGoods.setCustomerCode(isSkuProduct ? skuProduct.getCustomerCode() : spuProduct.getCustomerCode());
cartGoods.setRiseSell(isSkuProduct?skuProduct.getRiseSell():spuProduct.getRiseSell()); cartGoods.setRiseSell(isSkuProduct?skuProduct.getRiseSell():spuProduct.getRiseSell());
cartGoods.setMemberDiscount(isSkuProduct?skuProduct.getMemberDiscountResult():spuProduct.getMemberDiscountResult());
String skuSpecName = ""; String skuSpecName = "";
if (isSkuProduct && CollectionUtils.isNotEmpty(skuProduct.getSkuSpecValues())) { if (isSkuProduct && CollectionUtils.isNotEmpty(skuProduct.getSkuSpecValues())) {
......
...@@ -138,6 +138,11 @@ public class CartGoods { ...@@ -138,6 +138,11 @@ public class CartGoods {
* 无起售份数默认值1 * 无起售份数默认值1
*/ */
private Integer riseSell; private Integer riseSell;
/**
* 折扣比例
* 例如8折为80
*/
private Integer memberDiscount;
/** /**
* 套餐固定商品 * 套餐固定商品
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
<dependency> <dependency>
<groupId>cn.freemud</groupId> <groupId>cn.freemud</groupId>
<artifactId>assortment-ordercenter-sdk</artifactId> <artifactId>assortment-ordercenter-sdk</artifactId>
<version>1.4.9.RELEASE</version> <version>1.5.0.RELEASE</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.freemud.application.service.sdk</groupId> <groupId>com.freemud.application.service.sdk</groupId>
......
...@@ -2032,6 +2032,9 @@ public class OrderAdapter { ...@@ -2032,6 +2032,9 @@ public class OrderAdapter {
if (ActivityTypeEnum.TYPE_14.getCode().equals(activityType)) { if (ActivityTypeEnum.TYPE_14.getCode().equals(activityType)) {
return OldOrderAccountType.FULL_DISTRIBUTION_FEE; return OldOrderAccountType.FULL_DISTRIBUTION_FEE;
} }
if (ActivityTypeEnum.TYPE_320.getCode().equals(activityType)){
return OldOrderAccountType.MEMBER_PRICE_DISCOUNT;
}
return OldOrderAccountType.BUYM_SENDN; return OldOrderAccountType.BUYM_SENDN;
} }
......
...@@ -50,7 +50,8 @@ public enum ActivityTypeEnum { ...@@ -50,7 +50,8 @@ public enum ActivityTypeEnum {
TYPE_200(200, "X元Y件"), TYPE_200(200, "X元Y件"),
TYPE_PACKAGE(900, "包装费"), TYPE_PACKAGE(900, "包装费"),
TYPE_DELIVERY(901, "配送费"), TYPE_DELIVERY(901, "配送费"),
TYPE_211(211, "套餐优惠"); TYPE_211(211, "套餐优惠"),
TYPE_320(320, "会员价优惠");
private Integer code; private Integer code;
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
<dependency> <dependency>
<groupId>com.freemud.application.service.sdk</groupId> <groupId>com.freemud.application.service.sdk</groupId>
<artifactId>productcenter-sdk</artifactId> <artifactId>productcenter-sdk</artifactId>
<version>2.8.0-SNAPSHOT</version> <version>2.9.3-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.freemud.application.service.sdk</groupId> <groupId>com.freemud.application.service.sdk</groupId>
......
...@@ -63,6 +63,10 @@ public class ActivityCalculationDiscountRequestDto { ...@@ -63,6 +63,10 @@ public class ActivityCalculationDiscountRequestDto {
private List<CalculationDiscountGoods> goods; private List<CalculationDiscountGoods> goods;
private Long distributionFee; private Long distributionFee;
/**
* 是否是会员
*/
private Boolean isMember;
@Data @Data
public static class CalculationDiscountCoupon { public static class CalculationDiscountCoupon {
...@@ -94,6 +98,11 @@ public class ActivityCalculationDiscountRequestDto { ...@@ -94,6 +98,11 @@ public class ActivityCalculationDiscountRequestDto {
* 原价(分) * 原价(分)
*/ */
private Long originalPrice; private Long originalPrice;
/**
* 折扣比例
* 例如8折为80
*/
private Integer memberDiscount;
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
......
package cn.freemud.entities.dto.user;
import lombok.Data;
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @version V1.0
* @Title: GetSessionUserInfoDto
* @Package cn.freemud.entities.dto.user
* @Description:
* @author: shuhu.hou
* @date: 2020/5/25 15:50
* @Copyright: 2020 www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
@Data
public class GetSessionUserInfoDto {
private String sessionId;
private boolean isGetPaid;
}
...@@ -145,6 +145,11 @@ public class CartGoods { ...@@ -145,6 +145,11 @@ public class CartGoods {
*/ */
private Integer riseSell; private Integer riseSell;
/** /**
* 折扣比例
* 例如8折为80
*/
private Integer memberDiscount;
/**
* 套餐固定商品 * 套餐固定商品
*/ */
private List<ComboxGoods> productComboList; private List<ComboxGoods> productComboList;
......
package cn.freemud.entities.vo;
import lombok.Data;
import org.apache.commons.collections4.CollectionUtils;
import java.util.List;
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @version V1.0
* @Title: CustomerInfoVo
* @Package cn.freemud.entities.vo
* @Description:
* @author: shuhu.hou
* @date: 2020/5/25 15:35
* @Copyright: 2020 www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
@Data
public class CustomerInfoVo {
private String openId;
private String unionId;
private String wxAppId;
private String appSecret;
private String sessionKey;
private String nickName;
private String photoUrl;
private String mobile;
private String memberId;
private String partnerId;
private Boolean newMember;
private String sessionId;
private String tableNumber;
private String iappId;
private String storeId;
private String devBrand;
private String devModel;
private String channel;
private String accessToken;
private String alipayUserId;
private String appId;
private String thirdPartyPartnerID;
private String thirdPartyMemberID;
/** 付费会员卡列表 **/
private List<MemberPaidDetailVo> memberPaids;
/** 判断是否为付费会员 **/
public boolean isMemberPaid(){
if(CollectionUtils.isEmpty(memberPaids)){
return false;
}
return memberPaids.stream().anyMatch(item -> item.getExpiryTime().getTime() > System.currentTimeMillis());
}
}
package cn.freemud.entities.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@Data
public class MemberPaidDetailVo {
private String id;
private String paidId;
private String paidName;
private Date openTime;
private Date expiryTime;
}
...@@ -93,6 +93,7 @@ public interface ShoppingCartNewService { ...@@ -93,6 +93,7 @@ public interface ShoppingCartNewService {
String userId, String userId,
String appId, String appId,
Integer orderType, Integer orderType,
boolean isMember,
List<CartGoods> cartGoodsList, List<CartGoods> cartGoodsList,
List<ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon> coupons, List<ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon> coupons,
List<ShoppingCartInfoRequestVo.SendGoods> sendGoodsList,String menuType,Long distributionFee); List<ShoppingCartInfoRequestVo.SendGoods> sendGoodsList,String menuType,Long distributionFee);
......
...@@ -416,7 +416,7 @@ public class ShoppingCartMallServiceImpl implements ShoppingCartNewService { ...@@ -416,7 +416,7 @@ public class ShoppingCartMallServiceImpl implements ShoppingCartNewService {
@Override @Override
public ActivityCalculationDiscountResponseDto.CalculationDiscountResult getActivityCalculationDiscountResponse( public ActivityCalculationDiscountResponseDto.CalculationDiscountResult getActivityCalculationDiscountResponse(
String partnerId, String storeId, String userId, String appId, Integer orderType, List<CartGoods> cartGoodsList, String partnerId, String storeId, String userId, String appId, Integer orderType,boolean isMember, List<CartGoods> cartGoodsList,
List<ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon> coupons, List<ShoppingCartInfoRequestVo.SendGoods> sendGoodsList,String menuType,Long distributionFee) { List<ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon> coupons, List<ShoppingCartInfoRequestVo.SendGoods> sendGoodsList,String menuType,Long distributionFee) {
return null; return null;
} }
......
...@@ -490,7 +490,7 @@ public class ShoppingCartMealServiceImpl implements ShoppingCartNewService { ...@@ -490,7 +490,7 @@ public class ShoppingCartMealServiceImpl implements ShoppingCartNewService {
@Override @Override
public ActivityCalculationDiscountResponseDto.CalculationDiscountResult public ActivityCalculationDiscountResponseDto.CalculationDiscountResult
getActivityCalculationDiscountResponse(String partnerId, String storeId, String userId, String appId, Integer orderType, getActivityCalculationDiscountResponse(String partnerId, String storeId, String userId, String appId, Integer orderType,boolean isMember,
List<CartGoods> cartGoodsList, List<ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon> coupons, List<ShoppingCartInfoRequestVo.SendGoods> sendGoodsList,String menuType,Long distributionFee) { List<CartGoods> cartGoodsList, List<ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon> coupons, List<ShoppingCartInfoRequestVo.SendGoods> sendGoodsList,String menuType,Long distributionFee) {
return null; return null;
} }
......
...@@ -26,6 +26,7 @@ import cn.freemud.entities.dto.activity.ShareDiscountActivityDto; ...@@ -26,6 +26,7 @@ import cn.freemud.entities.dto.activity.ShareDiscountActivityDto;
import cn.freemud.entities.dto.openplatform.WeixinProductRequestDto; 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.shoppingCart.ShoppingCartGoodsDto; import cn.freemud.entities.dto.shoppingCart.ShoppingCartGoodsDto;
import cn.freemud.entities.dto.user.GetSessionUserInfoDto;
import cn.freemud.entities.vo.*; import cn.freemud.entities.vo.*;
import cn.freemud.enums.*; import cn.freemud.enums.*;
import cn.freemud.interceptor.ServiceException; import cn.freemud.interceptor.ServiceException;
...@@ -96,10 +97,8 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -96,10 +97,8 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
private StoreItemClient storeItemClient; private StoreItemClient storeItemClient;
@Autowired @Autowired
private ActivityClient activityClient; private ActivityClient activityClient;
@Autowired @Autowired
private ItemService itemService; private ItemService itemService;
@Autowired @Autowired
private ShoppingCartNewBaseService shoppingCartNewBaseService; private ShoppingCartNewBaseService shoppingCartNewBaseService;
@Autowired @Autowired
...@@ -128,7 +127,6 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -128,7 +127,6 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
private AssortmentCustomerInfoManager customerInfoManager; private AssortmentCustomerInfoManager customerInfoManager;
@Autowired @Autowired
private PaymentNewService paymentNewService; private PaymentNewService paymentNewService;
//会员SDK
@Autowired @Autowired
private MemberCenterService memberCenterService; private MemberCenterService memberCenterService;
@Autowired @Autowired
...@@ -137,10 +135,8 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -137,10 +135,8 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
private StoreServiceImpl storeService; private StoreServiceImpl storeService;
@Autowired @Autowired
private StoreCenterService storeCenterService; private StoreCenterService storeCenterService;
@Autowired @Autowired
private CommonService commonService; private CommonService commonService;
@Autowired @Autowired
private ProductService productService; private ProductService productService;
@Autowired @Autowired
...@@ -218,7 +214,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -218,7 +214,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
public BaseResponse addGoods(AddShoppingCartGoodsRequestVo addShoppingCartGoodsRequestVo) { public BaseResponse addGoods(AddShoppingCartGoodsRequestVo addShoppingCartGoodsRequestVo) {
ShoppingCartGoodsResponseVo shoppingCartGoodsResponseVo = new ShoppingCartGoodsResponseVo(); ShoppingCartGoodsResponseVo shoppingCartGoodsResponseVo = new ShoppingCartGoodsResponseVo();
// 获取用户信息 // 获取用户信息
AssortmentCustomerInfoVo assortmentCustomerInfoVo = customerInfoManager.getCustomerInfoByObject(addShoppingCartGoodsRequestVo.getSessionId()); CustomerInfoVo assortmentCustomerInfoVo =getCustomerInfoVo(addShoppingCartGoodsRequestVo.getSessionId());
UserLoginInfoDto userLoginInfoDto = convert2UserLoginInfoDto(assortmentCustomerInfoVo); UserLoginInfoDto userLoginInfoDto = convert2UserLoginInfoDto(assortmentCustomerInfoVo);
String userId = userLoginInfoDto.getMemberId(); String userId = userLoginInfoDto.getMemberId();
String partnerId = addShoppingCartGoodsRequestVo.getPartnerId(); String partnerId = addShoppingCartGoodsRequestVo.getPartnerId();
...@@ -272,7 +268,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -272,7 +268,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
// 获取优惠信息 // 获取优惠信息
ActivityCalculationDiscountResponseDto.CalculationDiscountResult calculationDiscountResult ActivityCalculationDiscountResponseDto.CalculationDiscountResult calculationDiscountResult
=getCalculationDiscountResult(menuType,partnerId,storeId,userId,appId,userLoginInfoDto.getWxAppid(),orderType,allCartGoodsList,new ArrayList(),new ArrayList<>(),null,deliveryAmount); =getCalculationDiscountResult(menuType,partnerId,storeId,userId,appId,userLoginInfoDto.getWxAppid(),orderType,assortmentCustomerInfoVo.isMemberPaid(), allCartGoodsList,new ArrayList(),new ArrayList<>(),null,deliveryAmount);
// 当商品数量被设为0时 // 当商品数量被设为0时
...@@ -327,7 +323,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -327,7 +323,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
@Override @Override
public BaseResponse updateGoodsQty(UpdateShoppingCartGoodsQtyRequestVo updateShoppingCartGoodsQtyRequestVo) { public BaseResponse updateGoodsQty(UpdateShoppingCartGoodsQtyRequestVo updateShoppingCartGoodsQtyRequestVo) {
ShoppingCartGoodsResponseVo shoppingCartGoodsResponseVo = new ShoppingCartGoodsResponseVo(); ShoppingCartGoodsResponseVo shoppingCartGoodsResponseVo = new ShoppingCartGoodsResponseVo();
AssortmentCustomerInfoVo assortmentCustomerInfoVo = customerInfoManager.getCustomerInfoByObject(updateShoppingCartGoodsQtyRequestVo.getSessionId()); CustomerInfoVo assortmentCustomerInfoVo = getCustomerInfoVo(updateShoppingCartGoodsQtyRequestVo.getSessionId());
UserLoginInfoDto userLoginInfoDto = convert2UserLoginInfoDto(assortmentCustomerInfoVo); UserLoginInfoDto userLoginInfoDto = convert2UserLoginInfoDto(assortmentCustomerInfoVo);
String userId = userLoginInfoDto.getMemberId(); String userId = userLoginInfoDto.getMemberId();
String partnerId = updateShoppingCartGoodsQtyRequestVo.getPartnerId(); String partnerId = updateShoppingCartGoodsQtyRequestVo.getPartnerId();
...@@ -364,7 +360,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -364,7 +360,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
Long deliveryAmount = calculateDeliveryAmount(receiveId,partnerId,storeId,userLoginInfoDto.getWxAppid()); Long deliveryAmount = calculateDeliveryAmount(receiveId,partnerId,storeId,userLoginInfoDto.getWxAppid());
// 获取优惠信息 // 获取优惠信息
ActivityCalculationDiscountResponseDto.CalculationDiscountResult calculationDiscountResult ActivityCalculationDiscountResponseDto.CalculationDiscountResult calculationDiscountResult
=getCalculationDiscountResult(menuType,partnerId,storeId,userId,appId,userLoginInfoDto.getWxAppid(),orderType,cartGoodsList,new ArrayList(),new ArrayList<>(),null,deliveryAmount); =getCalculationDiscountResult(menuType,partnerId,storeId,userId,appId,userLoginInfoDto.getWxAppid(),orderType,assortmentCustomerInfoVo.isMemberPaid(),cartGoodsList,new ArrayList(),new ArrayList<>(),null,deliveryAmount);
if (calculationDiscountResult == null) { if (calculationDiscountResult == null) {
shoppingCartGoodsResponseVo.setProducts(cartGoodsList); shoppingCartGoodsResponseVo.setProducts(cartGoodsList);
// return shoppingCartGoodsResponseVo; // return shoppingCartGoodsResponseVo;
...@@ -429,7 +425,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -429,7 +425,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
public BaseResponse getGoodsList(ShoppingCartInfoRequestVo shoppingCartInfoRequestVo) { public BaseResponse getGoodsList(ShoppingCartInfoRequestVo shoppingCartInfoRequestVo) {
ShoppingCartGoodsResponseVo shoppingCartGoodsResponseVo = new ShoppingCartGoodsResponseVo(); ShoppingCartGoodsResponseVo shoppingCartGoodsResponseVo = new ShoppingCartGoodsResponseVo();
// 获取用户信息 // 获取用户信息
AssortmentCustomerInfoVo assortmentCustomerInfoVo = customerInfoManager.getCustomerInfoByObject(shoppingCartInfoRequestVo.getSessionId()); CustomerInfoVo assortmentCustomerInfoVo = getCustomerInfoVo(shoppingCartInfoRequestVo.getSessionId());
UserLoginInfoDto userLoginInfoDto = convert2UserLoginInfoDto(assortmentCustomerInfoVo); UserLoginInfoDto userLoginInfoDto = convert2UserLoginInfoDto(assortmentCustomerInfoVo);
String userId = userLoginInfoDto.getMemberId(); String userId = userLoginInfoDto.getMemberId();
String partnerId = shoppingCartInfoRequestVo.getPartnerId(); String partnerId = shoppingCartInfoRequestVo.getPartnerId();
...@@ -465,7 +461,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -465,7 +461,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
Long deliveryAmount = calculateDeliveryAmount(receiveId,partnerId,storeId,userLoginInfoDto.getWxAppid()); Long deliveryAmount = calculateDeliveryAmount(receiveId,partnerId,storeId,userLoginInfoDto.getWxAppid());
// 获取优惠信息 // 获取优惠信息
ActivityCalculationDiscountResponseDto.CalculationDiscountResult calculationDiscountResult = getCalculationDiscountResult(menuType,partnerId,storeId,userId,appId,userLoginInfoDto.getWxAppid(),orderType,cartGoodsList,coupons,null,shoppingCartInfoRequestVo.getReceiveId(),deliveryAmount); ActivityCalculationDiscountResponseDto.CalculationDiscountResult calculationDiscountResult = getCalculationDiscountResult(menuType,partnerId,storeId,userId,appId,userLoginInfoDto.getWxAppid(),orderType,assortmentCustomerInfoVo.isMemberPaid(),cartGoodsList,coupons,null,shoppingCartInfoRequestVo.getReceiveId(),deliveryAmount);
if (calculationDiscountResult == null) { if (calculationDiscountResult == null) {
shoppingCartGoodsResponseVo.setProducts(cartGoodsList); shoppingCartGoodsResponseVo.setProducts(cartGoodsList);
...@@ -520,7 +516,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -520,7 +516,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
*/ */
@Override @Override
public BaseResponse clear(ShoppingCartClearRequestVo shoppingCartClearRequestVo) { public BaseResponse clear(ShoppingCartClearRequestVo shoppingCartClearRequestVo) {
AssortmentCustomerInfoVo userLoginInfoDto = customerInfoManager.getCustomerInfoByObject(shoppingCartClearRequestVo.getSessionId()); CustomerInfoVo userLoginInfoDto =getCustomerInfoVo(shoppingCartClearRequestVo.getSessionId());
String appId = shoppingCartClearRequestVo.getAppId(); String appId = shoppingCartClearRequestVo.getAppId();
if (StringUtils.isBlank(appId)) { if (StringUtils.isBlank(appId)) {
return ResponseUtil.error(ResponseResult.PARAMETER_MISSING, "appId不能为空"); return ResponseUtil.error(ResponseResult.PARAMETER_MISSING, "appId不能为空");
...@@ -555,7 +551,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -555,7 +551,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
ShoppingCartGoodsDto shoppingCartGoodsDto = new ShoppingCartGoodsDto(); ShoppingCartGoodsDto shoppingCartGoodsDto = new ShoppingCartGoodsDto();
ShoppingCartGoodsResponseVo shoppingCartGoodsResponseVo = new ShoppingCartGoodsResponseVo(); ShoppingCartGoodsResponseVo shoppingCartGoodsResponseVo = new ShoppingCartGoodsResponseVo();
// 获取用户信息 // 获取用户信息
AssortmentCustomerInfoVo assortmentCustomerInfoVo = customerInfoManager.getCustomerInfoByObject(shoppingCartInfoRequestVo.getSessionId()); CustomerInfoVo assortmentCustomerInfoVo = getCustomerInfoVo(shoppingCartInfoRequestVo.getSessionId());
UserLoginInfoDto userLoginInfoDto = convert2UserLoginInfoDto(assortmentCustomerInfoVo); UserLoginInfoDto userLoginInfoDto = convert2UserLoginInfoDto(assortmentCustomerInfoVo);
String userId = userLoginInfoDto.getMemberId(); String userId = userLoginInfoDto.getMemberId();
String partnerId = shoppingCartInfoRequestVo.getPartnerId(); String partnerId = shoppingCartInfoRequestVo.getPartnerId();
...@@ -630,7 +626,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -630,7 +626,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
Long deliveryAmount = calculateDeliveryAmount(receiveId,partnerId,storeId,userLoginInfoDto.getWxAppid()); Long deliveryAmount = calculateDeliveryAmount(receiveId,partnerId,storeId,userLoginInfoDto.getWxAppid());
// 获取优惠信息 // 获取优惠信息
ActivityCalculationDiscountResponseDto.CalculationDiscountResult calculationDiscountResult = getCalculationDiscountResult(menuType,partnerId,storeId,userId,appId,userLoginInfoDto.getWxAppid(),orderType,cartGoodsList,coupons,sendGoodsList,shoppingCartInfoRequestVo.getReceiveId(),deliveryAmount); ActivityCalculationDiscountResponseDto.CalculationDiscountResult calculationDiscountResult = getCalculationDiscountResult(menuType,partnerId,storeId,userId,appId,userLoginInfoDto.getWxAppid(),orderType,assortmentCustomerInfoVo.isMemberPaid(),cartGoodsList,coupons,sendGoodsList,shoppingCartInfoRequestVo.getReceiveId(),deliveryAmount);
ActivityQueryDto activityQueryDto = activityAdapter.getActivityQueryDto(partnerId, storeId, userId, appId, shoppingCartInfoRequestVo.getOrderType()); ActivityQueryDto activityQueryDto = activityAdapter.getActivityQueryDto(partnerId, storeId, userId, appId, shoppingCartInfoRequestVo.getOrderType());
...@@ -711,8 +707,8 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -711,8 +707,8 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
* @return * @return
*/ */
public ActivityCalculationDiscountResponseDto.CalculationDiscountResult getActivityCalculationDiscountResponse( public ActivityCalculationDiscountResponseDto.CalculationDiscountResult getActivityCalculationDiscountResponse(
String partnerId, String storeId, String userId, String wxAppid, Integer orderType, List<CartGoods> cartGoodsList,String menuType, Long distributionFee) { String partnerId, String storeId, String userId, String wxAppid, Integer orderType,boolean isMember, List<CartGoods> cartGoodsList,String menuType, Long distributionFee) {
return getActivityCalculationDiscountResponse(partnerId, storeId, userId, wxAppid, orderType, cartGoodsList, new ArrayList<>(), new ArrayList<>(),menuType,distributionFee); return getActivityCalculationDiscountResponse(partnerId, storeId, userId, wxAppid, orderType,isMember, cartGoodsList, new ArrayList<>(), new ArrayList<>(),menuType,distributionFee);
} }
/** /**
...@@ -725,7 +721,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -725,7 +721,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
*/ */
@Override @Override
public ActivityCalculationDiscountResponseDto.CalculationDiscountResult getActivityCalculationDiscountResponse( public ActivityCalculationDiscountResponseDto.CalculationDiscountResult getActivityCalculationDiscountResponse(
String partnerId, String storeId, String userId, String appId, Integer orderType, List<CartGoods> cartGoodsList, String partnerId, String storeId, String userId, String appId, Integer orderType,boolean isMember, List<CartGoods> cartGoodsList,
List<ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon> coupons, List<ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon> coupons,
List<ShoppingCartInfoRequestVo.SendGoods> sendGoodsList,String menuType,Long distributionFee) { List<ShoppingCartInfoRequestVo.SendGoods> sendGoodsList,String menuType,Long distributionFee) {
...@@ -738,7 +734,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -738,7 +734,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
String cartGoodsUid = cartGoods.getCartGoodsUid(); String cartGoodsUid = cartGoods.getCartGoodsUid();
// 商品不是商品券 // 商品不是商品券
if (!cartGoodsUid.startsWith(CommonsConstant.COUPON_PREFIX)) { if (!cartGoodsUid.startsWith(CommonsConstant.COUPON_PREFIX)) {
this.addCalculationDiscountGoods(calculationDiscountGoodsList, cartGoods.getGoodsId(), cartGoods.getQty(), cartGoods.getFinalPrice()); this.addCalculationDiscountGoods(calculationDiscountGoodsList, cartGoods.getGoodsId(), cartGoods.getQty(), cartGoods.getFinalPrice(),cartGoods.getMemberDiscount());
} }
// 商品是商品券 // 商品是商品券
else { else {
...@@ -762,13 +758,13 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -762,13 +758,13 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
coupons.add(coupon); coupons.add(coupon);
// 添加商品券代表的商品 // 添加商品券代表的商品
String goodsId = StringUtils.isEmpty(checkSpqInfoResponseDto.getSkuId()) ? checkSpqInfoResponseDto.getSpuId() : checkSpqInfoResponseDto.getSkuId(); String goodsId = StringUtils.isEmpty(checkSpqInfoResponseDto.getSkuId()) ? checkSpqInfoResponseDto.getSpuId() : checkSpqInfoResponseDto.getSkuId();
this.addCalculationDiscountGoods(calculationDiscountGoodsList, goodsId, 1, checkSpqInfoResponseDto.getPrice()); this.addCalculationDiscountGoods(calculationDiscountGoodsList, goodsId, 1, checkSpqInfoResponseDto.getPrice(),100);
} }
} }
// 当加价购商品不为空时 // 当加价购商品不为空时
if (CollectionUtils.isNotEmpty(sendGoodsList)) { if (CollectionUtils.isNotEmpty(sendGoodsList)) {
for (ShoppingCartInfoRequestVo.SendGoods sendGoods : sendGoodsList) { for (ShoppingCartInfoRequestVo.SendGoods sendGoods : sendGoodsList) {
this.addCalculationDiscountGoods(calculationDiscountGoodsList, sendGoods.getGoodsId(), sendGoods.getQty(), sendGoods.getOriginalPrice()); this.addCalculationDiscountGoods(calculationDiscountGoodsList, sendGoods.getGoodsId(), sendGoods.getQty(), sendGoods.getOriginalPrice(),100);
} }
} }
calculationDiscountGoodsList.removeIf(calculationDiscountGoods -> (calculationDiscountGoods.getGoodsQuantity().equals(0))); calculationDiscountGoodsList.removeIf(calculationDiscountGoods -> (calculationDiscountGoods.getGoodsQuantity().equals(0)));
...@@ -780,6 +776,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -780,6 +776,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
activityCalculationDiscountRequestDto.setCoupons(coupons); activityCalculationDiscountRequestDto.setCoupons(coupons);
activityCalculationDiscountRequestDto.setOrgIds(commonService.getOrgIds(partnerId, storeId)); activityCalculationDiscountRequestDto.setOrgIds(commonService.getOrgIds(partnerId, storeId));
activityCalculationDiscountRequestDto.setDistributionFee(distributionFee); activityCalculationDiscountRequestDto.setDistributionFee(distributionFee);
activityCalculationDiscountRequestDto.setIsMember(isMember);
ActivityCalculationDiscountResponseDto activityCalculationDiscountResponseDto; ActivityCalculationDiscountResponseDto activityCalculationDiscountResponseDto;
try { try {
activityCalculationDiscountResponseDto = activityClient.calculationDiscount(activityCalculationDiscountRequestDto); activityCalculationDiscountResponseDto = activityClient.calculationDiscount(activityCalculationDiscountRequestDto);
...@@ -807,11 +804,12 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -807,11 +804,12 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
* @param originalPrice * @param originalPrice
*/ */
private void addCalculationDiscountGoods(List<ActivityCalculationDiscountRequestDto.CalculationDiscountGoods> calculationDiscountGoodsList, private void addCalculationDiscountGoods(List<ActivityCalculationDiscountRequestDto.CalculationDiscountGoods> calculationDiscountGoodsList,
String goodsId, Integer goodsQuantity, Long originalPrice) { String goodsId, Integer goodsQuantity, Long originalPrice,Integer memberDiscount) {
ActivityCalculationDiscountRequestDto.CalculationDiscountGoods calculationDiscountGoods = new ActivityCalculationDiscountRequestDto.CalculationDiscountGoods(); ActivityCalculationDiscountRequestDto.CalculationDiscountGoods calculationDiscountGoods = new ActivityCalculationDiscountRequestDto.CalculationDiscountGoods();
calculationDiscountGoods.setGoodsId(goodsId); calculationDiscountGoods.setGoodsId(goodsId);
calculationDiscountGoods.setGoodsQuantity(goodsQuantity); calculationDiscountGoods.setGoodsQuantity(goodsQuantity);
calculationDiscountGoods.setOriginalPrice(originalPrice); calculationDiscountGoods.setOriginalPrice(originalPrice);
calculationDiscountGoods.setMemberDiscount(memberDiscount);
this.addCalculationDiscountGoods(calculationDiscountGoodsList, calculationDiscountGoods); this.addCalculationDiscountGoods(calculationDiscountGoodsList, calculationDiscountGoods);
} }
...@@ -1333,7 +1331,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -1333,7 +1331,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
shoppingCartGoodsResponseVo.setCardDiscountAmount(firstCouponAmount); shoppingCartGoodsResponseVo.setCardDiscountAmount(firstCouponAmount);
} }
private UserLoginInfoDto convert2UserLoginInfoDto(AssortmentCustomerInfoVo assortmentCustomerInfoVo) { private UserLoginInfoDto convert2UserLoginInfoDto(CustomerInfoVo assortmentCustomerInfoVo) {
if (assortmentCustomerInfoVo == null || assortmentCustomerInfoVo.getMemberId() == null) { if (assortmentCustomerInfoVo == null || assortmentCustomerInfoVo.getMemberId() == null) {
throw new ServiceException(ResponseResult.NOT_LOGIN); throw new ServiceException(ResponseResult.NOT_LOGIN);
} }
...@@ -1503,7 +1501,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -1503,7 +1501,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
* 获取优惠 * 获取优惠
*/ */
private ActivityCalculationDiscountResponseDto.CalculationDiscountResult getCalculationDiscountResult(String menuType private ActivityCalculationDiscountResponseDto.CalculationDiscountResult getCalculationDiscountResult(String menuType
,String partnerId,String storeId,String userId,String appId,String wxappid,Integer orderType ,String partnerId,String storeId,String userId,String appId,String wxappid,Integer orderType,boolean isMember
,List<CartGoods> cartGoodsList,List<ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon> coupons ,List<CartGoods> cartGoodsList,List<ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon> coupons
,List<ShoppingCartInfoRequestVo.SendGoods> sendGoodsList,String receiveId,Long deliveryAmount){ ,List<ShoppingCartInfoRequestVo.SendGoods> sendGoodsList,String receiveId,Long deliveryAmount){
// 获取优惠信息 // 获取优惠信息
...@@ -1511,9 +1509,9 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -1511,9 +1509,9 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
//外卖场景下 查询门店配送信息 //外卖场景下 查询门店配送信息
if(BusinessTypeEnum.SAAS_DELIVERY.getCode().equals(menuType)){ if(BusinessTypeEnum.SAAS_DELIVERY.getCode().equals(menuType)){
calculationDiscountResult = this.getActivityCalculationDiscountResponse(partnerId, storeId, userId, appId, orderType, cartGoodsList, coupons, sendGoodsList,BusinessTypeEnum.getByType(menuType).getCode(),deliveryAmount); calculationDiscountResult = this.getActivityCalculationDiscountResponse(partnerId, storeId, userId, appId, orderType,isMember, cartGoodsList, coupons, sendGoodsList,BusinessTypeEnum.getByType(menuType).getCode(),deliveryAmount);
}else{ }else{
calculationDiscountResult = this.getActivityCalculationDiscountResponse(partnerId, storeId, userId, appId, orderType, cartGoodsList, coupons, sendGoodsList,BusinessTypeEnum.getByType(menuType).getCode(),null); calculationDiscountResult = this.getActivityCalculationDiscountResponse(partnerId, storeId, userId, appId, orderType,isMember, cartGoodsList, coupons, sendGoodsList,BusinessTypeEnum.getByType(menuType).getCode(),null);
} }
return calculationDiscountResult; return calculationDiscountResult;
...@@ -1534,4 +1532,15 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -1534,4 +1532,15 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
} }
private CustomerInfoVo getCustomerInfoVo(String sessionId) {
GetSessionUserInfoDto getSessionUserInfoDto = new GetSessionUserInfoDto();
getSessionUserInfoDto.setGetPaid(true);
getSessionUserInfoDto.setSessionId(sessionId);
BaseResponse<CustomerInfoVo> sessionUserInfo = customerApplicationClient.getSessionUserInfo(getSessionUserInfoDto);
if (!ResponseResult.SUCCESS.getCode().equals(sessionUserInfo.getCode()) || sessionUserInfo.getResult() == null) {
throw new ServiceException(ResponseResult.NOT_LOGIN);
}
return sessionUserInfo.getResult();
}
} }
...@@ -3,6 +3,8 @@ package cn.freemud.service.thirdparty; ...@@ -3,6 +3,8 @@ package cn.freemud.service.thirdparty;
import cn.freemud.base.entity.BaseResponse; import cn.freemud.base.entity.BaseResponse;
import cn.freemud.entities.dto.GetPaidRuleRequestDto; import cn.freemud.entities.dto.GetPaidRuleRequestDto;
import cn.freemud.entities.dto.GetPaidRuleResponseDto; import cn.freemud.entities.dto.GetPaidRuleResponseDto;
import cn.freemud.entities.dto.user.GetSessionUserInfoDto;
import cn.freemud.entities.vo.CustomerInfoVo;
import org.springframework.cloud.netflix.feign.FeignClient; import org.springframework.cloud.netflix.feign.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;
...@@ -24,4 +26,7 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -24,4 +26,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
public interface CustomerApplicationClient { public interface CustomerApplicationClient {
@PostMapping(value = "/membercard/getPaidRule") @PostMapping(value = "/membercard/getPaidRule")
BaseResponse<GetPaidRuleResponseDto> getPaidRule(GetPaidRuleRequestDto getPaidRuleRequestDto); BaseResponse<GetPaidRuleResponseDto> getPaidRule(GetPaidRuleRequestDto getPaidRuleRequestDto);
@PostMapping(value = "/user/getSessionUserInfo")
BaseResponse<CustomerInfoVo>getSessionUserInfo(GetSessionUserInfoDto getSessionUserInfoDto);
} }
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