修改抢单逻辑,去掉总金额的逻辑
This commit is contained in:
@@ -605,10 +605,7 @@ public class LbGoodsServiceImpl extends ServiceImpl<LbGoodsMapper, LbGoods> impl
|
|||||||
stoppedByMax = true;
|
stoppedByMax = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (maxGrabAmount != null && maxGrabAmount > 0 && successTotalAmount >= maxGrabAmount) {
|
|
||||||
stoppedByMaxAmount = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (attemptCount >= maxAttempts) {
|
if (attemptCount >= maxAttempts) {
|
||||||
stoppedByMaxAttempts = true;
|
stoppedByMaxAttempts = true;
|
||||||
break;
|
break;
|
||||||
@@ -616,6 +613,10 @@ public class LbGoodsServiceImpl extends ServiceImpl<LbGoodsMapper, LbGoods> impl
|
|||||||
if (goods.getId() == null) {
|
if (goods.getId() == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if(goods.getPrice().intValue() >maxGrabAmount){
|
||||||
|
log.info("跳过货品 {},因为超过最大抢单金额:{}", goods.getId(), goods.getPrice().intValue());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (goodsCoordinator != null && accountId != null
|
if (goodsCoordinator != null && accountId != null
|
||||||
&& !goodsCoordinator.tryAcquire(tid, goods.getId(), accountId)) {
|
&& !goodsCoordinator.tryAcquire(tid, goods.getId(), accountId)) {
|
||||||
@@ -663,7 +664,7 @@ public class LbGoodsServiceImpl extends ServiceImpl<LbGoodsMapper, LbGoods> impl
|
|||||||
if (buyResult.success()) {
|
if (buyResult.success()) {
|
||||||
successCount++;
|
successCount++;
|
||||||
successTotalAmount += goods.getTotalMoney().intValue();
|
successTotalAmount += goods.getTotalMoney().intValue();
|
||||||
Thread.sleep(3000);
|
Thread.sleep(1000);
|
||||||
} else {
|
} else {
|
||||||
failCount++;
|
failCount++;
|
||||||
if (buyResult.orderAlreadyGrabbed()) {
|
if (buyResult.orderAlreadyGrabbed()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user