Commit 60716508 authored by 郝彦辉's avatar 郝彦辉

copyBlackGreyListResult_old2方法

parent 2e1e6e8c
......@@ -693,10 +693,12 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService {
List<BlackGreyListResult> blackListResults = new ArrayList<>();
int pageSize = 2000;
int offset = 0;
String sql_tmp = ConstantBlackGrey.SQL.BL_QUERY_BLACKLIST_RESULT_BY_LIMIT;
sql_tmp = sql_tmp.replace("r.*"," r.r_id, r.uuid, r.black_type, r.types, r.reasons ");
//查询黑名单集合
while (true) {
try{
List<BlackGreyListResult> tmpQueryList = blackListJdbcTemplate.query(ConstantBlackGrey.SQL.BL_QUERY_BLACKLIST_RESULT_BY_LIMIT, new Object[]{offset, pageSize}, new RowMapper<BlackGreyListResult>() {
List<BlackGreyListResult> tmpQueryList = blackListJdbcTemplate.query(sql_tmp, new Object[]{offset, pageSize}, new RowMapper<BlackGreyListResult>() {
@Override
public BlackGreyListResult mapRow(ResultSet rs, int rowNum) throws SQLException {
BlackGreyListResult bean = new BlackGreyListResult();
......@@ -751,10 +753,12 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService {
List<BlackGreyListResult> blackListResults = new ArrayList<>();
int pageSize = 2000;
int offset = 0;
String sql_tmp = ConstantBlackGrey.SQL.BL_QUERY_BLACKLIST_RESULT_BY_LIMIT;
sql_tmp = sql_tmp.replace("r.*","r.r_id, r.uuid, r.black_type");
//查询黑名单集合
while (true) {
try{
List<BlackGreyListResult> tmpQueryList = blackListJdbcTemplate.query(ConstantBlackGrey.SQL.BL_QUERY_BLACKLIST_RESULT_BY_LIMIT, new Object[]{offset, pageSize}, new RowMapper<BlackGreyListResult>() {
List<BlackGreyListResult> tmpQueryList = blackListJdbcTemplate.query(sql_tmp, new Object[]{offset, pageSize}, new RowMapper<BlackGreyListResult>() {
@Override
public BlackGreyListResult mapRow(ResultSet rs, int rowNum) throws SQLException {
BlackGreyListResult bean = new BlackGreyListResult();
......
......@@ -3,6 +3,7 @@ package cn.quantgroup.qgblservice.service.impl;
import cn.quantgroup.qgblservice.constant.Constant;
import cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.BlackGreyListDetails;
import cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.BlackGreyListQueryVo;
import cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.BlackGreyListResult;
import cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.BlackListChannelExpireConfigVo0;
import cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.BlackListQueryTidbVo0;
import cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.TmpBlackGreyList;
......@@ -503,6 +504,10 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS
//tmpBlackGreyToProduct();
}
if("copyBlackGreyListResult_old2".equals(operatType)){
copyBlackGreyListResult_old2();
}
//测试job中的方法
//现金分期,每日逾期15+用户 每日执行导入新的黑名单表
......@@ -642,6 +647,70 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS
//return "dealWith all OK, totalCount="+totalCount+",runOkCount="+runOkCount;
}
private void copyBlackGreyListResult_old2() {
long startTime = System.currentTimeMillis();
int pageSize = 1000;
int offset = 0;
String sql_tmp = "SELECT r.* FROM black_grey_list_result_old2 r ORDER BY r.r_id LIMIT ?, ? ; ";
int count_query = 0;
int count_insert = 0;
while (true) {
long start = System.currentTimeMillis();
try{
List<BlackGreyListResult> tmpQueryList = blackListJdbcTemplate.query(sql_tmp, new Object[]{offset, pageSize}, new RowMapper<BlackGreyListResult>() {
@Override
public BlackGreyListResult mapRow(ResultSet rs, int rowNum) throws SQLException {
BlackGreyListResult bean = new BlackGreyListResult();
bean.setRId(rs.getString("r_id"));
bean.setUuid(rs.getString("uuid"));
bean.setName(rs.getString("name"));
bean.setPhoneNo(rs.getString("phone_no"));
bean.setIdNo(rs.getString("id_no"));
bean.setPhoneNoMd5(rs.getString("phone_no_md5"));
bean.setIdNoMd5(rs.getString("id_no_md5"));
bean.setBlackType(rs.getString("black_type"));
bean.setTypes(rs.getString("types"));
bean.setReasons(rs.getString("reasons"));
bean.setCreatedAt(rs.getTimestamp("created_at"));
bean.setUpdatedAt(rs.getTimestamp("updated_at"));
return bean;
}
});
if(tmpQueryList!=null && tmpQueryList.size() >0){
count_query+=tmpQueryList.size();
for (BlackGreyListResult blackGreyListResult : tmpQueryList){
try{
int ins = blackGreyListMapper.insertBlackGreyListResult(blackGreyListResult);
count_insert+=ins;
}catch (Exception e){
log.error("插入黑灰名单结果表异常, offset: {} , pageSize: {} , bean: {} ", offset, pageSize, JSON.toJSONString(blackGreyListResult), e);
}
}
}else {
break;
}
}catch (Exception e){
log.error("插入黑灰名单结果表异常, offset: {} , pageSize: {} ", offset, pageSize);
}finally {
log.info("插入结束, offset: {} , pageSize: {} , 耗时: {} ", offset, pageSize, (System.currentTimeMillis()-start));
offset=offset + pageSize;
}
}
log.info("黑转灰-查询黑灰名单结果表结束, 查询大小: {} , 插入大小: {} , 耗时: {} ", count_query, count_insert, (System.currentTimeMillis()-startTime));
}
private void updat_idNoIsPhone(String sql_query, String sql_update, String type) {
long star = System.currentTimeMillis();
......
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