xiongzhu před 4 roky
rodič
revize
f667ab9765

+ 5 - 1
src/main/java/com/izouma/nineth/service/OrderService.java

@@ -261,6 +261,9 @@ public class OrderService {
         if (order.getInvitor() != null) {
             invitor = userRepo.findById(order.getInvitor()).orElse(null);
         }
+        if (invitor != null && StringUtils.isBlank(invitor.getSettleAccountId())) {
+            invitor = null;
+        }
         if (order.getStatus() != OrderStatus.NOT_PAID) {
             throw new BusinessException("订单状态错误");
         }
@@ -530,7 +533,8 @@ public class OrderService {
         if (order.getInvitor() != null) {
             userRepo.findById(order.getInvitor()).ifPresent(user -> {
                 BigDecimal shareRatio = user.getShareRatio();
-                if (shareRatio != null && shareRatio.compareTo(BigDecimal.ZERO) > 0) {
+                if (StringUtils.isNotBlank(user.getSettleAccountId()) &&
+                        shareRatio != null && shareRatio.compareTo(BigDecimal.ZERO) > 0) {
                     BigDecimal totalPrice = order.getTotalPrice().subtract(order.getGasPrice());
                     commissionRecordRepo.save(CommissionRecord.builder()
                             .orderId(order.getId())