Commit 07edc08c authored by xiaozhe.chen's avatar xiaozhe.chen

添加修改手机号后台管理接口

parent ff68ae55
...@@ -23,7 +23,7 @@ import java.util.Properties; ...@@ -23,7 +23,7 @@ import java.util.Properties;
@Configuration @Configuration
@EnableJpaRepositories(basePackages = "cn.quantgroup.customer.repo") @EnableJpaRepositories(basePackages = "cn.quantgroup.customer.repo")
@EnableTransactionManagement @EnableTransactionManagement
public class DBConfig { public class DbConfig {
@Value("${data.mysql.jdbc-url}") @Value("${data.mysql.jdbc-url}")
private String jdbcUrl; private String jdbcUrl;
......
...@@ -28,7 +28,8 @@ import java.util.concurrent.ConcurrentHashMap; ...@@ -28,7 +28,8 @@ import java.util.concurrent.ConcurrentHashMap;
threading = ThreadingBehavior.IMMUTABLE threading = ThreadingBehavior.IMMUTABLE
) )
public class HttpRequestRetryHandler extends DefaultHttpRequestRetryHandler { public class HttpRequestRetryHandler extends DefaultHttpRequestRetryHandler {
private static final String POST = "POST";
private static final String TIME_OUT = "Read timed out";
private final Map<String, Boolean> idempotentMethods; private final Map<String, Boolean> idempotentMethods;
/** /**
...@@ -79,8 +80,8 @@ public class HttpRequestRetryHandler extends DefaultHttpRequestRetryHandler { ...@@ -79,8 +80,8 @@ public class HttpRequestRetryHandler extends DefaultHttpRequestRetryHandler {
final HttpClientContext clientContext = HttpClientContext.adapt(context); final HttpClientContext clientContext = HttpClientContext.adapt(context);
final HttpRequest request = clientContext.getRequest(); final HttpRequest request = clientContext.getRequest();
String method = request.getRequestLine().getMethod().toUpperCase(Locale.ROOT); String method = request.getRequestLine().getMethod().toUpperCase(Locale.ROOT);
if ("POST".equals(method)) { if (POST.equals(method)) {
if (!StringUtils.containsIgnoreCase(exception.getMessage(), "Read timed out")) { if (!StringUtils.containsIgnoreCase(exception.getMessage(), TIME_OUT)) {
return super.retryRequest(exception, executionCount, context); return super.retryRequest(exception, executionCount, context);
} else { } else {
return false; return false;
......
...@@ -24,6 +24,8 @@ import java.util.Objects; ...@@ -24,6 +24,8 @@ import java.util.Objects;
@Component @Component
public class RestTemplateServiceImpl implements IHttpService { public class RestTemplateServiceImpl implements IHttpService {
private static final String LEFT_BRACES = "{", RIGHT_BRACES = "}", Q_MARK = "?";
@Autowired @Autowired
private RestTemplate restTemplate; private RestTemplate restTemplate;
...@@ -63,17 +65,17 @@ public class RestTemplateServiceImpl implements IHttpService { ...@@ -63,17 +65,17 @@ public class RestTemplateServiceImpl implements IHttpService {
private String buildUrl(String uri, Map<String, ?> parameters) { private String buildUrl(String uri, Map<String, ?> parameters) {
StringBuilder builder = new StringBuilder(uri); StringBuilder builder = new StringBuilder(uri);
if (!parameters.isEmpty()) { if (!parameters.isEmpty()) {
if (uri.indexOf("{") > 0 && uri.indexOf("}") > 0) { if (uri.indexOf(LEFT_BRACES) > 0 && uri.indexOf(RIGHT_BRACES) > 0) {
//存在匹配不进行处理 //存在匹配不进行处理
} else { } else {
if (uri.indexOf("?") == -1) { if (uri.indexOf("?") == -1) {
builder.append("?"); builder.append(Q_MARK);
} else if (!uri.endsWith("?")) { } else if (!uri.endsWith(Q_MARK)) {
builder.append("&"); builder.append("&");
} }
int i = 0, j = parameters.keySet().size(); int i = 0, j = parameters.keySet().size();
for (String s : parameters.keySet()) { for (String s : parameters.keySet()) {
builder.append(s).append("={").append(s).append("}"); builder.append(s).append("=").append(LEFT_BRACES).append(s).append(RIGHT_BRACES);
i++; i++;
if (j != i) { if (j != i) {
builder.append("&"); builder.append("&");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment