This commit is contained in:
zhaohengkun 2024-10-24 10:10:25 +08:00
parent 9eceda0858
commit 51bc0851f9

View File

@ -483,6 +483,8 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
String lockKey = "IntegralOrders" + orderNo;
Boolean isLock = redisLock.tryLock(lockKey, 5000, TimeUnit.MILLISECONDS);
if (isLock && "paid".equals(listByOrderNo.get(0).getStatus()) && "0".equals(listByOrderNo.get(0).getProcessingStatus())) {
try {
// 查询用户信息
LJUserVo ljUserVos = ljUserMapper.selectAllInfoById2(listByOrderNo.get(0).getUserId(), listByOrderNo.get(0).getChainStoreId());
// 查询用户信息
@ -497,8 +499,14 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
IntegralGift integralGift = integralGiftService.queryById(integralOrders.getGiftId());
if (integralGift.getGiftType().equals("电子券")) {
CardCoupon cardCoupon = cardCouponService.selectOneBuId(integralGift.getCouponId());
ResponseObject responseObject = cardCouponService.sendCoupon2(new CardCouponUser());
for (int i = 0; i <integralOrders.getExchangeQuantity() ; i++) {
CardCouponUser cardCouponUser = new CardCouponUser();
cardCouponUser.setMtUserId(ljUserVos.getId());
cardCouponUser.setStoreId(integralOrders.getStoreId());
cardCouponUser.setCardCouponId(integralGift.getCouponId());
ResponseObject responseObject = cardCouponService.sendCoupon2(cardCouponUser);
}
} else if (integralGift.getGiftType().equals("实物商品")) {
// 修改商品库存并增加记录
@ -533,7 +541,10 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
integralOrdersDao.updatePaymentType(orderNo);
redisLock.unlock(lockKey);
} catch (Exception e) {
redisLock.unlock(lockKey);
e.printStackTrace();
}
} else {
redisLock.unlock(lockKey);