diff --git a/bashi-dk/src/main/java/com/bashi/dk/service/impl/BorrowServiceImpl.java b/bashi-dk/src/main/java/com/bashi/dk/service/impl/BorrowServiceImpl.java index dde41d6..b61d248 100644 --- a/bashi-dk/src/main/java/com/bashi/dk/service/impl/BorrowServiceImpl.java +++ b/bashi-dk/src/main/java/com/bashi/dk/service/impl/BorrowServiceImpl.java @@ -57,27 +57,26 @@ public class BorrowServiceImpl extends ServiceImpl impleme @Autowired private RedissonClient redissonClient; - @Override public Borrow borrow(BorrowStartReq req) { - Customer customer = customerService.getById(req.getCustomerId()); CustomerInfo customerInfo = customerInfoService.getByCustomerId(req.getCustomerId()); - if(customerInfo == null || customer == null){ + if(customerInfo == null){ throw new CustomException("用户不存在"); } - if(customer.getLoansFlag() == 1){ - throw new CustomException("请等待上一次贷款完结后在发起贷款"); - } - if(customer.getRealNameAuth() != 1){ - throw new CustomException("请补全个人资料后在发起贷款"); - } RLock lock = redissonClient.getLock("borrow:lock:" + req.getCustomerId()); if(lock.isLocked()){ throw new CustomException("点击太快了,请稍等"); } - lock.lock(5, TimeUnit.SECONDS); + lock.lock(10, TimeUnit.SECONDS); Borrow borrow; try { + Customer customer = customerService.getById(req.getCustomerId()); + if(customer.getLoansFlag() == 1){ + throw new CustomException("请等待上一次贷款完结后在发起贷款"); + } + if(customer.getRealNameAuth() != 1){ + throw new CustomException("请补全个人资料后在发起贷款"); + } LoansSetting loansSetting = loansSettingService.getLoansSetting(); CalLoanReq calLoanReq = new CalLoanReq(); calLoanReq.setTotalLoanMoney(req.getTotalLoanMoney());