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
1fb419ac
Commit
1fb419ac
authored
Jul 15, 2021
by
郑建
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删掉tidb的使用
parent
2e3d1a7e
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
40 additions
and
164 deletions
+40
-164
TidbDataSourceConfig.java
...ntgroup/qgblservice/config/tidb/TidbDataSourceConfig.java
+32
-32
BlackListImportManagerController.java
...lservice/controller/BlackListImportManagerController.java
+0
-13
BlackListQueryTidbMapper.java
...ository/mybatis/mapper/tidb/BlackListQueryTidbMapper.java
+8
-8
IBlackListImportService.java
...antgroup/qgblservice/service/IBlackListImportService.java
+0
-2
IBlackListManagerService.java
...ntgroup/qgblservice/service/IBlackListManagerService.java
+0
-8
BlackListImportServiceImpl.java
.../qgblservice/service/impl/BlackListImportServiceImpl.java
+0
-72
BlackListManagerServiceImpl.java
...qgblservice/service/impl/BlackListManagerServiceImpl.java
+0
-29
No files found.
src/main/java/cn/quantgroup/qgblservice/config/tidb/TidbDataSourceConfig.java
View file @
1fb419ac
...
@@ -38,39 +38,39 @@ public class TidbDataSourceConfig {
...
@@ -38,39 +38,39 @@ public class TidbDataSourceConfig {
@Value
(
"${tidb.config-location}"
)
@Value
(
"${tidb.config-location}"
)
private
String
configLocation
;
private
String
configLocation
;
@Autowired
//
@Autowired
private
TidbDataSourceProperties
tidbDataSourceProperties
;
//
private TidbDataSourceProperties tidbDataSourceProperties;
@Bean
(
name
=
"tidbDataSource"
)
//
@Bean(name = "tidbDataSource")
public
DataSource
tidbDataSource
()
{
//
public DataSource tidbDataSource() {
HikariConfig
config
=
new
HikariConfig
();
//
HikariConfig config = new HikariConfig();
config
.
setJdbcUrl
(
tidbDataSourceProperties
.
getJdbcUrl
());
//
config.setJdbcUrl(tidbDataSourceProperties.getJdbcUrl());
log
.
info
(
"TIDB数据库地址:{}"
,
tidbDataSourceProperties
.
getJdbcUrl
());
//
log.info("TIDB数据库地址:{}", tidbDataSourceProperties.getJdbcUrl());
config
.
setPassword
(
tidbDataSourceProperties
.
getPassword
());
//
config.setPassword(tidbDataSourceProperties.getPassword());
config
.
setUsername
(
tidbDataSourceProperties
.
getUsername
());
//
config.setUsername(tidbDataSourceProperties.getUsername());
config
.
setMaximumPoolSize
(
tidbDataSourceProperties
.
getMaxPoolSize
());
//
config.setMaximumPoolSize(tidbDataSourceProperties.getMaxPoolSize());
config
.
setMinimumIdle
(
tidbDataSourceProperties
.
getMinPoolSize
());
//
config.setMinimumIdle(tidbDataSourceProperties.getMinPoolSize());
config
.
addDataSourceProperty
(
"cachePrepStmts"
,
"true"
);
//
config.addDataSourceProperty("cachePrepStmts", "true");
config
.
addDataSourceProperty
(
"prepStmtCacheSize"
,
"250"
);
//
config.addDataSourceProperty("prepStmtCacheSize", "250");
config
.
addDataSourceProperty
(
"prepStmtCacheSqlLimit"
,
"2048"
);
//
config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
return
new
HikariDataSource
(
config
);
//
return new HikariDataSource(config);
}
//
}
@Bean
(
name
=
"tidbSqlSessionFactory"
)
//
@Bean(name = "tidbSqlSessionFactory")
public
SqlSessionFactory
tidbSqlSessionFactory
(
@Qualifier
(
"tidbDataSource"
)
DataSource
tidbDataSource
)
throws
Exception
{
//
public SqlSessionFactory tidbSqlSessionFactory(@Qualifier("tidbDataSource") DataSource tidbDataSource) throws Exception {
final
SqlSessionFactoryBean
sessionFactory
=
new
SqlSessionFactoryBean
();
//
final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
sessionFactory
.
setDataSource
(
tidbDataSource
);
//
sessionFactory.setDataSource(tidbDataSource);
sessionFactory
.
setMapperLocations
(
new
PathMatchingResourcePatternResolver
()
//
sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver()
.
getResources
(
mapperLocations
));
//
.getResources(mapperLocations));
sessionFactory
.
setTypeAliasesPackage
(
typeAliasesPackage
);
//
sessionFactory.setTypeAliasesPackage(typeAliasesPackage);
sessionFactory
.
setConfigLocation
(
new
PathMatchingResourcePatternResolver
()
//
sessionFactory.setConfigLocation(new PathMatchingResourcePatternResolver()
.
getResource
(
configLocation
));
//
.getResource(configLocation));
return
sessionFactory
.
getObject
();
//
return sessionFactory.getObject();
}
//
}
//
@Bean
(
name
=
"tidbSqlSessionTemplate"
)
//
@Bean(name = "tidbSqlSessionTemplate")
public
SqlSessionTemplate
tidbSqlSessionTemplate
(
@Qualifier
(
"tidbSqlSessionFactory"
)
SqlSessionFactory
tidbSqlSessionFactory
)
throws
Exception
{
//
public SqlSessionTemplate tidbSqlSessionTemplate(@Qualifier("tidbSqlSessionFactory") SqlSessionFactory tidbSqlSessionFactory) throws Exception {
return
new
SqlSessionTemplate
(
tidbSqlSessionFactory
,
ExecutorType
.
BATCH
);
//
return new SqlSessionTemplate(tidbSqlSessionFactory, ExecutorType.BATCH);
}
//
}
}
}
src/main/java/cn/quantgroup/qgblservice/controller/BlackListImportManagerController.java
View file @
1fb419ac
...
@@ -28,19 +28,6 @@ public class BlackListImportManagerController {
...
@@ -28,19 +28,6 @@ public class BlackListImportManagerController {
@Autowired
@Autowired
private
IThirdPartBlackListManagerService
iThirdPartBlackListManagerService
;
private
IThirdPartBlackListManagerService
iThirdPartBlackListManagerService
;
@RequestMapping
(
"/phone_black_list_import_by_month"
)
public
GlobalResponse
phoneBlackListImportByMonth
(
String
startTime
,
String
endTime
)
{
log
.
info
(
"方法phoneBlackListImportByMonth入参, startTime: {} , endTime: {} "
,
startTime
,
endTime
);
return
iBlackListImportManagerService
.
blackListPhoneImport
(
startTime
,
endTime
);
}
@RequestMapping
(
"/id_no_black_list_import_by_month"
)
public
GlobalResponse
idNoBlackListImportByMonth
(
String
startTime
,
String
endTime
){
log
.
info
(
"方法idNoBlackListImportByMonth入参, startTime: {} , endTime: {} "
,
startTime
,
endTime
);
return
iBlackListImportManagerService
.
blackListIdCardImport
(
startTime
,
endTime
);
}
/**
/**
* -----------------------------------------------------------------------------<br>
* -----------------------------------------------------------------------------<br>
* 描 述: 三方数据源项目,命中外部黑名单,调该接口写入黑名单库 <br>
* 描 述: 三方数据源项目,命中外部黑名单,调该接口写入黑名单库 <br>
...
...
src/main/java/cn/quantgroup/qgblservice/repository/mybatis/mapper/tidb/BlackListQueryTidbMapper.java
View file @
1fb419ac
...
@@ -10,11 +10,11 @@ import java.util.List;
...
@@ -10,11 +10,11 @@ import java.util.List;
* @Author fengjunkai
* @Author fengjunkai
* @Date 2019-08-01 15:22
* @Date 2019-08-01 15:22
*/
*/
@Repository
//
@Repository
public
interface
BlackListQueryTidbMapper
{
//
public interface BlackListQueryTidbMapper {
//
List
<
BlackListQueryTidbVo0
>
findBlackListPhoneByTime
(
BlackListQueryTidbParam0
blackListQueryTidbParam0
);
//
List<BlackListQueryTidbVo0> findBlackListPhoneByTime(BlackListQueryTidbParam0 blackListQueryTidbParam0);
//
List
<
BlackListQueryTidbVo0
>
findBlackListIdCardByTime
(
BlackListQueryTidbParam0
blackListQueryTidbParam0
);
//
List<BlackListQueryTidbVo0> findBlackListIdCardByTime(BlackListQueryTidbParam0 blackListQueryTidbParam0);
//
}
//
}
src/main/java/cn/quantgroup/qgblservice/service/IBlackListImportService.java
View file @
1fb419ac
...
@@ -9,7 +9,5 @@ import cn.quantgroup.qgblservice.response.GlobalResponse;
...
@@ -9,7 +9,5 @@ import cn.quantgroup.qgblservice.response.GlobalResponse;
@Deprecated
@Deprecated
public
interface
IBlackListImportService
{
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
View file @
1fb419ac
...
@@ -17,14 +17,6 @@ public interface IBlackListManagerService {
...
@@ -17,14 +17,6 @@ public interface IBlackListManagerService {
public
GlobalResponse
manualImportBlackList
(
String
sourcePath
);
public
GlobalResponse
manualImportBlackList
(
String
sourcePath
);
// public Map<String,Object> importBlacklistByExcel(MultipartFile file) throws IOException;
@Deprecated
public
void
blackListPhoneHistoryManagerByMonth
(
String
startTime
,
String
endTime
);
@Deprecated
public
void
blackListIdCardHistoryManagerByMonth
(
String
startTime
,
String
endTime
);
@Deprecated
@Deprecated
public
void
blackListPhoneManagerByDay
(
String
startTime
,
String
endTime
);
public
void
blackListPhoneManagerByDay
(
String
startTime
,
String
endTime
);
...
...
src/main/java/cn/quantgroup/qgblservice/service/impl/BlackListImportServiceImpl.java
View file @
1fb419ac
...
@@ -25,79 +25,7 @@ public class BlackListImportServiceImpl implements IBlackListImportService {
...
@@ -25,79 +25,7 @@ public class BlackListImportServiceImpl implements IBlackListImportService {
@Autowired
@Autowired
private
IBlackListManagerService
iBlackListManagerService
;
private
IBlackListManagerService
iBlackListManagerService
;
/**
* 手机关联三要素黑名单导入新表
*
* @param startTime
* @param endTime
* @return
*/
@Async
@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
{
endTime
=
erlyDate
.
plusMonths
(
i
+
1
).
format
(
DateTimeFormatter
.
ISO_DATE
);
startTime
=
erlyDate
.
plusMonths
(
i
).
format
(
DateTimeFormatter
.
ISO_DATE
);
if
(
phoneBreakDate
.
equalsIgnoreCase
(
startTime
))
{
break
;
}
iBlackListManagerService
.
blackListPhoneHistoryManagerByMonth
(
startTime
,
endTime
);
}
catch
(
Exception
e
)
{
log
.
error
(
"手机号整合导入黑名单新表异常, startTime: {} , endTime: {} "
,
startTime
,
endTime
,
e
);
}
}
log
.
info
(
"手机号整合导入新表完毕"
);
return
GlobalResponse
.
success
(
"手机号关联三要素导入黑名单新表完毕"
);
}
/**
* 身份证关联三要素导入黑名单新表
*
* @param startTime
* @param endTime
* @return
*/
@Async
@Override
public
GlobalResponse
blackListIdCardImport
(
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
;
}
iBlackListManagerService
.
blackListIdCardHistoryManagerByMonth
(
startTime
,
endTime
);
}
catch
(
Exception
e
)
{
log
.
error
(
"身份证号整合导入黑名单新表异常, startTime: {} , endTime: {} "
,
startTime
,
endTime
,
e
);
}
}
log
.
info
(
"身份证号整合导入新表完毕"
);
return
GlobalResponse
.
success
(
"身份证号关联三要素导入黑名单新表完毕"
);
}
}
}
src/main/java/cn/quantgroup/qgblservice/service/impl/BlackListManagerServiceImpl.java
View file @
1fb419ac
...
@@ -4,7 +4,6 @@ import cn.quantgroup.qgblservice.constant.Constant;
...
@@ -4,7 +4,6 @@ import cn.quantgroup.qgblservice.constant.Constant;
import
cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.BlackListQueryTidbParam0
;
import
cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.BlackListQueryTidbParam0
;
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.xyqbuser.XyqbUser
;
import
cn.quantgroup.qgblservice.repository.mybatis.entity.xyqbuser.XyqbUser
;
import
cn.quantgroup.qgblservice.repository.mybatis.mapper.tidb.BlackListQueryTidbMapper
;
import
cn.quantgroup.qgblservice.response.GlobalResponse
;
import
cn.quantgroup.qgblservice.response.GlobalResponse
;
import
cn.quantgroup.qgblservice.service.IBlackListManagerService
;
import
cn.quantgroup.qgblservice.service.IBlackListManagerService
;
import
cn.quantgroup.qgblservice.service.IBlackListUpdateThreeEleService
;
import
cn.quantgroup.qgblservice.service.IBlackListUpdateThreeEleService
;
...
@@ -35,8 +34,6 @@ import java.util.concurrent.TimeUnit;
...
@@ -35,8 +34,6 @@ import java.util.concurrent.TimeUnit;
@Service
@Service
public
class
BlackListManagerServiceImpl
implements
IBlackListManagerService
{
public
class
BlackListManagerServiceImpl
implements
IBlackListManagerService
{
@Autowired
private
BlackListQueryTidbMapper
blackListQueryTidbMapper
;
@Autowired
@Autowired
private
JdbcTemplate
blackListJdbcTemplate
;
private
JdbcTemplate
blackListJdbcTemplate
;
@Autowired
@Autowired
...
@@ -45,9 +42,6 @@ public class BlackListManagerServiceImpl implements IBlackListManagerService {
...
@@ -45,9 +42,6 @@ public class BlackListManagerServiceImpl implements IBlackListManagerService {
private
JdbcTemplate
xyqbUserJdbcTemplate
;
private
JdbcTemplate
xyqbUserJdbcTemplate
;
@Autowired
@Autowired
private
IBlackListUpdateThreeEleService
iBlackListUpdateThreeEleService
;
private
IBlackListUpdateThreeEleService
iBlackListUpdateThreeEleService
;
@Autowired
private
BlackListQueryTidbMapper
blackListQueryMapper
;
@Autowired
@Autowired
private
ExcelUtil
excelUtil
;
private
ExcelUtil
excelUtil
;
@Async
@Async
...
@@ -182,31 +176,8 @@ public class BlackListManagerServiceImpl implements IBlackListManagerService {
...
@@ -182,31 +176,8 @@ public class BlackListManagerServiceImpl implements IBlackListManagerService {
// return result;
// return result;
// }
// }
@Override
public
void
blackListPhoneHistoryManagerByMonth
(
String
startTime
,
String
endTime
)
{
List
<
BlackListQueryTidbVo0
>
blackListQueryTidbVo0s
=
blackListQueryTidbMapper
.
findBlackListPhoneByTime
(
BlackListQueryTidbParam0
.
builder
().
startTime
(
startTime
).
endTime
(
endTime
).
build
());
if
(
CollectionUtils
.
isNotEmpty
(
blackListQueryTidbVo0s
))
{
Stopwatch
stopwatch
=
Stopwatch
.
createStarted
();
int
batchExecuteResult
=
JdbcExecuters
.
blackListImportBatchExecute
(
blackListQueryTidbVo0s
,
Constant
.
SQL
.
BLACK_LIST_NEW_BATCH_INSERT_BLACK_THREE_ELE_LIST_SQL
,
blackListJdbcTemplate
,
Constant
.
BATCH_TYPE
.
BATCH_PHONES_MONTH
);
log
.
info
(
"{} - {} 手机号黑名单(month)关联三要素导入完成, 结果大小: {} , 入库大小: {} , 耗时: {} "
,
startTime
,
endTime
,
blackListQueryTidbVo0s
.
size
(),
batchExecuteResult
,
stopwatch
.
stop
().
elapsed
(
TimeUnit
.
MILLISECONDS
));
}
}
@Override
public
void
blackListIdCardHistoryManagerByMonth
(
String
startTime
,
String
endTime
)
{
List
<
BlackListQueryTidbVo0
>
blackListQueryTidbVo0s
=
blackListQueryTidbMapper
.
findBlackListIdCardByTime
(
BlackListQueryTidbParam0
.
builder
().
startTime
(
startTime
).
endTime
(
endTime
).
build
());
if
(
CollectionUtils
.
isNotEmpty
(
blackListQueryTidbVo0s
))
{
Stopwatch
stopwatch
=
Stopwatch
.
createStarted
();
int
batchExecuteResult
=
JdbcExecuters
.
blackListImportBatchExecute
(
blackListQueryTidbVo0s
,
Constant
.
SQL
.
BLACK_LIST_NEW_BATCH_INSERT_BLACK_THREE_ELE_LIST_SQL
,
blackListJdbcTemplate
,
Constant
.
BATCH_TYPE
.
BATCH_IDCARDS_MONTH
);
log
.
info
(
"{} - {} 身份证号黑名单(month)关联三要素导入完成, 结果大小: {} , 入库大小: {} , 耗时: {} "
,
startTime
,
endTime
,
blackListQueryTidbVo0s
.
size
(),
batchExecuteResult
,
stopwatch
.
stop
().
elapsed
(
TimeUnit
.
MILLISECONDS
));
}
}
@Override
@Override
public
void
blackListPhoneManagerByDay
(
String
startTime
,
String
endTime
)
{
public
void
blackListPhoneManagerByDay
(
String
startTime
,
String
endTime
)
{
...
...
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