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
167f9a2c
Commit
167f9a2c
authored
Jun 15, 2023
by
王亮
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove unused code.
parent
4c80cacd
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
7 deletions
+21
-7
pom.xml
pom.xml
+1
-1
OauthClientDetailsServiceImpl.java
...xyqb/service/user/impl/OauthClientDetailsServiceImpl.java
+15
-2
OauthLoginInfoServiceImpl.java
...oup/xyqb/service/user/impl/OauthLoginInfoServiceImpl.java
+5
-4
No files found.
pom.xml
View file @
167f9a2c
...
...
@@ -341,7 +341,7 @@
<dependency>
<groupId>
com.github.ben-manes.caffeine
</groupId>
<artifactId>
caffeine
</artifactId>
<version>
3.1.6
</version>
<version>
2.9.3
</version>
</dependency>
</dependencies>
...
...
src/main/java/cn/quantgroup/xyqb/service/user/impl/OauthClientDetailsServiceImpl.java
View file @
167f9a2c
...
...
@@ -4,12 +4,15 @@ import cn.quantgroup.xyqb.entity.OauthClientDetailsEntity;
import
cn.quantgroup.xyqb.entity.ProductLoginEntity
;
import
cn.quantgroup.xyqb.repository.IOauthClientDetailsRepository
;
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
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.concurrent.TimeUnit
;
/**
* Created by 11 on 2016/12/29.
...
...
@@ -18,12 +21,22 @@ import java.util.List;
@Service
public
class
OauthClientDetailsServiceImpl
implements
IOauthClientDetailsService
{
@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
public
OauthClientDetailsEntity
findFirstByClientId
(
Integer
clientId
)
{
return
oauthClientDetailsRepository
.
findFirstByClientId
(
clientId
);
return
cache
.
get
(
clientId
);
}
@Override
...
...
src/main/java/cn/quantgroup/xyqb/service/user/impl/OauthLoginInfoServiceImpl.java
View file @
167f9a2c
...
...
@@ -6,6 +6,7 @@ import cn.quantgroup.xyqb.repository.ICustomerInfoRepository;
import
cn.quantgroup.xyqb.repository.ICustomerLoginRepository
;
import
cn.quantgroup.xyqb.repository.IOauthClientDetailsRepository
;
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.IProductLoginService
;
import
cn.quantgroup.xyqb.util.AtomicSequencer
;
...
...
@@ -25,7 +26,7 @@ import java.util.Date;
@Service
public
class
OauthLoginInfoServiceImpl
implements
IOauthLoginInfoService
{
@Autowired
private
IOauthClientDetails
Repository
oauthClientDetailsRepository
;
private
IOauthClientDetails
Service
oauthClientDetailsService
;
@Autowired
private
IProductLoginRepository
productLoginRepository
;
...
...
@@ -45,7 +46,7 @@ public class OauthLoginInfoServiceImpl implements IOauthLoginInfoService {
@Override
@Transactional
(
propagation
=
Propagation
.
REQUIRES_NEW
,
rollbackFor
=
Exception
.
class
)
public
void
addLoginInfo
(
User
user
,
Integer
tenantId
)
{
OauthClientDetailsEntity
oauthClientDetailsEntity
=
oauthClientDetails
Repository
.
findFirstByClientId
(
tenantId
);
OauthClientDetailsEntity
oauthClientDetailsEntity
=
oauthClientDetails
Service
.
findFirstByClientId
(
tenantId
);
if
(
oauthClientDetailsEntity
!=
null
)
{
String
institutionId
=
oauthClientDetailsEntity
.
getInstitutionId
();
String
productId
=
oauthClientDetailsEntity
.
getProductId
();
...
...
@@ -104,7 +105,7 @@ public class OauthLoginInfoServiceImpl implements IOauthLoginInfoService {
@Override
@Transactional
(
propagation
=
Propagation
.
REQUIRES_NEW
)
public
void
addRegisterInfo
(
User
user
,
AppletParamEntry
appletParamEntry
)
{
OauthClientDetailsEntity
oauthClientDetailsEntity
=
oauthClientDetails
Repository
.
findFirstByClientId
(
appletParamEntry
.
getTenantId
());
OauthClientDetailsEntity
oauthClientDetailsEntity
=
oauthClientDetails
Service
.
findFirstByClientId
(
appletParamEntry
.
getTenantId
());
if
(
oauthClientDetailsEntity
!=
null
)
{
String
institutionId
=
oauthClientDetailsEntity
.
getInstitutionId
();
String
productId
=
oauthClientDetailsEntity
.
getProductId
();
...
...
@@ -113,7 +114,7 @@ public class OauthLoginInfoServiceImpl implements IOauthLoginInfoService {
ProductLoginEntity
productLoginEntity
=
productLoginService
.
findTenantAndPhoneNo
(
institutionId
,
productId
,
phoneNo
);
long
uuid
=
0L
;
// 如果找不到该用户就创建
if
(
""
.
equals
(
productLoginEntity
)
||
productLoginEntity
==
null
)
{
if
(
productLoginEntity
==
null
)
{
// 添加用户到产品登录表
long
customerId
=
atomicSequencer
.
nextId
();
long
id
=
atomicSequencer
.
nextId
();
...
...
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