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
70f739d7
Commit
70f739d7
authored
Nov 06, 2019
by
xiaozhe.chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加修改手机号后台管理接口
parent
bb9a9d55
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
60 additions
and
520 deletions
+60
-520
pom.xml
pom.xml
+14
-86
Bootstrap.java
src/main/java/cn/quantgroup/customer/Bootstrap.java
+1
-3
WebMvcConfigure.java
.../quantgroup/customer/config/http/mvc/WebMvcConfigure.java
+0
-2
CorsFilter.java
...uantgroup/customer/config/http/mvc/filter/CorsFilter.java
+1
-1
ParticularPasswordEncoder.java
...tomer/config/http/security/ParticularPasswordEncoder.java
+1
-1
RESTAuthenticationEntryPoint.java
...er/config/http/security/RESTAuthenticationEntryPoint.java
+0
-28
WebSecurityConfig.java
...roup/customer/config/http/security/WebSecurityConfig.java
+1
-18
HttpRequestRetryHandler.java
...ntgroup/customer/config/rest/HttpRequestRetryHandler.java
+4
-6
RestConfig.java
...n/java/cn/quantgroup/customer/config/rest/RestConfig.java
+14
-14
Constant.java
src/main/java/cn/quantgroup/customer/constant/Constant.java
+4
-3
Authority.java
src/main/java/cn/quantgroup/customer/entity/Authority.java
+0
-43
Role.java
src/main/java/cn/quantgroup/customer/entity/Role.java
+2
-2
RoleAuthority.java
...ain/java/cn/quantgroup/customer/entity/RoleAuthority.java
+0
-36
UserRole.java
src/main/java/cn/quantgroup/customer/entity/UserRole.java
+0
-36
AuthorityEnum.java
...main/java/cn/quantgroup/customer/enums/AuthorityEnum.java
+0
-17
RoleTypeEnum.java
src/main/java/cn/quantgroup/customer/enums/RoleTypeEnum.java
+0
-4
AuthorityRepo.java
src/main/java/cn/quantgroup/customer/repo/AuthorityRepo.java
+0
-14
RoleAuthorityRepo.java
...n/java/cn/quantgroup/customer/repo/RoleAuthorityRepo.java
+0
-13
UserRoleRepo.java
src/main/java/cn/quantgroup/customer/repo/UserRoleRepo.java
+0
-12
JsonResult.java
src/main/java/cn/quantgroup/customer/rest/JsonResult.java
+9
-77
TestRest.java
src/main/java/cn/quantgroup/customer/rest/TestRest.java
+4
-47
UserRest.java
src/main/java/cn/quantgroup/customer/rest/UserRest.java
+0
-12
IUserService.java
...ain/java/cn/quantgroup/customer/service/IUserService.java
+1
-10
UserServiceImpl.java
.../cn/quantgroup/customer/service/impl/UserServiceImpl.java
+3
-33
PwdUtil.java
src/main/java/cn/quantgroup/customer/util/PwdUtil.java
+1
-2
No files found.
pom.xml
View file @
70f739d7
...
...
@@ -4,7 +4,6 @@
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
cn.quantgroup
</groupId>
<artifactId>
customer-service
</artifactId>
<version>
1.0-SNAPSHOT
</version>
...
...
@@ -21,11 +20,10 @@
<java.version>
1.8
</java.version>
<spring-context-support.version>
4.1.6.RELEASE
</spring-context-support.version>
<maven.test.skip>
true
</maven.test.skip>
<!--temporary-->
<okhttp.version>
3.4.2
</okhttp.version>
<retrofit.version>
2.1.0
</retrofit.version>
<rxjava.version>
1.2.3
</rxjava.version>
<
org.springframework.security.version>
3.2.7.RELEASE
</org.springframework.
security.version>
<
security.version>
3.2.7.RELEASE
</
security.version>
</properties>
<build>
...
...
@@ -59,16 +57,21 @@
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
<groupId>
cn.quantgroup
</groupId>
<artifactId>
commons-spring
</artifactId>
</dependency>
<dependency>
<groupId>
cn.quantgroup
</groupId>
<artifactId>
commons-core
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot
</artifactId>
<artifactId>
spring-boot
-starter-web
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot
-starter-jdbc
</artifactId>
<artifactId>
spring-boot
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
...
...
@@ -88,7 +91,6 @@
<artifactId>
mysql-connector-java
</artifactId>
<version>
5.1.31
</version>
</dependency>
<dependency>
<groupId>
javax.validation
</groupId>
<artifactId>
validation-api
</artifactId>
...
...
@@ -121,22 +123,22 @@
<dependency>
<groupId>
org.springframework.security
</groupId>
<artifactId>
spring-security-core
</artifactId>
<version>
${
org.springframework.
security.version}
</version>
<version>
${security.version}
</version>
</dependency>
<dependency>
<groupId>
org.springframework.security
</groupId>
<artifactId>
spring-security-config
</artifactId>
<version>
${
org.springframework.
security.version}
</version>
<version>
${security.version}
</version>
</dependency>
<dependency>
<groupId>
org.springframework.security
</groupId>
<artifactId>
spring-security-crypto
</artifactId>
<version>
${
org.springframework.
security.version}
</version>
<version>
${security.version}
</version>
</dependency>
<dependency>
<groupId>
org.springframework.security
</groupId>
<artifactId>
spring-security-web
</artifactId>
<version>
${
org.springframework.
security.version}
</version>
<version>
${security.version}
</version>
</dependency>
<!--security 不兼容. 降级到 1.5.4 完全OK-->
<dependency>
...
...
@@ -190,49 +192,11 @@
<artifactId>
logback-core
</artifactId>
<version>
1.1.4
</version>
</dependency>
<dependency>
<groupId>
com.squareup.okhttp3
</groupId>
<artifactId>
okhttp
</artifactId>
<version>
${okhttp.version}
</version>
</dependency>
<dependency>
<groupId>
com.squareup.okhttp3
</groupId>
<artifactId>
logging-interceptor
</artifactId>
<version>
${okhttp.version}
</version>
</dependency>
<dependency>
<groupId>
com.squareup.retrofit2
</groupId>
<artifactId>
retrofit
</artifactId>
<version>
${retrofit.version}
</version>
</dependency>
<dependency>
<groupId>
com.squareup.retrofit2
</groupId>
<artifactId>
adapter-rxjava
</artifactId>
<version>
${retrofit.version}
</version>
</dependency>
<dependency>
<groupId>
com.squareup.retrofit2
</groupId>
<artifactId>
converter-simplexml
</artifactId>
<version>
${retrofit.version}
</version>
</dependency>
<dependency>
<groupId>
com.squareup.retrofit2
</groupId>
<artifactId>
converter-gson
</artifactId>
<version>
${retrofit.version}
</version>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
fastjson
</artifactId>
<version>
1.2.62
</version>
</dependency>
<dependency>
<groupId>
cn.quantgroup
</groupId>
<artifactId>
commons-spring
</artifactId>
</dependency>
<dependency>
<groupId>
cn.quantgroup
</groupId>
<artifactId>
commons-core
</artifactId>
</dependency>
<dependency>
<groupId>
cn.quantgroup
</groupId>
<artifactId>
shutdown-spring-boot-starter
</artifactId>
...
...
@@ -243,40 +207,4 @@
</dependency>
</dependencies>
<profiles>
<profile>
<id>
dev
</id>
<properties>
<project.environment>
dev
</project.environment>
</properties>
<build>
<resources>
<resource>
<directory>
${project.basedir}/src/main/resources/config/dev
</directory>
<filtering>
true
</filtering>
</resource>
</resources>
</build>
</profile>
<profile>
<id>
product
</id>
<properties>
<project.environment>
product
</project.environment>
</properties>
<build>
<resources>
<resource>
<directory>
${project.basedir}/src/main/resources/config/product
</directory>
<filtering>
true
</filtering>
</resource>
</resources>
</build>
</profile>
</profiles>
</project>
\ No newline at end of file
src/main/java/cn/quantgroup/customer/Bootstrap.java
View file @
70f739d7
...
...
@@ -7,9 +7,7 @@ import org.springframework.context.annotation.EnableAspectJAutoProxy;
@Configuration
@EnableAspectJAutoProxy
@SpringBootApplication
(
scanBasePackages
=
{
"cn.quantgroup.customer"
})
@SpringBootApplication
(
scanBasePackages
=
{
"cn.quantgroup.customer"
})
public
class
Bootstrap
{
public
static
void
main
(
String
[]
args
)
{
...
...
src/main/java/cn/quantgroup/customer/config/http/mvc/WebMvcConfigure.java
View file @
70f739d7
...
...
@@ -35,8 +35,6 @@ public class WebMvcConfigure extends WebMvcConfigurerAdapter {
}
//添加枚举参数转化器
//LocalDate,LocalDateTime转换器也在此添加
@Override
public
void
addFormatters
(
FormatterRegistry
registry
)
{
registry
.
addConverterFactory
(
new
IEnumConverterFactory
());
...
...
src/main/java/cn/quantgroup/customer/config/http/mvc/filter/C
ORS
Filter.java
→
src/main/java/cn/quantgroup/customer/config/http/mvc/filter/C
ors
Filter.java
View file @
70f739d7
...
...
@@ -11,7 +11,7 @@ import java.io.IOException;
@Order
(
Ordered
.
HIGHEST_PRECEDENCE
)
@Configuration
public
class
C
ORS
Filter
implements
Filter
{
public
class
C
ors
Filter
implements
Filter
{
private
String
allowedHeaders
;
@Override
...
...
src/main/java/cn/quantgroup/customer/config/http/security/
I
PasswordEncoder.java
→
src/main/java/cn/quantgroup/customer/config/http/security/
Particular
PasswordEncoder.java
View file @
70f739d7
...
...
@@ -7,7 +7,7 @@ import org.springframework.stereotype.Component;
@Component
(
"passwordEncoder"
)
public
class
I
PasswordEncoder
implements
PasswordEncoder
{
public
class
Particular
PasswordEncoder
implements
PasswordEncoder
{
@Override
public
String
encode
(
CharSequence
rawPassword
)
{
return
PwdUtil
.
MD5
(
rawPassword
.
toString
().
toLowerCase
()
+
Constant
.
PASSWORD_SALT
);
...
...
src/main/java/cn/quantgroup/customer/config/http/security/RESTAuthenticationEntryPoint.java
deleted
100644 → 0
View file @
bb9a9d55
package
cn
.
quantgroup
.
customer
.
config
.
http
.
security
;
import
cn.quantgroup.customer.rest.JsonResult
;
import
org.apache.http.HttpStatus
;
import
org.springframework.security.core.AuthenticationException
;
import
org.springframework.security.web.AuthenticationEntryPoint
;
import
javax.servlet.ServletException
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.PrintWriter
;
import
static
cn
.
quantgroup
.
customer
.
constant
.
Constant
.
GSON
;
public
class
RESTAuthenticationEntryPoint
implements
AuthenticationEntryPoint
{
private
static
final
String
UN_AUTHORIZED_RESULT
=
GSON
.
toJson
(
new
JsonResult
(
"UnAuthorized request"
,
401L
,
""
));
@Override
public
void
commence
(
HttpServletRequest
httpServletRequest
,
HttpServletResponse
httpServletResponse
,
AuthenticationException
e
)
throws
IOException
,
ServletException
{
httpServletResponse
.
setStatus
(
HttpStatus
.
SC_UNAUTHORIZED
);
httpServletResponse
.
setContentType
(
"application/javascript; charset=utf-8"
);
PrintWriter
out
=
httpServletResponse
.
getWriter
();
out
.
println
(
UN_AUTHORIZED_RESULT
);
out
.
close
();
}
}
src/main/java/cn/quantgroup/customer/config/http/security/WebSecurityConfig.java
View file @
70f739d7
package
cn
.
quantgroup
.
customer
.
config
.
http
.
security
;
import
cn.quantgroup.customer.config.http.mvc.filter.CsrfHeaderFilter
;
import
cn.quantgroup.customer.constant.Constant
;
import
cn.quantgroup.customer.service.IUserService
;
import
cn.quantgroup.customer.util.PwdUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.autoconfigure.security.SecurityProperties
;
import
org.springframework.context.annotation.Configuration
;
...
...
@@ -16,13 +14,11 @@ import org.springframework.security.crypto.password.PasswordEncoder;
import
org.springframework.security.web.csrf.CsrfFilter
;
import
org.springframework.security.web.csrf.CsrfTokenRepository
;
import
org.springframework.security.web.csrf.HttpSessionCsrfTokenRepository
;
import
org.springframework.util.StringUtils
;
@Configuration
@Order
(
SecurityProperties
.
ACCESS_OVERRIDE_ORDER
)
public
class
WebSecurityConfig
extends
WebSecurityConfigurerAdapter
{
private
final
IUserService
userService
;
private
final
PasswordEncoder
passwordEncoder
;
@Autowired
...
...
@@ -58,20 +54,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
public
void
configure
(
AuthenticationManagerBuilder
auth
)
throws
Exception
{
auth
.
userDetailsService
(
userService
).
passwordEncoder
(
new
PasswordEncoder
()
{
@Override
public
String
encode
(
CharSequence
rawPass
)
{
return
PwdUtil
.
MD5
(
rawPass
.
toString
().
toLowerCase
()
+
Constant
.
PASSWORD_SALT
);
}
@Override
public
boolean
matches
(
CharSequence
rawPass
,
String
password
)
{
if
(
StringUtils
.
isEmpty
(
password
))
{
return
false
;
}
return
password
.
equals
(
PwdUtil
.
MD5
(
rawPass
.
toString
().
toLowerCase
()
+
Constant
.
PASSWORD_SALT
));
}
});
auth
.
userDetailsService
(
userService
).
passwordEncoder
(
passwordEncoder
);
}
@Override
...
...
src/main/java/cn/quantgroup/customer/config/rest/HttpRequestRetryHandler.java
View file @
70f739d7
...
...
@@ -38,10 +38,8 @@ public class HttpRequestRetryHandler extends DefaultHttpRequestRetryHandler {
* @param requestSentRetryEnabled
*/
public
HttpRequestRetryHandler
(
int
retryCount
,
boolean
requestSentRetryEnabled
)
{
super
(
retryCount
,
requestSentRetryEnabled
,
Arrays
.
asList
(
UnknownHostException
.
class
,
SSLException
.
class
));
this
.
idempotentMethods
=
new
ConcurrentHashMap
();
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
);
...
...
@@ -62,8 +60,8 @@ public class HttpRequestRetryHandler extends DefaultHttpRequestRetryHandler {
@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
()
;
Boolean
b
=
this
.
idempotentMethods
.
get
(
method
);
return
b
!=
null
&&
b
;
}
/**
...
...
src/main/java/cn/quantgroup/customer/config/rest/RestConfig.java
View file @
70f739d7
...
...
@@ -27,18 +27,15 @@ import org.springframework.web.client.RestTemplate;
import
javax.net.ssl.SSLContext
;
import
java.io.IOException
;
import
static
cn
.
quantgroup
.
customer
.
constant
.
Constant
.
HTTP
;
import
static
cn
.
quantgroup
.
customer
.
constant
.
Constant
.
HTTPS
;
@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
sslR
a
stTemplate
()
{
SSLContext
sslContext
=
null
;
public
RestTemplate
sslR
e
stTemplate
()
{
SSLContext
sslContext
;
try
{
sslContext
=
new
SSLContextBuilder
()
.
loadTrustMaterial
(
null
,
(
TrustStrategy
)
(
x509Certificates
,
s
)
->
true
).
build
();
...
...
@@ -53,9 +50,11 @@ public class RestConfig {
PoolingHttpClientConnectionManager
connectionManager
=
new
PoolingHttpClientConnectionManager
(
registry
);
connectionManager
.
setMaxTotal
(
1000
);
connectionManager
.
setDefaultMaxPerRoute
(
1000
);
int
connectTimeout
=
15000
;
int
soTimeout
=
60000
;
RequestConfig
requestConfig
=
RequestConfig
.
custom
()
.
setConnectTimeout
(
connect
_timeout
).
setConnectionRequestTimeout
(
connect_t
imeout
)
.
setSocketTimeout
(
so
_t
imeout
).
build
();
.
setConnectTimeout
(
connect
Timeout
).
setConnectionRequestTimeout
(
connectT
imeout
)
.
setSocketTimeout
(
so
T
imeout
).
build
();
HttpClientBuilder
clientBuilder
=
HttpClientBuilder
.
create
();
clientBuilder
.
setSSLSocketFactory
(
sslsf
);
...
...
@@ -69,8 +68,9 @@ public class RestConfig {
HttpComponentsClientHttpRequestFactory
clientHttpRequestFactory
=
new
HttpComponentsClientHttpRequestFactory
();
clientHttpRequestFactory
.
setHttpClient
(
httpClient
);
clientHttpRequestFactory
.
setConnectTimeout
(
connect_timeout
);
clientHttpRequestFactory
.
setReadTimeout
(
read_timeout
);
clientHttpRequestFactory
.
setConnectTimeout
(
connectTimeout
);
int
readTimeout
=
30000
;
clientHttpRequestFactory
.
setReadTimeout
(
readTimeout
);
RestTemplate
restTemplate
=
new
RestTemplate
(
clientHttpRequestFactory
);
restTemplate
.
setErrorHandler
(
new
HttpResponseErrorHandler
());
...
...
@@ -83,13 +83,13 @@ public class RestConfig {
*/
public
static
class
LogInterceptor
implements
ClientHttpRequestInterceptor
{
private
final
static
Logger
log
=
LoggerFactory
.
getLogger
(
RestTemplate
.
class
);
private
final
static
int
max_len
=
1024
;
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
)
{
if
(
body
.
length
>
MAX_LEN
)
{
p
=
"Too long."
;
}
else
{
p
=
new
String
(
body
);
...
...
src/main/java/cn/quantgroup/customer/constant/Constant.java
View file @
70f739d7
...
...
@@ -4,13 +4,14 @@ package cn.quantgroup.customer.constant;
import
com.google.gson.Gson
;
public
interface
Constant
{
String
HTTP
=
"http"
;
String
HTTPS
=
"https"
;
String
PASSWORD_SALT
=
"_lkb"
;
String
COOKIE_NAME
=
"SESSION"
;
String
CUSTOMER_SESSION_NAMESPACE
=
"CUSTOMER:SESSION_NAMESPACE"
;
String
SPRING_SECURITY_CONTEXT
=
"SPRING_SECURITY_CONTEXT"
;
int
COOKIE_AND_SESSION_EXPIRE_TIMEOUT_SECONDS
=
24
*
60
*
60
;
String
LOGIN_SUCCESS
=
"登录成功"
;
String
LOGOUT_SUCCESS
=
"登出成功"
;
String
LOGIN_FAIL
=
"登录失败"
;
...
...
src/main/java/cn/quantgroup/customer/entity/Authority.java
deleted
100644 → 0
View file @
bb9a9d55
package
cn
.
quantgroup
.
customer
.
entity
;
import
cn.quantgroup.customer.enums.AuthorityEnum
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.ToString
;
import
org.springframework.security.core.GrantedAuthority
;
import
javax.persistence.*
;
import
java.util.Objects
;
@Entity
@Table
(
name
=
"authorities"
)
@Getter
@Setter
@ToString
public
class
Authority
implements
GrantedAuthority
{
@Id
@Column
(
name
=
"id"
)
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Long
id
;
@Column
(
name
=
"authority"
)
private
AuthorityEnum
authority
;
@Override
public
String
getAuthority
()
{
if
(
Objects
.
isNull
(
authority
))
{
return
null
;
}
return
authority
.
getName
();
}
public
String
getAuthorityMessage
()
{
if
(
Objects
.
isNull
(
authority
))
{
return
null
;
}
return
authority
.
getMessage
();
}
}
src/main/java/cn/quantgroup/customer/entity/Role.java
View file @
70f739d7
...
...
@@ -5,7 +5,7 @@ import lombok.Getter;
@Getter
public
enum
Role
{
/*
| 初审|终审|统计|查询|催收|催收减免|修改订单状态
| 初审|终审|统计|查询|催收|催收减免|修改订单状态
———————————————
管理员 |√ |√ |√ |√ |√ |x |x
主管 |√ |√ |√ |√ |√ |x |x
...
...
@@ -14,7 +14,7 @@ public enum Role {
催收人员 |x |x |x |x |√ |x |x
催收主管 |x |x |x |x |√ |√ |x
运营人员 |x |x |x |x |x |x |√
*/
*/
ADMINISTRATOR
(
"管理员"
),
SUPERVISOR
(
"主管"
),
...
...
src/main/java/cn/quantgroup/customer/entity/RoleAuthority.java
deleted
100644 → 0
View file @
bb9a9d55
package
cn
.
quantgroup
.
customer
.
entity
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.ToString
;
import
javax.persistence.*
;
import
java.sql.Timestamp
;
@Entity
@Table
(
name
=
"role_authority"
)
@Getter
@Setter
@ToString
public
class
RoleAuthority
{
@Id
@Column
(
name
=
"id"
)
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Long
id
;
@Column
(
name
=
"role_id"
,
nullable
=
false
)
private
Long
roleId
;
@Column
(
name
=
"authority_id"
,
nullable
=
false
)
private
Long
authorityId
;
@Column
(
name
=
"enable"
)
private
Boolean
enable
;
@Column
(
name
=
"created_at"
)
private
Timestamp
createdAt
;
@Column
(
name
=
"updated_at"
)
private
Timestamp
updatedAt
;
}
src/main/java/cn/quantgroup/customer/entity/UserRole.java
deleted
100644 → 0
View file @
bb9a9d55
package
cn
.
quantgroup
.
customer
.
entity
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.ToString
;
import
javax.persistence.*
;
import
java.io.Serializable
;
import
java.sql.Timestamp
;
@Entity
@Table
(
name
=
"user_role"
)
@Getter
@Setter
@ToString
public
class
UserRole
implements
Serializable
{
@Id
@Column
(
name
=
"id"
)
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Long
id
;
@Column
(
name
=
"user_id"
,
nullable
=
false
)
private
Long
userId
;
@Column
(
name
=
"role_id"
,
nullable
=
false
)
private
Long
roleId
;
@Column
(
name
=
"enable"
)
private
Boolean
enable
;
@Column
(
name
=
"created_at"
)
private
Timestamp
createdAt
;
@Column
(
name
=
"updated_at"
)
private
Timestamp
updatedAt
;
}
src/main/java/cn/quantgroup/customer/enums/AuthorityEnum.java
deleted
100644 → 0
View file @
bb9a9d55
package
cn
.
quantgroup
.
customer
.
enums
;
import
lombok.Getter
;
@Getter
public
enum
AuthorityEnum
{
MODIFY_PHONE
(
"MODIFY_PHONE"
,
"修改手机号"
,
10
);
private
String
name
;
private
int
value
;
private
String
message
;
AuthorityEnum
(
String
name
,
String
message
,
int
value
)
{
this
.
name
=
name
;
this
.
value
=
value
;
this
.
message
=
message
;
}
}
src/main/java/cn/quantgroup/customer/enums/RoleTypeEnum.java
deleted
100644 → 0
View file @
bb9a9d55
package
cn
.
quantgroup
.
customer
.
enums
;
public
enum
RoleTypeEnum
{
}
src/main/java/cn/quantgroup/customer/repo/AuthorityRepo.java
deleted
100644 → 0
View file @
bb9a9d55
package
cn
.
quantgroup
.
customer
.
repo
;
import
cn.quantgroup.customer.entity.Authority
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
java.util.Collection
;
import
java.util.List
;
public
interface
AuthorityRepo
extends
JpaRepository
<
Authority
,
Long
>
{
List
<
Authority
>
findByIdIn
(
Collection
<
Long
>
idList
);
}
src/main/java/cn/quantgroup/customer/repo/RoleAuthorityRepo.java
deleted
100644 → 0
View file @
bb9a9d55
package
cn
.
quantgroup
.
customer
.
repo
;
import
cn.quantgroup.customer.entity.RoleAuthority
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
java.util.Collection
;
import
java.util.List
;
public
interface
RoleAuthorityRepo
extends
JpaRepository
<
RoleAuthority
,
Long
>
{
List
<
RoleAuthority
>
findByRoleIdIn
(
Collection
<
Long
>
roleIdList
);
}
src/main/java/cn/quantgroup/customer/repo/UserRoleRepo.java
deleted
100644 → 0
View file @
bb9a9d55
package
cn
.
quantgroup
.
customer
.
repo
;
import
cn.quantgroup.customer.entity.UserRole
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
java.util.List
;
public
interface
UserRoleRepo
extends
JpaRepository
<
UserRole
,
Long
>
{
List
<
UserRole
>
findByUserId
(
Long
userId
);
}
src/main/java/cn/quantgroup/customer/rest/JsonResult.java
View file @
70f739d7
package
cn
.
quantgroup
.
customer
.
rest
;
import
java.io.Serializable
;
import
lombok.Getter
;
import
lombok.Setter
;
import
java.io.Serializable
;
@Setter
@Getter
public
class
JsonResult
implements
Serializable
{
p
ublic
static
final
Long
API_INVOKE_UNEXPECTED_RESULT_CODE
=
2L
;
p
rivate
static
final
Long
API_INVOKE_UNEXPECTED_RESULT_CODE
=
2L
;
private
static
final
Long
SUCCESS_CODE
=
0L
;
private
static
final
Long
ERROR_STATE_CODE
=
1L
;
private
static
final
Long
SUCCESS_BUSSINESS_CODE
=
0L
;
private
static
final
Long
ERROR_BUSSINESS_CODE
=
1L
;
private
static
final
long
serialVersionUID
=
-
1L
;
private
static
final
String
ZERO_FILL_TEMPLATE
=
"%04d"
;
private
static
final
String
FLOAT_MONEY_ZERO_FILL
=
"%.2f"
;
private
String
msg
=
""
;
// 0成功,1失败
private
String
code
=
"0000"
;
// 业务错误码
private
String
businessCode
=
"0000"
;
// 业务状态码
private
String
businessFlag
=
"0000"
;
private
Object
data
=
null
;
public
JsonResult
()
{
}
/**
* @param msg
* @param code
* @param data
*/
public
JsonResult
(
String
msg
,
Long
code
,
Object
data
)
{
this
.
msg
=
msg
;
this
.
code
=
String
.
format
(
ZERO_FILL_TEMPLATE
,
code
);
...
...
@@ -43,25 +41,11 @@ public class JsonResult implements Serializable {
this
.
businessCode
=
String
.
format
(
ZERO_FILL_TEMPLATE
,
businessCode
);
}
public
JsonResult
(
String
msg
,
Long
code
,
Object
data
,
Long
businessFlag
,
Long
businessCode
)
{
this
.
msg
=
msg
;
this
.
code
=
String
.
format
(
ZERO_FILL_TEMPLATE
,
code
);
this
.
data
=
data
;
this
.
businessCode
=
String
.
format
(
ZERO_FILL_TEMPLATE
,
businessCode
);
this
.
businessFlag
=
String
.
format
(
ZERO_FILL_TEMPLATE
,
businessFlag
);
}
public
JsonResult
(
Object
data
)
{
this
.
data
=
data
;
}
/**
* 构造成功的JsonResult
*
* @param msg String
* @param data Object
* @return JsonResult
*/
public
static
JsonResult
buildSuccessResult
(
String
msg
,
Object
data
)
{
return
new
JsonResult
(
msg
,
SUCCESS_CODE
,
data
,
SUCCESS_BUSSINESS_CODE
);
}
...
...
@@ -70,17 +54,6 @@ public class JsonResult implements Serializable {
return
new
JsonResult
(
msg
,
SUCCESS_CODE
,
data
,
businessId
);
}
public
static
JsonResult
buildSuccessResult
(
String
msg
,
Object
data
,
Long
businessFlag
,
Long
businessCode
)
{
return
new
JsonResult
(
msg
,
SUCCESS_CODE
,
data
,
businessFlag
,
businessCode
);
}
/**
* 构造状态不正确的JsonResult
*
* @param msg String
* @param data Object
* @return JsonResult
*/
public
static
JsonResult
buildErrorStateResult
(
String
msg
,
Object
data
)
{
return
new
JsonResult
(
msg
,
ERROR_STATE_CODE
,
data
,
ERROR_BUSSINESS_CODE
);
}
...
...
@@ -101,53 +74,12 @@ public class JsonResult implements Serializable {
return
new
JsonResult
(
msg
,
SUCCESS_CODE
,
data
,
API_INVOKE_UNEXPECTED_RESULT_CODE
);
}
public
String
getMsg
()
{
return
msg
;
}
public
void
setMsg
(
String
msg
)
{
this
.
msg
=
msg
;
}
public
Object
getData
()
{
return
data
;
}
public
void
setData
(
Object
data
)
{
this
.
data
=
data
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
String
getBusinessCode
()
{
return
businessCode
;
}
public
void
setBusinessCode
(
String
businessCode
)
{
this
.
businessCode
=
businessCode
;
}
public
String
getBusinessFlag
()
{
return
businessFlag
;
}
public
void
setBusinessFlag
(
String
businessFlag
)
{
this
.
businessFlag
=
businessFlag
;
}
@Override
public
String
toString
()
{
return
"JsonResult{"
+
"businessCode='"
+
businessCode
+
'\''
+
", code='"
+
code
+
'\''
+
", data="
+
data
+
",businessFlag="
+
businessFlag
+
'}'
;
}
...
...
src/main/java/cn/quantgroup/customer/rest/TestRest.java
View file @
70f739d7
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
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
@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";
String
url
=
""
;
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
)
{
...
...
@@ -53,12 +18,4 @@ public class TestRest {
}
@Setter
@Getter
static
class
AuditParam
{
private
boolean
applyStatus
;
private
String
applyStatusReason
;
private
String
id
;
}
}
src/main/java/cn/quantgroup/customer/rest/UserRest.java
View file @
70f739d7
...
...
@@ -53,18 +53,6 @@ public class UserRest {
return
JsonResult
.
buildErrorStateResult
(
LOGIN_FAIL
,
null
);
}
@PostMapping
(
value
=
"/logout"
)
public
JsonResult
logout
()
{
return
JsonResult
.
buildSuccessResult
(
LOGOUT_SUCCESS
,
null
);
}
@GetMapping
(
value
=
"/logout-success"
)
public
JsonResult
logoutSuccess
()
{
return
JsonResult
.
buildSuccessResult
(
LOGOUT_SUCCESS
,
null
);
}
/**
* 修改手机号-查询工单
*
...
...
src/main/java/cn/quantgroup/customer/service/IUserService.java
View file @
70f739d7
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
;
import
java.util.List
;
@Service
public
interface
IUserService
extends
UserDetailsService
{
List
<
UserRole
>
findUserRoleByUserId
(
Long
userId
);
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/impl/UserServiceImpl.java
View file @
70f739d7
package
cn
.
quantgroup
.
customer
.
service
.
impl
;
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
;
...
...
@@ -26,7 +20,6 @@ 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
;
...
...
@@ -39,20 +32,12 @@ public class UserServiceImpl implements IUserService {
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
,
IHttpService
httpService
)
{
public
UserServiceImpl
(
UserRepo
userRepo
,
IHttpService
httpService
)
{
this
.
userRepo
=
userRepo
;
this
.
userRoleRepo
=
userRoleRepo
;
this
.
authorityRepo
=
authorityRepo
;
this
.
roleAuthorityRepo
=
roleAuthorityRepo
;
this
.
httpService
=
httpService
;
}
...
...
@@ -65,21 +50,6 @@ public class UserServiceImpl implements IUserService {
return
new
AuthenticationUserDetail
(
user
);
}
@Override
public
List
<
UserRole
>
findUserRoleByUserId
(
Long
userId
)
{
return
userRoleRepo
.
findByUserId
(
userId
);
}
@Override
public
List
<
RoleAuthority
>
findRoleAuthorityByRoleIds
(
List
<
Long
>
roleIdList
)
{
return
roleAuthorityRepo
.
findByRoleIdIn
(
roleIdList
);
}
@Override
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"
;
...
...
@@ -114,8 +84,8 @@ public class UserServiceImpl implements IUserService {
@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";
//
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
);
...
...
src/main/java/cn/quantgroup/customer/util/PwdUtil.java
View file @
70f739d7
...
...
@@ -19,8 +19,7 @@ public class PwdUtil {
int
j
=
md
.
length
;
char
[]
str
=
new
char
[
j
<<
1
];
int
k
=
0
;
for
(
int
i
=
0
;
i
<
j
;
i
++)
{
byte
byte0
=
md
[
i
];
for
(
byte
byte0
:
md
)
{
str
[
k
++]
=
HEX_DIGITS
[
byte0
>>>
4
&
0xf
];
str
[
k
++]
=
HEX_DIGITS
[
byte0
&
0xf
];
}
...
...
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