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

黑灰名单2020.04.28_01

parent 4e6f0984
...@@ -10,6 +10,8 @@ public class Constant { ...@@ -10,6 +10,8 @@ public class Constant {
public static String BLACK_LIST_NEW_QUERY_THIRD_PART_BLACK_LIST_CONFIG_SQL = "select * from third_part_black_list_config where status = true;"; public static String BLACK_LIST_NEW_QUERY_THIRD_PART_BLACK_LIST_CONFIG_SQL = "select * from third_part_black_list_config where status = true;";
public static String BLACK_LIST_NEW_QUERY_CHANNEL_BLACK_LIST_EXPIRE_CONFIG_SQL = "select * from black_list_channel_expire_config where status = true"; public static String BLACK_LIST_NEW_QUERY_CHANNEL_BLACK_LIST_EXPIRE_CONFIG_SQL = "select * from black_list_channel_expire_config where status = true";
public static String BLACK_GREY_LIST_REASON_CONFIG_SQL = "select * from black_grey_list_reason_config where status = true;";
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`, `phone_no_md5`, `id_no_md5`) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; 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`, `phone_no_md5`, `id_no_md5`) 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_QUERY_BY_UNIQUE_KEY_SQL = "select * from black_list_new where phone_no = '%s' and name = '%s' and id_no = '%s' and type = '%s';";
......
...@@ -17,7 +17,7 @@ public class ConstantBlackGrey { ...@@ -17,7 +17,7 @@ public class ConstantBlackGrey {
public static class SQL { public static class SQL {
public static String XYQB_QUERY_XianJinDai_15DAY = "SELECT c.uuid, d.name, d.phone_no, d.id_no, " + public static String XYQB_QUERY_XianJinDai_15DAY = "SELECT c.uuid, d.name, d.phone_no, d.id_no, " +
"now() created_at, now() updated_at, '1' black_type, '1' type, '1' join_black_reason, NULL max_overdue_days, NULL total_overdue_days, NULL remark " + "now() created_at, now() updated_at, '1' black_type, '1' type, 'B_001' reason_code, NULL max_overdue_days, NULL total_overdue_days, NULL remark " +
"FROM repayment_plan a " + "FROM repayment_plan a " +
" LEFT JOIN loan_application_manifest_history b ON a.loan_application_history_id = b.loan_application_history_id " + " LEFT JOIN loan_application_manifest_history b ON a.loan_application_history_id = b.loan_application_history_id " +
" LEFT JOIN `user` c ON a.user_id = c.id " + " LEFT JOIN `user` c ON a.user_id = c.id " +
...@@ -38,19 +38,12 @@ public class ConstantBlackGrey { ...@@ -38,19 +38,12 @@ public class ConstantBlackGrey {
"AND a.repay_date>DATE_SUB(CURDATE(),INTERVAL 20 day);"; "AND a.repay_date>DATE_SUB(CURDATE(),INTERVAL 20 day);";
public static String XYQBUSER_QUERY_VCC_15DAY = "SELECT c.uuid, d.name, d.phone_no, d.id_no, " + public static String XYQBUSER_QUERY_VCC_15DAY = "SELECT c.uuid, d.name, d.phone_no, d.id_no, " +
" now() created_at, now() updated_at, '1' black_type, '10' type, '2' join_black_reason, NULL max_overdue_days, NULL total_overdue_days, NULL remark " + " now() created_at, now() updated_at, '1' black_type, '10' type, 'B_002' reason_code, NULL max_overdue_days, NULL total_overdue_days, NULL remark " +
" FROM `user` c " + " FROM `user` c " +
" LEFT JOIN user_detail d ON c.id = d.user_id " + " LEFT JOIN user_detail d ON c.id = d.user_id " +
"WHERE c.id IN (##IN_USER_ID##);"; "WHERE c.id IN (##IN_USER_ID##);";
//分页查询结果表黑名单 //分页查询结果表黑名单
public static String BL_QUERY_BLACKLIST_RESULT_BY_LIMIT = "SELECT r.* " +
" FROM black_grey_list_result r " +
" INNER JOIN ( " +
" SELECT br.r_id FROM black_grey_list_result br " +
" where br.black_type='1' " +
" ORDER BY br.r_id LIMIT ?, ? " +
") AS page USING(r_id); ";
public static String BL_QUERY_BLACKLIST_RESULT_MAX_ID = " SELECT max(id) as 'maxId' FROM black_grey_list_result r WHERE r.black_type='1';"; public static String BL_QUERY_BLACKLIST_RESULT_MAX_ID = " SELECT max(id) as 'maxId' FROM black_grey_list_result r WHERE r.black_type='1';";
public static String BL_QUERY_BLACKLIST_RESULT_BY_LIMIT_ID = " SELECT ##r.*## " + public static String BL_QUERY_BLACKLIST_RESULT_BY_LIMIT_ID = " SELECT ##r.*## " +
" FROM black_grey_list_result r " + " FROM black_grey_list_result r " +
......
package cn.quantgroup.qgblservice.model.blacklist;
import lombok.Data;
import java.io.Serializable;
import java.sql.Timestamp;
/**
* -----------------------------------------------------------------------------<br>
* 类描述: 加入黑灰名单原因配置表 black_grey_list_reason_config <br>
* 创建人: yanhui.Hao <br>
* 创建时间: 2020.04.28 15:43 <br>
* 公司: 北京众信利民信息技术有限公司 <br>
* -----------------------------------------------------------------------------
*/
@Data
public class BlackGreyListReasonConfig implements Serializable {
private Long id;
private String blackType;
private String type;
private String reasonCode;
private String reasonExplain;
private boolean status;
private Timestamp createdAt;
private Timestamp updatedAt;
}
package cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist; package cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data; import lombok.Data;
...@@ -67,7 +68,8 @@ public class BlackGreyListResult implements Serializable { ...@@ -67,7 +68,8 @@ public class BlackGreyListResult implements Serializable {
return typesSet; return typesSet;
} }
public static List<ReasonsVo> reasonsToList(String oldJsonStr, String newReason, String newType){ @Deprecated
public static List<ReasonsVo> reasonsToList_old(String oldJsonStr, String newReason, String newType){
List<ReasonsVo> reasonList = null; List<ReasonsVo> reasonList = null;
try { try {
if(StringUtils.isNotEmpty(oldJsonStr)) { if(StringUtils.isNotEmpty(oldJsonStr)) {
...@@ -102,8 +104,8 @@ public class BlackGreyListResult implements Serializable { ...@@ -102,8 +104,8 @@ public class BlackGreyListResult implements Serializable {
return reasonList; return reasonList;
} }
//在历史reason的json基础上追加
public static List<ReasonsVo> reasonsToList2(String oldJsonStr, String newReason, String newType){ public static List<ReasonsVo> reasonsToList(String oldJsonStr, String newReasonCode, String newType){
List<ReasonsVo> reasonList = null; List<ReasonsVo> reasonList = null;
try { try {
if(StringUtils.isNotEmpty(oldJsonStr)) { if(StringUtils.isNotEmpty(oldJsonStr)) {
...@@ -117,8 +119,8 @@ public class BlackGreyListResult implements Serializable { ...@@ -117,8 +119,8 @@ public class BlackGreyListResult implements Serializable {
reasonList = new ArrayList<ReasonsVo>(); reasonList = new ArrayList<ReasonsVo>();
} }
//ReasonsVo数值长度最多保存6条,大于6条的丢弃掉历史最老的 //`reasons` varchar(1024) 最多保存18条ReasonsVo,不能无限追加,大于18条的丢弃掉历史最老的
int maxLeng = 6; int maxLeng = 18;
int size = reasonList.size(); int size = reasonList.size();
if(size >= maxLeng){ if(size >= maxLeng){
//把ReasonsVo按照时间从小到大排列 //把ReasonsVo按照时间从小到大排列
...@@ -140,10 +142,11 @@ public class BlackGreyListResult implements Serializable { ...@@ -140,10 +142,11 @@ public class BlackGreyListResult implements Serializable {
for(int i=0; i < maxLeng-1; i++){ for(int i=0; i < maxLeng-1; i++){
tmpList.add(reasonList.get(size-1-i)); tmpList.add(reasonList.get(size-1-i));
} }
reasonList = tmpList;
} }
ReasonsVo newObj = new ReasonsVo(); ReasonsVo newObj = new ReasonsVo();
newObj.setReason(newReason); newObj.setReason(newReasonCode);
newObj.setType(newType); newObj.setType(newType);
newObj.setUtcTime(System.currentTimeMillis()); newObj.setUtcTime(System.currentTimeMillis());
reasonList.add(newObj); reasonList.add(newObj);
...@@ -151,6 +154,12 @@ public class BlackGreyListResult implements Serializable { ...@@ -151,6 +154,12 @@ public class BlackGreyListResult implements Serializable {
} }
/* public static void main(String[] args) {
String oldJsonStr = "[{\"reason\":\"G_001\",\"type\":\"1\",\"utcTime\":1570550400000},{\"reason\":\"G_001\",\"type\":\"2\",\"utcTime\":1587128783310},{\"reason\":\"G_001\",\"type\":\"10\",\"utcTime\":1587128790628}]";
List<ReasonsVo> reasonsToList = BlackGreyListResult.reasonsToList(oldJsonStr, "G_999", "99");
System.out.println(JSON.toJSONString(reasonsToList));
}*/
......
...@@ -33,7 +33,7 @@ public class TmpBlackGreyList implements Serializable { ...@@ -33,7 +33,7 @@ public class TmpBlackGreyList implements Serializable {
private String blackType; private String blackType;
private String type; private String type;
private String joinBlackReason; //private String joinBlackReason;
private String maxOverdueDays; private String maxOverdueDays;
private String totalOverdueDays; private String totalOverdueDays;
...@@ -44,5 +44,7 @@ public class TmpBlackGreyList implements Serializable { ...@@ -44,5 +44,7 @@ public class TmpBlackGreyList implements Serializable {
@JsonIgnore @JsonIgnore
private Timestamp updatedAt; private Timestamp updatedAt;
private String reasonCode;
private String reasonExplain;
} }
...@@ -38,7 +38,7 @@ public class TmpBlackGreyListRowMapper implements RowMapper<TmpBlackGreyList> { ...@@ -38,7 +38,7 @@ public class TmpBlackGreyListRowMapper implements RowMapper<TmpBlackGreyList> {
bean.setIdNo(rs.getString("id_no")); bean.setIdNo(rs.getString("id_no"));
bean.setBlackType(rs.getString("black_type")); bean.setBlackType(rs.getString("black_type"));
bean.setType(rs.getString("type")); bean.setType(rs.getString("type"));
bean.setJoinBlackReason(rs.getString("join_black_reason")); bean.setReasonCode(rs.getString("reason_code"));
bean.setMaxOverdueDays(rs.getString("max_overdue_days")); bean.setMaxOverdueDays(rs.getString("max_overdue_days"));
bean.setTotalOverdueDays(rs.getString("total_overdue_days")); bean.setTotalOverdueDays(rs.getString("total_overdue_days"));
bean.setCreatedAt(rs.getTimestamp("created_at")); bean.setCreatedAt(rs.getTimestamp("created_at"));
......
...@@ -26,10 +26,11 @@ ...@@ -26,10 +26,11 @@
<result column="idNo" jdbcType="VARCHAR" property="id_no"/> <result column="idNo" jdbcType="VARCHAR" property="id_no"/>
<result column="type" jdbcType="VARCHAR" property="type"/> <result column="type" jdbcType="VARCHAR" property="type"/>
<result column="reasonCode" jdbcType="VARCHAR" property="reason_code"/> <result column="reasonCode" jdbcType="VARCHAR" property="reason_code"/>
<!--<result column="reasonExplain" jdbcType="VARCHAR" property="reason_explain"/>-->
<result column="totalOverdueDays" jdbcType="VARCHAR" property="total_overdue_days"/> <result column="totalOverdueDays" jdbcType="VARCHAR" property="total_overdue_days"/>
<result column="maxOverdueDays" jdbcType="VARCHAR" property="max_overdue_days"/> <result column="maxOverdueDays" jdbcType="VARCHAR" property="max_overdue_days"/>
<result column="status" jdbcType="INTEGER" property="status"/> <result column="status" jdbcType="INTEGER" property="status"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/> <!-- <result column="remark" jdbcType="VARCHAR" property="remark"/>-->
<result column="createdAt" jdbcType="TIMESTAMP" property="created_at"/> <result column="createdAt" jdbcType="TIMESTAMP" property="created_at"/>
<result column="updatedAt" jdbcType="TIMESTAMP" property="updated_at"/> <result column="updatedAt" jdbcType="TIMESTAMP" property="updated_at"/>
</resultMap> </resultMap>
...@@ -62,11 +63,13 @@ ...@@ -62,11 +63,13 @@
<select id="findBGLResultByRid" parameterType="java.lang.String" resultMap="BlackGreyListResultMap"> <select id="findBGLResultByRid" parameterType="java.lang.String" resultMap="BlackGreyListResultMap">
select * from black_grey_list_result where r_id = #{rId, jdbcType=VARCHAR} ; select id, r_id, uuid, name, phone_no, id_no, phone_no_md5, id_no_md5, black_type, types, reasons, created_at, updated_at
from black_grey_list_result where r_id = #{rId, jdbcType=VARCHAR} ;
</select> </select>
<select id="findBlackGreyListResult" parameterType="cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.BlackGreyListQueryVo" resultMap="BlackGreyListResultMap"> <select id="findBlackGreyListResult" parameterType="cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.BlackGreyListQueryVo" resultMap="BlackGreyListResultMap">
select * from black_grey_list_result select id, r_id, uuid, name, phone_no, id_no, phone_no_md5, id_no_md5, black_type, types, reasons, created_at, updated_at
from black_grey_list_result
<trim prefix="where" prefixOverrides="and"> <trim prefix="where" prefixOverrides="and">
<if test="rId != null"> <if test="rId != null">
and r_id = #{rId,jdbcType=VARCHAR} and r_id = #{rId,jdbcType=VARCHAR}
...@@ -91,7 +94,8 @@ ...@@ -91,7 +94,8 @@
</select> </select>
<select id="findBlackGreyListResultBy3YS" parameterType="cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.BlackGreyListQueryVo" resultMap="BlackGreyListResultMap"> <select id="findBlackGreyListResultBy3YS" parameterType="cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.BlackGreyListQueryVo" resultMap="BlackGreyListResultMap">
select * from black_grey_list_result select id, r_id, uuid, name, phone_no, id_no, phone_no_md5, id_no_md5, black_type, types, reasons, created_at, updated_at
from black_grey_list_result
where where
<choose> <choose>
<when test = "phoneNo == null"> <when test = "phoneNo == null">
...@@ -122,7 +126,7 @@ ...@@ -122,7 +126,7 @@
</select> </select>
<select id="findBlackGreyListDetails" parameterType="cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.BlackGreyListQueryVo" resultMap="BlackGreyListDetailsMap"> <select id="findBlackGreyListDetails" parameterType="cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.BlackGreyListQueryVo" resultMap="BlackGreyListDetailsMap">
select id, r_id, name, phone_no, id_no, type, reason_code, max_overdue_days, total_overdue_days, status, remark, created_at, updated_at select id, r_id, name, phone_no, id_no, type, reason_code, max_overdue_days, total_overdue_days, status, created_at, updated_at
from black_grey_list_details from black_grey_list_details
<trim prefix="where" prefixOverrides="and"> <trim prefix="where" prefixOverrides="and">
<if test="rId != null"> <if test="rId != null">
...@@ -153,7 +157,7 @@ ...@@ -153,7 +157,7 @@
</select> </select>
<select id="findBlackGreyListDetailsBy3YS" parameterType="cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.BlackGreyListQueryVo" resultMap="BlackGreyListDetailsMap"> <select id="findBlackGreyListDetailsBy3YS" parameterType="cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.BlackGreyListQueryVo" resultMap="BlackGreyListDetailsMap">
select id, r_id, name, phone_no, id_no, type, reason_code, max_overdue_days, total_overdue_days, status, remark, created_at, updated_at select id, r_id, name, phone_no, id_no, type, reason_code, max_overdue_days, total_overdue_days, status, created_at, updated_at
from black_grey_list_details from black_grey_list_details
where where
<choose> <choose>
...@@ -217,7 +221,6 @@ ...@@ -217,7 +221,6 @@
</select> </select>
<insert id="insertBlackGreyListResult" <insert id="insertBlackGreyListResult"
parameterType="cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.BlackGreyListResult"> 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`) 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`)
...@@ -235,23 +238,6 @@ ...@@ -235,23 +238,6 @@
#{maxOverdueDays, jdbcType=VARCHAR}, #{totalOverdueDays, jdbcType=VARCHAR}, #{status, jdbcType=INTEGER}, #{remark, jdbcType=VARCHAR}, #{createdAt, jdbcType=VARCHAR}, #{updatedAt, jdbcType=VARCHAR}) #{maxOverdueDays, jdbcType=VARCHAR}, #{totalOverdueDays, jdbcType=VARCHAR}, #{status, jdbcType=INTEGER}, #{remark, jdbcType=VARCHAR}, #{createdAt, jdbcType=VARCHAR}, #{updatedAt, jdbcType=VARCHAR})
</insert> </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 id="updateBlackGreyListResult" parameterType="cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.BlackGreyListResult">
update black_grey_list_result update black_grey_list_result
...@@ -266,7 +252,6 @@ ...@@ -266,7 +252,6 @@
</update> </update>
<update id="updateDetailsStatusByparams" parameterType="cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.DetailsUpdate"> <update id="updateDetailsStatusByparams" parameterType="cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.DetailsUpdate">
/*update black_grey_list_details set status = ?, updated_at = ? where r_id = ? AND status =10 AND type IN ('1','2','10')*/
update black_grey_list_details update black_grey_list_details
set status = #{status,jdbcType=INTEGER}, updated_at = #{updatedAt,jdbcType=VARCHAR} set status = #{status,jdbcType=INTEGER}, updated_at = #{updatedAt,jdbcType=VARCHAR}
where where
......
...@@ -3,12 +3,9 @@ package cn.quantgroup.qgblservice.service.impl; ...@@ -3,12 +3,9 @@ package cn.quantgroup.qgblservice.service.impl;
import cn.quantgroup.qgblservice.constant.ConstantBlackGrey; import cn.quantgroup.qgblservice.constant.ConstantBlackGrey;
import cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.*; import cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.*;
import cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.TmpBlackGreyList; import cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.TmpBlackGreyList;
import cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.TmpBlackGreyListRowMapper;
import cn.quantgroup.qgblservice.repository.mybatis.mapper.blacklist.BlackGreyListMapper; import cn.quantgroup.qgblservice.repository.mybatis.mapper.blacklist.BlackGreyListMapper;
import cn.quantgroup.qgblservice.service.IBlackGreyListService; import cn.quantgroup.qgblservice.service.IBlackGreyListService;
import cn.quantgroup.qgblservice.utils.MD5Util; import cn.quantgroup.qgblservice.utils.MD5Util;
import cn.quantgroup.qgblservice.utils.blacklist.BlackListUtils;
import cn.quantgroup.qgblservice.utils.jdbc.JdbcExecuters;
import com.alibaba.fastjson.JSON; 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;
...@@ -21,7 +18,10 @@ import org.springframework.jdbc.core.RowMapper; ...@@ -21,7 +18,10 @@ import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.sql.*; import java.sql.*;
import java.util.*; import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
...@@ -51,16 +51,8 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService { ...@@ -51,16 +51,8 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService {
@Autowired @Autowired
private UpdateBlackListOverdueDayParallel updateBlackListOverdueDayParallel; private UpdateBlackListOverdueDayParallel updateBlackListOverdueDayParallel;
//private static int pageSize = 10000;
private static int pageSize = 2000; private static int pageSize = 2000;
//private static Map<String, Integer> channelBlackListExpireConfigMap = new ConcurrentHashMap<>();
/*@PostConstruct
public void initChannelBlackListExpireConfig() {
List<BlackListChannelExpireConfigVo0> queryBlackListChannelExpireConfigVo0List = blackListJdbcTemplate.query(Constant.SQL.BLACK_LIST_NEW_QUERY_CHANNEL_BLACK_LIST_EXPIRE_CONFIG_SQL, new BeanPropertyRowMapper<>(BlackListChannelExpireConfigVo0.class));
channelBlackListExpireConfigMap = queryBlackListChannelExpireConfigVo0List.stream().collect(Collectors.toMap(BlackListChannelExpireConfigVo0::getType, BlackListChannelExpireConfigVo0::getExpireTime));
log.info("加载渠道黑名单有效期配置完成, result: {} ", JSON.toJSONString(channelBlackListExpireConfigMap));
}*/
/** /**
* -----------------------------------------------------------------------------<br> * -----------------------------------------------------------------------------<br>
...@@ -99,7 +91,7 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService { ...@@ -99,7 +91,7 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService {
} }
oldResult.setBlackType(blackGreyObj.getBlackType()); oldResult.setBlackType(blackGreyObj.getBlackType());
oldResult.setTypes(blackGreyObj.getType()); oldResult.setTypes(blackGreyObj.getType());
List<ReasonsVo> reasonsList = BlackGreyListResult.reasonsToList(null, blackGreyObj.getJoinBlackReason(), blackGreyObj.getType()); List<ReasonsVo> reasonsList = BlackGreyListResult.reasonsToList(null, blackGreyObj.getReasonCode(), blackGreyObj.getType());
oldResult.setReasons(JSON.toJSONString(reasonsList)); oldResult.setReasons(JSON.toJSONString(reasonsList));
oldResult.setCreatedAt(blackGreyObj.getCreatedAt()); oldResult.setCreatedAt(blackGreyObj.getCreatedAt());
oldResult.setUpdatedAt(blackGreyObj.getUpdatedAt()); oldResult.setUpdatedAt(blackGreyObj.getUpdatedAt());
...@@ -109,7 +101,8 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService { ...@@ -109,7 +101,8 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService {
details.setPhoneNo(oldResult.getPhoneNo()); details.setPhoneNo(oldResult.getPhoneNo());
details.setIdNo(oldResult.getIdNo()); details.setIdNo(oldResult.getIdNo());
details.setType(blackGreyObj.getType()); details.setType(blackGreyObj.getType());
details.setReasonCode(blackGreyObj.getJoinBlackReason()); details.setReasonCode(blackGreyObj.getReasonCode());
details.setReasonExplain(blackGreyObj.getReasonExplain());
details.setMaxOverdueDays(blackGreyObj.getMaxOverdueDays()); details.setMaxOverdueDays(blackGreyObj.getMaxOverdueDays());
details.setTotalOverdueDays(blackGreyObj.getTotalOverdueDays()); details.setTotalOverdueDays(blackGreyObj.getTotalOverdueDays());
details.setStatus(0);//状态 0:正常有效的; -1:由灰名单进入黑名单(无效,逻辑删除的); -2:由黑名单进入灰名单(无效,逻辑删除的);-3:在插入灰名单时,已经是黑名单 10:当前在黑名单,并且该条数据逾期已还清的 details.setStatus(0);//状态 0:正常有效的; -1:由灰名单进入黑名单(无效,逻辑删除的); -2:由黑名单进入灰名单(无效,逻辑删除的);-3:在插入灰名单时,已经是黑名单 10:当前在黑名单,并且该条数据逾期已还清的
...@@ -145,7 +138,7 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService { ...@@ -145,7 +138,7 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService {
} }
Set<String> typeSet = BlackGreyListResult.typesToSet(oldResult.getTypes(), blackGreyObj.getType()); Set<String> typeSet = BlackGreyListResult.typesToSet(oldResult.getTypes(), blackGreyObj.getType());
List<ReasonsVo> reasonsList = BlackGreyListResult.reasonsToList(oldResult.getReasons(), blackGreyObj.getJoinBlackReason(), blackGreyObj.getType()); List<ReasonsVo> reasonsList = BlackGreyListResult.reasonsToList(oldResult.getReasons(), blackGreyObj.getReasonCode(), blackGreyObj.getType());
/* 状态 status /* 状态 status
0:正常有效的; 0:正常有效的;
-1:由灰名单进入黑名单(无效,逻辑删除的); -1:由灰名单进入黑名单(无效,逻辑删除的);
...@@ -195,7 +188,8 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService { ...@@ -195,7 +188,8 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService {
details.setPhoneNo(oldResult.getPhoneNo()); details.setPhoneNo(oldResult.getPhoneNo());
details.setIdNo(oldResult.getIdNo()); details.setIdNo(oldResult.getIdNo());
details.setType(blackGreyObj.getType()); details.setType(blackGreyObj.getType());
details.setReasonCode(blackGreyObj.getJoinBlackReason()); details.setReasonCode(blackGreyObj.getReasonCode());
details.setReasonExplain(blackGreyObj.getReasonExplain());
details.setMaxOverdueDays(blackGreyObj.getMaxOverdueDays()); details.setMaxOverdueDays(blackGreyObj.getMaxOverdueDays());
details.setTotalOverdueDays(blackGreyObj.getTotalOverdueDays()); details.setTotalOverdueDays(blackGreyObj.getTotalOverdueDays());
details.setStatus(details_status); details.setStatus(details_status);
...@@ -223,15 +217,20 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService { ...@@ -223,15 +217,20 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService {
return 0; return 0;
} }
/**
* -----------------------------------------------------------------------------<br>
* 描 述: 黑灰名单插入,jdbc事务控制 <br>
* 创建人: yanhui.Hao <br>
* 创建时间: 2020.04.28 16:31 <br>
* 最后修改人: <br>
* 最后修改时间: 2020.04.28 16:31 <br>
* 入参说明: <br>
* 出参说明: <br>
* -----------------------------------------------------------------------------
*/
@Override @Override
public int saveBlackGreyListByJdbc(List<TmpBlackGreyList> tmpQueryList) throws SQLException { public int saveBlackGreyListByJdbc(List<TmpBlackGreyList> tmpQueryList) throws SQLException {
/*String sql_insert_result = " 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 (?,?,?,?,?,?,?,?,?,?,?,?) ;";
String sql_insert_details = " 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 (?,?,?,?,?,?,?,?,?,?,?,?) ;";
String sql_update_result = "UPDATE black_grey_list_result set black_type=?, types=?, reasons=?, updated_at=? WHERE r_id=? ;";
String sql_update_details = "UPDATE black_grey_list_details set status=?, updated_at=? WHERE r_id=? AND status=0;";*/
AtomicInteger atomicInteger = new AtomicInteger(); AtomicInteger atomicInteger = new AtomicInteger();
Connection conn = null; Connection conn = null;
Statement statement = null; Statement statement = null;
...@@ -252,7 +251,7 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService { ...@@ -252,7 +251,7 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService {
BlackGreyListQueryVo queryResultParam = BlackGreyListQueryVo.builder().name(blackGreyObj.getName()).idNo(blackGreyObj.getIdNo()).phoneNo(blackGreyObj.getPhoneNo()).build(); BlackGreyListQueryVo queryResultParam = BlackGreyListQueryVo.builder().name(blackGreyObj.getName()).idNo(blackGreyObj.getIdNo()).phoneNo(blackGreyObj.getPhoneNo()).build();
List<BlackGreyListResult> blackGreyResultList = blackGreyListMapper.findBlackGreyListResultBy3YS(queryResultParam); List<BlackGreyListResult> blackGreyResultList = blackGreyListMapper.findBlackGreyListResultBy3YS(queryResultParam);
//结果中没有,新增 //结果中没有,新增
if(blackGreyResultList==null || blackGreyResultList.size()==0){ if(blackGreyResultList==null || blackGreyResultList.size()==0){
String rId = UUID.randomUUID().toString().replaceAll("-", ""); String rId = UUID.randomUUID().toString().replaceAll("-", "");
insertResult = new BlackGreyListResult(); insertResult = new BlackGreyListResult();
...@@ -269,7 +268,7 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService { ...@@ -269,7 +268,7 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService {
} }
insertResult.setBlackType(blackGreyObj.getBlackType()); insertResult.setBlackType(blackGreyObj.getBlackType());
insertResult.setTypes(blackGreyObj.getType()); insertResult.setTypes(blackGreyObj.getType());
List<ReasonsVo> reasonsList = BlackGreyListResult.reasonsToList(null, blackGreyObj.getJoinBlackReason(), blackGreyObj.getType()); List<ReasonsVo> reasonsList = BlackGreyListResult.reasonsToList(null, blackGreyObj.getReasonCode(), blackGreyObj.getType());
insertResult.setReasons(JSON.toJSONString(reasonsList)); insertResult.setReasons(JSON.toJSONString(reasonsList));
insertResult.setCreatedAt(blackGreyObj.getCreatedAt()); insertResult.setCreatedAt(blackGreyObj.getCreatedAt());
insertResult.setUpdatedAt(blackGreyObj.getUpdatedAt()); insertResult.setUpdatedAt(blackGreyObj.getUpdatedAt());
...@@ -280,15 +279,16 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService { ...@@ -280,15 +279,16 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService {
insertdetails.setPhoneNo(insertResult.getPhoneNo()); insertdetails.setPhoneNo(insertResult.getPhoneNo());
insertdetails.setIdNo(insertResult.getIdNo()); insertdetails.setIdNo(insertResult.getIdNo());
insertdetails.setType(blackGreyObj.getType()); insertdetails.setType(blackGreyObj.getType());
insertdetails.setReasonCode(blackGreyObj.getJoinBlackReason()); insertdetails.setReasonCode(blackGreyObj.getReasonCode());
insertdetails.setReasonExplain(blackGreyObj.getReasonExplain());
insertdetails.setMaxOverdueDays(blackGreyObj.getMaxOverdueDays()); insertdetails.setMaxOverdueDays(blackGreyObj.getMaxOverdueDays());
insertdetails.setTotalOverdueDays(blackGreyObj.getTotalOverdueDays()); insertdetails.setTotalOverdueDays(blackGreyObj.getTotalOverdueDays());
insertdetails.setStatus(0);//状态 0:正常有效的; -1:由灰名单进入黑名单(无效,逻辑删除的); -2:由黑名单进入灰名单(无效,逻辑删除的);-3:在插入灰名单时,已经是黑名单 10:当前在黑名单,并且该条数据逾期已还清的 insertdetails.setStatus(0);//状态 0:正常有效的; -1:由灰名单进入黑名单(无效,逻辑删除的); -2:由黑名单进入灰名单(无效,逻辑删除的);-3:在插入灰名单时,已经是黑名单 10:当前在黑名单,并且该条数据逾期已还清的
insertdetails.setRemark(blackGreyObj.getRemark()); insertdetails.setRemark(blackGreyObj.getRemark());
insertdetails.setCreatedAt(blackGreyObj.getCreatedAt()); insertdetails.setCreatedAt(blackGreyObj.getCreatedAt());
insertdetails.setUpdatedAt(blackGreyObj.getUpdatedAt()); insertdetails.setUpdatedAt(blackGreyObj.getUpdatedAt());
log.info("黑灰名单增加结束-结果表插入: {} , 明细表插入: {} ", insertResult.toString(), insertdetails.toString()); log.info("黑灰名单增加结束-结果表插入: {} , 明细表插入: {} ", insertResult.toString(), insertdetails.toString());
}else{ }else{
if(blackGreyResultList.size()!=1){ if(blackGreyResultList.size()!=1){
...@@ -298,7 +298,7 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService { ...@@ -298,7 +298,7 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService {
BlackGreyListResult oldResult = blackGreyResultList.get(0); BlackGreyListResult oldResult = blackGreyResultList.get(0);
updateResult = new BlackGreyListResult(); updateResult = new BlackGreyListResult();
//UpdatedAt BlackType Types Reasons //要更新的字段UpdatedAt BlackType Types Reasons
updateResult.setRId(oldResult.getRId()); updateResult.setRId(oldResult.getRId());
if(oldResult.getUpdatedAt().getTime() >= blackGreyObj.getUpdatedAt().getTime()){ if(oldResult.getUpdatedAt().getTime() >= blackGreyObj.getUpdatedAt().getTime()){
updateResult.setUpdatedAt(oldResult.getUpdatedAt()); updateResult.setUpdatedAt(oldResult.getUpdatedAt());
...@@ -307,7 +307,7 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService { ...@@ -307,7 +307,7 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService {
} }
Set<String> typeSet = BlackGreyListResult.typesToSet(oldResult.getTypes(), blackGreyObj.getType()); Set<String> typeSet = BlackGreyListResult.typesToSet(oldResult.getTypes(), blackGreyObj.getType());
List<ReasonsVo> reasonsList = BlackGreyListResult.reasonsToList(oldResult.getReasons(), blackGreyObj.getJoinBlackReason(), blackGreyObj.getType()); List<ReasonsVo> reasonsList = BlackGreyListResult.reasonsToList(oldResult.getReasons(), blackGreyObj.getReasonCode(), blackGreyObj.getType());
/* 状态 status /* 状态 status
0:正常有效的; 0:正常有效的;
-1:由灰名单进入黑名单(无效,逻辑删除的); -1:由灰名单进入黑名单(无效,逻辑删除的);
...@@ -343,8 +343,7 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService { ...@@ -343,8 +343,7 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService {
deleteDetails = new BlackGreyListDetails(); deleteDetails = new BlackGreyListDetails();
deleteDetails.setRId(oldResult.getRId()); deleteDetails.setRId(oldResult.getRId());
deleteDetails.setStatus(-1);//-1:由灰名单进入黑名单(无效,逻辑删除的) deleteDetails.setStatus(-1);//-1:由灰名单进入黑名单(无效,逻辑删除的)
Timestamp newTime = new Timestamp(System.currentTimeMillis()); deleteDetails.setUpdatedAt(new Timestamp(System.currentTimeMillis()));
deleteDetails.setUpdatedAt(newTime);
} }
else{ else{
log.error("黑灰名单新增发现其他类别BlackType, oldResult : {} , blackGrey : {} ", oldResult.toString(), blackGreyObj.toString()); log.error("黑灰名单新增发现其他类别BlackType, oldResult : {} , blackGrey : {} ", oldResult.toString(), blackGreyObj.toString());
...@@ -357,14 +356,14 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService { ...@@ -357,14 +356,14 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService {
insertdetails.setPhoneNo(oldResult.getPhoneNo()); insertdetails.setPhoneNo(oldResult.getPhoneNo());
insertdetails.setIdNo(oldResult.getIdNo()); insertdetails.setIdNo(oldResult.getIdNo());
insertdetails.setType(blackGreyObj.getType()); insertdetails.setType(blackGreyObj.getType());
insertdetails.setReasonCode(blackGreyObj.getJoinBlackReason()); insertdetails.setReasonCode(blackGreyObj.getReasonCode());
insertdetails.setReasonExplain(blackGreyObj.getReasonExplain());
insertdetails.setMaxOverdueDays(blackGreyObj.getMaxOverdueDays()); insertdetails.setMaxOverdueDays(blackGreyObj.getMaxOverdueDays());
insertdetails.setTotalOverdueDays(blackGreyObj.getTotalOverdueDays()); insertdetails.setTotalOverdueDays(blackGreyObj.getTotalOverdueDays());
insertdetails.setStatus(details_status); insertdetails.setStatus(details_status);
insertdetails.setRemark(blackGreyObj.getRemark()); insertdetails.setRemark(blackGreyObj.getRemark());
insertdetails.setCreatedAt(blackGreyObj.getCreatedAt()); insertdetails.setCreatedAt(blackGreyObj.getCreatedAt());
insertdetails.setUpdatedAt(blackGreyObj.getUpdatedAt()); insertdetails.setUpdatedAt(blackGreyObj.getUpdatedAt());
log.info("黑灰名单增加结束-结果表修改: {} , 明细表插入: {} , 明细表修改: {} , blackGreyObj : {} ", updateResult.toString(), insertdetails.toString(), deleteDetails, blackGreyObj.toString()); log.info("黑灰名单增加结束-结果表修改: {} , 明细表插入: {} , 明细表修改: {} , blackGreyObj : {} ", updateResult.toString(), insertdetails.toString(), deleteDetails, blackGreyObj.toString());
} }
...@@ -375,6 +374,7 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService { ...@@ -375,6 +374,7 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService {
} }
if(deleteDetails!=null){ if(deleteDetails!=null){
//"UPDATE black_grey_list_details set status=?, updated_at=? WHERE r_id=? AND status=0;"
StringBuffer sql_buff = new StringBuffer("UPDATE black_grey_list_details set "); StringBuffer sql_buff = new StringBuffer("UPDATE black_grey_list_details set ");
sql_buff.append(" status=").append(deleteDetails.getStatus()).append(", "); sql_buff.append(" status=").append(deleteDetails.getStatus()).append(", ");
sql_buff.append(" updated_at=").append(getValue(deleteDetails.getUpdatedAt().toString())); sql_buff.append(" updated_at=").append(getValue(deleteDetails.getUpdatedAt().toString()));
...@@ -390,6 +390,7 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService { ...@@ -390,6 +390,7 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService {
statement.addBatch(sql_buff.toString()); statement.addBatch(sql_buff.toString());
} }
if(updateResult!=null){ if(updateResult!=null){
//"UPDATE black_grey_list_result set black_type=?, types=?, reasons=?, updated_at=? WHERE r_id=? ;"
StringBuffer sql_buff = new StringBuffer("UPDATE black_grey_list_result set "); StringBuffer sql_buff = new StringBuffer("UPDATE black_grey_list_result set ");
sql_buff.append(" black_type=").append(getValue(updateResult.getBlackType())).append(", "); sql_buff.append(" black_type=").append(getValue(updateResult.getBlackType())).append(", ");
sql_buff.append(" types=").append(getValue(updateResult.getTypes())).append(", "); sql_buff.append(" types=").append(getValue(updateResult.getTypes())).append(", ");
...@@ -402,6 +403,8 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService { ...@@ -402,6 +403,8 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService {
statement.addBatch(sql_buff.toString()); statement.addBatch(sql_buff.toString());
} }
if(insertResult!=null){ if(insertResult!=null){
//" 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 (?,?,?,?,?,?,?,?,?,?,?,?) ;"
StringBuffer sql_buff = new StringBuffer("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`) "); StringBuffer sql_buff = new StringBuffer("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`) ");
sql_buff.append(" values ("); sql_buff.append(" values (");
sql_buff.append(getValue(insertResult.getRId())).append(", "); sql_buff.append(getValue(insertResult.getRId())).append(", ");
...@@ -420,7 +423,9 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService { ...@@ -420,7 +423,9 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService {
statement.addBatch(sql_buff.toString()); statement.addBatch(sql_buff.toString());
} }
if(insertdetails!=null){ if(insertdetails!=null){
StringBuffer sql_buff = new StringBuffer("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`) "); //" insert ignore into black_grey_list_details (`r_id`, `name`, `phone_no`, `id_no`, `type`, `reason_code`, `reason_explain`, `max_overdue_days`, `total_overdue_days`, `status`, `remark`, `created_at`, `updated_at`) " +
//" values (?,?,?,?,?,?,?,?,?,?,?,?) ;"
StringBuffer sql_buff = new StringBuffer("insert ignore into black_grey_list_details (`r_id`, `name`, `phone_no`, `id_no`, `type`, `reason_code`, `reason_explain`, `max_overdue_days`, `total_overdue_days`, `status`, `remark`, `created_at`, `updated_at`) ");
sql_buff.append(" values ("); sql_buff.append(" values (");
sql_buff.append(getValue(insertdetails.getRId())).append(", "); sql_buff.append(getValue(insertdetails.getRId())).append(", ");
sql_buff.append(getValue(insertdetails.getName())).append(", "); sql_buff.append(getValue(insertdetails.getName())).append(", ");
...@@ -428,6 +433,7 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService { ...@@ -428,6 +433,7 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService {
sql_buff.append(getValue(insertdetails.getIdNo())).append(", "); sql_buff.append(getValue(insertdetails.getIdNo())).append(", ");
sql_buff.append(getValue(insertdetails.getType())).append(", "); sql_buff.append(getValue(insertdetails.getType())).append(", ");
sql_buff.append(getValue(insertdetails.getReasonCode())).append(", "); sql_buff.append(getValue(insertdetails.getReasonCode())).append(", ");
sql_buff.append(getValue(insertdetails.getReasonExplain())).append(", ");
sql_buff.append(getValue(insertdetails.getMaxOverdueDays())).append(", "); sql_buff.append(getValue(insertdetails.getMaxOverdueDays())).append(", ");
sql_buff.append(getValue(insertdetails.getTotalOverdueDays())).append(", "); sql_buff.append(getValue(insertdetails.getTotalOverdueDays())).append(", ");
sql_buff.append(insertdetails.getStatus()).append(", "); sql_buff.append(insertdetails.getStatus()).append(", ");
...@@ -524,13 +530,13 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService { ...@@ -524,13 +530,13 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService {
blackGreyVo = xjdBlackGreyList.get(i); blackGreyVo = xjdBlackGreyList.get(i);
queryParams = BlackGreyListQueryVo.builder().name(blackGreyVo.getName()).idNo(blackGreyVo.getIdNo()).phoneNo(blackGreyVo.getPhoneNo()) queryParams = BlackGreyListQueryVo.builder().name(blackGreyVo.getName()).idNo(blackGreyVo.getIdNo()).phoneNo(blackGreyVo.getPhoneNo())
.type(blackGreyVo.getType()).status(0).build(); .type(blackGreyVo.getType()).status(0).build();
//List<BlackGreyListDetails> detailsList = blackGreyListMapper.findBlackGreyListDetails(queryParams); //List<BlackGreyListDetails> detailsList = blackGreyListMapper.findBlackGreyListDetails(queryParams);
List<BlackGreyListDetails> detailsList = blackGreyListMapper.findBlackGreyListDetailsBy3YS(queryParams); List<BlackGreyListDetails> detailsList = blackGreyListMapper.findBlackGreyListDetailsBy3YS(queryParams);
if(detailsList!=null && detailsList.size()>0){ if(detailsList!=null && detailsList.size()>0){
details_haveCount.incrementAndGet(); details_haveCount.incrementAndGet();
}else { }else {
blackGreyVo.setReasonExplain(ThirdPartBlackListServiceImpl.getReasonExplainByReasonCodeMap.get(blackGreyVo.getReasonCode()));
newIncreasedList.add(blackGreyVo); newIncreasedList.add(blackGreyVo);
} }
}catch (Exception e){ }catch (Exception e){
...@@ -553,6 +559,18 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService { ...@@ -553,6 +559,18 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService {
return String.format(resMsgTemp, xjdBlackGreyList.size(), details_haveCount.get(), newIncreasedList.size(), saveOkCount); return String.format(resMsgTemp, xjdBlackGreyList.size(), details_haveCount.get(), newIncreasedList.size(), saveOkCount);
} }
/**
* -----------------------------------------------------------------------------<br>
* 描 述: vcc逾期,每日逾期15+用户 每日执行导入新的黑名单表 <br>
* 创建人: yanhui.Hao <br>
* 创建时间: 2020.04.28 16:44 <br>
* 最后修改人: <br>
* 最后修改时间: 2020.04.28 16:44 <br>
* 入参说明: <br>
* 出参说明: <br>
* -----------------------------------------------------------------------------
*/
@Override @Override
public String importVccBlackGreyList() { public String importVccBlackGreyList() {
Stopwatch queryStopwatch1 = Stopwatch.createStarted(); Stopwatch queryStopwatch1 = Stopwatch.createStarted();
...@@ -623,12 +641,12 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService { ...@@ -623,12 +641,12 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService {
blackGreyVo = vccBlackGreyList.get(i); blackGreyVo = vccBlackGreyList.get(i);
queryParams = BlackGreyListQueryVo.builder().name(blackGreyVo.getName()).idNo(blackGreyVo.getIdNo()).phoneNo(blackGreyVo.getPhoneNo()) queryParams = BlackGreyListQueryVo.builder().name(blackGreyVo.getName()).idNo(blackGreyVo.getIdNo()).phoneNo(blackGreyVo.getPhoneNo())
.type(blackGreyVo.getType()).status(0).build(); .type(blackGreyVo.getType()).status(0).build();
//List<BlackGreyListDetails> detailsList = blackGreyListMapper.findBlackGreyListDetails(queryParams); //List<BlackGreyListDetails> detailsList = blackGreyListMapper.findBlackGreyListDetails(queryParams);
List<BlackGreyListDetails> detailsList = blackGreyListMapper.findBlackGreyListDetailsBy3YS(queryParams); List<BlackGreyListDetails> detailsList = blackGreyListMapper.findBlackGreyListDetailsBy3YS(queryParams);
if(detailsList!=null && detailsList.size()>0){ if(detailsList!=null && detailsList.size()>0){
details_haveCount.incrementAndGet(); details_haveCount.incrementAndGet();
}else { }else {
blackGreyVo.setReasonExplain(ThirdPartBlackListServiceImpl.getReasonExplainByReasonCodeMap.get(blackGreyVo.getReasonCode()));
newIncreasedList.add(blackGreyVo); newIncreasedList.add(blackGreyVo);
} }
}catch (Exception e){ }catch (Exception e){
...@@ -827,6 +845,8 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService { ...@@ -827,6 +845,8 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService {
return null; return null;
}*/ }*/
/** /**
* -----------------------------------------------------------------------------<br> * -----------------------------------------------------------------------------<br>
* 描 述: 更新黑名单>>逾期天数 <br> * 描 述: 更新黑名单>>逾期天数 <br>
......
...@@ -478,13 +478,13 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS ...@@ -478,13 +478,13 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS
log.warn("该方法值执行一次,已经执行!"); log.warn("该方法值执行一次,已经执行!");
} }
else if("updat_idNoIsPhone".equals(operatType)){ else if("updat_idNoIsPhone".equals(operatType)){
String sql_query = "select b.id, b.uuid, b.name, b.phone_no, b.id_no, b.black_type, b.type, b.join_black_reason, b.max_overdue_days, b.total_overdue_days, b.created_at, b.updated_at " + String sql_query = "select b.id, b.uuid, b.name, b.phone_no, b.id_no, b.black_type, b.type, b.join_black_reason as reason_code, b.max_overdue_days, b.total_overdue_days, b.created_at, b.updated_at " +
" from tmp_black_grey_list b where LENGTH(b.id_no)=11; "; //5010条 " from tmp_black_grey_list b where LENGTH(b.id_no)=11; "; //5010条
String sql_update = " update tmp_black_grey_list set phone_no=?, phone_no_md5= ?, id_no=?, id_no_md5=?, name=? where id=? "; String sql_update = " update tmp_black_grey_list set phone_no=?, phone_no_md5= ?, id_no=?, id_no_md5=?, name=? where id=? ";
//updat_idNoIsPhone(sql_query, sql_update, "1"); //updat_idNoIsPhone(sql_query, sql_update, "1");
} }
else if("updat_PhoneNot11".equals(operatType)){ else if("updat_PhoneNot11".equals(operatType)){
String sql_query = "select b.id, b.uuid, b.name, b.phone_no, b.id_no, b.black_type, b.type, b.join_black_reason, b.max_overdue_days, b.total_overdue_days, b.created_at, b.updated_at " + String sql_query = "select b.id, b.uuid, b.name, b.phone_no, b.id_no, b.black_type, b.type, b.join_black_reason reason_code, b.max_overdue_days, b.total_overdue_days, b.created_at, b.updated_at " +
" from tmp_black_grey_list b where LENGTH(b.phone_no)!=11; "; //5398条 " from tmp_black_grey_list b where LENGTH(b.phone_no)!=11; "; //5398条
String sql_update = " update tmp_black_grey_list set phone_no=?, phone_no_md5= ?, id_no=?, id_no_md5=?, name=? where id=? "; String sql_update = " update tmp_black_grey_list set phone_no=?, phone_no_md5= ?, id_no=?, id_no_md5=?, name=? where id=? ";
//updat_idNoIsPhone(sql_query, sql_update, "2"); //updat_idNoIsPhone(sql_query, sql_update, "2");
...@@ -527,10 +527,10 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS ...@@ -527,10 +527,10 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS
else if("updat_detail_reasons".equals(operatType)){ else if("updat_detail_reasons".equals(operatType)){
updat_detail_reasons(); //updat_detail_reasons();
} }
else if("updat_result_reasons".equals(operatType)){ else if("updat_result_reasons".equals(operatType)){
updat_result_reasons(); //updat_result_reasons();
} }
...@@ -545,7 +545,7 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS ...@@ -545,7 +545,7 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS
long star = System.currentTimeMillis(); long star = System.currentTimeMillis();
final String SQL_MAXID = "SELECT max(id) as 'maxId' FROM black_list_new;"; final String SQL_MAXID = "SELECT max(id) as 'maxId' FROM black_list_new;";
String SQL_QUERY = "SELECT b.id, b.uuid, b.name, b.phone_no, b.id_no, " + String SQL_QUERY = "SELECT b.id, b.uuid, b.name, b.phone_no, b.id_no, " +
"if(type=11,'1','2') black_type, b.type, if(b.type=11,'4','5') join_black_reason, " + "if(type=11,'1','2') black_type, b.type, if(b.type=11,'B_004','G_001') reason_code, " +
" b.max_overdue_days, b.total_overdue_days, b.created_at, b.updated_at" + " b.max_overdue_days, b.total_overdue_days, b.created_at, b.updated_at" +
" FROM black_list_new b WHERE id > ? and id<=?;"; " FROM black_list_new b WHERE id > ? and id<=?;";
...@@ -922,7 +922,7 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS ...@@ -922,7 +922,7 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS
if(StringUtils.isNotEmpty(queryBean.getUuid())){ if(StringUtils.isNotEmpty(queryBean.getUuid())){
queryBean.setBlackType("2"); queryBean.setBlackType("2");
queryBean.setJoinBlackReason("6"); queryBean.setReasonCode("6");
Map<String, Object> in_overdue_Map = null; Map<String, Object> in_overdue_Map = null;
try { try {
...@@ -935,7 +935,7 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS ...@@ -935,7 +935,7 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS
int in_overdue = Integer.parseInt(in_overdue_Map.get("in_overdue").toString()); int in_overdue = Integer.parseInt(in_overdue_Map.get("in_overdue").toString());
if(in_overdue >=1 ){ if(in_overdue >=1 ){
queryBean.setBlackType("1"); queryBean.setBlackType("1");
queryBean.setJoinBlackReason("1"); queryBean.setReasonCode("1");
} }
} }
updateBeanList.add(queryBean); updateBeanList.add(queryBean);
...@@ -953,7 +953,7 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS ...@@ -953,7 +953,7 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS
for (TmpBlackGreyList bean : updateBeanList) { for (TmpBlackGreyList bean : updateBeanList) {
try{ try{
String sql_tmp = sql_update_type1.replace("##id##", ""+bean.getId()); String sql_tmp = sql_update_type1.replace("##id##", ""+bean.getId());
sql_tmp = sql_tmp.replace("##join_black_reason##", bean.getJoinBlackReason()); sql_tmp = sql_tmp.replace("##join_black_reason##", bean.getReasonCode());
sql_tmp = sql_tmp.replace("##black_type##", bean.getBlackType()); sql_tmp = sql_tmp.replace("##black_type##", bean.getBlackType());
if(StringUtils.isNotEmpty(bean.getRemark())){ if(StringUtils.isNotEmpty(bean.getRemark())){
...@@ -1104,7 +1104,7 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS ...@@ -1104,7 +1104,7 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS
if(StringUtils.isNotEmpty(queryBean.getUuid())){ if(StringUtils.isNotEmpty(queryBean.getUuid())){
queryBean.setBlackType("2"); queryBean.setBlackType("2");
queryBean.setJoinBlackReason("6"); queryBean.setReasonCode("6");
Object in_overdue_Obj = null; Object in_overdue_Obj = null;
try { try {
...@@ -1119,7 +1119,7 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS ...@@ -1119,7 +1119,7 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS
int in_overdue = Integer.parseInt(in_overdue_Obj.toString()); int in_overdue = Integer.parseInt(in_overdue_Obj.toString());
if(in_overdue >=1 ){ if(in_overdue >=1 ){
queryBean.setBlackType("1"); queryBean.setBlackType("1");
queryBean.setJoinBlackReason("3"); queryBean.setReasonCode("3");
} }
} }
updateBeanList.add(queryBean); updateBeanList.add(queryBean);
...@@ -1137,7 +1137,7 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS ...@@ -1137,7 +1137,7 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS
for (TmpBlackGreyList bean : updateBeanList) { for (TmpBlackGreyList bean : updateBeanList) {
try{ try{
String sql_tmp = sql_update_type1.replace("##id##", ""+bean.getId()); String sql_tmp = sql_update_type1.replace("##id##", ""+bean.getId());
sql_tmp = sql_tmp.replace("##join_black_reason##", bean.getJoinBlackReason()); sql_tmp = sql_tmp.replace("##join_black_reason##", bean.getReasonCode());
sql_tmp = sql_tmp.replace("##black_type##", bean.getBlackType()); sql_tmp = sql_tmp.replace("##black_type##", bean.getBlackType());
if(StringUtils.isNotEmpty(bean.getRemark())){ if(StringUtils.isNotEmpty(bean.getRemark())){
...@@ -1271,7 +1271,7 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS ...@@ -1271,7 +1271,7 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS
if (xyqbUser != null && xyqbUser.getId() != 0L) { if (xyqbUser != null && xyqbUser.getId() != 0L) {
queryBean.setBlackType("2"); queryBean.setBlackType("2");
queryBean.setJoinBlackReason("6"); queryBean.setReasonCode("6");
Object in_overdue_Obj = null; Object in_overdue_Obj = null;
try { try {
...@@ -1286,7 +1286,7 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS ...@@ -1286,7 +1286,7 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS
int in_overdue = Integer.parseInt(in_overdue_Obj.toString()); int in_overdue = Integer.parseInt(in_overdue_Obj.toString());
if (in_overdue >= 1) { if (in_overdue >= 1) {
queryBean.setBlackType("1"); queryBean.setBlackType("1");
queryBean.setJoinBlackReason("2"); queryBean.setReasonCode("2");
} }
} }
updateBeanList.add(queryBean); updateBeanList.add(queryBean);
...@@ -1304,7 +1304,7 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS ...@@ -1304,7 +1304,7 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS
for (TmpBlackGreyList bean : updateBeanList) { for (TmpBlackGreyList bean : updateBeanList) {
try { try {
String sql_tmp = sql_update_type1.replace("##id##", "" + bean.getId()); String sql_tmp = sql_update_type1.replace("##id##", "" + bean.getId());
sql_tmp = sql_tmp.replace("##join_black_reason##", bean.getJoinBlackReason()); sql_tmp = sql_tmp.replace("##join_black_reason##", bean.getReasonCode());
sql_tmp = sql_tmp.replace("##black_type##", bean.getBlackType()); sql_tmp = sql_tmp.replace("##black_type##", bean.getBlackType());
int update = blackListJdbcTemplate.update(sql_tmp); int update = blackListJdbcTemplate.update(sql_tmp);
...@@ -1342,7 +1342,7 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS ...@@ -1342,7 +1342,7 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS
private void tmpBlackGreyToProduct(){ private void tmpBlackGreyToProduct(){
long totalStar = System.currentTimeMillis(); long totalStar = System.currentTimeMillis();
//blackListJdbcTemplate //blackListJdbcTemplate
String sql_blacklist3_query = "SELECT t.id, t.uuid, t.`name`, t.phone_no, t.id_no, t.black_type, t.type, t.join_black_reason, t.max_overdue_days, t.total_overdue_days, t.created_at, t.updated_at " + String sql_blacklist3_query = "SELECT t.id, t.uuid, t.`name`, t.phone_no, t.id_no, t.black_type, t.type, t.join_black_reason as reason_code, t.max_overdue_days, t.total_overdue_days, t.created_at, t.updated_at " +
" from tmp_black_grey_list t " + " from tmp_black_grey_list t " +
" WHERE id > ? AND id<=?;"; " WHERE id > ? AND id<=?;";
...@@ -1742,18 +1742,35 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS ...@@ -1742,18 +1742,35 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS
List<TmpBlackGreyList> blackGreyList = new ArrayList<TmpBlackGreyList>(); List<TmpBlackGreyList> blackGreyList = new ArrayList<TmpBlackGreyList>();
TmpBlackGreyList blackGreyObj = null; TmpBlackGreyList blackGreyObj = null;
for (String context: contextList) { for (String context: contextList) {
//uuid|name|phone_no|id_no|black_type|type|join_black_reason|max_overdue_days|total_overdue_days|remark|created_at|updated_at //uuid,name,phone_no,id_no,black_type,type,reasonCode,max_overdue_days,total_overdue_days,remark,created_at,updated_at
if(context.length()<11){ if(context.length()<11){
log.warn("该行参数有误, 跳过: {} ", context); log.warn("该行参数有误, 跳过: {} ", context);
continue; continue;
} }
String[] array = context.trim().split("[|]"); String[] array = context.trim().split(",");
if(array.length<12){ if(array.length<12){
log.warn("该行参数格式有误, 跳过: {} ", context); log.warn("该行参数格式有误, 跳过: {} ", context);
continue; continue;
} }
//黑灰名单来源type不能为空
if(org.apache.commons.lang3.StringUtils.isAnyEmpty(array[4].trim(), array[5].trim())){
log.warn("黑灰名单类型blackType和来源type不能为空, 跳过: {} ", context);
continue;
}
blackGreyObj = new TmpBlackGreyList(); blackGreyObj = new TmpBlackGreyList();
blackGreyObj.setType(array[5].trim());
blackGreyObj.setBlackType(array[4].trim());
//加入黑灰名单原因
if(StringUtils.isNotEmpty(array[6].trim()) && (array[6].trim().startsWith("B_") || array[6].trim().startsWith("G_"))){
blackGreyObj.setReasonCode(array[6].trim());
}else {
blackGreyObj.setReasonCode(ThirdPartBlackListServiceImpl.getReasonCodeByTypeMap.get(blackGreyObj.getType()));
}
blackGreyObj.setReasonExplain(ThirdPartBlackListServiceImpl.getReasonExplainByReasonCodeMap.get(blackGreyObj.getReasonCode()));
if(StringUtils.isNotEmpty(array[0].trim())){ if(StringUtils.isNotEmpty(array[0].trim())){
blackGreyObj.setUuid(array[0].trim()); blackGreyObj.setUuid(array[0].trim());
} }
...@@ -1766,15 +1783,8 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS ...@@ -1766,15 +1783,8 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS
if(StringUtils.isNotEmpty(array[3].trim())){ if(StringUtils.isNotEmpty(array[3].trim())){
blackGreyObj.setIdNo(array[3].trim()); blackGreyObj.setIdNo(array[3].trim());
} }
if(StringUtils.isNotEmpty(array[4].trim())){
blackGreyObj.setBlackType(array[4].trim());
}
if(StringUtils.isNotEmpty(array[5].trim())){
blackGreyObj.setType(array[5].trim());
}
if(StringUtils.isNotEmpty(array[6].trim())){
blackGreyObj.setJoinBlackReason(array[6].trim());
}
if(StringUtils.isNotEmpty(array[7].trim())){ if(StringUtils.isNotEmpty(array[7].trim())){
blackGreyObj.setMaxOverdueDays(array[7].trim()); blackGreyObj.setMaxOverdueDays(array[7].trim());
} }
...@@ -1805,7 +1815,6 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS ...@@ -1805,7 +1815,6 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS
BlackGreyListQueryVo queryResultParam = BlackGreyListQueryVo.builder().name(blackGreyObj.getName()).idNo(blackGreyObj.getIdNo()).phoneNo(blackGreyObj.getPhoneNo()) BlackGreyListQueryVo queryResultParam = BlackGreyListQueryVo.builder().name(blackGreyObj.getName()).idNo(blackGreyObj.getIdNo()).phoneNo(blackGreyObj.getPhoneNo())
.type(blackGreyObj.getType()).status(0).build(); .type(blackGreyObj.getType()).status(0).build();
//List<BlackGreyListDetails> detailsList = blackGreyListMapper.findBlackGreyListDetails(queryResultParam); //List<BlackGreyListDetails> detailsList = blackGreyListMapper.findBlackGreyListDetails(queryResultParam);
List<BlackGreyListDetails> detailsList = blackGreyListMapper.findBlackGreyListDetailsBy3YS(queryResultParam); List<BlackGreyListDetails> detailsList = blackGreyListMapper.findBlackGreyListDetailsBy3YS(queryResultParam);
if(detailsList!=null && detailsList.size()>0){ if(detailsList!=null && detailsList.size()>0){
......
...@@ -198,8 +198,8 @@ public class BlackToGreyListParallel implements ParallelComputingProcess<BlackGr ...@@ -198,8 +198,8 @@ public class BlackToGreyListParallel implements ParallelComputingProcess<BlackGr
//可以有多个type,说明至少有一个逾期还没还清,就不能转出黑名单 //可以有多个type,说明至少有一个逾期还没还清,就不能转出黑名单
is_grey_result = false; is_grey_result = false;
}else if(detailsVo.getStatus().intValue()==10){ }else if(detailsVo.getStatus().intValue()==10){
//Set<String> typeSet = BlackGreyListResult.typesToSet(blackResult.getTypes(), rJoinDVo.getType()); //G_002 发生过15天以上逾期已经结清的客户,从黑名单转标记为灰名单
reasonsList = BlackGreyListResult.reasonsToList(blackResult.getReasons(), "6", detailsVo.getType()); reasonsList = BlackGreyListResult.reasonsToList(blackResult.getReasons(), "G_002", detailsVo.getType());
} }
} }
......
package cn.quantgroup.qgblservice.service.impl; package cn.quantgroup.qgblservice.service.impl;
import cn.quantgroup.qgblservice.constant.Constant; import cn.quantgroup.qgblservice.constant.Constant;
import cn.quantgroup.qgblservice.model.blacklist.BlackGreyListReasonConfig;
import cn.quantgroup.qgblservice.model.blacklist.ThirdPartBlackListConfigVo0; import cn.quantgroup.qgblservice.model.blacklist.ThirdPartBlackListConfigVo0;
import cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.BlackGreyListDetails; 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.BlackGreyListQueryVo;
...@@ -50,6 +51,12 @@ public class ThirdPartBlackListServiceImpl implements IThirdPartBlackListManager ...@@ -50,6 +51,12 @@ public class ThirdPartBlackListServiceImpl implements IThirdPartBlackListManager
private static Map<String, String> thirdPartBlackListCacheConfigMap = new ConcurrentHashMap<>(); private static Map<String, String> thirdPartBlackListCacheConfigMap = new ConcurrentHashMap<>();
private static Map<String, String> thirdPartBlackListMap = new ConcurrentHashMap<>(); private static Map<String, String> thirdPartBlackListMap = new ConcurrentHashMap<>();
//2020.04.28 根据黑灰名单开源type,获取加入黑灰名单原因code
public static Map<String, String> getReasonCodeByTypeMap = new ConcurrentHashMap<>();
//2020.04.28 加入黑灰名单原因code,获取原因中文描述
public static Map<String, String> getReasonExplainByReasonCodeMap = new ConcurrentHashMap<>();
@Autowired @Autowired
private BlackGreyListMapper blackGreyListMapper; private BlackGreyListMapper blackGreyListMapper;
...@@ -126,9 +133,12 @@ public class ThirdPartBlackListServiceImpl implements IThirdPartBlackListManager ...@@ -126,9 +133,12 @@ public class ThirdPartBlackListServiceImpl implements IThirdPartBlackListManager
List<ThirdPartBlackListConfigVo0> thirdPartBlackListConfigVo0s = blackListJdbcTemplate.query(Constant.SQL.BLACK_LIST_NEW_QUERY_THIRD_PART_BLACK_LIST_CONFIG_SQL, new BeanPropertyRowMapper<>(ThirdPartBlackListConfigVo0.class)); List<ThirdPartBlackListConfigVo0> thirdPartBlackListConfigVo0s = blackListJdbcTemplate.query(Constant.SQL.BLACK_LIST_NEW_QUERY_THIRD_PART_BLACK_LIST_CONFIG_SQL, new BeanPropertyRowMapper<>(ThirdPartBlackListConfigVo0.class));
thirdPartBlackListCacheConfigMap = thirdPartBlackListConfigVo0s.stream().collect(Collectors.toMap(ThirdPartBlackListConfigVo0::getChannelType, ThirdPartBlackListConfigVo0::getType)); thirdPartBlackListCacheConfigMap = thirdPartBlackListConfigVo0s.stream().collect(Collectors.toMap(ThirdPartBlackListConfigVo0::getChannelType, ThirdPartBlackListConfigVo0::getType));
thirdPartBlackListMap = thirdPartBlackListConfigVo0s.stream().collect(Collectors.toMap(ThirdPartBlackListConfigVo0::getChannelType, ThirdPartBlackListConfigVo0::getName)); thirdPartBlackListMap = thirdPartBlackListConfigVo0s.stream().collect(Collectors.toMap(ThirdPartBlackListConfigVo0::getChannelType, ThirdPartBlackListConfigVo0::getName));
log.info("加载三方数据源黑名单配置完成, result: {} ", JSON.toJSONString(thirdPartBlackListCacheConfigMap)); log.info("加载三方数据源黑名单配置完成, result: {} ", JSON.toJSONString(thirdPartBlackListCacheConfigMap));
List<BlackGreyListReasonConfig> blackGreyListReasonConfigList = blackListJdbcTemplate.query(Constant.SQL.BLACK_GREY_LIST_REASON_CONFIG_SQL, new BeanPropertyRowMapper<>(BlackGreyListReasonConfig.class));
getReasonCodeByTypeMap = blackGreyListReasonConfigList.stream().collect(Collectors.toMap(BlackGreyListReasonConfig::getType, BlackGreyListReasonConfig::getReasonCode));
getReasonExplainByReasonCodeMap = blackGreyListReasonConfigList.stream().collect(Collectors.toMap(BlackGreyListReasonConfig::getReasonCode, BlackGreyListReasonConfig::getReasonExplain));
log.info("加载三方数据源黑灰名单原因配置完成, map: {} ", JSON.toJSONString(getReasonCodeByTypeMap));
} }
@Override @Override
...@@ -136,17 +146,18 @@ public class ThirdPartBlackListServiceImpl implements IThirdPartBlackListManager ...@@ -136,17 +146,18 @@ public class ThirdPartBlackListServiceImpl implements IThirdPartBlackListManager
//2020.04.26 历史黑名单继续写入,暂时未线下 //2020.04.26 历史黑名单继续写入,暂时未线下
try { try {
log.info("历史黑名单继续写入, uuid: {} , name: {} , phoneNo: {} , idCard: {} , type: {} ", uuid, name, phoneNo, idCard, type);
saveThirdPartBlackList(uuid, name, phoneNo, idCard, type); saveThirdPartBlackList(uuid, name, phoneNo, idCard, type);
}catch (Exception e){ }catch (Exception e){
log.error("保存历史黑名单异常", e); log.error("保存历史黑名单异常", e);
} }
//根据三方数据源urlType获取黑灰名单来源type
String typeCode = thirdPartBlackListCacheConfigMap.get(type); String typeCode = thirdPartBlackListCacheConfigMap.get(type);
String joinBlackReason = thirdPartBlackListMap.get(type); String reasonCode = getReasonCodeByTypeMap.get(type);
if(StringUtils.isEmpty(typeCode)){ String reasonExplain = getReasonExplainByReasonCodeMap.get(reasonCode);
log.error("插入黑灰名单时-未匹配到typeCode! uuid: {} , name: {} , phoneNo: {} , idCard: {} , type: {} ", uuid, name, phoneNo, idCard, type); if(org.apache.commons.lang3.StringUtils.isAnyEmpty(typeCode, reasonCode, reasonExplain)){
log.error("插入黑灰名单时-未匹配到typeCode或reason! uuid: {} , name: {} , phoneNo: {} , idCard: {} , type: {} ", uuid, name, phoneNo, idCard, type);
return GlobalResponse.error("参数type未匹配到typeCode!"); return GlobalResponse.error("参数type未匹配到typeCode!");
} }
BlackGreyListQueryVo queryResultParam = BlackGreyListQueryVo.builder().name(name).idNo(idCard).phoneNo(phoneNo) BlackGreyListQueryVo queryResultParam = BlackGreyListQueryVo.builder().name(name).idNo(idCard).phoneNo(phoneNo)
...@@ -161,7 +172,8 @@ public class ThirdPartBlackListServiceImpl implements IThirdPartBlackListManager ...@@ -161,7 +172,8 @@ public class ThirdPartBlackListServiceImpl implements IThirdPartBlackListManager
TmpBlackGreyList blackGreyObj = new TmpBlackGreyList(); TmpBlackGreyList blackGreyObj = new TmpBlackGreyList();
blackGreyObj.setBlackType("2");//灰名单 blackGreyObj.setBlackType("2");//灰名单
blackGreyObj.setType(typeCode); blackGreyObj.setType(typeCode);
//blackGreyObj.setJoinBlackReason(array[6].trim()); blackGreyObj.setReasonCode(reasonCode);
blackGreyObj.setReasonExplain(reasonExplain);
if(StringUtils.isNotEmpty(uuid)){ if(StringUtils.isNotEmpty(uuid)){
blackGreyObj.setUuid(uuid); blackGreyObj.setUuid(uuid);
...@@ -184,7 +196,7 @@ public class ThirdPartBlackListServiceImpl implements IThirdPartBlackListManager ...@@ -184,7 +196,7 @@ public class ThirdPartBlackListServiceImpl implements IThirdPartBlackListManager
blackGreyList.add(blackGreyObj); blackGreyList.add(blackGreyObj);
int saveOkCount = blackGreyListService.saveBlackGreyListByJdbc(blackGreyList); int saveOkCount = blackGreyListService.saveBlackGreyListByJdbc(blackGreyList);
return GlobalResponse.success("保存成功"+saveOkCount+"条"); return GlobalResponse.success("保存黑灰名单成功"+saveOkCount+"条");
} catch (SQLException e) { } catch (SQLException e) {
log.error("保存黑灰名单数据异常", e); log.error("保存黑灰名单数据异常", e);
} }
......
...@@ -89,7 +89,7 @@ public class ReadOrWriteTxt { ...@@ -89,7 +89,7 @@ public class ReadOrWriteTxt {
List<String> lineList = new ArrayList<String>(); List<String> lineList = new ArrayList<String>();
try { try {
FileInputStream fileInputStream = new FileInputStream(file); FileInputStream fileInputStream = new FileInputStream(file);
InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "GBK"); InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream);
BufferedReader bufferedReader = new BufferedReader(inputStreamReader); BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
......
...@@ -187,7 +187,7 @@ public class JdbcExecuters { ...@@ -187,7 +187,7 @@ public class JdbcExecuters {
ps.setString(7, vo.getIdNoMd5()); ps.setString(7, vo.getIdNoMd5());
ps.setString(8, vo.getBlackType()); ps.setString(8, vo.getBlackType());
ps.setString(9, vo.getType()); ps.setString(9, vo.getType());
ps.setString(10, vo.getJoinBlackReason()); ps.setString(10, vo.getReasonCode());
ps.setString(11, vo.getMaxOverdueDays()); ps.setString(11, vo.getMaxOverdueDays());
ps.setString(12, vo.getTotalOverdueDays()); ps.setString(12, vo.getTotalOverdueDays());
ps.setTimestamp(13, vo.getCreatedAt()); ps.setTimestamp(13, vo.getCreatedAt());
......
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