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
b65d715c
Commit
b65d715c
authored
Aug 05, 2019
by
data爬虫-冯 军凯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
手机号关联三要素导入新表开发完成
parent
8f321041
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
787 additions
and
69 deletions
+787
-69
pom.xml
pom.xml
+4
-45
QgBlServiceApplication.java
...ava/cn/quantgroup/qgblservice/QgBlServiceApplication.java
+4
-0
BlackListSourceConfig.java
...p/qgblservice/config/blacklist/BlackListSourceConfig.java
+12
-4
TidbDataSourceConfig.java
...ntgroup/qgblservice/config/tidb/TidbDataSourceConfig.java
+76
-0
TidbDataSourceProperties.java
...oup/qgblservice/config/tidb/TidbDataSourceProperties.java
+31
-0
XyqbUserSourceConfig.java
...oup/qgblservice/config/xyqbuser/XyqbUserSourceConfig.java
+5
-6
Constant.java
...ain/java/cn/quantgroup/qgblservice/constant/Constant.java
+17
-0
BlackListCacheManagerController.java
...blservice/controller/BlackListCacheManagerController.java
+18
-0
BlackListImportManagerController.java
...lservice/controller/BlackListImportManagerController.java
+30
-0
BlackListImportManagerJob.java
...p/qgblservice/job/blimport/BlackListImportManagerJob.java
+20
-0
test.java
src/main/java/cn/quantgroup/qgblservice/job/test.java
+8
-0
BlackListType.java
...quantgroup/qgblservice/model/blacklist/BlackListType.java
+61
-0
text.java
src/main/java/cn/quantgroup/qgblservice/model/text.java
+8
-0
BlackListQueryTidbParam0.java
...ository/mybatis/entity/tidb/BlackListQueryTidbParam0.java
+21
-0
BlackListQueryTidbVo0.java
...repository/mybatis/entity/tidb/BlackListQueryTidbVo0.java
+31
-0
TestMapper.java
...lservice/repository/mybatis/mapper/master/TestMapper.java
+0
-8
BlackListQueryTidbMapper.java
...ository/mybatis/mapper/tidb/BlackListQueryTidbMapper.java
+22
-0
TestMapper.xml
.../qgblservice/repository/mybatis/xml/master/TestMapper.xml
+0
-5
BlackListQueryTidbMapper.xml
.../repository/mybatis/xml/tidb/BlackListQueryTidbMapper.xml
+113
-0
GlobalResponse.java
...va/cn/quantgroup/qgblservice/response/GlobalResponse.java
+67
-0
IBlackListImportManagerService.java
...p/qgblservice/service/IBlackListImportManagerService.java
+14
-0
BlackListImportManagerServiceImpl.java
...rvice/service/impl/BlackListImportManagerServiceImpl.java
+131
-0
JdbcExecuters.java
...a/cn/quantgroup/qgblservice/utils/jdbc/JdbcExecuters.java
+86
-0
test.java
src/main/java/cn/quantgroup/qgblservice/utils/test.java
+8
-0
application.properties
src/main/resources/application.properties
+0
-1
No files found.
pom.xml
View file @
b65d715c
...
@@ -90,29 +90,6 @@
...
@@ -90,29 +90,6 @@
<version>
1.16.16
</version>
<version>
1.16.16
</version>
</dependency>
</dependency>
<!-- 添加权限 -->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-security
</artifactId>
</dependency>
<!--swagger -->
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger2
</artifactId>
<version>
2.0.3
</version>
<exclusions>
<exclusion>
<groupId>
com.fasterxml.jackson.core
</groupId>
<artifactId>
jackson-annotations
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger-ui
</artifactId>
<version>
2.0.3
</version>
</dependency>
<!--swagger -->
<!--spring-->
<!--spring-->
<dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
...
@@ -123,8 +100,8 @@
...
@@ -123,8 +100,8 @@
<artifactId>
spring-boot
</artifactId>
<artifactId>
spring-boot
</artifactId>
</dependency>
</dependency>
<!--<dependency>-->
<!--<dependency>-->
<!--<groupId>org.springframework.data</groupId>-->
<!--<groupId>org.springframework.data</groupId>-->
<!--<artifactId>spring-data-redis</artifactId>-->
<!--<artifactId>spring-data-redis</artifactId>-->
<!--</dependency>-->
<!--</dependency>-->
<dependency>
<dependency>
<groupId>
org.springframework
</groupId>
<groupId>
org.springframework
</groupId>
...
@@ -150,8 +127,8 @@
...
@@ -150,8 +127,8 @@
<version>
5.1.2
</version>
<version>
5.1.2
</version>
</dependency>
</dependency>
<!--<dependency>-->
<!--<dependency>-->
<!--<groupId>redis.clients</groupId>-->
<!--<groupId>redis.clients</groupId>-->
<!--<artifactId>jedis</artifactId>-->
<!--<artifactId>jedis</artifactId>-->
<!--</dependency>-->
<!--</dependency>-->
<dependency>
<dependency>
<groupId>
org.apache.httpcomponents
</groupId>
<groupId>
org.apache.httpcomponents
</groupId>
...
@@ -284,24 +261,6 @@
...
@@ -284,24 +261,6 @@
<version>
20180928-Release
</version>
<version>
20180928-Release
</version>
</dependency>
</dependency>
<!--<dependency>-->
<!--<groupId>com.github.tobato</groupId>-->
<!--<artifactId>fastdfs-client</artifactId>-->
<!--<version>1.26.2</version>-->
<!--</dependency>-->
<dependency>
<groupId>
com.belerweb
</groupId>
<artifactId>
pinyin4j
</artifactId>
<version>
2.5.0
</version>
</dependency>
<dependency>
<groupId>
com.ibm.icu
</groupId>
<artifactId>
icu4j
</artifactId>
<version>
53.1
</version>
</dependency>
<!--SpringBoot, Cloud基础的依赖-->
<!--SpringBoot, Cloud基础的依赖-->
<dependency>
<dependency>
<groupId>
cn.quantgroup
</groupId>
<groupId>
cn.quantgroup
</groupId>
...
...
src/main/java/cn/quantgroup/qgblservice/QgBlServiceApplication.java
View file @
b65d715c
...
@@ -26,11 +26,15 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
...
@@ -26,11 +26,15 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
public
class
QgBlServiceApplication
{
public
class
QgBlServiceApplication
{
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
JSON
.
DEFAULT_GENERATE_FEATURE
|=
SerializerFeature
.
WriteEnumUsingToString
.
getMask
();
JSON
.
DEFAULT_GENERATE_FEATURE
|=
SerializerFeature
.
WriteEnumUsingToString
.
getMask
();
SpringApplication
springApplication
=
new
SpringApplication
(
QgBlServiceApplication
.
class
);
SpringApplication
springApplication
=
new
SpringApplication
(
QgBlServiceApplication
.
class
);
springApplication
.
addInitializers
(
new
ApolloPropertySourceInitializer
());
springApplication
.
addInitializers
(
new
ApolloPropertySourceInitializer
());
springApplication
.
run
(
args
);
springApplication
.
run
(
args
);
log
.
info
(
"量化派黑名单系统启动完成...."
);
log
.
info
(
"量化派黑名单系统启动完成...."
);
}
}
}
}
src/main/java/cn/quantgroup/qgblservice/config/blacklist/BlackListSourceConfig.java
View file @
b65d715c
...
@@ -14,6 +14,7 @@ import org.springframework.context.annotation.Configuration;
...
@@ -14,6 +14,7 @@ import org.springframework.context.annotation.Configuration;
import
org.springframework.context.annotation.Import
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.core.io.support.PathMatchingResourcePatternResolver
;
import
org.springframework.core.io.support.PathMatchingResourcePatternResolver
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
javax.sql.DataSource
;
import
javax.sql.DataSource
;
...
@@ -39,24 +40,31 @@ public class BlackListSourceConfig {
...
@@ -39,24 +40,31 @@ public class BlackListSourceConfig {
private
BlackListProperties
blackListProperties
;
private
BlackListProperties
blackListProperties
;
@Bean
(
name
=
"dataSource"
)
@Bean
(
name
=
"dataSource"
)
@Qualifier
(
"dataSource"
)
@Primary
public
DataSource
blackListDataSource
()
{
public
DataSource
blackListDataSource
()
{
HikariConfig
config
=
new
HikariConfig
();
HikariConfig
config
=
new
HikariConfig
();
config
.
setPassword
(
blackListProperties
.
getPassword
());
config
.
setJdbcUrl
(
blackListProperties
.
getJdbcUrl
());
config
.
setJdbcUrl
(
blackListProperties
.
getJdbcUrl
());
config
.
setUsername
(
blackListProperties
.
getUsername
());
config
.
setUsername
(
blackListProperties
.
getUsername
());
config
.
set
MaximumPoolSize
(
blackListProperties
.
getMaxPoolSize
());
config
.
set
Password
(
blackListProperties
.
getPassword
());
config
.
setMinimumIdle
(
blackListProperties
.
getMinPoolSize
());
config
.
setMinimumIdle
(
blackListProperties
.
getMinPoolSize
());
config
.
setMaximumPoolSize
(
blackListProperties
.
getMaxPoolSize
());
config
.
addDataSourceProperty
(
"cachePrepStmts"
,
"true"
);
config
.
addDataSourceProperty
(
"cachePrepStmts"
,
"true"
);
config
.
addDataSourceProperty
(
"prepStmtCacheSqlLimit"
,
"2048"
);
config
.
addDataSourceProperty
(
"prepStmtCacheSize"
,
"250"
);
config
.
addDataSourceProperty
(
"prepStmtCacheSize"
,
"250"
);
config
.
addDataSourceProperty
(
"prepStmtCacheSqlLimit"
,
"2048"
);
return
new
HikariDataSource
(
config
);
return
new
HikariDataSource
(
config
);
}
}
@Bean
(
name
=
"blackListJdbcTemplate"
)
public
JdbcTemplate
primaryJdbcTemplate
(
@Qualifier
(
"dataSource"
)
DataSource
dataSource
)
{
return
new
JdbcTemplate
(
dataSource
);
}
@Bean
(
name
=
"blackListSqlSessionFactory"
)
@Bean
(
name
=
"blackListSqlSessionFactory"
)
public
SqlSessionFactory
blackListSqlSessionFactory
(
@Qualifier
(
"dataSource"
)
DataSource
dataSource
)
throws
Exception
{
public
SqlSessionFactory
blackListSqlSessionFactory
(
@Qualifier
(
"dataSource"
)
DataSource
dataSource
)
throws
Exception
{
final
SqlSessionFactoryBean
sessionFactory
=
new
SqlSessionFactoryBean
();
final
SqlSessionFactoryBean
sessionFactory
=
new
SqlSessionFactoryBean
();
sessionFactory
.
setDataSource
(
dataSource
);
sessionFactory
.
setMapperLocations
(
new
PathMatchingResourcePatternResolver
().
getResources
(
mapperLocations
));
sessionFactory
.
setMapperLocations
(
new
PathMatchingResourcePatternResolver
().
getResources
(
mapperLocations
));
sessionFactory
.
setDataSource
(
dataSource
);
sessionFactory
.
setTypeAliasesPackage
(
typeAliasesPackage
);
sessionFactory
.
setTypeAliasesPackage
(
typeAliasesPackage
);
sessionFactory
.
setConfigLocation
(
new
PathMatchingResourcePatternResolver
().
getResource
(
configLocation
));
sessionFactory
.
setConfigLocation
(
new
PathMatchingResourcePatternResolver
().
getResource
(
configLocation
));
return
sessionFactory
.
getObject
();
return
sessionFactory
.
getObject
();
...
...
src/main/java/cn/quantgroup/qgblservice/config/
master/Master
SourceConfig.java
→
src/main/java/cn/quantgroup/qgblservice/config/
tidb/TidbData
SourceConfig.java
View file @
b65d715c
package
cn
.
quantgroup
.
qgblservice
.
config
.
master
;
package
cn
.
quantgroup
.
qgblservice
.
config
.
tidb
;
import
cn.quantgroup.qgblservice.config.blacklist.BlackListProperties
;
import
com.zaxxer.hikari.HikariConfig
;
import
com.zaxxer.hikari.HikariConfig
;
import
com.zaxxer.hikari.HikariDataSource
;
import
com.zaxxer.hikari.HikariDataSource
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.ibatis.session.ExecutorType
;
import
org.apache.ibatis.session.SqlSessionFactory
;
import
org.apache.ibatis.session.SqlSessionFactory
;
import
org.mybatis.spring.SqlSessionFactoryBean
;
import
org.mybatis.spring.SqlSessionFactoryBean
;
import
org.mybatis.spring.SqlSessionTemplate
;
import
org.mybatis.spring.SqlSessionTemplate
;
...
@@ -19,52 +20,57 @@ import javax.sql.DataSource;
...
@@ -19,52 +20,57 @@ import javax.sql.DataSource;
/**
/**
* @Author fengjunkai
* @Author fengjunkai
* @Date 2019-0
7-02 11:5
8
* @Date 2019-0
8-01 15:1
8
*/
*/
@Import
({
MasterProperties
.
class
})
@Import
(
TidbDataSourceProperties
.
class
)
@MapperScan
(
basePackages
=
MasterSourceConfig
.
PACKAGE
,
sqlSessionFactoryRef
=
"masterSqlSessionFactory"
)
@Configuration
@Configuration
public
class
MasterSourceConfig
{
@Slf4j
@MapperScan
(
basePackages
=
TidbDataSourceConfig
.
PACKAGE
,
sqlSessionFactoryRef
=
"tidbSqlSessionFactory"
)
public
class
TidbDataSourceConfig
{
static
final
String
PACKAGE
=
"cn.quantgroup.qgblservice.repository.mybatis.mapper.master"
;
@Value
(
"${master.mapper-locations}"
)
static
final
String
PACKAGE
=
"cn.quantgroup.qgblservice.repository.mybatis.mapper.tidb"
;
@Value
(
"${tidb.mapper-locations}"
)
private
String
mapperLocations
;
private
String
mapperLocations
;
@Value
(
"${
master
.type-aliases-package}"
)
@Value
(
"${
tidb
.type-aliases-package}"
)
private
String
typeAliasesPackage
;
private
String
typeAliasesPackage
;
@Value
(
"${
master
.config-location}"
)
@Value
(
"${
tidb
.config-location}"
)
private
String
configLocation
;
private
String
configLocation
;
@Autowired
@Autowired
private
MasterProperties
master
Properties
;
private
TidbDataSourceProperties
tidbDataSource
Properties
;
@Bean
(
name
=
"
d
ataSource"
)
@Bean
(
name
=
"
tidbD
ataSource"
)
public
DataSource
master
DataSource
()
{
public
DataSource
tidb
DataSource
()
{
HikariConfig
config
=
new
HikariConfig
();
HikariConfig
config
=
new
HikariConfig
();
config
.
setJdbcUrl
(
master
Properties
.
getJdbcUrl
());
config
.
setJdbcUrl
(
tidbDataSource
Properties
.
getJdbcUrl
());
config
.
setPassword
(
masterProperties
.
getPassword
());
log
.
info
(
"TIDB数据库地址:{}"
,
tidbDataSourceProperties
.
getJdbcUrl
());
config
.
set
MaximumPoolSize
(
masterProperties
.
getMaxPoolSize
());
config
.
set
Password
(
tidbDataSourceProperties
.
getPassword
());
config
.
setUsername
(
master
Properties
.
getUsername
());
config
.
setUsername
(
tidbDataSource
Properties
.
getUsername
());
config
.
setM
inimumIdle
(
masterProperties
.
getMin
PoolSize
());
config
.
setM
aximumPoolSize
(
tidbDataSourceProperties
.
getMax
PoolSize
());
config
.
addDataSourceProperty
(
"prepStmtCacheSize"
,
"250"
);
config
.
setMinimumIdle
(
tidbDataSourceProperties
.
getMinPoolSize
()
);
config
.
addDataSourceProperty
(
"cachePrepStmts"
,
"true"
);
config
.
addDataSourceProperty
(
"cachePrepStmts"
,
"true"
);
config
.
addDataSourceProperty
(
"prepStmtCacheSize"
,
"250"
);
config
.
addDataSourceProperty
(
"prepStmtCacheSqlLimit"
,
"2048"
);
config
.
addDataSourceProperty
(
"prepStmtCacheSqlLimit"
,
"2048"
);
return
new
HikariDataSource
(
config
);
return
new
HikariDataSource
(
config
);
}
}
@Bean
(
name
=
"
master
SqlSessionFactory"
)
@Bean
(
name
=
"
tidb
SqlSessionFactory"
)
public
SqlSessionFactory
masterSqlSessionFactory
(
@Qualifier
(
"dataSource"
)
DataSource
d
ataSource
)
throws
Exception
{
public
SqlSessionFactory
tidbSqlSessionFactory
(
@Qualifier
(
"tidbDataSource"
)
DataSource
tidbD
ataSource
)
throws
Exception
{
final
SqlSessionFactoryBean
sessionFactory
=
new
SqlSessionFactoryBean
();
final
SqlSessionFactoryBean
sessionFactory
=
new
SqlSessionFactoryBean
();
sessionFactory
.
setDataSource
(
dataSource
);
sessionFactory
.
setDataSource
(
tidbDataSource
);
sessionFactory
.
setMapperLocations
(
new
PathMatchingResourcePatternResolver
().
getResources
(
mapperLocations
));
sessionFactory
.
setMapperLocations
(
new
PathMatchingResourcePatternResolver
()
.
getResources
(
mapperLocations
));
sessionFactory
.
setTypeAliasesPackage
(
typeAliasesPackage
);
sessionFactory
.
setTypeAliasesPackage
(
typeAliasesPackage
);
sessionFactory
.
setConfigLocation
(
new
PathMatchingResourcePatternResolver
().
getResource
(
configLocation
));
sessionFactory
.
setConfigLocation
(
new
PathMatchingResourcePatternResolver
()
.
getResource
(
configLocation
));
return
sessionFactory
.
getObject
();
return
sessionFactory
.
getObject
();
}
}
@Bean
(
name
=
"
master
SqlSessionTemplate"
)
@Bean
(
name
=
"
tidb
SqlSessionTemplate"
)
public
SqlSessionTemplate
masterSqlSessionTemplate
(
@Qualifier
(
"masterSqlSessionFactory"
)
SqlSessionFactory
s
qlSessionFactory
)
throws
Exception
{
public
SqlSessionTemplate
tidbSqlSessionTemplate
(
@Qualifier
(
"tidbSqlSessionFactory"
)
SqlSessionFactory
tidbS
qlSessionFactory
)
throws
Exception
{
return
new
SqlSessionTemplate
(
sqlSessionFactory
);
return
new
SqlSessionTemplate
(
tidbSqlSessionFactory
,
ExecutorType
.
BATCH
);
}
}
}
}
src/main/java/cn/quantgroup/qgblservice/config/
master/Master
Properties.java
→
src/main/java/cn/quantgroup/qgblservice/config/
tidb/TidbDataSource
Properties.java
View file @
b65d715c
package
cn
.
quantgroup
.
qgblservice
.
config
.
master
;
package
cn
.
quantgroup
.
qgblservice
.
config
.
tidb
;
import
lombok.Data
;
import
lombok.Getter
;
import
lombok.Setter
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
/**
/**
* 原先黑名单库
*
* @Author fengjunkai
* @Author fengjunkai
* @Date 2019-0
7-02 11:5
8
* @Date 2019-0
8-01 15:1
8
*/
*/
@Data
@Setter
@Getter
@Configuration
@Configuration
public
class
Master
Properties
{
public
class
TidbDataSource
Properties
{
@Value
(
"${
master
.db.driver}"
)
@Value
(
"${
tidb
.db.driver}"
)
private
String
driverClass
;
private
String
driverClass
;
@Value
(
"${
master
.db.minPoolSize}"
)
@Value
(
"${
tidb
.db.minPoolSize}"
)
private
int
minPoolSize
;
private
int
minPoolSize
;
@Value
(
"${
master
.db.maxPoolSize}"
)
@Value
(
"${
tidb
.db.maxPoolSize}"
)
private
int
maxPoolSize
;
private
int
maxPoolSize
;
@Value
(
"${master.db.url}"
)
@Value
(
"${data.source.tidb.jdbcUrl}"
)
private
String
jdbcUrl
;
private
String
jdbcUrl
;
@Value
(
"${
master.
db.username}"
)
@Value
(
"${
data.source.ti
db.username}"
)
private
String
username
;
private
String
username
;
@Value
(
"${
master.
db.password}"
)
@Value
(
"${
data.source.ti
db.password}"
)
private
String
password
;
private
String
password
;
}
}
src/main/java/cn/quantgroup/qgblservice/config/xyqbuser/XyqbUserSourceConfig.java
View file @
b65d715c
package
cn
.
quantgroup
.
qgblservice
.
config
.
xyqbuser
;
package
cn
.
quantgroup
.
qgblservice
.
config
.
xyqbuser
;
import
cn.quantgroup.qgblservice.config.blacklist.BlackListProperties
;
import
com.zaxxer.hikari.HikariConfig
;
import
com.zaxxer.hikari.HikariConfig
;
import
com.zaxxer.hikari.HikariDataSource
;
import
com.zaxxer.hikari.HikariDataSource
;
import
org.apache.ibatis.session.SqlSessionFactory
;
import
org.apache.ibatis.session.SqlSessionFactory
;
...
@@ -38,7 +37,7 @@ public class XyqbUserSourceConfig {
...
@@ -38,7 +37,7 @@ public class XyqbUserSourceConfig {
@Autowired
@Autowired
private
XyqbUserProperties
xyqbUserProperties
;
private
XyqbUserProperties
xyqbUserProperties
;
@Bean
(
name
=
"
d
ataSource"
)
@Bean
(
name
=
"
xyqbUserD
ataSource"
)
public
DataSource
xyqbUserDataSource
()
{
public
DataSource
xyqbUserDataSource
()
{
HikariConfig
config
=
new
HikariConfig
();
HikariConfig
config
=
new
HikariConfig
();
config
.
setJdbcUrl
(
xyqbUserProperties
.
getJdbcUrl
());
config
.
setJdbcUrl
(
xyqbUserProperties
.
getJdbcUrl
());
...
@@ -46,19 +45,19 @@ public class XyqbUserSourceConfig {
...
@@ -46,19 +45,19 @@ public class XyqbUserSourceConfig {
config
.
setUsername
(
xyqbUserProperties
.
getUsername
());
config
.
setUsername
(
xyqbUserProperties
.
getUsername
());
config
.
setMaximumPoolSize
(
xyqbUserProperties
.
getMaxPoolSize
());
config
.
setMaximumPoolSize
(
xyqbUserProperties
.
getMaxPoolSize
());
config
.
setMinimumIdle
(
xyqbUserProperties
.
getMinPoolSize
());
config
.
setMinimumIdle
(
xyqbUserProperties
.
getMinPoolSize
());
config
.
addDataSourceProperty
(
"cachePrepStmts"
,
"true"
);
config
.
addDataSourceProperty
(
"prepStmtCacheSize"
,
"250"
);
config
.
addDataSourceProperty
(
"prepStmtCacheSize"
,
"250"
);
config
.
addDataSourceProperty
(
"cachePrepStmts"
,
"true"
);
config
.
addDataSourceProperty
(
"prepStmtCacheSqlLimit"
,
"2048"
);
config
.
addDataSourceProperty
(
"prepStmtCacheSqlLimit"
,
"2048"
);
return
new
HikariDataSource
(
config
);
return
new
HikariDataSource
(
config
);
}
}
@Bean
(
name
=
"xyqbUserSqlSessionFactory"
)
@Bean
(
name
=
"xyqbUserSqlSessionFactory"
)
public
SqlSessionFactory
xyqbUserSqlSessionFactory
(
@Qualifier
(
"
dataSource"
)
DataSource
d
ataSource
)
throws
Exception
{
public
SqlSessionFactory
xyqbUserSqlSessionFactory
(
@Qualifier
(
"
xyqbUserDataSource"
)
DataSource
xyqbUserD
ataSource
)
throws
Exception
{
final
SqlSessionFactoryBean
sessionFactory
=
new
SqlSessionFactoryBean
();
final
SqlSessionFactoryBean
sessionFactory
=
new
SqlSessionFactoryBean
();
sessionFactory
.
setDataSource
(
d
ataSource
);
sessionFactory
.
setDataSource
(
xyqbUserD
ataSource
);
sessionFactory
.
setMapperLocations
(
new
PathMatchingResourcePatternResolver
().
getResources
(
mapperLocations
));
sessionFactory
.
setMapperLocations
(
new
PathMatchingResourcePatternResolver
().
getResources
(
mapperLocations
));
sessionFactory
.
setTypeAliasesPackage
(
typeAliasesPackage
);
sessionFactory
.
setConfigLocation
(
new
PathMatchingResourcePatternResolver
().
getResource
(
configLocation
));
sessionFactory
.
setConfigLocation
(
new
PathMatchingResourcePatternResolver
().
getResource
(
configLocation
));
sessionFactory
.
setTypeAliasesPackage
(
typeAliasesPackage
);
return
sessionFactory
.
getObject
();
return
sessionFactory
.
getObject
();
}
}
...
...
src/main/java/cn/quantgroup/qgblservice/constant/Constant.java
0 → 100644
View file @
b65d715c
package
cn
.
quantgroup
.
qgblservice
.
constant
;
/**
* @Author fengjunkai
* @Date 2019-08-02 16:27
*/
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_IDCARD_LIST_SQL
=
""
;
}
}
src/main/java/cn/quantgroup/qgblservice/controller/BlackListCacheManagerController.java
0 → 100644
View file @
b65d715c
package
cn
.
quantgroup
.
qgblservice
.
controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* 预留刷新缓存接口
*
* @Author fengjunkai
* @Date 2019-07-31 17:16
*/
@RestController
@RequestMapping
(
"/"
)
public
class
BlackListCacheManagerController
{
}
src/main/java/cn/quantgroup/qgblservice/controller/BlackListImportManagerController.java
0 → 100644
View file @
b65d715c
package
cn
.
quantgroup
.
qgblservice
.
controller
;
import
cn.quantgroup.qgblservice.response.GlobalResponse
;
import
cn.quantgroup.qgblservice.service.IBlackListImportManagerService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* 黑名单导入管理接口
* black_type_list_new/black_type_idcard_new--->black_list
*
* @Author fengjunkai
* @Date 2019-07-31 17:18
*/
@RestController
@RequestMapping
(
"/"
)
public
class
BlackListImportManagerController
{
@Autowired
private
IBlackListImportManagerService
iBlackListImportManagerService
;
@RequestMapping
(
"/black_list_import_by_month"
)
public
GlobalResponse
blackListImportByMonth
(
String
startTime
,
String
endTime
)
{
return
iBlackListImportManagerService
.
blackListPhoneImport
(
startTime
,
endTime
);
}
}
src/main/java/cn/quantgroup/qgblservice/job/blimport/BlackListImportManagerJob.java
0 → 100644
View file @
b65d715c
package
cn
.
quantgroup
.
qgblservice
.
job
.
blimport
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
/**
* 量化派黑名单导入整理至新表任务
*
* @Author fengjunkai
* @Date 2019-07-31 17:13
*/
@Component
public
class
BlackListImportManagerJob
{
@Scheduled
(
cron
=
"0 0 6 * * ?"
)
public
void
blackListImportJob
(){
}
}
src/main/java/cn/quantgroup/qgblservice/
repository/mybatis/entity/master
/test.java
→
src/main/java/cn/quantgroup/qgblservice/
job
/test.java
View file @
b65d715c
package
cn
.
quantgroup
.
qgblservice
.
repository
.
mybatis
.
entity
.
master
;
package
cn
.
quantgroup
.
qgblservice
.
job
;
/**
/**
* @Author fengjunkai
* @Author fengjunkai
* @Date 2019-07-
02 14:50
* @Date 2019-07-
31 17:12
*/
*/
public
class
test
{
public
class
test
{
}
}
src/main/java/cn/quantgroup/qgblservice/model/blacklist/BlackListType.java
0 → 100644
View file @
b65d715c
package
cn
.
quantgroup
.
qgblservice
.
model
.
blacklist
;
import
lombok.Getter
;
/**
* @Author fengjunkai
* @Date 2019-07-31 17:43
*/
public
enum
BlackListType
{
CASH_LOAN
(
"现金贷黑名单"
,
"1"
),
BAI_TIAO
(
"白条黑名单"
,
"2"
),
QUNAR
(
"去哪儿黑名单"
,
"3"
),
COURT
(
"法院黑名单"
,
"4"
),
OFF_LINE
(
"线下黑名单"
,
"5"
),
XINYAN_CASH
(
"新颜套现黑名单"
,
"6"
),
PHONE_CASH
(
"手机套现黑名单"
,
"8"
),
HUAN_QIU_BLACK_CARD
(
"环球黑卡黑名单"
,
"9"
),
P2P
(
"P2P黑名单"
,
"101"
),
WE_SHARE
(
"weshare黑名单"
,
"102"
),
ZHI_MA
(
"芝麻行业关注黑名单"
,
"103"
),
OTHER_LOAN
(
"其他小贷黑名单"
,
"104"
),
QI_MEI
(
"企美黑名单"
,
"105"
),
NA_XIA
(
"拿下分期黑名单"
,
"106"
),
BLACK_BANK
(
"black_bank黑名单"
,
"201"
),
KAO_LA
(
"考拉黑名单"
,
"202"
),
BLACK_CAR
(
"black_car黑名单"
,
"203"
),
QIAN_HAI
(
"前海黑名单"
,
"204"
),
HUA_RONG
(
"华融黑名单"
,
"205"
),
REN_REN_XIN
(
"人人信黑名单"
,
"206"
),
TONG_DUN
(
"同盾黑名单"
,
"207"
),
DA_CHUI
(
"大锤黑名单"
,
"208"
),
GUO_MEI
(
"国美黑名单"
,
"209"
),
MEI_JIE
(
"美借黑名单"
,
"210"
),
KUAI_JIN
(
"快金黑名单"
,
"211"
),
ZHI_CHENG_A_FU
(
"至诚阿福黑名单"
,
"218"
),
SUAN_HUA
(
"算话黑名单"
,
"219"
),
MI_ME
(
"米么黑名单"
,
"212"
),
PHONE_LOAN
(
"手机贷黑名单"
,
"213"
),
PAI_PAI_DAI
(
"拍拍贷黑名单"
,
"214"
),
ZHANG_ZHONG
(
"掌众(闪电借款)黑名单"
,
"215"
),
XIANG_QIAN_DAI
(
"向前贷(明特量化)黑名单"
,
"216"
),
XIAO_DAI_CHANNEL1
(
"齐立欣提供小贷渠道1黑名单"
,
"217"
),
BLACK_DISPUTE
(
"black_dispute黑名单"
,
"301"
),
BAITIAO_CASH
(
"白条套现黑名单"
,
"401"
),
MA_SHANG
(
"马上闹事群众黑名单"
,
"501"
);
@Getter
private
String
type
;
@Getter
private
String
name
;
BlackListType
(
String
name
,
String
type
){
this
.
name
=
name
;
this
.
type
=
type
;
}
}
src/main/java/cn/quantgroup/qgblservice/model/text.java
0 → 100644
View file @
b65d715c
package
cn
.
quantgroup
.
qgblservice
.
model
;
/**
* @Author fengjunkai
* @Date 2019-07-31 17:42
*/
public
class
text
{
}
src/main/java/cn/quantgroup/qgblservice/repository/mybatis/entity/tidb/BlackListQueryTidbParam0.java
0 → 100644
View file @
b65d715c
package
cn
.
quantgroup
.
qgblservice
.
repository
.
mybatis
.
entity
.
tidb
;
import
lombok.Builder
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @Author fengjunkai
* @Date 2019-08-01 17:17
*/
@Builder
@Data
public
class
BlackListQueryTidbParam0
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
1524091819762740255L
;
private
String
startTime
;
private
String
endTime
;
}
src/main/java/cn/quantgroup/qgblservice/repository/mybatis/entity/tidb/BlackListQueryTidbVo0.java
0 → 100644
View file @
b65d715c
package
cn
.
quantgroup
.
qgblservice
.
repository
.
mybatis
.
entity
.
tidb
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.sql.Timestamp
;
/**
* @Author fengjunkai
* @Date 2019-07-31 19:36
*/
@Data
public
class
BlackListQueryTidbVo0
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
3763596487278973104L
;
private
long
id
;
private
String
uuid
;
private
String
name
;
private
String
phoneNo
;
private
String
idNo
;
private
String
majorType
;
private
String
type
;
private
String
firstOverdueDays
;
private
String
maxOverdueDays
;
private
String
blackLevel
;
private
boolean
status
;
private
Timestamp
createdAt
;
private
Timestamp
updatedAt
;
}
src/main/java/cn/quantgroup/qgblservice/repository/mybatis/mapper/master/TestMapper.java
deleted
100644 → 0
View file @
8f321041
package
cn
.
quantgroup
.
qgblservice
.
repository
.
mybatis
.
mapper
.
master
;
/**
* @Author fengjunkai
* @Date 2019-07-02 14:50
*/
public
interface
TestMapper
{
}
src/main/java/cn/quantgroup/qgblservice/repository/mybatis/mapper/tidb/BlackListQueryTidbMapper.java
0 → 100644
View file @
b65d715c
package
cn
.
quantgroup
.
qgblservice
.
repository
.
mybatis
.
mapper
.
tidb
;
import
cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.BlackListQueryTidbParam0
;
import
cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.BlackListQueryTidbVo0
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
/**
* @Author fengjunkai
* @Date 2019-08-01 15:22
*/
@Repository
public
interface
BlackListQueryTidbMapper
{
List
<
BlackListQueryTidbVo0
>
findBlackListPhoneByTime
(
BlackListQueryTidbParam0
blackListQueryTidbParam0
);
List
<
BlackListQueryTidbVo0
>
findBlackListIdCardByTime
(
BlackListQueryTidbParam0
blackListQueryTidbParam0
);
void
insertBatch
(
List
<
BlackListQueryTidbVo0
>
blackListQueryTidbVo0s
);
}
src/main/java/cn/quantgroup/qgblservice/repository/mybatis/xml/master/TestMapper.xml
deleted
100644 → 0
View file @
8f321041
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"cn.quantgroup.qgblservice.repository.mybatis.mapper.master.TestMapper"
>
</mapper>
\ No newline at end of file
src/main/java/cn/quantgroup/qgblservice/repository/mybatis/xml/tidb/BlackListQueryTidbMapper.xml
0 → 100644
View file @
b65d715c
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"cn.quantgroup.qgblservice.repository.mybatis.mapper.tidb.BlackListQueryTidbMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.BlackListQueryTidbVo0"
>
<id
column=
"id"
jdbcType=
"BIGINT"
property=
"id"
/>
<result
column=
"uuid"
jdbcType=
"VARCHAR"
property=
"uuid"
/>
<result
column=
"name"
jdbcType=
"VARCHAR"
property=
"name"
/>
<result
column=
"phoneNo"
jdbcType=
"VARCHAR"
property=
"phone_no"
/>
<result
column=
"idNo"
jdbcType=
"VARCHAR"
property=
"id_no"
/>
<result
column=
"majorType"
jdbcType=
"VARCHAR"
property=
"major_type"
/>
<result
column=
"type"
jdbcType=
"VARCHAR"
property=
"type"
/>
<result
column=
"firstOverdueDays"
jdbcType=
"VARCHAR"
property=
"first_overdue_days"
/>
<result
column=
"maxOverdueDays"
jdbcType=
"VARCHAR"
property=
"max_overdue_days"
/>
<result
column=
"blackLevel"
jdbcType=
"VARCHAR"
property=
"black_level"
/>
<result
column=
"status"
jdbcType=
"VARCHAR"
property=
"status"
/>
<result
column=
"createdAt"
jdbcType=
"TIMESTAMP"
property=
"created_at"
/>
<result
column=
"updatedAt"
jdbcType=
"TIMESTAMP"
property=
"updated_at"
/>
</resultMap>
<select
id=
"findBlackListPhoneByTime"
parameterType=
"cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.BlackListQueryTidbParam0"
resultMap=
"BaseResultMap"
>
select
b.uuid uuid
,c.name name
,a.phone phone_no
,c.id_no id_no
,a.createDate created_at
,a.createDate updated_at
,case when a.type
<
=99 and a.type>=1 then '1'
when a.type
<
=199 and a.type>=101 then '2'
when a.type
<
=299 and a.type>=201 then '3'
when a.type
<
=399 and a.type>=301 then '4'
when a.type
<
=499 and a.type>=401 then '5'
else '4' end major_type
,a.type type
,if(a.type=1,'逾期15+',d.content) join_black_reason
,null first_overdue_days
,null max_overdue_days
,'1' status
,case when a.type in (2,4,6) then 'B1'
when a.type in (3,5,8,9) then 'B2'
when a.type in (104,105,106,203,209,210,212,213,215,216,217) then 'C1'
when a.type in (102,103,201,202,204,205,206,207,208,214) then 'C2'
when a.type in (101,211,301,401,501) then 'C3'
when a.type in (0,1) and a.createDate
<
=DATE_SUB(CURDATE(),INTERVAL 12 month) then 'A1'
when a.type in (0,1) and a.createDate>DATE_SUB(CURDATE(),INTERVAL 12 month) and a.createDate
<
=DATE_SUB(CURDATE(),INTERVAL 24 month) then 'A2'
when a.type in (0,1) and a.createDate>DATE_SUB(CURDATE(),INTERVAL 24 month) then 'A3'
else 'C3' end black_level
from blacklist3_i_black_type_list_new a
left join blacklist3_i_black_type d on a.type=d.type
left join xyqb_user_i_user b on a.phone=b.phone_no
left join xyqb_user_i_user_detail c on b.id=c.user_id
where a.createDate>=#{startTime,jdbcType=VARCHAR}
and a.createDate
<
#{endTime, jdbcType=VARCHAR};
</select>
<select
id=
"findBlackListIdCardByTime"
parameterType=
"cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.BlackListQueryTidbParam0"
resultMap=
"BaseResultMap"
>
select
c.uuid uuid
,a.realName user_name
,b.phone_no phone_no
,a.idcard id_no
,a.createDate created_at
,a.createDate updated_at
,case when a.type
<
=99 and a.type>=1 then '1'
when a.type
<
=199 and a.type>=101 then '2'
when a.type
<
=299 and a.type>=201 then '3'
when a.type
<
=399 and a.type>=301 then '4'
when a.type
<
=499 and a.type>=401 then '5'
else '4' end major_type
,a.type type
,if(a.type=1,'逾期15+',d.content) join_black_reason
,null first_overdue_days
,null max_overdue_days
,'1' status
,case when a.type in (2,4,6) then 'B1'
when a.type in (3,5,8,9) then 'B2'
when a.type in (104,105,106,203,209,210,212,213,215,216,217) then 'C1'
when a.type in (102,103,201,202,204,205,206,207,208,214) then 'C2'
when a.type in (101,211,301,401,501) then 'C3'
when a.type in (0,1) and a.createDate
<
=DATE_SUB(CURDATE(),INTERVAL 12 month) then 'A1'
when a.type in (0,1) and a.createDate>DATE_SUB(CURDATE(),INTERVAL 12 month) and a.createDate
<
=DATE_SUB(CURDATE(),INTERVAL 24 month) then 'A2'
when a.type in (0,1) and a.createDate>DATE_SUB(CURDATE(),INTERVAL 24 month) then 'A3'
else 'C3' end black_level
from blacklist3_i_black_type_idcard_new a
left join blacklist3_i_black_type d on a.type=d.type
left join xyqb_user_i_user_detail b on a.idcard=b.id_no
left join xyqb_user_i_user c on b.user_id=c.id
where a.createDate>=#{startTime,jdbcType=VARCHAR}
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>
</mapper>
\ No newline at end of file
src/main/java/cn/quantgroup/qgblservice/response/GlobalResponse.java
0 → 100644
View file @
b65d715c
package
cn
.
quantgroup
.
qgblservice
.
response
;
/**
* 统一输出实体
*
* @Author fengjunkai
* @Date 2019-07-31 17:22
*/
public
class
GlobalResponse
{
private
int
code
;
private
String
businessCode
;
private
String
msg
;
private
Object
body
;
public
GlobalResponse
()
{
}
private
GlobalResponse
(
Object
object
)
{
body
=
object
;
code
=
0
;
msg
=
""
;
}
private
GlobalResponse
(
int
code
,
String
msg
,
Object
object
)
{
this
.
body
=
object
;
this
.
code
=
code
;
this
.
msg
=
msg
;
}
private
GlobalResponse
(
int
code
,
String
businessCode
,
String
msg
,
Object
object
)
{
this
.
code
=
code
;
this
.
businessCode
=
businessCode
;
this
.
msg
=
msg
;
this
.
body
=
object
;
}
public
static
GlobalResponse
success
()
{
return
new
GlobalResponse
(
0
,
"success"
,
null
);
}
public
static
GlobalResponse
success
(
String
msg
)
{
return
new
GlobalResponse
(
0
,
msg
,
null
);
}
public
static
GlobalResponse
success
(
Object
data
)
{
return
new
GlobalResponse
(
0
,
"success"
,
data
);
}
public
static
GlobalResponse
create
(
String
businessCode
,
String
msg
,
Object
object
)
{
return
new
GlobalResponse
(
0
,
businessCode
,
msg
,
object
);
}
public
static
GlobalResponse
error
(
String
msg
)
{
return
new
GlobalResponse
(
1
,
msg
,
null
);
}
public
static
GlobalResponse
error
(
int
code
,
Object
data
)
{
return
new
GlobalResponse
(
code
,
null
,
data
);
}
public
static
GlobalResponse
generate
(
Object
o
)
{
return
new
GlobalResponse
(
o
);
}
}
src/main/java/cn/quantgroup/qgblservice/service/IBlackListImportManagerService.java
0 → 100644
View file @
b65d715c
package
cn
.
quantgroup
.
qgblservice
.
service
;
import
cn.quantgroup.qgblservice.response.GlobalResponse
;
/**
* @Author fengjunkai
* @Date 2019-08-01 17:50
*/
public
interface
IBlackListImportManagerService
{
public
GlobalResponse
blackListPhoneImport
(
String
startTime
,
String
endTime
);
public
GlobalResponse
blackListIdCardImport
(
String
startTime
,
String
endTime
);
}
src/main/java/cn/quantgroup/qgblservice/service/impl/BlackListImportManagerServiceImpl.java
0 → 100644
View file @
b65d715c
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
lombok.extern.slf4j.Slf4j
;
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
* @Date 2019-08-01 17:51
*/
@Slf4j
@Service
public
class
BlackListImportManagerServiceImpl
implements
IBlackListImportManagerService
{
private
static
String
ERLY_DATE
=
"2015-08-01T00:00:00"
;
private
static
String
PHONE_BREAK_DATE
=
"2019-09-01T00:00:00"
;
private
static
String
IDCARD_BREAK_DATE
=
"2019-10-01T00:00:00"
;
@Autowired
private
BlackListQueryTidbMapper
blackListQueryTidbMapper
;
@Autowired
private
JdbcTemplate
blackListJdbcTemplate
;
public
static
void
main
(
String
[]
args
)
{
LocalDateTime
localDateTime
=
LocalDateTime
.
parse
(
PHONE_BREAK_DATE
);
System
.
out
.
println
();
}
/**
* 手机关联三要素黑名单导入新表
*
* @param startTime
* @param endTime
* @return
*/
@Override
public
GlobalResponse
blackListPhoneImport
(
String
startTime
,
String
endTime
)
{
LocalDateTime
erlyDate
=
LocalDateTime
.
parse
(
ERLY_DATE
);
String
phoneBreakDate
=
LocalDateTime
.
parse
(
PHONE_BREAK_DATE
).
format
(
DateTimeFormatter
.
ISO_DATE
);
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
);
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
));
}
catch
(
Exception
e
)
{
log
.
error
(
"手机号黑名单导入发生异常, startTime: {} , endTime: {} "
,
startTime
,
endTime
);
}
}
log
.
info
(
"手机号整合导入新表完毕"
);
return
GlobalResponse
.
success
(
"手机号关联三要素导入黑名单新表完毕"
);
}
/**
* 身份证关联三要素导入黑名单新表
*
* @param startTime
* @param endTime
* @return
*/
@Override
public
GlobalResponse
blackListIdCardImport
(
String
startTime
,
String
endTime
)
{
LocalDateTime
erlyDate
=
LocalDateTime
.
parse
(
ERLY_DATE
);
String
idCardBreakDate
=
LocalDateTime
.
parse
(
IDCARD_BREAK_DATE
).
format
(
DateTimeFormatter
.
ISO_DATE
);
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
try
{
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
));
}
catch
(
Exception
e
)
{
log
.
error
(
"身份证黑名单导入发生异常, startTime: {} , endTime: {} "
,
startTime
,
endTime
);
}
}
log
.
info
(
"身份证黑名单整合导入新表完毕"
);
return
GlobalResponse
.
success
(
"身份真关联三要素导入黑名单新表完毕"
);
}
}
src/main/java/cn/quantgroup/qgblservice/utils/jdbc/JdbcExecuters.java
0 → 100644
View file @
b65d715c
package
cn
.
quantgroup
.
qgblservice
.
utils
.
jdbc
;
import
cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.BlackListQueryTidbVo0
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
java.sql.*
;
import
java.util.List
;
import
java.util.concurrent.atomic.AtomicInteger
;
/**
* Created by renfeng on 2019/4/22.
*/
public
class
JdbcExecuters
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
JdbcExecuters
.
class
);
public
static
int
batchExecute
(
List
<
BlackListQueryTidbVo0
>
blackListQueryTidbVo0s
,
String
sql
,
JdbcTemplate
jdbcTemplate
)
{
Connection
conn
=
null
;
PreparedStatement
ps
=
null
;
AtomicInteger
atomicInteger
=
new
AtomicInteger
();
try
{
conn
=
jdbcTemplate
.
getDataSource
().
getConnection
();
ps
=
conn
.
prepareStatement
(
sql
);
conn
.
setAutoCommit
(
false
);
for
(
int
i
=
0
;
i
<
blackListQueryTidbVo0s
.
size
();
i
++)
{
BlackListQueryTidbVo0
blackListQueryTidbVo0
=
blackListQueryTidbVo0s
.
get
(
i
);
ps
.
setString
(
1
,
blackListQueryTidbVo0
.
getUuid
());
ps
.
setString
(
2
,
blackListQueryTidbVo0
.
getName
());
ps
.
setString
(
3
,
blackListQueryTidbVo0
.
getPhoneNo
());
ps
.
setString
(
4
,
blackListQueryTidbVo0
.
getIdNo
());
ps
.
setString
(
5
,
blackListQueryTidbVo0
.
getMajorType
());
ps
.
setString
(
6
,
blackListQueryTidbVo0
.
getType
());
ps
.
setString
(
7
,
blackListQueryTidbVo0
.
getFirstOverdueDays
());
ps
.
setString
(
8
,
blackListQueryTidbVo0
.
getMaxOverdueDays
());
ps
.
setString
(
9
,
blackListQueryTidbVo0
.
getBlackLevel
());
ps
.
setTimestamp
(
10
,
blackListQueryTidbVo0
.
getCreatedAt
());
ps
.
setTimestamp
(
11
,
blackListQueryTidbVo0
.
getUpdatedAt
());
ps
.
addBatch
();
atomicInteger
.
getAndIncrement
();
if
(
i
>
0
&&
i
%
5000
==
0
)
{
ps
.
executeBatch
();
conn
.
commit
();
ps
.
clearBatch
();
}
}
ps
.
executeBatch
();
conn
.
commit
();
}
catch
(
Exception
e
)
{
log
.
error
(
"清洗数据批量插入数据异常"
,
e
);
}
finally
{
close
(
conn
,
ps
,
null
);
}
return
atomicInteger
.
get
();
}
/**
* 关闭资源
*
* @param conn
* @param st
* @param rs
*/
private
static
void
close
(
Connection
conn
,
Statement
st
,
ResultSet
rs
)
{
try
{
if
(
rs
!=
null
)
rs
.
close
();
if
(
st
!=
null
)
st
.
close
();
if
(
conn
!=
null
)
conn
.
close
();
}
catch
(
SQLException
e
)
{
log
.
error
(
"清洗数据关闭jdbc资源异常"
,
e
);
}
}
}
src/main/java/cn/quantgroup/qgblservice/utils/test.java
0 → 100644
View file @
b65d715c
package
cn
.
quantgroup
.
qgblservice
.
utils
;
/**
* @Author fengjunkai
* @Date 2019-08-02 16:22
*/
public
class
test
{
}
src/main/resources/application.properties
deleted
100644 → 0
View file @
8f321041
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