|
|
|
@ -1,18 +1,18 @@
|
|
|
|
|
package au.com.royalpay.payment.manage.application.core.impls;
|
|
|
|
|
|
|
|
|
|
import au.com.royalpay.payment.manage.application.core.SimpleClientApplyService;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.beans.NewAccountBean;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
|
|
|
|
|
import au.com.royalpay.payment.manage.system.core.MailGunService;
|
|
|
|
|
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
|
|
|
|
|
import au.com.royalpay.payment.tools.env.SysConfigManager;
|
|
|
|
|
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
|
|
|
|
|
import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
|
|
|
|
|
import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
|
|
|
|
|
import au.com.royalpay.payment.tools.mail.SendMail;
|
|
|
|
|
import au.com.royalpay.payment.tools.utils.sms.SmsSingleSender;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.lang3.RandomStringUtils;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
@ -21,15 +21,14 @@ import org.springframework.util.Assert;
|
|
|
|
|
import org.thymeleaf.context.Context;
|
|
|
|
|
import org.thymeleaf.spring4.SpringTemplateEngine;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.HashSet;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Set;
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
|
|
|
|
public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
|
|
|
|
|
|
|
|
|
|
@Value("${royalpay.sms.appid}")
|
|
|
|
@ -44,6 +43,8 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
|
|
|
|
|
private SpringTemplateEngine thymeleaf;
|
|
|
|
|
@Resource
|
|
|
|
|
private ClientManager clientManager;
|
|
|
|
|
@Resource
|
|
|
|
|
private ClientAccountMapper clientAccountMapper;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private StringRedisTemplate stringRedisTemplate;
|
|
|
|
@ -151,7 +152,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
|
|
|
|
|
if(StringUtils.isNotEmpty(codeKey)){
|
|
|
|
|
String redisAddress = stringRedisTemplate.boundValueOps(getVerifyMailRedisKey(codeKey)).get();
|
|
|
|
|
if(!address.equals(redisAddress)){
|
|
|
|
|
throw new BadRequestException("Data error");
|
|
|
|
|
throw new BadRequestException("Mail expired");
|
|
|
|
|
}else {
|
|
|
|
|
return codeKey;
|
|
|
|
|
}
|
|
|
|
@ -167,6 +168,14 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
|
|
|
|
|
stringRedisTemplate.delete(getVerifyMailRedisKey(codeKey));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void checkAccountName(String account_name) {
|
|
|
|
|
JSONObject account = clientAccountMapper.findByUsernameForDuplicate(account_name);
|
|
|
|
|
if (!account.isEmpty()){
|
|
|
|
|
throw new ForbiddenException("用户名已被注册");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String getRegisterClientRedisKey(String phoneNumber){
|
|
|
|
|
return REGISTER_CLIENT_PREFIX +phoneNumber;
|
|
|
|
|
}
|
|
|
|
|