Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xyqb-user2
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
head_group
xyqb-user2
Commits
dac85ae4
Commit
dac85ae4
authored
Jun 16, 2023
by
王亮
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature-temp-20230615' into 'master'
Feature temp 20230615 See merge request
!116
parents
5b8ef268
2e49972b
Changes
47
Show whitespace changes
Inline
Side-by-side
Showing
47 changed files
with
1504 additions
and
2260 deletions
+1504
-2260
user.sql
doc/sql/user.sql
+0
-0
pom.xml
pom.xml
+8
-17
LoanVestMqConfig.java
...n/java/cn/quantgroup/xyqb/config/mq/LoanVestMqConfig.java
+0
-86
RegisterMqConfig.java
...n/java/cn/quantgroup/xyqb/config/mq/RegisterMqConfig.java
+84
-1
RegisteredNotifyBlackHoleMqConfig.java
...oup/xyqb/config/mq/RegisteredNotifyBlackHoleMqConfig.java
+0
-53
UserController.java
...n/quantgroup/xyqb/controller/external/UserController.java
+2
-2
UserDetailController.java
...tgroup/xyqb/controller/external/UserDetailController.java
+0
-87
UserQueryLogController.java
.../controller/internal/querylog/UserQueryLogController.java
+2
-1
AppController.java
...antgroup/xyqb/controller/internal/user/AppController.java
+2
-24
InnerController.java
...tgroup/xyqb/controller/internal/user/InnerController.java
+1190
-1217
SyncUserController.java
...oup/xyqb/controller/internal/user/SyncUserController.java
+2
-11
UserCenterController.java
...controller/internal/user/center/UserCenterController.java
+5
-3
UserDetailController.java
...troller/middleoffice/userdetail/UserDetailController.java
+1
-7
UserDetailReq.java
...controller/middleoffice/userdetail/req/UserDetailReq.java
+0
-4
WxController.java
...ntgroup/xyqb/controller/middleoffice/wx/WxController.java
+22
-26
Step1Req.java
...uantgroup/xyqb/controller/modifyphoneno/req/Step1Req.java
+0
-2
DetailRegisteredEventListener.java
.../quantgroup/xyqb/event/DetailRegisteredEventListener.java
+2
-13
LkbRegisteredEventListener.java
.../cn/quantgroup/xyqb/event/LkbRegisteredEventListener.java
+1
-1
UserRegisterParam.java
...main/java/cn/quantgroup/xyqb/model/UserRegisterParam.java
+0
-1
IIdCardService.java
.../java/cn/quantgroup/xyqb/service/auth/IIdCardService.java
+0
-18
IdCardServiceImpl.java
.../quantgroup/xyqb/service/auth/impl/IdCardServiceImpl.java
+0
-284
GeetestLib.java
...n/java/cn/quantgroup/xyqb/service/captcha/GeetestLib.java
+6
-4
IUserRegisterService.java
...uantgroup/xyqb/service/register/IUserRegisterService.java
+2
-4
UserRegisterServiceImpl.java
...p/xyqb/service/register/impl/UserRegisterServiceImpl.java
+12
-107
ILkbUserService.java
...java/cn/quantgroup/xyqb/service/user/ILkbUserService.java
+1
-2
IProductLoginService.java
...cn/quantgroup/xyqb/service/user/IProductLoginService.java
+1
-1
LkbUserviceImpl.java
...cn/quantgroup/xyqb/service/user/impl/LkbUserviceImpl.java
+2
-4
OauthClientDetailsServiceImpl.java
...xyqb/service/user/impl/OauthClientDetailsServiceImpl.java
+15
-4
OauthLoginInfoServiceImpl.java
...oup/xyqb/service/user/impl/OauthLoginInfoServiceImpl.java
+5
-6
ProductLoginServiceImpl.java
...group/xyqb/service/user/impl/ProductLoginServiceImpl.java
+3
-5
TenantServiceImpl.java
.../quantgroup/xyqb/service/user/impl/TenantServiceImpl.java
+30
-47
UserCenterServiceImpl.java
...ntgroup/xyqb/service/user/impl/UserCenterServiceImpl.java
+21
-34
UserDetailServiceImpl.java
...ntgroup/xyqb/service/user/impl/UserDetailServiceImpl.java
+1
-4
UserServiceImpl.java
...cn/quantgroup/xyqb/service/user/impl/UserServiceImpl.java
+19
-21
XyqbSessionContextHolder.java
.../cn/quantgroup/xyqb/session/XyqbSessionContextHolder.java
+3
-9
BctyptPasswordUtil.java
...main/java/cn/quantgroup/xyqb/util/BctyptPasswordUtil.java
+2
-7
DateUtils.java
src/main/java/cn/quantgroup/xyqb/util/DateUtils.java
+0
-1
RedisLock.java
src/main/java/cn/quantgroup/xyqb/util/RedisLock.java
+1
-1
ServerUtils.java
src/main/java/cn/quantgroup/xyqb/util/ServerUtils.java
+0
-13
SnowflakeIdentitySequencer.java
...a/cn/quantgroup/xyqb/util/SnowflakeIdentitySequencer.java
+0
-41
StringUtils.java
src/main/java/cn/quantgroup/xyqb/util/StringUtils.java
+0
-9
TenantUtil.java
src/main/java/cn/quantgroup/xyqb/util/TenantUtil.java
+0
-1
XxlJobSpringExecutor.java
...in/java/cn/quantgroup/xyqb/util/XxlJobSpringExecutor.java
+55
-0
IdCard.java
src/main/java/cn/quantgroup/xyqb/validator/IdCard.java
+0
-33
IdCardValidator.java
...in/java/cn/quantgroup/xyqb/validator/IdCardValidator.java
+0
-38
XxlJobConfig.java
src/main/java/cn/quantgroup/xyqb/xxlJob/XxlJobConfig.java
+2
-2
JsonTest.java
src/test/java/common/JsonTest.java
+2
-4
No files found.
src/main/resources/stati
c/sql/user.sql
→
do
c/sql/user.sql
View file @
dac85ae4
File moved
pom.xml
View file @
dac85ae4
...
@@ -46,11 +46,6 @@
...
@@ -46,11 +46,6 @@
<artifactId>
SensorsAnalyticsSDK
</artifactId>
<artifactId>
SensorsAnalyticsSDK
</artifactId>
<version>
3.2.0
</version>
<version>
3.2.0
</version>
</dependency>
</dependency>
<dependency>
<groupId>
com.google.code.gson
</groupId>
<artifactId>
gson
</artifactId>
<version>
2.3.1
</version>
</dependency>
<dependency>
<dependency>
<groupId>
org.springframework.amqp
</groupId>
<groupId>
org.springframework.amqp
</groupId>
<artifactId>
spring-rabbit
</artifactId>
<artifactId>
spring-rabbit
</artifactId>
...
@@ -224,11 +219,7 @@
...
@@ -224,11 +219,7 @@
<artifactId>
commons-codec
</artifactId>
<artifactId>
commons-codec
</artifactId>
<version>
1.10
</version>
<version>
1.10
</version>
</dependency>
</dependency>
<dependency>
<groupId>
com.rabbitmq
</groupId>
<artifactId>
amqp-client
</artifactId>
<version>
4.0.3
</version>
</dependency>
<dependency>
<dependency>
<groupId>
com.zaxxer
</groupId>
<groupId>
com.zaxxer
</groupId>
<artifactId>
HikariCP
</artifactId>
<artifactId>
HikariCP
</artifactId>
...
@@ -306,11 +297,6 @@
...
@@ -306,11 +297,6 @@
<artifactId>
sentry-spring
</artifactId>
<artifactId>
sentry-spring
</artifactId>
<version>
1.7.30
</version>
<version>
1.7.30
</version>
</dependency>
</dependency>
<dependency>
<groupId>
com.vaadin.external.google
</groupId>
<artifactId>
android-json
</artifactId>
<version>
0.0.20131108.vaadin1
</version>
</dependency>
<dependency>
<dependency>
<groupId>
org.aspectj
</groupId>
<groupId>
org.aspectj
</groupId>
<artifactId>
aspectjweaver
</artifactId>
<artifactId>
aspectjweaver
</artifactId>
...
@@ -327,8 +313,8 @@
...
@@ -327,8 +313,8 @@
<version>
2.1.0
</version>
<version>
2.1.0
</version>
<exclusions>
<exclusions>
<exclusion>
<exclusion>
<groupId>
io.nett
y
</groupId>
<groupId>
org.codehaus.groov
y
</groupId>
<artifactId>
netty-all
</artifactId>
<artifactId>
groovy
</artifactId>
</exclusion>
</exclusion>
</exclusions>
</exclusions>
</dependency>
</dependency>
...
@@ -353,6 +339,11 @@
...
@@ -353,6 +339,11 @@
</exclusion>
</exclusion>
</exclusions>
</exclusions>
</dependency>
</dependency>
<dependency>
<groupId>
com.github.ben-manes.caffeine
</groupId>
<artifactId>
caffeine
</artifactId>
<version>
2.9.3
</version>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
...
...
src/main/java/cn/quantgroup/xyqb/config/mq/LoanVestMqConfig.java
deleted
100644 → 0
View file @
5b8ef268
package
cn
.
quantgroup
.
xyqb
.
config
.
mq
;
import
org.springframework.amqp.core.*
;
import
org.springframework.amqp.rabbit.connection.CachingConnectionFactory
;
import
org.springframework.amqp.rabbit.connection.ConnectionFactory
;
import
org.springframework.amqp.rabbit.core.RabbitAdmin
;
import
org.springframework.amqp.rabbit.core.RabbitTemplate
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Primary
;
/**
* //马甲包 xuran
*/
@Primary
@Configuration
public
class
LoanVestMqConfig
{
@Value
(
"${loanvest.rabbitmq.queue}"
)
private
String
queueName
;
@Value
(
"${loanvest.rabbitmq.exchange}"
)
private
String
loanVestExchange
;
@Value
(
"${loanvest.rabbitmq.connection.host}"
)
private
String
host
;
@Value
(
"${loanvest.rabbitmq.connection.port}"
)
private
Integer
port
;
@Value
(
"${loanvest.rabbitmq.connection.user}"
)
private
String
user
;
@Value
(
"${loanvest.rabbitmq.connection.password}"
)
private
String
password
;
@Value
(
"${loanvest.rabbitmq.connection.virtual-host}"
)
private
String
virtualHost
;
@Primary
@Bean
(
name
=
"vestFactory"
)
public
ConnectionFactory
vestFactory
()
{
CachingConnectionFactory
connectionFactory
=
new
CachingConnectionFactory
(
host
,
port
);
connectionFactory
.
setChannelCacheSize
(
1024
);
connectionFactory
.
setCacheMode
(
CachingConnectionFactory
.
CacheMode
.
CONNECTION
);
connectionFactory
.
setChannelCacheSize
(
180
*
1000
);
connectionFactory
.
setConnectionCacheSize
(
1024
);
connectionFactory
.
setUsername
(
user
);
connectionFactory
.
setPassword
(
password
);
connectionFactory
.
setVirtualHost
(
virtualHost
);
connectionFactory
.
setPublisherReturns
(
false
);
connectionFactory
.
setPublisherConfirms
(
false
);
return
connectionFactory
;
}
@Primary
@Bean
(
name
=
"loanVestAmqpAdmin"
)
public
AmqpAdmin
loanVestAdmin
(
@Qualifier
(
"vestFactory"
)
ConnectionFactory
vestFactory
)
{
return
new
RabbitAdmin
(
vestFactory
);
}
@Primary
@Bean
(
name
=
"loanVestExchange"
)
public
FanoutExchange
loanVestExchange
()
{
return
new
FanoutExchange
(
loanVestExchange
);
}
@Primary
@Bean
(
name
=
"loanVestQueue"
)
public
Queue
loanVestQueue
()
{
return
new
Queue
(
queueName
);
}
@Primary
@Bean
(
name
=
"loanVestBinding"
)
public
Binding
bindingLoanVest
(
@Qualifier
(
"loanVestAmqpAdmin"
)
AmqpAdmin
loanVestAdmin
,
@Qualifier
(
"loanVestQueue"
)
Queue
loanVestQueue
,
@Qualifier
(
"loanVestExchange"
)
FanoutExchange
loanVestExchange
)
{
Binding
binding
=
BindingBuilder
.
bind
(
loanVestQueue
).
to
(
loanVestExchange
);
loanVestAdmin
.
declareBinding
(
binding
);
return
binding
;
}
@Primary
@Bean
(
name
=
"rabbitTemplate"
)
public
RabbitTemplate
loanVestTemplate
(
@Qualifier
(
"vestFactory"
)
ConnectionFactory
vestFactory
)
{
RabbitTemplate
template
=
new
RabbitTemplate
(
vestFactory
);
template
.
setExchange
(
loanVestExchange
);
return
template
;
}
}
src/main/java/cn/quantgroup/xyqb/config/mq/RegisterMqConfig.java
View file @
dac85ae4
...
@@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Qualifier;
...
@@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Qualifier;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Primary
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -42,6 +43,89 @@ public class RegisterMqConfig {
...
@@ -42,6 +43,89 @@ public class RegisterMqConfig {
@Value
(
"${register.rabbitmq.connection.virtual-host}"
)
@Value
(
"${register.rabbitmq.connection.virtual-host}"
)
private
String
virtualHost
;
private
String
virtualHost
;
@Value
(
"${registered.notify.black.hole.rabbitmq.connection.virtual-host}"
)
private
String
BlackVirtualHost
;
@Value
(
"${loanvest.rabbitmq.connection.virtual-host}"
)
private
String
loanVirtualHost
;
@Value
(
"${loanvest.rabbitmq.exchange}"
)
private
String
loanVestExchange
;
@Value
(
"${loanvest.rabbitmq.queue}"
)
private
String
loanQueueName
;
@Primary
@Bean
(
name
=
"loanVestQueue"
)
public
Queue
loanVestQueue
()
{
return
new
Queue
(
loanQueueName
);
}
@Primary
@Bean
(
name
=
"loanVestBinding"
)
public
Binding
bindingLoanVest
(
@Qualifier
(
"loanVestAmqpAdmin"
)
AmqpAdmin
loanVestAdmin
,
@Qualifier
(
"loanVestQueue"
)
Queue
loanVestQueue
,
@Qualifier
(
"loanVestExchange"
)
FanoutExchange
loanVestExchange
)
{
Binding
binding
=
BindingBuilder
.
bind
(
loanVestQueue
).
to
(
loanVestExchange
);
loanVestAdmin
.
declareBinding
(
binding
);
return
binding
;
}
@Primary
@Bean
(
name
=
"rabbitTemplate"
)
public
RabbitTemplate
loanVestTemplate
(
@Qualifier
(
"vestFactory"
)
ConnectionFactory
vestFactory
)
{
RabbitTemplate
template
=
new
RabbitTemplate
(
vestFactory
);
template
.
setExchange
(
loanVestExchange
);
return
template
;
}
@Primary
@Bean
(
name
=
"loanVestAmqpAdmin"
)
public
AmqpAdmin
loanVestAdmin
(
@Qualifier
(
"vestFactory"
)
ConnectionFactory
vestFactory
)
{
return
new
RabbitAdmin
(
vestFactory
);
}
@Primary
@Bean
(
name
=
"loanVestExchange"
)
public
FanoutExchange
loanVestExchange
()
{
return
new
FanoutExchange
(
loanVestExchange
);
}
@Primary
@Bean
(
name
=
"vestFactory"
)
public
ConnectionFactory
vestFactory
()
{
CachingConnectionFactory
connectionFactory
=
new
CachingConnectionFactory
(
host
,
port
);
connectionFactory
.
setChannelCacheSize
(
1024
);
connectionFactory
.
setCacheMode
(
CachingConnectionFactory
.
CacheMode
.
CONNECTION
);
connectionFactory
.
setChannelCacheSize
(
180
*
1000
);
connectionFactory
.
setConnectionCacheSize
(
1024
);
connectionFactory
.
setUsername
(
user
);
connectionFactory
.
setPassword
(
password
);
connectionFactory
.
setVirtualHost
(
loanVirtualHost
);
connectionFactory
.
setPublisherReturns
(
false
);
connectionFactory
.
setPublisherConfirms
(
false
);
return
connectionFactory
;
}
@Bean
(
name
=
"registeredNotifyBlackHoleFactory"
)
public
ConnectionFactory
connectionFactory
()
{
CachingConnectionFactory
connectionFactory
=
new
CachingConnectionFactory
(
host
,
port
);
connectionFactory
.
setChannelCacheSize
(
1024
);
connectionFactory
.
setCacheMode
(
CachingConnectionFactory
.
CacheMode
.
CONNECTION
);
connectionFactory
.
setChannelCacheSize
(
180
*
1000
);
connectionFactory
.
setConnectionCacheSize
(
1024
);
connectionFactory
.
setUsername
(
user
);
connectionFactory
.
setPassword
(
password
);
connectionFactory
.
setVirtualHost
(
BlackVirtualHost
);
connectionFactory
.
setPublisherReturns
(
true
);
connectionFactory
.
setPublisherConfirms
(
true
);
return
connectionFactory
;
}
@Bean
(
name
=
"registeredNotifyBlackHoleRabbitTemplate"
)
public
RabbitTemplate
registeredNotifyBlackHoleRabbitTemplate
(
@Qualifier
(
"registeredNotifyBlackHoleFactory"
)
ConnectionFactory
connectionFactory
)
{
return
new
RabbitTemplate
(
connectionFactory
);
}
@Bean
(
name
=
"registerMqFactory"
)
@Bean
(
name
=
"registerMqFactory"
)
public
ConnectionFactory
registerMqFactory
()
{
public
ConnectionFactory
registerMqFactory
()
{
...
@@ -138,7 +222,6 @@ public class RegisterMqConfig {
...
@@ -138,7 +222,6 @@ public class RegisterMqConfig {
queueArgs
.
put
(
"x-message-ttl"
,
24
*
60
*
60
*
1000
);
queueArgs
.
put
(
"x-message-ttl"
,
24
*
60
*
60
*
1000
);
Queue
wechatBind
=
new
Queue
(
queueName
,
true
,
false
,
false
,
queueArgs
);
Queue
wechatBind
=
new
Queue
(
queueName
,
true
,
false
,
false
,
queueArgs
);
rabbitAdmin
.
declareQueue
(
wechatBind
);
rabbitAdmin
.
declareQueue
(
wechatBind
);
// rabbitTemplate.setQueue(queueName);
rabbitTemplate
.
setRoutingKey
(
queueName
);
rabbitTemplate
.
setRoutingKey
(
queueName
);
return
rabbitTemplate
;
return
rabbitTemplate
;
}
}
...
...
src/main/java/cn/quantgroup/xyqb/config/mq/RegisteredNotifyBlackHoleMqConfig.java
deleted
100644 → 0
View file @
5b8ef268
package
cn
.
quantgroup
.
xyqb
.
config
.
mq
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.amqp.rabbit.connection.CachingConnectionFactory
;
import
org.springframework.amqp.rabbit.connection.ConnectionFactory
;
import
org.springframework.amqp.rabbit.core.RabbitTemplate
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
/**
* Date: 2020/1/15
* Time: 下午2:20
*
* @author: yangrui
*/
@Slf4j
@Configuration
public
class
RegisteredNotifyBlackHoleMqConfig
{
@Value
(
"${rabbitmq.connection.host}"
)
private
String
host
;
@Value
(
"${rabbitmq.connection.port}"
)
private
Integer
port
;
@Value
(
"${rabbitmq.connection.user}"
)
private
String
user
;
@Value
(
"${rabbitmq.connection.password}"
)
private
String
password
;
@Value
(
"${registered.notify.black.hole.rabbitmq.connection.virtual-host}"
)
private
String
virtualHost
;
@Bean
(
name
=
"registeredNotifyBlackHoleFactory"
)
public
ConnectionFactory
connectionFactory
()
{
CachingConnectionFactory
connectionFactory
=
new
CachingConnectionFactory
(
host
,
port
);
connectionFactory
.
setChannelCacheSize
(
1024
);
connectionFactory
.
setCacheMode
(
CachingConnectionFactory
.
CacheMode
.
CONNECTION
);
connectionFactory
.
setChannelCacheSize
(
180
*
1000
);
connectionFactory
.
setConnectionCacheSize
(
1024
);
connectionFactory
.
setUsername
(
user
);
connectionFactory
.
setPassword
(
password
);
connectionFactory
.
setVirtualHost
(
virtualHost
);
connectionFactory
.
setPublisherReturns
(
true
);
connectionFactory
.
setPublisherConfirms
(
true
);
return
connectionFactory
;
}
@Bean
(
name
=
"registeredNotifyBlackHoleRabbitTemplate"
)
public
RabbitTemplate
rabbitTemplate
(
@Qualifier
(
"registeredNotifyBlackHoleFactory"
)
ConnectionFactory
connectionFactory
)
{
RabbitTemplate
template
=
new
RabbitTemplate
(
connectionFactory
);
return
template
;
}
}
src/main/java/cn/quantgroup/xyqb/controller/external/UserController.java
View file @
dac85ae4
...
@@ -681,7 +681,7 @@ public class UserController implements IBaseController {
...
@@ -681,7 +681,7 @@ public class UserController implements IBaseController {
String
token
=
request
.
getHeader
(
"x-auth-token"
);
String
token
=
request
.
getHeader
(
"x-auth-token"
);
if
(
null
==
token
||
""
.
equals
(
token
))
{
if
(
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isEmpty
(
token
))
{
return
JsonResult
.
buildErrorStateResult
(
"服务器异常,请稍后再试"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"服务器异常,请稍后再试"
,
null
);
}
}
...
@@ -905,7 +905,7 @@ public class UserController implements IBaseController {
...
@@ -905,7 +905,7 @@ public class UserController implements IBaseController {
@RequestMapping
(
value
=
"/kdsp/loginRecord"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/kdsp/loginRecord"
,
method
=
RequestMethod
.
POST
)
public
JsonResult
loginRecord
(
@RequestParam
(
required
=
true
)
String
deviceId
)
{
public
JsonResult
loginRecord
(
@RequestParam
(
required
=
true
)
String
deviceId
)
{
if
(
null
==
deviceId
||
""
.
equals
(
deviceId
))
{
if
(
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isEmpty
(
deviceId
))
{
return
JsonResult
.
buildErrorStateResult
(
"请传入正确的设备ID"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"请传入正确的设备ID"
,
null
);
}
}
...
...
src/main/java/cn/quantgroup/xyqb/controller/external/UserDetailController.java
deleted
100644 → 0
View file @
5b8ef268
package
cn
.
quantgroup
.
xyqb
.
controller
.
external
;
import
cn.quantgroup.xyqb.controller.IBaseController
;
import
cn.quantgroup.xyqb.entity.User
;
import
cn.quantgroup.xyqb.entity.UserDetail
;
import
cn.quantgroup.xyqb.model.IdCardInfo
;
import
cn.quantgroup.xyqb.model.IdType
;
import
cn.quantgroup.xyqb.model.JsonResult
;
import
cn.quantgroup.xyqb.service.auth.IIdCardService
;
import
cn.quantgroup.xyqb.service.user.IUserDetailService
;
import
cn.quantgroup.xyqb.util.ValidationUtil
;
import
cn.quantgroup.xyqb.validator.ChineseName
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.dao.DataIntegrityViolationException
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Objects
;
/**
* Created by Miraculous on 2017/1/3.
*/
@Slf4j
@RestController
@RequestMapping
(
"/user_detail"
)
@Validated
public
class
UserDetailController
implements
IBaseController
{
@Autowired
private
IUserDetailService
userDetailService
;
@Autowired
private
IIdCardService
idCardService
;
/**
* 保存/更新用户实名信息
* 注:
* 本接口会验证用户登录状态,仅用于用户个人补全实名信息操作
* 产品逻辑是不允许用户重复设置实名信息的,但历史存在导流数据创建不完整实名信息的场景(可理解为和渠道有关)
* 故此本处保留修改逻辑,仍依赖业务端控制产品行为
*
* @param idNo
* @param name
* @return
* @yapi unknown
* @Deprecated 20210318
* @see cn.quantgroup.xyqb.controller.internal.user.InnerController#saveUserDetail(Long, String, String, String, String, String)
*/
@Deprecated
@RequestMapping
(
"/save"
)
public
JsonResult
saveUserDetail
(
String
idNo
,
@ChineseName
@RequestParam
String
name
)
{
if
(!
ValidationUtil
.
validateChinese
(
name
))
{
log
.
error
(
"姓名错误,name:{}"
,
name
);
return
JsonResult
.
buildErrorStateResult
(
"姓名错误"
,
null
);
}
User
user
=
getCurrentUserFromRedis
();
if
(
user
==
null
)
{
return
JsonResult
.
buildErrorStateResult
(
"系统错误"
,
null
);
}
IdCardInfo
info
=
idCardService
.
getIdCardInfo
(
idNo
);
if
(
info
==
null
||
!
info
.
isValid
())
{
log
.
error
(
"身份证号错误,userId:{}, idNo: {}"
,
user
.
getId
(),
idNo
);
return
JsonResult
.
buildErrorStateResult
(
"身份证号码错误"
,
null
);
}
/* 保存或更新 */
UserDetail
userDetail
=
userDetailService
.
findByUserId
(
user
.
getId
());
if
(
Objects
.
isNull
(
userDetail
))
{
userDetail
=
new
UserDetail
();
}
userDetail
.
setPhoneNo
(
user
.
getPhoneNo
());
userDetail
.
setUserId
(
user
.
getId
());
userDetail
.
setName
(
name
);
userDetail
.
setGender
(
info
.
getGender
());
userDetail
.
setIsAuthenticated
(
false
);
log
.
info
(
"UserDetailController saveUserDetail, userId:{}, phoneNo:{}, name:{}"
,
user
.
getId
(),
user
.
getPhoneNo
(),
name
);
try
{
userDetailService
.
saveUserDetail
(
userDetail
);
}
catch
(
DataIntegrityViolationException
ex
)
{
return
JsonResult
.
buildSuccessResult
(
""
,
null
);
}
return
JsonResult
.
buildSuccessResult
(
""
,
null
);
}
}
src/main/java/cn/quantgroup/xyqb/controller/internal/querylog/UserQueryLogController.java
View file @
dac85ae4
...
@@ -15,6 +15,7 @@ import cn.quantgroup.xyqb.util.IdcardValidator;
...
@@ -15,6 +15,7 @@ import cn.quantgroup.xyqb.util.IdcardValidator;
import
cn.quantgroup.xyqb.util.ValidationUtil
;
import
cn.quantgroup.xyqb.util.ValidationUtil
;
import
cn.quantgroup.xyqb.util.encrypt.Md5Util
;
import
cn.quantgroup.xyqb.util.encrypt.Md5Util
;
import
cn.quantgroup.xyqb.util.encrypt.Rsa
;
import
cn.quantgroup.xyqb.util.encrypt.Rsa
;
import
com.alibaba.fastjson.JSON
;
import
com.google.gson.*
;
import
com.google.gson.*
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.poi.hssf.usermodel.*
;
import
org.apache.poi.hssf.usermodel.*
;
...
@@ -206,7 +207,7 @@ public class UserQueryLogController {
...
@@ -206,7 +207,7 @@ public class UserQueryLogController {
HashMap
<
String
,
Object
>
ha
=
new
HashMap
<>();
HashMap
<
String
,
Object
>
ha
=
new
HashMap
<>();
ha
.
put
(
"type"
,
"1"
);
ha
.
put
(
"type"
,
"1"
);
ha
.
put
(
"phones"
,
phoneNos
);
ha
.
put
(
"phones"
,
phoneNos
);
String
phoneNoStr
=
new
Gson
().
toJson
(
ha
);
String
phoneNoStr
=
JSON
.
toJSONString
(
ha
);
String
data
=
""
;
String
data
=
""
;
String
sign
=
""
;
String
sign
=
""
;
...
...
src/main/java/cn/quantgroup/xyqb/controller/internal/user/AppController.java
View file @
dac85ae4
...
@@ -162,7 +162,7 @@ public class AppController implements IBaseController {
...
@@ -162,7 +162,7 @@ public class AppController implements IBaseController {
log
.
info
(
"第三方用户登录 [AppController] login --> loginFrom:{},channelId:{},btRegisterChannelId:{} requestIp:{},idNo:{},name:{}"
,
registerFrom
,
channelId
,
btRegisterChannelId
,
IpUtil
.
getRemoteIP
(
request
),
idNo
,
name
);
log
.
info
(
"第三方用户登录 [AppController] login --> loginFrom:{},channelId:{},btRegisterChannelId:{} requestIp:{},idNo:{},name:{}"
,
registerFrom
,
channelId
,
btRegisterChannelId
,
IpUtil
.
getRemoteIP
(
request
),
idNo
,
name
);
User
user
=
userService
.
findByPhoneInDb
(
phoneNo
);
User
user
=
userService
.
findByPhoneInDb
(
phoneNo
);
if
(
user
==
null
)
{
if
(
user
==
null
)
{
user
=
userRegisterService
.
register
(
registerFrom
,
phoneNo
,
idNo
,
name
,
channelId
,
btRegisterChannelId
);
user
=
userRegisterService
.
register
(
registerFrom
,
phoneNo
,
name
,
channelId
,
btRegisterChannelId
);
}
}
if
(
user
==
null
)
{
if
(
user
==
null
)
{
return
JsonResult
.
buildErrorStateResult
(
USER_ERROR_OR_PASSWORD_ERROR
,
null
);
return
JsonResult
.
buildErrorStateResult
(
USER_ERROR_OR_PASSWORD_ERROR
,
null
);
...
@@ -222,7 +222,7 @@ public class AppController implements IBaseController {
...
@@ -222,7 +222,7 @@ public class AppController implements IBaseController {
boolean
isRegister
=
false
;
boolean
isRegister
=
false
;
if
(
user
==
null
)
{
if
(
user
==
null
)
{
try
{
try
{
user
=
userRegisterService
.
register
(
registerFrom
,
phoneNo
,
idNo
,
name
,
channelId
,
btRegisterChannelId
);
user
=
userRegisterService
.
register
(
registerFrom
,
phoneNo
,
name
,
channelId
,
btRegisterChannelId
);
isRegister
=
true
;
isRegister
=
true
;
}
catch
(
PersistenceException
e
)
{
}
catch
(
PersistenceException
e
)
{
user
=
userService
.
findByPhoneInDb
(
phoneNo
);
user
=
userService
.
findByPhoneInDb
(
phoneNo
);
...
@@ -349,26 +349,4 @@ public class AppController implements IBaseController {
...
@@ -349,26 +349,4 @@ public class AppController implements IBaseController {
return
JsonResult
.
buildSuccessResult
(
"登录成功"
,
bean
);
return
JsonResult
.
buildSuccessResult
(
"登录成功"
,
bean
);
}
}
// @RequestMapping("/login33")
// public JsonResult login233() {
// User user = new User();
// user.setUuid("3213213321");
// user.setRegisteredFrom(221L);
// try {
// EventRecord userRecord = EventRecord.builder().setDistinctId(user.getUuid()).isLoginId(Boolean.TRUE)
// .setEventName("PD_WUXIEC_UserLoginVccCash")
// .addProperty("son_channel_id", user.getRegisteredFrom())
// .addProperty("parent_channel_id",-1L)
// .addProperty("vcc_uuid", user.getUuid())
// .build();
// iSensorsAnalytics.track(userRecord);
// iSensorsAnalytics.flush();
// log.info("神策上报成功");
// } catch (Exception e) {
// log.info("神策埋点出现问题", e);
// }
// return JsonResult.buildSuccessResult("登录成功", null);
//
// }
}
}
src/main/java/cn/quantgroup/xyqb/controller/internal/user/InnerController.java
View file @
dac85ae4
...
@@ -3,20 +3,16 @@ package cn.quantgroup.xyqb.controller.internal.user;
...
@@ -3,20 +3,16 @@ package cn.quantgroup.xyqb.controller.internal.user;
import
cn.quantgroup.xyqb.Constants
;
import
cn.quantgroup.xyqb.Constants
;
import
cn.quantgroup.xyqb.aspect.accessable.IpValidator
;
import
cn.quantgroup.xyqb.aspect.accessable.IpValidator
;
import
cn.quantgroup.xyqb.aspect.forbidden.AccessForbiddenValidator
;
import
cn.quantgroup.xyqb.aspect.forbidden.AccessForbiddenValidator
;
import
cn.quantgroup.xyqb.constant.enums.*
;
import
cn.quantgroup.xyqb.controller.IBaseController
;
import
cn.quantgroup.xyqb.controller.IBaseController
;
import
cn.quantgroup.xyqb.controller.internal.user.resp.UserFullResp
;
import
cn.quantgroup.xyqb.controller.internal.user.resp.UserFullResp
;
import
cn.quantgroup.xyqb.entity.*
;
import
cn.quantgroup.xyqb.entity.*
;
import
cn.quantgroup.xyqb.event.DisableActiveEvent
;
import
cn.quantgroup.xyqb.event.DisableActiveEvent
;
import
cn.quantgroup.xyqb.event.UserDisableRecordEvent
;
import
cn.quantgroup.xyqb.event.UserDisableRecordEvent
;
import
cn.quantgroup.xyqb.exception.UserNotExistException
;
import
cn.quantgroup.xyqb.exception.UserNotExistException
;
import
cn.quantgroup.xyqb.model.Gender
;
import
cn.quantgroup.xyqb.model.IdType
;
import
cn.quantgroup.xyqb.model.*
;
import
cn.quantgroup.xyqb.model.*
;
import
cn.quantgroup.xyqb.remote.StmsRemoteService
;
import
cn.quantgroup.xyqb.remote.StmsRemoteService
;
import
cn.quantgroup.xyqb.repository.IUserDisableRecordRepository
;
import
cn.quantgroup.xyqb.repository.IUserDisableRecordRepository
;
import
cn.quantgroup.xyqb.service.api.IUserApiService
;
import
cn.quantgroup.xyqb.service.api.IUserApiService
;
import
cn.quantgroup.xyqb.service.auth.IIdCardService
;
import
cn.quantgroup.xyqb.service.merchant.IMerchantService
;
import
cn.quantgroup.xyqb.service.merchant.IMerchantService
;
import
cn.quantgroup.xyqb.service.register.IUserDeregisterService
;
import
cn.quantgroup.xyqb.service.register.IUserDeregisterService
;
import
cn.quantgroup.xyqb.service.register.IUserRegisterService
;
import
cn.quantgroup.xyqb.service.register.IUserRegisterService
;
...
@@ -50,7 +46,6 @@ import javax.annotation.Resource;
...
@@ -50,7 +46,6 @@ import javax.annotation.Resource;
import
javax.validation.constraints.Min
;
import
javax.validation.constraints.Min
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.NotNull
;
import
java.io.UnsupportedEncodingException
;
import
java.io.UnsupportedEncodingException
;
import
java.text.ParseException
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -74,8 +69,6 @@ public class InnerController implements IBaseController {
...
@@ -74,8 +69,6 @@ public class InnerController implements IBaseController {
private
IUserDetailService
userDetailService
;
private
IUserDetailService
userDetailService
;
@Autowired
@Autowired
private
IUserBtRegisterService
userBtRegisterService
;
private
IUserBtRegisterService
userBtRegisterService
;
@Autowired
private
IIdCardService
idCardService
;
@Autowired
@Autowired
private
IWechatService
wechatService
;
private
IWechatService
wechatService
;
...
@@ -144,8 +137,7 @@ public class InnerController implements IBaseController {
...
@@ -144,8 +137,7 @@ public class InnerController implements IBaseController {
return
JsonResult
.
buildErrorStateResult
(
"查无此人"
,
null
,
4L
);
return
JsonResult
.
buildErrorStateResult
(
"查无此人"
,
null
,
4L
);
}
}
}
}
UserRet
userRet
=
new
UserRet
(
user
);
return
JsonResult
.
buildSuccessResult
(
""
,
new
UserRet
(
user
));
return
JsonResult
.
buildSuccessResult
(
""
,
userRet
);
}
}
/**
/**
...
@@ -165,8 +157,8 @@ public class InnerController implements IBaseController {
...
@@ -165,8 +157,8 @@ public class InnerController implements IBaseController {
return
JsonResult
.
buildErrorStateResult
(
"查无此人"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"查无此人"
,
null
);
}
}
}
}
UserRet
userRet
=
new
UserRet
(
user
);
return
JsonResult
.
buildSuccessResult
(
""
,
userRet
);
return
JsonResult
.
buildSuccessResult
(
""
,
new
UserRet
(
user
)
);
}
}
/**
/**
...
@@ -273,14 +265,13 @@ public class InnerController implements IBaseController {
...
@@ -273,14 +265,13 @@ public class InnerController implements IBaseController {
@RequestMapping
(
"/user/getPhoneByUserIds"
)
@RequestMapping
(
"/user/getPhoneByUserIds"
)
public
JsonResult
findByIds
(
@RequestParam
(
value
=
"userIds"
)
String
userIdsString
,
public
JsonResult
findByIds
(
@RequestParam
(
value
=
"userIds"
)
String
userIdsString
,
@RequestParam
(
required
=
false
)
Integer
tenantId
)
{
@RequestParam
(
required
=
false
)
Integer
tenantId
)
{
log
.
info
(
"批量查询用户的手机号列表, userIdsString:"
+
userIdsString
+
", tenantId:"
+
tenantId
);
if
(
StringUtils
.
isEmpty
(
userIdsString
))
{
return
JsonResult
.
buildErrorStateResult
(
null
,
null
);
}
//默认羊小咩租户
//默认羊小咩租户
if
(
TenantUtil
.
validationTenantIdIsNullOrZero
(
tenantId
))
{
if
(
TenantUtil
.
validationTenantIdIsNullOrZero
(
tenantId
))
{
tenantId
=
TenantUtil
.
TENANT_DEFAULT
;
tenantId
=
TenantUtil
.
TENANT_DEFAULT
;
}
}
if
(
StringUtils
.
isEmpty
(
userIdsString
))
{
return
JsonResult
.
buildErrorStateResult
(
null
,
null
);
}
List
<
Long
>
userIds
=
JSONObject
.
parseObject
(
userIdsString
,
new
TypeReference
<
List
<
Long
>>()
{
List
<
Long
>
userIds
=
JSONObject
.
parseObject
(
userIdsString
,
new
TypeReference
<
List
<
Long
>>()
{
});
});
if
(!
CollectionUtils
.
isEmpty
(
userIds
)
&&
userIds
.
size
()
<=
Constants
.
USER_ID_BATCH_SIZE
)
{
if
(!
CollectionUtils
.
isEmpty
(
userIds
)
&&
userIds
.
size
()
<=
Constants
.
USER_ID_BATCH_SIZE
)
{
...
@@ -323,7 +314,7 @@ public class InnerController implements IBaseController {
...
@@ -323,7 +314,7 @@ public class InnerController implements IBaseController {
return
JsonResult
.
buildSuccessResult
(
null
,
new
UserRet
(
user
));
return
JsonResult
.
buildSuccessResult
(
null
,
new
UserRet
(
user
));
}
}
//注册新用户
//注册新用户
user
=
userRegisterService
.
register
(
registeredFrom
,
phoneNo
,
null
,
null
,
0L
,
0L
,
tenantId
);
user
=
userRegisterService
.
register
(
registeredFrom
,
phoneNo
,
null
,
0L
,
0L
,
tenantId
);
//校验租户ID tenantId
//校验租户ID tenantId
iOauthLoginInfoService
.
addLoginInfo
(
user
,
tenantId
);
iOauthLoginInfoService
.
addLoginInfo
(
user
,
tenantId
);
return
JsonResult
.
buildSuccessResult
(
null
,
new
UserRet
(
user
));
return
JsonResult
.
buildSuccessResult
(
null
,
new
UserRet
(
user
));
...
@@ -354,20 +345,14 @@ public class InnerController implements IBaseController {
...
@@ -354,20 +345,14 @@ public class InnerController implements IBaseController {
if
(
StringUtils
.
isBlank
(
name
))
{
if
(
StringUtils
.
isBlank
(
name
))
{
return
JsonResult
.
buildErrorStateResult
(
"用户姓名为空."
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"用户姓名为空."
,
null
);
}
}
if
(
StringUtils
.
isBlank
(
idNo
))
{
return
JsonResult
.
buildErrorStateResult
(
"用户身份证为空."
,
null
);
}
if
(!
ValidationUtil
.
validatePhoneNo
(
phoneNo
))
{
if
(!
ValidationUtil
.
validatePhoneNo
(
phoneNo
))
{
return
JsonResult
.
buildErrorStateResult
(
"用户手机号错误."
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"用户手机号错误."
,
null
);
}
}
if
(!
ValidationUtil
.
validateChinese
(
name
))
{
if
(!
ValidationUtil
.
validateChinese
(
name
))
{
return
JsonResult
.
buildErrorStateResult
(
"用户姓名错误."
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"用户姓名错误."
,
null
);
}
}
IdCardInfo
info
=
idCardService
.
getIdCardInfo
(
idNo
);
if
(
Objects
.
isNull
(
info
)
||
!
info
.
isValid
())
{
log
.
error
(
"用户身份证号错误,userId:{},idNo: {}"
,
userId
,
idNo
);
return
JsonResult
.
buildErrorStateResult
(
"身份证号码错误"
,
null
);
}
User
user
=
userService
.
findById
(
userId
);
User
user
=
userService
.
findById
(
userId
);
if
(
Objects
.
isNull
(
user
))
{
if
(
Objects
.
isNull
(
user
))
{
return
JsonResult
.
buildErrorStateResult
(
"用户不存在"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"用户不存在"
,
null
);
...
@@ -391,7 +376,6 @@ public class InnerController implements IBaseController {
...
@@ -391,7 +376,6 @@ public class InnerController implements IBaseController {
userDetail
.
setUserId
(
userId
);
userDetail
.
setUserId
(
userId
);
userDetail
.
setName
(
name
);
userDetail
.
setName
(
name
);
userDetail
.
setPhoneNo
(
phoneNo
);
userDetail
.
setPhoneNo
(
phoneNo
);
userDetail
.
setGender
(
info
.
getGender
());
userDetail
.
setEmail
(
email
);
userDetail
.
setEmail
(
email
);
userDetail
.
setQq
(
qq
);
userDetail
.
setQq
(
qq
);
userDetail
=
userDetailService
.
saveUserDetail
(
userDetail
);
userDetail
=
userDetailService
.
saveUserDetail
(
userDetail
);
...
@@ -439,12 +423,13 @@ public class InnerController implements IBaseController {
...
@@ -439,12 +423,13 @@ public class InnerController implements IBaseController {
if
(
tenantId
!=
null
&&
!
TenantUtil
.
TENANT_DEFAULT
.
equals
(
tenantId
))
{
if
(
tenantId
!=
null
&&
!
TenantUtil
.
TENANT_DEFAULT
.
equals
(
tenantId
))
{
// userId 查询对应productLogin 获取手机号和customerId
// userId 查询对应productLogin 获取手机号和customerId
user
=
tenantService
.
getTenantUser
(
user
,
tenantId
);
user
=
tenantService
.
getTenantUser
(
user
,
tenantId
);
if
(
user
==
null
)
{
if
(
user
!=
null
)
{
return
JsonResult
.
buildErrorStateResult
(
"查无此人"
,
null
);
return
JsonResult
.
buildSuccessResult
(
null
,
new
UserRet
(
user
));
}
}
}
}
else
{
return
JsonResult
.
buildSuccessResult
(
null
,
new
UserRet
(
user
));
return
JsonResult
.
buildSuccessResult
(
null
,
new
UserRet
(
user
));
}
}
}
return
JsonResult
.
buildErrorStateResult
(
"查无此人"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"查无此人"
,
null
);
}
}
...
@@ -603,7 +588,6 @@ public class InnerController implements IBaseController {
...
@@ -603,7 +588,6 @@ public class InnerController implements IBaseController {
}
}
@RequestMapping
(
"/user/query/openId"
)
@RequestMapping
(
"/user/query/openId"
)
public
JsonResult
queryOpenIdByUserId
(
Long
userId
)
{
public
JsonResult
queryOpenIdByUserId
(
Long
userId
)
{
if
(
userId
==
null
)
{
if
(
userId
==
null
)
{
...
@@ -738,12 +722,9 @@ public class InnerController implements IBaseController {
...
@@ -738,12 +722,9 @@ public class InnerController implements IBaseController {
}
}
@RequestMapping
(
"/user/wechat/phone_no"
)
@RequestMapping
(
"/user/wechat/phone_no"
)
public
JsonResult
queryOpenIdByPhoneNo
(
String
phoneNo
)
{
public
JsonResult
queryOpenIdByPhoneNo
(
String
phoneNo
)
{
if
(
StringUtils
.
isBlank
(
phoneNo
))
{
return
JsonResult
.
buildErrorStateResult
(
"手机号错误"
,
null
);
}
if
(!
ValidationUtil
.
validatePhoneNo
(
phoneNo
))
{
if
(!
ValidationUtil
.
validatePhoneNo
(
phoneNo
))
{
return
JsonResult
.
buildErrorStateResult
(
"手机号格式错误"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"手机号格式错误"
,
null
);
}
}
...
@@ -860,15 +841,7 @@ public class InnerController implements IBaseController {
...
@@ -860,15 +841,7 @@ public class InnerController implements IBaseController {
if
(
StringUtils
.
isBlank
(
name
))
{
if
(
StringUtils
.
isBlank
(
name
))
{
return
JsonResult
.
buildErrorStateResult
(
"用户名异常."
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"用户名异常."
,
null
);
}
}
boolean
isIdCard
;
try
{
isIdCard
=
idCardService
.
isIdCardValid
(
idNo
);
}
catch
(
ParseException
e
)
{
isIdCard
=
false
;
}
if
(!
isIdCard
)
{
return
JsonResult
.
buildErrorStateResult
(
"用户身份证号异常."
,
null
);
}
//地址信息,同时存在provinceCode和address时才校验地址信息
//地址信息,同时存在provinceCode和address时才校验地址信息
if
(
StringUtils
.
isNotEmpty
(
provinceCode
)
&&
StringUtils
.
isNotEmpty
(
address
))
{
if
(
StringUtils
.
isNotEmpty
(
provinceCode
)
&&
StringUtils
.
isNotEmpty
(
address
))
{
if
(!
NumberUtils
.
isDigits
(
provinceCode
))
{
if
(!
NumberUtils
.
isDigits
(
provinceCode
))
{
...
@@ -901,7 +874,7 @@ public class InnerController implements IBaseController {
...
@@ -901,7 +874,7 @@ public class InnerController implements IBaseController {
}
}
user
=
userRegisterService
.
register
(
Long
.
valueOf
(
registeredFrom
),
Long
.
valueOf
(
channelId
),
user
=
userRegisterService
.
register
(
Long
.
valueOf
(
registeredFrom
),
Long
.
valueOf
(
channelId
),
phoneNo
,
name
,
idNo
,
contacts
,
btRegisterChannelId
);
phoneNo
,
name
,
contacts
,
btRegisterChannelId
);
UserRet
userRet
=
new
UserRet
(
user
);
UserRet
userRet
=
new
UserRet
(
user
);
return
JsonResult
.
buildSuccessResult
(
null
,
userRet
);
return
JsonResult
.
buildSuccessResult
(
null
,
userRet
);
}
}
...
@@ -1315,7 +1288,7 @@ public class InnerController implements IBaseController {
...
@@ -1315,7 +1288,7 @@ public class InnerController implements IBaseController {
}
}
@RequestMapping
(
"/delete/session"
)
@RequestMapping
(
"/delete/session"
)
public
JsonResult
deleteSession
(
Long
userId
)
{
public
JsonResult
deleteSession
(
Long
userId
)
{
sessionService
.
deleteByUserId
(
userId
);
sessionService
.
deleteByUserId
(
userId
);
return
JsonResult
.
buildSuccessResult
();
return
JsonResult
.
buildSuccessResult
();
}
}
...
...
src/main/java/cn/quantgroup/xyqb/controller/internal/user/SyncUserController.java
View file @
dac85ae4
...
@@ -3,11 +3,8 @@ package cn.quantgroup.xyqb.controller.internal.user;
...
@@ -3,11 +3,8 @@ package cn.quantgroup.xyqb.controller.internal.user;
import
cn.quantgroup.xyqb.aspect.accessable.IpValidator
;
import
cn.quantgroup.xyqb.aspect.accessable.IpValidator
;
import
cn.quantgroup.xyqb.entity.User
;
import
cn.quantgroup.xyqb.entity.User
;
import
cn.quantgroup.xyqb.entity.UserDetail
;
import
cn.quantgroup.xyqb.entity.UserDetail
;
import
cn.quantgroup.xyqb.model.IdCardInfo
;
import
cn.quantgroup.xyqb.model.IdType
;
import
cn.quantgroup.xyqb.model.JsonResult
;
import
cn.quantgroup.xyqb.model.JsonResult
;
import
cn.quantgroup.xyqb.model.UserModel
;
import
cn.quantgroup.xyqb.model.UserModel
;
import
cn.quantgroup.xyqb.service.auth.IIdCardService
;
import
cn.quantgroup.xyqb.service.user.IUserDetailService
;
import
cn.quantgroup.xyqb.service.user.IUserDetailService
;
import
cn.quantgroup.xyqb.service.user.IUserService
;
import
cn.quantgroup.xyqb.service.user.IUserService
;
import
cn.quantgroup.xyqb.util.ValidationUtil
;
import
cn.quantgroup.xyqb.util.ValidationUtil
;
...
@@ -38,8 +35,7 @@ public class SyncUserController {
...
@@ -38,8 +35,7 @@ public class SyncUserController {
private
IUserService
userService
;
private
IUserService
userService
;
@Autowired
@Autowired
private
IUserDetailService
userDetailService
;
private
IUserDetailService
userDetailService
;
@Autowired
private
IIdCardService
idCardService
;
@RequestMapping
(
"/save_detail"
)
@RequestMapping
(
"/save_detail"
)
public
JsonResult
saveUserDetail
(
String
key
,
String
phoneNo
,
String
idNo
,
public
JsonResult
saveUserDetail
(
String
key
,
String
phoneNo
,
String
idNo
,
...
@@ -55,11 +51,7 @@ public class SyncUserController {
...
@@ -55,11 +51,7 @@ public class SyncUserController {
log
.
error
(
"姓名错误,name:{}"
,
name
);
log
.
error
(
"姓名错误,name:{}"
,
name
);
return
JsonResult
.
buildErrorStateResult
(
"姓名错误"
,
name
);
return
JsonResult
.
buildErrorStateResult
(
"姓名错误"
,
name
);
}
}
IdCardInfo
info
=
idCardService
.
getIdCardInfo
(
idNo
);
if
(
Objects
.
isNull
(
info
)
||
!
info
.
isValid
())
{
log
.
error
(
"身份证号错误,idNo:{}"
,
idNo
);
return
JsonResult
.
buildErrorStateResult
(
"身份证号码错误"
,
idNo
);
}
User
user
=
userService
.
findByPhoneWithCache
(
phoneNo
);
User
user
=
userService
.
findByPhoneWithCache
(
phoneNo
);
if
(
Objects
.
isNull
(
user
))
{
if
(
Objects
.
isNull
(
user
))
{
log
.
error
(
"用户不存在,phoneNo:{}"
,
phoneNo
);
log
.
error
(
"用户不存在,phoneNo:{}"
,
phoneNo
);
...
@@ -73,7 +65,6 @@ public class SyncUserController {
...
@@ -73,7 +65,6 @@ public class SyncUserController {
userDetail
.
setUserId
(
user
.
getId
());
userDetail
.
setUserId
(
user
.
getId
());
userDetail
.
setPhoneNo
(
phoneNo
);
userDetail
.
setPhoneNo
(
phoneNo
);
userDetail
.
setName
(
name
);
userDetail
.
setName
(
name
);
userDetail
.
setGender
(
info
.
getGender
());
userDetail
.
setIsAuthenticated
(
false
);
userDetail
.
setIsAuthenticated
(
false
);
log
.
info
(
"SyncUserController saveUserDetail, userId:{}, phoneNo:{}, name:{}"
,
user
.
getId
(),
phoneNo
,
name
);
log
.
info
(
"SyncUserController saveUserDetail, userId:{}, phoneNo:{}, name:{}"
,
user
.
getId
(),
phoneNo
,
name
);
try
{
try
{
...
...
src/main/java/cn/quantgroup/xyqb/controller/internal/user/center/UserCenterController.java
View file @
dac85ae4
...
@@ -62,9 +62,6 @@ public class UserCenterController {
...
@@ -62,9 +62,6 @@ public class UserCenterController {
@PostMapping
(
"/attach/list"
)
@PostMapping
(
"/attach/list"
)
public
JsonResult
queryUserAttachList
(
@RequestBody
List
<
Long
>
userIds
,
@RequestParam
(
required
=
false
)
Integer
tenantId
)
{
public
JsonResult
queryUserAttachList
(
@RequestBody
List
<
Long
>
userIds
,
@RequestParam
(
required
=
false
)
Integer
tenantId
)
{
//默认羊小咩租户
//默认羊小咩租户
if
(
TenantUtil
.
validationTenantIdIsNullOrZero
(
tenantId
))
{
tenantId
=
TenantUtil
.
TENANT_DEFAULT
;
}
if
(
CollectionUtils
.
isEmpty
(
userIds
))
{
if
(
CollectionUtils
.
isEmpty
(
userIds
))
{
return
JsonResult
.
buildErrorStateResult
(
"用户 ID 不能为空"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"用户 ID 不能为空"
,
null
);
}
}
...
@@ -72,6 +69,11 @@ public class UserCenterController {
...
@@ -72,6 +69,11 @@ public class UserCenterController {
if
(
userIds
.
size
()
>
size
)
{
if
(
userIds
.
size
()
>
size
)
{
return
JsonResult
.
buildErrorStateResult
(
"超出最大条数限制"
+
size
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"超出最大条数限制"
+
size
,
null
);
}
}
if
(
TenantUtil
.
validationTenantIdIsNullOrZero
(
tenantId
))
{
tenantId
=
TenantUtil
.
TENANT_DEFAULT
;
}
List
<
UserAttached
>
userAttachedList
=
userCenterService
.
searchUserAttachedListByUserId
(
userIds
,
tenantId
);
List
<
UserAttached
>
userAttachedList
=
userCenterService
.
searchUserAttachedListByUserId
(
userIds
,
tenantId
);
return
JsonResult
.
buildSuccessResultGeneric
(
userAttachedList
);
return
JsonResult
.
buildSuccessResultGeneric
(
userAttachedList
);
}
}
...
...
src/main/java/cn/quantgroup/xyqb/controller/middleoffice/userdetail/UserDetailController.java
View file @
dac85ae4
...
@@ -3,10 +3,7 @@ package cn.quantgroup.xyqb.controller.middleoffice.userdetail;
...
@@ -3,10 +3,7 @@ package cn.quantgroup.xyqb.controller.middleoffice.userdetail;
import
cn.quantgroup.xyqb.controller.middleoffice.userdetail.req.UserDetailReq
;
import
cn.quantgroup.xyqb.controller.middleoffice.userdetail.req.UserDetailReq
;
import
cn.quantgroup.xyqb.entity.User
;
import
cn.quantgroup.xyqb.entity.User
;
import
cn.quantgroup.xyqb.entity.UserDetail
;
import
cn.quantgroup.xyqb.entity.UserDetail
;
import
cn.quantgroup.xyqb.model.IdCardInfo
;
import
cn.quantgroup.xyqb.model.IdType
;
import
cn.quantgroup.xyqb.model.JsonResult
;
import
cn.quantgroup.xyqb.model.JsonResult
;
import
cn.quantgroup.xyqb.service.auth.IIdCardService
;
import
cn.quantgroup.xyqb.service.user.IUserDetailService
;
import
cn.quantgroup.xyqb.service.user.IUserDetailService
;
import
cn.quantgroup.xyqb.service.user.IUserService
;
import
cn.quantgroup.xyqb.service.user.IUserService
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -29,8 +26,6 @@ public class UserDetailController {
...
@@ -29,8 +26,6 @@ public class UserDetailController {
@Resource
@Resource
private
IUserService
userService
;
private
IUserService
userService
;
@Resource
private
IIdCardService
idCardService
;
/**
/**
* 修改用户实名信息
* 修改用户实名信息
...
@@ -68,13 +63,12 @@ public class UserDetailController {
...
@@ -68,13 +63,12 @@ public class UserDetailController {
return
JsonResult
.
buildSuccessResultGeneric
(
userDetail
);
return
JsonResult
.
buildSuccessResultGeneric
(
userDetail
);
}
}
User
user
=
userService
.
findById
(
userId
);
User
user
=
userService
.
findById
(
userId
);
IdCardInfo
idCardInfo
=
idCardService
.
getIdCardInfo
(
userDetailReq
.
getIdNo
());
userDetail
=
new
UserDetail
();
userDetail
=
new
UserDetail
();
userDetail
.
setUserId
(
userId
);
userDetail
.
setUserId
(
userId
);
userDetail
.
setName
(
userDetailReq
.
getName
());
userDetail
.
setName
(
userDetailReq
.
getName
());
userDetail
.
setPhoneNo
(
user
.
getPhoneNo
());
userDetail
.
setPhoneNo
(
user
.
getPhoneNo
());
userDetail
.
setGender
(
idCardInfo
.
getGender
());
userDetail
.
setGender
(
userDetail
.
getGender
());
userDetail
=
userDetailService
.
saveUserDetail
(
userDetail
);
userDetail
=
userDetailService
.
saveUserDetail
(
userDetail
);
log
.
info
(
"UserDetailController save, userId:{}, phoneNo:{}, name:{}"
,
user
.
getId
(),
user
.
getPhoneNo
(),
userDetailReq
.
getName
());
log
.
info
(
"UserDetailController save, userId:{}, phoneNo:{}, name:{}"
,
user
.
getId
(),
user
.
getPhoneNo
(),
userDetailReq
.
getName
());
return
JsonResult
.
buildSuccessResultGeneric
(
userDetail
);
return
JsonResult
.
buildSuccessResultGeneric
(
userDetail
);
...
...
src/main/java/cn/quantgroup/xyqb/controller/middleoffice/userdetail/req/UserDetailReq.java
View file @
dac85ae4
package
cn
.
quantgroup
.
xyqb
.
controller
.
middleoffice
.
userdetail
.
req
;
package
cn
.
quantgroup
.
xyqb
.
controller
.
middleoffice
.
userdetail
.
req
;
import
cn.quantgroup.xyqb.validator.ChineseName
;
import
cn.quantgroup.xyqb.validator.ChineseName
;
import
cn.quantgroup.xyqb.validator.IdCard
;
import
lombok.Data
;
import
lombok.Data
;
@Data
@Data
public
class
UserDetailReq
{
public
class
UserDetailReq
{
@ChineseName
@ChineseName
private
String
name
;
private
String
name
;
@IdCard
private
String
idNo
;
}
}
src/main/java/cn/quantgroup/xyqb/controller/middleoffice/wx/WxController.java
View file @
dac85ae4
...
@@ -35,56 +35,51 @@ public class WxController {
...
@@ -35,56 +35,51 @@ public class WxController {
private
IUserService
userService
;
private
IUserService
userService
;
/**
/**
* @ yapi http://open.quantgroups.com/project/59/interface/api/693
* @ yapi http://yapi.quantgroups.com/project/17/interface/api/30122
* @param userId
* @param userId
* @return
* @return
* @ yapi http://open.quantgroups.com/project/59/interface/api/693
* @ yapi http://yapi.quantgroups.com/project/17/interface/api/30122
*/
*/
@GetMapping
(
"/userId/{userId}"
)
@GetMapping
(
"/userId/{userId}"
)
public
JsonResult
openId
(
@PathVariable
Long
userId
,
@RequestParam
(
required
=
false
)
Integer
tenantId
)
{
public
JsonResult
openId
(
@PathVariable
Long
userId
,
@RequestParam
(
required
=
false
)
Integer
tenantId
)
{
//默认羊小咩租户
String
openId
=
null
;
if
(
TenantUtil
.
validationTenantIdIsNullOrZero
(
tenantId
))
{
if
(
TenantUtil
.
validationTenantIdIsNullOrZero
(
tenantId
)
||
tenantId
.
equals
(
TenantUtil
.
TENANT_DEFAULT
))
{
tenantId
=
TenantUtil
.
TENANT_DEFAULT
;
}
if
(
tenantId
.
equals
(
TenantUtil
.
TENANT_DEFAULT
))
{
WechatUserInfo
wechatUserInfo
=
wechatService
.
queryByUserId
(
userId
);
WechatUserInfo
wechatUserInfo
=
wechatService
.
queryByUserId
(
userId
);
if
(
wechatUserInfo
=
=
null
)
{
if
(
wechatUserInfo
!
=
null
)
{
return
JsonResult
.
buildSuccessResult
();
openId
=
wechatUserInfo
.
getOpenId
();
}
}
return
JsonResult
.
buildSuccessResultGeneric
(
wechatUserInfo
.
getOpenId
());
}
else
{
}
else
{
User
user
=
userService
.
findById
(
userId
);
User
user
=
userService
.
findById
(
userId
);
if
(
user
==
null
)
{
if
(
user
!=
null
)
{
return
JsonResult
.
buildSuccessResult
();
}
CustomerInfoEntity
tenantCustomerInfo
=
tenantService
.
getTenantCustomerInfo
(
user
,
tenantId
);
CustomerInfoEntity
tenantCustomerInfo
=
tenantService
.
getTenantCustomerInfo
(
user
,
tenantId
);
if
(
tenantCustomerInfo
==
null
)
{
if
(
tenantCustomerInfo
!=
null
)
{
return
JsonResult
.
buildSuccessResult
();
openId
=
tenantCustomerInfo
.
getSourceOpenId
();
}
}
}
return
JsonResult
.
buildSuccessResultGeneric
(
tenantCustomerInfo
.
getSourceOpenId
());
}
}
return
JsonResult
.
buildSuccessResultGeneric
(
openId
);
}
}
/**
/**
* @ yapi http://yapi.quantgroups.com/project/17/interface/api/30122
* @param userId
* @param userId
* @param appName
* @param appName
* @param tenantId
* @param tenantId
* @return
* @return
* @ yapi http://yapi.quantgroups.com/project/17/interface/api/30122
*/
*/
@GetMapping
(
"/userId/{userId}/{appName}"
)
@GetMapping
(
"/userId/{userId}/{appName}"
)
public
JsonResult
openId
(
@PathVariable
Long
userId
,
@PathVariable
String
appName
,
@RequestParam
(
required
=
false
)
Integer
tenantId
)
{
public
JsonResult
openId
(
@PathVariable
Long
userId
,
@PathVariable
String
appName
,
@RequestParam
(
required
=
false
)
Integer
tenantId
)
{
//默认羊小咩租户
//默认羊小咩租户
if
(
TenantUtil
.
validationTenantIdIsNullOrZero
(
tenantId
))
{
if
(
TenantUtil
.
validationTenantIdIsNullOrZero
(
tenantId
))
{
tenantId
=
TenantUtil
.
TENANT_DEFAULT
;
tenantId
=
TenantUtil
.
TENANT_DEFAULT
;
}
}
if
(
tenantId
.
equals
(
TenantUtil
.
TENANT_DEFAULT
))
{
if
(
tenantId
.
equals
(
TenantUtil
.
TENANT_DEFAULT
))
{
WechatUserInfo
wechatUserInfo
=
wechatService
.
queryByUserId
(
userId
,
appName
);
WechatUserInfo
wechatUserInfo
=
wechatService
.
queryByUserId
(
userId
,
appName
);
if
(
wechatUserInfo
==
null
)
{
if
(
wechatUserInfo
==
null
)
{
return
JsonResult
.
buildSuccessResult
();
return
JsonResult
.
buildSuccessResult
();
}
}
return
JsonResult
.
buildSuccessResultGeneric
(
wechatUserInfo
.
getOpenId
());
return
JsonResult
.
buildSuccessResultGeneric
(
wechatUserInfo
.
getOpenId
());
}
else
{
}
else
{
User
user
=
userService
.
findById
(
userId
);
User
user
=
userService
.
findById
(
userId
);
if
(
user
==
null
)
{
if
(
user
==
null
)
{
return
JsonResult
.
buildSuccessResult
();
return
JsonResult
.
buildSuccessResult
();
...
@@ -99,10 +94,10 @@ public class WxController {
...
@@ -99,10 +94,10 @@ public class WxController {
}
}
/**
/**
* @yapi http://open.quantgroups.com/project/59/interface/api/693
* @yapi http://yapi.quantgroups.com/project/17/interface/api/30122
* @param phoneNo
* @param phoneNo
* @return
* @return
* @yapi http://open.quantgroups.com/project/59/interface/api/693
* @yapi http://yapi.quantgroups.com/project/17/interface/api/30122
*/
*/
@GetMapping
(
"/phoneNo/{phoneNo}"
)
@GetMapping
(
"/phoneNo/{phoneNo}"
)
public
JsonResult
openId
(
@PathVariable
String
phoneNo
,
@RequestParam
(
required
=
false
)
Integer
tenantId
)
{
public
JsonResult
openId
(
@PathVariable
String
phoneNo
,
@RequestParam
(
required
=
false
)
Integer
tenantId
)
{
...
@@ -115,7 +110,7 @@ public class WxController {
...
@@ -115,7 +110,7 @@ public class WxController {
return
JsonResult
.
buildSuccessResult
();
return
JsonResult
.
buildSuccessResult
();
}
}
return
JsonResult
.
buildSuccessResultGeneric
(
wechatUserInfo
.
getOpenId
());
return
JsonResult
.
buildSuccessResultGeneric
(
wechatUserInfo
.
getOpenId
());
}
else
{
}
else
{
User
user
=
userService
.
findByPhoneInDb
(
phoneNo
);
User
user
=
userService
.
findByPhoneInDb
(
phoneNo
);
if
(
user
==
null
)
{
if
(
user
==
null
)
{
return
JsonResult
.
buildSuccessResult
();
return
JsonResult
.
buildSuccessResult
();
...
@@ -141,6 +136,7 @@ public class WxController {
...
@@ -141,6 +136,7 @@ public class WxController {
}
}
/**
/**
*
*/
*/
@PostMapping
(
"/v1/getByOpenIdToUserIds"
)
@PostMapping
(
"/v1/getByOpenIdToUserIds"
)
public
JsonResult
getByOpenIdToUserIds
(
@RequestBody
Map
<
String
,
Object
>
params
,
@RequestParam
(
required
=
false
,
defaultValue
=
"wuxi"
)
String
appName
)
{
public
JsonResult
getByOpenIdToUserIds
(
@RequestBody
Map
<
String
,
Object
>
params
,
@RequestParam
(
required
=
false
,
defaultValue
=
"wuxi"
)
String
appName
)
{
...
@@ -150,7 +146,7 @@ public class WxController {
...
@@ -150,7 +146,7 @@ public class WxController {
return
JsonResult
.
buildErrorStateResult
(
"用户Id不能为空"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"用户Id不能为空"
,
null
);
}
}
if
(
userIds
.
size
()
>
500
)
{
if
(
userIds
.
size
()
>
500
)
{
userIds
=
userIds
.
subList
(
0
,
500
);
userIds
=
userIds
.
subList
(
0
,
500
);
}
}
List
<
Long
>
userIdList
=
userIds
.
stream
().
map
(
userId
->
Long
.
parseLong
(
userId
.
toString
())).
collect
(
Collectors
.
toList
());
List
<
Long
>
userIdList
=
userIds
.
stream
().
map
(
userId
->
Long
.
parseLong
(
userId
.
toString
())).
collect
(
Collectors
.
toList
());
...
...
src/main/java/cn/quantgroup/xyqb/controller/modifyphoneno/req/Step1Req.java
View file @
dac85ae4
...
@@ -2,7 +2,6 @@ package cn.quantgroup.xyqb.controller.modifyphoneno.req;
...
@@ -2,7 +2,6 @@ package cn.quantgroup.xyqb.controller.modifyphoneno.req;
import
cn.quantgroup.xyqb.entity.ModifyPhoneNo
;
import
cn.quantgroup.xyqb.entity.ModifyPhoneNo
;
import
cn.quantgroup.xyqb.util.ValidationUtil
;
import
cn.quantgroup.xyqb.util.ValidationUtil
;
import
cn.quantgroup.xyqb.validator.IdCard
;
import
lombok.Data
;
import
lombok.Data
;
import
org.hibernate.validator.constraints.Length
;
import
org.hibernate.validator.constraints.Length
;
import
org.hibernate.validator.constraints.NotBlank
;
import
org.hibernate.validator.constraints.NotBlank
;
...
@@ -34,7 +33,6 @@ public class Step1Req implements Serializable {
...
@@ -34,7 +33,6 @@ public class Step1Req implements Serializable {
*/
*/
//@ApiModelProperty("注册人身份证件号")
//@ApiModelProperty("注册人身份证件号")
@NotBlank
(
message
=
"注册人身份证件号不能为空"
)
@NotBlank
(
message
=
"注册人身份证件号不能为空"
)
@IdCard
private
String
idCard
;
private
String
idCard
;
/**
/**
...
...
src/main/java/cn/quantgroup/xyqb/event/DetailRegisteredEventListener.java
View file @
dac85ae4
...
@@ -2,10 +2,7 @@ package cn.quantgroup.xyqb.event;
...
@@ -2,10 +2,7 @@ package cn.quantgroup.xyqb.event;
import
cn.quantgroup.xyqb.entity.User
;
import
cn.quantgroup.xyqb.entity.User
;
import
cn.quantgroup.xyqb.entity.UserDetail
;
import
cn.quantgroup.xyqb.entity.UserDetail
;
import
cn.quantgroup.xyqb.model.IdCardInfo
;
import
cn.quantgroup.xyqb.model.IdType
;
import
cn.quantgroup.xyqb.model.UserRegisterParam
;
import
cn.quantgroup.xyqb.model.UserRegisterParam
;
import
cn.quantgroup.xyqb.service.auth.IIdCardService
;
import
cn.quantgroup.xyqb.service.user.IUserDetailService
;
import
cn.quantgroup.xyqb.service.user.IUserDetailService
;
import
cn.quantgroup.xyqb.util.ValidationUtil
;
import
cn.quantgroup.xyqb.util.ValidationUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -19,8 +16,7 @@ import javax.annotation.Resource;
...
@@ -19,8 +16,7 @@ import javax.annotation.Resource;
@Component
@Component
public
class
DetailRegisteredEventListener
implements
ApplicationListener
<
RegisterEvent
>
{
public
class
DetailRegisteredEventListener
implements
ApplicationListener
<
RegisterEvent
>
{
@Resource
private
IIdCardService
idCardService
;
@Resource
@Resource
private
IUserDetailService
userDetailService
;
private
IUserDetailService
userDetailService
;
...
@@ -29,23 +25,16 @@ public class DetailRegisteredEventListener implements ApplicationListener<Regist
...
@@ -29,23 +25,16 @@ public class DetailRegisteredEventListener implements ApplicationListener<Regist
UserRegisterParam
userRegisterParam
=
event
.
getUserRegisterParam
();
UserRegisterParam
userRegisterParam
=
event
.
getUserRegisterParam
();
User
user
=
userRegisterParam
.
getUser
();
User
user
=
userRegisterParam
.
getUser
();
if
(
StringUtils
.
isAnyBlank
(
userRegisterParam
.
get
IdNo
(),
userRegisterParam
.
get
Name
())
||
if
(
StringUtils
.
isAnyBlank
(
userRegisterParam
.
getName
())
||
!
ValidationUtil
.
validateChinese
(
userRegisterParam
.
getName
()))
{
!
ValidationUtil
.
validateChinese
(
userRegisterParam
.
getName
()))
{
return
;
return
;
}
}
String
phoneNo
=
userRegisterParam
.
getPhoneNo
();
String
phoneNo
=
userRegisterParam
.
getPhoneNo
();
String
name
=
userRegisterParam
.
getName
();
String
name
=
userRegisterParam
.
getName
();
String
idNo
=
userRegisterParam
.
getIdNo
();
IdCardInfo
cardInfo
=
idCardService
.
getIdCardInfo
(
idNo
);
if
(
cardInfo
==
null
||
!
cardInfo
.
isValid
())
{
log
.
info
(
"用户身份证号验证失败,userId:{},idNo:{}"
,
user
.
getId
(),
idNo
);
return
;
}
UserDetail
userDetail
=
new
UserDetail
();
UserDetail
userDetail
=
new
UserDetail
();
userDetail
.
setPhoneNo
(
phoneNo
);
userDetail
.
setPhoneNo
(
phoneNo
);
userDetail
.
setName
(
name
);
userDetail
.
setName
(
name
);
userDetail
.
setUserId
(
user
.
getId
());
userDetail
.
setUserId
(
user
.
getId
());
userDetail
.
setGender
(
cardInfo
.
getGender
());
log
.
info
(
"DetailRegisteredEventListener saveUserDetail, userId:{}, phoneNo:{}, name:{}"
,
user
.
getId
(),
phoneNo
,
name
);
log
.
info
(
"DetailRegisteredEventListener saveUserDetail, userId:{}, phoneNo:{}, name:{}"
,
user
.
getId
(),
phoneNo
,
name
);
userDetailService
.
saveUserDetail
(
userDetail
);
userDetailService
.
saveUserDetail
(
userDetail
);
}
}
...
...
src/main/java/cn/quantgroup/xyqb/event/LkbRegisteredEventListener.java
View file @
dac85ae4
...
@@ -28,7 +28,7 @@ public class LkbRegisteredEventListener implements ApplicationListener<RegisterE
...
@@ -28,7 +28,7 @@ public class LkbRegisteredEventListener implements ApplicationListener<RegisterE
User
user
=
userRegisterParam
.
getUser
();
User
user
=
userRegisterParam
.
getUser
();
String
uuid
=
user
.
getUuid
();
String
uuid
=
user
.
getUuid
();
boolean
pushResult
=
lkbUserService
.
pushUser
(
uuid
,
userRegisterParam
.
getPhoneNo
(),
boolean
pushResult
=
lkbUserService
.
pushUser
(
uuid
,
userRegisterParam
.
getPhoneNo
(),
userRegisterParam
.
getName
()
,
userRegisterParam
.
getIdNo
()
);
userRegisterParam
.
getName
());
if
(!
pushResult
)
{
if
(!
pushResult
)
{
log
.
error
(
"[userRegisterHandler][baseUserRegisterHandler]同步用户至Lkb出错,userRegisterParam:{}"
,
JsonUtil
.
toJson
(
userRegisterParam
));
log
.
error
(
"[userRegisterHandler][baseUserRegisterHandler]同步用户至Lkb出错,userRegisterParam:{}"
,
JsonUtil
.
toJson
(
userRegisterParam
));
throw
new
PushUserToLkbException
(
"同步用户至Lkb出错"
);
throw
new
PushUserToLkbException
(
"同步用户至Lkb出错"
);
...
...
src/main/java/cn/quantgroup/xyqb/model/UserRegisterParam.java
View file @
dac85ae4
...
@@ -21,7 +21,6 @@ public class UserRegisterParam {
...
@@ -21,7 +21,6 @@ public class UserRegisterParam {
private
Long
registerFrom
;
// 注册渠道
private
Long
registerFrom
;
// 注册渠道
private
String
phoneNo
;
// 手机号
private
String
phoneNo
;
// 手机号
private
String
password
;
// 密码
private
String
password
;
// 密码
private
String
idNo
;
// 身份证号
private
String
name
;
// 姓名
private
String
name
;
// 姓名
private
Long
channelId
;
// 业务渠道
private
Long
channelId
;
// 业务渠道
private
Long
btRegisterChannelId
;
// 白条渠道
private
Long
btRegisterChannelId
;
// 白条渠道
...
...
src/main/java/cn/quantgroup/xyqb/service/auth/IIdCardService.java
deleted
100644 → 0
View file @
5b8ef268
package
cn
.
quantgroup
.
xyqb
.
service
.
auth
;
import
cn.quantgroup.xyqb.model.IdCardInfo
;
import
java.text.ParseException
;
/**
* Created by Miraculous on 15/7/10.
*/
public
interface
IIdCardService
{
boolean
isIdCardValid
(
String
idCard
)
throws
ParseException
;
IdCardInfo
getIdCardInfo
(
String
idCardStr
);
// 当身份证不合法,直接抛出异常。
IdCardInfo
getIdCardInfoWithExceptions
(
String
idCardStr
)
throws
ParseException
;
}
src/main/java/cn/quantgroup/xyqb/service/auth/impl/IdCardServiceImpl.java
deleted
100644 → 0
View file @
5b8ef268
package
cn
.
quantgroup
.
xyqb
.
service
.
auth
.
impl
;
import
cn.quantgroup.xyqb.Constants
;
import
cn.quantgroup.xyqb.exception.IdCardException
;
import
cn.quantgroup.xyqb.model.Gender
;
import
cn.quantgroup.xyqb.model.IdCardInfo
;
import
cn.quantgroup.xyqb.service.auth.IIdCardService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.PostConstruct
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
/**
* Created by Miraculous on 15/7/10.
*/
@Slf4j
@Service
public
class
IdCardServiceImpl
implements
IIdCardService
{
private
String
[]
validCodes
=
{
"1"
,
"0"
,
"x"
,
"9"
,
"8"
,
"7"
,
"6"
,
"5"
,
"4"
,
"3"
,
"2"
};
private
Map
<
String
,
String
>
areaCodes
;
private
int
[]
wi
=
{
7
,
9
,
10
,
5
,
8
,
4
,
2
,
1
,
6
,
3
,
7
,
9
,
10
,
5
,
8
,
4
,
2
};
private
Pattern
datePattern
=
Pattern
.
compile
(
"^((\\d{2}(([02468][048])|([13579][26]))[\\-\\/\\s]?((((0?[13578])|(1[02]))"
+
"[\\-/\\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\\-/\\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\\-/\\s]?"
+
"((0?[1-9])|([1-2][0-9])))))|(\\d{2}(([02468][1235679])|([13579][01345789]))[\\-/\\s]?((((0?[13578])|(1[02]))[\\-/\\s]?"
+
"((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\\-/\\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\\-/\\s]?((0?[1-9])|(1[0-9])|(2[0-8]))))))"
+
"(\\s(((0?[0-9])|([1-2][0-3]))\\:([0-5]?[0-9])((\\s)|(:([0-5]?[0-9])))))?$"
);
@PostConstruct
private
void
init
()
{
areaCodes
=
new
HashMap
<>();
areaCodes
.
put
(
"11"
,
"北京"
);
areaCodes
.
put
(
"12"
,
"天津"
);
areaCodes
.
put
(
"13"
,
"河北"
);
areaCodes
.
put
(
"14"
,
"山西"
);
areaCodes
.
put
(
"15"
,
"内蒙古"
);
areaCodes
.
put
(
"21"
,
"辽宁"
);
areaCodes
.
put
(
"22"
,
"吉林"
);
areaCodes
.
put
(
"23"
,
"黑龙江"
);
areaCodes
.
put
(
"31"
,
"上海"
);
areaCodes
.
put
(
"32"
,
"江苏"
);
areaCodes
.
put
(
"33"
,
"浙江"
);
areaCodes
.
put
(
"34"
,
"安徽"
);
areaCodes
.
put
(
"35"
,
"福建"
);
areaCodes
.
put
(
"36"
,
"江西"
);
areaCodes
.
put
(
"37"
,
"山东"
);
areaCodes
.
put
(
"41"
,
"河南"
);
areaCodes
.
put
(
"42"
,
"湖北"
);
areaCodes
.
put
(
"43"
,
"湖南"
);
areaCodes
.
put
(
"44"
,
"广东"
);
areaCodes
.
put
(
"45"
,
"广西"
);
areaCodes
.
put
(
"46"
,
"海南"
);
areaCodes
.
put
(
"50"
,
"重庆"
);
areaCodes
.
put
(
"51"
,
"四川"
);
areaCodes
.
put
(
"52"
,
"贵州"
);
areaCodes
.
put
(
"53"
,
"云南"
);
areaCodes
.
put
(
"54"
,
"西藏"
);
areaCodes
.
put
(
"61"
,
"陕西"
);
areaCodes
.
put
(
"62"
,
"甘肃"
);
areaCodes
.
put
(
"63"
,
"青海"
);
areaCodes
.
put
(
"64"
,
"宁夏"
);
areaCodes
.
put
(
"65"
,
"新疆"
);
areaCodes
.
put
(
"71"
,
"台湾"
);
areaCodes
.
put
(
"81"
,
"香港"
);
areaCodes
.
put
(
"82"
,
"澳门"
);
areaCodes
.
put
(
"91"
,
"国外"
);
}
@Override
public
boolean
isIdCardValid
(
String
idCardStr
)
throws
ParseException
{
if
(
idCardStr
==
null
)
{
return
false
;
}
String
actualId
;
if
(
idCardStr
.
length
()
==
Constants
.
ID_NO_STANDARD_LENGTH
)
{
actualId
=
idCardStr
.
substring
(
0
,
Constants
.
ID_NO_CHECK_LENGTH
);
}
else
if
(
idCardStr
.
length
()
==
Constants
.
ID_NO_OLD_LENGTH
)
{
actualId
=
idCardStr
.
substring
(
0
,
6
)
+
"19"
+
idCardStr
.
substring
(
6
,
Constants
.
ID_NO_OLD_LENGTH
);
}
else
{
return
false
;
}
if
(!
StringUtils
.
isNumeric
(
actualId
))
{
return
false
;
}
String
yearStr
=
actualId
.
substring
(
6
,
10
);
String
monthStr
=
actualId
.
substring
(
10
,
12
);
String
dayStr
=
actualId
.
substring
(
12
,
14
);
int
year
=
Integer
.
parseInt
(
yearStr
);
int
month
=
Integer
.
parseInt
(
monthStr
);
int
day
=
Integer
.
parseInt
(
dayStr
);
String
dateStr
=
yearStr
+
"-"
+
monthStr
+
"-"
+
dayStr
;
Matcher
matcher
=
datePattern
.
matcher
(
dateStr
);
if
(!
matcher
.
matches
())
{
return
false
;
}
GregorianCalendar
gc
=
new
GregorianCalendar
();
Date
date
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
parse
(
dateStr
);
if
(
gc
.
get
(
Calendar
.
YEAR
)
-
year
>
Constants
.
AGE_MAX
||
gc
.
getTime
().
getTime
()
-
date
.
getTime
()
<
0
)
{
return
false
;
}
if
(
month
<
Constants
.
MONTH_NO_MIN
||
month
>
Constants
.
MONTH_NO_MAX
)
{
return
false
;
}
if
(
day
<
Constants
.
DAY_NO_MIN
||
day
>
Constants
.
DAY_NO_MAX
)
{
return
false
;
}
String
areaCode
=
actualId
.
substring
(
0
,
Constants
.
ID_NO_AREA_CODE_LENGTH
);
if
(!
areaCodes
.
containsKey
(
areaCode
))
{
return
false
;
}
// 校验码
int
acurateCode
=
0
;
for
(
int
i
=
0
;
i
<
Constants
.
ID_NO_CHECK_LENGTH
;
++
i
)
{
acurateCode
+=
((
actualId
.
charAt
(
i
)
-
'0'
)
*
wi
[
i
]);
}
actualId
+=
validCodes
[
acurateCode
%
Constants
.
ID_NO_CHECK_MASK
];
return
idCardStr
.
length
()
!=
Constants
.
ID_NO_STANDARD_LENGTH
||
actualId
.
equalsIgnoreCase
(
idCardStr
);
}
@Override
public
IdCardInfo
getIdCardInfo
(
String
idCardStr
){
IdCardInfo
cardInfo
=
new
IdCardInfo
();
cardInfo
.
setIsValid
(
false
);
if
(
idCardStr
==
null
)
{
return
cardInfo
;
}
String
actualId
;
String
lastChar
;
if
(
idCardStr
.
length
()
==
Constants
.
ID_NO_STANDARD_LENGTH
)
{
actualId
=
idCardStr
.
substring
(
0
,
Constants
.
ID_NO_CHECK_LENGTH
);
lastChar
=
idCardStr
.
substring
(
16
,
Constants
.
ID_NO_CHECK_LENGTH
).
toLowerCase
();
}
else
if
(
idCardStr
.
length
()
==
Constants
.
ID_NO_OLD_LENGTH
)
{
actualId
=
idCardStr
.
substring
(
0
,
6
)
+
"19"
+
idCardStr
.
substring
(
6
,
Constants
.
ID_NO_OLD_LENGTH
);
lastChar
=
idCardStr
.
substring
(
13
,
14
).
toLowerCase
();
}
else
{
return
cardInfo
;
}
if
(!
StringUtils
.
isNumeric
(
actualId
))
{
return
cardInfo
;
}
String
yearStr
=
actualId
.
substring
(
6
,
10
);
String
monthStr
=
actualId
.
substring
(
10
,
12
);
String
dayStr
=
actualId
.
substring
(
12
,
14
);
int
year
=
Integer
.
parseInt
(
yearStr
);
int
month
=
Integer
.
parseInt
(
monthStr
);
int
day
=
Integer
.
parseInt
(
dayStr
);
String
dateStr
=
yearStr
+
"-"
+
monthStr
+
"-"
+
dayStr
;
Matcher
matcher
=
datePattern
.
matcher
(
dateStr
);
if
(!
matcher
.
matches
())
{
return
cardInfo
;
}
GregorianCalendar
gc
=
new
GregorianCalendar
();
Date
date
;
try
{
date
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
parse
(
dateStr
);
}
catch
(
ParseException
e
)
{
//这里根本不会出错好么.万一哪个脑抽改了上面的, 就出错了
log
.
error
(
"解析日期异常..."
,
e
);
return
null
;
}
if
(
gc
.
get
(
Calendar
.
YEAR
)
-
year
>
Constants
.
AGE_MAX
||
gc
.
getTime
().
getTime
()
-
date
.
getTime
()
<
0
)
{
return
cardInfo
;
}
if
(
month
<
Constants
.
MONTH_NO_MIN
||
month
>
Constants
.
MONTH_NO_MAX
)
{
return
cardInfo
;
}
if
(
day
<
Constants
.
DAY_NO_MIN
||
day
>
Constants
.
DAY_NO_MAX
)
{
return
cardInfo
;
}
String
areaCode
=
actualId
.
substring
(
0
,
Constants
.
ID_NO_AREA_CODE_LENGTH
);
if
(!
areaCodes
.
containsKey
(
areaCode
))
{
return
cardInfo
;
}
// 校验码
int
checkCode
=
0
;
for
(
int
i
=
0
;
i
<
Constants
.
ID_NO_CHECK_LENGTH
;
++
i
)
{
checkCode
+=
((
actualId
.
charAt
(
i
)
-
'0'
)
*
wi
[
i
]);
}
actualId
+=
validCodes
[
checkCode
%
Constants
.
ID_NO_CHECK_MASK
];
if
(
idCardStr
.
length
()
==
Constants
.
ID_NO_STANDARD_LENGTH
)
{
if
(!
actualId
.
equalsIgnoreCase
(
idCardStr
))
{
return
cardInfo
;
}
}
cardInfo
.
setIsValid
(
true
);
// 判断男女
if
(
Integer
.
parseInt
(
lastChar
)
%
Constants
.
GENDER_MASK
==
0
)
{
cardInfo
.
setGender
(
Gender
.
FEMALE
);
}
else
{
cardInfo
.
setGender
(
Gender
.
MALE
);
}
cardInfo
.
setIdNo
(
idCardStr
);
cardInfo
.
setProvince
(
areaCodes
.
get
(
areaCode
));
cardInfo
.
setBirthDate
(
date
);
return
cardInfo
;
}
@Override
public
IdCardInfo
getIdCardInfoWithExceptions
(
String
idCardStr
)
throws
ParseException
{
if
(
idCardStr
==
null
)
{
throw
new
IdCardException
(
"身份证号码不能为空"
);
}
String
actualId
;
String
lastValue
;
if
(
idCardStr
.
length
()
==
Constants
.
ID_NO_STANDARD_LENGTH
)
{
actualId
=
idCardStr
.
substring
(
0
,
Constants
.
ID_NO_CHECK_LENGTH
);
lastValue
=
idCardStr
.
substring
(
16
,
Constants
.
ID_NO_CHECK_LENGTH
).
toLowerCase
();
}
else
if
(
idCardStr
.
length
()
==
Constants
.
ID_NO_OLD_LENGTH
)
{
actualId
=
idCardStr
.
substring
(
0
,
6
)
+
"19"
+
idCardStr
.
substring
(
6
,
Constants
.
ID_NO_OLD_LENGTH
);
lastValue
=
idCardStr
.
substring
(
13
,
14
).
toLowerCase
();
}
else
{
throw
new
IdCardException
(
"身份证号码必须为18位或15位"
);
}
if
(!
StringUtils
.
isNumeric
(
actualId
))
{
throw
new
IdCardException
(
"身份证格式不正确"
);
}
String
yearStr
=
actualId
.
substring
(
6
,
10
);
String
monthStr
=
actualId
.
substring
(
10
,
Constants
.
MONTH_NO_MAX
);
String
dayStr
=
actualId
.
substring
(
12
,
14
);
int
year
=
Integer
.
parseInt
(
yearStr
);
int
month
=
Integer
.
parseInt
(
monthStr
);
int
day
=
Integer
.
parseInt
(
dayStr
);
String
dateStr
=
yearStr
+
"-"
+
monthStr
+
"-"
+
dayStr
;
Matcher
matcher
=
datePattern
.
matcher
(
dateStr
);
if
(!
matcher
.
matches
())
{
throw
new
IdCardException
(
"身份证出生日期不正确"
);
}
GregorianCalendar
gc
=
new
GregorianCalendar
();
Date
date
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
parse
(
dateStr
);
if
(
gc
.
get
(
Calendar
.
YEAR
)
-
year
>
Constants
.
AGE_MAX
||
gc
.
getTime
().
getTime
()
-
date
.
getTime
()
<
0
)
{
throw
new
IdCardException
(
"身份证出生年份不正确"
);
}
if
(
month
<
Constants
.
MONTH_NO_MIN
||
month
>
Constants
.
MONTH_NO_MAX
)
{
throw
new
IdCardException
(
"身份证出生月份不正确"
);
}
if
(
day
<
Constants
.
DAY_NO_MIN
||
day
>
Constants
.
DAY_NO_MAX
)
{
throw
new
IdCardException
(
"身份证出生日期不正确"
);
}
String
areaCode
=
actualId
.
substring
(
0
,
Constants
.
ID_NO_AREA_CODE_LENGTH
);
if
(!
areaCodes
.
containsKey
(
areaCode
))
{
throw
new
IdCardException
(
"身份证省份不正确"
);
}
// 校验码
int
checkCode
=
0
;
for
(
int
i
=
0
;
i
<
Constants
.
ID_NO_CHECK_LENGTH
;
++
i
)
{
checkCode
+=
((
actualId
.
charAt
(
i
)
-
'0'
)
*
wi
[
i
]);
}
actualId
+=
validCodes
[
checkCode
%
Constants
.
ID_NO_CHECK_MASK
];
if
(
idCardStr
.
length
()
==
Constants
.
ID_NO_STANDARD_LENGTH
)
{
if
(!
actualId
.
equalsIgnoreCase
(
idCardStr
))
{
throw
new
IdCardException
(
"身份证校验不正确"
);
}
}
IdCardInfo
cardInfo
=
new
IdCardInfo
();
cardInfo
.
setIsValid
(
true
);
// 判断男女
if
(
Integer
.
parseInt
(
lastValue
)
%
Constants
.
GENDER_MASK
==
0
)
{
cardInfo
.
setGender
(
Gender
.
FEMALE
);
}
else
{
cardInfo
.
setGender
(
Gender
.
MALE
);
}
cardInfo
.
setIdNo
(
idCardStr
);
cardInfo
.
setProvince
(
areaCodes
.
get
(
areaCode
));
cardInfo
.
setBirthDate
(
date
);
return
cardInfo
;
}
}
src/main/java/cn/quantgroup/xyqb/service/captcha/GeetestLib.java
View file @
dac85ae4
...
@@ -2,10 +2,12 @@ package cn.quantgroup.xyqb.service.captcha;
...
@@ -2,10 +2,12 @@ package cn.quantgroup.xyqb.service.captcha;
import
cn.quantgroup.xyqb.Constants
;
import
cn.quantgroup.xyqb.Constants
;
import
cn.quantgroup.xyqb.util.encrypt.Md5Util
;
import
cn.quantgroup.xyqb.util.encrypt.Md5Util
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONException
;
import
com.alibaba.fastjson.JSONObject
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.http.HttpStatus
;
import
org.apache.http.HttpStatus
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
...
@@ -162,7 +164,7 @@ public class GeetestLib {
...
@@ -162,7 +164,7 @@ public class GeetestLib {
}
}
gtlog
(
"result:"
+
result_str
);
gtlog
(
"result:"
+
result_str
);
JSONObject
jsonObject
=
new
JSON
Object
(
result_str
);
JSONObject
jsonObject
=
JSON
.
parse
Object
(
result_str
);
String
return_challenge
=
jsonObject
.
getString
(
"challenge"
);
String
return_challenge
=
jsonObject
.
getString
(
"challenge"
);
this
.
challenge
=
return_challenge
;
this
.
challenge
=
return_challenge
;
...
@@ -295,7 +297,7 @@ public class GeetestLib {
...
@@ -295,7 +297,7 @@ public class GeetestLib {
}
}
String
return_seccode
=
""
;
String
return_seccode
=
""
;
try
{
try
{
JSONObject
return_map
=
new
JSON
Object
(
response
);
JSONObject
return_map
=
JSONObject
.
parse
Object
(
response
);
return_seccode
=
return_map
.
getString
(
"seccode"
);
return_seccode
=
return_map
.
getString
(
"seccode"
);
gtlog
(
"md5: "
+
Md5Util
.
build
(
return_seccode
));
gtlog
(
"md5: "
+
Md5Util
.
build
(
return_seccode
));
if
(
return_seccode
.
equals
(
Md5Util
.
build
(
seccode
)))
{
if
(
return_seccode
.
equals
(
Md5Util
.
build
(
seccode
)))
{
...
...
src/main/java/cn/quantgroup/xyqb/service/register/IUserRegisterService.java
View file @
dac85ae4
...
@@ -17,15 +17,13 @@ public interface IUserRegisterService {
...
@@ -17,15 +17,13 @@ public interface IUserRegisterService {
*
*
* @param registerFrom
* @param registerFrom
* @param phoneNo
* @param phoneNo
* @param idNo
* @param name
* @param name
* @param channelId
* @param channelId
* @param btRegisterChannelId
* @param btRegisterChannelId
* @return
* @return
*/
*/
User
register
(
Long
registerFrom
,
String
phoneNo
,
String
idNo
,
String
name
,
Long
channelId
,
Long
btRegisterChannelId
);
User
register
(
Long
registerFrom
,
String
phoneNo
,
String
name
,
Long
channelId
,
Long
btRegisterChannelId
);
User
register
(
Long
registerFrom
,
String
phoneNo
,
String
idNo
,
String
name
,
Long
channelId
,
Long
btRegisterChannelId
,
Integer
tenantId
);
User
register
(
Long
registerFrom
,
String
phoneNo
,
String
name
,
Long
channelId
,
Long
btRegisterChannelId
,
Integer
tenantId
);
User
register
(
Long
registerFrom
,
String
phoneNo
,
String
name
,
Long
channelId
,
Long
btRegisterChannelId
,
Integer
tenantId
);
...
@@ -68,7 +66,7 @@ public interface IUserRegisterService {
...
@@ -68,7 +66,7 @@ public interface IUserRegisterService {
* @author jinsong.zhu 2018年05月16日14:22:13
* @author jinsong.zhu 2018年05月16日14:22:13
* 处理对address和contact的非必要兼容
* 处理对address和contact的非必要兼容
*/
*/
User
register
(
Long
registeredFrom
,
Long
channelId
,
String
phoneNo
,
String
name
,
String
idNo
,
String
contacts
,
Long
btRegisterChannelId
);
User
register
(
Long
registeredFrom
,
Long
channelId
,
String
phoneNo
,
String
name
,
String
contacts
,
Long
btRegisterChannelId
);
}
}
src/main/java/cn/quantgroup/xyqb/service/register/impl/UserRegisterServiceImpl.java
View file @
dac85ae4
package
cn
.
quantgroup
.
xyqb
.
service
.
register
.
impl
;
package
cn
.
quantgroup
.
xyqb
.
service
.
register
.
impl
;
import
cn.quantgroup.xyqb.constant.enums.RecordType
;
import
cn.quantgroup.xyqb.Constants
;
import
cn.quantgroup.xyqb.Constants
;
import
cn.quantgroup.xyqb.constant.enums.RecordType
;
import
cn.quantgroup.xyqb.entity.User
;
import
cn.quantgroup.xyqb.entity.User
;
import
cn.quantgroup.xyqb.entity.UserDeregisterRecord
;
import
cn.quantgroup.xyqb.entity.UserDeregisterRecord
;
import
cn.quantgroup.xyqb.event.RegisterEvent
;
import
cn.quantgroup.xyqb.event.RegisterEvent
;
...
@@ -54,14 +54,7 @@ public class UserRegisterServiceImpl implements IUserRegisterService {
...
@@ -54,14 +54,7 @@ public class UserRegisterServiceImpl implements IUserRegisterService {
/* 用户销户检查 */
/* 用户销户检查 */
deregisterCheck
(
phoneNo
);
deregisterCheck
(
phoneNo
);
UserRegisterParam
userRegisterParam
=
UserRegisterParam
.
builder
()
UserRegisterParam
userRegisterParam
=
UserRegisterParam
.
builder
().
registerFrom
(
registerFrom
).
phoneNo
(
phoneNo
).
channelId
(
registerFrom
).
sendSuccessSms
(
true
).
sendAppSms
(
true
).
sendSuccessMq
(
true
).
build
();
.
registerFrom
(
registerFrom
)
.
phoneNo
(
phoneNo
)
.
channelId
(
registerFrom
)
.
sendSuccessSms
(
true
)
.
sendAppSms
(
true
)
.
sendSuccessMq
(
true
)
.
build
();
User
user
=
saveUser
(
userRegisterParam
);
User
user
=
saveUser
(
userRegisterParam
);
applicationEventPublisher
.
publishEvent
(
new
RegisterEvent
(
this
,
userRegisterParam
));
applicationEventPublisher
.
publishEvent
(
new
RegisterEvent
(
this
,
userRegisterParam
));
return
user
;
return
user
;
...
@@ -73,14 +66,7 @@ public class UserRegisterServiceImpl implements IUserRegisterService {
...
@@ -73,14 +66,7 @@ public class UserRegisterServiceImpl implements IUserRegisterService {
deregisterCheck
(
phoneNo
);
deregisterCheck
(
phoneNo
);
UserRegisterParam
userRegisterParam
=
UserRegisterParam
.
builder
()
UserRegisterParam
userRegisterParam
=
UserRegisterParam
.
builder
().
registerFrom
(
registerFrom
).
phoneNo
(
phoneNo
).
channelId
(
registerFrom
).
sendSuccessSms
(
true
).
sendAppSms
(
true
).
sendSuccessMq
(
true
).
build
();
.
registerFrom
(
registerFrom
)
.
phoneNo
(
phoneNo
)
.
channelId
(
registerFrom
)
.
sendSuccessSms
(
true
)
.
sendAppSms
(
true
)
.
sendSuccessMq
(
true
)
.
build
();
User
user
=
saveUser
(
userRegisterParam
);
User
user
=
saveUser
(
userRegisterParam
);
if
(
tenantId
==
null
||
tenantId
.
equals
(
TenantUtil
.
TENANT_DEFAULT
))
{
if
(
tenantId
==
null
||
tenantId
.
equals
(
TenantUtil
.
TENANT_DEFAULT
))
{
applicationEventPublisher
.
publishEvent
(
new
RegisterEvent
(
this
,
userRegisterParam
));
applicationEventPublisher
.
publishEvent
(
new
RegisterEvent
(
this
,
userRegisterParam
));
...
@@ -90,49 +76,16 @@ public class UserRegisterServiceImpl implements IUserRegisterService {
...
@@ -90,49 +76,16 @@ public class UserRegisterServiceImpl implements IUserRegisterService {
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
@Override
public
User
register
(
Long
registerFrom
,
String
phoneNo
,
String
idNo
,
String
name
,
Long
channelId
,
Long
btRegisterChannelId
)
{
public
User
register
(
Long
registerFrom
,
String
phoneNo
,
String
name
,
Long
channelId
,
Long
btRegisterChannelId
)
{
deregisterCheck
(
phoneNo
);
deregisterCheck
(
phoneNo
);
UserRegisterParam
userRegisterParam
=
UserRegisterParam
.
builder
()
UserRegisterParam
userRegisterParam
=
UserRegisterParam
.
builder
().
registerFrom
(
registerFrom
).
phoneNo
(
phoneNo
).
name
(
name
).
channelId
(
channelId
).
btRegisterChannelId
(
btRegisterChannelId
).
sendSuccessSms
(
true
).
sendAppSms
(
true
).
sendSuccessMq
(
true
).
build
();
.
registerFrom
(
registerFrom
)
.
phoneNo
(
phoneNo
)
.
idNo
(
idNo
)
.
name
(
name
)
.
channelId
(
channelId
)
.
btRegisterChannelId
(
btRegisterChannelId
)
.
sendSuccessSms
(
true
)
.
sendAppSms
(
true
)
.
sendSuccessMq
(
true
)
.
build
();
User
user
=
saveUser
(
userRegisterParam
);
User
user
=
saveUser
(
userRegisterParam
);
applicationEventPublisher
.
publishEvent
(
new
RegisterEvent
(
this
,
userRegisterParam
));
applicationEventPublisher
.
publishEvent
(
new
RegisterEvent
(
this
,
userRegisterParam
));
return
user
;
return
user
;
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
User
register
(
Long
registerFrom
,
String
phoneNo
,
String
idNo
,
String
name
,
Long
channelId
,
Long
btRegisterChannelId
,
Integer
tenantId
)
{
deregisterCheck
(
phoneNo
);
UserRegisterParam
userRegisterParam
=
UserRegisterParam
.
builder
()
.
registerFrom
(
registerFrom
)
.
phoneNo
(
phoneNo
)
.
idNo
(
idNo
)
.
name
(
name
)
.
channelId
(
channelId
)
.
btRegisterChannelId
(
btRegisterChannelId
)
.
sendSuccessSms
(
true
)
.
sendAppSms
(
true
)
.
sendSuccessMq
(
true
)
.
build
();
User
user
=
saveUser
(
userRegisterParam
);
if
(
tenantId
==
null
||
tenantId
.
equals
(
TenantUtil
.
TENANT_DEFAULT
))
{
applicationEventPublisher
.
publishEvent
(
new
RegisterEvent
(
this
,
userRegisterParam
));
}
return
user
;
}
private
User
saveUser
(
UserRegisterParam
userRegisterParam
)
{
private
User
saveUser
(
UserRegisterParam
userRegisterParam
)
{
String
uuid
=
UUID
.
randomUUID
().
toString
();
String
uuid
=
UUID
.
randomUUID
().
toString
();
...
@@ -176,16 +129,7 @@ public class UserRegisterServiceImpl implements IUserRegisterService {
...
@@ -176,16 +129,7 @@ public class UserRegisterServiceImpl implements IUserRegisterService {
deregisterCheck
(
phoneNo
);
deregisterCheck
(
phoneNo
);
UserRegisterParam
userRegisterParam
=
UserRegisterParam
.
builder
()
UserRegisterParam
userRegisterParam
=
UserRegisterParam
.
builder
().
registerFrom
(
registerFrom
).
phoneNo
(
phoneNo
).
password
(
password
).
channelId
(
channelId
).
btRegisterChannelId
(
btRegisterChannelId
).
dimension
(
dimension
).
sendSuccessSms
(
true
).
sendAppSms
(
true
).
sendSuccessMq
(
true
).
build
();
.
registerFrom
(
registerFrom
)
.
phoneNo
(
phoneNo
).
password
(
password
)
.
channelId
(
channelId
)
.
btRegisterChannelId
(
btRegisterChannelId
)
.
dimension
(
dimension
)
.
sendSuccessSms
(
true
)
.
sendAppSms
(
true
)
.
sendSuccessMq
(
true
)
.
build
();
User
user
=
saveUser
(
userRegisterParam
);
User
user
=
saveUser
(
userRegisterParam
);
applicationEventPublisher
.
publishEvent
(
new
RegisterEvent
(
this
,
userRegisterParam
));
applicationEventPublisher
.
publishEvent
(
new
RegisterEvent
(
this
,
userRegisterParam
));
return
user
!=
null
;
return
user
!=
null
;
...
@@ -197,16 +141,7 @@ public class UserRegisterServiceImpl implements IUserRegisterService {
...
@@ -197,16 +141,7 @@ public class UserRegisterServiceImpl implements IUserRegisterService {
deregisterCheck
(
phoneNo
);
deregisterCheck
(
phoneNo
);
UserRegisterParam
userRegisterParam
=
UserRegisterParam
.
builder
()
UserRegisterParam
userRegisterParam
=
UserRegisterParam
.
builder
().
registerFrom
(
registerFrom
).
phoneNo
(
phoneNo
).
channelId
(
channelId
).
btRegisterChannelId
(
btRegisterChannelId
).
dimension
(
dimension
).
sendSuccessSms
(
true
).
sendAppSms
(
true
).
sendSuccessMq
(
true
).
build
();
.
registerFrom
(
registerFrom
)
.
phoneNo
(
phoneNo
)
.
channelId
(
channelId
)
.
btRegisterChannelId
(
btRegisterChannelId
)
.
dimension
(
dimension
)
.
sendSuccessSms
(
true
)
.
sendAppSms
(
true
)
.
sendSuccessMq
(
true
)
.
build
();
User
user
=
saveUser
(
userRegisterParam
);
User
user
=
saveUser
(
userRegisterParam
);
applicationEventPublisher
.
publishEvent
(
new
RegisterEvent
(
this
,
userRegisterParam
));
applicationEventPublisher
.
publishEvent
(
new
RegisterEvent
(
this
,
userRegisterParam
));
return
user
;
return
user
;
...
@@ -219,16 +154,7 @@ public class UserRegisterServiceImpl implements IUserRegisterService {
...
@@ -219,16 +154,7 @@ public class UserRegisterServiceImpl implements IUserRegisterService {
deregisterCheck
(
phoneNo
);
deregisterCheck
(
phoneNo
);
UserRegisterParam
userRegisterParam
=
UserRegisterParam
.
builder
()
UserRegisterParam
userRegisterParam
=
UserRegisterParam
.
builder
().
registerFrom
(
registerFrom
).
phoneNo
(
phoneNo
).
channelId
(
channelId
).
btRegisterChannelId
(
btRegisterChannelId
).
dimension
(
dimension
).
sendSuccessSms
(
true
).
sendAppSms
(
true
).
sendSuccessMq
(
true
).
build
();
.
registerFrom
(
registerFrom
)
.
phoneNo
(
phoneNo
)
.
channelId
(
channelId
)
.
btRegisterChannelId
(
btRegisterChannelId
)
.
dimension
(
dimension
)
.
sendSuccessSms
(
true
)
.
sendAppSms
(
true
)
.
sendSuccessMq
(
true
)
.
build
();
User
user
=
saveUser
(
userRegisterParam
);
User
user
=
saveUser
(
userRegisterParam
);
if
(
tenantId
==
null
||
tenantId
.
equals
(
TenantUtil
.
TENANT_DEFAULT
))
{
if
(
tenantId
==
null
||
tenantId
.
equals
(
TenantUtil
.
TENANT_DEFAULT
))
{
applicationEventPublisher
.
publishEvent
(
new
RegisterEvent
(
this
,
userRegisterParam
));
applicationEventPublisher
.
publishEvent
(
new
RegisterEvent
(
this
,
userRegisterParam
));
...
@@ -238,22 +164,11 @@ public class UserRegisterServiceImpl implements IUserRegisterService {
...
@@ -238,22 +164,11 @@ public class UserRegisterServiceImpl implements IUserRegisterService {
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
@Override
public
User
register
(
Long
registeredFrom
,
Long
channelId
,
String
phoneNo
,
String
name
,
String
idNo
,
String
contacts
,
Long
btRegisterChannelId
)
{
public
User
register
(
Long
registeredFrom
,
Long
channelId
,
String
phoneNo
,
String
name
,
String
contacts
,
Long
btRegisterChannelId
)
{
deregisterCheck
(
phoneNo
);
deregisterCheck
(
phoneNo
);
UserRegisterParam
userRegisterParam
=
UserRegisterParam
.
builder
()
UserRegisterParam
userRegisterParam
=
UserRegisterParam
.
builder
().
registerFrom
(
registeredFrom
).
phoneNo
(
phoneNo
).
name
(
name
).
channelId
(
channelId
).
btRegisterChannelId
(
btRegisterChannelId
).
contacts
(
contacts
).
sendSuccessSms
(
true
).
sendAppSms
(
true
).
sendSuccessMq
(
true
).
build
();
.
registerFrom
(
registeredFrom
)
.
phoneNo
(
phoneNo
)
.
idNo
(
idNo
)
.
name
(
name
)
.
channelId
(
channelId
)
.
btRegisterChannelId
(
btRegisterChannelId
)
.
contacts
(
contacts
)
.
sendSuccessSms
(
true
)
.
sendAppSms
(
true
)
.
sendSuccessMq
(
true
)
.
build
();
User
user
=
saveUser
(
userRegisterParam
);
User
user
=
saveUser
(
userRegisterParam
);
applicationEventPublisher
.
publishEvent
(
new
RegisterEvent
(
this
,
userRegisterParam
));
applicationEventPublisher
.
publishEvent
(
new
RegisterEvent
(
this
,
userRegisterParam
));
return
user
;
return
user
;
...
@@ -270,8 +185,7 @@ public class UserRegisterServiceImpl implements IUserRegisterService {
...
@@ -270,8 +185,7 @@ public class UserRegisterServiceImpl implements IUserRegisterService {
List
<
UserDeregisterRecord
>
deregisterRecords
=
userDeregisterService
.
queryByPhoneNo
(
Md5Util
.
build
(
phoneNo
));
List
<
UserDeregisterRecord
>
deregisterRecords
=
userDeregisterService
.
queryByPhoneNo
(
Md5Util
.
build
(
phoneNo
));
/* 获取最新销户记录 */
/* 获取最新销户记录 */
Optional
<
UserDeregisterRecord
>
lastOne
=
deregisterRecords
.
stream
()
Optional
<
UserDeregisterRecord
>
lastOne
=
deregisterRecords
.
stream
().
max
(
Comparator
.
comparing
(
UserDeregisterRecord:
:
getDeregisterTime
));
.
max
(
Comparator
.
comparing
(
UserDeregisterRecord:
:
getDeregisterTime
));
if
(!
lastOne
.
isPresent
())
{
if
(!
lastOne
.
isPresent
())
{
return
;
return
;
...
@@ -290,16 +204,7 @@ public class UserRegisterServiceImpl implements IUserRegisterService {
...
@@ -290,16 +204,7 @@ public class UserRegisterServiceImpl implements IUserRegisterService {
deregisterCheck
(
phoneNo
);
deregisterCheck
(
phoneNo
);
UserRegisterParam
userRegisterParam
=
UserRegisterParam
.
builder
()
UserRegisterParam
userRegisterParam
=
UserRegisterParam
.
builder
().
registerFrom
(
registerFrom
).
phoneNo
(
phoneNo
).
name
(
name
).
channelId
(
channelId
).
btRegisterChannelId
(
btRegisterChannelId
).
sendSuccessSms
(
true
).
sendAppSms
(
true
).
sendSuccessMq
(
true
).
build
();
.
registerFrom
(
registerFrom
)
.
phoneNo
(
phoneNo
)
.
name
(
name
)
.
channelId
(
channelId
)
.
btRegisterChannelId
(
btRegisterChannelId
)
.
sendSuccessSms
(
true
)
.
sendAppSms
(
true
)
.
sendSuccessMq
(
true
)
.
build
();
User
user
=
saveUser
(
userRegisterParam
);
User
user
=
saveUser
(
userRegisterParam
);
if
(
tenantId
==
null
||
tenantId
.
equals
(
TenantUtil
.
TENANT_DEFAULT
))
{
if
(
tenantId
==
null
||
tenantId
.
equals
(
TenantUtil
.
TENANT_DEFAULT
))
{
applicationEventPublisher
.
publishEvent
(
new
RegisterEvent
(
this
,
userRegisterParam
));
applicationEventPublisher
.
publishEvent
(
new
RegisterEvent
(
this
,
userRegisterParam
));
...
...
src/main/java/cn/quantgroup/xyqb/service/user/ILkbUserService.java
View file @
dac85ae4
...
@@ -13,7 +13,6 @@ public interface ILkbUserService {
...
@@ -13,7 +13,6 @@ public interface ILkbUserService {
* @param uuid
* @param uuid
* @param phoneNo
* @param phoneNo
* @param name
* @param name
* @param idNo
*/
*/
boolean
pushUser
(
String
uuid
,
String
phoneNo
,
String
name
,
String
idNo
);
boolean
pushUser
(
String
uuid
,
String
phoneNo
,
String
name
);
}
}
src/main/java/cn/quantgroup/xyqb/service/user/IProductLoginService.java
View file @
dac85ae4
...
@@ -9,7 +9,7 @@ import java.util.List;
...
@@ -9,7 +9,7 @@ import java.util.List;
*/
*/
public
interface
IProductLoginService
{
public
interface
IProductLoginService
{
ProductLoginEntity
findSlaveByPloginInfo
(
String
institutionId
,
String
productId
,
Long
userId
);
ProductLoginEntity
findSlaveByPloginInfo
(
String
institutionId
,
String
productId
,
Long
userId
);
List
<
ProductLoginEntity
>
findSlaveByP
loginInfos
(
String
institutionId
,
String
productId
,
List
<
Long
>
userId
);
List
<
ProductLoginEntity
>
findSlaveByP
roductLoginInfoList
(
String
institutionId
,
String
productId
,
List
<
Long
>
userId
);
List
<
ProductLoginEntity
>
findSlaveByUserId
(
Long
userId
);
List
<
ProductLoginEntity
>
findSlaveByUserId
(
Long
userId
);
List
<
ProductLoginEntity
>
findSlaveByUserIds
(
List
<
Long
>
userIds
);
List
<
ProductLoginEntity
>
findSlaveByUserIds
(
List
<
Long
>
userIds
);
...
...
src/main/java/cn/quantgroup/xyqb/service/user/impl/LkbUserviceImpl.java
View file @
dac85ae4
...
@@ -34,7 +34,7 @@ public class LkbUserviceImpl implements ILkbUserService {
...
@@ -34,7 +34,7 @@ public class LkbUserviceImpl implements ILkbUserService {
private
String
clientUrl
;
private
String
clientUrl
;
@Override
@Override
public
boolean
pushUser
(
String
uuid
,
String
phoneNo
,
String
name
,
String
idNo
)
{
public
boolean
pushUser
(
String
uuid
,
String
phoneNo
,
String
name
)
{
String
timeunit
=
System
.
currentTimeMillis
()
+
""
;
String
timeunit
=
System
.
currentTimeMillis
()
+
""
;
String
token
=
PasswordUtil
.
MD5
(
String
.
format
(
TOKEN_PATTERN
,
timeunit
));
String
token
=
PasswordUtil
.
MD5
(
String
.
format
(
TOKEN_PATTERN
,
timeunit
));
Map
<
String
,
String
>
parameters
=
Maps
.
newHashMap
();
Map
<
String
,
String
>
parameters
=
Maps
.
newHashMap
();
...
@@ -46,9 +46,7 @@ public class LkbUserviceImpl implements ILkbUserService {
...
@@ -46,9 +46,7 @@ public class LkbUserviceImpl implements ILkbUserService {
if
(
StringUtils
.
isNotBlank
(
name
))
{
if
(
StringUtils
.
isNotBlank
(
name
))
{
parameters
.
put
(
"realName"
,
name
);
parameters
.
put
(
"realName"
,
name
);
}
}
if
(
StringUtils
.
isNotBlank
(
idNo
))
{
parameters
.
put
(
"idCardNo"
,
idNo
);
}
String
response
=
httpService
.
post
(
clientUrl
+
"/user/push.json"
,
parameters
);
String
response
=
httpService
.
post
(
clientUrl
+
"/user/push.json"
,
parameters
);
Optional
<
Map
>
resultOptional
=
JsonUtil
.
fromJson
(
response
,
Map
.
class
);
Optional
<
Map
>
resultOptional
=
JsonUtil
.
fromJson
(
response
,
Map
.
class
);
if
(!
resultOptional
.
isPresent
()
||
!
Constants
.
SUCCESS_CODE
.
equals
(
resultOptional
.
get
().
get
(
Constants
.
RESULT_CODE
)))
{
if
(!
resultOptional
.
isPresent
()
||
!
Constants
.
SUCCESS_CODE
.
equals
(
resultOptional
.
get
().
get
(
Constants
.
RESULT_CODE
)))
{
...
...
src/main/java/cn/quantgroup/xyqb/service/user/impl/OauthClientDetailsServiceImpl.java
View file @
dac85ae4
...
@@ -4,12 +4,15 @@ import cn.quantgroup.xyqb.entity.OauthClientDetailsEntity;
...
@@ -4,12 +4,15 @@ import cn.quantgroup.xyqb.entity.OauthClientDetailsEntity;
import
cn.quantgroup.xyqb.entity.ProductLoginEntity
;
import
cn.quantgroup.xyqb.entity.ProductLoginEntity
;
import
cn.quantgroup.xyqb.repository.IOauthClientDetailsRepository
;
import
cn.quantgroup.xyqb.repository.IOauthClientDetailsRepository
;
import
cn.quantgroup.xyqb.service.user.IOauthClientDetailsService
;
import
cn.quantgroup.xyqb.service.user.IOauthClientDetailsService
;
import
com.github.benmanes.caffeine.cache.Caffeine
;
import
com.github.benmanes.caffeine.cache.LoadingCache
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.concurrent.TimeUnit
;
/**
/**
* Created by 11 on 2016/12/29.
* Created by 11 on 2016/12/29.
...
@@ -18,13 +21,22 @@ import java.util.List;
...
@@ -18,13 +21,22 @@ import java.util.List;
@Service
@Service
public
class
OauthClientDetailsServiceImpl
implements
IOauthClientDetailsService
{
public
class
OauthClientDetailsServiceImpl
implements
IOauthClientDetailsService
{
@Autowired
@Autowired
private
IOauthClientDetailsRepository
oauthClientDetailsRepository
;
private
final
IOauthClientDetailsRepository
oauthClientDetailsRepository
;
private
final
LoadingCache
<
Integer
,
OauthClientDetailsEntity
>
cache
;
public
OauthClientDetailsServiceImpl
(
IOauthClientDetailsRepository
oauthClientDetailsRepository
)
{
this
.
oauthClientDetailsRepository
=
oauthClientDetailsRepository
;
cache
=
Caffeine
.
newBuilder
()
.
expireAfterWrite
(
8
,
TimeUnit
.
HOURS
)
.
maximumSize
(
1_000
)
.
build
(
this
.
oauthClientDetailsRepository
::
findFirstByClientId
);
}
@Override
@Override
public
OauthClientDetailsEntity
findFirstByClientId
(
Integer
clientId
)
{
public
OauthClientDetailsEntity
findFirstByClientId
(
Integer
clientId
)
{
OauthClientDetailsEntity
oauthClientDetailsEntity
=
oauthClientDetailsRepository
.
findFirstByClientId
(
clientId
);
return
cache
.
get
(
clientId
);
return
oauthClientDetailsEntity
;
}
}
@Override
@Override
...
@@ -40,5 +52,4 @@ public class OauthClientDetailsServiceImpl implements IOauthClientDetailsService
...
@@ -40,5 +52,4 @@ public class OauthClientDetailsServiceImpl implements IOauthClientDetailsService
}
}
}
}
src/main/java/cn/quantgroup/xyqb/service/user/impl/OauthLoginInfoServiceImpl.java
View file @
dac85ae4
...
@@ -6,6 +6,7 @@ import cn.quantgroup.xyqb.repository.ICustomerInfoRepository;
...
@@ -6,6 +6,7 @@ import cn.quantgroup.xyqb.repository.ICustomerInfoRepository;
import
cn.quantgroup.xyqb.repository.ICustomerLoginRepository
;
import
cn.quantgroup.xyqb.repository.ICustomerLoginRepository
;
import
cn.quantgroup.xyqb.repository.IOauthClientDetailsRepository
;
import
cn.quantgroup.xyqb.repository.IOauthClientDetailsRepository
;
import
cn.quantgroup.xyqb.repository.IProductLoginRepository
;
import
cn.quantgroup.xyqb.repository.IProductLoginRepository
;
import
cn.quantgroup.xyqb.service.user.IOauthClientDetailsService
;
import
cn.quantgroup.xyqb.service.user.IOauthLoginInfoService
;
import
cn.quantgroup.xyqb.service.user.IOauthLoginInfoService
;
import
cn.quantgroup.xyqb.service.user.IProductLoginService
;
import
cn.quantgroup.xyqb.service.user.IProductLoginService
;
import
cn.quantgroup.xyqb.util.AtomicSequencer
;
import
cn.quantgroup.xyqb.util.AtomicSequencer
;
...
@@ -25,7 +26,7 @@ import java.util.Date;
...
@@ -25,7 +26,7 @@ import java.util.Date;
@Service
@Service
public
class
OauthLoginInfoServiceImpl
implements
IOauthLoginInfoService
{
public
class
OauthLoginInfoServiceImpl
implements
IOauthLoginInfoService
{
@Autowired
@Autowired
private
IOauthClientDetails
Repository
oauthClientDetailsRepository
;
private
IOauthClientDetails
Service
oauthClientDetailsService
;
@Autowired
@Autowired
private
IProductLoginRepository
productLoginRepository
;
private
IProductLoginRepository
productLoginRepository
;
...
@@ -45,7 +46,7 @@ public class OauthLoginInfoServiceImpl implements IOauthLoginInfoService {
...
@@ -45,7 +46,7 @@ public class OauthLoginInfoServiceImpl implements IOauthLoginInfoService {
@Override
@Override
@Transactional
(
propagation
=
Propagation
.
REQUIRES_NEW
,
rollbackFor
=
Exception
.
class
)
@Transactional
(
propagation
=
Propagation
.
REQUIRES_NEW
,
rollbackFor
=
Exception
.
class
)
public
void
addLoginInfo
(
User
user
,
Integer
tenantId
)
{
public
void
addLoginInfo
(
User
user
,
Integer
tenantId
)
{
OauthClientDetailsEntity
oauthClientDetailsEntity
=
oauthClientDetails
Repository
.
findFirstByClientId
(
tenantId
);
OauthClientDetailsEntity
oauthClientDetailsEntity
=
oauthClientDetails
Service
.
findFirstByClientId
(
tenantId
);
if
(
oauthClientDetailsEntity
!=
null
)
{
if
(
oauthClientDetailsEntity
!=
null
)
{
String
institutionId
=
oauthClientDetailsEntity
.
getInstitutionId
();
String
institutionId
=
oauthClientDetailsEntity
.
getInstitutionId
();
String
productId
=
oauthClientDetailsEntity
.
getProductId
();
String
productId
=
oauthClientDetailsEntity
.
getProductId
();
...
@@ -61,7 +62,6 @@ public class OauthLoginInfoServiceImpl implements IOauthLoginInfoService {
...
@@ -61,7 +62,6 @@ public class OauthLoginInfoServiceImpl implements IOauthLoginInfoService {
long
id
=
atomicSequencer
.
nextId
();
long
id
=
atomicSequencer
.
nextId
();
String
customerName
=
customerId
+
""
;
String
customerName
=
customerId
+
""
;
uuid
=
RandomSequencer
.
randomUUID
(
customerId
);
uuid
=
RandomSequencer
.
randomUUID
(
customerId
);
ProductLoginEntity
entity
=
new
ProductLoginEntity
();
Integer
partitionKey
=
atomicSequencer
.
partitionKey
(
customerId
);
Integer
partitionKey
=
atomicSequencer
.
partitionKey
(
customerId
);
ProductLoginEntity
productLoginEntity
=
EntityBuilder
.
productLogin
(
productId
,
institutionId
,
phoneNo
,
customerId
,
customerName
,
partitionKey
,
id
);
ProductLoginEntity
productLoginEntity
=
EntityBuilder
.
productLogin
(
productId
,
institutionId
,
phoneNo
,
customerId
,
customerName
,
partitionKey
,
id
);
productLoginEntity
.
setExtensionAccountId
(
userId
);
productLoginEntity
.
setExtensionAccountId
(
userId
);
...
@@ -105,7 +105,7 @@ public class OauthLoginInfoServiceImpl implements IOauthLoginInfoService {
...
@@ -105,7 +105,7 @@ public class OauthLoginInfoServiceImpl implements IOauthLoginInfoService {
@Override
@Override
@Transactional
(
propagation
=
Propagation
.
REQUIRES_NEW
)
@Transactional
(
propagation
=
Propagation
.
REQUIRES_NEW
)
public
void
addRegisterInfo
(
User
user
,
AppletParamEntry
appletParamEntry
)
{
public
void
addRegisterInfo
(
User
user
,
AppletParamEntry
appletParamEntry
)
{
OauthClientDetailsEntity
oauthClientDetailsEntity
=
oauthClientDetails
Repository
.
findFirstByClientId
(
appletParamEntry
.
getTenantId
());
OauthClientDetailsEntity
oauthClientDetailsEntity
=
oauthClientDetails
Service
.
findFirstByClientId
(
appletParamEntry
.
getTenantId
());
if
(
oauthClientDetailsEntity
!=
null
)
{
if
(
oauthClientDetailsEntity
!=
null
)
{
String
institutionId
=
oauthClientDetailsEntity
.
getInstitutionId
();
String
institutionId
=
oauthClientDetailsEntity
.
getInstitutionId
();
String
productId
=
oauthClientDetailsEntity
.
getProductId
();
String
productId
=
oauthClientDetailsEntity
.
getProductId
();
...
@@ -114,13 +114,12 @@ public class OauthLoginInfoServiceImpl implements IOauthLoginInfoService {
...
@@ -114,13 +114,12 @@ public class OauthLoginInfoServiceImpl implements IOauthLoginInfoService {
ProductLoginEntity
productLoginEntity
=
productLoginService
.
findTenantAndPhoneNo
(
institutionId
,
productId
,
phoneNo
);
ProductLoginEntity
productLoginEntity
=
productLoginService
.
findTenantAndPhoneNo
(
institutionId
,
productId
,
phoneNo
);
long
uuid
=
0L
;
long
uuid
=
0L
;
// 如果找不到该用户就创建
// 如果找不到该用户就创建
if
(
""
.
equals
(
productLoginEntity
)
||
productLoginEntity
==
null
)
{
if
(
productLoginEntity
==
null
)
{
// 添加用户到产品登录表
// 添加用户到产品登录表
long
customerId
=
atomicSequencer
.
nextId
();
long
customerId
=
atomicSequencer
.
nextId
();
long
id
=
atomicSequencer
.
nextId
();
long
id
=
atomicSequencer
.
nextId
();
String
customerName
=
customerId
+
""
;
String
customerName
=
customerId
+
""
;
uuid
=
RandomSequencer
.
randomUUID
(
customerId
);
uuid
=
RandomSequencer
.
randomUUID
(
customerId
);
ProductLoginEntity
entity
=
new
ProductLoginEntity
();
Integer
partitionKey
=
atomicSequencer
.
partitionKey
(
customerId
);
Integer
partitionKey
=
atomicSequencer
.
partitionKey
(
customerId
);
productLoginEntity
=
EntityBuilder
.
productLogin
(
productId
,
institutionId
,
phoneNo
,
customerId
,
customerName
,
partitionKey
,
id
);
productLoginEntity
=
EntityBuilder
.
productLogin
(
productId
,
institutionId
,
phoneNo
,
customerId
,
customerName
,
partitionKey
,
id
);
productLoginEntity
.
setExtensionAccountId
(
userId
);
productLoginEntity
.
setExtensionAccountId
(
userId
);
...
...
src/main/java/cn/quantgroup/xyqb/service/user/impl/ProductLoginServiceImpl.java
View file @
dac85ae4
...
@@ -25,9 +25,8 @@ public class ProductLoginServiceImpl implements IProductLoginService {
...
@@ -25,9 +25,8 @@ public class ProductLoginServiceImpl implements IProductLoginService {
}
}
@Override
@Override
public
List
<
ProductLoginEntity
>
findSlaveByPloginInfos
(
String
institutionId
,
String
productId
,
List
<
Long
>
userIds
)
{
public
List
<
ProductLoginEntity
>
findSlaveByProductLoginInfoList
(
String
institutionId
,
String
productId
,
List
<
Long
>
userIds
)
{
List
<
ProductLoginEntity
>
list
=
productLoginRepository
.
findByInstitutionIdAndProductIdAndExtensionAccountIdIn
(
institutionId
,
productId
,
userIds
);
return
productLoginRepository
.
findByInstitutionIdAndProductIdAndExtensionAccountIdIn
(
institutionId
,
productId
,
userIds
);
return
list
;
}
}
@Override
@Override
...
@@ -38,8 +37,7 @@ public class ProductLoginServiceImpl implements IProductLoginService {
...
@@ -38,8 +37,7 @@ public class ProductLoginServiceImpl implements IProductLoginService {
@Override
@Override
public
List
<
ProductLoginEntity
>
findSlaveByUserIds
(
List
<
Long
>
userIds
)
{
public
List
<
ProductLoginEntity
>
findSlaveByUserIds
(
List
<
Long
>
userIds
)
{
List
<
ProductLoginEntity
>
productLoginEntityList
=
productLoginRepository
.
findAllByExtensionAccountIdIn
(
userIds
);
return
productLoginRepository
.
findAllByExtensionAccountIdIn
(
userIds
);
return
productLoginEntityList
;
}
}
@Override
@Override
...
...
src/main/java/cn/quantgroup/xyqb/service/user/impl/TenantServiceImpl.java
View file @
dac85ae4
...
@@ -7,6 +7,7 @@ import cn.quantgroup.xyqb.service.user.IOauthClientDetailsService;
...
@@ -7,6 +7,7 @@ import cn.quantgroup.xyqb.service.user.IOauthClientDetailsService;
import
cn.quantgroup.xyqb.service.user.IProductLoginService
;
import
cn.quantgroup.xyqb.service.user.IProductLoginService
;
import
cn.quantgroup.xyqb.service.user.ITenantService
;
import
cn.quantgroup.xyqb.service.user.ITenantService
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -37,13 +38,12 @@ public class TenantServiceImpl implements ITenantService {
...
@@ -37,13 +38,12 @@ public class TenantServiceImpl implements ITenantService {
if
(
oauthClientDetails
!=
null
)
{
if
(
oauthClientDetails
!=
null
)
{
ProductLoginEntity
productLogin
=
productLoginService
.
findSlaveByPloginInfo
(
oauthClientDetails
.
getInstitutionId
(),
oauthClientDetails
.
getProductId
(),
user
.
getId
());
ProductLoginEntity
productLogin
=
productLoginService
.
findSlaveByPloginInfo
(
oauthClientDetails
.
getInstitutionId
(),
oauthClientDetails
.
getProductId
(),
user
.
getId
());
if
(
productLogin
!=
null
)
{
if
(
productLogin
!=
null
)
{
if
(!
user
.
getEncryptedPhoneNo
().
equals
(
productLogin
.
getEncryptedPhoneNo
()))
{
if
(
user
.
getEncryptedPhoneNo
().
equals
(
productLogin
.
getEncryptedPhoneNo
()))
{
return
null
;
}
user
.
setPassword
(
productLogin
.
getPassword
());
user
.
setPassword
(
productLogin
.
getPassword
());
return
user
;
return
user
;
}
}
}
}
}
return
null
;
return
null
;
}
}
...
@@ -107,15 +107,9 @@ public class TenantServiceImpl implements ITenantService {
...
@@ -107,15 +107,9 @@ public class TenantServiceImpl implements ITenantService {
if
(
oauthClientDetails
!=
null
)
{
if
(
oauthClientDetails
!=
null
)
{
ProductLoginEntity
productLogin
=
productLoginService
.
findSlaveByPloginInfo
(
oauthClientDetails
.
getInstitutionId
(),
oauthClientDetails
.
getProductId
(),
user
.
getId
());
ProductLoginEntity
productLogin
=
productLoginService
.
findSlaveByPloginInfo
(
oauthClientDetails
.
getInstitutionId
(),
oauthClientDetails
.
getProductId
(),
user
.
getId
());
if
(
productLogin
!=
null
)
{
if
(
productLogin
!=
null
)
{
if
(!
user
.
getPhoneNo
().
equals
(
productLogin
.
getPhoneNo
()))
{
if
(
user
.
getPhoneNo
().
equals
(
productLogin
.
getPhoneNo
()))
{
return
null
;
return
customerInfoService
.
findSlaveByCustomerId
(
productLogin
.
getCustomerId
());
}
CustomerInfoEntity
customerInfo
=
customerInfoService
.
findSlaveByCustomerId
(
productLogin
.
getCustomerId
());
if
(
customerInfo
==
null
)
{
return
null
;
}
}
return
customerInfo
;
}
}
}
}
return
null
;
return
null
;
...
@@ -124,18 +118,14 @@ public class TenantServiceImpl implements ITenantService {
...
@@ -124,18 +118,14 @@ public class TenantServiceImpl implements ITenantService {
@Override
@Override
public
List
<
User
>
selectUsersByTenantId
(
List
<
User
>
users
,
Integer
tenantId
)
{
public
List
<
User
>
selectUsersByTenantId
(
List
<
User
>
users
,
Integer
tenantId
)
{
List
<
User
>
result
=
new
ArrayList
<>();
List
<
User
>
result
=
new
ArrayList
<>();
if
(
users
!=
null
)
{
if
(
CollectionUtils
.
isNotEmpty
(
users
)
)
{
OauthClientDetailsEntity
oauthClientDetails
=
oauthClientDetailsService
.
findFirstByClientId
(
tenantId
);
OauthClientDetailsEntity
oauthClientDetails
=
oauthClientDetailsService
.
findFirstByClientId
(
tenantId
);
if
(
oauthClientDetails
!=
null
)
{
if
(
oauthClientDetails
!=
null
)
{
List
<
Long
>
userIds
=
users
.
stream
().
map
(
User:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
Long
>
userIds
=
users
.
stream
().
map
(
User:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
ProductLoginEntity
>
productLoginEntities
=
productLoginService
.
findSlaveByP
loginInfos
(
oauthClientDetails
.
getInstitutionId
(),
oauthClientDetails
.
getProductId
(),
userIds
);
List
<
ProductLoginEntity
>
productLoginEntities
=
productLoginService
.
findSlaveByP
roductLoginInfoList
(
oauthClientDetails
.
getInstitutionId
(),
oauthClientDetails
.
getProductId
(),
userIds
);
if
(
productLoginEntities
!=
null
&&
productLoginEntities
.
size
()>
0
)
{
if
(
CollectionUtils
.
isNotEmpty
(
productLoginEntities
)
)
{
List
<
String
>
phoneNos
=
productLoginEntities
.
stream
().
map
(
ProductLoginEntity:
:
getPhoneNo
).
collect
(
Collectors
.
toList
());
List
<
String
>
phoneNos
=
productLoginEntities
.
stream
().
map
(
ProductLoginEntity:
:
getPhoneNo
).
collect
(
Collectors
.
toList
());
users
.
forEach
(
a
->{
result
=
users
.
stream
().
filter
(
i
->
phoneNos
.
contains
(
i
.
getPhoneNo
())).
collect
(
Collectors
.
toList
());
if
(
phoneNos
.
contains
(
a
.
getPhoneNo
()))
{
result
.
add
(
a
);
}
});
}
}
}
}
}
}
...
@@ -148,7 +138,7 @@ public class TenantServiceImpl implements ITenantService {
...
@@ -148,7 +138,7 @@ public class TenantServiceImpl implements ITenantService {
OauthClientDetailsEntity
oauthClientDetails
=
oauthClientDetailsService
.
findFirstByClientId
(
tenantId
);
OauthClientDetailsEntity
oauthClientDetails
=
oauthClientDetailsService
.
findFirstByClientId
(
tenantId
);
if
(
oauthClientDetails
!=
null
)
{
if
(
oauthClientDetails
!=
null
)
{
CustomerInfoEntity
customerInfo
=
customerInfoService
.
findSlaveByOpenId
(
openId
,
oauthClientDetails
.
getInstitutionId
(),
oauthClientDetails
.
getProductId
());
CustomerInfoEntity
customerInfo
=
customerInfoService
.
findSlaveByOpenId
(
openId
,
oauthClientDetails
.
getInstitutionId
(),
oauthClientDetails
.
getProductId
());
if
(
customerInfo
!=
null
)
{
if
(
customerInfo
!=
null
)
{
ProductLoginEntity
productLogin
=
productLoginService
.
findSlaveByCustomerInfo
(
customerInfo
.
getCustomerId
(),
oauthClientDetails
.
getInstitutionId
(),
oauthClientDetails
.
getProductId
());
ProductLoginEntity
productLogin
=
productLoginService
.
findSlaveByCustomerInfo
(
customerInfo
.
getCustomerId
(),
oauthClientDetails
.
getInstitutionId
(),
oauthClientDetails
.
getProductId
());
if
(
productLogin
!=
null
)
{
if
(
productLogin
!=
null
)
{
return
productLogin
.
getExtensionAccountId
();
return
productLogin
.
getExtensionAccountId
();
...
@@ -161,31 +151,24 @@ public class TenantServiceImpl implements ITenantService {
...
@@ -161,31 +151,24 @@ public class TenantServiceImpl implements ITenantService {
@Override
@Override
public
List
<
User
>
validationTentIdByTentId
(
List
<
User
>
users
,
Integer
tenantId
)
{
public
List
<
User
>
validationTentIdByTentId
(
List
<
User
>
users
,
Integer
tenantId
)
{
List
<
User
>
result
=
new
ArrayList
<>();
List
<
User
>
result
=
new
ArrayList
<>();
if
(
users
!=
null
)
{
if
(
CollectionUtils
.
isNotEmpty
(
users
))
{
List
<
Long
>
userIds
=
users
.
stream
().
map
(
User:
:
getId
).
collect
(
Collectors
.
toList
());
OauthClientDetailsEntity
oauthClientDetails
=
oauthClientDetailsService
.
findFirstByClientId
(
tenantId
);
OauthClientDetailsEntity
oauthClientDetails
=
oauthClientDetailsService
.
findFirstByClientId
(
tenantId
);
List
<
Long
>
userIds
=
users
.
stream
().
map
(
User:
:
getId
).
collect
(
Collectors
.
toList
());
if
(
oauthClientDetails
!=
null
)
{
if
(
oauthClientDetails
!=
null
)
{
List
<
ProductLoginEntity
>
slaveByPloginInfos
=
productLoginService
.
findSlaveByPloginInfos
(
oauthClientDetails
.
getInstitutionId
(),
oauthClientDetails
.
getProductId
(),
userIds
);
//1、查询出在product_login手机号码相同的用户
users
.
forEach
(
a
->{
List
<
ProductLoginEntity
>
productLoginEntities
=
productLoginService
.
findSlaveByProductLoginInfoList
(
oauthClientDetails
.
getInstitutionId
(),
oauthClientDetails
.
getProductId
(),
userIds
);
if
(
slaveByPloginInfos
!=
null
&&
slaveByPloginInfos
.
size
()>
0
)
{
List
<
String
>
phoneNos
=
productLoginEntities
.
stream
().
map
(
ProductLoginEntity:
:
getPhoneNo
).
collect
(
Collectors
.
toList
());
List
<
String
>
phoneNos
=
slaveByPloginInfos
.
stream
().
map
(
ProductLoginEntity:
:
getPhoneNo
).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isNotEmpty
(
productLoginEntities
))
{
if
(
phoneNos
.
contains
(
a
.
getPhoneNo
()))
{
result
=
users
.
stream
().
filter
(
i
->
phoneNos
.
contains
(
i
.
getPhoneNo
())).
collect
(
Collectors
.
toList
());
result
.
add
(
a
);
}
}
});
}
}
}
else
{
//2、查询用户id不在product_login的扩展账户ID的用户
List
<
ProductLoginEntity
>
slaveByUserIds
=
productLoginService
.
findSlaveByUserIds
(
userIds
);
List
<
ProductLoginEntity
>
slaveByUserIds
=
productLoginService
.
findSlaveByUserIds
(
userIds
);
if
(
slaveByUserIds
!=
null
)
{
List
<
Long
>
extensionAccountIds
=
slaveByUserIds
.
stream
().
map
(
ProductLoginEntity:
:
getExtensionAccountId
).
collect
(
Collectors
.
toList
());
List
<
Long
>
collect
=
slaveByUserIds
.
stream
().
map
(
ProductLoginEntity:
:
getExtensionAccountId
).
collect
(
Collectors
.
toList
());
users
.
forEach
(
a
->{
if
(
CollectionUtils
.
isNotEmpty
(
slaveByUserIds
))
{
if
(
collect
!=
null
)
{
result
=
users
.
stream
().
filter
(
i
->
extensionAccountIds
.
contains
(
i
.
getId
())).
collect
(
Collectors
.
toList
());
if
(!
collect
.
contains
(
a
.
getId
()))
{
result
.
add
(
a
);
}
}
}
});
}
}
}
}
return
result
;
return
result
;
...
...
src/main/java/cn/quantgroup/xyqb/service/user/impl/UserCenterServiceImpl.java
View file @
dac85ae4
...
@@ -9,6 +9,7 @@ import cn.quantgroup.xyqb.service.user.UserCenterService;
...
@@ -9,6 +9,7 @@ import cn.quantgroup.xyqb.service.user.UserCenterService;
import
cn.quantgroup.xyqb.util.EmojiUtil
;
import
cn.quantgroup.xyqb.util.EmojiUtil
;
import
cn.quantgroup.xyqb.util.TenantUtil
;
import
cn.quantgroup.xyqb.util.TenantUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.hibernate.exception.ConstraintViolationException
;
import
org.hibernate.exception.ConstraintViolationException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -46,32 +47,18 @@ public class UserCenterServiceImpl implements UserCenterService {
...
@@ -46,32 +47,18 @@ public class UserCenterServiceImpl implements UserCenterService {
@Override
@Override
public
List
<
UserAttached
>
searchUserAttachedListByUserId
(
List
<
Long
>
userIds
,
Integer
tenantId
)
{
public
List
<
UserAttached
>
searchUserAttachedListByUserId
(
List
<
Long
>
userIds
,
Integer
tenantId
)
{
List
<
UserAttached
>
resultProductUsers
=
new
ArrayList
<>();
List
<
UserAttached
>
resultProductUsers
=
new
ArrayList
<>();
List
<
UserAttached
>
userAttacheds
=
userAttachedRepository
.
findByUserIdIn
(
userIds
);
List
<
UserAttached
>
userAttachedList
=
userAttachedRepository
.
findByUserIdIn
(
userIds
);
if
(!
tenantId
.
equals
(
TenantUtil
.
TENANT_DEFAULT
))
{
if
(
userAttacheds
!=
null
)
{
List
<
User
>
users
=
userRepository
.
findByIdIn
(
userIds
);
List
<
User
>
users
=
userRepository
.
findByIdIn
(
userIds
);
List
<
User
>
productUsers
=
tenantService
.
selectUsersByTenantId
(
users
,
tenantId
);
List
<
User
>
productUsers
;
if
(
productUsers
!=
null
)
{
if
(!
tenantId
.
equals
(
TenantUtil
.
TENANT_DEFAULT
))
{
List
<
Long
>
collect
=
productUsers
.
stream
().
map
(
User:
:
getId
).
collect
(
Collectors
.
toList
());
productUsers
=
tenantService
.
selectUsersByTenantId
(
users
,
tenantId
);
userAttacheds
.
forEach
(
a
->{
}
else
{
if
(
collect
.
contains
(
a
.
getUserId
()))
{
productUsers
=
tenantService
.
validationTentIdByTentId
(
users
,
tenantId
);
resultProductUsers
.
add
(
a
);
}
});
}
return
resultProductUsers
;
}
}
else
{
List
<
User
>
users
=
userRepository
.
findByIdIn
(
userIds
);
List
<
User
>
productUsers
=
tenantService
.
validationTentIdByTentId
(
users
,
tenantId
);
if
(
productUsers
!=
null
)
{
List
<
Long
>
collect
=
productUsers
.
stream
().
map
(
User:
:
getId
).
collect
(
Collectors
.
toList
());
userAttacheds
.
forEach
(
a
->{
if
(
collect
.
contains
(
a
.
getUserId
()))
{
resultProductUsers
.
add
(
a
);
}
});
}
}
if
(
CollectionUtils
.
isNotEmpty
(
userAttachedList
)
&&
CollectionUtils
.
isNotEmpty
(
productUsers
))
{
List
<
Long
>
productUserIds
=
productUsers
.
stream
().
map
(
User:
:
getId
).
collect
(
Collectors
.
toList
());
resultProductUsers
=
userAttachedList
.
stream
().
filter
(
i
->
productUserIds
.
contains
(
i
.
getUserId
())).
collect
(
Collectors
.
toList
());
}
}
return
resultProductUsers
;
return
resultProductUsers
;
}
}
...
@@ -80,10 +67,10 @@ public class UserCenterServiceImpl implements UserCenterService {
...
@@ -80,10 +67,10 @@ public class UserCenterServiceImpl implements UserCenterService {
@CacheEvict
(
value
=
"userAttachedCache"
,
key
=
"'xyqbUserAttached' + #userId"
,
cacheManager
=
"cacheManager"
)
@CacheEvict
(
value
=
"userAttachedCache"
,
key
=
"'xyqbUserAttached' + #userId"
,
cacheManager
=
"cacheManager"
)
public
UserAttached
saveUserAvatar
(
long
userId
,
String
avatar
)
{
public
UserAttached
saveUserAvatar
(
long
userId
,
String
avatar
)
{
UserAttached
userAttached
=
userAttachedRepository
.
findByUserId
(
userId
);
UserAttached
userAttached
=
userAttachedRepository
.
findByUserId
(
userId
);
if
(
Objects
.
isNull
(
userAttached
))
{
if
(
Objects
.
isNull
(
userAttached
))
{
userAttached
=
createUserAttached
(
userId
,
avatar
,
null
);
userAttached
=
createUserAttached
(
userId
,
avatar
,
null
);
}
}
if
(!
Objects
.
equals
(
avatar
,
userAttached
.
getAvatar
()))
{
if
(!
Objects
.
equals
(
avatar
,
userAttached
.
getAvatar
()))
{
userAttached
.
setAvatar
(
avatar
);
userAttached
.
setAvatar
(
avatar
);
userAttached
=
userAttachedRepository
.
save
(
userAttached
);
userAttached
=
userAttachedRepository
.
save
(
userAttached
);
}
}
...
@@ -96,14 +83,14 @@ public class UserCenterServiceImpl implements UserCenterService {
...
@@ -96,14 +83,14 @@ public class UserCenterServiceImpl implements UserCenterService {
UserAttached
userAttached
=
userAttachedRepository
.
findByUserId
(
userId
);
UserAttached
userAttached
=
userAttachedRepository
.
findByUserId
(
userId
);
// 替换所有,UTF-8编码时4字节的Emoji表情字符
// 替换所有,UTF-8编码时4字节的Emoji表情字符
nick
=
EmojiUtil
.
filterUnicode4
(
nick
);
nick
=
EmojiUtil
.
filterUnicode4
(
nick
);
if
(
Objects
.
isNull
(
userAttached
))
{
if
(
Objects
.
isNull
(
userAttached
))
{
userAttached
=
createUserAttached
(
userId
,
null
,
nick
);
userAttached
=
createUserAttached
(
userId
,
null
,
nick
);
}
}
if
(!
Objects
.
equals
(
nick
,
userAttached
.
getNick
()))
{
if
(!
Objects
.
equals
(
nick
,
userAttached
.
getNick
()))
{
userAttached
.
setNick
(
nick
);
userAttached
.
setNick
(
nick
);
try
{
try
{
userAttached
=
userAttachedRepository
.
save
(
userAttached
);
userAttached
=
userAttachedRepository
.
save
(
userAttached
);
}
catch
(
ConstraintViolationException
e
)
{
}
catch
(
ConstraintViolationException
e
)
{
// Sql唯一约束异常(诱因是Form重复提交,因为该操作是幂等的,故此不需额外处理,可返回成功)
// Sql唯一约束异常(诱因是Form重复提交,因为该操作是幂等的,故此不需额外处理,可返回成功)
log
.
error
(
"Sql约束异常[uni_idx_user_id]重复提交Form是幂等操作,不影响处理结果"
,
e
);
log
.
error
(
"Sql约束异常[uni_idx_user_id]重复提交Form是幂等操作,不影响处理结果"
,
e
);
}
}
...
@@ -129,10 +116,10 @@ public class UserCenterServiceImpl implements UserCenterService {
...
@@ -129,10 +116,10 @@ public class UserCenterServiceImpl implements UserCenterService {
// 更新实例
// 更新实例
userAttached
=
Optional
.
ofNullable
(
userAttached
).
orElse
(
new
UserAttached
());
userAttached
=
Optional
.
ofNullable
(
userAttached
).
orElse
(
new
UserAttached
());
userAttached
.
setUserId
(
userId
);
userAttached
.
setUserId
(
userId
);
if
(
StringUtils
.
isBlank
(
userAttached
.
getAvatar
()))
{
if
(
StringUtils
.
isBlank
(
userAttached
.
getAvatar
()))
{
userAttached
.
setAvatar
(
avatar
);
userAttached
.
setAvatar
(
avatar
);
}
}
if
(
StringUtils
.
isBlank
(
userAttached
.
getNick
()))
{
if
(
StringUtils
.
isBlank
(
userAttached
.
getNick
()))
{
userAttached
.
setNick
(
nick
);
userAttached
.
setNick
(
nick
);
}
}
return
userAttachedRepository
.
save
(
userAttached
);
return
userAttachedRepository
.
save
(
userAttached
);
...
...
src/main/java/cn/quantgroup/xyqb/service/user/impl/UserDetailServiceImpl.java
View file @
dac85ae4
...
@@ -4,11 +4,9 @@ import cn.quantgroup.xyqb.Constants;
...
@@ -4,11 +4,9 @@ import cn.quantgroup.xyqb.Constants;
import
cn.quantgroup.xyqb.entity.UserDetail
;
import
cn.quantgroup.xyqb.entity.UserDetail
;
import
cn.quantgroup.xyqb.event.UserDetailUpdateEvent
;
import
cn.quantgroup.xyqb.event.UserDetailUpdateEvent
;
import
cn.quantgroup.xyqb.model.Gender
;
import
cn.quantgroup.xyqb.model.Gender
;
import
cn.quantgroup.xyqb.model.IdCardInfo
;
import
cn.quantgroup.xyqb.model.IdType
;
import
cn.quantgroup.xyqb.model.IdType
;
import
cn.quantgroup.xyqb.repository.IUserDetailRepository
;
import
cn.quantgroup.xyqb.repository.IUserDetailRepository
;
import
cn.quantgroup.xyqb.repository.IUserRepository
;
import
cn.quantgroup.xyqb.repository.IUserRepository
;
import
cn.quantgroup.xyqb.service.auth.IIdCardService
;
import
cn.quantgroup.xyqb.service.user.IUserDetailService
;
import
cn.quantgroup.xyqb.service.user.IUserDetailService
;
import
cn.quantgroup.xyqb.service.user.vo.UserDetailVO
;
import
cn.quantgroup.xyqb.service.user.vo.UserDetailVO
;
import
cn.quantgroup.xyqb.util.AddressFilter
;
import
cn.quantgroup.xyqb.util.AddressFilter
;
...
@@ -42,8 +40,7 @@ public class UserDetailServiceImpl implements IUserDetailService {
...
@@ -42,8 +40,7 @@ public class UserDetailServiceImpl implements IUserDetailService {
private
IUserDetailRepository
userDetailRepository
;
private
IUserDetailRepository
userDetailRepository
;
@Autowired
@Autowired
private
IUserRepository
userRepository
;
private
IUserRepository
userRepository
;
@Autowired
private
IIdCardService
idCardService
;
@Resource
@Resource
private
ApplicationEventPublisher
applicationEventPublisher
;
private
ApplicationEventPublisher
applicationEventPublisher
;
@Resource
@Resource
...
...
src/main/java/cn/quantgroup/xyqb/service/user/impl/UserServiceImpl.java
View file @
dac85ae4
...
@@ -5,7 +5,10 @@ import cn.quantgroup.xyqb.aspect.lock.RedisLock;
...
@@ -5,7 +5,10 @@ import cn.quantgroup.xyqb.aspect.lock.RedisLock;
import
cn.quantgroup.xyqb.constant.enums.LoginType
;
import
cn.quantgroup.xyqb.constant.enums.LoginType
;
import
cn.quantgroup.xyqb.controller.IBaseController
;
import
cn.quantgroup.xyqb.controller.IBaseController
;
import
cn.quantgroup.xyqb.controller.internal.user.resp.UserFullResp
;
import
cn.quantgroup.xyqb.controller.internal.user.resp.UserFullResp
;
import
cn.quantgroup.xyqb.entity.*
;
import
cn.quantgroup.xyqb.entity.Merchant
;
import
cn.quantgroup.xyqb.entity.User
;
import
cn.quantgroup.xyqb.entity.UserDetail
;
import
cn.quantgroup.xyqb.entity.UserHashMapping
;
import
cn.quantgroup.xyqb.event.PhoneNoUpdateEvent
;
import
cn.quantgroup.xyqb.event.PhoneNoUpdateEvent
;
import
cn.quantgroup.xyqb.exception.DataException
;
import
cn.quantgroup.xyqb.exception.DataException
;
import
cn.quantgroup.xyqb.exception.UserNotExistException
;
import
cn.quantgroup.xyqb.exception.UserNotExistException
;
...
@@ -154,7 +157,6 @@ public class UserServiceImpl implements IUserService, IBaseController {
...
@@ -154,7 +157,6 @@ public class UserServiceImpl implements IUserService, IBaseController {
if
(
CollectionUtils
.
isEmpty
(
userIds
))
{
if
(
CollectionUtils
.
isEmpty
(
userIds
))
{
return
Maps
.
newHashMap
();
return
Maps
.
newHashMap
();
}
}
Map
<
Long
,
String
>
userIdAndPhoneMap
=
Maps
.
newHashMap
();
List
<
User
>
users
=
userRepository
.
findByIdIn
(
userIds
);
List
<
User
>
users
=
userRepository
.
findByIdIn
(
userIds
);
//校验租户ID
//校验租户ID
if
(!
TenantUtil
.
TENANT_DEFAULT
.
equals
(
tenantId
))
{
if
(!
TenantUtil
.
TENANT_DEFAULT
.
equals
(
tenantId
))
{
...
@@ -162,8 +164,7 @@ public class UserServiceImpl implements IUserService, IBaseController {
...
@@ -162,8 +164,7 @@ public class UserServiceImpl implements IUserService, IBaseController {
}
else
{
}
else
{
users
=
tenantService
.
validationTentIdByTentId
(
users
,
tenantId
);
users
=
tenantService
.
validationTentIdByTentId
(
users
,
tenantId
);
}
}
users
.
forEach
(
user
->
userIdAndPhoneMap
.
put
(
user
.
getId
(),
user
.
getPhoneNo
()));
return
users
.
stream
().
collect
(
Collectors
.
toMap
(
User:
:
getId
,
User:
:
getPhoneNo
));
return
userIdAndPhoneMap
;
}
}
@Override
@Override
...
@@ -213,7 +214,6 @@ public class UserServiceImpl implements IUserService, IBaseController {
...
@@ -213,7 +214,6 @@ public class UserServiceImpl implements IUserService, IBaseController {
}
}
@Override
@Override
// @Cacheable(value = "usercache", key = "'xyqbuser' + #phone", unless = "#result == null", cacheManager = "cacheManager")
public
User
findByPhoneWithCache
(
String
phone
)
{
public
User
findByPhoneWithCache
(
String
phone
)
{
if
(
StringUtils
.
isBlank
(
phone
))
{
if
(
StringUtils
.
isBlank
(
phone
))
{
return
null
;
return
null
;
...
@@ -510,33 +510,29 @@ public class UserServiceImpl implements IUserService, IBaseController {
...
@@ -510,33 +510,29 @@ public class UserServiceImpl implements IUserService, IBaseController {
@Override
@Override
public
List
<
User
>
findByUuidsOrUserIds
(
List
<
String
>
vals
,
Integer
type
,
Integer
tenantId
)
{
public
List
<
User
>
findByUuidsOrUserIds
(
List
<
String
>
vals
,
Integer
type
,
Integer
tenantId
)
{
if
(
CollectionUtils
.
isEmpty
(
vals
))
{
if
(
CollectionUtils
.
isEmpty
(
vals
))
{
return
Collections
.
EMPTY_LIST
;
return
new
ArrayList
<>()
;
}
}
List
<
User
>
users
;
if
(
type
==
1
)
{
//1是userids
if
(
type
==
1
)
{
//1是userids
List
<
Long
>
collect
=
vals
.
stream
()
List
<
Long
>
collect
=
vals
.
stream
()
.
map
(
Long:
:
valueOf
)
.
map
(
Long:
:
valueOf
)
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
List
<
User
>
users
=
userRepository
.
findByIdIn
(
collect
);
users
=
userRepository
.
findByIdIn
(
collect
);
if
(!
tenantId
.
equals
(
TenantUtil
.
TENANT_DEFAULT
))
{
return
tenantService
.
selectUsersByTenantId
(
users
,
tenantId
);
}
else
{
return
tenantService
.
validationTentIdByTentId
(
users
,
tenantId
);
}
}
else
{
//不是1 就是 uuids
}
else
{
//不是1 就是 uuids
List
<
User
>
users
=
userRepository
.
findByUuidIn
(
vals
);
users
=
userRepository
.
findByUuidIn
(
vals
);
}
if
(!
tenantId
.
equals
(
TenantUtil
.
TENANT_DEFAULT
))
{
if
(!
tenantId
.
equals
(
TenantUtil
.
TENANT_DEFAULT
))
{
return
tenantService
.
selectUsersByTenantId
(
users
,
tenantId
);
users
=
tenantService
.
selectUsersByTenantId
(
users
,
tenantId
);
}
else
{
}
else
{
return
tenantService
.
validationTentIdByTentId
(
users
,
tenantId
);
users
=
tenantService
.
validationTentIdByTentId
(
users
,
tenantId
);
}
}
}
return
users
;
}
}
@Override
@Override
public
void
logout
(
String
token
)
{
public
void
logout
(
String
token
)
{
sessionService
.
deleteSession
(
token
);
sessionService
.
deleteSession
(
token
);
}
}
...
@@ -616,6 +612,7 @@ public class UserServiceImpl implements IUserService, IBaseController {
...
@@ -616,6 +612,7 @@ public class UserServiceImpl implements IUserService, IBaseController {
/**
/**
* 不同渠道用户签署不同合同模板
* 不同渠道用户签署不同合同模板
*
* @param user
* @param user
* @param loginFrom
* @param loginFrom
*/
*/
...
@@ -627,7 +624,8 @@ public class UserServiceImpl implements IUserService, IBaseController {
...
@@ -627,7 +624,8 @@ public class UserServiceImpl implements IUserService, IBaseController {
if
(
Objects
.
nonNull
(
loginFrom
)
&&
Objects
.
equals
(
user
.
getRegisteredFrom
(),
loginFrom
))
{
if
(
Objects
.
nonNull
(
loginFrom
)
&&
Objects
.
equals
(
user
.
getRegisteredFrom
(),
loginFrom
))
{
return
;
return
;
}
}
Map
<
String
,
Long
>
channelMap
=
JSON
.
parseObject
(
channelTemplate
,
new
TypeReference
<
HashMap
<
String
,
Long
>>()
{});
Map
<
String
,
Long
>
channelMap
=
JSON
.
parseObject
(
channelTemplate
,
new
TypeReference
<
HashMap
<
String
,
Long
>>()
{
});
Long
templateId
=
channelMap
.
get
(
String
.
valueOf
(
user
.
getRegisteredFrom
()));
Long
templateId
=
channelMap
.
get
(
String
.
valueOf
(
user
.
getRegisteredFrom
()));
boolean
needCheck
=
false
;
boolean
needCheck
=
false
;
if
(
Objects
.
nonNull
(
loginFrom
)
&&
!
Objects
.
equals
(
user
.
getRegisteredFrom
(),
loginFrom
))
{
if
(
Objects
.
nonNull
(
loginFrom
)
&&
!
Objects
.
equals
(
user
.
getRegisteredFrom
(),
loginFrom
))
{
...
...
src/main/java/cn/quantgroup/xyqb/session/XyqbSessionContextHolder.java
View file @
dac85ae4
...
@@ -52,21 +52,16 @@ public class XyqbSessionContextHolder {
...
@@ -52,21 +52,16 @@ public class XyqbSessionContextHolder {
}
}
public
static
SessionStruct
getXSessionFromRedis
(
String
token
)
{
public
static
SessionStruct
getXSessionFromRedis
(
String
token
)
{
if
(
Objects
.
isNull
(
redisTemplate
))
{
return
null
;
}
String
linkToken
=
Constants
.
Session
.
USER_SESSION_CACHE
+
token
;
String
linkToken
=
Constants
.
Session
.
USER_SESSION_CACHE
+
token
;
String
result
=
redisTemplate
.
opsForValue
().
get
(
linkToken
);
String
result
=
redisTemplate
.
opsForValue
().
get
(
linkToken
);
if
(
StringUtils
.
isEmpty
(
result
))
{
if
(
StringUtils
.
isEmpty
(
result
))
{
log
.
warn
(
"[XyqbSessionContextHolder][getXSessionFromRedis] Tokekn:{},linkTokekn:{}"
,
token
,
linkToken
);
log
.
warn
(
"[XyqbSessionContextHolder][getXSessionFromRedis] session data 未找到:Tokekn:{},linkTokekn:{},sessionValue:{}"
,
token
,
linkToken
,
result
);
log
.
warn
(
"[XyqbSessionContextHolder][getXSessionFromRedis] session data 未找到:sid:{},sessionValue:{}"
,
token
,
result
);
return
null
;
return
null
;
}
}
try
{
try
{
SessionValue
values
=
JSON
.
parseObject
(
result
,
SessionValue
.
class
);
SessionValue
values
=
JSON
.
parseObject
(
result
,
SessionValue
.
class
);
if
(
values
==
null
)
{
if
(
values
==
null
)
{
log
.
warn
(
"[XyqbSessionContextHolder][getXSessionFromRedis] Tokekn:{},linkTokekn:{}"
,
token
,
linkToken
);
log
.
warn
(
"[XyqbSessionContextHolder][getXSessionFromRedis] session data 序列化失败:token:{},linkTokekn:{},sessionValue:{}"
,
token
,
linkToken
,
result
);
log
.
warn
(
"[XyqbSessionContextHolder][getXSessionFromRedis] session data 序列化失败:sid:{},sessionValue:{}"
,
token
,
result
);
return
null
;
return
null
;
}
}
SessionStruct
sessionStruct
=
new
SessionStruct
();
SessionStruct
sessionStruct
=
new
SessionStruct
();
...
@@ -75,8 +70,7 @@ public class XyqbSessionContextHolder {
...
@@ -75,8 +70,7 @@ public class XyqbSessionContextHolder {
sessionStruct
.
setExpire
(
redisTemplate
.
getExpire
(
Constants
.
Session
.
USER_SESSION_CACHE
+
token
));
sessionStruct
.
setExpire
(
redisTemplate
.
getExpire
(
Constants
.
Session
.
USER_SESSION_CACHE
+
token
));
return
sessionStruct
;
return
sessionStruct
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
warn
(
"[XyqbSessionContextHolder][getXSessionFromRedis] Tokekn:{},linkTokekn:{}"
,
token
,
linkToken
);
log
.
warn
(
"[XyqbSessionContextHolder][getXSessionFromRedis] 序列化SessionValue出错:Tokekn:{},linkTokekn:{},sessionValue:{}"
,
token
,
linkToken
,
result
,
e
);
log
.
warn
(
"[XyqbSessionContextHolder][getXSessionFromRedis] 序列化SessionValue出错:sid:{},sessionValue:{}"
,
token
,
result
,
e
);
return
null
;
return
null
;
}
}
}
}
...
...
src/main/java/cn/quantgroup/xyqb/util/BctyptPasswordUtil.java
View file @
dac85ae4
...
@@ -8,19 +8,14 @@ import java.util.Objects;
...
@@ -8,19 +8,14 @@ import java.util.Objects;
* Created by Miraculous on 15/7/5.
* Created by Miraculous on 15/7/5.
*/
*/
public
class
BctyptPasswordUtil
{
public
class
BctyptPasswordUtil
{
public
static
void
main
(
String
[]
args
)
{
public
static
String
BCryptWithSalt
(
String
password
)
{
System
.
out
.
println
(
BCryptWithSalt
(
"123456"
));
System
.
out
.
println
(
BCryptCheckPw
(
"123456"
,
BCryptWithSalt
(
"123456"
)));
}
public
final
static
String
BCryptWithSalt
(
String
password
)
{
if
(
Objects
.
isNull
(
password
)){
if
(
Objects
.
isNull
(
password
)){
return
null
;
return
null
;
}
}
return
BCrypt
.
hashpw
(
password
,
BCrypt
.
gensalt
());
return
BCrypt
.
hashpw
(
password
,
BCrypt
.
gensalt
());
}
}
public
final
static
Boolean
BCryptCheckPw
(
String
password
,
String
hashe
)
{
public
static
Boolean
BCryptCheckPw
(
String
password
,
String
hashe
)
{
return
BCrypt
.
checkpw
(
password
,
hashe
);
return
BCrypt
.
checkpw
(
password
,
hashe
);
}
}
...
...
src/main/java/cn/quantgroup/xyqb/util/DateUtils.java
View file @
dac85ae4
...
@@ -17,7 +17,6 @@ import java.util.Date;
...
@@ -17,7 +17,6 @@ import java.util.Date;
*/
*/
public
class
DateUtils
{
public
class
DateUtils
{
public
static
final
String
YMD_FORMAT
=
"yyyy-MM-dd"
;
public
static
final
String
YMD_HMS_FORMAT
=
"yyyy-MM-dd HH:mm:ss"
;
public
static
final
String
YMD_HMS_FORMAT
=
"yyyy-MM-dd HH:mm:ss"
;
/**
/**
...
...
src/main/java/cn/quantgroup/xyqb/util/RedisLock.java
View file @
dac85ae4
...
@@ -26,7 +26,7 @@ import java.util.Random;
...
@@ -26,7 +26,7 @@ import java.util.Random;
*/
*/
@Slf4j
@Slf4j
public
class
RedisLock
{
public
class
RedisLock
{
private
RedisTemplate
redisTemplate
;
private
final
RedisTemplate
redisTemplate
;
/**
/**
* Lock key path.
* Lock key path.
*/
*/
...
...
src/main/java/cn/quantgroup/xyqb/util/ServerUtils.java
View file @
dac85ae4
...
@@ -53,17 +53,4 @@ public abstract class ServerUtils {
...
@@ -53,17 +53,4 @@ public abstract class ServerUtils {
return
port
==
null
||
port
.
equals
(
""
)
?
null
:
Integer
.
valueOf
(
port
);
return
port
==
null
||
port
.
equals
(
""
)
?
null
:
Integer
.
valueOf
(
port
);
}
}
public
static
Integer
getIntegerPort
()
throws
MalformedObjectNameException
{
return
getIntegerPort
(
null
);
}
public
static
void
main
(
String
[]
args
)
{
try
{
System
.
out
.
println
(
ServerUtils
.
getLongHostAddress
());
}
catch
(
UnknownHostException
e
)
{
e
.
printStackTrace
();
}
}
}
}
src/main/java/cn/quantgroup/xyqb/util/SnowflakeIdentitySequencer.java
View file @
dac85ae4
...
@@ -99,45 +99,4 @@ public class SnowflakeIdentitySequencer implements IdentitySequencer {
...
@@ -99,45 +99,4 @@ public class SnowflakeIdentitySequencer implements IdentitySequencer {
", workerId="
+
workerId
+
", workerId="
+
workerId
+
'}'
;
'}'
;
}
}
public
static
void
main
(
String
[]
args
)
{
SnowflakeIdentitySequencer
snowflakeIdWorker
=
new
SnowflakeIdentitySequencer
(
255255255255L
^
8000
,
8
);
// SnowflakeIdentitySequencer snowflakeIdWorker = new SnowflakeIdentitySequencer(1099511627775L, 8, TWEPOCH_PLUS);
// SnowflakeIdWorker snowflakeIdWorker = new SnowflakeIdWorker(255255255255L, 16, 8);
// SnowflakeIdWorker snowflakeIdWorker = new SnowflakeIdWorker(255255255255L, 16, 8);
// SnowflakeIdWorker snowflakeIdWorker = new SnowflakeIdWorker(17202801560208L);
Long
nextId
=
snowflakeIdWorker
.
nextId
(
245
);
System
.
out
.
println
(
nextId
);
// for(int i=0; i<300;i++){
// System.out.println(i+":"+(i&255));
// }
// for (int i = 0; i < 100; i++) {
// new Thread(new Running(snowflakeIdWorker)).start();
// }
// System.out.println(73361139375145112L ^ (73361139375145112L >> 8 << 8));
// System.out.println((nextId >> 8 << 8) ^ nextId);
// for (int i = 0; i < 10000; i++) {
// System.out.println(snowflakeIdWorker.nextId());
// }
}
public
static
class
Running
implements
Runnable
{
SnowflakeIdentitySequencer
sequencer
;
public
Running
(
SnowflakeIdentitySequencer
sequencer
)
{
this
.
sequencer
=
sequencer
;
}
@Override
public
void
run
()
{
System
.
out
.
println
(
this
.
sequencer
.
nextId
(
255
));
}
}
}
}
src/main/java/cn/quantgroup/xyqb/util/StringUtils.java
View file @
dac85ae4
...
@@ -10,16 +10,10 @@ import org.slf4j.helpers.MessageFormatter;
...
@@ -10,16 +10,10 @@ import org.slf4j.helpers.MessageFormatter;
import
java.io.Serializable
;
import
java.io.Serializable
;
public
class
StringUtils
extends
org
.
springframework
.
util
.
StringUtils
{
public
class
StringUtils
extends
org
.
springframework
.
util
.
StringUtils
{
public
static
final
char
DELIMITED_ID_SEP
=
'$'
;
public
static
final
char
DELIMITED_ID_WCHAR
=
'*'
;
public
StringUtils
()
{
public
StringUtils
()
{
}
}
public
static
String
defaultIfNull
(
String
object
,
String
defaultValue
)
{
return
object
==
null
?
defaultValue
:
object
;
}
public
static
<
T
extends
Serializable
>
String
toDelimitedString
(
T
...
ids
)
{
public
static
<
T
extends
Serializable
>
String
toDelimitedString
(
T
...
ids
)
{
return
toDelimitedString
(
'$'
,
ids
);
return
toDelimitedString
(
'$'
,
ids
);
}
}
...
@@ -49,8 +43,5 @@ public class StringUtils extends org.springframework.util.StringUtils {
...
@@ -49,8 +43,5 @@ public class StringUtils extends org.springframework.util.StringUtils {
return
builder
.
toString
();
return
builder
.
toString
();
}
}
public
static
String
format
(
String
msg
,
Object
...
args
)
{
return
MessageFormatter
.
arrayFormat
(
msg
,
args
).
getMessage
();
}
}
}
src/main/java/cn/quantgroup/xyqb/util/TenantUtil.java
View file @
dac85ae4
...
@@ -4,7 +4,6 @@ public class TenantUtil {
...
@@ -4,7 +4,6 @@ public class TenantUtil {
/* 租户羊小咩 */
/* 租户羊小咩 */
public
static
final
Integer
TENANT_DEFAULT
=
560761
;
public
static
final
Integer
TENANT_DEFAULT
=
560761
;
public
static
final
String
TENANT_USER_ERROR
=
"该租户下未找到此用户"
;
/* 验证租户ID是否为空或0 */
/* 验证租户ID是否为空或0 */
public
static
boolean
validationTenantIdIsNullOrZero
(
Integer
tenantId
)
{
public
static
boolean
validationTenantIdIsNullOrZero
(
Integer
tenantId
)
{
...
...
src/main/java/cn/quantgroup/xyqb/util/XxlJobSpringExecutor.java
0 → 100644
View file @
dac85ae4
package
cn
.
quantgroup
.
xyqb
.
util
;
import
com.xxl.job.core.executor.XxlJobExecutor
;
import
com.xxl.job.core.handler.IJobHandler
;
import
com.xxl.job.core.handler.annotation.JobHandler
;
import
org.springframework.beans.BeansException
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContextAware
;
import
java.util.Iterator
;
import
java.util.Map
;
public
class
XxlJobSpringExecutor
extends
XxlJobExecutor
implements
ApplicationContextAware
{
private
static
ApplicationContext
applicationContext
;
public
void
start
()
throws
Exception
{
this
.
initJobHandlerRepository
(
applicationContext
);
super
.
start
();
}
private
void
initJobHandlerRepository
(
ApplicationContext
applicationContext
)
{
if
(
applicationContext
!=
null
)
{
Map
<
String
,
Object
>
serviceBeanMap
=
applicationContext
.
getBeansWithAnnotation
(
JobHandler
.
class
);
if
(
serviceBeanMap
!=
null
&&
serviceBeanMap
.
size
()
>
0
)
{
Iterator
var3
=
serviceBeanMap
.
values
().
iterator
();
while
(
var3
.
hasNext
())
{
Object
serviceBean
=
var3
.
next
();
if
(
serviceBean
instanceof
IJobHandler
)
{
String
name
=
((
JobHandler
)
serviceBean
.
getClass
().
getAnnotation
(
JobHandler
.
class
))
.
value
();
IJobHandler
handler
=
(
IJobHandler
)
serviceBean
;
if
(
loadJobHandler
(
name
)
!=
null
)
{
throw
new
RuntimeException
(
"xxl-job jobhandler naming conflicts."
);
}
registJobHandler
(
name
,
handler
);
}
}
}
}
}
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
throws
BeansException
{
XxlJobSpringExecutor
.
applicationContext
=
applicationContext
;
}
public
static
ApplicationContext
getApplicationContext
()
{
return
applicationContext
;
}
}
src/main/java/cn/quantgroup/xyqb/validator/IdCard.java
deleted
100644 → 0
View file @
5b8ef268
package
cn
.
quantgroup
.
xyqb
.
validator
;
import
javax.validation.Constraint
;
import
javax.validation.Payload
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
/**
* @author 徐小光
*/
@Target
({
ElementType
.
FIELD
,
ElementType
.
PARAMETER
})
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Constraint
(
validatedBy
=
IdCardValidator
.
class
)
public
@interface
IdCard
{
/**
* 出错提示
*
* @return
*/
String
message
()
default
"身份证号码错误"
;
/**
* 啥玩意?
*
* @return
*/
Class
<?>[]
groups
()
default
{};
Class
<?
extends
Payload
>[]
payload
()
default
{};
}
src/main/java/cn/quantgroup/xyqb/validator/IdCardValidator.java
deleted
100644 → 0
View file @
5b8ef268
package
cn
.
quantgroup
.
xyqb
.
validator
;
import
cn.quantgroup.xyqb.util.IdcardValidator
;
import
org.apache.commons.lang3.StringUtils
;
import
javax.validation.ConstraintValidator
;
import
javax.validation.ConstraintValidatorContext
;
/**
* 身份证验证器, <IdCard,String> String 对应的是可以对哪些类型校验
*
* @author 徐小光
*/
public
class
IdCardValidator
implements
ConstraintValidator
<
IdCard
,
String
>
{
/**
* 这个方法在初始化的时候调用. 如果配置错了, 你可以抛一个异常. 启动就报错了
*
* @param constraint
*/
@Override
public
void
initialize
(
IdCard
constraint
)
{
}
/**
* 这....true = 校验通过. false = 校验失败
*
* @param idCard 就是那个String
* @param context
* @return
*/
@Override
public
boolean
isValid
(
String
idCard
,
ConstraintValidatorContext
context
)
{
if
(
StringUtils
.
isNotBlank
(
idCard
))
{
return
IdcardValidator
.
isValidate18Idcard
(
idCard
);
}
return
true
;
}
}
src/main/java/cn/quantgroup/xyqb/xxlJob/XxlJobConfig.java
View file @
dac85ae4
package
cn
.
quantgroup
.
xyqb
.
xxlJob
;
package
cn
.
quantgroup
.
xyqb
.
xxlJob
;
import
c
om.xxl.job.core.executor.imp
l.XxlJobSpringExecutor
;
import
c
n.quantgroup.xyqb.uti
l.XxlJobSpringExecutor
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
...
@@ -32,7 +32,7 @@ public class XxlJobConfig {
...
@@ -32,7 +32,7 @@ public class XxlJobConfig {
@Bean
(
initMethod
=
"start"
,
destroyMethod
=
"destroy"
)
@Bean
(
initMethod
=
"start"
,
destroyMethod
=
"destroy"
)
public
XxlJobSpringExecutor
xxlJobExecutor
()
{
public
XxlJobSpringExecutor
xxlJob
Spring
Executor
()
{
log
.
info
(
">>>>>>>>>>> xxl-job config init."
);
log
.
info
(
">>>>>>>>>>> xxl-job config init."
);
XxlJobSpringExecutor
xxlJobSpringExecutor
=
new
XxlJobSpringExecutor
();
XxlJobSpringExecutor
xxlJobSpringExecutor
=
new
XxlJobSpringExecutor
();
...
...
src/test/java/common/JsonTest.java
View file @
dac85ae4
...
@@ -8,7 +8,6 @@ import com.alibaba.fastjson.serializer.SerializerFeature;
...
@@ -8,7 +8,6 @@ import com.alibaba.fastjson.serializer.SerializerFeature;
import
com.fasterxml.jackson.databind.DeserializationFeature
;
import
com.fasterxml.jackson.databind.DeserializationFeature
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.SerializationFeature
;
import
com.fasterxml.jackson.databind.SerializationFeature
;
import
com.google.gson.Gson
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.codec.binary.Base64
;
import
org.apache.commons.codec.binary.Base64
;
import
org.junit.Test
;
import
org.junit.Test
;
...
@@ -20,7 +19,6 @@ import java.sql.Timestamp;
...
@@ -20,7 +19,6 @@ import java.sql.Timestamp;
@Slf4j
@Slf4j
@RunWith
(
JUnit4
.
class
)
@RunWith
(
JUnit4
.
class
)
public
class
JsonTest
{
public
class
JsonTest
{
private
static
final
Gson
GSON
=
new
Gson
();
private
static
final
ObjectMapper
MAPPER
=
new
ObjectMapper
()
private
static
final
ObjectMapper
MAPPER
=
new
ObjectMapper
()
.
configure
(
DeserializationFeature
.
FAIL_ON_UNKNOWN_PROPERTIES
,
false
)
.
configure
(
DeserializationFeature
.
FAIL_ON_UNKNOWN_PROPERTIES
,
false
)
.
configure
(
SerializationFeature
.
WRITE_ENUMS_USING_INDEX
,
true
)
.
configure
(
SerializationFeature
.
WRITE_ENUMS_USING_INDEX
,
true
)
...
@@ -34,7 +32,7 @@ public class JsonTest {
...
@@ -34,7 +32,7 @@ public class JsonTest {
userData
.
setId
(
131L
);
userData
.
setId
(
131L
);
userData
.
setUserId
(
119L
);
userData
.
setUserId
(
119L
);
userData
.
setCreatedAt
(
new
Timestamp
(
1
));
userData
.
setCreatedAt
(
new
Timestamp
(
1
));
log
.
info
(
"序列化--GSON--成功!data:{}"
,
GSON
.
toJson
(
userData
));
log
.
info
(
"序列化--GSON--成功!data:{}"
,
JSON
.
toJSONString
(
userData
));
log
.
info
(
"序列化--MAPPER--成功!data:{}"
,
MAPPER
.
writeValueAsString
(
userData
));
log
.
info
(
"序列化--MAPPER--成功!data:{}"
,
MAPPER
.
writeValueAsString
(
userData
));
log
.
info
(
"序列化--JSON--成功!data:{}"
,
JSON
.
toJSONString
(
userData
,
SerializerFeature
.
config
(
JSON
.
DEFAULT_GENERATE_FEATURE
,
SerializerFeature
.
WriteEnumUsingName
,
false
)));
log
.
info
(
"序列化--JSON--成功!data:{}"
,
JSON
.
toJSONString
(
userData
,
SerializerFeature
.
config
(
JSON
.
DEFAULT_GENERATE_FEATURE
,
SerializerFeature
.
WriteEnumUsingName
,
false
)));
log
.
info
(
"序列化--JSONObject--成功!data:{}"
,
JSONObject
.
toJSONString
(
userData
));
log
.
info
(
"序列化--JSONObject--成功!data:{}"
,
JSONObject
.
toJSONString
(
userData
));
...
@@ -46,7 +44,7 @@ public class JsonTest {
...
@@ -46,7 +44,7 @@ public class JsonTest {
@Test
@Test
public
void
gsonGson
(){
public
void
gsonGson
(){
try
{
try
{
UserDetail
userData
=
GSON
.
fromJson
(
body
,
UserDetail
.
class
);
UserDetail
userData
=
JSON
.
parseObject
(
body
,
UserDetail
.
class
);
log
.
info
(
"GSON--成功!data:{}"
,
userData
);
log
.
info
(
"GSON--成功!data:{}"
,
userData
);
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
log
.
error
(
"GSON--失败!"
,
e
);
log
.
error
(
"GSON--失败!"
,
e
);
...
...
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