diff --git a/src/main/java/com/rj/service/impl/LbGoodsServiceImpl.java b/src/main/java/com/rj/service/impl/LbGoodsServiceImpl.java index bc89e1d..33bd7ed 100644 --- a/src/main/java/com/rj/service/impl/LbGoodsServiceImpl.java +++ b/src/main/java/com/rj/service/impl/LbGoodsServiceImpl.java @@ -605,10 +605,7 @@ public class LbGoodsServiceImpl extends ServiceImpl impl stoppedByMax = true; break; } - if (maxGrabAmount != null && maxGrabAmount > 0 && successTotalAmount >= maxGrabAmount) { - stoppedByMaxAmount = true; - break; - } + if (attemptCount >= maxAttempts) { stoppedByMaxAttempts = true; break; @@ -616,6 +613,10 @@ public class LbGoodsServiceImpl extends ServiceImpl impl if (goods.getId() == null) { continue; } + if(goods.getPrice().intValue() >maxGrabAmount){ + log.info("跳过货品 {},因为超过最大抢单金额:{}", goods.getId(), goods.getPrice().intValue()); + continue; + } if (goodsCoordinator != null && accountId != null && !goodsCoordinator.tryAcquire(tid, goods.getId(), accountId)) { @@ -663,7 +664,7 @@ public class LbGoodsServiceImpl extends ServiceImpl impl if (buyResult.success()) { successCount++; successTotalAmount += goods.getTotalMoney().intValue(); - Thread.sleep(3000); + Thread.sleep(1000); } else { failCount++; if (buyResult.orderAlreadyGrabbed()) {