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
80a545ab
Commit
80a545ab
authored
Nov 15, 2021
by
gaoguangjing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
校验是否为空,不为空执行
parent
9b7f907d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
48 deletions
+50
-48
OauthLoginInfoServiceImpl.java
...oup/xyqb/service/user/impl/OauthLoginInfoServiceImpl.java
+50
-48
No files found.
src/main/java/cn/quantgroup/xyqb/service/user/impl/OauthLoginInfoServiceImpl.java
View file @
80a545ab
...
...
@@ -42,58 +42,60 @@ public class OauthLoginInfoServiceImpl implements IOauthLoginInfoService {
public
void
addLoginInfo
(
User
user
,
String
tenantId
)
{
System
.
out
.
println
(
atomicSequencer
.
nextId
());
OauthClientDetailsEntity
oauthClientDetailsEntity
=
oauthClientDetailsRepository
.
findFirstByClientId
(
tenantId
);
String
institutionId
=
oauthClientDetailsEntity
.
getInstitutionId
();
String
productId
=
oauthClientDetailsEntity
.
getProductId
();
String
phoneNo
=
user
.
getPhoneNo
();
Long
userId
=
user
.
getId
();
ProductLoginEntity
productLoginEntity
=
productLoginRepository
.
findFirstByInstitutionIdAndProductIdAndPhoneNo
(
institutionId
,
productId
,
phoneNo
);
long
uuid
=
0L
;
// 如果找不到该用户就创建
if
(
""
.
equals
(
productLoginEntity
)
||
productLoginEntity
==
null
)
{
// 添加用户到产品登录表
long
customerId
=
atomicSequencer
.
nextId
();
if
(
oauthClientDetailsEntity
!=
null
)
{
String
institutionId
=
oauthClientDetailsEntity
.
getInstitutionId
();
String
productId
=
oauthClientDetailsEntity
.
getProductId
();
String
phoneNo
=
user
.
getPhoneNo
();
Long
userId
=
user
.
getId
();
ProductLoginEntity
productLoginEntity
=
productLoginRepository
.
findFirstByInstitutionIdAndProductIdAndPhoneNo
(
institutionId
,
productId
,
phoneNo
);
long
uuid
=
0L
;
// 如果找不到该用户就创建
if
(
""
.
equals
(
productLoginEntity
)
||
productLoginEntity
==
null
)
{
// 添加用户到产品登录表
long
customerId
=
atomicSequencer
.
nextId
();
// long id = session.nextId();
long
id
=
atomicSequencer
.
nextId
();
String
customerName
=
customerId
+
""
;
uuid
=
RandomSequencer
.
randomUUID
(
customerId
);
ProductLoginEntity
entity
=
new
ProductLoginEntity
();
Integer
partitionKey
=
atomicSequencer
.
partitionKey
(
customerId
);
productLoginEntity
=
EntityBuilder
.
productLogin
(
productId
,
institutionId
,
phoneNo
,
customerId
,
customerName
,
partitionKey
,
id
);
productLoginEntity
.
setExtensionAccountId
(
userId
);
productLoginRepository
.
save
(
productLoginEntity
);
// 根据customerId 获取uuid
CustomerLoginEntity
customerLoginEntity
=
customerLoginRepository
.
findFirstByCustomerId
(
productLoginEntity
.
getCustomerId
());
if
(
null
!=
customerLoginEntity
)
{
uuid
=
customerLoginEntity
.
getUuid
();
}
long
id
=
atomicSequencer
.
nextId
();
String
customerName
=
customerId
+
""
;
uuid
=
RandomSequencer
.
randomUUID
(
customerId
);
ProductLoginEntity
entity
=
new
ProductLoginEntity
();
Integer
partitionKey
=
atomicSequencer
.
partitionKey
(
customerId
);
productLoginEntity
=
EntityBuilder
.
productLogin
(
productId
,
institutionId
,
phoneNo
,
customerId
,
customerName
,
partitionKey
,
id
);
productLoginEntity
.
setExtensionAccountId
(
userId
);
productLoginRepository
.
save
(
productLoginEntity
);
// 根据customerId 获取uuid
CustomerLoginEntity
customerLoginEntity
=
customerLoginRepository
.
findFirstByCustomerId
(
productLoginEntity
.
getCustomerId
());
if
(
null
!=
customerLoginEntity
)
{
uuid
=
customerLoginEntity
.
getUuid
();
}
// 添加用户到登录表
CustomerLoginEntity
customerLogin
=
new
CustomerLoginEntity
();
customerLogin
.
setId
(
atomicSequencer
.
nextId
());
customerLogin
.
setInstitutionId
(
institutionId
);
customerLogin
.
setProductId
(
productId
);
customerLogin
.
setCustomerId
(
customerId
);
customerLogin
.
setUuid
(
uuid
);
customerLogin
.
setPartitionKey
(
partitionKey
);
customerLogin
.
setCreatedDate
(
new
Date
());
customerLogin
.
setModifiedDate
(
new
Date
());
customerLogin
.
setCreatedBy
(
""
);
customerLogin
.
setModifiedBy
(
""
);
customerLoginRepository
.
save
(
customerLogin
);
// 添加用户到登录表
CustomerLoginEntity
customerLogin
=
new
CustomerLoginEntity
();
customerLogin
.
setId
(
atomicSequencer
.
nextId
());
customerLogin
.
setInstitutionId
(
institutionId
);
customerLogin
.
setProductId
(
productId
);
customerLogin
.
setCustomerId
(
customerId
);
customerLogin
.
setUuid
(
uuid
);
customerLogin
.
setPartitionKey
(
partitionKey
);
customerLogin
.
setCreatedDate
(
new
Date
());
customerLogin
.
setModifiedDate
(
new
Date
());
customerLogin
.
setCreatedBy
(
""
);
customerLogin
.
setModifiedBy
(
""
);
customerLoginRepository
.
save
(
customerLogin
);
// 添加用户信息表
CustomerInfoEntity
customerInfo
=
new
CustomerInfoEntity
();
customerInfo
.
setId
(
atomicSequencer
.
nextId
());
customerInfo
.
setCustomerId
(
customerId
);
customerInfo
.
setInstitutionId
(
institutionId
);
customerInfo
.
setProductId
(
productId
);
customerInfo
.
setPartitionKey
(
partitionKey
);
customerInfo
.
setCreatedDate
(
new
Date
());
customerInfo
.
setModifiedDate
(
new
Date
());
customerInfo
.
setCreatedBy
(
""
);
customerInfo
.
setModifiedBy
(
""
);
customerInfoRepository
.
save
(
customerInfo
);
// 添加用户信息表
CustomerInfoEntity
customerInfo
=
new
CustomerInfoEntity
();
customerInfo
.
setId
(
atomicSequencer
.
nextId
());
customerInfo
.
setCustomerId
(
customerId
);
customerInfo
.
setInstitutionId
(
institutionId
);
customerInfo
.
setProductId
(
productId
);
customerInfo
.
setPartitionKey
(
partitionKey
);
customerInfo
.
setCreatedDate
(
new
Date
());
customerInfo
.
setModifiedDate
(
new
Date
());
customerInfo
.
setCreatedBy
(
""
);
customerInfo
.
setModifiedBy
(
""
);
customerInfoRepository
.
save
(
customerInfo
);
}
}
}
...
...
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