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
030b725d
Commit
030b725d
authored
Aug 07, 2019
by
data爬虫-冯 军凯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
record
parent
b65d715c
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
338 additions
and
19 deletions
+338
-19
Constant.java
...ain/java/cn/quantgroup/qgblservice/constant/Constant.java
+1
-1
BlackListImportManagerController.java
...lservice/controller/BlackListImportManagerController.java
+2
-2
BlackListImportManagerJob.java
...p/qgblservice/job/blimport/BlackListImportManagerJob.java
+20
-1
BlackListQueryByThreeEleParam0.java
...y/mybatis/entity/tidb/BlackListQueryByThreeEleParam0.java
+23
-0
BlackListQueryTidbMapper.java
...ository/mybatis/mapper/tidb/BlackListQueryTidbMapper.java
+8
-0
BlackListQueryTidbMapper.xml
.../repository/mybatis/xml/tidb/BlackListQueryTidbMapper.xml
+57
-14
IBlackListImportService.java
...antgroup/qgblservice/service/IBlackListImportService.java
+1
-1
IBlackListManagerService.java
...ntgroup/qgblservice/service/IBlackListManagerService.java
+14
-0
BlackListImportServiceImpl.java
.../qgblservice/service/impl/BlackListImportServiceImpl.java
+110
-0
BlackListManagerServiceImpl.java
...qgblservice/service/impl/BlackListManagerServiceImpl.java
+102
-0
No files found.
src/main/java/cn/quantgroup/qgblservice/constant/Constant.java
View file @
030b725d
...
...
@@ -8,7 +8,7 @@ public class Constant {
public
static
class
SQL
{
public
static
final
String
BATCH_INSERT_BLACK_PHONE_LIST_SQL
=
"insert into black_list_new (`uuid`, `name`, `phone_no`, `id_no`, `major_type`, `type`, `first_overdue_days`, `max_overdue_days`, `black_level`, `created_at`, `updated_at`) values(?,?,?,?,?,?,?,?,?,?,?)"
;
public
static
final
String
BATCH_INSERT_BLACK_PHONE_LIST_SQL
=
"insert i
gnore i
nto black_list_new (`uuid`, `name`, `phone_no`, `id_no`, `major_type`, `type`, `first_overdue_days`, `max_overdue_days`, `black_level`, `created_at`, `updated_at`) values(?,?,?,?,?,?,?,?,?,?,?)"
;
public
static
final
String
BATCH_INSERT_BLACK_IDCARD_LIST_SQL
=
""
;
...
...
src/main/java/cn/quantgroup/qgblservice/controller/BlackListImportManagerController.java
View file @
030b725d
package
cn
.
quantgroup
.
qgblservice
.
controller
;
import
cn.quantgroup.qgblservice.response.GlobalResponse
;
import
cn.quantgroup.qgblservice.service.IBlackListImport
Manager
Service
;
import
cn.quantgroup.qgblservice.service.IBlackListImportService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
...
...
@@ -18,7 +18,7 @@ import org.springframework.web.bind.annotation.RestController;
public
class
BlackListImportManagerController
{
@Autowired
private
IBlackListImport
Manager
Service
iBlackListImportManagerService
;
private
IBlackListImportService
iBlackListImportManagerService
;
@RequestMapping
(
"/black_list_import_by_month"
)
public
GlobalResponse
blackListImportByMonth
(
String
startTime
,
String
endTime
)
{
...
...
src/main/java/cn/quantgroup/qgblservice/job/blimport/BlackListImportManagerJob.java
View file @
030b725d
package
cn
.
quantgroup
.
qgblservice
.
job
.
blimport
;
import
cn.quantgroup.qgblservice.service.IBlackListManagerService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
/**
* 量化派黑名单导入整理至新表任务
*
...
...
@@ -12,9 +17,23 @@ import org.springframework.stereotype.Component;
@Component
public
class
BlackListImportManagerJob
{
@Scheduled
(
cron
=
"0 0 6 * * ?"
)
@Autowired
private
IBlackListManagerService
iBlackListManagerService
;
// @Scheduled(cron = "0 0 6 * * ?")
public
void
blackListImportJob
(){
String
startTime
=
LocalDateTime
.
now
().
format
(
DateTimeFormatter
.
ISO_DATE
);
String
endTime
=
LocalDateTime
.
now
().
minusDays
(
1
).
format
(
DateTimeFormatter
.
ISO_DATE
);
iBlackListManagerService
.
blackListPhoneManager
(
startTime
,
endTime
);
iBlackListManagerService
.
blackListIdCardManager
(
startTime
,
endTime
);
}
public
static
void
main
(
String
[]
args
)
{
}
}
src/main/java/cn/quantgroup/qgblservice/repository/mybatis/entity/tidb/BlackListQueryByThreeEleParam0.java
0 → 100644
View file @
030b725d
package
cn
.
quantgroup
.
qgblservice
.
repository
.
mybatis
.
entity
.
tidb
;
import
lombok.Builder
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @Author fengjunkai
* @Date 2019-08-05 17:38
*/
@Data
@Builder
public
class
BlackListQueryByThreeEleParam0
implements
Serializable
{
private
static
final
long
serialVersionUID
=
3308943168238892223L
;
private
String
phone
;
private
String
name
;
private
String
idCard
;
private
String
type
;
}
src/main/java/cn/quantgroup/qgblservice/repository/mybatis/mapper/tidb/BlackListQueryTidbMapper.java
View file @
030b725d
package
cn
.
quantgroup
.
qgblservice
.
repository
.
mybatis
.
mapper
.
tidb
;
import
cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.BlackListQueryByThreeEleParam0
;
import
cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.BlackListQueryTidbParam0
;
import
cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.BlackListQueryTidbVo0
;
import
org.springframework.stereotype.Repository
;
...
...
@@ -17,6 +18,13 @@ public interface BlackListQueryTidbMapper {
List
<
BlackListQueryTidbVo0
>
findBlackListIdCardByTime
(
BlackListQueryTidbParam0
blackListQueryTidbParam0
);
BlackListQueryTidbVo0
findBlackListByPhoneOrNameOrIdcardAndChannelType
(
BlackListQueryByThreeEleParam0
blackListQueryByThreeEleParam0
);
List
<
BlackListQueryTidbVo0
>
findBlackListByPhone
(
BlackListQueryByThreeEleParam0
blackListQueryByThreeEleParam0
);
List
<
BlackListQueryTidbVo0
>
findBlackListByIdcard
(
BlackListQueryByThreeEleParam0
blackListQueryByThreeEleParam0
);
void
updateThreeElementsById
(
BlackListQueryTidbVo0
blackListQueryTidbVo0
);
void
insertBatch
(
List
<
BlackListQueryTidbVo0
>
blackListQueryTidbVo0s
);
}
src/main/java/cn/quantgroup/qgblservice/repository/mybatis/xml/tidb/BlackListQueryTidbMapper.xml
View file @
030b725d
...
...
@@ -94,20 +94,63 @@
and a.createDate
<
#{endTime, jdbcType=VARCHAR};;
</select>
<insert
id=
"insertBatch"
parameterType=
"cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.BlackListQueryTidbVo0"
>
insert into black_list_new (`uuid`, `name`, `phone_no`, `id_no`, `major_type`, `type`, `first_overdue_days`, `max_overdue_days`, `black_level`)
values
<foreach
collection=
"list"
item=
"item"
separator=
","
>
(#{uuid, jdbcType=VARCHAR},
#{name, jdbcType=VARCHAR},
#{phone_no, jdbcType=VARCHAR},
#{id_no, jdbcType=VARCHAR},
#{major_type, jdbcType=VARCHAR},
#{type, jdbcType=VARCHAR},
#{first_overdue_days, jdbcType=VARCHAR},
#{max_overdue_days, jdbcType=VARCHAR},
#{black_level, jdbcType=VARCHAR})
</foreach>
<insert
id=
"insertBatch"
parameterType=
"cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.BlackListQueryTidbVo0"
>
insert into black_list_new (`uuid`, `name`, `phone_no`, `id_no`, `major_type`, `type`, `first_overdue_days`,
`max_overdue_days`, `black_level`)
values
<foreach
collection=
"list"
item=
"item"
separator=
","
>
(#{uuid, jdbcType=VARCHAR},
#{name, jdbcType=VARCHAR},
#{phone_no, jdbcType=VARCHAR},
#{id_no, jdbcType=VARCHAR},
#{major_type, jdbcType=VARCHAR},
#{type, jdbcType=VARCHAR},
#{first_overdue_days, jdbcType=VARCHAR},
#{max_overdue_days, jdbcType=VARCHAR},
#{black_level, jdbcType=VARCHAR})
</foreach>
</insert>
<select
id=
"findBlackListByPhoneOrNameOrIdcardAndChannelType"
parameterType=
"cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.BlackListQueryByThreeEleParam0"
resultMap=
"BaseResultMap"
>
select * from black_list_new
<trim
prefix=
"where"
prefixOverrides=
"and"
>
<if
test=
"phone != null"
>
and phone_no = #{phone,jdbcType=VARCHAR}
</if>
<if
test=
"name != null"
>
and name = #{name,jdbcType=VARCHAR}
</if>
<if
test=
"idCard != null"
>
and id_no = #{idCard,jdbcType=VARCHAR}
</if>
<if
test=
"type != null"
>
and type = #{type,jdbcType=VARCHAR}
</if>
</trim>
limit 1;
</select>
<select
id=
"findBlackListByPhone"
parameterType=
"cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.BlackListQueryByThreeEleParam0"
resultMap=
"BaseResultMap"
>
select * from black_list_new where phone_no = #{phone, jdbcType=VARCHAR}
</select>
<select
id=
"findBlackListByIdcard"
parameterType=
"cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.BlackListQueryByThreeEleParam0"
resultMap=
"BaseResultMap"
>
select * from black_list_new where phone_no = #{id_no, jdbcType=VARCHAR}
</select>
<update
id=
"updateThreeElementsById"
parameterType=
"cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.BlackListQueryTidbVo0"
>
update black_list_new bln
<set>
<if
test=
"uuid!=null"
>
bln.uuid = #{uuid,jdbcType=VARCHAR},
</if>
<if
test=
"name!=null"
>
bln.name = #{name,jdbcType=VARCHAR},
</if>
<if
test=
"phoneNo!=null"
>
bln.phone_no = #{phoneNo,jdbcType=VARCHAR},
</if>
<if
test=
"idNo!=null"
>
bln.id_no = #{idNo,jdbcType=VARCHAR},
</if>
<if
test=
"createdAt!=null"
>
bln.created_at = #{createdAt,jdbcType=TIMESTAMP},
</if>
<if
test=
"updatedAt!=null"
>
bln.updated_at = #{updatedAt,jdbcType=TIMESTAMP},
</if>
where bln.id = #{id}
</set>
</update>
</mapper>
\ No newline at end of file
src/main/java/cn/quantgroup/qgblservice/service/IBlackListImport
Manager
Service.java
→
src/main/java/cn/quantgroup/qgblservice/service/IBlackListImportService.java
View file @
030b725d
...
...
@@ -6,7 +6,7 @@ import cn.quantgroup.qgblservice.response.GlobalResponse;
* @Author fengjunkai
* @Date 2019-08-01 17:50
*/
public
interface
IBlackListImport
Manager
Service
{
public
interface
IBlackListImportService
{
public
GlobalResponse
blackListPhoneImport
(
String
startTime
,
String
endTime
);
public
GlobalResponse
blackListIdCardImport
(
String
startTime
,
String
endTime
);
...
...
src/main/java/cn/quantgroup/qgblservice/service/IBlackListManagerService.java
0 → 100644
View file @
030b725d
package
cn
.
quantgroup
.
qgblservice
.
service
;
import
cn.quantgroup.qgblservice.response.GlobalResponse
;
/**
* @Author fengjunkai
* @Date 2019-08-05 16:43
*/
public
interface
IBlackListManagerService
{
public
void
blackListPhoneManager
(
String
startTime
,
String
endTime
);
public
void
blackListIdCardManager
(
String
startTime
,
String
endTime
);
}
src/main/java/cn/quantgroup/qgblservice/service/impl/BlackListImport
Manager
ServiceImpl.java
→
src/main/java/cn/quantgroup/qgblservice/service/impl/BlackListImportServiceImpl.java
View file @
030b725d
package
cn
.
quantgroup
.
qgblservice
.
service
.
impl
;
import
cn.quantgroup.qgblservice.constant.Constant
;
import
cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.BlackListQueryTidbParam0
;
import
cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.BlackListQueryTidbVo0
;
import
cn.quantgroup.qgblservice.repository.mybatis.mapper.tidb.BlackListQueryTidbMapper
;
import
cn.quantgroup.qgblservice.response.GlobalResponse
;
import
cn.quantgroup.qgblservice.service.IBlackListImportManagerService
;
import
cn.quantgroup.qgblservice.utils.jdbc.JdbcExecuters
;
import
com.google.common.base.Stopwatch
;
import
cn.quantgroup.qgblservice.service.IBlackListImportService
;
import
cn.quantgroup.qgblservice.service.IBlackListManagerService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.stereotype.Service
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.List
;
import
java.util.concurrent.TimeUnit
;
/**
* @Author fengjunkai
...
...
@@ -24,7 +19,7 @@ import java.util.concurrent.TimeUnit;
*/
@Slf4j
@Service
public
class
BlackListImport
ManagerServiceImpl
implements
IBlackListImportManager
Service
{
public
class
BlackListImport
ServiceImpl
implements
IBlackListImport
Service
{
private
static
String
ERLY_DATE
=
"2015-08-01T00:00:00"
;
private
static
String
PHONE_BREAK_DATE
=
"2019-09-01T00:00:00"
;
...
...
@@ -34,11 +29,8 @@ public class BlackListImportManagerServiceImpl implements IBlackListImportManage
private
BlackListQueryTidbMapper
blackListQueryTidbMapper
;
@Autowired
private
JdbcTemplate
blackListJdbcTemplate
;
public
static
void
main
(
String
[]
args
)
{
LocalDateTime
localDateTime
=
LocalDateTime
.
parse
(
PHONE_BREAK_DATE
);
System
.
out
.
println
();
}
@Autowired
private
IBlackListManagerService
iBlackListManagerService
;
/**
* 手机关联三要素黑名单导入新表
...
...
@@ -56,23 +48,18 @@ public class BlackListImportManagerServiceImpl implements IBlackListImportManage
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
try
{
startTime
=
erlyDate
.
plusMonths
(
i
).
format
(
DateTimeFormatter
.
ISO_DATE
);
endTime
=
erlyDate
.
plusMonths
(
i
+
1
).
format
(
DateTimeFormatter
.
ISO_DATE
);
startTime
=
StringUtils
.
isBlank
(
startTime
)
?
erlyDate
.
plusMonths
(
i
).
format
(
DateTimeFormatter
.
ISO_DATE
)
:
startTime
;
endTime
=
StringUtils
.
isBlank
(
endTime
)
?
erlyDate
.
plusMonths
(
i
+
1
).
format
(
DateTimeFormatter
.
ISO_DATE
)
:
endTime
;
if
(
phoneBreakDate
.
equalsIgnoreCase
(
startTime
))
{
break
;
}
Stopwatch
queryPhoneStopwatch
=
Stopwatch
.
createStarted
();
List
<
BlackListQueryTidbVo0
>
blackListQueryTidbVo0s
=
blackListQueryTidbMapper
.
findBlackListPhoneByTime
(
BlackListQueryTidbParam0
.
builder
().
startTime
(
startTime
).
endTime
(
endTime
).
build
());
log
.
info
(
"手机黑名单查询 {} --- {} 结果size: {} , 耗时: {} "
,
startTime
,
endTime
,
blackListQueryTidbVo0s
.
size
(),
queryPhoneStopwatch
.
stop
().
elapsed
(
TimeUnit
.
MILLISECONDS
));
Stopwatch
executeInsertPhoneStopwatch
=
Stopwatch
.
createStarted
();
JdbcExecuters
.
batchExecute
(
blackListQueryTidbVo0s
,
Constant
.
SQL
.
BATCH_INSERT_BLACK_PHONE_LIST_SQL
,
blackListJdbcTemplate
);
log
.
info
(
"手机黑名单入库 {} --- {} 入库size: {} , 耗时: {} "
,
startTime
,
endTime
,
blackListQueryTidbVo0s
.
size
(),
executeInsertPhoneStopwatch
.
stop
().
elapsed
(
TimeUnit
.
MILLISECONDS
));
iBlackListManagerService
.
blackListPhoneManager
(
startTime
,
endTime
);
}
catch
(
Exception
e
)
{
log
.
error
(
"手机号
黑名单导入发生异常, startTime: {} , endTime: {} "
,
startTime
,
endTim
e
);
log
.
error
(
"手机号
整合导入黑名单新表异常, startTime: {} , endTime: {} "
,
startTime
,
endTime
,
e
);
}
}
...
...
@@ -102,19 +89,11 @@ public class BlackListImportManagerServiceImpl implements IBlackListImportManage
endTime
=
erlyDate
.
plusMonths
(
i
+
1
).
format
(
DateTimeFormatter
.
ISO_DATE
);
startTime
=
erlyDate
.
plusMonths
(
i
).
format
(
DateTimeFormatter
.
ISO_DATE
);
Stopwatch
queryStopwatch
=
Stopwatch
.
createStarted
();
if
(
idCardBreakDate
.
equalsIgnoreCase
(
startTime
))
{
break
;
}
List
<
BlackListQueryTidbVo0
>
blackListQueryTidbVo0s
=
blackListQueryTidbMapper
.
findBlackListPhoneByTime
(
BlackListQueryTidbParam0
.
builder
().
startTime
(
startTime
).
endTime
(
endTime
).
build
());
log
.
info
(
"身份证黑名单查询 {} --- {} 结果size: {} , 耗时: {} "
,
startTime
,
endTime
,
blackListQueryTidbVo0s
.
size
(),
queryStopwatch
.
stop
().
elapsed
(
TimeUnit
.
MILLISECONDS
));
Stopwatch
executeInsertStopwatch
=
Stopwatch
.
createStarted
();
JdbcExecuters
.
batchExecute
(
blackListQueryTidbVo0s
,
Constant
.
SQL
.
BATCH_INSERT_BLACK_PHONE_LIST_SQL
,
blackListJdbcTemplate
);
log
.
info
(
"身份证黑名单入库 {} --- {} 入库size: {} , 耗时: {} "
,
startTime
,
endTime
,
blackListQueryTidbVo0s
.
size
(),
executeInsertStopwatch
.
stop
().
elapsed
(
TimeUnit
.
MILLISECONDS
));
iBlackListManagerService
.
blackListIdCardManager
(
startTime
,
endTime
);
}
catch
(
Exception
e
)
{
log
.
error
(
"身份证黑名单导入发生异常, startTime: {} , endTime: {} "
,
startTime
,
endTime
);
...
...
src/main/java/cn/quantgroup/qgblservice/service/impl/BlackListManagerServiceImpl.java
0 → 100644
View file @
030b725d
package
cn
.
quantgroup
.
qgblservice
.
service
.
impl
;
import
cn.quantgroup.qgblservice.constant.Constant
;
import
cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.BlackListQueryByThreeEleParam0
;
import
cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.BlackListQueryTidbParam0
;
import
cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.BlackListQueryTidbVo0
;
import
cn.quantgroup.qgblservice.repository.mybatis.mapper.tidb.BlackListQueryTidbMapper
;
import
cn.quantgroup.qgblservice.service.IBlackListManagerService
;
import
cn.quantgroup.qgblservice.utils.jdbc.JdbcExecuters
;
import
com.alibaba.fastjson.JSON
;
import
com.google.common.base.Stopwatch
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.concurrent.TimeUnit
;
/**
* @Author fengjunkai
* @Date 2019-08-05 16:43
*/
@Slf4j
@Service
public
class
BlackListManagerServiceImpl
implements
IBlackListManagerService
{
@Autowired
private
BlackListQueryTidbMapper
blackListQueryTidbMapper
;
@Autowired
private
JdbcTemplate
blackListJdbcTemplate
;
@Override
public
void
blackListPhoneManager
(
String
startTime
,
String
endTime
)
{
Stopwatch
queryPhoneStopwatch
=
Stopwatch
.
createStarted
();
List
<
BlackListQueryTidbVo0
>
blackListQueryTidbVo0s
=
blackListQueryTidbMapper
.
findBlackListPhoneByTime
(
BlackListQueryTidbParam0
.
builder
().
startTime
(
startTime
).
endTime
(
endTime
).
build
());
log
.
info
(
"手机黑名单查询 {} --- {} 结果size: {} , 耗时: {} "
,
startTime
,
endTime
,
blackListQueryTidbVo0s
.
size
(),
queryPhoneStopwatch
.
stop
().
elapsed
(
TimeUnit
.
MILLISECONDS
));
blackListQueryTidbVo0s
.
forEach
(
blackListQueryTidbVo0
->
{
List
<
BlackListQueryTidbVo0
>
blackListByPhone
=
blackListQueryTidbMapper
.
findBlackListByPhone
(
BlackListQueryByThreeEleParam0
.
builder
().
phone
(
blackListQueryTidbVo0
.
getPhoneNo
()).
build
());
updatedThreeElementsById
(
blackListByPhone
,
blackListQueryTidbVo0
);
});
Stopwatch
executeInsertPhoneStopwatch
=
Stopwatch
.
createStarted
();
JdbcExecuters
.
batchExecute
(
blackListQueryTidbVo0s
,
Constant
.
SQL
.
BATCH_INSERT_BLACK_PHONE_LIST_SQL
,
blackListJdbcTemplate
);
log
.
info
(
"手机黑名单入库 {} --- {} 入库size: {} , 耗时: {} "
,
startTime
,
endTime
,
blackListQueryTidbVo0s
.
size
(),
executeInsertPhoneStopwatch
.
stop
().
elapsed
(
TimeUnit
.
MILLISECONDS
));
}
@Override
public
void
blackListIdCardManager
(
String
startTime
,
String
endTime
)
{
Stopwatch
queryStopwatch
=
Stopwatch
.
createStarted
();
List
<
BlackListQueryTidbVo0
>
blackListQueryTidbVo0s
=
blackListQueryTidbMapper
.
findBlackListPhoneByTime
(
BlackListQueryTidbParam0
.
builder
().
startTime
(
startTime
).
endTime
(
endTime
).
build
());
log
.
info
(
"身份证黑名单查询 {} --- {} 结果size: {} , 耗时: {} "
,
startTime
,
endTime
,
blackListQueryTidbVo0s
.
size
(),
queryStopwatch
.
stop
().
elapsed
(
TimeUnit
.
MILLISECONDS
));
blackListQueryTidbVo0s
.
forEach
(
blackListQueryTidbVo0
->
{
List
<
BlackListQueryTidbVo0
>
blackListByIdCard
=
blackListQueryTidbMapper
.
findBlackListByIdcard
(
BlackListQueryByThreeEleParam0
.
builder
().
idCard
(
blackListQueryTidbVo0
.
getIdNo
()).
build
());
updatedThreeElementsById
(
blackListByIdCard
,
blackListQueryTidbVo0
);
});
Stopwatch
executeInsertStopwatch
=
Stopwatch
.
createStarted
();
JdbcExecuters
.
batchExecute
(
blackListQueryTidbVo0s
,
Constant
.
SQL
.
BATCH_INSERT_BLACK_PHONE_LIST_SQL
,
blackListJdbcTemplate
);
log
.
info
(
"身份证黑名单入库 {} --- {} 入库size: {} , 耗时: {} "
,
startTime
,
endTime
,
blackListQueryTidbVo0s
.
size
(),
executeInsertStopwatch
.
stop
().
elapsed
(
TimeUnit
.
MILLISECONDS
));
}
public
void
updatedThreeElementsById
(
List
<
BlackListQueryTidbVo0
>
blackListByPhones
,
BlackListQueryTidbVo0
blackListQueryTidbVo0
){
if
(
CollectionUtils
.
isNotEmpty
(
blackListByPhones
))
{
for
(
int
i
=
0
;
i
<
blackListByPhones
.
size
();
i
++){
BlackListQueryTidbVo0
blacklist
=
blackListByPhones
.
get
(
i
);
if
(
StringUtils
.
isAnyBlank
(
blacklist
.
getIdNo
(),
blacklist
.
getName
(),
blacklist
.
getPhoneNo
())){
if
(
StringUtils
.
isBlank
(
blacklist
.
getIdNo
())
&&
StringUtils
.
isNotBlank
(
blackListQueryTidbVo0
.
getIdNo
()))
{
blacklist
.
setIdNo
(
blackListQueryTidbVo0
.
getIdNo
());
}
if
(
StringUtils
.
isBlank
(
blacklist
.
getName
())
&&
StringUtils
.
isNotBlank
(
blackListQueryTidbVo0
.
getName
()))
{
blacklist
.
setName
(
blackListQueryTidbVo0
.
getName
());
}
if
(
StringUtils
.
isBlank
(
blacklist
.
getUuid
())
&&
StringUtils
.
isNotBlank
(
blackListQueryTidbVo0
.
getUuid
())){
blacklist
.
setUuid
(
blackListQueryTidbVo0
.
getUuid
());
}
blacklist
.
setCreatedAt
(
blackListQueryTidbVo0
.
getCreatedAt
());
blacklist
.
setUpdatedAt
(
blackListQueryTidbVo0
.
getUpdatedAt
());
blackListQueryTidbMapper
.
updateThreeElementsById
(
blacklist
);
}
}
}
}
}
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