Commit fdd128ef by zhiheng.zhang

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

parents cec0f80a a086efca
...@@ -233,7 +233,8 @@ public class OrderController { ...@@ -233,7 +233,8 @@ public class OrderController {
@ApiAnnotation(logMessage = "deleteOrderById") @ApiAnnotation(logMessage = "deleteOrderById")
@PostMapping("/deleteOrderById") @PostMapping("/deleteOrderById")
public BaseResponse deleteOrderById(@Validated @LogParams @RequestBody DeleteOrderVo deleteOrderVo) { public BaseResponse deleteOrderById(@Validated @LogParams @RequestBody DeleteOrderVo deleteOrderVo) {
return orderservice.deleteOrderById(deleteOrderVo); //return orderservice.deleteOrderById(deleteOrderVo);
return orderservice.cancelPayOrder(deleteOrderVo);
} }
/** /**
......
...@@ -102,8 +102,12 @@ import com.freemud.application.sdk.api.ordercenter.response.orderInfo.OrderSettl ...@@ -102,8 +102,12 @@ import com.freemud.application.sdk.api.ordercenter.response.orderInfo.OrderSettl
import com.freemud.application.sdk.api.ordercenter.service.OrderDownLoadSdkService; import com.freemud.application.sdk.api.ordercenter.service.OrderDownLoadSdkService;
import com.freemud.application.sdk.api.ordercenter.service.OrderSdkService; import com.freemud.application.sdk.api.ordercenter.service.OrderSdkService;
import com.freemud.application.sdk.api.paymentcenter.client.request.CodePayRequest; import com.freemud.application.sdk.api.paymentcenter.client.request.CodePayRequest;
import com.freemud.application.sdk.api.paymentcenter.client.request.PaymentCloseUnifiedOrderRequest;
import com.freemud.application.sdk.api.paymentcenter.client.request.PaymentQueryRequest;
import com.freemud.application.sdk.api.paymentcenter.client.request.SVCCardAmountRequest; import com.freemud.application.sdk.api.paymentcenter.client.request.SVCCardAmountRequest;
import com.freemud.application.sdk.api.paymentcenter.client.response.CodePayResponse; import com.freemud.application.sdk.api.paymentcenter.client.response.CodePayResponse;
import com.freemud.application.sdk.api.paymentcenter.client.response.PaymentCloseUnifiedOrderResponse;
import com.freemud.application.sdk.api.paymentcenter.client.response.PaymentQueryResponse;
import com.freemud.application.sdk.api.paymentcenter.client.response.SVCCardAmountResponse; import com.freemud.application.sdk.api.paymentcenter.client.response.SVCCardAmountResponse;
import com.freemud.application.sdk.api.paymentcenter.client.service.PaymentNewService; import com.freemud.application.sdk.api.paymentcenter.client.service.PaymentNewService;
import com.freemud.application.sdk.api.storecenter.request.GetListByCodesRequest; import com.freemud.application.sdk.api.storecenter.request.GetListByCodesRequest;
...@@ -306,11 +310,9 @@ public class OrderServiceImpl implements Orderservice { ...@@ -306,11 +310,9 @@ public class OrderServiceImpl implements Orderservice {
@Autowired @Autowired
private SvcComPayClient svcComPayClient; private SvcComPayClient svcComPayClient;
@Autowired @Autowired
private OrderRelationFactory orderRelationFactory; private OrderRelationFactory orderRelationFactory;
@Override @Override
public BaseResponse checkBeforeCreateOrder(CheckBeforeCreateOrderRequestVo requestVo) { public BaseResponse checkBeforeCreateOrder(CheckBeforeCreateOrderRequestVo requestVo) {
String trackingNo = LogTreadLocal.getTrackingNo(); String trackingNo = LogTreadLocal.getTrackingNo();
...@@ -416,7 +418,7 @@ public class OrderServiceImpl implements Orderservice { ...@@ -416,7 +418,7 @@ public class OrderServiceImpl implements Orderservice {
dto.setPartnerId(partnerId); dto.setPartnerId(partnerId);
dto.setStoreId(storeId); dto.setStoreId(storeId);
dto.setTrackingNo(LogThreadLocal.getTrackingNo()); dto.setTrackingNo(LogThreadLocal.getTrackingNo());
//paymentQueueService.paymentCallback(dto); paymentQueueService.paymentCallback(dto);
} catch (Exception e) { } catch (Exception e) {
log.info("paymentQueueService.paymentCallback" + dto + " error" + e); log.info("paymentQueueService.paymentCallback" + dto + " error" + e);
} }
...@@ -438,7 +440,7 @@ public class OrderServiceImpl implements Orderservice { ...@@ -438,7 +440,7 @@ public class OrderServiceImpl implements Orderservice {
dto.setStoreId(storeId); dto.setStoreId(storeId);
dto.setPayChannelType(payChanelType); dto.setPayChannelType(payChanelType);
dto.setTrackingNo(LogThreadLocal.getTrackingNo()); dto.setTrackingNo(LogThreadLocal.getTrackingNo());
//paymentQueueService.paymentCallback(dto); paymentQueueService.paymentCallback(dto);
} catch (Exception e) { } catch (Exception e) {
log.info("paymentQueueService.paymentCallback" + dto + " error" + e); log.info("paymentQueueService.paymentCallback" + dto + " error" + e);
} }
...@@ -474,7 +476,6 @@ public class OrderServiceImpl implements Orderservice { ...@@ -474,7 +476,6 @@ public class OrderServiceImpl implements Orderservice {
} }
// 如果订单状态不是未支付,返回信息 // 如果订单状态不是未支付,返回信息
if (!PayStatus.NOT_PAY.getCode().equals(orderBean.getPayStatus()) || !OrderStatus.WAIT_PAY.getCode().equals(orderBean.getStatus())) { if (!PayStatus.NOT_PAY.getCode().equals(orderBean.getPayStatus()) || !OrderStatus.WAIT_PAY.getCode().equals(orderBean.getStatus())) {
return sendPaySuccessNoticeMessage(); return sendPaySuccessNoticeMessage();
} }
//若该订单使用了优惠券,则移除卡包,移除失败也不退款,现在支付成功个调用核销,无需调用此功能 //若该订单使用了优惠券,则移除卡包,移除失败也不退款,现在支付成功个调用核销,无需调用此功能
...@@ -1721,7 +1722,7 @@ public class OrderServiceImpl implements Orderservice { ...@@ -1721,7 +1722,7 @@ public class OrderServiceImpl implements Orderservice {
if (!OrderStatus.WAIT_PAY.getCode().equals(orderBean.getStatus())) { if (!OrderStatus.WAIT_PAY.getCode().equals(orderBean.getStatus())) {
return ResponseUtil.error(ResponseResult.ORDER_DELETE_ERROR.getCode(), "订单状态不允许取消"); return ResponseUtil.error(ResponseResult.ORDER_DELETE_ERROR.getCode(), "订单状态不允许取消");
} }
// this.closeHistoryPrePay(orderBean);
CancelOrderRequest var1 = new CancelOrderRequest(); CancelOrderRequest var1 = new CancelOrderRequest();
var1.setOrderId(deleteOrderVo.getOid()); var1.setOrderId(deleteOrderVo.getOid());
var1.setPartnerId(deleteOrderVo.getPartnerId()); var1.setPartnerId(deleteOrderVo.getPartnerId());
...@@ -3538,7 +3539,7 @@ public class OrderServiceImpl implements Orderservice { ...@@ -3538,7 +3539,7 @@ public class OrderServiceImpl implements Orderservice {
.orElse(null); .orElse(null);
//现金+svc 现金 //现金+svc 现金
if (payPlatforms.size()==2 || payPlatforms.size()==1 && cashPay!=null) { if (payPlatforms.size()==2 || (payPlatforms.size()==1 && cashPay!=null)) {
orderPayResponse = orderAdapter.convent2OrderCombPayResponse(combPayResponse.getData().getPayPlatformResponseList(),orderBean.getCompanyId(),storeId); orderPayResponse = orderAdapter.convent2OrderCombPayResponse(combPayResponse.getData().getPayPlatformResponseList(),orderBean.getCompanyId(),storeId);
orderPayResponse.setOpenId(paymentRequest.getOpenId()); orderPayResponse.setOpenId(paymentRequest.getOpenId());
orderPayResponse.setWxAppid(paymentRequest.getWxAppId()); orderPayResponse.setWxAppid(paymentRequest.getWxAppId());
...@@ -3709,4 +3710,40 @@ public class OrderServiceImpl implements Orderservice { ...@@ -3709,4 +3710,40 @@ public class OrderServiceImpl implements Orderservice {
sdkUpdateAbnormalState.setOrderCode(orderBean.getOid()); sdkUpdateAbnormalState.setOrderCode(orderBean.getOid());
orderSdkService.updateAbnormalState(sdkUpdateAbnormalState); orderSdkService.updateAbnormalState(sdkUpdateAbnormalState);
} }
private void closeHistoryPrePay(OrderBean orderBean) {
OrderExtInfoDto extInfo = JSONObject.parseObject(orderBean.getExtInfo(), OrderExtInfoDto.class);
//判断当前订单是否存在预支付订单
if(extInfo != null && StringUtils.isNotEmpty(extInfo.getFmId())){
//订单状态未支付且存在预支付订单:
// 1.查询预支付订单支付状态
PaymentQueryRequest paymentQueryRequest = new PaymentQueryRequest();
paymentQueryRequest.setPartnerId(orderBean.getCompanyId());
paymentQueryRequest.setStoreId(orderBean.getShopId());
paymentQueryRequest.setFmId(extInfo.getFmId());
paymentQueryRequest.setVer("2");
com.freemud.application.sdk.api.base.BaseResponse<PaymentQueryResponse> queryResponseBaseResponse = paymentNewService.query(paymentQueryRequest,LogThreadLocal.getTrackingNo());
//判断预支付订单状态
if(ObjectUtils.notEqual(ResponseResult.SUCCESS.getCode(), queryResponseBaseResponse.getCode())){
throw new ServiceException(ResponseResult.ORDER_PAY_GETPRE_MESSAGE_ERROR);
}
//判断当前预支付订单是否已经支付成功
if(ObjectUtils.equals(TradeState.SUCCESS.getCode(), queryResponseBaseResponse.getData().getTradeState())){
throw new ServiceException(ResponseResult.ORDER_HAS_PAID);
}
// 3.取消前一个预支付订单 调用支付取消预支付订单,如果预支付订单已经取消了再调用取消预支付订单接口会报错的
if(ObjectUtils.equals(TradeState.NOTPAY.getCode(), queryResponseBaseResponse.getData().getTradeState())) {
PaymentCloseUnifiedOrderRequest closeUnifiedOrderRequest = new PaymentCloseUnifiedOrderRequest();
closeUnifiedOrderRequest.setFmId(extInfo.getFmId());
closeUnifiedOrderRequest.setVer("2");
closeUnifiedOrderRequest.setPartnerId(orderBean.getCompanyId());
closeUnifiedOrderRequest.setStoreId(orderBean.getShopId());
com.freemud.application.sdk.api.base.BaseResponse<PaymentCloseUnifiedOrderResponse> cancelNewUnifiedOrder = paymentNewService.cancelNewUnifiedOrder(closeUnifiedOrderRequest,LogThreadLocal.getTrackingNo());
if(ObjectUtils.notEqual(ResponseResult.SUCCESS.getCode(),cancelNewUnifiedOrder.getCode())){
throw new ServiceException(ResponseResult.ORDER_PRE_PAYMENT_CLOSE_FAILED);
}
}
}
}
} }
...@@ -747,7 +747,88 @@ public class ShoppingCartConvertAdapter { ...@@ -747,7 +747,88 @@ public class ShoppingCartConvertAdapter {
productMaterialList.add(materialGoods); productMaterialList.add(materialGoods);
comboxGoods.setProductMaterialList(productMaterialList); comboxGoods.setProductMaterialList(productMaterialList);
} }
}
/**
* 更新套餐可选商品加料信息
*/
private void updateComboxGoodsInfoForMCoffeeProductGroup(com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoods.ComboxGoods comboxGoods, ProductTypeBeanDTO parentProductBean,
Map<String,ProductTypeBeanDTO> subProductTypeMap,
boolean isComboxGoods) {
if("0".equals(comboxGoods.getGoodsId())){
return;
}
ProductTypeBeanDTO.ProductComboType productComboType = new ProductTypeBeanDTO.ProductComboType();
ProductTypeBeanDTO.ProductGroupType.GroupDetailType groupDetailType = new ProductTypeBeanDTO.ProductGroupType.GroupDetailType();
if (isComboxGoods) {
productComboType = parentProductBean.getProductComboList().stream().filter(p -> ObjectUtils.equals(comboxGoods.getGoodsId(), p.getProductId())).findFirst().orElse(new ProductTypeBeanDTO.ProductComboType());
} else {
Map<String, ProductTypeBeanDTO.ProductGroupType.GroupDetailType> map = new HashMap<>();
// subProductTypeMap.get(comboxGoods.getSkuId()).getAdditionalGroupList().stream().map(t->t.getGroupDetail()).forEach(group->group.forEach(detailType-> map.put(detailType.getProductId(),detailType)));
parentProductBean.getProductGroupList().stream().map(t -> t.getGroupDetail()).forEach(group -> group.forEach(detailType -> map.put(detailType.getProductId(), detailType)));
groupDetailType = map.get(comboxGoods.getGoodsId());
}
// 若是固定商品则取商品详情的FinalPrice,若是可选商品则取MarkUpPrice
Long finalPrice = isComboxGoods ? (null != productComboType.getFinalPrice() ? productComboType.getFinalPrice().longValue() : 0L)
: (null != groupDetailType.getMarkUpPrice() ? groupDetailType.getMarkUpPrice().longValue() : 0L);
// 设置商品详情
Map<String, String> attributes = getAttributesNew(comboxGoods.getExtra());
comboxGoods.setSpuId(comboxGoods.getSpuId());
comboxGoods.setName(isComboxGoods ? productComboType.getProductName() : groupDetailType.getProductName());
comboxGoods.setSpuName(comboxGoods.getName());
comboxGoods.setSpecProductId(attributes.get(ATTRIBUTEID));
comboxGoods.setSubName(attributes.get(ATTRIBUTENAME));
comboxGoods.setPic(isComboxGoods ? productComboType.getPicture() : groupDetailType.getPicture());
comboxGoods.setOriginalPrice(isComboxGoods ? (null != productComboType.getFinalPrice() ? productComboType.getFinalPrice().longValue() : 0L)
: (null != groupDetailType.getProductFinalPrice() ? groupDetailType.getProductFinalPrice().longValue() : 0L));
comboxGoods.setOriginalAmount(comboxGoods.getOriginalPrice() * comboxGoods.getQty());
comboxGoods.setAmount(finalPrice * comboxGoods.getQty());
comboxGoods.setCustomerCode(isComboxGoods ? (StringUtils.isNotEmpty(productComboType.getCustomerCode()) ? productComboType.getCustomerCode() : "")
: (StringUtils.isNotEmpty(groupDetailType.getCustomerCode()) ? groupDetailType.getCustomerCode() : ""));
comboxGoods.setFinalPrice(finalPrice);
comboxGoods.setWeightType(isComboxGoods ? CommonsConstant.WEIGHT_PRODUCT.equals(productComboType.getWeightType()) : CommonsConstant.WEIGHT_PRODUCT.equals(groupDetailType.getWeightType()));
comboxGoods.setUnit(isComboxGoods ? (StringUtils.isNotEmpty(productComboType.getUnit()) ? productComboType.getUnit() :"") :
(StringUtils.isNotEmpty(groupDetailType.getUnit()) ? groupDetailType.getUnit() : ""));
comboxGoods.setWeight(isComboxGoods ? (null == productComboType.getWeight() ? 0 : productComboType.getWeight()) :
(null == groupDetailType.getWeight() ? 0:groupDetailType.getWeight()));
comboxGoods.setTax(isComboxGoods ? (null == productComboType.getTax() ? 0 : productComboType.getTax())
: (null == groupDetailType.getTax() ? 0 : groupDetailType.getTax()));
comboxGoods.setTaxId(isComboxGoods ? (StringUtils.isNotEmpty(productComboType.getTaxId()) ? productComboType.getTaxId() : "") :
(StringUtils.isNotEmpty(groupDetailType.getTaxId()) ? groupDetailType.getTaxId() : ""));
//2020/10/22 套餐内可选商品加料,暂无
if(CollectionUtils.isNotEmpty(comboxGoods.getProductMaterialList())){
Map<String, ProductTypeBeanDTO.ProductGroupType.GroupDetailType> materialMap = new HashMap<>();
subProductTypeMap.get(comboxGoods.getSkuId()).getAdditionalGroupList().stream().map(t->t.getGroupDetail()).forEach(group->group.forEach(detailType-> materialMap.put(detailType.getProductId(),detailType)));
List<ProductTypeBeanDTO.ProductGroupType.GroupDetailType> materialList = new ArrayList<>();
comboxGoods.getProductMaterialList().stream().forEach(materialGood -> materialList.add(materialMap.get(materialGood.getSpuId())));
List<com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoods.MaterialGoods> productMaterialList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(materialList)){
for (ProductTypeBeanDTO.ProductGroupType.GroupDetailType detailType : materialList) {
com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoods.MaterialGoods materialGoods = new com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoods.MaterialGoods();
materialGoods.setCustomerCode(StringUtils.isNotEmpty(detailType.getCustomerCode()) ?
detailType.getCustomerCode() : "");
materialGoods.setAmount(null != detailType.getMarkUpPrice() ?
detailType.getMarkUpPrice().longValue() : 0);
materialGoods.setFinalPrice(null != detailType.getProductFinalPrice() ?
detailType.getProductFinalPrice().longValue() : 0);
materialGoods.setSpuName(StringUtils.isNotEmpty(detailType.getProductName()) ?
detailType.getProductName() : "");
materialGoods.setSpuId(StringUtils.isNotEmpty(detailType.getProductId()) ?
detailType.getProductId() : "");
materialGoods.setOriginalPrice(null != detailType.getProductFinalPrice() ?
detailType.getProductFinalPrice().longValue() : 0);
materialGoods.setOriginalAmount(null != detailType.getProductFinalPrice() ?
detailType.getProductFinalPrice().longValue() : 0);
productMaterialList.add(materialGoods);
}
}
comboxGoods.setProductMaterialList(productMaterialList);
}
} }
private Map<String, String> getAttributesNew(List<com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoods.CartGoodsExtra> extra) { private Map<String, String> getAttributesNew(List<com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoods.CartGoodsExtra> extra) {
...@@ -818,77 +899,6 @@ public class ShoppingCartConvertAdapter { ...@@ -818,77 +899,6 @@ public class ShoppingCartConvertAdapter {
cartGoods.setOriginalMaterialAmount(originalMaterAmount); cartGoods.setOriginalMaterialAmount(originalMaterAmount);
} }
/**
* 可选商品组加料处理逻辑
* @param comboxGoods
* @param subProductTypeMap
*/
private void resolveMaterialForProductGroup(com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoods.ComboxGoods comboxGoods, Map<String,ProductTypeBeanDTO> subProductTypeMap){
//可选商品加料信息提取
List<com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoods.MaterialGoods> groupProductMaterial = new ArrayList<>();
groupProductMaterial.addAll(comboxGoods.getProductMaterialList());
if (null != subProductTypeMap && !subProductTypeMap.isEmpty()) {
ProductTypeBeanDTO productTypeBeanDTO = subProductTypeMap.get(comboxGoods.getSkuId());
if (CollectionUtils.isNotEmpty(productTypeBeanDTO.getAdditionalGroupList())){
List<String> materialSpu = new ArrayList<>();
HashMap<String, ProductTypeBeanDTO.ProductGroupType.GroupDetailType> materialHash = new HashMap<>();
for (ProductTypeBeanDTO.ProductGroupType productGroupType : productTypeBeanDTO.getAdditionalGroupList()) {
//提取加料信息
List<ProductTypeBeanDTO.ProductGroupType.GroupDetailType> groupDetail = new ArrayList<>();
groupDetail.addAll(productGroupType.getGroupDetail());
for (ProductTypeBeanDTO.ProductGroupType.GroupDetailType groupDetailType : groupDetail) {
materialHash.put(groupDetailType.getProductId(), groupDetailType);
materialSpu.add(groupDetailType.getProductId());
}
}
//加车小料和商品小料没有交集则提示商品信息有异常
if (CollectionUtils.isEmpty(groupProductMaterial.stream().filter(e -> materialSpu.contains(e.getSpuId())).collect(Collectors.toList()))) {
// comboxGoods.setGoodsType(com.freemud.sdk.api.assortment.shoppingcart.constant.GoodsTypeEnum.EXCEPTION_GOODS.getGoodsType());
comboxGoods.setProductMaterialList(new ArrayList<>());
return;
}
ArrayList<com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoods.MaterialGoods> materialGoodsList = new ArrayList<>();
Long materialAmount = 0L;
Long originalMaterAmount = 0L;
String materialSubName = comboxGoods.getSubName();
for (com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoods.MaterialGoods materialGoods : comboxGoods.getProductMaterialList()) {
ProductTypeBeanDTO.ProductGroupType.GroupDetailType detail = materialHash.get(materialGoods.getSpuId());
if (detail == null) continue;
com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoods.MaterialGoods material = new com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoods.MaterialGoods();
material.setSpuName(detail.getProductName());
material.setSpuId(detail.getProductId());
//行单价 \ 行总价
material.setFinalPrice(detail.getProductFinalPrice().longValue());
material.setAmount(detail.getProductFinalPrice().longValue() * comboxGoods.getQty());
//原行单价*数量
material.setOriginalAmount(detail.getProductFinalPrice().longValue() * comboxGoods.getQty());
material.setOriginalPrice(detail.getProductFinalPrice().longValue());
material.setCustomerCode(materialGoods.getCustomerCode());
materialGoodsList.add(material);
materialAmount += detail.getProductFinalPrice().longValue() * comboxGoods.getQty();
originalMaterAmount += detail.getProductFinalPrice().longValue() * comboxGoods.getQty();
;
materialSubName = materialSubName + "/" + detail.getProductName();
}
//设置购物车行记录
comboxGoods.setProductMaterialList(materialGoodsList);
//加料行记录现价总价
comboxGoods.setMaterialAmount(materialAmount);
//加料行记录原价总价
// comboxGoods.setOriginalMaterialAmount(originalMaterAmount);
}else{
// comboxGoods.setGoodsType(com.freemud.sdk.api.assortment.shoppingcart.constant.GoodsTypeEnum.EXCEPTION_GOODS.getGoodsType());
comboxGoods.setProductMaterialList(new ArrayList<>());
return;
}
}
}
public void updateCartGoodsInfo(com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoods cartGoods, ProductTypeBeanDTO spuProduct,Map<String,ProductTypeBeanDTO> subProductTypeMap) { public void updateCartGoodsInfo(com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoods cartGoods, ProductTypeBeanDTO spuProduct,Map<String,ProductTypeBeanDTO> subProductTypeMap) {
try { try {
...@@ -934,7 +944,6 @@ public class ShoppingCartConvertAdapter { ...@@ -934,7 +944,6 @@ public class ShoppingCartConvertAdapter {
if(productCombo.getSpuId() != null && !productCombo.getSkuId().equals(productCombo.getSpuId()) ){ if(productCombo.getSpuId() != null && !productCombo.getSkuId().equals(productCombo.getSpuId()) ){
ProductTypeBeanDTO productBeanDTO = subProductTypeMap.get(productCombo.getSpuId()); ProductTypeBeanDTO productBeanDTO = subProductTypeMap.get(productCombo.getSpuId());
updateComboxGoodsInfoFor(productCombo, productBeanDTO, true); updateComboxGoodsInfoFor(productCombo, productBeanDTO, true);
}else { }else {
//套餐子商品为单品 //套餐子商品为单品
updateComboxGoodsInfoForMCoffee(productCombo, spuProduct, true); updateComboxGoodsInfoForMCoffee(productCombo, spuProduct, true);
...@@ -951,7 +960,9 @@ public class ShoppingCartConvertAdapter { ...@@ -951,7 +960,9 @@ public class ShoppingCartConvertAdapter {
} }
}else { }else {
for (com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoods.ComboxGoods productGroup : cartGoods.getProductGroupList()) { for (com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoods.ComboxGoods productGroup : cartGoods.getProductGroupList()) {
updateComboxGoodsInfoForMCoffee(productGroup, spuProduct, false); // updateComboxGoodsInfoForMCoffee(productGroup, spuProduct, false);
updateComboxGoodsInfoForMCoffeeProductGroup(productGroup,spuProduct,subProductTypeMap
,false);
} }
} }
} }
...@@ -1146,4 +1157,4 @@ public class ShoppingCartConvertAdapter { ...@@ -1146,4 +1157,4 @@ public class ShoppingCartConvertAdapter {
} }
} }
} }
\ No newline at end of file
...@@ -31,6 +31,7 @@ public class CouponAvailableReqVo { ...@@ -31,6 +31,7 @@ public class CouponAvailableReqVo {
private List<String> couponCodes; private List<String> couponCodes;
//金额 //金额
private Integer totalAmount; private Integer totalAmount;
private String appId;
//购物车商品列表 //购物车商品列表
private List<Product> productList; private List<Product> productList;
} }
...@@ -71,7 +71,7 @@ public interface CouponService { ...@@ -71,7 +71,7 @@ public interface CouponService {
* @param cartGoods * @param cartGoods
* @return * @return
*/ */
ActivityClassifyCouponBean availableCoupon(List<CartGoods> cartGoods, String partnerId, String userId, String storeId, String couponCode, boolean hasGoodsCoupon, Integer orderType, int isNew); ActivityClassifyCouponBean availableCoupon(List<CartGoods> cartGoods, String partnerId, String userId, String storeId, String couponCode, boolean hasGoodsCoupon, Integer orderType, int isNew,String appId);
/** /**
* 获取卡券服务商户密钥 * 获取卡券服务商户密钥
......
...@@ -51,8 +51,15 @@ public class CouponPromotionService implements IPromotionService { ...@@ -51,8 +51,15 @@ public class CouponPromotionService implements IPromotionService {
// 是否存在商品券 // 是否存在商品券
boolean hasGoodssCoupon = CollectionUtils.isNotEmpty(tmpCartGoods); boolean hasGoodssCoupon = CollectionUtils.isNotEmpty(tmpCartGoods);
// 构建可用不可用优惠券 // 构建可用不可用优惠券
ActivityClassifyCouponBean activityClassifyCouponBean = couponService.availableCoupon(cartGoodsList, couponPromotionVO.getPartnerId() ActivityClassifyCouponBean activityClassifyCouponBean = couponService.availableCoupon(cartGoodsList,
, couponPromotionVO.getUserId(), couponPromotionVO.getStoreId(), couponPromotionVO.getCouponCode(), hasGoodssCoupon, couponPromotionVO.getOrderType(), 0); couponPromotionVO.getPartnerId(),
couponPromotionVO.getUserId(),
couponPromotionVO.getStoreId(),
couponPromotionVO.getCouponCode(),
hasGoodssCoupon,
couponPromotionVO.getOrderType(),
0,
shoppingCartInfoRequestVo.getAppId() );
if (Objects.equals(activityClassifyCouponBean, null)) { if (Objects.equals(activityClassifyCouponBean, null)) {
// 构建一个空得订单券信息 // 构建一个空得订单券信息
activityClassifyCouponBean = createEmptyActivityCouponBean(); activityClassifyCouponBean = createEmptyActivityCouponBean();
......
...@@ -392,7 +392,8 @@ public class CouponServiceImpl implements CouponService { ...@@ -392,7 +392,8 @@ public class CouponServiceImpl implements CouponService {
, String couponCode , String couponCode
, boolean hasGoodsCoupon , boolean hasGoodsCoupon
, Integer orderType , Integer orderType
, int isNew) { , int isNew
, String appId) {
GetMemberCouponListRequestDto getMemberCouponListRequestDto = new GetMemberCouponListRequestDto(partnerId, userId); GetMemberCouponListRequestDto getMemberCouponListRequestDto = new GetMemberCouponListRequestDto(partnerId, userId);
getMemberCouponListRequestDto.setStatusFlags(Arrays.asList(CouponStatus.STATUS_0.getCode())); getMemberCouponListRequestDto.setStatusFlags(Arrays.asList(CouponStatus.STATUS_0.getCode()));
getMemberCouponListRequestDto.setPageNum(1); getMemberCouponListRequestDto.setPageNum(1);
...@@ -431,14 +432,14 @@ public class CouponServiceImpl implements CouponService { ...@@ -431,14 +432,14 @@ public class CouponServiceImpl implements CouponService {
} }
} }
}); });
List<CouponStateVo> couponStateList = buildAvailiableCoupons(cartGoods, partnerId, storeId, couponCodes, isNew); List<CouponStateVo> couponStateList = buildAvailiableCoupons(cartGoods, partnerId, storeId, couponCodes, isNew,appId);
if (CollectionUtils.isNotEmpty(couponStateList)) { if (CollectionUtils.isNotEmpty(couponStateList)) {
return returnSuccessAvailiableCoupons(couponCode, hasGoodsCoupon, availableCouponResponseVo, usableCoupons, disableCoupons, memberCouponMap, couponStateList); return returnSuccessAvailiableCoupons(couponCode, hasGoodsCoupon, availableCouponResponseVo, usableCoupons, disableCoupons, memberCouponMap, couponStateList);
} }
return null; return null;
} }
private List<CouponStateVo> buildAvailiableCoupons(List<CartGoods> cartGoods, String partnerId, String storeId, List<String> couponCodes, int isNew) { private List<CouponStateVo> buildAvailiableCoupons(List<CartGoods> cartGoods, String partnerId, String storeId, List<String> couponCodes, int isNew,String appId) {
String appSecret = getAppSecret(partnerId); String appSecret = getAppSecret(partnerId);
// 最大15一提交 // 最大15一提交
int maxNum = 15; int maxNum = 15;
...@@ -448,6 +449,7 @@ public class CouponServiceImpl implements CouponService { ...@@ -448,6 +449,7 @@ public class CouponServiceImpl implements CouponService {
couponAvailableReqVo.setProviderId(partnerId); couponAvailableReqVo.setProviderId(partnerId);
couponAvailableReqVo.setMerchantId(partnerId); couponAvailableReqVo.setMerchantId(partnerId);
couponAvailableReqVo.setStoreId(storeId); couponAvailableReqVo.setStoreId(storeId);
couponAvailableReqVo.setAppId(appId);
List<Product> productList = Lists.newArrayList(); List<Product> productList = Lists.newArrayList();
// 优惠券优先级最高,根据商品原价做计算 // 优惠券优先级最高,根据商品原价做计算
// 订单金额 // 订单金额
......
...@@ -78,7 +78,7 @@ public class CalculationSharingCartService { ...@@ -78,7 +78,7 @@ public class CalculationSharingCartService {
/** /**
* 可用券及券折扣 * 可用券及券折扣
*/ */
promotionSharingService.updateShoppingCartGoodsDiscount(discountResult, cartGoodsList, shoppingCartGoodsResponseVo, couponPromotionVO); promotionSharingService.updateShoppingCartGoodsDiscount(discountResult, cartGoodsList, shoppingCartGoodsResponseVo, couponPromotionVO,shoppingCartInfoRequestVo);
/** /**
* 满减处理 * 满减处理
......
...@@ -41,7 +41,8 @@ public class CouponSharingService { ...@@ -41,7 +41,8 @@ public class CouponSharingService {
public void updateShoppingCartGoodsDiscount(CalculationSharingDiscountResponseDto.CalculationDiscountResult calculationDiscountResult public void updateShoppingCartGoodsDiscount(CalculationSharingDiscountResponseDto.CalculationDiscountResult calculationDiscountResult
, List<CartGoods> cartGoodsList , List<CartGoods> cartGoodsList
, ShoppingCartGoodsResponseVo shoppingCartGoodsResponseVo , ShoppingCartGoodsResponseVo shoppingCartGoodsResponseVo
, CouponPromotionVO couponPromotionVO) { , CouponPromotionVO couponPromotionVO
,ShoppingCartInfoRequestVo shoppingCartInfoRequestVo) {
// 用户选择了查询优惠券信息 // 用户选择了查询优惠券信息
if (couponPromotionVO != null && ObjectUtils.equals(CouponFlag.YES.getCode(), couponPromotionVO.getFlg())) { if (couponPromotionVO != null && ObjectUtils.equals(CouponFlag.YES.getCode(), couponPromotionVO.getFlg())) {
List<CartGoods> tmpCartGoods = cartGoodsList.parallelStream().filter(k -> k.getCartGoodsUid() List<CartGoods> tmpCartGoods = cartGoodsList.parallelStream().filter(k -> k.getCartGoodsUid()
...@@ -56,7 +57,9 @@ public class CouponSharingService { ...@@ -56,7 +57,9 @@ public class CouponSharingService {
, couponPromotionVO.getCouponCode() , couponPromotionVO.getCouponCode()
, hasGoodssCoupon , hasGoodssCoupon
, couponPromotionVO.getOrderType() , couponPromotionVO.getOrderType()
, 1); , 1
, shoppingCartInfoRequestVo.getAppId()
);
if (Objects.equals(activityClassifyCouponBean, null)) { if (Objects.equals(activityClassifyCouponBean, null)) {
// 构建一个空得订单券信息 // 构建一个空得订单券信息
activityClassifyCouponBean = createEmptyActivityCouponBean(); activityClassifyCouponBean = createEmptyActivityCouponBean();
......
...@@ -1556,6 +1556,7 @@ public class ShoppingCartMCoffeeServiceImpl { ...@@ -1556,6 +1556,7 @@ public class ShoppingCartMCoffeeServiceImpl {
CartGoods.MaterialGoods materialGoods = new CartGoods.MaterialGoods(); CartGoods.MaterialGoods materialGoods = new CartGoods.MaterialGoods();
materialGoods.setSpuId(materialRequestVo.getSpuId()); materialGoods.setSpuId(materialRequestVo.getSpuId());
materialGoods.setGroupId(materialRequestVo.getGroupId()); materialGoods.setGroupId(materialRequestVo.getGroupId());
materialGoods.setCustomerCode(materialRequestVo.getCustomerCode());
comboxMaterialGoodsList.add(materialGoods); comboxMaterialGoodsList.add(materialGoods);
} }
productCombox.setProductMaterialList(comboxMaterialGoodsList); productCombox.setProductMaterialList(comboxMaterialGoodsList);
......
...@@ -133,7 +133,7 @@ public class CouponServiceTest { ...@@ -133,7 +133,7 @@ public class CouponServiceTest {
List<CartGoods> cartGoods = Lists.newArrayList(); List<CartGoods> cartGoods = Lists.newArrayList();
CartGoods cartGood = new CartGoods(); CartGoods cartGood = new CartGoods();
cartGoods.add(cartGood); cartGoods.add(cartGood);
ActivityClassifyCouponBean activityClassifyCouponBean = couponService.availableCoupon(cartGoods, "1864", "122424124", "1011", "88123124", true, 1, 1); ActivityClassifyCouponBean activityClassifyCouponBean = couponService.availableCoupon(cartGoods, "1864", "122424124", "1011", "88123124", true, 1, 1,"null");
assertTrue(activityClassifyCouponBean.getCouponNum() >= 1); assertTrue(activityClassifyCouponBean.getCouponNum() >= 1);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment