From b73be018faea00f91a8958f4e308e68cb8749635 Mon Sep 17 00:00:00 2001 From: yixian Date: Wed, 9 Jun 2021 14:33:36 +0800 Subject: [PATCH] remove chinese character in english sms message --- .../manage/appclient/core/impls/ManageAppServiceImp.java | 2 +- .../manage/appclient/core/impls/RetailAppServiceImp.java | 4 ++-- .../manage/signin/core/impls/SignInAccountServiceImpl.java | 4 ++-- .../payment/manage/support/sms/SmsSenderQcloudImpl.java | 1 - .../payment/manage/support/sms/daas/DaasMessageTemplate.java | 2 -- .../payment/manage/support/sms/SmsSenderDaasImplTest.java | 2 -- 6 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/ManageAppServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/ManageAppServiceImp.java index 50564b732..b971de222 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/ManageAppServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/ManageAppServiceImp.java @@ -514,7 +514,7 @@ public class ManageAppServiceImp implements ManageAppService { String nationCode = phone.getString("nation_code"); String phoneNumber = phone.getString("contact_phone"); try { - smsSender.sendAuthCodeMessage(nationCode.trim(), phoneNumber, Locale.ENGLISH, new AuthCodeMessage("绑定手机号", codeKeyValue, 5)); + smsSender.sendAuthCodeMessage(nationCode.trim(), phoneNumber, Locale.ENGLISH, new AuthCodeMessage("Binding mobile number", codeKeyValue, 5)); } catch (Exception e) { e.printStackTrace(); throw new ServerErrorException("Phone number is wrong.Please try again."); diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java index 80284ba35..59ae53947 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java @@ -2231,7 +2231,7 @@ public class RetailAppServiceImp implements RetailAppService { String nationCode = phone.getString("nation_code").contains("+") ? phone.getString("nation_code").substring(1) : phone.getString("nation_code"); String phoneNumber = phone.getString("contact_phone"); try { - smsSender.sendAuthCodeMessage(nationCode.trim(), phoneNumber, Locale.ENGLISH, new AuthCodeMessage("绑定手机号", codeKeyValue, 1)); + smsSender.sendAuthCodeMessage(nationCode.trim(), phoneNumber, Locale.ENGLISH, new AuthCodeMessage("Binding mobile number", codeKeyValue, 1)); } catch (Exception e) { logger.error(e.getMessage(), e); throw new BadRequestException("Phone number is wrong.Please try again."); @@ -2251,7 +2251,7 @@ public class RetailAppServiceImp implements RetailAppService { String nationCode = client.getString("nation_code").contains("+") ? client.getString("nation_code").substring(1) : client.getString("nation_code"); String phoneNumber = client.getString("contact_phone"); try { - smsSender.sendAuthCodeMessage(nationCode.trim(), phoneNumber, Locale.ENGLISH, new AuthCodeMessage("解綁绑定手机号", codeKeyValue, 1)); + smsSender.sendAuthCodeMessage(nationCode.trim(), phoneNumber, Locale.ENGLISH, new AuthCodeMessage("Unbind mobile number", codeKeyValue, 1)); } catch (Exception e) { logger.error(e.getMessage(), e); throw new BadRequestException("Phone number is wrong.Please try again."); diff --git a/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInAccountServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInAccountServiceImpl.java index c28390ea9..97c8f62c9 100644 --- a/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInAccountServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInAccountServiceImpl.java @@ -571,7 +571,7 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati }); break; case "phone": - smsSender.sendAuthCodeMessage(account.getString("nation_code").trim(), account.getString("contact_phone"), Locale.ENGLISH, new AuthCodeMessage("密码重置服务", codeKeyValue, 5)); + smsSender.sendAuthCodeMessage(account.getString("nation_code").trim(), account.getString("contact_phone"), Locale.ENGLISH, new AuthCodeMessage("Reset password", codeKeyValue, 5)); break; } stringRedisTemplate.boundValueOps(getResetClientAccountKey(accountId)).set(codeKeyValue, 5, TimeUnit.MINUTES); @@ -607,7 +607,7 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati }); break; case "phone": - smsSender.sendAuthCodeMessage(account.getString("nation_code").trim(), account.getString("phone"), Locale.CHINESE, new AuthCodeMessage("密码重置服务",codeKeyValue,5)); + smsSender.sendAuthCodeMessage(account.getString("nation_code").trim(), account.getString("phone"), Locale.CHINESE, new AuthCodeMessage("密码重置服务", codeKeyValue,5)); break; } stringRedisTemplate.boundValueOps(getResetManagerAccountKey(managerId)).set(codeKeyValue, 5, TimeUnit.MINUTES); diff --git a/src/main/java/au/com/royalpay/payment/manage/support/sms/SmsSenderQcloudImpl.java b/src/main/java/au/com/royalpay/payment/manage/support/sms/SmsSenderQcloudImpl.java index 8730b4bf7..c2bbcc243 100644 --- a/src/main/java/au/com/royalpay/payment/manage/support/sms/SmsSenderQcloudImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/support/sms/SmsSenderQcloudImpl.java @@ -7,7 +7,6 @@ import au.com.royalpay.payment.tools.exceptions.ServerErrorException; import com.github.qcloudsms.SmsSingleSender; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.core.Ordered; import org.springframework.stereotype.Component; import java.util.Locale; diff --git a/src/main/java/au/com/royalpay/payment/manage/support/sms/daas/DaasMessageTemplate.java b/src/main/java/au/com/royalpay/payment/manage/support/sms/daas/DaasMessageTemplate.java index d01811e03..c440c6dfd 100644 --- a/src/main/java/au/com/royalpay/payment/manage/support/sms/daas/DaasMessageTemplate.java +++ b/src/main/java/au/com/royalpay/payment/manage/support/sms/daas/DaasMessageTemplate.java @@ -1,7 +1,5 @@ package au.com.royalpay.payment.manage.support.sms.daas; -import org.springframework.util.MultiValueMap; - public interface DaasMessageTemplate { String getMessage(); diff --git a/src/test/java/au/com/royalpay/payment/manage/support/sms/SmsSenderDaasImplTest.java b/src/test/java/au/com/royalpay/payment/manage/support/sms/SmsSenderDaasImplTest.java index b7257cb4b..e6bddccbc 100644 --- a/src/test/java/au/com/royalpay/payment/manage/support/sms/SmsSenderDaasImplTest.java +++ b/src/test/java/au/com/royalpay/payment/manage/support/sms/SmsSenderDaasImplTest.java @@ -6,8 +6,6 @@ import org.junit.jupiter.api.Test; import java.util.Locale; -import static org.junit.jupiter.api.Assertions.*; - class SmsSenderDaasImplTest { private SmsSender sender;