From 3f2f0527807810e13d969292be08e88d4832627f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E8=89=AF=28004796=29?= Date: Wed, 31 Jan 2024 14:23:03 +0800 Subject: [PATCH] 123 --- .../dk/service/impl/BorrowServiceImpl.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) 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());