Commit 1e4bf001 authored by 郝彦辉's avatar 郝彦辉

黑灰名单结果表、明细表增加数据源

parent 27a13e8f
package cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
import java.sql.Timestamp;
/**
* -----------------------------------------------------------------------------<br>
* 类描述: black_grey_list_details表实体 <br>
* 创建人: yanhui.Hao <br>
* 创建时间: 2020.04.14 20:43 <br>
* 公司: 北京众信利民信息技术有限公司 <br>
* -----------------------------------------------------------------------------
*/
@Data
public class BlackGreyListDetails implements Serializable {
private static final long serialVersionUID = 3504867579864272343L;
private Long id;
private String rId;
private String name;
private String phoneNo;
private String idNo;
private String type; //原始黑名单来源。1~99:QG黑名单(1:现金贷,2:白条,3:去哪儿,4:法院黑名单,5:线下黑名单,6新氧黑名单,8手机套现黑名单,9.环球黑卡套现,10.vcc逾期黑名单,11恶意投诉客户);101~199:P2P黑名单(101:p2p黑名单,102:weshare黑名单,103:芝麻行业关注名单,104:其他小贷黑名单,105-企美提供黑名单,106-拿下分期黑名单);201~299:机构黑名单(201-black_bank,202-black_kaola,203-black_car,204-前海黑名单,205-华融黑名单,206-人人信黑名单,207-同盾黑名单,208-大锤黑名单,209-国美黑名单,210-美借,211-快金,212-米么,213-手机贷,214-拍拍贷,215-掌众(闪电借款),216-向前贷(明特量化),217-齐立欣提供小贷渠道1,218-致诚阿福黑名单,219-算话黑名单);301~399:其他黑名单(301:black_dispute);401~499:白条黑名单(401:白条套现);501-马上闹事群众
private String reasonCode;//加入黑名单原因。1现金分期逾期大于15天,且仍然在逾;2.vcc逾期大于15天,且仍然在逾。;3.白条在逾;4.恶意投诉客户;
private String maxOverdueDays;
private String totalOverdueDays;
private int status; //状态 0:正常有效的; -1:由灰名单进入黑名单(无效,逻辑删除的); -2:由黑名单进入灰名单(无效,逻辑删除的); 10:当前在黑名单,并且该条数据逾期已还清的
private String remark;
@JsonIgnore
private Timestamp createdAt;
@JsonIgnore
private Timestamp updatedAt;
}
package cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist;
import lombok.Builder;
import lombok.Data;
import java.io.Serializable;
/**
* -----------------------------------------------------------------------------<br>
* 类描述: 黑灰名单查询参数类 <br>
* 创建人: yanhui.Hao <br>
* 创建时间: 2020.04.14 20:43 <br>
* 公司: 北京众信利民信息技术有限公司 <br>
* -----------------------------------------------------------------------------
*/
@Data
@Builder
public class BlackGreyListQueryVo implements Serializable {
private static final long serialVersionUID = 3504867579864272343L;
private String rId;
private String uuid;
private String name;
private String phoneNo;
private String idNo;
private String blackType;
}
package cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.*;
/**
* -----------------------------------------------------------------------------<br>
* 类描述: black_grey_list_result表实体 <br>
* 创建人: yanhui.Hao <br>
* 创建时间: 2020.04.14 20:43 <br>
* 公司: 北京众信利民信息技术有限公司 <br>
* -----------------------------------------------------------------------------
*/
@Data
public class BlackGreyListResult implements Serializable {
private static final long serialVersionUID = 3504867579864272343L;
private String rId;
private String uuid;
private String name;
private String phoneNo;
private String idNo;
/**phoneNo md5加密*/
private String phoneNoMd5;
/**idNo md5加密*/
private String idNoMd5;
private String blackType;
private String types;
private String reasons;
@JsonIgnore
private Timestamp createdAt;
@JsonIgnore
private Timestamp updatedAt;
public static Set<String> typesToSet(String oldTypesStr, String newType){
Set<String> typesSet = null;
try {
if(StringUtils.isEmpty(oldTypesStr)) {
typesSet = new HashSet<>();
}else{
String[] array = oldTypesStr.trim().split("[,]");
typesSet = new HashSet<>(Arrays.asList(array));
}
}catch (Exception e){
e.printStackTrace();
}
if(typesSet==null){
typesSet = new HashSet<>();
}
typesSet.add(newType);
return typesSet;
}
public static List<Reasons> reasonsToList(String oldJsonStr, String newReason, String newType){
List<Reasons> reasonList = null;
try {
if(StringUtils.isNotEmpty(oldJsonStr)) {
reasonList = JSONArray.parseArray(oldJsonStr, Reasons.class);
}
}catch (Exception e){
e.printStackTrace();
}
if(reasonList==null){
reasonList = new ArrayList<Reasons>();
}
int size = reasonList.size();
if(size>=2){
Reasons back1 = reasonList.get(0);
for(int i=1; i < size; i++){
Reasons tmp2 = reasonList.get(i);
if(back1.getUtcTime() <= tmp2.getUtcTime()){
back1 = tmp2;
}
}
reasonList = new ArrayList<Reasons>();
reasonList.add(back1);
}
Reasons newObj = new Reasons();
newObj.setReason(newReason);
newObj.setType(newType);
newObj.setUtcTime(System.currentTimeMillis());
reasonList.add(newObj);
return reasonList;
}
}
package cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
import java.sql.Timestamp;
/**
* -----------------------------------------------------------------------------<br>
* 类描述: black_grey_list_result表的reasons <br>
* 创建人: yanhui.Hao <br>
* 创建时间: 2020.04.14 20:57 <br>
* 公司: 北京众信利民信息技术有限公司 <br>
* -----------------------------------------------------------------------------
*/
@Data
public class Reasons implements Serializable {
private String type;
private String reason;
private long utcTime;
}
package cn.quantgroup.qgblservice.repository.mybatis.mapper.blacklist;
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 org.springframework.stereotype.Repository;
import java.util.List;
/**
* -----------------------------------------------------------------------------<br>
* 类描述: 黑灰名单 <br>
* 创建人: yanhui.Hao <br>
* 创建时间: 2020.04.14 21:41 <br>
* 公司: 北京众信利民信息技术有限公司 <br>
* -----------------------------------------------------------------------------
*/
@Repository
public interface BlackGreyListMapper {
BlackGreyListResult findBGLResultByRid(String rId);
List<BlackGreyListResult> findBlackGreyListResult(BlackGreyListQueryVo queryParams);
int insertBlackGreyListResult(BlackGreyListResult result);
int insertBlackGreyListDetails(BlackGreyListDetails details);
int updateBlackGreyListResult(BlackGreyListResult params);
int updateDetailsStatus(BlackGreyListDetails params);
}
<?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.blacklist.BlackGreyListMapper">
<resultMap id="BlackGreyListResultMap" type="cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.BlackGreyListResult">
<id column="rId" jdbcType="VARCHAR" property="r_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="phoneNoMd5" jdbcType="VARCHAR" property="phone_no_md5"/>
<result column="idNoMd5" jdbcType="VARCHAR" property="id_no_md5"/>
<result column="blackType" jdbcType="VARCHAR" property="black_type"/>
<result column="types" jdbcType="VARCHAR" property="types"/>
<result column="reasons" jdbcType="VARCHAR" property="reasons"/>
<result column="createdAt" jdbcType="TIMESTAMP" property="created_at"/>
<result column="updatedAt" jdbcType="TIMESTAMP" property="updated_at"/>
</resultMap>
<resultMap id="BlackGreyListDetailsMap" type="cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.BlackGreyListDetails">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="rId" jdbcType="VARCHAR" property="r_id"/>
<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="type" jdbcType="VARCHAR" property="type"/>
<result column="reasonCode" jdbcType="VARCHAR" property="reason_code"/>
<result column="totalOverdueDays" jdbcType="VARCHAR" property="total_overdue_days"/>
<result column="maxOverdueDays" jdbcType="VARCHAR" property="max_overdue_days"/>
<result column="status" jdbcType="INTEGER" property="status"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
<result column="createdAt" jdbcType="TIMESTAMP" property="created_at"/>
<result column="updatedAt" jdbcType="TIMESTAMP" property="updated_at"/>
</resultMap>
<select id="findBGLResultByRid" parameterType="java.lang.String" resultMap="BlackGreyListResultMap">
select * from black_grey_list_result where r_id = #{rId, jdbcType=VARCHAR} ;
</select>
<select id="findBlackGreyListResult" parameterType="cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.BlackGreyListQueryVo" resultMap="BlackGreyListResultMap">
select * from black_grey_list_result
<trim prefix="where" prefixOverrides="and">
<if test="rId != null">
and r_id = #{rId,jdbcType=VARCHAR}
</if>
<if test="phoneNo != null">
and phone_no = #{phoneNo,jdbcType=VARCHAR}
</if>
<if test="name != null">
and name = #{name,jdbcType=VARCHAR}
</if>
<if test="idNo != null">
and id_no = #{idNo,jdbcType=VARCHAR}
</if>
<if test="blackType != null">
and black_type = #{blackType,jdbcType=VARCHAR}
</if>
</trim>
</select>
<insert id="insertBlackGreyListResult"
parameterType="cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.BlackGreyListResult">
insert ignore into black_grey_list_result (`r_id`, `uuid`, `name`, `phone_no`, `id_no`, `phone_no_md5`, `id_no_md5`, `black_type`, `types`, `reasons`, `created_at`, `updated_at`)
values
(#{rId, jdbcType=VARCHAR}, #{uuid, jdbcType=VARCHAR}, #{name, jdbcType=VARCHAR}, #{phoneNo, jdbcType=VARCHAR}, #{idNo, jdbcType=VARCHAR}, #{phoneNoMd5, jdbcType=VARCHAR}, #{idNoMd5, jdbcType=VARCHAR},
#{blackType, jdbcType=VARCHAR}, #{types, jdbcType=VARCHAR}, #{reasons, jdbcType=VARCHAR}, #{createdAt, jdbcType=VARCHAR}, #{updatedAt, jdbcType=VARCHAR})
</insert>
<insert id="insertBlackGreyListDetails"
parameterType="cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.BlackGreyListDetails">
insert ignore into black_grey_list_details (`r_id`, `name`, `phone_no`, `id_no`, `type`, `reason_code`,
`max_overdue_days`, `total_overdue_days`, `status`, `remark`, `created_at`, `updated_at`)
values
(#{rId, jdbcType=VARCHAR}, #{name, jdbcType=VARCHAR}, #{phoneNo, jdbcType=VARCHAR}, #{idNo, jdbcType=VARCHAR}, #{type, jdbcType=VARCHAR}, #{reasonCode, jdbcType=VARCHAR},
#{maxOverdueDays, jdbcType=VARCHAR}, #{totalOverdueDays, jdbcType=VARCHAR}, #{status, jdbcType=INTEGER}, #{remark, jdbcType=VARCHAR}, #{createdAt, jdbcType=VARCHAR}, #{updatedAt, jdbcType=VARCHAR})
</insert>
<!--<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`, `total_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},
#{total_overdue_days, jdbcType=VARCHAR},
#{max_overdue_days, jdbcType=VARCHAR},
#{black_level, jdbcType=VARCHAR})
</foreach>
</insert>-->
<update id="updateBlackGreyListResult" parameterType="cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.BlackGreyListResult">
update black_grey_list_result
<set>
<if test="blackType!=null"> black_type = #{blackType,jdbcType=VARCHAR}, </if>
<if test="types!=null"> types = #{types,jdbcType=VARCHAR}, </if>
<if test="reasons!=null"> reasons = #{reasons,jdbcType=VARCHAR}, </if>
<if test="updatedAt!=null"> updated_at = #{updatedAt,jdbcType=VARCHAR} </if>
where
r_id = #{rId,jdbcType=VARCHAR};
</set>
</update>
<update id="updateDetailsStatus" parameterType="cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.BlackGreyListDetails">
update black_grey_list_details
set status = #{status,jdbcType=INTEGER}, updated_at = #{updatedAt,jdbcType=VARCHAR}
where
r_id = #{rId,jdbcType=VARCHAR} AND status=0 ;
</update>
</mapper>
\ No newline at end of file
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
<update id="updateThreeElementsById" parameterType="cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.BlackListQueryTidbVo0"> <update id="updateThreeElementsById" parameterType="cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.BlackListQueryTidbVo0">
update black_list_new update black_list_new
<set> <set>
<if test="uuid!=null">uuid = #{uuid,jdbcType=VARCHAR},</if> <if test="uuid!=null" >uuid = #{uuid,jdbcType=VARCHAR},</if>
<if test="name!=null">name = #{name,jdbcType=VARCHAR},</if> <if test="name!=null">name = #{name,jdbcType=VARCHAR},</if>
<if test="phoneNo!=null">phone_no = #{phoneNo,jdbcType=VARCHAR},</if> <if test="phoneNo!=null">phone_no = #{phoneNo,jdbcType=VARCHAR},</if>
<if test="idNo!=null">id_no = #{idNo,jdbcType=VARCHAR}</if> <if test="idNo!=null">id_no = #{idNo,jdbcType=VARCHAR}</if>
......
package cn.quantgroup.qgblservice.service;
import cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.TmpBlackGreyList;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;
/**
* -----------------------------------------------------------------------------<br>
* 类描述: 黑灰名单表 <br>
* 创建人: yanhui.Hao <br>
* 创建时间: 2020.04.14 20:34 <br>
* 公司: 北京众信利民信息技术有限公司 <br>
* -----------------------------------------------------------------------------
*/
public interface IBlackGreyListService {
/**
* -----------------------------------------------------------------------------<br>
* 描述: 往black_grey_list_result表及black_grey_list_details表插入<br>
* 作者:yanhui.Hao <br>
* 时间:2020.04.02 <br>
* 授权: (C) Copyright (c) 2017 <br>
* 公司: 北京众信利民信息技术有限公司 <br>
* -----------------------------------------------------------------------------
*/
int saveBlackRreyList(TmpBlackGreyList blackGreyObj);
int saveBlackRreyListByJdbc(List<TmpBlackGreyList> tmpQueryList) throws SQLException;
}
...@@ -8,8 +8,8 @@ import cn.quantgroup.qgblservice.repository.mybatis.mapper.tidb.BlackListQueryTi ...@@ -8,8 +8,8 @@ import cn.quantgroup.qgblservice.repository.mybatis.mapper.tidb.BlackListQueryTi
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;
import cn.quantgroup.qgblservice.utils.MD5Util;
import cn.quantgroup.qgblservice.utils.ExcelUtil; import cn.quantgroup.qgblservice.utils.ExcelUtil;
import cn.quantgroup.qgblservice.utils.MD5Util;
import cn.quantgroup.qgblservice.utils.jdbc.JdbcExecuters; import cn.quantgroup.qgblservice.utils.jdbc.JdbcExecuters;
import com.google.common.base.Stopwatch; import com.google.common.base.Stopwatch;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -21,14 +21,10 @@ import org.springframework.jdbc.core.BeanPropertyRowMapper; ...@@ -21,14 +21,10 @@ import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
/** /**
......
...@@ -5,6 +5,8 @@ import cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.BlackListQueryTi ...@@ -5,6 +5,8 @@ import cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.BlackListQueryTi
import java.sql.Timestamp; import java.sql.Timestamp;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/** /**
* @Author fengjunkai * @Author fengjunkai
...@@ -12,6 +14,11 @@ import java.time.LocalDateTime; ...@@ -12,6 +14,11 @@ import java.time.LocalDateTime;
*/ */
public class BlackListUtils { public class BlackListUtils {
private static Pattern p_chinese = Pattern.compile("[\u4e00-\u9fa5]");//中文
private static Pattern p_phone = Pattern.compile("^((13[0-9])|(15[^4])|(18[0,2,3,5-9])|(17[0-8])|(147))\\d{8}$");
public static void getOrUpdateBlackListLevel(BlackListQueryTidbVo0 blackListQueryTidbVo0, String type) { public static void getOrUpdateBlackListLevel(BlackListQueryTidbVo0 blackListQueryTidbVo0, String type) {
LocalDateTime localDateTimeCreatedAt = blackListQueryTidbVo0.getCreatedAt().toLocalDateTime(); LocalDateTime localDateTimeCreatedAt = blackListQueryTidbVo0.getCreatedAt().toLocalDateTime();
LocalDateTime localDateTimeNow = LocalDateTime.now(); LocalDateTime localDateTimeNow = LocalDateTime.now();
...@@ -28,4 +35,68 @@ public class BlackListUtils { ...@@ -28,4 +35,68 @@ public class BlackListUtils {
} }
public static boolean isContainChinese(String str) {
Matcher m = p_chinese.matcher(str);
if (m.find()) {
return true;
}
return false;
}
public static boolean isIDNumber(String IDNumber) {
if (IDNumber == null || "".equals(IDNumber)) {
return false;
}
// 定义判别用户身份证号的正则表达式(15位或者18位,最后一位可以为字母)
String regularExpression = "(^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$)|" +
"(^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}$)";
boolean matches = IDNumber.matches(regularExpression);
//判断第18位校验值
if (matches) {
if (IDNumber.length() == 18) {
try {
char[] charArray = IDNumber.toCharArray();
//前十七位加权因子
int[] idCardWi = {7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2};
//这是除以11后,可能产生的11位余数对应的验证码
String[] idCardY = {"1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"};
int sum = 0;
for (int i = 0; i < idCardWi.length; i++) {
int current = Integer.parseInt(String.valueOf(charArray[i]));
int count = current * idCardWi[i];
sum += count;
}
char idCardLast = charArray[17];
int idCardMod = sum % 11;
if (idCardY[idCardMod].toUpperCase().equals(String.valueOf(idCardLast).toUpperCase())) {
return true;
} else {
return false;
}
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
}
return matches;
}
/**
* 大陆手机号码11位数,匹配格式:前三位固定格式+后8位任意数
* 此方法中前三位格式有:
* 13+任意数
* 15+除4的任意数
* 18+除1和4的任意数
* 17+除9的任意数
* 147
*/
public static boolean isChinaPhone(String str) {
Matcher m = p_phone.matcher(str);
return m.matches();
}
} }
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