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

黑灰名单2020.04.22_08

parent 7fe229af
......@@ -128,6 +128,8 @@ public class ConstantBlackGrey {
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/";
/**当前服务器CPU个数*/
......
......@@ -30,7 +30,7 @@ public class BlackGreyListDetails implements Serializable {
private String maxOverdueDays;
private String totalOverdueDays;
private int status; //状态 0:正常有效的; -1:由灰名单进入黑名单(无效,逻辑删除的); -2:由黑名单进入灰名单(无效,逻辑删除的); 10:当前在黑名单,并且该条数据逾期已还清的
private Integer status; //状态 0:正常有效的; -1:由灰名单进入黑名单(无效,逻辑删除的); -2:由黑名单进入灰名单(无效,逻辑删除的); 10:当前在黑名单,并且该条数据逾期已还清的
private String remark;
@JsonIgnore
......
......@@ -153,7 +153,8 @@
</select>
<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
<choose>
<when test = "phoneNo == null">
......
......@@ -894,7 +894,7 @@ public class BlackGreyListServiceImpl implements IBlackGreyListService {
//批量更新黑名单>>逾期天数
if(blackListResults!=null && blackListResults.size() >0 ){
return updateBlackListOverdueDayParallel.runMain(blackListResults);
return updateBlackListOverdueDayParallel.runUpdate(blackListResults);
}
return null;
}
......
......@@ -115,13 +115,13 @@ public class BlackToGreyListParallel implements ParallelComputingProcess<BlackGr
boolean is_type_11 = false;
for(BlackGreyListDetails detailsVo : detailsList){
//type=11, 恶意投诉客服,一直在黑名单
if("11".equals(detailsVo.getType()) && detailsVo.getStatus()==0){
if("11".equals(detailsVo.getType()) && detailsVo.getStatus().intValue()==0){
type_11.getAndIncrement();
is_type_11=true;
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,否则不做修改)
//查询现金贷逾期,是否逾期已还清
Integer in_overdue_Obj = null;
......@@ -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,否则不做修改)
//查询白条逾期逾期黑名单是否已还清
......@@ -155,7 +155,7 @@ public class BlackToGreyListParallel implements ParallelComputingProcess<BlackGr
}
//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,否则不做修改)
Integer in_overdue_Obj = null;
......@@ -174,10 +174,10 @@ public class BlackToGreyListParallel implements ParallelComputingProcess<BlackGr
}
}else{
if(detailsVo.getStatus()==0){
if(detailsVo.getStatus().intValue()==0){
err_count.getAndIncrement();
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
boolean is_grey_result = true;
List<ReasonsVo> reasonsList = null;
for(BlackGreyListDetails detailsVo : detailsList){
if(detailsVo.getStatus()==0){
if(detailsVo.getStatus().intValue()==0){
//可以有多个type,说明至少有一个逾期还没还清,就不能转出黑名单
is_grey_result = false;
}else if(detailsVo.getStatus()==10){
}else if(detailsVo.getStatus().intValue()==10){
//Set<String> typeSet = BlackGreyListResult.typesToSet(blackResult.getTypes(), rJoinDVo.getType());
reasonsList = BlackGreyListResult.reasonsToList(blackResult.getReasons(), "6", detailsVo.getType());
}
......@@ -229,13 +229,13 @@ public class BlackToGreyListParallel implements ParallelComputingProcess<BlackGr
}else {
err_count.getAndIncrement();
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) {
err_count.getAndIncrement();
optSet.add("ERR:" + blackResult.getRId());
log.error(log_inf + "process() threadId:" + threadId + ",ERROR!", e);
log.error(log_inf + "黑名单转灰名单执行异常process() threadId:" + threadId, e);
}
}else {
log.error("查询逾期黑名单是否已还清-发现uuid为空, threadId_{} , r_Id: {} , uuid: {} , blackType: {} ", threadId, rId, uuid, blackResult.getBlackType());
......@@ -419,8 +419,9 @@ public class BlackToGreyListParallel implements ParallelComputingProcess<BlackGr
//-------------------------------------------------------------------------
private static void writeLogByName(String fileName, String msg) {
String time = ConstantBlackGrey.PARAM.DF_YMDHMS.format(System.currentTimeMillis());
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) {
e.printStackTrace();
System.err.println("writeLog Error," + msg + "," + e.toString());
......
......@@ -60,10 +60,10 @@ public class UpdateBlackListOverdueDayParallel implements ParallelComputingProce
//@Autowired
//private JdbcTemplate blackListJdbcTemplate;
public String runMain(List<BlackGreyListResult> tmpQueryList) {
public String runUpdate(List<BlackGreyListResult> tmpQueryList) {
long startProcess = System.currentTimeMillis();
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 {
//并行框架---执行
......@@ -72,16 +72,16 @@ public class UpdateBlackListOverdueDayParallel implements ParallelComputingProce
//并行框架执行结果
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 {
//执行成功
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条;";
return String.format(resMsgTemp, listSize, listSize-optSet.size(), optSet.size());
} catch (Exception e) {
log.error(log_inf +"-runMain更新逾期天数执行异常.", e);
log.error(log_inf +"-runUpdate更新逾期天数执行异常.", e);
}
return "更新逾期天数执行异常";
}
......@@ -110,6 +110,7 @@ public class UpdateBlackListOverdueDayParallel implements ParallelComputingProce
BlackGreyListQueryVo queryParam = BlackGreyListQueryVo.builder().rId(rId).status(0).build();
List<BlackGreyListDetails> detailsList = blackGreyListMapper.findBlackGreyListDetails(queryParam);
boolean details_is_update= false; //用于标记修改结果表修改时间
log.info("明细表查询列表: {} , rId: {} , uuid: {} ", detailsList!=null?JSON.toJSONString(detailsList):"null", rId, uuid);
if (detailsList!=null && detailsList.size()>0) {
boolean is_type_11 = false;
......@@ -120,7 +121,7 @@ public class UpdateBlackListOverdueDayParallel implements ParallelComputingProce
continue;
}
//现金贷
else if("1".equals(detailsVo.getType()) && detailsVo.getStatus()==0){
else if("1".equals(detailsVo.getType())){
//查询现金贷逾期,是否逾期已还清
OverdueDaysVo overdueDays = null;
try {
......@@ -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;
try {
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
}
//Vcc
else if("10".equals(detailsVo.getType()) && detailsVo.getStatus()==0){
else if("10".equals(detailsVo.getType())){
OverdueDaysVo overdueDays = null;
//查询user_id
XyqbUser xyqbUser = queryXyqbUserByUuid(uuid);
......@@ -201,9 +202,11 @@ public class UpdateBlackListOverdueDayParallel implements ParallelComputingProce
}
}
}else{
//if(detailsVo.getStatus()==0){
err_count.getAndIncrement();
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());
//}
}
}
......@@ -217,13 +220,13 @@ public class UpdateBlackListOverdueDayParallel implements ParallelComputingProce
}else {
err_count.getAndIncrement();
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) {
optSet.add("ERR:" + blackResult.getRId());
err_count.getAndIncrement();
log.error(log_inf + "process() threadId:" + threadId + ",ERROR!", e);
log.error(log_inf + "更新黑名单逾期天执行异常process() threadId:" + threadId, e);
}
}else {
err_count.getAndIncrement();
......@@ -240,8 +243,9 @@ public class UpdateBlackListOverdueDayParallel implements ParallelComputingProce
//-------------------------------------------------------------------------
private static void writeLogByName(String fileName, String msg) {
String time = ConstantBlackGrey.PARAM.DF_YMDHMS.format(System.currentTimeMillis());
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) {
e.printStackTrace();
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