Commit 9321b413 authored by data爬虫-冯 军凯's avatar data爬虫-冯 军凯

fix

parent 4561222c
...@@ -3,6 +3,7 @@ package cn.quantgroup.qgblservice.job.blimport; ...@@ -3,6 +3,7 @@ package cn.quantgroup.qgblservice.job.blimport;
import cn.quantgroup.qgblservice.service.IBlackListManagerService; import cn.quantgroup.qgblservice.service.IBlackListManagerService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
...@@ -18,7 +19,7 @@ public class BlackListImportManagerJob { ...@@ -18,7 +19,7 @@ public class BlackListImportManagerJob {
@Autowired @Autowired
private IBlackListManagerService iBlackListManagerService; private IBlackListManagerService iBlackListManagerService;
// @Scheduled(cron = "0 0 6 * * ?") @Scheduled(cron = "0 0 4 * * ?")
public void blackListImportJob() { public void blackListImportJob() {
try { try {
......
...@@ -5,6 +5,7 @@ import cn.quantgroup.qgblservice.service.IBlackListImportService; ...@@ -5,6 +5,7 @@ import cn.quantgroup.qgblservice.service.IBlackListImportService;
import cn.quantgroup.qgblservice.service.IBlackListManagerService; import cn.quantgroup.qgblservice.service.IBlackListManagerService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.LocalDateTime; import java.time.LocalDateTime;
...@@ -31,6 +32,7 @@ public class BlackListImportServiceImpl implements IBlackListImportService { ...@@ -31,6 +32,7 @@ public class BlackListImportServiceImpl implements IBlackListImportService {
* @param endTime * @param endTime
* @return * @return
*/ */
@Async
@Override @Override
public GlobalResponse blackListPhoneImport(String startTime, String endTime) { public GlobalResponse blackListPhoneImport(String startTime, String endTime) {
...@@ -66,6 +68,7 @@ public class BlackListImportServiceImpl implements IBlackListImportService { ...@@ -66,6 +68,7 @@ public class BlackListImportServiceImpl implements IBlackListImportService {
* @param endTime * @param endTime
* @return * @return
*/ */
@Async
@Override @Override
public GlobalResponse blackListIdCardImport(String startTime, String endTime) { public GlobalResponse blackListIdCardImport(String startTime, String endTime) {
......
...@@ -9,6 +9,7 @@ import cn.quantgroup.qgblservice.repository.mybatis.mapper.blacklist.BlackListQu ...@@ -9,6 +9,7 @@ import cn.quantgroup.qgblservice.repository.mybatis.mapper.blacklist.BlackListQu
import cn.quantgroup.qgblservice.repository.mybatis.mapper.tidb.BlackListQueryTidbMapper; import cn.quantgroup.qgblservice.repository.mybatis.mapper.tidb.BlackListQueryTidbMapper;
import cn.quantgroup.qgblservice.service.IBlackListManagerService; import cn.quantgroup.qgblservice.service.IBlackListManagerService;
import cn.quantgroup.qgblservice.utils.jdbc.JdbcExecuters; import cn.quantgroup.qgblservice.utils.jdbc.JdbcExecuters;
import com.alibaba.fastjson.JSON;
import com.google.common.base.Stopwatch; import com.google.common.base.Stopwatch;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
...@@ -46,7 +47,10 @@ public class BlackListManagerServiceImpl implements IBlackListManagerService { ...@@ -46,7 +47,10 @@ public class BlackListManagerServiceImpl implements IBlackListManagerService {
public void blackListRealTimeManagerByDay() { public void blackListRealTimeManagerByDay() {
List<BlackListQueryTidbVo0> blackListQueryTidbVo0s = new ArrayList<>(); List<BlackListQueryTidbVo0> blackListQueryTidbVo0s = new ArrayList<>();
Stopwatch stopwatch = Stopwatch.createStarted();
List<BlackListQueryTidbVo0> userLoanOverdue15DaysLists = xyqbJdbcTemplate.query(Constant.SQL.XYQB_QUERY_USER_LOAN_OVERDUE_15DAY_SQL, new BeanPropertyRowMapper<>(BlackListQueryTidbVo0.class)); List<BlackListQueryTidbVo0> userLoanOverdue15DaysLists = xyqbJdbcTemplate.query(Constant.SQL.XYQB_QUERY_USER_LOAN_OVERDUE_15DAY_SQL, new BeanPropertyRowMapper<>(BlackListQueryTidbVo0.class));
log.info("每天执行查询15+逾期用户黑名单, result: {} , 耗时: {} ", JSON.toJSONString(userLoanOverdue15DaysLists), stopwatch.stop().elapsed(TimeUnit.MILLISECONDS));
for (int i = 0; i < userLoanOverdue15DaysLists.size(); i++) { for (int i = 0; i < userLoanOverdue15DaysLists.size(); i++) {
BlackListQueryTidbVo0 blackListQueryTidbVo0 = userLoanOverdue15DaysLists.get(i); BlackListQueryTidbVo0 blackListQueryTidbVo0 = userLoanOverdue15DaysLists.get(i);
...@@ -68,9 +72,9 @@ public class BlackListManagerServiceImpl implements IBlackListManagerService { ...@@ -68,9 +72,9 @@ public class BlackListManagerServiceImpl implements IBlackListManagerService {
} }
if (CollectionUtils.isNotEmpty(blackListQueryTidbVo0s)) { if (CollectionUtils.isNotEmpty(blackListQueryTidbVo0s)) {
Stopwatch stopwatch = Stopwatch.createStarted(); Stopwatch stopwatchInsert = 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); 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("每日定时导入近5天逾期15+的用户黑名单完成, 查询大小: {} , 入库大小: {} , 耗时: {} ", userLoanOverdue15DaysLists.size(), batchExecuteResult, stopwatch.stop().elapsed(TimeUnit.MILLISECONDS)); log.info("每日定时导入近5天逾期15+的用户黑名单完成, 查询大小: {} , 入库大小: {} , 耗时: {} ", userLoanOverdue15DaysLists.size(), batchExecuteResult, stopwatchInsert.stop().elapsed(TimeUnit.MILLISECONDS));
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment