REQ-3201: 预设按钮幂等控制
This commit is contained in:
parent
0b31cc123f
commit
8c04600a8e
@ -177,7 +177,7 @@ public class CardManager {
|
||||
CardLogger updateCardLogger = cardLoggers.createLogger(CardRequestContext.create(request));
|
||||
execTransactional(() -> {
|
||||
ArrayList<Card> updates = new ArrayList<>(cards.size());
|
||||
for (Card card : cardDao.getCardsForUpdate(cards)) {
|
||||
for (Card card : cardDao.reloadCardsForUpdate(cards)) {
|
||||
if (card.getCardState() == CardState.COMPLETED)
|
||||
continue;
|
||||
updateCardLogger.addCard(card);
|
||||
|
||||
@ -78,19 +78,20 @@ public class CardDao extends ServiceImpl<CardMapper, Card> {
|
||||
updateBatchById(updates);
|
||||
}
|
||||
|
||||
public List<Card> getCardsForUpdate(List<Card> cards) {
|
||||
public List<Card> reloadCardsForUpdate(List<Card> cards) {
|
||||
if (CollectionUtils.isEmpty(cards))
|
||||
return Collections.emptyList();
|
||||
return lambdaQuery()
|
||||
return DeleteAwareInterceptor.execute(() -> lambdaQuery()
|
||||
.in(Card::getId, collectCardIdsSorted(cards))
|
||||
.last("FOR UPDATE")
|
||||
.list();
|
||||
.list());
|
||||
}
|
||||
|
||||
public List<Card> reloadCards(List<Card> cards) {
|
||||
if (CollectionUtils.isEmpty(cards))
|
||||
return Collections.emptyList();
|
||||
return DeleteAwareInterceptor.execute(()-> listByIds(collectCardIdsSorted(cards)));
|
||||
return DeleteAwareInterceptor.execute(() ->
|
||||
listByIds(collectCardIdsSorted(cards)));
|
||||
}
|
||||
|
||||
public void deleteCards(List<Card> cards) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user