Commit 60ab0a39 by huiyang.chen

Merge branch 'feature-2020/8/6-McCafe-会阳' into feature-2020/9/6-fabu-huiyang

parents af70e3d8 051ac3cf
......@@ -32,9 +32,9 @@ public class McCafeCouponAdapter {
}
List<QueryOrdersResponse.DataBean.OrderBean.AccountBean> accountList = orderBean.getAccountList().stream().filter(
account -> (getQueryOrderAccountType(getOrderAccountType(account.getType())).equals(QueryOrderAccountType.COUPON)
|| getQueryOrderAccountType(getOrderAccountType(account.getType())).equals(QueryOrderAccountType.PRODUCT_COUPON)
|| getQueryOrderAccountType(getOrderAccountType(account.getType())).equals(QueryOrderAccountType.DISCOUNT_COUPON)) && account.getPrice() != 0l).collect(Collectors.toList());
account -> (getQueryOrderAccountType(OldOrderAccountType.getByCode(account.getType())).equals(QueryOrderAccountType.COUPON)
|| getQueryOrderAccountType(OldOrderAccountType.getByCode(account.getType())).equals(QueryOrderAccountType.PRODUCT_COUPON)
|| getQueryOrderAccountType(OldOrderAccountType.getByCode(account.getType())).equals(QueryOrderAccountType.DISCOUNT_COUPON)) && account.getPrice() != 0l).collect(Collectors.toList());
if (CollectionUtils.isEmpty(accountList) ) {
return null;
}
......@@ -46,7 +46,7 @@ public class McCafeCouponAdapter {
public MCCafeCouponRequest convert2MCCafeCouponRequest(QueryOrdersResponse.DataBean.OrderBean orderBean, QueryOrdersResponse.DataBean.OrderBean.AccountBean accountBean) {
List<MCCafeProductRedeemVo> products = new ArrayList<>();
//商品券核销核销参数
if (QueryOrderAccountType.PRODUCT_COUPON.equals(getQueryOrderAccountType(getOrderAccountType(accountBean.getType())))) {
if (QueryOrderAccountType.PRODUCT_COUPON.equals(getQueryOrderAccountType(OldOrderAccountType.getByCode(accountBean.getType())))) {
for (int i = 0; i < orderBean.getProductList().size(); i++) {
QueryOrdersResponse.DataBean.OrderBean.ProductBean productBean = orderBean.getProductList().get(i);
String pid = StringUtils.isNotBlank(productBean.getSpecification()) ? productBean.getSpecification() : productBean.getProductId();
......@@ -67,7 +67,7 @@ public class McCafeCouponAdapter {
}
}
}
}else if (QueryOrderAccountType.COUPON.equals(getQueryOrderAccountType(getOrderAccountType(accountBean.getType())))) {
}else if (QueryOrderAccountType.COUPON.equals(getQueryOrderAccountType(OldOrderAccountType.getByCode(accountBean.getType())))) {
for (int i = 0; i < orderBean.getProductList().size(); i++) {
QueryOrdersResponse.DataBean.OrderBean.ProductBean productBean = orderBean.getProductList().get(i);
String pid = StringUtils.isNotBlank(productBean.getSpecification()) ? productBean.getSpecification() : productBean.getProductId();
......@@ -115,54 +115,6 @@ public class McCafeCouponAdapter {
}
/**
* 将促销的枚举 ActivityTypeEnum 和orderAccountType 关联映射
*/
public OldOrderAccountType getOrderAccountType(Integer activityType) {
if (ActivityTypeEnum.TYPE_1.getCode().equals(activityType) || ActivityTypeEnum.TYPE_11.getCode().equals(activityType) || ActivityTypeEnum.TYPE_12.getCode().equals(activityType) || ActivityTypeEnum.TYPE_13.getCode().equals(activityType)) {
return OldOrderAccountType.BUY_DISCOUNT;
}
if (ActivityTypeEnum.TYPE_3.getCode().equals(activityType)) {
return OldOrderAccountType.COUPON;
}
if (ActivityTypeEnum.TYPE_2.getCode().equals(activityType) || ActivityTypeEnum.TYPE_21.getCode().equals(activityType)) {
return OldOrderAccountType.DISCOUNT_AMOUNT;
}
if (ActivityTypeEnum.TYPE_81.getCode().equals(activityType)) {
return OldOrderAccountType.PREMIUM_EXCHANGE;
}
if (ActivityTypeEnum.TYPE_32.getCode().equals(activityType)) {
return OldOrderAccountType.PRODUCT_COUPON;
}
if (ActivityTypeEnum.TYPE_31.getCode().equals(activityType)) {
return OldOrderAccountType.DISCOUNT_COUPON;
}
if (ActivityTypeEnum.TYPE_PACKAGE.getCode().equals(activityType)) {
return OldOrderAccountType.PACK_AMOUNT;
}
if (ActivityTypeEnum.TYPE_DELIVERY.getCode().equals(activityType)) {
return OldOrderAccountType.DELIVERY_AMOUNT;
}
if (ActivityTypeEnum.TYPE_61.getCode().equals(activityType)) {
return OldOrderAccountType.BUYM_SENDN;
}
if (ActivityTypeEnum.TYPE_53.getCode().equals(activityType)) {
return OldOrderAccountType.SECOND_DISCOUNT;
}
if (ActivityTypeEnum.TYPE_211.getCode().equals(activityType)) {
return OldOrderAccountType.SET_MEAL;
}
if (ActivityTypeEnum.TYPE_104.getCode().equals(activityType)) {
return OldOrderAccountType.XY_DISCOUNT;
}
if (ActivityTypeEnum.TYPE_14.getCode().equals(activityType)) {
return OldOrderAccountType.FULL_DISTRIBUTION_FEE;
}
if (ActivityTypeEnum.TYPE_320.getCode().equals(activityType)){
return OldOrderAccountType.MEMBER_PRICE_DISCOUNT;
}
return OldOrderAccountType.BUYM_SENDN;
}
public List<MCCafeCouponLockRequest> convertOrderBean2UnlockCoupon(QueryOrdersResponse.DataBean.OrderBean orderBean) {
......@@ -170,9 +122,9 @@ public class McCafeCouponAdapter {
return null;
}
List<QueryOrdersResponse.DataBean.OrderBean.AccountBean> accountList = orderBean.getAccountList().stream().filter(
account -> (getQueryOrderAccountType(getOrderAccountType(account.getType())).equals(QueryOrderAccountType.COUPON)
|| getQueryOrderAccountType(getOrderAccountType(account.getType())).equals(QueryOrderAccountType.PRODUCT_COUPON)
|| getQueryOrderAccountType(getOrderAccountType(account.getType())).equals(QueryOrderAccountType.DISCOUNT_COUPON)) && account.getPrice() != 0l).collect(Collectors.toList());
account -> (getQueryOrderAccountType(OldOrderAccountType.getByCode(account.getType())).equals(QueryOrderAccountType.COUPON)
|| getQueryOrderAccountType(OldOrderAccountType.getByCode(account.getType())).equals(QueryOrderAccountType.PRODUCT_COUPON)
|| getQueryOrderAccountType(OldOrderAccountType.getByCode(account.getType())).equals(QueryOrderAccountType.DISCOUNT_COUPON)) && account.getPrice() != 0l).collect(Collectors.toList());
if (CollectionUtils.isEmpty(accountList) ) {
return null;
}
......
......@@ -37,7 +37,9 @@ public class CouponHandle {
for (MCCafeCouponRequest mcCafeCouponRequest: list) {
//重试3次
for (int i = 2; i >= 0; i--) {
log.info("核销券码入参:{}",JSONObject.toJSONString(mcCafeCouponRequest));
CouponRedeemResponse redeem = couponOfflineMCCafeClient.redeem(mcCafeCouponRequest);
log.info("核销券码出参:{}",JSONObject.toJSONString(redeem));
if (RESPONSE_SUCCESS.equals(redeem.getStatusCode())) {
break;
}
......
......@@ -264,20 +264,6 @@ public class OrderVerifyHandle {
&& orderBean.getRefundList().get(orderBean.getRefundList().size() - 1).getStatus() != 1) {
return ResponseUtil.error(ResponseResult.ORDER_REFUND_NOT_APPLY);
}
//订单是否支持退款
boolean isCanRefund = false;
//订单
boolean isRefundDeliveryFee=false;
//saas渠道订单,已完成的订单不能操作, 商户配置已完成订单可退款可退款
if (ObjectUtils.equals(orderBean.getSource(), OrderSource.SAAS.getSource())) {
isCanRefund = getRefundConfig(orderBean);
if (!isCanRefund) {
return ResponseUtil.error(ResponseResult.ORDER_HAD_AFFIRM_CAN_NOT_REFUND);
}
}
if (isCanRefund) {
orderBean.setAmount(getRefundAmount(orderBean,isRefundDeliveryFee).longValue());
}
return ResponseUtil.success();
}
......
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