Commit 2758ff61 by box

Merge branch 'feature/box/券包退款' into develop

parents 2f3ab06b 05ae9375
...@@ -56,6 +56,7 @@ import com.freemud.sdk.api.assortment.order.enums.AutoOrderConfigTime; ...@@ -56,6 +56,7 @@ import com.freemud.sdk.api.assortment.order.enums.AutoOrderConfigTime;
import com.freemud.sdk.api.assortment.order.service.OrderCenterSdkService; import com.freemud.sdk.api.assortment.order.service.OrderCenterSdkService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.BooleanUtils;
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.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -149,6 +150,9 @@ public class RefundService { ...@@ -149,6 +150,9 @@ public class RefundService {
// 如果是买券订单,查询券是否已使用,如果没有使用,冻结券,否则不许退款 // 如果是买券订单,查询券是否已使用,如果没有使用,冻结券,否则不许退款
if (BizTypeEnum.SALE_COUPON.getBizType().equals(order.getBizType())) { if (BizTypeEnum.SALE_COUPON.getBizType().equals(order.getBizType())) {
if (BooleanUtils.isTrue(orderRefundVo.getIsPartRefund())) {
throw new ServiceException("该订单不支持部分退款,请联系门店进行线下处理");
}
freezeCouponCode(partnerId, order); freezeCouponCode(partnerId, order);
} }
......
...@@ -77,12 +77,11 @@ public class CouponQueryHandle { ...@@ -77,12 +77,11 @@ public class CouponQueryHandle {
List<CodeInfoQueryDto> codeInfoQueryDtos = this.queryCodesInfo(partnerId, couponCodes); List<CodeInfoQueryDto> codeInfoQueryDtos = this.queryCodesInfo(partnerId, couponCodes);
// 以下条件任意一个成立,说明券已使用: // 以下条件任意一个成立,说明券已使用:
// 1. 返回的数量和查询的不一致 // 1. 返回的数量和查询的不一致
// 2. 存在已使用或者部分使用的券状态 // 2. 券状态不是 0
// 3. 存在锁定的券(剩余核销次数!=总核销次数) // 3. 存在锁定的券(剩余核销次数!=总核销次数)
used = couponCodes.size() != codeInfoQueryDtos.size() used = couponCodes.size() != codeInfoQueryDtos.size()
|| codeInfoQueryDtos.stream().anyMatch(o -> { || codeInfoQueryDtos.stream().anyMatch(o -> {
return CouponStatus.STATUS_1.getCode().equals(o.getState()) return !CouponStatus.STATUS_0.getCode().equals(o.getState())
|| CouponStatus.STATUS_2.getCode().equals(o.getState())
|| !Objects.equals(o.getMaxLeftAvailableTimes(), o.getCouponUseRule().getMaxRedeemTimes()); || !Objects.equals(o.getMaxLeftAvailableTimes(), o.getCouponUseRule().getMaxRedeemTimes());
}); });
return used; return used;
......
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