Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
customer-service
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
QG
customer-service
Commits
50fd68a1
Commit
50fd68a1
authored
Nov 05, 2019
by
xiaozhe.chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加修改手机号后台管理接口
parent
de0103f2
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
868 additions
and
25 deletions
+868
-25
pom.xml
pom.xml
+5
-0
WebSecurityConfig.java
...roup/customer/config/http/security/WebSecurityConfig.java
+4
-0
WebSessionConfig.java
...group/customer/config/http/security/WebSessionConfig.java
+3
-17
HttpRequestRetryHandler.java
...ntgroup/customer/config/rest/HttpRequestRetryHandler.java
+93
-0
HttpResponseErrorHandler.java
...tgroup/customer/config/rest/HttpResponseErrorHandler.java
+43
-0
RestConfig.java
...n/java/cn/quantgroup/customer/config/rest/RestConfig.java
+103
-0
Constant.java
src/main/java/cn/quantgroup/customer/constant/Constant.java
+4
-0
ErrorCodeEnum.java
...main/java/cn/quantgroup/customer/enums/ErrorCodeEnum.java
+27
-0
NetCommunicationException.java
...ntgroup/customer/exception/NetCommunicationException.java
+7
-0
JsonResult.java
src/main/java/cn/quantgroup/customer/rest/JsonResult.java
+4
-0
RestAdvice.java
src/main/java/cn/quantgroup/customer/rest/RestAdvice.java
+12
-0
TestRest.java
src/main/java/cn/quantgroup/customer/rest/TestRest.java
+63
-0
UserRest.java
src/main/java/cn/quantgroup/customer/rest/UserRest.java
+59
-5
ModifyPhoneAudit.java
...a/cn/quantgroup/customer/rest/param/ModifyPhoneAudit.java
+16
-0
ModifyPhoneFeedback.java
...n/quantgroup/customer/rest/param/ModifyPhoneFeedback.java
+13
-0
ModifyPhoneQuery.java
...a/cn/quantgroup/customer/rest/param/ModifyPhoneQuery.java
+19
-0
IUserService.java
...ain/java/cn/quantgroup/customer/service/IUserService.java
+9
-0
IHttpService.java
...ava/cn/quantgroup/customer/service/http/IHttpService.java
+87
-0
RestTemplateServiceImpl.java
...tgroup/customer/service/http/RestTemplateServiceImpl.java
+228
-0
UserServiceImpl.java
.../cn/quantgroup/customer/service/impl/UserServiceImpl.java
+69
-3
No files found.
pom.xml
View file @
50fd68a1
...
...
@@ -135,6 +135,11 @@
<artifactId>
commons-lang3
</artifactId>
<version>
3.5
</version>
</dependency>
<dependency>
<groupId>
commons-beanutils
</groupId>
<artifactId>
commons-beanutils
</artifactId>
<version>
1.9.3
</version>
</dependency>
<dependency>
<groupId>
org.apache.commons
</groupId>
<artifactId>
commons-collections4
</artifactId>
...
...
src/main/java/cn/quantgroup/customer/config/http/security/WebSecurityConfig.java
View file @
50fd68a1
...
...
@@ -40,6 +40,10 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
.
antMatchers
(
"/tech/health/check"
).
permitAll
()
.
antMatchers
(
"/login"
).
permitAll
()
.
antMatchers
(
"/logout-success"
).
permitAll
()
/*test*/
.
antMatchers
(
"/test/**"
).
permitAll
()
.
antMatchers
(
"/user/**"
).
permitAll
()
/*test*/
.
anyRequest
().
authenticated
()
.
requestMatchers
(
CorsUtils:
:
isPreFlightRequest
).
permitAll
()
.
and
().
sessionManagement
().
maximumSessions
(
1
).
maxSessionsPreventsLogin
(
true
)
...
...
src/main/java/cn/quantgroup/customer/config/http/security/WebSessionConfig.java
View file @
50fd68a1
package
cn
.
quantgroup
.
customer
.
config
.
http
.
security
;
import
cn.quantgroup.customer.constant.Constant
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession
;
import
org.springframework.session.web.http.CookieHttpSessionStrategy
;
import
org.springframework.session.web.http.CookieSerializer
;
import
org.springframework.session.web.http.DefaultCookieSerializer
;
import
org.springframework.session.web.http.HeaderHttpSessionStrategy
;
import
org.springframework.session.web.http.HttpSessionStrategy
;
@EnableRedisHttpSession
(
maxInactiveIntervalInSeconds
=
Constant
.
COOKIE_AND_SESSION_EXPIRE_TIMEOUT_SECONDS
,
redisNamespace
=
Constant
.
CUSTOMER_SESSION_NAMESPACE
)
public
class
WebSessionConfig
{
@Bean
(
name
=
"httpSessionStrategy"
)
public
HttpSessionStrategy
httpSessionStrategy
(
@Qualifier
(
"cookieSerializer"
)
CookieSerializer
cookieSerializer
)
{
CookieHttpSessionStrategy
strategy
=
new
CookieHttpSessionStrategy
();
strategy
.
setCookieSerializer
(
cookieSerializer
);
public
HttpSessionStrategy
httpSessionStrategy
()
{
HeaderHttpSessionStrategy
strategy
=
new
HeaderHttpSessionStrategy
();
return
strategy
;
}
@Bean
(
name
=
"cookieSerializer"
)
public
CookieSerializer
generateCookieSerializer
()
{
DefaultCookieSerializer
serializer
=
new
DefaultCookieSerializer
();
serializer
.
setCookieName
(
Constant
.
COOKIE_NAME
);
serializer
.
setCookiePath
(
"/"
);
serializer
.
setDomainNamePattern
(
"^.+?.(\\w+.[a-z]+)$"
);
serializer
.
setCookieMaxAge
(
Constant
.
COOKIE_AND_SESSION_EXPIRE_TIMEOUT_SECONDS
);
return
serializer
;
}
}
src/main/java/cn/quantgroup/customer/config/rest/HttpRequestRetryHandler.java
0 → 100644
View file @
50fd68a1
package
cn
.
quantgroup
.
customer
.
config
.
rest
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.http.HttpRequest
;
import
org.apache.http.annotation.Contract
;
import
org.apache.http.annotation.ThreadingBehavior
;
import
org.apache.http.client.protocol.HttpClientContext
;
import
org.apache.http.impl.client.DefaultHttpRequestRetryHandler
;
import
org.apache.http.protocol.HttpContext
;
import
org.apache.http.util.Args
;
import
javax.net.ssl.SSLException
;
import
java.io.IOException
;
import
java.net.UnknownHostException
;
import
java.util.Arrays
;
import
java.util.Locale
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
/**
* HTTP 自动重试;
* 如果是post请求,并且异常有 Read timed out则不进行重试
*
* @author Jie.Feng
* @date 2017/12/13
*/
@Contract
(
threading
=
ThreadingBehavior
.
IMMUTABLE
)
public
class
HttpRequestRetryHandler
extends
DefaultHttpRequestRetryHandler
{
private
final
Map
<
String
,
Boolean
>
idempotentMethods
;
/**
* 现在重试的类型
*
* @param retryCount
* @param requestSentRetryEnabled
*/
public
HttpRequestRetryHandler
(
int
retryCount
,
boolean
requestSentRetryEnabled
)
{
super
(
retryCount
,
requestSentRetryEnabled
,
Arrays
.
asList
(
UnknownHostException
.
class
,
SSLException
.
class
));
this
.
idempotentMethods
=
new
ConcurrentHashMap
();
this
.
idempotentMethods
.
put
(
"GET"
,
Boolean
.
TRUE
);
this
.
idempotentMethods
.
put
(
"HEAD"
,
Boolean
.
TRUE
);
this
.
idempotentMethods
.
put
(
"PUT"
,
Boolean
.
TRUE
);
this
.
idempotentMethods
.
put
(
"DELETE"
,
Boolean
.
TRUE
);
this
.
idempotentMethods
.
put
(
"OPTIONS"
,
Boolean
.
TRUE
);
this
.
idempotentMethods
.
put
(
"TRACE"
,
Boolean
.
TRUE
);
this
.
idempotentMethods
.
put
(
"POST"
,
Boolean
.
TRUE
);
}
/**
* 这算是默认所有都重3次
*/
public
HttpRequestRetryHandler
()
{
this
(
3
,
false
);
}
@Override
protected
boolean
handleAsIdempotent
(
HttpRequest
request
)
{
String
method
=
request
.
getRequestLine
().
getMethod
().
toUpperCase
(
Locale
.
ROOT
);
Boolean
b
=
(
Boolean
)
this
.
idempotentMethods
.
get
(
method
);
return
b
!=
null
&&
b
.
booleanValue
();
}
/**
* 限制重试的类别
*
* @param exception
* @param executionCount
* @param context
* @return
*/
@Override
public
boolean
retryRequest
(
IOException
exception
,
int
executionCount
,
HttpContext
context
)
{
Args
.
notNull
(
exception
,
"Exception parameter"
);
Args
.
notNull
(
context
,
"HTTP context"
);
final
HttpClientContext
clientContext
=
HttpClientContext
.
adapt
(
context
);
final
HttpRequest
request
=
clientContext
.
getRequest
();
String
method
=
request
.
getRequestLine
().
getMethod
().
toUpperCase
(
Locale
.
ROOT
);
if
(
"POST"
.
equals
(
method
))
{
if
(!
StringUtils
.
containsIgnoreCase
(
exception
.
getMessage
(),
"Read timed out"
))
{
return
super
.
retryRequest
(
exception
,
executionCount
,
context
);
}
else
{
return
false
;
}
}
return
super
.
retryRequest
(
exception
,
executionCount
,
context
);
}
}
src/main/java/cn/quantgroup/customer/config/rest/HttpResponseErrorHandler.java
0 → 100644
View file @
50fd68a1
package
cn
.
quantgroup
.
customer
.
config
.
rest
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.client.ClientHttpResponse
;
import
org.springframework.web.client.DefaultResponseErrorHandler
;
import
org.springframework.web.client.HttpClientErrorException
;
import
org.springframework.web.client.HttpServerErrorException
;
import
org.springframework.web.client.RestClientException
;
import
java.io.IOException
;
import
java.nio.charset.Charset
;
/**
* @author Jie.Feng
* @date 2018/2/6
*/
@Slf4j
public
class
HttpResponseErrorHandler
extends
DefaultResponseErrorHandler
{
@Override
public
void
handleError
(
ClientHttpResponse
response
)
throws
IOException
{
HttpStatus
statusCode
=
getHttpStatusCode
(
response
);
Charset
charset
=
getCharset
(
response
);
if
(
charset
==
null
)
{
charset
=
Charset
.
defaultCharset
();
}
switch
(
statusCode
.
series
())
{
case
CLIENT_ERROR:
byte
[]
responseBody
=
getResponseBody
(
response
);
log
.
warn
(
"HTTP Response: statusCode={},body={}"
,
statusCode
,
new
String
(
responseBody
,
charset
));
throw
new
HttpClientErrorException
(
statusCode
,
response
.
getStatusText
(),
response
.
getHeaders
(),
responseBody
,
charset
);
case
SERVER_ERROR:
byte
[]
responseBody2
=
getResponseBody
(
response
);
log
.
warn
(
"HTTP Response: statusCode={},body={}"
,
statusCode
,
new
String
(
responseBody2
,
charset
));
throw
new
HttpServerErrorException
(
statusCode
,
response
.
getStatusText
(),
response
.
getHeaders
(),
responseBody2
,
charset
);
default
:
throw
new
RestClientException
(
"Unknown status code ["
+
statusCode
+
"]"
);
}
}
}
src/main/java/cn/quantgroup/customer/config/rest/RestConfig.java
0 → 100644
View file @
50fd68a1
package
cn
.
quantgroup
.
customer
.
config
.
rest
;
import
org.apache.http.client.HttpClient
;
import
org.apache.http.client.config.RequestConfig
;
import
org.apache.http.config.Registry
;
import
org.apache.http.config.RegistryBuilder
;
import
org.apache.http.conn.socket.ConnectionSocketFactory
;
import
org.apache.http.conn.socket.PlainConnectionSocketFactory
;
import
org.apache.http.conn.ssl.NoopHostnameVerifier
;
import
org.apache.http.conn.ssl.SSLConnectionSocketFactory
;
import
org.apache.http.conn.ssl.TrustStrategy
;
import
org.apache.http.impl.client.DefaultServiceUnavailableRetryStrategy
;
import
org.apache.http.impl.client.HttpClientBuilder
;
import
org.apache.http.impl.conn.PoolingHttpClientConnectionManager
;
import
org.apache.http.ssl.SSLContextBuilder
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.http.HttpRequest
;
import
org.springframework.http.client.ClientHttpRequestExecution
;
import
org.springframework.http.client.ClientHttpRequestInterceptor
;
import
org.springframework.http.client.ClientHttpResponse
;
import
org.springframework.http.client.HttpComponentsClientHttpRequestFactory
;
import
org.springframework.web.client.RestTemplate
;
import
javax.net.ssl.SSLContext
;
import
java.io.IOException
;
@Configuration
public
class
RestConfig
{
private
final
int
connect_timeout
=
15000
;
private
final
int
read_timeout
=
30000
;
private
final
int
so_timeout
=
60000
;
private
static
final
String
HTTP
=
"http"
;
private
static
final
String
HTTPS
=
"https"
;
@Bean
public
RestTemplate
sslRastTemplate
()
{
SSLContext
sslContext
=
null
;
try
{
sslContext
=
new
SSLContextBuilder
()
.
loadTrustMaterial
(
null
,
(
TrustStrategy
)
(
x509Certificates
,
s
)
->
true
).
build
();
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
SSLConnectionSocketFactory
sslsf
=
new
SSLConnectionSocketFactory
(
sslContext
,
new
String
[]{
"SSLv2Hello"
,
"SSLv3"
,
"TLSv1"
,
"TLSv1.2"
},
null
,
NoopHostnameVerifier
.
INSTANCE
);
Registry
<
ConnectionSocketFactory
>
registry
=
RegistryBuilder
.<
ConnectionSocketFactory
>
create
()
.
register
(
HTTP
,
new
PlainConnectionSocketFactory
())
.
register
(
HTTPS
,
sslsf
)
.
build
();
PoolingHttpClientConnectionManager
connectionManager
=
new
PoolingHttpClientConnectionManager
(
registry
);
connectionManager
.
setMaxTotal
(
1000
);
connectionManager
.
setDefaultMaxPerRoute
(
1000
);
RequestConfig
requestConfig
=
RequestConfig
.
custom
()
.
setConnectTimeout
(
connect_timeout
).
setConnectionRequestTimeout
(
connect_timeout
)
.
setSocketTimeout
(
so_timeout
).
build
();
HttpClientBuilder
clientBuilder
=
HttpClientBuilder
.
create
();
clientBuilder
.
setSSLSocketFactory
(
sslsf
);
clientBuilder
.
setDefaultRequestConfig
(
requestConfig
);
clientBuilder
.
setConnectionManager
(
connectionManager
);
// 开启重试 状态 503 重试
clientBuilder
.
setServiceUnavailableRetryStrategy
(
new
DefaultServiceUnavailableRetryStrategy
(
1
,
500
));
// 开启重试
clientBuilder
.
setRetryHandler
(
new
HttpRequestRetryHandler
());
HttpClient
httpClient
=
clientBuilder
.
build
();
HttpComponentsClientHttpRequestFactory
clientHttpRequestFactory
=
new
HttpComponentsClientHttpRequestFactory
();
clientHttpRequestFactory
.
setHttpClient
(
httpClient
);
clientHttpRequestFactory
.
setConnectTimeout
(
connect_timeout
);
clientHttpRequestFactory
.
setReadTimeout
(
read_timeout
);
RestTemplate
restTemplate
=
new
RestTemplate
(
clientHttpRequestFactory
);
restTemplate
.
setErrorHandler
(
new
HttpResponseErrorHandler
());
restTemplate
.
getInterceptors
().
add
(
new
LogInterceptor
());
return
restTemplate
;
}
/**
* 日志输出
*/
public
static
class
LogInterceptor
implements
ClientHttpRequestInterceptor
{
private
final
static
Logger
log
=
LoggerFactory
.
getLogger
(
RestTemplate
.
class
);
private
final
static
int
max_len
=
1024
;
@Override
public
ClientHttpResponse
intercept
(
HttpRequest
request
,
byte
[]
body
,
ClientHttpRequestExecution
execution
)
throws
IOException
{
String
p
=
null
;
if
(
body
!=
null
)
{
if
(
body
.
length
>
max_len
)
{
p
=
"Too long."
;
}
else
{
p
=
new
String
(
body
);
}
}
log
.
info
(
"HTTP Request: method={},uri={},param:{}"
,
request
.
getMethod
(),
request
.
getURI
(),
p
);
return
execution
.
execute
(
request
,
body
);
}
}
}
src/main/java/cn/quantgroup/customer/constant/Constant.java
View file @
50fd68a1
package
cn
.
quantgroup
.
customer
.
constant
;
import
com.google.gson.Gson
;
public
interface
Constant
{
String
PASSWORD_SALT
=
"_lkb"
;
String
COOKIE_NAME
=
"SESSION"
;
...
...
@@ -14,4 +16,6 @@ public interface Constant {
String
LOGIN_FAIL
=
"登录失败"
;
String
NAME_OR_PWD_ERROR
=
"用户名或密码错误"
;
Gson
GSON
=
new
Gson
();
}
src/main/java/cn/quantgroup/customer/enums/ErrorCodeEnum.java
0 → 100644
View file @
50fd68a1
package
cn
.
quantgroup
.
customer
.
enums
;
public
enum
ErrorCodeEnum
{
NET_ERROR
(
6001L
,
"网络通讯异常"
),
RETURN_ERROR
(
5001L
,
"返回值异常"
);
public
String
getMessage
()
{
return
message
;
}
public
Long
getCode
()
{
return
code
;
}
private
Long
code
;
private
String
message
;
ErrorCodeEnum
(
Long
code
,
String
message
)
{
this
.
code
=
code
;
this
.
message
=
message
;
}
}
src/main/java/cn/quantgroup/customer/exception/NetCommunicationException.java
0 → 100644
View file @
50fd68a1
package
cn
.
quantgroup
.
customer
.
exception
;
public
class
NetCommunicationException
extends
RuntimeException
{
public
NetCommunicationException
(
String
message
)
{
super
(
message
);
}
}
src/main/java/cn/quantgroup/customer/rest/JsonResult.java
View file @
50fd68a1
...
...
@@ -89,6 +89,10 @@ public class JsonResult implements Serializable {
return
new
JsonResult
(
msg
,
ERROR_STATE_CODE
,
data
,
businessId
);
}
public
static
JsonResult
buildErrorStateResult
(
String
msg
,
Long
businessId
)
{
return
new
JsonResult
(
msg
,
ERROR_STATE_CODE
,
null
,
businessId
);
}
public
static
JsonResult
buildFatalErrorStateResult
(
String
msg
,
Object
data
,
Long
businessId
)
{
return
new
JsonResult
(
msg
,
ERROR_STATE_CODE
,
data
,
businessId
);
}
...
...
src/main/java/cn/quantgroup/customer/rest/RestAdvice.java
View file @
50fd68a1
package
cn
.
quantgroup
.
customer
.
rest
;
import
cn.quantgroup.customer.constant.Constant
;
import
cn.quantgroup.customer.enums.ErrorCodeEnum
;
import
cn.quantgroup.customer.exception.NetCommunicationException
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.security.authentication.BadCredentialsException
;
...
...
@@ -19,4 +21,14 @@ public class RestAdvice {
return
JsonResult
.
buildErrorStateResult
(
Constant
.
NAME_OR_PWD_ERROR
,
null
);
}
@ExceptionHandler
({
NetCommunicationException
.
class
})
@ResponseBody
@ResponseStatus
(
HttpStatus
.
OK
)
public
JsonResult
handleNetCommunicationException
(
NetCommunicationException
ex
)
{
log
.
info
(
ex
.
getMessage
());
return
JsonResult
.
buildErrorStateResult
(
ErrorCodeEnum
.
NET_ERROR
.
getMessage
(),
ErrorCodeEnum
.
NET_ERROR
.
getCode
());
}
}
src/main/java/cn/quantgroup/customer/rest/TestRest.java
0 → 100644
View file @
50fd68a1
package
cn
.
quantgroup
.
customer
.
rest
;
import
cn.quantgroup.customer.service.http.IHttpService
;
import
com.google.common.collect.Maps
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.Map
;
import
static
cn
.
quantgroup
.
customer
.
constant
.
Constant
.
LOGOUT_SUCCESS
;
@Slf4j
@RestController
@RequestMapping
(
"/test"
)
public
class
TestRest
{
@Autowired
private
IHttpService
httpService
;
@GetMapping
(
value
=
"/auth"
)
public
JsonResult
testAuth
()
{
return
JsonResult
.
buildSuccessResult
(
LOGOUT_SUCCESS
,
null
);
}
@RequestMapping
(
value
=
"/audit"
,
method
=
RequestMethod
.
PUT
)
public
JsonResult
audit
(
@RequestBody
AuditParam
auditParam
)
{
return
JsonResult
.
buildSuccessResult
(
"success"
,
auditParam
);
}
@RequestMapping
(
value
=
"/put_audit"
)
public
JsonResult
putAudit
()
{
String
url
=
"http://127.0.0.1:7067/test/audit"
;
Map
<
String
,
String
>
header
=
Maps
.
newHashMap
();
header
.
put
(
"Content-type"
,
"application/json"
);
Map
<
String
,
String
>
auditParam
=
Maps
.
newHashMap
();
auditParam
.
put
(
"applyStatus"
,
"true"
);
auditParam
.
put
(
"applyStatusReason"
,
"success"
);
auditParam
.
put
(
"id"
,
"rx12308866"
);
JsonResult
result
=
httpService
.
put
(
url
,
header
,
auditParam
,
JsonResult
.
class
);
return
result
;
}
@RequestMapping
(
value
=
"/modify/{id}/feedback"
,
method
=
RequestMethod
.
PUT
)
public
JsonResult
feedback
(
@PathVariable
String
id
)
{
return
JsonResult
.
buildSuccessResult
(
"success"
,
id
);
}
@Setter
@Getter
static
class
AuditParam
{
boolean
applyStatus
;
String
applyStatusReason
;
String
id
;
}
}
src/main/java/cn/quantgroup/customer/rest/UserRest.java
View file @
50fd68a1
package
cn
.
quantgroup
.
customer
.
rest
;
import
cn.quantgroup.customer.entity.User
;
import
cn.quantgroup.customer.enums.ErrorCodeEnum
;
import
cn.quantgroup.customer.rest.param.LoginParam
;
import
cn.quantgroup.customer.rest.param.ModifyPhoneAudit
;
import
cn.quantgroup.customer.rest.param.ModifyPhoneFeedback
;
import
cn.quantgroup.customer.rest.param.ModifyPhoneQuery
;
import
cn.quantgroup.customer.rest.vo.AuthUserVo
;
import
cn.quantgroup.customer.service.IUserService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.security.authentication.AuthenticationManager
;
import
org.springframework.security.authentication.UsernamePasswordAuthenticationToken
;
import
org.springframework.security.core.Authentication
;
import
org.springframework.security.core.annotation.AuthenticationPrincipal
;
import
org.springframework.security.core.context.SecurityContextHolder
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.ModelAttribute
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpSession
;
...
...
@@ -22,12 +25,15 @@ import static cn.quantgroup.customer.constant.Constant.*;
@Slf4j
@RestController
@RequestMapping
(
"/user"
)
public
class
UserRest
{
private
final
IUserService
userService
;
private
final
AuthenticationManager
authenticationManager
;
public
UserRest
(
AuthenticationManager
authenticationManager
)
{
public
UserRest
(
AuthenticationManager
authenticationManager
,
IUserService
userService
)
{
this
.
authenticationManager
=
authenticationManager
;
this
.
userService
=
userService
;
}
@PostMapping
(
value
=
"/login"
)
...
...
@@ -51,9 +57,57 @@ public class UserRest {
return
JsonResult
.
buildSuccessResult
(
LOGOUT_SUCCESS
,
null
);
}
@GetMapping
(
value
=
"/logout-success"
)
public
JsonResult
logoutSuccess
()
{
return
JsonResult
.
buildSuccessResult
(
LOGOUT_SUCCESS
,
null
);
}
/**
* 修改手机号-查询工单
*
* @param modifyPhoneQuery
* @return
*/
@GetMapping
(
value
=
"/modify/phone_no"
)
public
JsonResult
modifyPhoneQuery
(
ModifyPhoneQuery
modifyPhoneQuery
)
{
String
response
=
userService
.
modifyPhoneQuery
(
modifyPhoneQuery
);
if
(
StringUtils
.
isEmpty
(
response
))
{
return
JsonResult
.
buildErrorStateResult
(
ErrorCodeEnum
.
RETURN_ERROR
.
getMessage
(),
ErrorCodeEnum
.
RETURN_ERROR
.
getCode
());
}
return
GSON
.
fromJson
(
response
,
JsonResult
.
class
);
}
/**
* 修改手机号-人工审核
*
* @param modifyPhoneAudit
* @return
*/
@PostMapping
(
value
=
"/modify/phone_no/audit"
)
public
JsonResult
modifyPhoneAudit
(
ModifyPhoneAudit
modifyPhoneAudit
)
{
String
response
=
userService
.
modifyPhoneAudit
(
modifyPhoneAudit
);
if
(
StringUtils
.
isEmpty
(
response
))
{
return
JsonResult
.
buildErrorStateResult
(
ErrorCodeEnum
.
RETURN_ERROR
.
getMessage
(),
ErrorCodeEnum
.
RETURN_ERROR
.
getCode
());
}
return
GSON
.
fromJson
(
response
,
JsonResult
.
class
);
}
/**
* 修改手机号-反馈跟进
*
* @param modifyPhoneFeedback
* @return
*/
@PostMapping
(
value
=
"/modify/phone_no/feedback"
)
public
JsonResult
modifyPhoneFeedback
(
ModifyPhoneFeedback
modifyPhoneFeedback
)
{
String
response
=
userService
.
modifyPhoneFeedback
(
modifyPhoneFeedback
);
if
(
StringUtils
.
isEmpty
(
response
))
{
return
JsonResult
.
buildErrorStateResult
(
ErrorCodeEnum
.
RETURN_ERROR
.
getMessage
(),
ErrorCodeEnum
.
RETURN_ERROR
.
getCode
());
}
return
GSON
.
fromJson
(
response
,
JsonResult
.
class
);
}
}
src/main/java/cn/quantgroup/customer/rest/param/ModifyPhoneAudit.java
0 → 100644
View file @
50fd68a1
package
cn
.
quantgroup
.
customer
.
rest
.
param
;
import
lombok.Data
;
import
lombok.ToString
;
import
javax.validation.constraints.NotNull
;
@Data
@ToString
public
class
ModifyPhoneAudit
{
@NotNull
(
message
=
"审核状态不能为空"
)
private
Integer
applyStatus
;
private
String
applyStatusReason
;
@NotNull
(
message
=
"id不能为空"
)
private
String
id
;
}
src/main/java/cn/quantgroup/customer/rest/param/ModifyPhoneFeedback.java
0 → 100644
View file @
50fd68a1
package
cn
.
quantgroup
.
customer
.
rest
.
param
;
import
lombok.Data
;
import
lombok.ToString
;
import
javax.validation.constraints.NotNull
;
@Data
@ToString
public
class
ModifyPhoneFeedback
{
@NotNull
(
message
=
"id不能为空"
)
private
String
id
;
}
src/main/java/cn/quantgroup/customer/rest/param/ModifyPhoneQuery.java
0 → 100644
View file @
50fd68a1
package
cn
.
quantgroup
.
customer
.
rest
.
param
;
import
lombok.Data
;
import
lombok.ToString
;
import
java.time.LocalDate
;
@Data
@ToString
public
class
ModifyPhoneQuery
{
private
String
name
;
private
String
idCard
;
private
LocalDate
startAt
;
private
LocalDate
endAt
;
private
Integer
applyStatus
;
private
Integer
processingStatus
;
private
Integer
page
;
private
Integer
size
;
}
src/main/java/cn/quantgroup/customer/service/IUserService.java
View file @
50fd68a1
...
...
@@ -3,6 +3,9 @@ package cn.quantgroup.customer.service;
import
cn.quantgroup.customer.entity.Authority
;
import
cn.quantgroup.customer.entity.RoleAuthority
;
import
cn.quantgroup.customer.entity.UserRole
;
import
cn.quantgroup.customer.rest.param.ModifyPhoneAudit
;
import
cn.quantgroup.customer.rest.param.ModifyPhoneFeedback
;
import
cn.quantgroup.customer.rest.param.ModifyPhoneQuery
;
import
org.springframework.security.core.userdetails.UserDetailsService
;
import
org.springframework.stereotype.Service
;
...
...
@@ -15,4 +18,10 @@ public interface IUserService extends UserDetailsService {
List
<
RoleAuthority
>
findRoleAuthorityByRoleIds
(
List
<
Long
>
roleIdList
);
List
<
Authority
>
findAuthorityByAuthorityIds
(
List
<
Long
>
authorityIdList
);
String
modifyPhoneQuery
(
ModifyPhoneQuery
modifyPhoneQuery
);
String
modifyPhoneAudit
(
ModifyPhoneAudit
modifyPhoneAudit
);
String
modifyPhoneFeedback
(
ModifyPhoneFeedback
modifyPhoneFeedback
);
}
src/main/java/cn/quantgroup/customer/service/http/IHttpService.java
0 → 100644
View file @
50fd68a1
package
cn
.
quantgroup
.
customer
.
service
.
http
;
import
org.springframework.web.client.RestTemplate
;
import
java.util.Map
;
/**
* @author mengfan.feng
* @time 2015-08-13 10:11
*/
public
interface
IHttpService
{
/**
* spring web RestTemplate
*
* @return
*/
RestTemplate
restTemplate
();
/**
* Http Get
*
* @param uri
* @return
*/
String
get
(
String
uri
);
<
T
>
T
get
(
String
uri
,
Class
<
T
>
clazz
);
/**
* Http Get
*
* @param uri
* @param parameters
* @return
*/
String
get
(
String
uri
,
Map
<
String
,
?>
parameters
);
/**
* Http Get
*
* @param uri
* @param headers
* @param parameters
* @return
*/
String
get
(
String
uri
,
Map
<
String
,
String
>
headers
,
Map
<
String
,
?>
parameters
);
/**
* Http Post
*
* @param uri
* @return
*/
String
post
(
String
uri
);
/**
* Http Post
*
* @param uri
* @param parameters
* @return
*/
String
post
(
String
uri
,
Object
parameters
);
String
post
(
String
uri
,
Map
<
String
,
?>
parameters
);
<
T
>
T
post
(
String
uri
,
Map
<
String
,
String
>
headers
,
Object
parameters
,
Class
<
T
>
clazz
);
<
T
>
T
postWithParam
(
String
uri
,
Map
<
String
,
String
>
parameters
,
Class
<
T
>
clazz
);
<
T
>
T
post
(
String
uri
,
Map
<
String
,
String
>
headers
,
Map
<
String
,
String
>
parameters
,
Class
<
T
>
clazz
);
/**
* Http Post
*
* @param uri
* @param headers
* @param parameters
* @return
*/
String
post
(
String
uri
,
Map
<
String
,
String
>
headers
,
Object
parameters
);
<
T
>
T
put
(
String
uri
,
final
Map
<
String
,
String
>
headers
,
Object
parameters
,
Class
<
T
>
clazz
);
}
src/main/java/cn/quantgroup/customer/service/http/RestTemplateServiceImpl.java
0 → 100644
View file @
50fd68a1
package
cn
.
quantgroup
.
customer
.
service
.
http
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.beanutils.BeanUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.*
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.LinkedMultiValueMap
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.web.client.HttpClientErrorException
;
import
org.springframework.web.client.RestTemplate
;
import
java.util.Map
;
import
java.util.Objects
;
/**
* 这是基于 RestTemplate 实现的 ,兼容之前的接口
*
* @author Jie.Feng
* @date 2017/12/13
*/
@Slf4j
@Component
public
class
RestTemplateServiceImpl
implements
IHttpService
{
@Autowired
private
RestTemplate
restTemplate
;
@Override
public
RestTemplate
restTemplate
()
{
return
restTemplate
;
}
@Override
public
String
get
(
String
uri
)
{
ResponseEntity
<
String
>
entity
=
restTemplate
.
getForEntity
(
uri
,
String
.
class
);
if
(
entity
.
getStatusCode
().
is2xxSuccessful
())
{
return
entity
.
getBody
();
}
throw
new
HttpClientErrorException
(
entity
.
getStatusCode
());
}
@Override
public
<
T
>
T
get
(
String
uri
,
Class
<
T
>
clazz
)
{
ResponseEntity
<
T
>
entity
=
restTemplate
.
getForEntity
(
uri
,
clazz
);
if
(
entity
.
getStatusCode
().
is2xxSuccessful
())
{
return
entity
.
getBody
();
}
throw
new
HttpClientErrorException
(
entity
.
getStatusCode
());
}
@Override
public
String
get
(
String
uri
,
Map
<
String
,
?>
parameters
)
{
ResponseEntity
<
String
>
entity
=
restTemplate
.
getForEntity
(
buildUrl
(
uri
,
parameters
),
String
.
class
,
parameters
);
if
(
entity
.
getStatusCode
().
is2xxSuccessful
())
{
return
entity
.
getBody
();
}
throw
new
HttpClientErrorException
(
entity
.
getStatusCode
());
}
private
String
buildUrl
(
String
uri
,
Map
<
String
,
?>
parameters
)
{
StringBuilder
builder
=
new
StringBuilder
(
uri
);
if
(!
parameters
.
isEmpty
())
{
if
(
uri
.
indexOf
(
"{"
)
>
0
&&
uri
.
indexOf
(
"}"
)
>
0
)
{
//存在匹配不进行处理
}
else
{
if
(
uri
.
indexOf
(
"?"
)
==
-
1
)
{
builder
.
append
(
"?"
);
}
else
if
(!
uri
.
endsWith
(
"?"
))
{
builder
.
append
(
"&"
);
}
int
i
=
0
,
j
=
parameters
.
keySet
().
size
();
for
(
String
s
:
parameters
.
keySet
())
{
builder
.
append
(
s
).
append
(
"={"
).
append
(
s
).
append
(
"}"
);
i
++;
if
(
j
!=
i
)
{
builder
.
append
(
"&"
);
}
}
}
}
return
builder
.
toString
();
}
@Override
public
String
get
(
String
uri
,
Map
<
String
,
String
>
hs
,
Map
<
String
,
?>
parameters
)
{
HttpHeaders
headers
=
new
HttpHeaders
();
hs
.
forEach
((
k
,
v
)
->
{
headers
.
add
(
k
,
v
);
});
HttpEntity
<?>
en
=
new
HttpEntity
<>(
headers
);
ResponseEntity
<
String
>
entity
=
restTemplate
.
exchange
(
buildUrl
(
uri
,
parameters
),
HttpMethod
.
GET
,
en
,
String
.
class
,
parameters
);
if
(
entity
.
getStatusCode
().
is2xxSuccessful
())
{
return
entity
.
getBody
();
}
throw
new
HttpClientErrorException
(
entity
.
getStatusCode
());
}
@Override
public
String
post
(
String
uri
)
{
ResponseEntity
<
String
>
entity
=
restTemplate
.
postForEntity
(
uri
,
null
,
String
.
class
);
if
(
entity
.
getStatusCode
().
is2xxSuccessful
())
{
return
entity
.
getBody
();
}
throw
new
HttpClientErrorException
(
entity
.
getStatusCode
());
}
@Override
public
String
post
(
String
uri
,
Object
parameters
)
{
ResponseEntity
<
String
>
entity
=
restTemplate
.
postForEntity
(
uri
,
parameters
,
String
.
class
);
if
(
entity
.
getStatusCode
().
is2xxSuccessful
())
{
return
entity
.
getBody
();
}
throw
new
HttpClientErrorException
(
entity
.
getStatusCode
());
}
@Override
public
String
post
(
String
uri
,
Map
<
String
,
?>
parameters
)
{
ResponseEntity
<
String
>
entity
=
restTemplate
.
exchange
(
uri
,
HttpMethod
.
POST
,
from
(
null
,
parameters
),
String
.
class
);
if
(
entity
.
getStatusCode
().
is2xxSuccessful
())
{
return
entity
.
getBody
();
}
throw
new
HttpClientErrorException
(
entity
.
getStatusCode
());
}
/**
* 表单提交封装
*
* @param parameters
* @return
*/
private
HttpEntity
<
MultiValueMap
<
String
,
String
>>
from
(
Map
<
String
,
String
>
headers
,
Map
<
String
,
?>
parameters
)
{
HttpHeaders
hd
=
new
HttpHeaders
();
if
(
headers
!=
null
)
{
headers
.
forEach
((
k
,
v
)
->
{
hd
.
add
(
k
,
v
);
});
}
// hd.setContentType(MediaType.APPLICATION_FORM_URLENCODED); 表单头?
MultiValueMap
<
String
,
String
>
params
=
new
LinkedMultiValueMap
<>();
parameters
.
forEach
((
s
,
o
)
->
{
params
.
add
(
s
,
Objects
.
toString
(
o
,
StringUtils
.
EMPTY
));
});
HttpEntity
<
MultiValueMap
<
String
,
String
>>
requestEntity
=
new
HttpEntity
<>(
params
,
hd
);
return
requestEntity
;
}
@Override
public
<
T
>
T
post
(
String
uri
,
final
Map
<
String
,
String
>
headers
,
Object
parameters
,
Class
<
T
>
clazz
)
{
HttpHeaders
hd
=
new
HttpHeaders
();
if
(
headers
!=
null
)
{
headers
.
forEach
((
k
,
v
)
->
{
hd
.
add
(
k
,
v
);
});
}
//模拟表单提交
if
(
MediaType
.
APPLICATION_FORM_URLENCODED
.
equals
(
hd
.
getContentType
()))
{
MultiValueMap
<
String
,
Object
>
params
=
new
LinkedMultiValueMap
<>();
if
(
parameters
instanceof
Map
)
{
Map
<
String
,
Object
>
param
=
(
Map
)
parameters
;
params
.
setAll
(
param
);
}
else
{
try
{
Map
<
String
,
String
>
describe
=
BeanUtils
.
describe
(
parameters
);
describe
.
forEach
((
k
,
v
)
->
{
params
.
add
(
k
,
v
);
});
}
catch
(
Exception
e
)
{
log
.
error
(
"表单提交时,bean必须为可序列基础类型:"
,
e
);
throw
new
IllegalArgumentException
(
"bean必须为可序列基础类型"
);
}
}
parameters
=
params
;
}
HttpEntity
<
Object
>
requestEntity
=
new
HttpEntity
<>(
parameters
,
hd
);
ResponseEntity
<
T
>
entity
=
restTemplate
.
exchange
(
uri
,
HttpMethod
.
POST
,
requestEntity
,
clazz
);
if
(
entity
.
getStatusCode
().
is2xxSuccessful
())
{
return
entity
.
getBody
();
}
throw
new
HttpClientErrorException
(
entity
.
getStatusCode
());
}
@Override
public
<
T
>
T
postWithParam
(
String
uri
,
Map
<
String
,
String
>
parameters
,
Class
<
T
>
clazz
)
{
ResponseEntity
<
T
>
entity
=
restTemplate
.
exchange
(
uri
,
HttpMethod
.
POST
,
from
(
null
,
parameters
),
clazz
);
if
(
entity
.
getStatusCode
().
is2xxSuccessful
())
{
return
entity
.
getBody
();
}
throw
new
HttpClientErrorException
(
entity
.
getStatusCode
());
}
@Override
public
<
T
>
T
post
(
String
uri
,
Map
<
String
,
String
>
headers
,
Map
<
String
,
String
>
parameters
,
Class
<
T
>
clazz
)
{
ResponseEntity
<
T
>
entity
=
restTemplate
.
exchange
(
uri
,
HttpMethod
.
POST
,
from
(
headers
,
parameters
),
clazz
);
if
(
entity
.
getStatusCode
().
is2xxSuccessful
())
{
return
entity
.
getBody
();
}
throw
new
HttpClientErrorException
(
entity
.
getStatusCode
());
}
@Override
public
String
post
(
String
uri
,
Map
<
String
,
String
>
headers
,
Object
parameters
)
{
return
post
(
uri
,
headers
,
parameters
,
String
.
class
);
}
@Override
public
<
T
>
T
put
(
String
uri
,
final
Map
<
String
,
String
>
headers
,
Object
parameters
,
Class
<
T
>
clazz
)
{
HttpHeaders
hd
=
new
HttpHeaders
();
if
(
headers
!=
null
)
{
headers
.
forEach
((
k
,
v
)
->
{
hd
.
add
(
k
,
v
);
});
}
HttpEntity
<
Object
>
requestEntity
=
new
HttpEntity
<>(
parameters
,
hd
);
ResponseEntity
<
T
>
entity
=
restTemplate
.
exchange
(
uri
,
HttpMethod
.
PUT
,
requestEntity
,
clazz
);
if
(
entity
.
getStatusCode
().
is2xxSuccessful
())
{
return
entity
.
getBody
();
}
throw
new
HttpClientErrorException
(
entity
.
getStatusCode
());
}
}
src/main/java/cn/quantgroup/customer/service/impl/UserServiceImpl.java
View file @
50fd68a1
...
...
@@ -4,35 +4,55 @@ import cn.quantgroup.customer.entity.Authority;
import
cn.quantgroup.customer.entity.RoleAuthority
;
import
cn.quantgroup.customer.entity.User
;
import
cn.quantgroup.customer.entity.UserRole
;
import
cn.quantgroup.customer.enums.ErrorCodeEnum
;
import
cn.quantgroup.customer.exception.NetCommunicationException
;
import
cn.quantgroup.customer.repo.AuthorityRepo
;
import
cn.quantgroup.customer.repo.RoleAuthorityRepo
;
import
cn.quantgroup.customer.repo.UserRepo
;
import
cn.quantgroup.customer.repo.UserRoleRepo
;
import
cn.quantgroup.customer.rest.param.ModifyPhoneAudit
;
import
cn.quantgroup.customer.rest.param.ModifyPhoneFeedback
;
import
cn.quantgroup.customer.rest.param.ModifyPhoneQuery
;
import
cn.quantgroup.customer.service.IUserService
;
import
cn.quantgroup.customer.service.http.IHttpService
;
import
com.google.common.collect.Maps
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.exception.ExceptionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.security.core.userdetails.UserDetails
;
import
org.springframework.security.core.userdetails.UsernameNotFoundException
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
import
java.util.Map
;
import
static
cn
.
quantgroup
.
customer
.
constant
.
Constant
.
GSON
;
@Slf4j
@Service
(
"userService"
)
public
class
UserServiceImpl
implements
IUserService
{
@Value
(
"${passportapi2.https}"
)
private
String
userSysUrl
;
private
final
UserRepo
userRepo
;
private
final
UserRoleRepo
userRoleRepo
;
private
final
AuthorityRepo
authorityRepo
;
private
final
RoleAuthorityRepo
roleAuthorityRepo
;
private
final
IHttpService
httpService
;
@Autowired
public
UserServiceImpl
(
UserRepo
userRepo
,
UserRoleRepo
userRoleRepo
,
AuthorityRepo
authorityRepo
,
RoleAuthorityRepo
roleAuthorityRepo
)
{
AuthorityRepo
authorityRepo
,
RoleAuthorityRepo
roleAuthorityRepo
,
IHttpService
httpService
)
{
this
.
userRepo
=
userRepo
;
this
.
userRoleRepo
=
userRoleRepo
;
this
.
authorityRepo
=
authorityRepo
;
this
.
roleAuthorityRepo
=
roleAuthorityRepo
;
this
.
httpService
=
httpService
;
}
@Override
...
...
@@ -41,7 +61,6 @@ public class UserServiceImpl implements IUserService {
if
(
user
==
null
)
{
throw
new
UsernameNotFoundException
(
"user: "
+
userName
+
" do not exist!"
);
}
/*
List<UserRole> userRoles = findUserRoleByUserId(user.getId());
if (CollectionUtils.isNotEmpty(userRoles)) {
...
...
@@ -56,7 +75,6 @@ public class UserServiceImpl implements IUserService {
}
}
*/
return
user
;
}
...
...
@@ -74,4 +92,52 @@ public class UserServiceImpl implements IUserService {
public
List
<
Authority
>
findAuthorityByAuthorityIds
(
List
<
Long
>
authorityIdList
)
{
return
authorityRepo
.
findByIdIn
(
authorityIdList
);
}
@Override
public
String
modifyPhoneQuery
(
ModifyPhoneQuery
modifyPhoneQuery
)
{
String
url
=
userSysUrl
+
"/v1/user/modify/phone_no"
;
Map
param
=
GSON
.
fromJson
(
GSON
.
toJson
(
modifyPhoneQuery
),
Map
.
class
);
try
{
String
response
=
httpService
.
get
(
url
,
param
);
if
(
StringUtils
.
isEmpty
(
response
))
{
log
.
error
(
"[user][query modify phone list] 请求业务系统返回值为空,queryModifyPhone:{}"
,
modifyPhoneQuery
);
}
return
response
;
}
catch
(
Exception
e
)
{
log
.
error
(
"[user][query modify phone list] 网络通讯异常,queryModifyPhone:{},ex:{}"
,
modifyPhoneQuery
,
ExceptionUtils
.
getStackTrace
(
e
));
throw
new
NetCommunicationException
(
ErrorCodeEnum
.
NET_ERROR
.
getMessage
());
}
}
@Override
public
String
modifyPhoneAudit
(
ModifyPhoneAudit
modifyPhoneAudit
)
{
String
url
=
userSysUrl
+
"/v1/user/modify/phone_no/audit"
;
Map
param
=
GSON
.
fromJson
(
GSON
.
toJson
(
modifyPhoneAudit
),
Map
.
class
);
try
{
Map
<
String
,
String
>
header
=
Maps
.
newHashMap
();
header
.
put
(
"Content-type"
,
"application/json"
);
String
result
=
httpService
.
put
(
url
,
header
,
param
,
String
.
class
);
log
.
info
(
"[user][query modify audit ] 请求业务系统返回值:{}"
,
result
);
return
result
;
}
catch
(
Exception
e
)
{
log
.
error
(
"[user][query modify audit ] 网络通讯异常,modifyPhoneAudit:{},ex:{}"
,
modifyPhoneAudit
,
ExceptionUtils
.
getStackTrace
(
e
));
throw
new
NetCommunicationException
(
ErrorCodeEnum
.
NET_ERROR
.
getMessage
());
}
}
@Override
public
String
modifyPhoneFeedback
(
ModifyPhoneFeedback
modifyPhoneFeedback
)
{
//String url = "http://127.0.0.1:7067/test/modify/{id}/feedback";
String
url
=
userSysUrl
+
"/v1/user/modify/phone_no/{id}/feedback"
;
try
{
String
id
=
modifyPhoneFeedback
.
getId
();
url
=
url
.
replace
(
"{id}"
,
id
);
String
result
=
httpService
.
put
(
url
,
null
,
null
,
String
.
class
);
log
.
info
(
"[user][query modify feedback ] 请求业务系统返回值:{}"
,
result
);
return
result
;
}
catch
(
Exception
e
)
{
log
.
error
(
"[user][query modify feedback ] 网络通讯异常,modifyPhoneFeedback:{},ex:{}"
,
modifyPhoneFeedback
,
ExceptionUtils
.
getStackTrace
(
e
));
throw
new
NetCommunicationException
(
ErrorCodeEnum
.
NET_ERROR
.
getMessage
());
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment