123
This commit is contained in:
@@ -6,6 +6,7 @@ import com.bashi.common.core.domain.AjaxResult;
|
||||
import com.bashi.common.core.domain.entity.Customer;
|
||||
import com.bashi.common.core.redis.RedisCache;
|
||||
import com.bashi.common.exception.CustomException;
|
||||
import com.bashi.common.utils.MessageUtils;
|
||||
import com.bashi.dk.dto.app.req.CustomerRegisterReq;
|
||||
import com.bashi.dk.dto.app.req.UpdatePwdOpenReq;
|
||||
import com.bashi.dk.service.CustomerService;
|
||||
@@ -41,7 +42,7 @@ public class AppCustomerOpenController {
|
||||
@ApiOperation("用户注册")
|
||||
public AjaxResult<Void> customerRegister(@RequestBody CustomerRegisterReq register) {
|
||||
if(!codeService.check(register.getPhoneNumber(), CodeType.CUSTOMER_REGISTER,register.getCode())){
|
||||
throw new CustomException("验证码错误");
|
||||
throw new CustomException(MessageUtils.message("dk.code.error"));
|
||||
}
|
||||
customerService.register(register);
|
||||
return AjaxResult.success();
|
||||
@@ -61,7 +62,7 @@ public class AppCustomerOpenController {
|
||||
@ApiOperation("忘记密码-验证码-校验")
|
||||
public AjaxResult<String> customerForgetPasswordCheck(String phoneNumber,String code) {
|
||||
if(!codeService.check(phoneNumber, CodeType.CUSTOMER_REGISTER,code)){
|
||||
throw new CustomException("验证码错误");
|
||||
throw new CustomException(MessageUtils.message("dk.code.error"));
|
||||
}
|
||||
Customer customer = customerService.getCustomerByName(phoneNumber);
|
||||
String uuid = UUID.randomUUID().toString();
|
||||
@@ -76,10 +77,10 @@ public class AppCustomerOpenController {
|
||||
public AjaxResult<String> customerForgetPasswordCheck(@RequestBody UpdatePwdOpenReq updatePwdOpenReq) {
|
||||
Customer customer = redisCache.getCacheObject(updatePwdOpenReq.getCheckCode());
|
||||
if(customer == null){
|
||||
throw new CustomException("密码修改失败,请重新获取验证码操作");
|
||||
throw new CustomException(MessageUtils.message("dk.password.update.error"));
|
||||
}
|
||||
if(!updatePwdOpenReq.getPassword().equals(updatePwdOpenReq.getConfirmPassword())){
|
||||
throw new CustomException("密码不一致");
|
||||
throw new CustomException(MessageUtils.message("dk.password.check.error"));
|
||||
}
|
||||
customerService.updatePwd(customer.getId(),updatePwdOpenReq.getPassword());
|
||||
AjaxResult<String> success = AjaxResult.success();
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.aliyuncs.exceptions.ClientException;
|
||||
import com.aliyuncs.exceptions.ServerException;
|
||||
import com.aliyuncs.profile.DefaultProfile;
|
||||
import com.bashi.common.core.domain.AjaxResult;
|
||||
import com.bashi.common.utils.MessageUtils;
|
||||
import com.bashi.dk.manager.FileUploadManager;
|
||||
import com.bashi.dk.manager.FileUploadRes;
|
||||
import com.bashi.dk.oss.ali.StsOssKit;
|
||||
@@ -46,7 +47,7 @@ public class V2CommonController {
|
||||
public AjaxResult getSts(){
|
||||
StsResult stsToken = stsOssKit.getStsToken();
|
||||
if(stsToken == null){
|
||||
return AjaxResult.error(400,"文件上传初始化失败");
|
||||
return AjaxResult.error(400, MessageUtils.message("dk.file.upload.init.error"));
|
||||
}
|
||||
return AjaxResult.success(stsToken);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.bashi.common.core.domain.entity.Customer;
|
||||
import com.bashi.common.exception.CustomException;
|
||||
import com.bashi.common.utils.BeanConvertUtil;
|
||||
import com.bashi.common.utils.JsonUtils;
|
||||
import com.bashi.common.utils.MessageUtils;
|
||||
import com.bashi.dk.domain.AgreementSetting;
|
||||
import com.bashi.dk.domain.Borrow;
|
||||
import com.bashi.dk.domain.CustomerInfo;
|
||||
@@ -63,31 +64,31 @@ public class BorrowServiceImpl extends ServiceImpl<BorrowMapper, Borrow> impleme
|
||||
public Borrow borrow(BorrowStartReq req) {
|
||||
CustomerInfo customerInfo = customerInfoService.getByCustomerId(req.getCustomerId());
|
||||
if(customerInfo == null){
|
||||
throw new CustomException("用户不存在");
|
||||
throw new CustomException(MessageUtils.message("dk.user.no"));
|
||||
}
|
||||
RLock lock = redissonClient.getLock("borrow:lock:" + req.getCustomerId());
|
||||
if(lock.isLocked()){
|
||||
throw new CustomException("点击太快了,请稍等");
|
||||
throw new CustomException(MessageUtils.message("dk.wait"));
|
||||
}
|
||||
lock.lock(10, TimeUnit.SECONDS);
|
||||
Borrow borrow;
|
||||
try {
|
||||
Customer customer = customerService.getById(req.getCustomerId());
|
||||
if(customer.getLoansFlag() == 1){
|
||||
throw new CustomException("请等待上一次贷款完结后在发起贷款");
|
||||
throw new CustomException(MessageUtils.message("dk.wait.last.loan"));
|
||||
}
|
||||
if(customer.getRealNameAuth() != 1){
|
||||
throw new CustomException("请补全个人资料后在发起贷款");
|
||||
throw new CustomException(MessageUtils.message("dk.loan.userData.missing"));
|
||||
}
|
||||
if(req.getTotalLoanMoney() == null){
|
||||
throw new CustomException("请选择贷款金额");
|
||||
throw new CustomException(MessageUtils.message("dk.loanAccount.empty"));
|
||||
}
|
||||
LoansSetting loansSetting = loansSettingService.getLoansSetting();
|
||||
if(req.getTotalLoanMoney().compareTo(loansSetting.getLoansMinAccount()) < 0){
|
||||
throw new CustomException("贷款金额不能小于"+loansSetting.getLoansMinAccount());
|
||||
throw new CustomException(MessageUtils.message("dk.loan.amount.notLe")+loansSetting.getLoansMinAccount());
|
||||
}
|
||||
if(req.getTotalLoanMoney().compareTo(loansSetting.getLoansMaxAccount()) > 0){
|
||||
throw new CustomException("贷款金额不能大于"+loansSetting.getLoansMaxAccount());
|
||||
throw new CustomException(MessageUtils.message("dk.loan.amount.notGe")+loansSetting.getLoansMaxAccount());
|
||||
}
|
||||
CalLoanReq calLoanReq = new CalLoanReq();
|
||||
calLoanReq.setTotalLoanMoney(req.getTotalLoanMoney());
|
||||
@@ -106,9 +107,9 @@ public class BorrowServiceImpl extends ServiceImpl<BorrowMapper, Borrow> impleme
|
||||
borrow.setAvgRepayment(loan.getAvgRepayment());
|
||||
borrow.setDueDate(loansSetting.getDueDate());
|
||||
borrow.setNoteRemark(req.getNoteRemark());
|
||||
borrow.setBorrowName("审核中");
|
||||
borrow.setBorrowName(MessageUtils.message("dk.loan.auditing"));
|
||||
borrow.setBorrowNameStyle("black");
|
||||
borrow.setBorrowRemark("审核中...");
|
||||
borrow.setBorrowRemark(MessageUtils.message("dk.loan.auditing.remark"));
|
||||
borrow.setInfoJson(JsonUtils.toJsonString(loan));
|
||||
borrow.setFirstBankType(borrow.getBankType());
|
||||
borrow.setFirstBackCardNum(borrow.getBackCardNum());
|
||||
@@ -192,23 +193,23 @@ public class BorrowServiceImpl extends ServiceImpl<BorrowMapper, Borrow> impleme
|
||||
public void withdraw(Double withdrawAmount, Long customerId) {
|
||||
Customer customer = customerService.getById(customerId);
|
||||
if(BooleanUtils.isNotTrue(customer.getAllowWithdrawFlag())){
|
||||
throw new CustomException("提现失败,账号异常");
|
||||
throw new CustomException(MessageUtils.message("dk.withdraw.account.error"));
|
||||
}
|
||||
if(customer.getAccount().doubleValue() < withdrawAmount){
|
||||
throw new CustomException("余额不足");
|
||||
throw new CustomException(MessageUtils.message("dk.withdraw.balance.not.enough.error"));
|
||||
}
|
||||
Borrow one = this.getOne(Wrappers.lambdaQuery(Borrow.class).eq(Borrow::getCustomerId,customerId));
|
||||
if(one == null){
|
||||
throw new CustomException("提现失败");
|
||||
throw new CustomException(MessageUtils.message("dk.withdraw.fail"));
|
||||
}
|
||||
if(!"审核通过".equals(one.getBorrowName())){
|
||||
if(!MessageUtils.message("dk.audit.success").equals(one.getBorrowName())){
|
||||
throw new CustomException(one.getBorrowName());
|
||||
}
|
||||
boolean result = customerService.withdraw(customerId,withdrawAmount);
|
||||
Borrow update = new Borrow();
|
||||
update.setId(one.getId());
|
||||
update.setBorrowName("提现中");
|
||||
update.setBorrowRemark("提现中...");
|
||||
update.setBorrowName(MessageUtils.message("dk.withdraw.ing"));
|
||||
update.setBorrowRemark(MessageUtils.message("dk.withdraw.remark"));
|
||||
update.setBorrowNameStyle("red");
|
||||
this.updateById(update);
|
||||
}
|
||||
@@ -224,21 +225,21 @@ public class BorrowServiceImpl extends ServiceImpl<BorrowMapper, Borrow> impleme
|
||||
LoanProcessResp resp = new LoanProcessResp();
|
||||
List<BorrowStepResp> borrowStep = new ArrayList<>();
|
||||
if(one == null){
|
||||
borrowStep.add(new BorrowStepResp("提交成功",false));
|
||||
borrowStep.add(new BorrowStepResp("正在审核",false));
|
||||
borrowStep.add(new BorrowStepResp("到账成功",false));
|
||||
borrowStep.add(new BorrowStepResp(MessageUtils.message("dk.borrow.push.success"),false));
|
||||
borrowStep.add(new BorrowStepResp(MessageUtils.message("dk.borrow.auditing"),false));
|
||||
borrowStep.add(new BorrowStepResp(MessageUtils.message("dk.borrow.account.success"),false));
|
||||
resp.setBorrowStep(borrowStep);
|
||||
resp.setBorrowNameStyle("red");
|
||||
resp.setBorrowRemark("您的个人信用贷款正在审核,请留意您的审核状态!如有疑问,请联系业务员咨询…");
|
||||
resp.setBorrowRemark(MessageUtils.message("dk.borrow.accounting.remark"));
|
||||
return resp;
|
||||
}
|
||||
borrowStep.add(new BorrowStepResp("提交成功",true));
|
||||
borrowStep.add(new BorrowStepResp(MessageUtils.message("dk.borrow.push.success"),true));
|
||||
if("审核通过".equals(one.getBorrowName())){
|
||||
borrowStep.add(new BorrowStepResp(one.getBorrowName(),true));
|
||||
borrowStep.add(new BorrowStepResp("到账成功",true));
|
||||
borrowStep.add(new BorrowStepResp(MessageUtils.message("dk.borrow.account.success"),true));
|
||||
}else{
|
||||
borrowStep.add(new BorrowStepResp(one.getBorrowName(),true));
|
||||
borrowStep.add(new BorrowStepResp("到账成功",false));
|
||||
borrowStep.add(new BorrowStepResp(MessageUtils.message("dk.borrow.account.success"),false));
|
||||
}
|
||||
resp.setBorrowStep(borrowStep);
|
||||
resp.setBorrowNameStyle(one.getBorrowNameStyle());
|
||||
@@ -258,7 +259,7 @@ public class BorrowServiceImpl extends ServiceImpl<BorrowMapper, Borrow> impleme
|
||||
public String getContract(String tradeNo) {
|
||||
Borrow borrow = this.getByTradeNo(tradeNo);
|
||||
if(borrow == null){
|
||||
throw new CustomException("借款不存在");
|
||||
throw new CustomException(MessageUtils.message("dk.borrow.contract.error"));
|
||||
}
|
||||
CustomerInfo customerInfo = customerInfoService.getByCustomerId(borrow.getCustomerId());
|
||||
Customer customer = customerService.getById(borrow.getCustomerId());
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bashi.common.core.domain.entity.Customer;
|
||||
import com.bashi.common.exception.CustomException;
|
||||
import com.bashi.common.utils.MessageUtils;
|
||||
import com.bashi.dk.domain.Borrow;
|
||||
import com.bashi.dk.domain.CustomerInfo;
|
||||
import com.bashi.dk.mapper.CustomerInfoMapper;
|
||||
@@ -26,7 +27,7 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
|
||||
Long customerId = customerInfo.getCustomerId();
|
||||
long count = borrowService.count(Wrappers.lambdaQuery(Borrow.class).eq(Borrow::getCustomerId, customerId));
|
||||
if(count > 0){
|
||||
throw new CustomException("贷款已提交无法修改信息,请联系客服");
|
||||
throw new CustomException(MessageUtils.message("dk.customer.update.having.loans"));
|
||||
}
|
||||
this.update(customerInfo,Wrappers.lambdaQuery(CustomerInfo.class)
|
||||
.eq(CustomerInfo::getCustomerId, customerId));
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.bashi.common.com.Condition;
|
||||
import com.bashi.common.com.PageParams;
|
||||
import com.bashi.common.core.domain.entity.Customer;
|
||||
import com.bashi.common.exception.CustomException;
|
||||
import com.bashi.common.utils.MessageUtils;
|
||||
import com.bashi.dk.domain.BorrowLog;
|
||||
import com.bashi.dk.domain.CustomerInfo;
|
||||
import com.bashi.dk.dto.admin.resp.CustomerAdminResp;
|
||||
@@ -15,6 +16,7 @@ import com.bashi.dk.mapper.BorrowLogMapper;
|
||||
import com.bashi.dk.mapper.CustomerMapper;
|
||||
import com.bashi.dk.service.CustomerInfoService;
|
||||
import com.bashi.dk.service.CustomerService;
|
||||
import org.aspectj.bridge.Message;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -42,11 +44,11 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
|
||||
String phoneNumber = register.getPhoneNumber();
|
||||
Customer customer = this.getCustomerByName(phoneNumber);
|
||||
if(customer != null){
|
||||
throw new CustomException("用户已存在");
|
||||
throw new CustomException(MessageUtils.message("dk.user.already.having"));
|
||||
}
|
||||
customer = new Customer();
|
||||
customer.setPhoneNumber(phoneNumber);
|
||||
customer.setNickName("VIP用户"+phoneNumber.substring(phoneNumber.length() - 4));
|
||||
customer.setNickName(MessageUtils.message("dk.user.name")+phoneNumber.substring(phoneNumber.length() - 4));
|
||||
customer.setPassword(passwordEncoder.encode(register.getPassword()));
|
||||
this.save(customer);
|
||||
CustomerInfo customerInfo = new CustomerInfo();
|
||||
|
||||
Reference in New Issue
Block a user