Commit 240ad6dd authored by 郝彦辉's avatar 郝彦辉

黑灰名单2020.04.22_08

parent 7fe229af
...@@ -128,6 +128,8 @@ public class ConstantBlackGrey { ...@@ -128,6 +128,8 @@ public class ConstantBlackGrey {
public static final DateFormat DF_YMD = new SimpleDateFormat("yyyyMMdd"); public static final DateFormat DF_YMD = new SimpleDateFormat("yyyyMMdd");
public static final DateFormat DF_YMDHMS = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
public static final String SAVELOGPATH = "/home/quant_group/qg-bl-service/logs/"; public static final String SAVELOGPATH = "/home/quant_group/qg-bl-service/logs/";
/**当前服务器CPU个数*/ /**当前服务器CPU个数*/
......
...@@ -30,7 +30,7 @@ public class BlackGreyListDetails implements Serializable { ...@@ -30,7 +30,7 @@ public class BlackGreyListDetails implements Serializable {
private String maxOverdueDays; private String maxOverdueDays;
private String totalOverdueDays; private String totalOverdueDays;
private int status; //状态 0:正常有效的; -1:由灰名单进入黑名单(无效,逻辑删除的); -2:由黑名单进入灰名单(无效,逻辑删除的); 10:当前在黑名单,并且该条数据逾期已还清的 private Integer status; //状态 0:正常有效的; -1:由灰名单进入黑名单(无效,逻辑删除的); -2:由黑名单进入灰名单(无效,逻辑删除的); 10:当前在黑名单,并且该条数据逾期已还清的
private String remark; private String remark;
@JsonIgnore @JsonIgnore
......
...@@ -153,7 +153,8 @@ ...@@ -153,7 +153,8 @@
</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 * from black_grey_list_details select id, r_id, name, phone_no, id_no, type, reason_code, max_overdue_days, total_overdue_days, status, remark, created_at, updated_at
from black_grey_list_details
where where
<choose> <choose>
<when test = "phoneNo == null"> <when test = "phoneNo == null">
......
...@@ -894,7 +894,7 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService { ...@@ -894,7 +894,7 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService {
//批量更新黑名单>>逾期天数 //批量更新黑名单>>逾期天数
if(blackListResults!=null && blackListResults.size() >0 ){ if(blackListResults!=null && blackListResults.size() >0 ){
return updateBlackListOverdueDayParallel.runMain(blackListResults); return updateBlackListOverdueDayParallel.runUpdate(blackListResults);
} }
return null; return null;
} }
......
...@@ -115,13 +115,13 @@ public class BlackToGreyListParallel implements ParallelComputingProcess<BlackGr ...@@ -115,13 +115,13 @@ public class BlackToGreyListParallel implements ParallelComputingProcess<BlackGr
boolean is_type_11 = false; boolean is_type_11 = false;
for(BlackGreyListDetails detailsVo : detailsList){ for(BlackGreyListDetails detailsVo : detailsList){
//type=11, 恶意投诉客服,一直在黑名单 //type=11, 恶意投诉客服,一直在黑名单
if("11".equals(detailsVo.getType()) && detailsVo.getStatus()==0){ if("11".equals(detailsVo.getType()) && detailsVo.getStatus().intValue()==0){
type_11.getAndIncrement(); type_11.getAndIncrement();
is_type_11=true; is_type_11=true;
break; break;
} }
//现金贷 //现金贷
else if("1".equals(detailsVo.getType()) && detailsVo.getStatus()==0){ else if("1".equals(detailsVo.getType()) && detailsVo.getStatus().intValue()==0){
//#现金分期在逾转已还 (条件为step1的表内join_black_reason=1的用户,判断其是否还处于在逾状态,如果in_overdue=0,则更新step1的表的black_type为2并更新join_black_reason为6,否则不做修改) //#现金分期在逾转已还 (条件为step1的表内join_black_reason=1的用户,判断其是否还处于在逾状态,如果in_overdue=0,则更新step1的表的black_type为2并更新join_black_reason为6,否则不做修改)
//查询现金贷逾期,是否逾期已还清 //查询现金贷逾期,是否逾期已还清
Integer in_overdue_Obj = null; Integer in_overdue_Obj = null;
...@@ -137,7 +137,7 @@ public class BlackToGreyListParallel implements ParallelComputingProcess<BlackGr ...@@ -137,7 +137,7 @@ public class BlackToGreyListParallel implements ParallelComputingProcess<BlackGr
} }
//白条 //白条
else if("2".equals(detailsVo.getType()) && detailsVo.getStatus()==0){ else if("2".equals(detailsVo.getType()) && detailsVo.getStatus().intValue()==0){
//#白条在逾转已还 (条件为step1的表内join_black_reason=3的用户,判断其是否还处于在逾状态,如果in_overdue=0,则更新step1的表的black_type为2并更新join_black_reason为6,否则不做修改) //#白条在逾转已还 (条件为step1的表内join_black_reason=3的用户,判断其是否还处于在逾状态,如果in_overdue=0,则更新step1的表的black_type为2并更新join_black_reason为6,否则不做修改)
//查询白条逾期逾期黑名单是否已还清 //查询白条逾期逾期黑名单是否已还清
...@@ -155,7 +155,7 @@ public class BlackToGreyListParallel implements ParallelComputingProcess<BlackGr ...@@ -155,7 +155,7 @@ public class BlackToGreyListParallel implements ParallelComputingProcess<BlackGr
} }
//Vcc //Vcc
else if("10".equals(detailsVo.getType()) && detailsVo.getStatus()==0){ else if("10".equals(detailsVo.getType()) && detailsVo.getStatus().intValue()==0){
// #vcc在逾转已还 (条件为step1的表内join_black_reason=2的用户,判断其是否还处于在逾状态,如果in_overdue=0,则更新step1的表的black_type为2并更新join_black_reason为6,否则不做修改) // #vcc在逾转已还 (条件为step1的表内join_black_reason=2的用户,判断其是否还处于在逾状态,如果in_overdue=0,则更新step1的表的black_type为2并更新join_black_reason为6,否则不做修改)
Integer in_overdue_Obj = null; Integer in_overdue_Obj = null;
...@@ -174,10 +174,10 @@ public class BlackToGreyListParallel implements ParallelComputingProcess<BlackGr ...@@ -174,10 +174,10 @@ public class BlackToGreyListParallel implements ParallelComputingProcess<BlackGr
} }
}else{ }else{
if(detailsVo.getStatus()==0){ if(detailsVo.getStatus().intValue()==0){
err_count.getAndIncrement(); err_count.getAndIncrement();
optSet.add("otherType:"+blackResult.getRId()); optSet.add("otherType:"+blackResult.getRId());
writeLogByName(ConstantBlackGrey.PARAM.SAVELOGPATH + dateName + ConstantBlackGrey.PARAM.SEPA + "error.log", "black_list_result_not_find_details>>"+blackResult.getRId()); writeLogByName(ConstantBlackGrey.PARAM.SAVELOGPATH + dateName + ConstantBlackGrey.PARAM.SEPA + "error.log", "黑转灰时,发现其他类别>>"+blackResult.getRId());
} }
} }
} }
...@@ -190,10 +190,10 @@ public class BlackToGreyListParallel implements ParallelComputingProcess<BlackGr ...@@ -190,10 +190,10 @@ public class BlackToGreyListParallel implements ParallelComputingProcess<BlackGr
boolean is_grey_result = true; boolean is_grey_result = true;
List<ReasonsVo> reasonsList = null; List<ReasonsVo> reasonsList = null;
for(BlackGreyListDetails detailsVo : detailsList){ for(BlackGreyListDetails detailsVo : detailsList){
if(detailsVo.getStatus()==0){ if(detailsVo.getStatus().intValue()==0){
//可以有多个type,说明至少有一个逾期还没还清,就不能转出黑名单 //可以有多个type,说明至少有一个逾期还没还清,就不能转出黑名单
is_grey_result = false; is_grey_result = false;
}else if(detailsVo.getStatus()==10){ }else if(detailsVo.getStatus().intValue()==10){
//Set<String> typeSet = BlackGreyListResult.typesToSet(blackResult.getTypes(), rJoinDVo.getType()); //Set<String> typeSet = BlackGreyListResult.typesToSet(blackResult.getTypes(), rJoinDVo.getType());
reasonsList = BlackGreyListResult.reasonsToList(blackResult.getReasons(), "6", detailsVo.getType()); reasonsList = BlackGreyListResult.reasonsToList(blackResult.getReasons(), "6", detailsVo.getType());
} }
...@@ -229,13 +229,13 @@ public class BlackToGreyListParallel implements ParallelComputingProcess<BlackGr ...@@ -229,13 +229,13 @@ public class BlackToGreyListParallel implements ParallelComputingProcess<BlackGr
}else { }else {
err_count.getAndIncrement(); err_count.getAndIncrement();
optSet.add("notFind:"+blackResult.getRId()); optSet.add("notFind:"+blackResult.getRId());
writeLogByName(ConstantBlackGrey.PARAM.SAVELOGPATH + dateName + ConstantBlackGrey.PARAM.SEPA + "error.log", "black_list_result_not_find_details>>"+blackResult.getRId()); writeLogByName(ConstantBlackGrey.PARAM.SAVELOGPATH + dateName + ConstantBlackGrey.PARAM.SEPA + "error.log", "黑转灰时,结果表没有发现details>>"+blackResult.getRId());
} }
} catch (Exception e) { } catch (Exception e) {
err_count.getAndIncrement(); err_count.getAndIncrement();
optSet.add("ERR:" + blackResult.getRId()); optSet.add("ERR:" + blackResult.getRId());
log.error(log_inf + "process() threadId:" + threadId + ",ERROR!", e); log.error(log_inf + "黑名单转灰名单执行异常process() threadId:" + threadId, e);
} }
}else { }else {
log.error("查询逾期黑名单是否已还清-发现uuid为空, threadId_{} , r_Id: {} , uuid: {} , blackType: {} ", threadId, rId, uuid, blackResult.getBlackType()); log.error("查询逾期黑名单是否已还清-发现uuid为空, threadId_{} , r_Id: {} , uuid: {} , blackType: {} ", threadId, rId, uuid, blackResult.getBlackType());
...@@ -419,8 +419,9 @@ public class BlackToGreyListParallel implements ParallelComputingProcess<BlackGr ...@@ -419,8 +419,9 @@ public class BlackToGreyListParallel implements ParallelComputingProcess<BlackGr
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
private static void writeLogByName(String fileName, String msg) { private static void writeLogByName(String fileName, String msg) {
String time = ConstantBlackGrey.PARAM.DF_YMDHMS.format(System.currentTimeMillis());
try { try {
FileUtils.write(new File(fileName), msg + "\r\n", "UTF-8", true); FileUtils.write(new File(fileName), time + " " +msg + "\r\n", "UTF-8", true);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
System.err.println("writeLog Error," + msg + "," + e.toString()); System.err.println("writeLog Error," + msg + "," + e.toString());
......
...@@ -60,10 +60,10 @@ public class UpdateBlackListOverdueDayParallel implements ParallelComputingProce ...@@ -60,10 +60,10 @@ public class UpdateBlackListOverdueDayParallel implements ParallelComputingProce
//@Autowired //@Autowired
//private JdbcTemplate blackListJdbcTemplate; //private JdbcTemplate blackListJdbcTemplate;
public String runMain(List<BlackGreyListResult> tmpQueryList) { public String runUpdate(List<BlackGreyListResult> tmpQueryList) {
long startProcess = System.currentTimeMillis(); long startProcess = System.currentTimeMillis();
int listSize = tmpQueryList.size(); int listSize = tmpQueryList.size();
log.info(log_inf+"-runMain更新逾期天数开始执行>>>>>>, listSize: {} , SYS_CPU_COUNT: {} ", listSize, THREAD_COUNT); log.info(log_inf+"-runUpdate更新逾期天数开始执行>>>>>>, listSize: {} , SYS_CPU_COUNT: {} ", listSize, THREAD_COUNT);
try { try {
//并行框架---执行 //并行框架---执行
...@@ -72,16 +72,16 @@ public class UpdateBlackListOverdueDayParallel implements ParallelComputingProce ...@@ -72,16 +72,16 @@ public class UpdateBlackListOverdueDayParallel implements ParallelComputingProce
//并行框架执行结果 //并行框架执行结果
if (optSet.size() > 0) {//并行框架执行异常 if (optSet.size() > 0) {//并行框架执行异常
log.info(log_inf + "-runMain更新逾期天数执行结束-部分失败, cost: {} <<<<<< process optSet size: {} , json: {} ", (System.currentTimeMillis()-startProcess), optSet.size(), JSONObject.toJSONString(optSet)); log.info(log_inf + "-runUpdate更新逾期天数执行结束-部分失败, cost: {} <<<<<< process optSet size: {} , json: {} ", (System.currentTimeMillis()-startProcess), optSet.size(), JSONObject.toJSONString(optSet));
} else { } else {
//执行成功 //执行成功
log.info(log_inf + "-runMain更新逾期天数执行结束-成功, cost: {} <<<<<< process is OK!", (System.currentTimeMillis() - startProcess)); log.info(log_inf + "-runUpdate更新逾期天数执行结束-成功, cost: {} <<<<<< process is OK!", (System.currentTimeMillis() - startProcess));
} }
String resMsgTemp = "更新逾期天数总共 %d条, 执行成功 %d条, 失败 %d条;"; String resMsgTemp = "更新逾期天数总共 %d条, 执行成功 %d条, 失败 %d条;";
return String.format(resMsgTemp, listSize, listSize-optSet.size(), optSet.size()); return String.format(resMsgTemp, listSize, listSize-optSet.size(), optSet.size());
} catch (Exception e) { } catch (Exception e) {
log.error(log_inf +"-runMain更新逾期天数执行异常.", e); log.error(log_inf +"-runUpdate更新逾期天数执行异常.", e);
} }
return "更新逾期天数执行异常"; return "更新逾期天数执行异常";
} }
...@@ -110,6 +110,7 @@ public class UpdateBlackListOverdueDayParallel implements ParallelComputingProce ...@@ -110,6 +110,7 @@ public class UpdateBlackListOverdueDayParallel implements ParallelComputingProce
BlackGreyListQueryVo queryParam = BlackGreyListQueryVo.builder().rId(rId).status(0).build(); BlackGreyListQueryVo queryParam = BlackGreyListQueryVo.builder().rId(rId).status(0).build();
List<BlackGreyListDetails> detailsList = blackGreyListMapper.findBlackGreyListDetails(queryParam); List<BlackGreyListDetails> detailsList = blackGreyListMapper.findBlackGreyListDetails(queryParam);
boolean details_is_update= false; //用于标记修改结果表修改时间 boolean details_is_update= false; //用于标记修改结果表修改时间
log.info("明细表查询列表: {} , rId: {} , uuid: {} ", detailsList!=null?JSON.toJSONString(detailsList):"null", rId, uuid);
if (detailsList!=null && detailsList.size()>0) { if (detailsList!=null && detailsList.size()>0) {
boolean is_type_11 = false; boolean is_type_11 = false;
...@@ -120,7 +121,7 @@ public class UpdateBlackListOverdueDayParallel implements ParallelComputingProce ...@@ -120,7 +121,7 @@ public class UpdateBlackListOverdueDayParallel implements ParallelComputingProce
continue; continue;
} }
//现金贷 //现金贷
else if("1".equals(detailsVo.getType()) && detailsVo.getStatus()==0){ else if("1".equals(detailsVo.getType())){
//查询现金贷逾期,是否逾期已还清 //查询现金贷逾期,是否逾期已还清
OverdueDaysVo overdueDays = null; OverdueDaysVo overdueDays = null;
try { try {
...@@ -147,7 +148,7 @@ public class UpdateBlackListOverdueDayParallel implements ParallelComputingProce ...@@ -147,7 +148,7 @@ public class UpdateBlackListOverdueDayParallel implements ParallelComputingProce
} }
//白条 //白条
else if("2".equals(detailsVo.getType()) && detailsVo.getStatus()==0){ else if("2".equals(detailsVo.getType())){
OverdueDaysVo overdueDays = null; OverdueDaysVo overdueDays = null;
try { try {
overdueDays = xyqbJdbcTemplate.queryForObject(ConstantBlackGrey.SQL.XYQB_QUERY_BAITIAO_OVERDUE_DAYS, new Object[]{uuid}, new RowMapper<OverdueDaysVo>() { overdueDays = xyqbJdbcTemplate.queryForObject(ConstantBlackGrey.SQL.XYQB_QUERY_BAITIAO_OVERDUE_DAYS, new Object[]{uuid}, new RowMapper<OverdueDaysVo>() {
...@@ -173,7 +174,7 @@ public class UpdateBlackListOverdueDayParallel implements ParallelComputingProce ...@@ -173,7 +174,7 @@ public class UpdateBlackListOverdueDayParallel implements ParallelComputingProce
} }
//Vcc //Vcc
else if("10".equals(detailsVo.getType()) && detailsVo.getStatus()==0){ else if("10".equals(detailsVo.getType())){
OverdueDaysVo overdueDays = null; OverdueDaysVo overdueDays = null;
//查询user_id //查询user_id
XyqbUser xyqbUser = queryXyqbUserByUuid(uuid); XyqbUser xyqbUser = queryXyqbUserByUuid(uuid);
...@@ -201,9 +202,11 @@ public class UpdateBlackListOverdueDayParallel implements ParallelComputingProce ...@@ -201,9 +202,11 @@ public class UpdateBlackListOverdueDayParallel implements ParallelComputingProce
} }
} }
}else{ }else{
err_count.getAndIncrement(); //if(detailsVo.getStatus()==0){
optSet.add("otherType:"+blackResult.getRId()); err_count.getAndIncrement();
writeLogByName(ConstantBlackGrey.PARAM.SAVELOGPATH + dateName + ConstantBlackGrey.PARAM.SEPA + "error.log", "black_list_result_not_find_details>>"+blackResult.getRId()); optSet.add("otherType:"+blackResult.getRId());
writeLogByName(ConstantBlackGrey.PARAM.SAVELOGPATH + dateName + ConstantBlackGrey.PARAM.SEPA + "error.log", "更新逾期天数时,发现其他类别>>"+blackResult.getRId());
//}
} }
} }
...@@ -217,13 +220,13 @@ public class UpdateBlackListOverdueDayParallel implements ParallelComputingProce ...@@ -217,13 +220,13 @@ public class UpdateBlackListOverdueDayParallel implements ParallelComputingProce
}else { }else {
err_count.getAndIncrement(); err_count.getAndIncrement();
optSet.add("notFind:"+blackResult.getRId()); optSet.add("notFind:"+blackResult.getRId());
writeLogByName(ConstantBlackGrey.PARAM.SAVELOGPATH + dateName + ConstantBlackGrey.PARAM.SEPA + "error.log", "black_list_result_not_find_details>>"+blackResult.getRId()); writeLogByName(ConstantBlackGrey.PARAM.SAVELOGPATH + dateName + ConstantBlackGrey.PARAM.SEPA + "error.log", "更新逾期天数时,结果表没有发现details>>"+blackResult.getRId());
} }
} catch (Exception e) { } catch (Exception e) {
optSet.add("ERR:" + blackResult.getRId()); optSet.add("ERR:" + blackResult.getRId());
err_count.getAndIncrement(); err_count.getAndIncrement();
log.error(log_inf + "process() threadId:" + threadId + ",ERROR!", e); log.error(log_inf + "更新黑名单逾期天执行异常process() threadId:" + threadId, e);
} }
}else { }else {
err_count.getAndIncrement(); err_count.getAndIncrement();
...@@ -240,8 +243,9 @@ public class UpdateBlackListOverdueDayParallel implements ParallelComputingProce ...@@ -240,8 +243,9 @@ public class UpdateBlackListOverdueDayParallel implements ParallelComputingProce
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
private static void writeLogByName(String fileName, String msg) { private static void writeLogByName(String fileName, String msg) {
String time = ConstantBlackGrey.PARAM.DF_YMDHMS.format(System.currentTimeMillis());
try { try {
FileUtils.write(new File(fileName), msg + "\r\n", "UTF-8", true); FileUtils.write(new File(fileName), time + " " +msg + "\r\n", "UTF-8", true);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
System.err.println("writeLog Error," + msg + "," + e.toString()); System.err.println("writeLog Error," + msg + "," + e.toString());
......
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