Commit a2f31a02 by zhiheng.zhang

Merge remote-tracking branch 'origin/qa' into qa

parents 360197b8 998b2f92
......@@ -88,12 +88,9 @@
| 2.2.18-SNAPSHOT| 抖音支付新增抖音单号和openId | 张志恒 | 2020-12-4 |
| 2.1.7-RELEASE | 农工商撤单 | 张志恒 | 2020-12-07 |
| 2.2.20-SNAPSHOT| 抖音支付 | 张志恒 | 2020-12-11ß |
| 2.1.8-RELEASE | 拼单 | 缪晖 | 2020-12-10 |
| 2.1.9-RELEASE | 去掉0元核销优惠券 | 李小二 | 2020-12-14 |
| 2.1.10-RELEASE | coco | 刘鹏飞 | 2020-12-17 |
| 2.1.11-RELEASE | 农工商添加设备号 | 梁崇福 | 2020-12-17 |
| 2.1.12-RELEASE | coco定制优惠券核销 | 刘鹏飞 | 2020-12-24 |
| 2.1.19-SNAPSHOT | 增加配送类型字段 | 王航航 | 2020-12-22 |
\ No newline at end of file
| 2.1.19-SNAPSHOT | 增加配送类型字段 | 王航航 | 2020-12-22 |
......@@ -135,6 +135,10 @@ public class QueryOrdersResponseDto {
*/
private Integer orderType;
/**
* 销售类型或营销活动类型 1普通订单 2秒杀订单 3推广活动 4拼单订单
*/
private Byte marketingType;
/**
* 取餐码
*/
private String otherCode;
......
package cn.freemud.entities.vo;
import lombok.Data;
import org.hibernate.validator.constraints.NotEmpty;
@Data
public class PlatformPaySuccessRequest {
@NotEmpty(message = "orderCode 不能为空")
private String orderCode;
@NotEmpty(message = "商户号 不能为空")
private String partnerId;
}
......@@ -147,8 +147,4 @@ public interface Orderservice {
BaseResponse timeOutOrderRefund(TimeOutOrderVo timeOutOrderVo);
BaseResponse platformPaysuccess(PlatformPaySuccessRequest requestVo);
}
......@@ -522,25 +522,27 @@ public class OrderServiceImpl implements Orderservice {
takeCode = payAccessResponse.getData().getTakeCode();
daySeq = payAccessResponse.getData().getDaySeq();
//TODO 清空购物车
NewShoppingCartClearDto newShoppingCartClearDto = new NewShoppingCartClearDto();
newShoppingCartClearDto.setPartnerId(partnerId);
newShoppingCartClearDto.setShopId(storeId);
newShoppingCartClearDto.setUserId(userId);
newShoppingCartClearDto.setAppId(wxappid);
newShoppingCartClearDto.setSessionId(sessionId);
newShoppingCartClearDto.setOperationType(1);
shoppingCartClient.clearShoppingCart(newShoppingCartClearDto);
// 清空拼单购物车
CollageOrderDto collageOrderDto = new CollageOrderDto();
collageOrderDto.setSessionId(StringUtils.isBlank(sessionId) ? oid : sessionId);
collageOrderDto.setPartnerId(partnerId);
collageOrderDto.setShopId(storeId);
collageOrderDto.setCreateCollageUserId(userId);
collageOrderDto.setOrderCode(oid);
collageOrderDto.setStatus(1);
shoppingCartClient.updateCollageOrder(collageOrderDto);
if (null != orderBean.getMarketingType() && OrderMarketType.COLLAGE.getIndex() == orderBean.getMarketingType()) {
// 更新拼单购物车状态
CollageOrderDto collageOrderDto = new CollageOrderDto();
collageOrderDto.setSessionId(StringUtils.isBlank(sessionId) ? oid : sessionId);
collageOrderDto.setPartnerId(partnerId);
collageOrderDto.setShopId(storeId);
collageOrderDto.setCreateCollageUserId(userId);
collageOrderDto.setOrderCode(oid);
collageOrderDto.setStatus(1);
shoppingCartClient.updateCollageOrder(collageOrderDto);
} else {
//TODO 清空购物车
NewShoppingCartClearDto newShoppingCartClearDto = new NewShoppingCartClearDto();
newShoppingCartClearDto.setPartnerId(partnerId);
newShoppingCartClearDto.setShopId(storeId);
newShoppingCartClearDto.setUserId(userId);
newShoppingCartClearDto.setAppId(wxappid);
newShoppingCartClearDto.setSessionId(sessionId);
newShoppingCartClearDto.setOperationType(1);
shoppingCartClient.clearShoppingCart(newShoppingCartClearDto);
}
if (StringUtils.isNotBlank(daySeq) && orderExtInfoDto != null && !OrderType.TAKE_OUT.getCode().equals(orderBean.getType())) {
String storeAddress = StringUtils.isNotBlank(orderBean.getAddress()) ? orderBean.getAddress() : "";
......@@ -1280,24 +1282,6 @@ public class OrderServiceImpl implements Orderservice {
return ResponseUtil.success();
}
@Override
public BaseResponse platformPaysuccess(PlatformPaySuccessRequest requestVo) {
BaseQueryOrderRequest baseQueryOrderRequest = new BaseQueryOrderRequest();
baseQueryOrderRequest.setOrderId(requestVo.getOrderCode());
baseQueryOrderRequest.setTrackingNo(LogThreadLocal.getTrackingNo());
QueryOrderByIdResponse queryOrderByIdResponse = orderCenterSdkService.queryOrderById(baseQueryOrderRequest);
if (!RESPONSE_SUCCESS_CODE.equals(queryOrderByIdResponse.getErrcode()) || queryOrderByIdResponse.getData() == null) {
return ResponseUtil.error(ResponseResult.ORDER_QUERYORDER_ERROR);
}
// 扣减储值卡
// 扣减券
// 扣减积分
return ResponseUtil.success();
}
private String getRedpacketsPicture(String activityId) {
if (StringUtils.isNotBlank(activityId)) {
......
......@@ -26,7 +26,6 @@ import com.freemud.application.sdk.api.storecenter.response.StoreResponse;
import com.freemud.sdk.api.assortment.order.adapter.OrderSdkAdapter;
import com.freemud.sdk.api.assortment.order.enums.OrderSourceType;
import com.freemud.sdk.api.assortment.order.response.order.QueryOrdersResponse;
import javafx.util.Pair;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils;
......
......@@ -22,7 +22,6 @@ import com.freemud.application.sdk.api.storecenter.response.StoreResponse;
import com.freemud.application.sdk.api.storecenter.service.StoreCenterService;
import com.freemud.sdk.api.assortment.order.enums.OrderSourceType;
import com.freemud.sdk.api.assortment.order.response.order.QueryOrdersResponse;
import javafx.util.Pair;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils;
......
......@@ -179,7 +179,8 @@ public enum ResponseResult {
/**
* coco验证券错误
*/
COCO_COUPON_VALIDATOR_FAIL("49000", "优惠券验证错误")
COCO_COUPON_VALIDATOR_FAIL("49000", "优惠券验证错误"),
NEW_PURCHASE("49001", "超过限购数量了")
;
......
......@@ -193,6 +193,7 @@ public class CalculationSharingDiscountService {
CalculationSharingDiscountResponseDto.CalculationDiscountResult.Discount discountDTO = result.getDiscounts().stream().filter(d -> 221 == d.getType()).findFirst().get();
convert2SendPoint(result, discountDTO);
}
this.checkPurchase(result);
result.setValidCouponMap(validCouponMap);
result.setDeliveryAmount(deliveryAmount);
result.setDistributionFee(result.getDistributionFee());
......@@ -209,6 +210,21 @@ public class CalculationSharingDiscountService {
return null;
}
private void checkPurchase(CalculationSharingDiscountResponseDto.CalculationDiscountResult result) {
if (CollectionUtils.isEmpty(result.getGoods())) {
return;
}
Integer type = 16;
for (CalculationSharingDiscountResponseDto.CalculationDiscountResult.Goods good : result.getGoods()) {
if (CollectionUtils.isNotEmpty(good.getDiscounts())) {
for (CalculationSharingDiscountResponseDto.CalculationDiscountResult.Goods.GoodsDiscount discount : good.getDiscounts()) {
if (type.equals(discount.getType()) && good.getGoodsQuantity()>=discount.getActualGoodsNumber()) {
throw new ServiceException(ResponseResult.NEW_PURCHASE);
}
}
}
}
}
private void convert2SendPoint(CalculationSharingDiscountResponseDto.CalculationDiscountResult result, CalculationSharingDiscountResponseDto.CalculationDiscountResult.Discount discountDTO) {
SendPoint sendPointNew = new SendPoint();
......
......@@ -475,32 +475,36 @@ public class CouponDiscountCalculation {
private Long createProductRequest(List<CartGoods> cartGoods, List<CouponProductVo> productList) {
Long totalAmount = 0L;
for (CartGoods cartGood : cartGoods) {
// 剔除商品券得商品
if (StringUtils.isEmpty(cartGood.getSkuId()) && StringUtils.isEmpty(cartGood.getSpuId())) {
continue;
}
// 剔除商品券得商品,麦咖啡逻辑
if(StringUtils.isNotEmpty(cartGood.getCouponCode())){
continue;
}
CouponProductVo product = new CouponProductVo();
product.setKeyProductCode(cartGood.getCustomerCode());
product.setProductId(StringUtils.isEmpty(cartGood.getSkuId()) ? cartGood.getSpuId() : cartGood.getSkuId());
// 普通商品价格
product.setAmount(Integer.valueOf(cartGood.getOriginalPrice() + ""));
// 套餐价格为: 套餐价+可选商品总价格
if (ObjectUtils.equals(GoodsTypeEnum.SET_MEAL_GOODS.getGoodsType(), cartGood.getGoodsType())) {
Long finalPrice = cartGood.getFinalPrice();
if (CollectionUtils.isNotEmpty(cartGood.getProductGroupList())){
finalPrice+=cartGood.getProductGroupList().stream().mapToLong(group->group.getFinalPrice()*group.getQty()).sum();
try {
for (CartGoods cartGood : cartGoods) {
// 剔除商品券得商品
if (StringUtils.isEmpty(cartGood.getSkuId()) && StringUtils.isEmpty(cartGood.getSpuId())) {
continue;
}
// 剔除商品券得商品,麦咖啡逻辑
if(StringUtils.isNotEmpty(cartGood.getCouponCode())){
continue;
}
CouponProductVo product = new CouponProductVo();
product.setKeyProductCode(cartGood.getCustomerCode());
product.setProductId(StringUtils.isEmpty(cartGood.getSkuId()) ? cartGood.getSpuId() : cartGood.getSkuId());
// 普通商品价格
product.setAmount(Integer.valueOf(cartGood.getOriginalPrice() + ""));
// 套餐价格为: 套餐价+可选商品总价格
if (ObjectUtils.equals(GoodsTypeEnum.SET_MEAL_GOODS.getGoodsType(), cartGood.getGoodsType())) {
Long finalPrice = cartGood.getFinalPrice();
if (CollectionUtils.isNotEmpty(cartGood.getProductGroupList())){
finalPrice+=cartGood.getProductGroupList().stream().mapToLong(group->group.getFinalPrice()*group.getQty()).sum();
}
product.setAmount(finalPrice.intValue());
}
product.setAmount(finalPrice.intValue());
// 数量
product.setQuantity(cartGood.getQty());
productList.add(product);
totalAmount = totalAmount +product.getAmount() * cartGood.getQty();
}
// 数量
product.setQuantity(cartGood.getQty());
productList.add(product);
totalAmount = totalAmount +product.getAmount() * cartGood.getQty();
} catch (NumberFormatException e) {
throw new ServiceException(ResponseResult.SYSTEM_ERROR);
}
return totalAmount;
}
......
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