|
|
@@ -1919,13 +1919,13 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
BigDecimal remainCash = giftCard.getRemainCash();
|
|
|
//扣完
|
|
|
if (remainCash.compareTo(deductCash) == 0) {
|
|
|
- deductGiftCardCash(user.getId(), giftCard.getId(), deductCash, remainCash, gcUseRecords);
|
|
|
+ deductGiftCardCash(user.getId(), giftCard.getId(), deductCash, remainCash, gcUseRecords, true);
|
|
|
deductCash = BigDecimal.ZERO;
|
|
|
} else if (remainCash.compareTo(deductCash) < 0) {
|
|
|
- deductGiftCardCash(user.getId(), giftCard.getId(), remainCash, remainCash, gcUseRecords);
|
|
|
+ deductGiftCardCash(user.getId(), giftCard.getId(), remainCash, remainCash, gcUseRecords, true);
|
|
|
deductCash = deductCash.subtract(remainCash);
|
|
|
} else if (remainCash.compareTo(deductCash) > 0) {
|
|
|
- deductGiftCardCash(user.getId(), giftCard.getId(), deductCash, remainCash, gcUseRecords);
|
|
|
+ deductGiftCardCash(user.getId(), giftCard.getId(), deductCash, remainCash, gcUseRecords, false);
|
|
|
deductCash = BigDecimal.ZERO;
|
|
|
}
|
|
|
}
|
|
|
@@ -2131,9 +2131,10 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void deductGiftCardCash(Long userId, Long gcId, BigDecimal deductCash, BigDecimal gcRemainCash, List<GiftCardOrderUseRecord> gcUseRecords) {
|
|
|
+ private void deductGiftCardCash(Long userId, Long gcId, BigDecimal deductCash, BigDecimal gcRemainCash, List<GiftCardOrderUseRecord> gcUseRecords, Boolean isUsed) {
|
|
|
Boolean is_update = giftCardUserRecordService.update(null, Wrappers.lambdaUpdate(GiftCardUserRecord.class)
|
|
|
.set(GiftCardUserRecord::getRemainCash, gcRemainCash.subtract(deductCash))
|
|
|
+ .set(isUsed, GiftCardUserRecord::getIsUsed, isUsed)
|
|
|
.eq(GiftCardUserRecord::getId, gcId)
|
|
|
.eq(GiftCardUserRecord::getIsPay, true)
|
|
|
.eq(GiftCardUserRecord::getRemainCash, gcRemainCash));
|