123
This commit is contained in:
@@ -57,27 +57,26 @@ public class BorrowServiceImpl extends ServiceImpl<BorrowMapper, Borrow> 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("用户不存在");
|
||||
}
|
||||
RLock lock = redissonClient.getLock("borrow:lock:" + req.getCustomerId());
|
||||
if(lock.isLocked()){
|
||||
throw new CustomException("点击太快了,请稍等");
|
||||
}
|
||||
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("请补全个人资料后在发起贷款");
|
||||
}
|
||||
RLock lock = redissonClient.getLock("borrow:lock:" + req.getCustomerId());
|
||||
if(lock.isLocked()){
|
||||
throw new CustomException("点击太快了,请稍等");
|
||||
}
|
||||
lock.lock(5, TimeUnit.SECONDS);
|
||||
Borrow borrow;
|
||||
try {
|
||||
LoansSetting loansSetting = loansSettingService.getLoansSetting();
|
||||
CalLoanReq calLoanReq = new CalLoanReq();
|
||||
calLoanReq.setTotalLoanMoney(req.getTotalLoanMoney());
|
||||
|
||||
Reference in New Issue
Block a user