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
c629cc5a
Commit
c629cc5a
authored
Jan 16, 2019
by
xiaoguang.xu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复userDetail 小写身份证数据244303个
parent
21e49667
Pipeline
#943
failed with stages
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
4 deletions
+27
-4
SyncHashController.java
...antgroup/xyqb/controller/external/SyncHashController.java
+27
-4
No files found.
src/main/java/cn/quantgroup/xyqb/controller/external/SyncHashController.java
View file @
c629cc5a
...
...
@@ -2,6 +2,8 @@ package cn.quantgroup.xyqb.controller.external;
import
cn.quantgroup.xyqb.entity.UserDetail
;
import
cn.quantgroup.xyqb.entity.UserHashMapping
;
import
cn.quantgroup.xyqb.model.Gender
;
import
cn.quantgroup.xyqb.model.IdType
;
import
cn.quantgroup.xyqb.model.JsonResult
;
import
cn.quantgroup.xyqb.repository.IUserDetailRepository
;
import
cn.quantgroup.xyqb.util.encrypt.MD5Util
;
...
...
@@ -53,16 +55,37 @@ public class SyncHashController {
while
(
isContinue
)
{
Stopwatch
started
=
Stopwatch
.
createStarted
();
Long
endPosition
=
startPosition
+
step
;
List
<
UserDetail
>
userDetails
=
userDetailRepository
.
findByIdBetween
(
startPosition
,
endPosition
);
String
sql
=
"select * from `user_detail` u where u.`id_no` like binary '%x' and u.id >= "
+
startPosition
+
" and u.id < "
+
endPosition
;
List
<
UserDetail
>
userDetails
=
jdbcTemplate
.
query
(
sql
,
(
rs
,
rowNum
)
->
{
UserDetail
userDetail
=
new
UserDetail
();
userDetail
.
setId
(
rs
.
getLong
(
"id"
));
userDetail
.
setUserId
(
rs
.
getLong
(
"user_id"
));
userDetail
.
setPhoneNo
(
rs
.
getString
(
"phone_no"
));
userDetail
.
setName
(
rs
.
getString
(
"name"
));
userDetail
.
setIdNo
(
rs
.
getString
(
"id_no"
));
userDetail
.
setIdType
(
IdType
.
values
()[
rs
.
getInt
(
"id_type"
)]);
userDetail
.
setIsAuthenticated
(
rs
.
getInt
(
"is_authenticated"
)
==
1
);
userDetail
.
setGender
(
Gender
.
values
()[
rs
.
getInt
(
"gender"
)]);
userDetail
.
setEmail
(
rs
.
getString
(
"email"
));
userDetail
.
setQq
(
rs
.
getString
(
"qq"
));
userDetail
.
setCreatedAt
(
rs
.
getTimestamp
(
"created_at"
));
userDetail
.
setUpdatedAt
(
rs
.
getTimestamp
(
"updated_at"
));
return
userDetail
;
});
if
(
userDetails
.
isEmpty
())
{
startPosition
=
endPosition
;
if
(
endPosition
>
49434765L
)
{
log
.
info
(
"没有数据了. 结束了"
);
return
;
}
continue
;
}
log
.
info
(
"查询用户需要的时间 : {}ms"
,
started
.
elapsed
(
TimeUnit
.
MILLISECONDS
));
List
<
UserHashMapping
>
userHashMappings
=
new
ArrayList
<>();
userDetails
.
forEach
(
userDetail
->
{
String
idNo
=
userDetail
.
getIdNo
();
if
(
idNo
!=
null
)
{
userDetail
.
setIdNo
(
idNo
.
toUpperCase
());
UserHashMapping
userHashMapping
=
new
UserHashMapping
();
userHashMapping
.
setUserId
(
userDetail
.
getUserId
());
userHashMapping
.
setIdNoMd5
(
MD5Util
.
build
(
userDetail
.
getIdNo
()));
...
...
@@ -84,7 +107,7 @@ public class SyncHashController {
jdbcTemplate
.
execute
(
sbSql
.
toString
());
// StringUtils.trimWhitespace()
userDetailRepository
.
save
(
userDetails
);
log
.
info
(
"batchUpdate需要的时间 : {}ms"
,
started
.
elapsed
(
TimeUnit
.
MILLISECONDS
));
...
...
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