【R】自助进件业务接口开发

master
liuxinxin 5 years ago
parent d47d99fccc
commit 8e12972f89

@ -18,7 +18,7 @@ public interface SimpleClientApplyService {
String getAndSendSmsCode(String phoneNumber, String nationCode, HttpServletRequest request);
String sendOpenSms(String phoneNumber, String nationCode);
void sendOpenSms(String phoneNumber, String nationCode);
String checkOrGenerateRegisterProcessKey(String accountName, String codeKey);

@ -185,26 +185,16 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
}
@Override
public String sendOpenSms(String phoneNumber, String nationCode) {
String reidsCheckCodeKey = getRegisterClientRedisKey(phoneNumber);
String value = stringRedisTemplate.boundValueOps(reidsCheckCodeKey).get();
if (StringUtils.isNotEmpty(value)) {
throw new BadRequestException("SMS has been sentPlease check your messages or try again in 3 minutes.");
}
public void sendOpenSms(String phoneNumber, String nationCode) {
ArrayList<String> param = new ArrayList<>();
String registerClientCode = RandomStringUtils.random(6, false, true);
param.add("RoyalPay");
param.add(registerClientCode);
String expireMin = "3";
param.add(expireMin);
String phone_Number = phoneNumber.substring(0, 3) + "****" + phoneNumber.substring(7, phoneNumber.length());
param.add(phone_Number);
try {
smsSender.getSender().sendWithParam(nationCode.trim(), phoneNumber, REGISTER_CLIENT_TEMPLID, param, "RoyalPay", "", "");
smsSender.getSender().sendWithParam(nationCode.trim(), phoneNumber, 462770, param, "RoyalPay", "", "");
} catch (Exception e) {
e.printStackTrace();
throw new ServerErrorException("Phone number is wrong Please try again");
}
stringRedisTemplate.boundValueOps(getRegisterClientRedisKey(phoneNumber)).set(registerClientCode, Long.parseLong(expireMin), TimeUnit.MINUTES);
return registerClientCode;
}
@Override

Loading…
Cancel
Save