Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qg-bl-service
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
data-spider
qg-bl-service
Commits
a95173dd
Commit
a95173dd
authored
Apr 14, 2020
by
郝彦辉
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
方法update_huiTohei_type2,type=2的灰洗黑
parent
cd40bbbd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
190 additions
and
5 deletions
+190
-5
BlackListToolsManagerServiceImpl.java
...ervice/service/impl/BlackListToolsManagerServiceImpl.java
+190
-5
No files found.
src/main/java/cn/quantgroup/qgblservice/service/impl/BlackListToolsManagerServiceImpl.java
View file @
a95173dd
...
@@ -5,6 +5,7 @@ import cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.BlackListCh
...
@@ -5,6 +5,7 @@ import cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.BlackListCh
import
cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.BlackListQueryTidbVo0
;
import
cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.BlackListQueryTidbVo0
;
import
cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.TmpBlackGreyList
;
import
cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.TmpBlackGreyList
;
import
cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.TmpBlackGreyListRowMapper
;
import
cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.TmpBlackGreyListRowMapper
;
import
cn.quantgroup.qgblservice.repository.mybatis.entity.xyqbuser.XyqbUser
;
import
cn.quantgroup.qgblservice.response.GlobalResponse
;
import
cn.quantgroup.qgblservice.response.GlobalResponse
;
import
cn.quantgroup.qgblservice.service.IBlackListToolsManagerService
;
import
cn.quantgroup.qgblservice.service.IBlackListToolsManagerService
;
import
cn.quantgroup.qgblservice.utils.MD5Util
;
import
cn.quantgroup.qgblservice.utils.MD5Util
;
...
@@ -481,7 +482,10 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS
...
@@ -481,7 +482,10 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS
//updat_idNoIsPhone(sql_query, sql_update, "2");
//updat_idNoIsPhone(sql_query, sql_update, "2");
}
}
else
if
(
"update_huiTohei_type1"
.
equals
(
operatType
)){
else
if
(
"update_huiTohei_type1"
.
equals
(
operatType
)){
update_huiTohei_type1
();
// update_huiTohei_type1();
}
else
if
(
"update_huiTohei_type2"
.
equals
(
operatType
)){
update_huiTohei_type2
();
}
}
...
@@ -790,7 +794,7 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS
...
@@ -790,7 +794,7 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS
" WHERE t.black_type='2' AND t.type='1'"
+
" WHERE t.black_type='2' AND t.type='1'"
+
" AND id > ? AND id<=?;"
;
" AND id > ? AND id<=?;"
;
//xyqb
User
JdbcTemplate
//xyqbJdbcTemplate
String
sql_xyqb_query_type1
=
"select count(distinct a.user_id) in_overdue "
+
String
sql_xyqb_query_type1
=
"select count(distinct a.user_id) in_overdue "
+
"from repayment_plan a "
+
"from repayment_plan a "
+
"left join loan_application_manifest_history b "
+
"left join loan_application_manifest_history b "
+
...
@@ -826,7 +830,7 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS
...
@@ -826,7 +830,7 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS
startId
=
(
page
-
1
)
*
LIMIT_1000
;
startId
=
(
page
-
1
)
*
LIMIT_1000
;
endId
=
page
*
LIMIT_1000
;
endId
=
page
*
LIMIT_1000
;
long
startUtc
=
System
.
currentTimeMillis
();
long
thisPageStart
=
System
.
currentTimeMillis
();
List
<
TmpBlackGreyList
>
updateBeanList
=
null
;
List
<
TmpBlackGreyList
>
updateBeanList
=
null
;
int
thisPageOk
=
0
;
int
thisPageOk
=
0
;
...
@@ -934,7 +938,7 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS
...
@@ -934,7 +938,7 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS
//e.printStackTrace();
//e.printStackTrace();
log
.
error
(
"update_huiTohei_type1()处理异常, page: {} , startId: {} , endId: {} "
,
page
,
startId
,
endId
,
e
);
log
.
error
(
"update_huiTohei_type1()处理异常, page: {} , startId: {} , endId: {} "
,
page
,
startId
,
endId
,
e
);
}
finally
{
}
finally
{
log
.
info
(
"update_huiTohei_type1()处理结束 page: {} , startId: {} , endId: {} , updateBeanList: {} , thisPageOk: {}
<<<<<<------\n"
,
page
,
startId
,
endId
,
(
updateBeanList
!=
null
?
updateBeanList
.
size
():
0
),
thisPageOk
,
((
System
.
currentTimeMillis
()-
startUtc
)+
".ms"
));
log
.
info
(
"update_huiTohei_type1()处理结束 page: {} , startId: {} , endId: {} , updateBeanList: {} , thisPageOk: {}
, 耗时: {} <<<<<<------\n"
,
page
,
startId
,
endId
,
(
updateBeanList
!=
null
?
updateBeanList
.
size
():
0
),
thisPageOk
,
((
System
.
currentTimeMillis
()-
thisPageStart
)+
".ms"
));
}
}
}
}
...
@@ -942,5 +946,186 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS
...
@@ -942,5 +946,186 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS
}
}
/**
* -----------------------------------------------------------------------------<br>
* 描 述: 将tmp_black_grey_list表,black_type=2 && type=2(白条)的,符合条件的更新为黑名单 <br>
* 创建人: yanhui.Hao <br>
* 创建时间: 2020.04.13 14:31 <br>
* 最后修改人: <br>
* 最后修改时间: 2020.04.13 14:31 <br>
* 入参说明: [] <br>
* 出参说明: void <br>
* -----------------------------------------------------------------------------
*/
private
void
update_huiTohei_type2
(){
long
totalStar
=
System
.
currentTimeMillis
();
//blackListJdbcTemplate
String
sql_blacklist3_query
=
"SELECT t.id, t.uuid, t.`name`, t.phone_no, t.id_no, t.black_type, t.type from tmp_black_grey_list t "
+
" WHERE t.black_type='2' AND t.type='2'"
+
" AND id > ? AND id<=?;"
;
//xyqbJdbcTemplate
String
sql_xyqb_query_type2
=
"select count(distinct a.user_id) in_overdue "
+
"from baitiao_repayment_plan a "
+
"left join baitiao_order b on a.order_id=b.id "
+
"left join user c on a.user_id=c.id "
+
"where c.uuid='##UUID##' "
+
"and b.status=1 "
+
"and a.repayment_status not in (3,4) and a.deadline<CURDATE()"
;
//int maxId = 11429420;
int
maxId
=
0
;
try
{
String
value
=
stringRedisTemplate
.
opsForValue
().
get
(
"UPDATE_HUITOHEI_MAXID_TYPE1"
);
if
(
StringUtils
.
isNotEmpty
(
value
)){
maxId
=
Integer
.
parseInt
(
value
);
}
}
catch
(
Exception
e
){
log
.
error
(
"获取redis里值异常, key: {} "
,
"UPDATE_HUITOHEI_MAXID_TYPE1"
,
e
);
}
log
.
info
(
"方法update_huiTohei_type2()查询缓存, maxId : {} "
,
maxId
);
if
(
maxId
<=
0
){
return
;
}
int
totalQueryCount
=
0
,
totalUpdateCount
=
0
,
totalOkCount
=
0
;
int
totalPage
=
maxId
/
LIMIT_1000
;
if
((
maxId
%
LIMIT_1000
)!=
0
){
totalPage
+=
1
;
}
int
startId
=
0
,
endId
=
0
;
for
(
int
page
=
1
;
page
<=
totalPage
;
page
++)
{
startId
=
(
page
-
1
)
*
LIMIT_1000
;
endId
=
page
*
LIMIT_1000
;
long
thisPageStart
=
System
.
currentTimeMillis
();
List
<
TmpBlackGreyList
>
updateBeanList
=
null
;
int
thisPageOk
=
0
;
try
{
log
.
info
(
"方法update_huiTohei_type2()处理开始 page: {} , startId: {} , endId: {} , totalPage: {} ------>>>>>>"
,
page
,
startId
,
endId
,
totalPage
);
List
<
TmpBlackGreyList
>
tmpQueryList
=
blackListJdbcTemplate
.
query
(
sql_blacklist3_query
,
new
Object
[]{
startId
,
endId
},
new
RowMapper
<
TmpBlackGreyList
>()
{
@Override
public
TmpBlackGreyList
mapRow
(
ResultSet
rs
,
int
rowNum
)
throws
SQLException
{
TmpBlackGreyList
bean
=
new
TmpBlackGreyList
();
bean
.
setId
(
rs
.
getLong
(
"id"
));
bean
.
setUuid
(
rs
.
getString
(
"uuid"
));
bean
.
setName
(
rs
.
getString
(
"name"
));
bean
.
setPhoneNo
(
rs
.
getString
(
"phone_no"
));
bean
.
setIdNo
(
rs
.
getString
(
"id_no"
));
bean
.
setBlackType
(
rs
.
getString
(
"black_type"
));
bean
.
setType
(
rs
.
getString
(
"type"
));
return
bean
;
}
});
if
(
tmpQueryList
!=
null
&&
tmpQueryList
.
size
()>
0
){
totalQueryCount
=
totalQueryCount
+
tmpQueryList
.
size
();
updateBeanList
=
new
ArrayList
<>();
for
(
TmpBlackGreyList
queryBean
:
tmpQueryList
){
if
(
queryBean
.
getUuid
()==
null
){
log
.
info
(
"方法update_huiTohei_type2()检测用户信息id:{} 的uuid是空的"
,
queryBean
.
getId
());
if
(
StringUtils
.
isNotEmpty
(
queryBean
.
getIdNo
())
&&
StringUtils
.
isNotEmpty
(
queryBean
.
getName
())){
String
sql_query_byIdNo
=
"select u.id, u.uuid, d.`name`, d.phone_no, d.id_no from user_detail d left join user u on d.user_id=u.id "
+
"where u.`enable`=1 AND d.id_no='"
+
queryBean
.
getIdNo
().
trim
().
toUpperCase
()+
"' AND d.`name`='"
+
queryBean
.
getName
().
trim
()+
"' LIMIT 1 "
;
XyqbUser
xyqbUser
=
null
;
try
{
xyqbUser
=
xyqbUserJdbcTemplate
.
queryForObject
(
sql_query_byIdNo
,
new
RowMapper
<
XyqbUser
>()
{
@Override
public
XyqbUser
mapRow
(
ResultSet
rs
,
int
rowNum
)
throws
SQLException
{
XyqbUser
bean
=
new
XyqbUser
();
bean
.
setId
(
rs
.
getLong
(
"id"
));
bean
.
setUuid
(
rs
.
getString
(
"uuid"
));
bean
.
setName
(
rs
.
getString
(
"name"
));
bean
.
setPhoneNo
(
rs
.
getString
(
"phone_no"
));
bean
.
setIdNo
(
rs
.
getString
(
"id_no"
));
return
bean
;
}
});
}
catch
(
EmptyResultDataAccessException
e
){
log
.
error
(
"方法update_huiTohei_type2补全用户信息uuid异常, idNo: {} , name: {} , e: {} "
,
queryBean
.
getIdNo
().
trim
().
toUpperCase
(),
queryBean
.
getName
().
trim
(),
e
.
toString
());
}
finally
{
log
.
info
(
"方法update_huiTohei_type2补全用户信息: {} , id: {} "
,
xyqbUser
!=
null
?
xyqbUser
.
toString
():
"null"
,
queryBean
.
getId
());
}
if
(
xyqbUser
!=
null
&&
StringUtils
.
isNotEmpty
(
xyqbUser
.
getUuid
())){
queryBean
.
setUuid
(
xyqbUser
.
getUuid
());
queryBean
.
setRemark
(
xyqbUser
.
getUuid
());
//为了标记,修改uuid
log
.
info
(
"方法update_huiTohei_type2()检测用户信息id:{} 的uuid是空, 但根据id_no和name补全了uuid={}, id_no={}, name={} "
,
queryBean
.
getId
(),
queryBean
.
getIdNo
().
trim
().
toUpperCase
(),
queryBean
.
getName
().
toUpperCase
());
}
}
}
if
(
StringUtils
.
isNotEmpty
(
queryBean
.
getUuid
())){
queryBean
.
setBlackType
(
"2"
);
queryBean
.
setJoinBlackReason
(
"6"
);
Object
in_overdue_Obj
=
null
;
try
{
in_overdue_Obj
=
xyqbJdbcTemplate
.
queryForObject
(
sql_xyqb_query_type2
.
replace
(
"##UUID##"
,
queryBean
.
getUuid
()),
String
.
class
);
}
catch
(
EmptyResultDataAccessException
e
){
log
.
error
(
"方法update_huiTohei_type2查询逾期in_overdue_Obj异常, uuid: {} , idNo: {} , name: {} , e: {} "
,
queryBean
.
getUuid
(),
queryBean
.
getIdNo
().
trim
().
toUpperCase
(),
queryBean
.
getName
().
trim
(),
e
.
toString
());
}
finally
{
log
.
info
(
"方法update_huiTohei_type2查询逾期in_overdue_Obj : {} , uuid: {} "
,
in_overdue_Obj
!=
null
?
in_overdue_Obj
.
toString
()
:
"null"
,
queryBean
.
getUuid
());
}
if
(
in_overdue_Obj
!=
null
&&
StringUtils
.
isNotEmpty
(
in_overdue_Obj
.
toString
())){
int
in_overdue
=
Integer
.
parseInt
(
in_overdue_Obj
.
toString
());
if
(
in_overdue
>=
1
){
queryBean
.
setBlackType
(
"1"
);
queryBean
.
setJoinBlackReason
(
"3"
);
}
}
updateBeanList
.
add
(
queryBean
);
totalUpdateCount
++;
}
else
{
log
.
warn
(
"方法update_huiTohei_type2查询in_overdue时用户uuid为空跳过, id: {} "
,
queryBean
.
getId
());
}
}
log
.
info
(
"方法update_huiTohei_type2()筛选结束, page: {} , startId: {} , endId: {}, list大小: {} "
,
page
,
startId
,
endId
,
updateBeanList
.
size
());
if
(
updateBeanList
.
size
()>
0
){
//batchResult = JdbcExecuters.updateBatchExecute(updateBean, sql_update_type1, blackListJdbcTemplate, "update_huiTohei_type1");
String
sql_update_type1
=
"update tmp_black_grey_list set black_type='##black_type##', join_black_reason='##join_black_reason##' ##have_UUID## where id=##id##"
;
for
(
TmpBlackGreyList
bean
:
updateBeanList
)
{
try
{
String
sql_tmp
=
sql_update_type1
.
replace
(
"##id##"
,
""
+
bean
.
getId
());
sql_tmp
=
sql_tmp
.
replace
(
"##join_black_reason##"
,
bean
.
getJoinBlackReason
());
sql_tmp
=
sql_tmp
.
replace
(
"##black_type##"
,
bean
.
getBlackType
());
if
(
StringUtils
.
isNotEmpty
(
bean
.
getRemark
())){
sql_tmp
=
sql_tmp
.
replace
(
"##have_UUID##"
,
", uuid='"
+
bean
.
getUuid
()+
"'"
);
}
else
{
sql_tmp
=
sql_tmp
.
replace
(
"##have_UUID##"
,
""
);
}
int
update
=
blackListJdbcTemplate
.
update
(
sql_tmp
);
thisPageOk
=
thisPageOk
+
update
;
totalOkCount
=
totalOkCount
+
update
;
}
catch
(
Exception
e
){
log
.
error
(
"方法update_huiTohei_type2()修改异常, id: {} "
,
bean
.
getId
(),
e
);
}
}
}
}
}
catch
(
Exception
e
){
log
.
error
(
"方法update_huiTohei_type2()处理异常, page: {} , startId: {} , endId: {} "
,
page
,
startId
,
endId
,
e
);
}
finally
{
log
.
info
(
"方法update_huiTohei_type2()处理结束 page: {} , startId: {} , endId: {} , updateBeanList: {} , thisPageOk: {} , 耗时: {} <<<<<<------\n"
,
page
,
startId
,
endId
,
(
updateBeanList
!=
null
?
updateBeanList
.
size
():
0
),
thisPageOk
,
((
System
.
currentTimeMillis
()-
thisPageStart
)+
".ms"
));
}
}
log
.
info
(
"\n>>>>>>方法update_huiTohei_type2()处理 Method End, totalQueryCount: {} , totalUpdateCount: {} , totalOkCount: {} , total cost: {} <<<<<<"
,
totalQueryCount
,
totalUpdateCount
,
totalOkCount
,
(
System
.
currentTimeMillis
()-
totalStar
)+
".ms"
);
}
}
}
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