Commit 5381d1e1 by 胡敬轩

Merge remote-tracking branch 'remotes/origin/master' into feature/20210316-v2023-加价购迁移购物车

# Conflicts:
#	shopping-cart-application-service/src/main/java/cn/freemud/entities/dto/ActivityCalculationDiscountResponseDto.java
#	shopping-cart-application-service/src/main/java/cn/freemud/entities/dto/calculate/CalculationSharingDiscountResponseDto.java
parents 80ebb769 071a6b22
...@@ -8,7 +8,7 @@ app.id=SHOP_OPEN_STORE ...@@ -8,7 +8,7 @@ app.id=SHOP_OPEN_STORE
apollo.meta=http://212.129.229.203 apollo.meta=http://212.129.229.203
env=dev env=dev
apollo.bootstrap.enabled=true apollo.bootstrap.enabled=true
apollo.bootstrap.namespaces=micro_progeram_commons,i_callback_service apollo.bootstrap.namespaces=i_callback_service,micro_progeram_commons
spring.main.allow-bean-definition-overriding=true spring.main.allow-bean-definition-overriding=true
management.endpoints.metrics.enabled=true management.endpoints.metrics.enabled=true
management.endpoints.health.sensitive=false management.endpoints.health.sensitive=false
......
...@@ -2080,11 +2080,11 @@ public class OrderAdapter { ...@@ -2080,11 +2080,11 @@ public class OrderAdapter {
break; break;
} }
} }
if(attr.length() > 0) { if(StringUtils.isNotBlank(attr)) {
productName += "("+attr+")"; productName += "("+attr+")";
} }
//英文名处理 //英文名处理
if(attrEng.length() > 0) { if(StringUtils.isNotBlank(attrEng)) {
foreignProductName += "("+attrEng+")"; foreignProductName += "("+attrEng+")";
} }
} }
......
...@@ -172,9 +172,9 @@ public class ThirdDeliveryServiceImpl implements ThirdDeliveryService { ...@@ -172,9 +172,9 @@ public class ThirdDeliveryServiceImpl implements ThirdDeliveryService {
sendException(request.getOrderId(),request.getExceptionDesc(),request.getUpdateTime(),DeliveryStatus.getDeliveryStatusByCode(deliveryStatus).getDesc()); sendException(request.getOrderId(),request.getExceptionDesc(),request.getUpdateTime(),DeliveryStatus.getDeliveryStatusByCode(deliveryStatus).getDesc());
// 取消外卖中台配送单 订单异常 // 取消外卖中台配送单 订单异常
// 如果 "配送单异常并且顾客更改配送地址" 不取消配送单 // 如果 "配送单异常并且顾客更改配送地址" 不取消配送单
if (!isDeliveryAbnormalAndCustomerChangedAddress(request)) { // if (!isDeliveryAbnormalAndCustomerChangedAddress(request)) {
partnerCancelOrder(request.getDeliveryId()); // partnerCancelOrder(request.getDeliveryId());
} // }
// 运单异常,取消订单 // 运单异常,取消订单
posBaseRequestDto.setReason("没有骑手接单"); posBaseRequestDto.setReason("没有骑手接单");
posBaseRequestDto.setDeliveryId(request.getDeliveryId()); posBaseRequestDto.setDeliveryId(request.getDeliveryId());
......
...@@ -21,7 +21,7 @@ management.endpoints.web.base-path=/ ...@@ -21,7 +21,7 @@ management.endpoints.web.base-path=/
management.endpoints.web.exposure.include=prometheus,info,health,shutdown management.endpoints.web.exposure.include=prometheus,info,health,shutdown
management.metrics.tags.application=${spring.application.name} management.metrics.tags.application=${spring.application.name}
management.endpoint.shutdown.enabled=true management.endpoint.shutdown.enabled=true
management.security.enabled=false #management.security.enabled=false
management.health.rabbit.enabled=false management.health.rabbit.enabled=false
mcCafe.partnerId=1206 mcCafe.partnerId=1206
apollo.plugin.namespace=openstore.gray.rule apollo.plugin.namespace=openstore.gray.rule
\ No newline at end of file
...@@ -412,6 +412,7 @@ public class ShoppingCartConvertAdapter { ...@@ -412,6 +412,7 @@ public class ShoppingCartConvertAdapter {
Integer qty = addShoppingCartGoodsRequestVo.getQty() == null ? 1 : addShoppingCartGoodsRequestVo.getQty(); Integer qty = addShoppingCartGoodsRequestVo.getQty() == null ? 1 : addShoppingCartGoodsRequestVo.getQty();
CartGoods cartGoods = new CartGoods(); CartGoods cartGoods = new CartGoods();
cartGoods.setGoodsId(goodsId); cartGoods.setGoodsId(goodsId);
cartGoods.setAddCartTime(System.currentTimeMillis());
cartGoods.setSpuId(spuId); cartGoods.setSpuId(spuId);
cartGoods.setSkuId(skuId); cartGoods.setSkuId(skuId);
cartGoods.setQty(qty); cartGoods.setQty(qty);
......
...@@ -9,6 +9,7 @@ public class ResponseCodeConstant { ...@@ -9,6 +9,7 @@ public class ResponseCodeConstant {
public final static String RESPONSE_SUCCESS_STR = "100"; public final static String RESPONSE_SUCCESS_STR = "100";
public final static String RESPONSE_CONFLICTS_STR = "105";
// coco券校验异常的错误 // coco券校验异常的错误
public final static String COCO_RESPONSE_COUPON_ERR_STR = "700"; public final static String COCO_RESPONSE_COUPON_ERR_STR = "700";
...@@ -25,6 +26,7 @@ public class ResponseCodeConstant { ...@@ -25,6 +26,7 @@ public class ResponseCodeConstant {
successResponseCodeSet.add(RESPONSE_SUCCESS_OK); successResponseCodeSet.add(RESPONSE_SUCCESS_OK);
successResponseCodeSet.add(RESPONSE_SUCCESS_1); successResponseCodeSet.add(RESPONSE_SUCCESS_1);
successResponseCodeSet.add(RESPONSE_SUCCESS_0_STR); successResponseCodeSet.add(RESPONSE_SUCCESS_0_STR);
successResponseCodeSet.add(RESPONSE_CONFLICTS_STR);
} }
public static boolean isSuccessRespinseCode(Object o) { public static boolean isSuccessRespinseCode(Object o) {
......
...@@ -10,6 +10,7 @@ import lombok.NoArgsConstructor; ...@@ -10,6 +10,7 @@ import lombok.NoArgsConstructor;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID;
@Data @Data
public class ActivityCalculationDiscountResponseDto { public class ActivityCalculationDiscountResponseDto {
...@@ -201,6 +202,7 @@ public class ActivityCalculationDiscountResponseDto { ...@@ -201,6 +202,7 @@ public class ActivityCalculationDiscountResponseDto {
* 购物车商品行uid * 购物车商品行uid
*/ */
private String cartGoodsUid; private String cartGoodsUid;
private Boolean zeroDiscount;
private Integer integral; private Integer integral;
} }
......
...@@ -41,6 +41,6 @@ public class CheckSpqInfoResponseDto { ...@@ -41,6 +41,6 @@ public class CheckSpqInfoResponseDto {
private Integer couponType; private Integer couponType;
private List<CartGoods.CartGoodsExtra> extras; private List<CartGoods.CartGoodsExtra> extras;
private Boolean isMultiCoupon; private Integer todayAvailableTimes;
} }
...@@ -36,6 +36,7 @@ public class GetCouponDetailResponseDto { ...@@ -36,6 +36,7 @@ public class GetCouponDetailResponseDto {
* 可核销周,时间段设置 * 可核销周,时间段设置
*/ */
private List<ActiveRedeemTimeInterval> activeRedeemTimeIntervalList; private List<ActiveRedeemTimeInterval> activeRedeemTimeIntervalList;
private Integer today_available_times;
} }
@Data @Data
public static class Active{ public static class Active{
......
...@@ -119,6 +119,10 @@ public class CalculationSharingDiscountRequestDto { ...@@ -119,6 +119,10 @@ public class CalculationSharingDiscountRequestDto {
*/ */
private Long originalPrice; private Long originalPrice;
/** /**
* 加车时间
*/
private Long addCartTime;
/**
* 折扣比例 * 折扣比例
* 例如8折为80 * 例如8折为80
*/ */
......
...@@ -171,6 +171,8 @@ public class CalculationSharingDiscountResponseDto { ...@@ -171,6 +171,8 @@ public class CalculationSharingDiscountResponseDto {
private Long thresholdAmount; private Long thresholdAmount;
private SendPointDto sendPointVo; private SendPointDto sendPointVo;
private Date endTime; private Date endTime;
private Boolean zeroDiscount;
private Integer integral; private Integer integral;
} }
......
...@@ -39,7 +39,6 @@ public class BatchOperateCartGoodsRequestVo extends BaseRequestVo{ ...@@ -39,7 +39,6 @@ public class BatchOperateCartGoodsRequestVo extends BaseRequestVo{
/** /**
* 商品信息 * 商品信息
*/ */
@NotEmpty(message = "商品信息不可为空")
private List<BatchGoodsInfoVo> goodsInfos; private List<BatchGoodsInfoVo> goodsInfos;
} }
\ No newline at end of file
...@@ -145,6 +145,7 @@ public enum ResponseResult { ...@@ -145,6 +145,7 @@ public enum ResponseResult {
COUPON_SHOP_NOTSUPPORT("46010", "优惠券在当前门店不可用"), COUPON_SHOP_NOTSUPPORT("46010", "优惠券在当前门店不可用"),
COUPON_ORDER_WAY_ERROR("46011", "您选择得优惠券不适用该点餐方式"), COUPON_ORDER_WAY_ERROR("46011", "您选择得优惠券不适用该点餐方式"),
COUPON_VERIFICATION_FAIL("46012", "优惠券核销失败"), COUPON_VERIFICATION_FAIL("46012", "优惠券核销失败"),
COUPON_CONFLICTS_ERROR("46013","当前使用的券列表存在互斥"),
/** /**
* 加价购商品 * 加价购商品
......
...@@ -115,7 +115,7 @@ public interface ShoppingCartNewService { ...@@ -115,7 +115,7 @@ public interface ShoppingCartNewService {
* @param productIds * @param productIds
* @return * @return
*/ */
default Pair<String, Boolean> validCoupon(String partnerId default Pair<String, Integer> validCoupon(String partnerId
, String storeId , String storeId
, String couponCode , String couponCode
, List<Long> productIds , List<Long> productIds
...@@ -133,7 +133,7 @@ public interface ShoppingCartNewService { ...@@ -133,7 +133,7 @@ public interface ShoppingCartNewService {
} }
productIds.add(Long.parseLong(checkSpqInfoResponseDto.getSkuId())); productIds.add(Long.parseLong(checkSpqInfoResponseDto.getSkuId()));
spuId2 = checkSpqInfoResponseDto.getSkuId(); spuId2 = checkSpqInfoResponseDto.getSkuId();
return new Pair(spuId2, checkSpqInfoResponseDto.getIsMultiCoupon()); return new Pair(spuId2, checkSpqInfoResponseDto.getTodayAvailableTimes());
} }
/** /**
...@@ -147,7 +147,7 @@ public interface ShoppingCartNewService { ...@@ -147,7 +147,7 @@ public interface ShoppingCartNewService {
* @param goodsId * @param goodsId
* @return * @return
*/ */
default Pair<String, Boolean> validCoupon(String partnerId default Pair<String, Integer> validCoupon(String partnerId
, String storeId , String storeId
, String couponCode , String couponCode
, List<Long> productIds , List<Long> productIds
...@@ -165,7 +165,7 @@ public interface ShoppingCartNewService { ...@@ -165,7 +165,7 @@ public interface ShoppingCartNewService {
productIds.add(Long.parseLong(checkSpqInfoResponseDto.getSkuId())); productIds.add(Long.parseLong(checkSpqInfoResponseDto.getSkuId()));
couponProductDto.setType(checkSpqInfoResponseDto.getCouponType()); couponProductDto.setType(checkSpqInfoResponseDto.getCouponType());
spuId2 = checkSpqInfoResponseDto.getSkuId(); spuId2 = checkSpqInfoResponseDto.getSkuId();
return new Pair(spuId2, checkSpqInfoResponseDto.getIsMultiCoupon()); return new Pair(spuId2, checkSpqInfoResponseDto.getTodayAvailableTimes());
} }
/** /**
......
...@@ -21,7 +21,9 @@ import cn.freemud.enums.ActivityTypeEnum; ...@@ -21,7 +21,9 @@ import cn.freemud.enums.ActivityTypeEnum;
import cn.freemud.enums.CalculationGoodsType; import cn.freemud.enums.CalculationGoodsType;
import cn.freemud.service.active.ActiveService; import cn.freemud.service.active.ActiveService;
import com.freemud.application.sdk.api.productcenter.domain.ProductBeanDTO; import com.freemud.application.sdk.api.productcenter.domain.ProductBeanDTO;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.ObjectUtils; import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -75,6 +77,7 @@ public class PlatformActiveServiceImpl implements ActiveService { ...@@ -75,6 +77,7 @@ public class PlatformActiveServiceImpl implements ActiveService {
Map<String, CalculationSharingDiscountResponseDto.CalculationDiscountResult.Goods> discountForGift = this.getDiscountForGift(discountResult); Map<String, CalculationSharingDiscountResponseDto.CalculationDiscountResult.Goods> discountForGift = this.getDiscountForGift(discountResult);
for (ProductBeanDTO product : products) { for (ProductBeanDTO product : products) {
String k = product.getPid(); String k = product.getPid();
CalculationSharingDiscountResponseDto.CalculationDiscountResult.Goods goods = discountForGift.get(k); CalculationSharingDiscountResponseDto.CalculationDiscountResult.Goods goods = discountForGift.get(k);
......
...@@ -606,6 +606,10 @@ public class CouponServiceImpl implements CouponService { ...@@ -606,6 +606,10 @@ public class CouponServiceImpl implements CouponService {
} }
} else { } else {
if (Objects.equals(couponStateVo.getState(), CouponStateEnum.STATE_1.getCode()) || (activityCouponBean.getDailyAvailableTimes() != null && activityCouponBean.getDailyAvailableTimes() == 0)) { if (Objects.equals(couponStateVo.getState(), CouponStateEnum.STATE_1.getCode()) || (activityCouponBean.getDailyAvailableTimes() != null && activityCouponBean.getDailyAvailableTimes() == 0)) {
if (Objects.equals(couponStateVo.getType(), CouponTypeEnum.TYPE_0.getCode()) || Objects.equals(couponStateVo.getType(), CouponTypeEnum.TYPE_4.getCode())){
activityCouponBean.setCouponPic(memberCoupon.getLogo());
activityCouponBean.setUnusedReason("商品券只能在点餐页");
}
disableCoupons.add(activityCouponBean); disableCoupons.add(activityCouponBean);
disableCouponNum = disableCouponNum + 1; disableCouponNum = disableCouponNum + 1;
} else if (Objects.equals(couponStateVo.getType(), CouponTypeEnum.TYPE_0.getCode()) || Objects.equals(couponStateVo.getType(), CouponTypeEnum.TYPE_4.getCode())) { } else if (Objects.equals(couponStateVo.getType(), CouponTypeEnum.TYPE_0.getCode()) || Objects.equals(couponStateVo.getType(), CouponTypeEnum.TYPE_4.getCode())) {
...@@ -774,9 +778,13 @@ public class CouponServiceImpl implements CouponService { ...@@ -774,9 +778,13 @@ public class CouponServiceImpl implements CouponService {
dto.setCouponName(couponDetailResponseDto.getDetails().get(0).getTitle()); dto.setCouponName(couponDetailResponseDto.getDetails().get(0).getTitle());
dto.setActivityName(couponDetailResponseDto.getDetails().get(0).getActive().getActiveName()); dto.setActivityName(couponDetailResponseDto.getDetails().get(0).getActive().getActiveName());
if (couponDetailResponseDto.getDetails().get(0).getActive().getMaxRedeemTimes() != null && couponDetailResponseDto.getDetails().get(0).getActive().getMaxRedeemTimes() > 1){ if (couponDetailResponseDto.getDetails().get(0).getActive().getMaxRedeemTimes() != null && couponDetailResponseDto.getDetails().get(0).getActive().getMaxRedeemTimes() > 1){
dto.setIsMultiCoupon(true); if (couponDetailResponseDto.getDetails().get(0).getToday_available_times() != null){
dto.setTodayAvailableTimes(couponDetailResponseDto.getDetails().get(0).getToday_available_times());
} else {
dto.setTodayAvailableTimes(1);
}
} else { } else {
dto.setIsMultiCoupon(false); dto.setTodayAvailableTimes(1);
} }
dto.setPrice(productsVo.getFinalPrice()); dto.setPrice(productsVo.getFinalPrice());
dto.setSpuId(productsVo.getSpuId()); dto.setSpuId(productsVo.getSpuId());
...@@ -941,9 +949,13 @@ public class CouponServiceImpl implements CouponService { ...@@ -941,9 +949,13 @@ public class CouponServiceImpl implements CouponService {
} }
CheckSpqInfoResponseDto dto = new CheckSpqInfoResponseDto(); CheckSpqInfoResponseDto dto = new CheckSpqInfoResponseDto();
if (couponDetailResponseDto.getDetails().get(0).getActive().getMaxRedeemTimes() != null && couponDetailResponseDto.getDetails().get(0).getActive().getMaxRedeemTimes() > 1){ if (couponDetailResponseDto.getDetails().get(0).getActive().getMaxRedeemTimes() != null && couponDetailResponseDto.getDetails().get(0).getActive().getMaxRedeemTimes() > 1){
dto.setIsMultiCoupon(true); if (couponDetailResponseDto.getDetails().get(0).getToday_available_times() != null){
dto.setTodayAvailableTimes(couponDetailResponseDto.getDetails().get(0).getToday_available_times());
} else {
dto.setTodayAvailableTimes(1);
}
} else { } else {
dto.setIsMultiCoupon(false); dto.setTodayAvailableTimes(1);
} }
dto.setCouponCode(couponCode); dto.setCouponCode(couponCode);
dto.setActiveCode(couponActivityDetail.getActive().getActiveCode()); dto.setActiveCode(couponActivityDetail.getActive().getActiveCode());
......
...@@ -122,7 +122,7 @@ public class ShoppingCartMealServiceImpl implements ShoppingCartNewService { ...@@ -122,7 +122,7 @@ public class ShoppingCartMealServiceImpl implements ShoppingCartNewService {
productIds.add(Long.parseLong(goodsId)); productIds.add(Long.parseLong(goodsId));
} else { } else {
//校验券是否有效 //校验券是否有效
Pair<String, Boolean> pair = validCoupon(partnerId, storeId, spuId, productIds, BusinessTypeEnum.getByType(requestVo.getMenuType()).getCode(), null, null); Pair<String, Integer> pair = validCoupon(partnerId, storeId, spuId, productIds, BusinessTypeEnum.getByType(requestVo.getMenuType()).getCode(), null, null);
spuId2 = pair.getKey(); spuId2 = pair.getKey();
} }
// 获取商品信息 // 获取商品信息
......
...@@ -77,8 +77,10 @@ import com.freemud.sdk.api.assortment.shoppingcart.service.ShoppingCartBaseServi ...@@ -77,8 +77,10 @@ import com.freemud.sdk.api.assortment.shoppingcart.service.ShoppingCartBaseServi
import com.freemud.sdk.api.assortment.shoppingcart.service.impl.ShoppingCartBaseServiceImpl; import com.freemud.sdk.api.assortment.shoppingcart.service.impl.ShoppingCartBaseServiceImpl;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import javafx.util.Pair; import javafx.util.Pair;
import javafx.util.Pair;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang.ObjectUtils; import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -195,7 +197,6 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -195,7 +197,6 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
private StoreItemAdapter storeItemAdapter; private StoreItemAdapter storeItemAdapter;
/** /**
* 从微信卡券向购物车中添加商品 * 从微信卡券向购物车中添加商品
*/ */
...@@ -295,21 +296,21 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -295,21 +296,21 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
//商品skuId或者商品券的商品id //商品skuId或者商品券的商品id
String spuId2 = spuId; String spuId2 = spuId;
CouponProductDto couponProductDto = new CouponProductDto(); CouponProductDto couponProductDto = new CouponProductDto();
Boolean isMultiCoupon = false; Integer todayAvailableTimes = 0;
if (StringUtils.isBlank(couponCode)) { if (StringUtils.isBlank(couponCode)) {
productIds.add(Long.parseLong(goodsId)); productIds.add(Long.parseLong(goodsId));
} else { } else {
//校验券是否有效 这里是新的商品券支持多商品及换购券 //校验券是否有效 这里是新的商品券支持多商品及换购券
if (StringUtils.isNotBlank(skuId)) { if (StringUtils.isNotBlank(skuId)) {
Pair<String, Boolean> pair = validCoupon(partnerId, storeId, couponCode, productIds, BusinessTypeEnum.getByType(addShoppingCartGoodsRequestVo.getMenuType()).getCode(), skuId, couponProductDto); Pair<String, Integer> pair = validCoupon(partnerId, storeId, couponCode, productIds, BusinessTypeEnum.getByType(addShoppingCartGoodsRequestVo.getMenuType()).getCode(), skuId, couponProductDto);
spuId2 = pair.getKey(); spuId2 = pair.getKey();
isMultiCoupon = pair.getValue(); todayAvailableTimes = pair.getValue();
cartGoods.setGoodsId(spuId); cartGoods.setGoodsId(spuId);
} else { } else {
// 老版本商品券 // 老版本商品券
Pair<String, Boolean> pair = validCoupon(partnerId, storeId, couponCode, productIds, BusinessTypeEnum.getByType(addShoppingCartGoodsRequestVo.getMenuType()).getCode(), couponProductDto); Pair<String, Integer> pair = validCoupon(partnerId, storeId, couponCode, productIds, BusinessTypeEnum.getByType(addShoppingCartGoodsRequestVo.getMenuType()).getCode(), couponProductDto);
spuId2 = pair.getKey(); spuId2 = pair.getKey();
isMultiCoupon = pair.getValue(); todayAvailableTimes = pair.getValue();
} }
} }
// // 获取商品详细信息 // // 获取商品详细信息
...@@ -356,7 +357,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -356,7 +357,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
} else { } else {
// 当商品是商品券,里面会判断如果购物车中已有商品券,会将cartGoods的CartGoodsUid设为null // 当商品是商品券,里面会判断如果购物车中已有商品券,会将cartGoods的CartGoodsUid设为null
this.addProductGoods(addShoppingCartGoodsRequestVo, cartGoods, spuId2, userId, shoppingCartGoodsResponseVo, this.addProductGoods(addShoppingCartGoodsRequestVo, cartGoods, spuId2, userId, shoppingCartGoodsResponseVo,
spuId, allCartGoodsList, productBeanListSpuClass, couponProductDto, couponCode, isMultiCoupon); spuId, allCartGoodsList, productBeanListSpuClass, couponProductDto, couponCode, todayAvailableTimes);
} }
Long deliveryAmount = calculateDeliveryAmount(receiveId, partnerId, storeId, userLoginInfoDto.getWxAppid(), shoppingCartGoodsResponseVo,addShoppingCartGoodsRequestVo.getOrderType()); Long deliveryAmount = calculateDeliveryAmount(receiveId, partnerId, storeId, userLoginInfoDto.getWxAppid(), shoppingCartGoodsResponseVo,addShoppingCartGoodsRequestVo.getOrderType());
...@@ -1341,6 +1342,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -1341,6 +1342,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Discount discountDTO = result.getDiscounts().stream().filter(d -> 221 == d.getType()).findFirst().get(); ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Discount discountDTO = result.getDiscounts().stream().filter(d -> 221 == d.getType()).findFirst().get();
convert2SendPoint(result, discountDTO); convert2SendPoint(result, discountDTO);
} }
result.setValidCouponMap(validCouponMap); result.setValidCouponMap(validCouponMap);
result.setSpqIdToCartUuid(spqIdToCartUuid); result.setSpqIdToCartUuid(spqIdToCartUuid);
result.setDeliveryAmount(distributionFee); result.setDeliveryAmount(distributionFee);
...@@ -1424,6 +1426,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -1424,6 +1426,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
calculationDiscountGoods.setGoodsId(cartGoods.getGoodsId()); calculationDiscountGoods.setGoodsId(cartGoods.getGoodsId());
calculationDiscountGoods.setCartGoodsUid(cartGoods.getCartGoodsUid()); calculationDiscountGoods.setCartGoodsUid(cartGoods.getCartGoodsUid());
calculationDiscountGoods.setAddCartTime(cartGoods.getAddCartTime() == null ? 0 : cartGoods.getAddCartTime());
calculationDiscountGoods.setGoodsQuantity(cartGoods.getQty()); calculationDiscountGoods.setGoodsQuantity(cartGoods.getQty());
calculationDiscountGoods.setOriginalPrice(cartGoods.getFinalPrice()); calculationDiscountGoods.setOriginalPrice(cartGoods.getFinalPrice());
calculationDiscountGoods.setMemberDiscount(cartGoods.getMemberDiscount()); calculationDiscountGoods.setMemberDiscount(cartGoods.getMemberDiscount());
...@@ -1803,7 +1806,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -1803,7 +1806,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
*/ */
private void addProductGoods(AddShoppingCartGoodsRequestVo addShoppingCartGoodsRequestVo private void addProductGoods(AddShoppingCartGoodsRequestVo addShoppingCartGoodsRequestVo
, CartGoods cartGoods, String spuId2, String userId, ShoppingCartGoodsResponseVo shoppingCartGoodsResponseVo, String spuId , CartGoods cartGoods, String spuId2, String userId, ShoppingCartGoodsResponseVo shoppingCartGoodsResponseVo, String spuId
, List<CartGoods> allCartGoodsList, List<ProductBean> productBeanListSpuClass, CouponProductDto couponProductDto, String couponCode, Boolean isMultiCoupon) { , List<CartGoods> allCartGoodsList, List<ProductBean> productBeanListSpuClass, CouponProductDto couponProductDto, String couponCode, Integer todayAvailableTimes) {
...@@ -1820,9 +1823,9 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -1820,9 +1823,9 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
} }
// 商品券Id // 商品券Id
String spqId = spuId.substring(CommonsConstant.COUPON_PREFIX.length()); String spqId = spuId.substring(CommonsConstant.COUPON_PREFIX.length());
if (CollectionUtils.isNotEmpty(allCartGoodsList) && !isMultiCoupon){ if (CollectionUtils.isNotEmpty(allCartGoodsList)){
CartGoods sameCartGoods = allCartGoodsList.stream().filter(p -> p.getSpuId().equals(spqId)).findFirst().orElse(null); int sum = allCartGoodsList.stream().filter(p -> p.getSpuId().equals(spqId)).mapToInt(CartGoods::getQty).sum();
if (sameCartGoods != null && sameCartGoods.getQty() != null && sameCartGoods.getQty() > 0){ if (sum + cartGoods.getQty() > todayAvailableTimes){
throw new ServiceException(ResponseResult.SHOPPING_CART_GOODS_COUPON_CAN_NOT_USE); throw new ServiceException(ResponseResult.SHOPPING_CART_GOODS_COUPON_CAN_NOT_USE);
} }
} }
......
...@@ -17,6 +17,7 @@ import tk.mybatis.mapper.genid.GenId; ...@@ -17,6 +17,7 @@ import tk.mybatis.mapper.genid.GenId;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.stream.Collectors;
/** /**
* All rights Reserved, Designed By www.freemud.cn * All rights Reserved, Designed By www.freemud.cn
......
...@@ -12,6 +12,7 @@ import cn.freemud.service.impl.calculate.promotion.*; ...@@ -12,6 +12,7 @@ import cn.freemud.service.impl.calculate.promotion.*;
import com.freemud.sdk.api.assortment.shoppingcart.enums.BusinessTypeEnum; import com.freemud.sdk.api.assortment.shoppingcart.enums.BusinessTypeEnum;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
......
...@@ -18,6 +18,7 @@ import cn.freemud.service.CouponService; ...@@ -18,6 +18,7 @@ import cn.freemud.service.CouponService;
import cn.freemud.service.active.ActiveFactory; import cn.freemud.service.active.ActiveFactory;
import cn.freemud.service.active.ActiveService; import cn.freemud.service.active.ActiveService;
import cn.freemud.service.impl.AssortmentSdkService; import cn.freemud.service.impl.AssortmentSdkService;
import cn.freemud.service.impl.calculate.promotion.GiftSharingService;
import cn.freemud.service.thirdparty.CalculationClient; import cn.freemud.service.thirdparty.CalculationClient;
import cn.freemud.utils.PropertyConvertUtil; import cn.freemud.utils.PropertyConvertUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
...@@ -25,8 +26,11 @@ import com.freemud.application.sdk.api.log.ErrorLog; ...@@ -25,8 +26,11 @@ import com.freemud.application.sdk.api.log.ErrorLog;
import com.freemud.sdk.api.assortment.shoppingcart.constant.CommonsConstant; import com.freemud.sdk.api.assortment.shoppingcart.constant.CommonsConstant;
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 javafx.util.Pair;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -61,6 +65,9 @@ public class CalculationSharingDiscountService { ...@@ -61,6 +65,9 @@ public class CalculationSharingDiscountService {
@Autowired @Autowired
private ActiveFactory activeFactory; private ActiveFactory activeFactory;
@Autowired
private GiftSharingService giftSharingService;
public CalculationSharingDiscountResponseDto.CalculationDiscountResult getCalculationSharingDiscountResult(String menuType public CalculationSharingDiscountResponseDto.CalculationDiscountResult getCalculationSharingDiscountResult(String menuType
, String partnerId , String partnerId
, String storeId , String storeId
...@@ -213,6 +220,7 @@ public class CalculationSharingDiscountService { ...@@ -213,6 +220,7 @@ public class CalculationSharingDiscountService {
CalculationSharingDiscountResponseDto.CalculationDiscountResult.Discount discountDTO = result.getDiscounts().stream().filter(d -> 221 == d.getType()).findFirst().get(); CalculationSharingDiscountResponseDto.CalculationDiscountResult.Discount discountDTO = result.getDiscounts().stream().filter(d -> 221 == d.getType()).findFirst().get();
convert2SendPoint(result, discountDTO); convert2SendPoint(result, discountDTO);
} }
result.setValidCouponMap(validCouponMap); result.setValidCouponMap(validCouponMap);
result.setSpqIdToCartUuid(spqIdToCartUuid); result.setSpqIdToCartUuid(spqIdToCartUuid);
result.setDeliveryAmount(deliveryAmount); result.setDeliveryAmount(deliveryAmount);
...@@ -258,6 +266,7 @@ public class CalculationSharingDiscountService { ...@@ -258,6 +266,7 @@ public class CalculationSharingDiscountService {
calculationDiscountGoods.setGoodsId(cartGoods.getGoodsId()); calculationDiscountGoods.setGoodsId(cartGoods.getGoodsId());
calculationDiscountGoods.setCartGoodsUid(cartGoods.getCartGoodsUid()); calculationDiscountGoods.setCartGoodsUid(cartGoods.getCartGoodsUid());
calculationDiscountGoods.setGoodsQuantity(cartGoods.getQty()); calculationDiscountGoods.setGoodsQuantity(cartGoods.getQty());
calculationDiscountGoods.setAddCartTime(cartGoods.getAddCartTime() == null ? 0 : cartGoods.getAddCartTime());
//if (cartGoods.getGoodsType().equals(GoodsTypeEnum.SET_MEAL_GOODS)) //if (cartGoods.getGoodsType().equals(GoodsTypeEnum.SET_MEAL_GOODS))
if (CollectionUtils.isNotEmpty(cartGoods.getProductGroupList()) || CollectionUtils.isNotEmpty(cartGoods.getProductComboList())) { if (CollectionUtils.isNotEmpty(cartGoods.getProductGroupList()) || CollectionUtils.isNotEmpty(cartGoods.getProductComboList())) {
calculationDiscountGoods.setOriginalPrice(cartGoods.getFinalPrice()!=null ? cartGoods.getFinalPrice() : cartGoods.getOriginalPrice()); calculationDiscountGoods.setOriginalPrice(cartGoods.getFinalPrice()!=null ? cartGoods.getFinalPrice() : cartGoods.getOriginalPrice());
...@@ -324,6 +333,7 @@ public class CalculationSharingDiscountService { ...@@ -324,6 +333,7 @@ public class CalculationSharingDiscountService {
CalculationSharingDiscountRequestDto.CalculationDiscountGoods calculationDiscountGoods = new CalculationSharingDiscountRequestDto.CalculationDiscountGoods(); CalculationSharingDiscountRequestDto.CalculationDiscountGoods calculationDiscountGoods = new CalculationSharingDiscountRequestDto.CalculationDiscountGoods();
calculationDiscountGoods.setGoodsId(goodsId); calculationDiscountGoods.setGoodsId(goodsId);
calculationDiscountGoods.setCartGoodsUid(cartGoods.getCartGoodsUid()); calculationDiscountGoods.setCartGoodsUid(cartGoods.getCartGoodsUid());
calculationDiscountGoods.setAddCartTime(cartGoods.getAddCartTime() == null ? 0 : cartGoods.getAddCartTime());
calculationDiscountGoods.setGoodsQuantity(cartGoods.getQty()); calculationDiscountGoods.setGoodsQuantity(cartGoods.getQty());
calculationDiscountGoods.setOriginalPrice(originalPrice); calculationDiscountGoods.setOriginalPrice(originalPrice);
calculationDiscountGoods.setMemberDiscount(100); calculationDiscountGoods.setMemberDiscount(100);
...@@ -337,6 +347,7 @@ public class CalculationSharingDiscountService { ...@@ -337,6 +347,7 @@ public class CalculationSharingDiscountService {
CalculationSharingDiscountRequestDto.CalculationDiscountGoods calculationDiscountGoods = new CalculationSharingDiscountRequestDto.CalculationDiscountGoods(); CalculationSharingDiscountRequestDto.CalculationDiscountGoods calculationDiscountGoods = new CalculationSharingDiscountRequestDto.CalculationDiscountGoods();
calculationDiscountGoods.setGoodsId(goodsId); calculationDiscountGoods.setGoodsId(goodsId);
calculationDiscountGoods.setCartGoodsUid(cartGoods.getCartGoodsUid()); calculationDiscountGoods.setCartGoodsUid(cartGoods.getCartGoodsUid());
calculationDiscountGoods.setAddCartTime(cartGoods.getAddCartTime() == null ? 0 : cartGoods.getAddCartTime());
calculationDiscountGoods.setGoodsQuantity(cartGoods.getQty()); calculationDiscountGoods.setGoodsQuantity(cartGoods.getQty());
calculationDiscountGoods.setOriginalPrice(originalPrice); calculationDiscountGoods.setOriginalPrice(originalPrice);
calculationDiscountGoods.setMemberDiscount(100); calculationDiscountGoods.setMemberDiscount(100);
......
package cn.freemud.service.impl.calculate.promotion; package cn.freemud.service.impl.calculate.promotion;
import cn.freemud.entities.dto.ActivityCalculationDiscountResponseDto;
import cn.freemud.entities.dto.activity.ActivityDiscountsDto; import cn.freemud.entities.dto.activity.ActivityDiscountsDto;
import cn.freemud.entities.dto.activity.ActivityQueryDto; import cn.freemud.entities.dto.activity.ActivityQueryDto;
import cn.freemud.entities.dto.calculate.CalculationSharingDiscountResponseDto; import cn.freemud.entities.dto.calculate.CalculationSharingDiscountResponseDto;
...@@ -15,14 +16,13 @@ import cn.freemud.service.active.ActiveService; ...@@ -15,14 +16,13 @@ import cn.freemud.service.active.ActiveService;
import cn.freemud.service.impl.AssortmentSdkService; import cn.freemud.service.impl.AssortmentSdkService;
import com.freemud.application.sdk.api.productcenter.domain.ProductBeanDTO; import com.freemud.application.sdk.api.productcenter.domain.ProductBeanDTO;
import com.freemud.sdk.api.assortment.shoppingcart.service.impl.ShoppingCartBaseServiceImpl; import com.freemud.sdk.api.assortment.shoppingcart.service.impl.ShoppingCartBaseServiceImpl;
import javafx.util.Pair;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.ObjectUtils; import org.apache.commons.lang.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
......
...@@ -223,12 +223,12 @@ public class ShoppingCartMCoffeeServiceImpl { ...@@ -223,12 +223,12 @@ public class ShoppingCartMCoffeeServiceImpl {
// 购物车数据更新(保存商品原价) // 购物车数据更新(保存商品原价)
List<CartGoods> newCartGoods = updateCartGoodsLegal(partnerId, storeId, orderType, tableNumber, menuType, userId, addCartGoods, shoppingCartGoodsResponseVo, oldCartGoodsList); List<CartGoods> newCartGoods = updateCartGoodsLegal(partnerId, storeId, orderType, tableNumber, menuType, userId, addCartGoods, shoppingCartGoodsResponseVo, oldCartGoodsList);
// 促销活动等价格计算 // 促销活动等价格计算
calculationService.updateShoppingCartGoodsDiscount(partnerId, storeId, userId, appId, orderType, assortmentCustomerInfoVo.isMemberPaid(), menuType, receiveId, null, calculationService.updateShoppingCartGoodsDiscount(partnerId, storeId, userId, appId, orderType, assortmentCustomerInfoVo.isMemberPaid(), menuType, receiveId, null,
newCartGoods, coupons, new ArrayList<>(), shoppingCartGoodsResponseVo, null); newCartGoods, coupons, new ArrayList<>(), shoppingCartGoodsResponseVo, null);
// 重新保存购物车数据
updateCartGoodsLegal(partnerId, storeId, orderType, tableNumber, menuType, userId, addCartGoods, shoppingCartGoodsResponseVo, oldCartGoodsList); // 购物车信息到缓存中
assortmentSdkService.setShoppingCart(partnerId, storeId, userId, newCartGoods, null, tableNumber, this.shoppingCartBaseService);
// 返回购物车数据 // 返回购物车数据
setAddAndUpdateResponse(shoppingCartGoodsResponseVo, newCartGoods, null, ShoppingCartConstant.ADD_AND_UPDATE, null); setAddAndUpdateResponse(shoppingCartGoodsResponseVo, newCartGoods, null, ShoppingCartConstant.ADD_AND_UPDATE, null);
} }
...@@ -358,46 +358,46 @@ public class ShoppingCartMCoffeeServiceImpl { ...@@ -358,46 +358,46 @@ public class ShoppingCartMCoffeeServiceImpl {
if (StringUtils.isEmpty(requestVo.getShopId())) { if (StringUtils.isEmpty(requestVo.getShopId())) {
throw new ServiceException(ResponseResult.SHOPPING_CART_SHOP_ID_NOT_EMPTY); throw new ServiceException(ResponseResult.SHOPPING_CART_SHOP_ID_NOT_EMPTY);
} }
if (CollectionUtils.isEmpty(requestVo.getGoodsInfos())) { if (CollectionUtils.isEmpty(requestVo.getGoodsInfos()) && CollectionUtils.isEmpty(requestVo.getQtyInfoList())) {
return ResponseUtil.error(ResponseResult.SHOPPING_CART_ADD_INVAILD); return ResponseUtil.error(ResponseResult.SHOPPING_CART_ADD_INVAILD);
} }
if (CollectionUtils.isEmpty(requestVo.getQtyInfoList())){ BaseResponse baseResponse = null;
return ResponseUtil.error(ResponseResult.SHOPPING_CART_UPDATE_ERROR); if (CollectionUtils.isNotEmpty(requestVo.getQtyInfoList())) {
BatchUpdateGoodsQtyRequestVo updateGoodsQtyRequestVo = new BatchUpdateGoodsQtyRequestVo();
updateGoodsQtyRequestVo.setAppId(requestVo.getAppId());
updateGoodsQtyRequestVo.setChannelType(requestVo.getChannelType());
updateGoodsQtyRequestVo.setCarVer(requestVo.getCarVer());
updateGoodsQtyRequestVo.setMenuType(requestVo.getMenuType());
updateGoodsQtyRequestVo.setReceiveId(requestVo.getReceiveId());
updateGoodsQtyRequestVo.setSessionId(requestVo.getSessionId());
updateGoodsQtyRequestVo.setVersion(requestVo.getVersion());
updateGoodsQtyRequestVo.setShopId(requestVo.getShopId());
updateGoodsQtyRequestVo.setPartnerId(requestVo.getPartnerId());
updateGoodsQtyRequestVo.setQtyInfoList(requestVo.getQtyInfoList());
baseResponse = this.batchUpdateGoodsQty(updateGoodsQtyRequestVo);
//批量更新失败,直接返回错误
if (!Objects.equals(ResponseResult.SUCCESS.getCode(), baseResponse.getCode())) {
return baseResponse;
}
} }
BaseResponse baseResponse; if (CollectionUtils.isNotEmpty(requestVo.getGoodsInfos())) {
BatchUpdateGoodsQtyRequestVo updateGoodsQtyRequestVo = new BatchUpdateGoodsQtyRequestVo(); MCoffeeBatchAddGoodsRequestVo addGoodsRequestVo = new MCoffeeBatchAddGoodsRequestVo();
updateGoodsQtyRequestVo.setAppId(requestVo.getAppId()); addGoodsRequestVo.setAppId(requestVo.getAppId());
updateGoodsQtyRequestVo.setChannelType(requestVo.getChannelType()); addGoodsRequestVo.setChannelType(requestVo.getChannelType());
updateGoodsQtyRequestVo.setCarVer(requestVo.getCarVer()); addGoodsRequestVo.setMenuType(requestVo.getMenuType());
updateGoodsQtyRequestVo.setMenuType(requestVo.getMenuType()); addGoodsRequestVo.setReceiveId(requestVo.getReceiveId());
updateGoodsQtyRequestVo.setReceiveId(requestVo.getReceiveId()); addGoodsRequestVo.setSessionId(requestVo.getSessionId());
updateGoodsQtyRequestVo.setSessionId(requestVo.getSessionId()); addGoodsRequestVo.setGoodsInfos(requestVo.getGoodsInfos());
updateGoodsQtyRequestVo.setVersion(requestVo.getVersion()); addGoodsRequestVo.setShopId(requestVo.getShopId());
updateGoodsQtyRequestVo.setShopId(requestVo.getShopId()); addGoodsRequestVo.setOrderType(requestVo.getOrderType());
updateGoodsQtyRequestVo.setPartnerId(requestVo.getPartnerId()); addGoodsRequestVo.setPartnerId(requestVo.getPartnerId());
updateGoodsQtyRequestVo.setQtyInfoList(requestVo.getQtyInfoList()); addGoodsRequestVo.setGoodsInfos(requestVo.getGoodsInfos());
baseResponse = this.batchUpdateGoodsQty(updateGoodsQtyRequestVo); baseResponse = this.addBatchGoods(addGoodsRequestVo);
//批量更新失败,直接返回错误 //批量新增失败,直接返回错误
if (!Objects.equals(ResponseResult.SUCCESS.getCode(),baseResponse.getCode())){ if (!Objects.equals(ResponseResult.SUCCESS.getCode(), baseResponse.getCode())) {
return baseResponse; return baseResponse;
} }
MCoffeeBatchAddGoodsRequestVo addGoodsRequestVo = new MCoffeeBatchAddGoodsRequestVo();
addGoodsRequestVo.setAppId(requestVo.getAppId());
addGoodsRequestVo.setChannelType(requestVo.getChannelType());
addGoodsRequestVo.setMenuType(requestVo.getMenuType());
addGoodsRequestVo.setReceiveId(requestVo.getReceiveId());
addGoodsRequestVo.setSessionId(requestVo.getSessionId());
addGoodsRequestVo.setGoodsInfos(requestVo.getGoodsInfos());
addGoodsRequestVo.setShopId(requestVo.getShopId());
addGoodsRequestVo.setOrderType(requestVo.getOrderType());
addGoodsRequestVo.setPartnerId(requestVo.getPartnerId());
addGoodsRequestVo.setGoodsInfos(requestVo.getGoodsInfos());
baseResponse = this.addBatchGoods(addGoodsRequestVo);
//批量新增失败,直接返回错误
if (!Objects.equals(ResponseResult.SUCCESS.getCode(),baseResponse.getCode())){
return baseResponse;
} }
return baseResponse; return baseResponse;
} }
...@@ -633,28 +633,20 @@ public class ShoppingCartMCoffeeServiceImpl { ...@@ -633,28 +633,20 @@ public class ShoppingCartMCoffeeServiceImpl {
assortmentSdkService.setShoppingCart(partnerId, storeId, userId, cartGoodsList, sessionId, "", shoppingCartBaseService); assortmentSdkService.setShoppingCart(partnerId, storeId, userId, cartGoodsList, sessionId, "", shoppingCartBaseService);
} }
/** // 门店列表页面无法获取到购物车行id导致前端需求,不管券信息是否为空,都更新到缓存
* 如果couponCode为空,则从缓存里尝试获取 //兼容前端逻辑,前端传递的券信息为空 或者 为 remove 时,清空购物车券,否则更新
* 如果couponCode不为空,则设置到缓存里 if(StringUtils.isEmpty(couponCode) || "remove".equals(couponCode)) {
*/ assortmentSdkService.setShoppingCartCouponCode(partnerId, storeId, userId, "",shoppingCartBaseService, SaveCouponType.COUPON.getCode());
if(StringUtils.isEmpty(couponCode)) {
couponCode = assortmentSdkService.getShoppingCartCoupon(partnerId, storeId, userId, shoppingCartBaseService, SaveCouponType.COUPON.getCode());
} else { } else {
if("remove".equals(couponCode)) {
couponCode = "";
}
assortmentSdkService.setShoppingCartCouponCode(partnerId, storeId, userId, couponCode, shoppingCartBaseService, SaveCouponType.COUPON.getCode()); assortmentSdkService.setShoppingCartCouponCode(partnerId, storeId, userId, couponCode, shoppingCartBaseService, SaveCouponType.COUPON.getCode());
} }
if(StringUtils.isEmpty(freightCouponCode) || "remove".equals(freightCouponCode)) {
if(StringUtils.isEmpty(freightCouponCode)) { assortmentSdkService.setShoppingCartCouponCode(partnerId, storeId, userId, "",shoppingCartBaseService, SaveCouponType.FREIGHT_COUPON.getCode());
freightCouponCode = assortmentSdkService.getShoppingCartCoupon(partnerId, storeId, userId, shoppingCartBaseService, SaveCouponType.FREIGHT_COUPON.getCode());
} else { } else {
if("remove".equals(freightCouponCode)) {
freightCouponCode = "";
}
assortmentSdkService.setShoppingCartCouponCode(partnerId, storeId, userId, freightCouponCode, shoppingCartBaseService, SaveCouponType.FREIGHT_COUPON.getCode()); assortmentSdkService.setShoppingCartCouponCode(partnerId, storeId, userId, freightCouponCode, shoppingCartBaseService, SaveCouponType.FREIGHT_COUPON.getCode());
} }
//放到参数里 //放到参数里
if(StringUtils.isNotEmpty(couponCode) ) { if(StringUtils.isNotEmpty(couponCode) ) {
shoppingCartInfoRequestVo.setCouponCode(couponCode); shoppingCartInfoRequestVo.setCouponCode(couponCode);
...@@ -1364,8 +1356,6 @@ public class ShoppingCartMCoffeeServiceImpl { ...@@ -1364,8 +1356,6 @@ public class ShoppingCartMCoffeeServiceImpl {
} }
}); });
} }
// 重新set购物车信息到缓存中
assortmentSdkService.setShoppingCart(partnerId, storeId, userId, nowCartGoodsList, null, tableNumber, this.shoppingCartBaseService);
return nowCartGoodsList; return nowCartGoodsList;
} }
......
...@@ -159,6 +159,10 @@ public class CalculationServiceImpl { ...@@ -159,6 +159,10 @@ public class CalculationServiceImpl {
ErrorLog.printErrorLog("calculation_discount_error", "/calculation/discount/sharding", discountRequest, ex); ErrorLog.printErrorLog("calculation_discount_error", "/calculation/discount/sharding", discountRequest, ex);
throw new ServiceException(ResponseResult.OPERATE_TOO_OFTEN); throw new ServiceException(ResponseResult.OPERATE_TOO_OFTEN);
} }
//优惠券互斥
if (null != activityCalculationDiscountResponseDto && StringUtils.equals(activityCalculationDiscountResponseDto.getStatusCode(),ResponseCodeConstant.RESPONSE_CONFLICTS_STR)){
throw new ServiceException(ResponseResult.COUPON_CONFLICTS_ERROR);
}
// 返回成功 // 返回成功
if (activityCalculationDiscountResponseDto == null || !StringUtils.equals(activityCalculationDiscountResponseDto.getStatusCode(), ResponseCodeConstant.RESPONSE_SUCCESS_STR)) { if (activityCalculationDiscountResponseDto == null || !StringUtils.equals(activityCalculationDiscountResponseDto.getStatusCode(), ResponseCodeConstant.RESPONSE_SUCCESS_STR)) {
throw new ServiceException(ResponseResult.OPERATE_TOO_OFTEN); throw new ServiceException(ResponseResult.OPERATE_TOO_OFTEN);
......
...@@ -60,6 +60,5 @@ public class MCoffeeBatchAddGoodsRequestVo { ...@@ -60,6 +60,5 @@ public class MCoffeeBatchAddGoodsRequestVo {
/** /**
* 商品信息 * 商品信息
*/ */
@NotEmpty(message = "商品信息不可为空")
private List<BatchGoodsInfoVo> goodsInfos; private List<BatchGoodsInfoVo> goodsInfos;
} }
...@@ -21,6 +21,6 @@ management.endpoints.web.base-path=/ ...@@ -21,6 +21,6 @@ management.endpoints.web.base-path=/
management.endpoints.web.exposure.include=prometheus,info,health,shutdown management.endpoints.web.exposure.include=prometheus,info,health,shutdown
management.metrics.tags.application=${spring.application.name} management.metrics.tags.application=${spring.application.name}
management.endpoint.shutdown.enabled=true management.endpoint.shutdown.enabled=true
management.security.enabled=false #management.security.enabled=false
management.health.rabbit.enabled=false management.health.rabbit.enabled=false
apollo.plugin.namespace=openstore.gray.rule apollo.plugin.namespace=openstore.gray.rule
\ No newline at end of file
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