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

黑名单添加内部渠道和三方数据源黑名单等级更新功能

parent 84181606
......@@ -14,7 +14,7 @@ public class Constant {
public static String BLACK_LIST_NEW_BATCH_INSERT_BLACK_THREE_ELE_LIST_SQL = "insert ignore into black_list_new (`uuid`, `name`, `phone_no`, `id_no`, `major_type`, `type`, `total_overdue_days`, `max_overdue_days`, `black_level`, `join_black_reason`, `created_at`, `updated_at`) values(?,?,?,?,?,?,?,?,?,?,?,?)";
public static String BLACK_LIST_NEW_QUERY_BY_UNIQUE_KEY_SQL = "select * from black_list_new where phone_no = '%s' and name = '%s' and id_no = '%s' and type = '%s';";
public static String BLACK_LIST_NEW_UPDATE_DISABLE_BY_RECORD_ID_SQL = "update black_list_new set status = false, updated_at = '%s' where id = %s;";
public static String BLACK_LIST_NEW_UPDATE_THREE_ELE_SQL = "update black_list_new set uuid = '%s', name = '%s', phone_no = '%s' , id_no = '%s' where id = %s;";
public static String BLACK_LIST_NEW_UPDATE_THREE_ELE_AND_BLACK_LEVEL_SQL = "update black_list_new set uuid = '%s', name = '%s', phone_no = '%s' , id_no = '%s', black_level = '%s' where id = %s;";
public static String BLACK_LIST_NEW_UPDATE_BLACK_LIST_LEVEL_SQL = "update black_list_new set black_level = '%s' where id = %s;";
public static String BLACK_LIST_NEW_INSERT_THIRD_PART_BLACK_LIST_SQL = "insert into `black_list_new` (`uuid`, `name`, `phone_no`, `id_no`, `major_type`, `type`, `black_level`, `join_black_reason`, `created_at`, `updated_at`) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);";
public static String BLACK_LIST_NEW_UPDATE_FIRST_OR_MAX_OVERDUE_DAYS_SQL = "update black_list_new set total_overdue_days = ? , max_overdue_days = ?, updated_at = ? where id = ?";
......@@ -23,7 +23,7 @@ public class Constant {
public static String BLACK_LIST_NEW_QUERY_BY_IDNO_SQL = "select * from black_list_new where id_no = '%s' and status = true;";
public static String BLACK_LIST_NEW_QUERY_BY_PHONENO_IDNO_SQL = "select * from black_list_new where phone_no = '%s' and id_no = '%s' and status = true;";
public static String BLACK_LIST_NEW_QUERY_BY_THREE_ELE_SQL = "select * from black_list_new where phone_no = '%s' and id_no = '%s' and name = '%s' and status = true;";
public static String BLACK_LIST_NEW_QUERY_BY_IDNO_OR_PHONENO_SQL = "select * from black_list_new where phone_no = '%s' or id_no = '%s' and status = true;";
public static String BLACK_LIST_NEW_QUERY_BY_IDNO_OR_PHONENO_SQL = "select * from black_list_new where phone_no = '%s' or id_no = '%s'";
public static String BLACK_LIST_NEW_QUERY_BY_UUID_SQL = "select * from black_list_new where uuid = '%s' and status = true;";
public static String XYQB_QUERY_USER_LOAN_OVERDUE_15DAY_SQL = "select a.user_id id, now() created_at, now() updated_at, 1 major_type, 1 type, '逾期15+' join_black_reason, null total_overdue_days, null max_overdue_days, '1' status, 'A1' black_level from repayment_plan a left join loan_application_manifest_history d on a.loan_application_history_id=d.loan_application_history_id where a.deadline<=DATE_SUB(CURDATE(),INTERVAL 15 day) and a.deadline>DATE_SUB(CURDATE(),INTERVAL 20 day) and a.repayment_status not in (3,4) and d.transaction_status in (2,5);";
......
......@@ -78,7 +78,7 @@ public class BlackListQueryManagerServiceImpl implements IBlackListQueryManagerS
return GlobalResponse.error("查询黑名单异常");
}
public List<BlackListQueryTidbVo0> getBlackListData(String queryBlackListSql, String queryUserIdSql, String uuid, String name, String phoneNo, String idNo, String type) {
public List<BlackListQueryTidbVo0> getBlackListData(String queryBlackListSql, String queryUserIdSql, String uuid, String name, String phoneNo, String idNo, String type) { //TODO 身份证或者手机号查询过滤掉status=false的
Stopwatch stopwatch = Stopwatch.createStarted();
List<BlackListQueryTidbVo0> queryListBlackListByPhoneNos = blackListJdbcTemplate.query(queryBlackListSql, new BeanPropertyRowMapper<>(BlackListQueryTidbVo0.class));
log.info("用户黑名单查询结果, uuid: {} , name: {} , phoneNo: {} , idNo: {} , type: {} , result: {} ", uuid, name, phoneNo, idNo, type, JSON.toJSONString(queryListBlackListByPhoneNos));
......@@ -97,7 +97,7 @@ public class BlackListQueryManagerServiceImpl implements IBlackListQueryManagerS
queryListBlackListByPhoneNos.stream().filter(o -> Timestamp.valueOf(
LocalDateTime.now().minusYears(channelBlackListExpireConfigMap.get(o.getType())).format(DateTimeFormatter.ofPattern(Constant.DAYE_FORMAT.YYYY_MM_DD_HH_MM_SS))
).getTime() - o.getCreatedAt().getTime() < 0).forEach(blackListQueryTidbVo0 -> {
).getTime() - o.getCreatedAt().getTime() < 0 && o.isStatus()).forEach(blackListQueryTidbVo0 -> {
if (CollectionUtils.isNotEmpty(totalOverdueDaysList)) {
Object totalOverdueDays = totalOverdueDaysList.get(0).get(Constant.PARAM.TOTAL_OVERDUE_DAYS);
......@@ -121,7 +121,7 @@ public class BlackListQueryManagerServiceImpl implements IBlackListQueryManagerS
queryListBlackListByPhoneNos.stream().filter(o -> Timestamp.valueOf(
LocalDateTime.now().minusYears(channelBlackListExpireConfigMap.get(o.getType())).format(DateTimeFormatter.ofPattern(Constant.DAYE_FORMAT.YYYY_MM_DD_HH_MM_SS))
).getTime() - o.getCreatedAt().getTime() < 0).forEach(blackListQueryTidbVo0 -> {
).getTime() - o.getCreatedAt().getTime() < 0 && o.isStatus()).forEach(blackListQueryTidbVo0 -> {
Timestamp updatedAt = new Timestamp(System.currentTimeMillis());
String updatedAtStr = updatedAt.toLocalDateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
......
......@@ -40,7 +40,7 @@ public class BlackListUpdateThreeEleServiceImpl implements IBlackListUpdateThree
for (int j = 0; j < query.size(); j++) {
BlackListQueryTidbVo0 blackListQueryTidbVo01 = query.get(j);
if (StringUtils.isAnyBlank(blackListQueryTidbVo01.getUuid(), blackListQueryTidbVo01.getName(), blackListQueryTidbVo01.getPhoneNo(), blackListQueryTidbVo01.getIdNo())) {
if (StringUtils.isAnyBlank(blackListQueryTidbVo01.getUuid(), blackListQueryTidbVo01.getName(), blackListQueryTidbVo01.getPhoneNo(), blackListQueryTidbVo01.getIdNo()) && blackListQueryTidbVo01.isStatus()) {
if (StringUtils.isBlank(blackListQueryTidbVo01.getUuid()) && StringUtils.isNotBlank(blackListQueryTidbVo0.getUuid())) {
blackListQueryTidbVo01.setUuid(blackListQueryTidbVo0.getUuid());
......@@ -65,14 +65,11 @@ public class BlackListUpdateThreeEleServiceImpl implements IBlackListUpdateThree
blackListQueryTidbVo01.setUpdatedAt(new Timestamp(System.currentTimeMillis()));
blackListJdbcTemplate.update(String.format(Constant.SQL.BLACK_LIST_NEW_UPDATE_DISABLE_BY_RECORD_ID_SQL, blackListQueryTidbVo01.getUpdatedAt(), blackListQueryTidbVo01.getId()));
} else {
blackListJdbcTemplate.update(String.format(Constant.SQL.BLACK_LIST_NEW_UPDATE_THREE_ELE_SQL, blackListQueryTidbVo0.getUuid(), blackListQueryTidbVo0.getName(), blackListQueryTidbVo0.getPhoneNo(), blackListQueryTidbVo0.getIdNo(), blackListQueryTidbVo01.getId()));
BlackListUtils.getOrUpdateBlackListLevel(blackListQueryTidbVo01, type);
blackListJdbcTemplate.update(String.format(Constant.SQL.BLACK_LIST_NEW_UPDATE_THREE_ELE_AND_BLACK_LEVEL_SQL, blackListQueryTidbVo0.getUuid(), blackListQueryTidbVo0.getName(), blackListQueryTidbVo0.getPhoneNo(), blackListQueryTidbVo0.getIdNo(), blackListQueryTidbVo01.getId()));
}
}
if(type.equals(Constant.PARAM.BLACK_LIST_INNER_PART)){
BlackListUtils.getOrUpdateBlackListLevel(blackListQueryTidbVo0, Constant.PARAM.BLACK_LIST_INNER_PART);
blackListJdbcTemplate.update(String.format(Constant.SQL.BLACK_LIST_NEW_UPDATE_BLACK_LIST_LEVEL_SQL, blackListQueryTidbVo0.getBlackLevel(), blackListQueryTidbVo0.getId()));
}
}
}catch(Exception e){
log.error("更新黑名单三要素异常{} ", type, e);
......
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