diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralOrdersServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralOrdersServiceImpl.java index d09b86640..47848aded 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralOrdersServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralOrdersServiceImpl.java @@ -483,57 +483,68 @@ 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())) { - // 查询用户信息 - LJUserVo ljUserVos = ljUserMapper.selectAllInfoById2(listByOrderNo.get(0).getUserId(), listByOrderNo.get(0).getChainStoreId()); - // 查询用户信息 - BigDecimal totalPoints = new BigDecimal(0); + try { - for (IntegralOrders integralOrders : listByOrderNo) { - // 查询员工信息 - LJStaff ljStaff = ljStaffMapper.selectById(integralOrders.getStaffId()); - if (ObjectUtil.isEmpty(integralOrders.getIntegral())) integralOrders.setIntegral(0.0); - totalPoints = totalPoints.add(new BigDecimal(integralOrders.getIntegral())); - // 加兑换卷和优惠券判断 - IntegralGift integralGift = integralGiftService.queryById(integralOrders.getGiftId()); - if (integralGift.getGiftType().equals("电子券")) { + // 查询用户信息 + LJUserVo ljUserVos = ljUserMapper.selectAllInfoById2(listByOrderNo.get(0).getUserId(), listByOrderNo.get(0).getChainStoreId()); + // 查询用户信息 + BigDecimal totalPoints = new BigDecimal(0); - CardCoupon cardCoupon = cardCouponService.selectOneBuId(integralGift.getCouponId()); - ResponseObject responseObject = cardCouponService.sendCoupon2(new CardCouponUser()); + for (IntegralOrders integralOrders : listByOrderNo) { + // 查询员工信息 + LJStaff ljStaff = ljStaffMapper.selectById(integralOrders.getStaffId()); + if (ObjectUtil.isEmpty(integralOrders.getIntegral())) integralOrders.setIntegral(0.0); + totalPoints = totalPoints.add(new BigDecimal(integralOrders.getIntegral())); + // 加兑换卷和优惠券判断 + IntegralGift integralGift = integralGiftService.queryById(integralOrders.getGiftId()); + if (integralGift.getGiftType().equals("电子券")) { + + + for (int i = 0; i 0) { + UserBalance userBalance = balanceCalculation(ljUserVos, totalPoints.doubleValue()); + userBalance.setChainStoreId(listByOrderNo.get(0).getChainStoreId()); + userBalanceService.updateUserBalance(userBalance); + } + // 积分表变动 + if (totalPoints.doubleValue() > 0) { + IntegralDetail integralDetail = changesInPoints(totalPoints.doubleValue(), ljUserVos); + integralDetail.setStoreId(listByOrderNo.get(0).getStoreId()); + integralDetail.setChainStoreId(listByOrderNo.get(0).getChainStoreId()); + integralDetailService.insert2(integralDetail); + } + // 批量修改该 + integralOrdersDao.updatePaymentType(orderNo); + + redisLock.unlock(lockKey); + } catch (Exception e) { + redisLock.unlock(lockKey); + e.printStackTrace(); } - - // 用户积分余额变动 - if (totalPoints.doubleValue() > 0) { - UserBalance userBalance = balanceCalculation(ljUserVos, totalPoints.doubleValue()); - userBalance.setChainStoreId(listByOrderNo.get(0).getChainStoreId()); - userBalanceService.updateUserBalance(userBalance); - } - // 积分表变动 - if (totalPoints.doubleValue() > 0) { - IntegralDetail integralDetail = changesInPoints(totalPoints.doubleValue(), ljUserVos); - integralDetail.setStoreId(listByOrderNo.get(0).getStoreId()); - integralDetail.setChainStoreId(listByOrderNo.get(0).getChainStoreId()); - integralDetailService.insert2(integralDetail); - } - - // 批量修改该 - integralOrdersDao.updatePaymentType(orderNo); - - redisLock.unlock(lockKey); - } else { redisLock.unlock(lockKey);