Browse Source

fix bug

release_toaliyun_real
xiaohanzi 4 years ago
parent
commit
eebf6e20e8
4 changed files with 31 additions and 19 deletions
  1. +10
    -0
      mallinkService/src/main/java/com/iformall/enums/EnumCouponType.java
  2. +2
    -1
      mallinkService/src/main/java/com/iformall/enums/EnumMerchantType.java
  3. +7
    -5
      mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java
  4. +12
    -13
      mallinkService/src/main/java/com/iformall/service/impl/WxRefundOrderServiceImpl.java

+ 10
- 0
mallinkService/src/main/java/com/iformall/enums/EnumCouponType.java View File

@@ -31,6 +31,16 @@ public enum EnumCouponType {
}
return null;
}
public static boolean mustHasMerchant(Integer code) {
if (null == code) {
return true;
}
if (COUPON_GIFT.code.equals(code)) {
return false;
}
return true;
}

private Integer code;
private String message;


+ 2
- 1
mallinkService/src/main/java/com/iformall/enums/EnumMerchantType.java View File

@@ -2,7 +2,8 @@ package com.iformall.enums;

public enum EnumMerchantType {

MERCHANT_MORE(-1, "多商户")
MERCHANT_MORE(-1, "多商户"),
MERCHANT_NONE(-2, "无归属商户")
;

public static EnumMerchantType getEnum(Integer code) {


+ 7
- 5
mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java View File

@@ -1529,7 +1529,7 @@ public class WxOrderServiceImpl implements WxOrderService {
creditHistory.setMerchantId(Long.valueOf(EnumMerchantType.MERCHANT_MORE.getCode()));
}
}else {
creditHistory.setMerchantId(Long.valueOf(EnumMerchantType.MERCHANT_MORE.getCode()));
creditHistory.setMerchantId(Long.valueOf(EnumMerchantType.MERCHANT_NONE.getCode()));
}
}

@@ -2320,10 +2320,12 @@ public class WxOrderServiceImpl implements WxOrderService {
logger.error("券不存在");
throw new MallinkException(ErrorCode.COUPON_IS_EMPTY.getCode(),premsg+"不存在");
}
// 检查券商户信息
if (!isCouponMerchantValid(coupon.getId(),coupon.getTenantId())) {
logger.error("商户不存在, couponId: " + coupon.getId());
throw new MallinkException(ErrorCode.MERCHANT_INFO_NOT_FOUND.getCode(),premsg+"商户信息没找到");
if (EnumCouponType.mustHasMerchant(coupon.getType())) {
// 检查券商户信息
if (!isCouponMerchantValid(coupon.getId(),coupon.getTenantId())) {
logger.error("商户不存在, couponId: " + coupon.getId());
throw new MallinkException(ErrorCode.MERCHANT_INFO_NOT_FOUND.getCode(),premsg+"商户信息没找到");
}
}
// 检查 优惠券 库存
if (coupon.getRemainInventory() <= 0) {


+ 12
- 13
mallinkService/src/main/java/com/iformall/service/impl/WxRefundOrderServiceImpl.java View File

@@ -20,6 +20,7 @@ import com.iformall.pay.WxRefundOrderSP;
import com.iformall.service.WxOrderService;
import com.iformall.service.WxRefundOrderService;
import com.iformall.service.helper.WxPayOrderServiceHelper;
import com.iformall.service.order.OrderFactory;
import com.iformall.service.pay.PayServiceFactory;
import com.iformall.service.pay.service.refund.entity.RefundAdapterResult;
import com.iformall.service.pay.service.refund.entity.RefundNotifyAdapterResult;
@@ -85,25 +86,23 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService {
@Autowired
PayServiceFactory payServiceFactory;





private boolean isMerchantOrder(WxOrder wxOrder, Long merchantId) {
if (wxOrder.getType().equals(EnumOrderType.COUPON.getCode())) {
WxCoupon wxCoupon = wxCouponMapper.selectById(wxOrder.getProductId(),wxOrder.getTenantId());
if (wxCoupon != null) {
//如券包就没有商户
WxCouponMerchant wxCouponMerchant = new WxCouponMerchant();
wxCouponMerchant.setProductId(wxCoupon.getId());
wxCouponMerchant.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_VALID.getCode());
List<WxCouponMerchant> couponMerchantList = wxCouponMerchantMapper.findList(wxCouponMerchant);
if (couponMerchantList.stream().anyMatch(cm -> cm.getMerchantId().equals(merchantId))) {
return true;
}
if (EnumCouponType.mustHasMerchant(wxCoupon.getType())) {
WxCouponMerchant wxCouponMerchant = new WxCouponMerchant();
wxCouponMerchant.setProductId(wxCoupon.getId());
wxCouponMerchant.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_VALID.getCode());
List<WxCouponMerchant> couponMerchantList = wxCouponMerchantMapper.findList(wxCouponMerchant);
if (couponMerchantList.stream().anyMatch(cm -> cm.getMerchantId().equals(merchantId))) {
return true;
}
}else {
return true;
}
}
} else if (wxOrder.getType().equals(EnumOrderType.MICROPAY.getCode())) {
WxMerchantBUser wxMerchantBUser = wxMerchantBUserMapper.selectById(wxOrder.getProductId());


Loading…
Cancel
Save