Commit 211523af authored by 郝彦辉's avatar 郝彦辉

非联合贷-实时数据报送sql修改

parent 0c0213f7
...@@ -33,89 +33,9 @@ public class ExZhuDaiBaiHangReSendController { ...@@ -33,89 +33,9 @@ public class ExZhuDaiBaiHangReSendController {
private static final Logger log = LoggerFactory.getLogger(ExZhuDaiBaiHangReSendController.class); private static final Logger log = LoggerFactory.getLogger(ExZhuDaiBaiHangReSendController.class);
//@Autowired
//private BaiHangService baiHangService;
//@Autowired
//private ReSendBaiHangService reSendBaiHangService;
@Autowired @Autowired
BaiHangZhuDaiService baiHangZhuDaiService; BaiHangZhuDaiService baiHangZhuDaiService;
/**
* 根据时间短重新报送实时放款数据
* @param startTime
* @param endTime
* @return
*/
/*@RequestMapping("/reSendLoanInfoByTime")
public GlobalResponse reSendLoanInfoByTime(String startTime, String endTime){
try{
reSendBaiHangService.sendLoaInfoReportToBaiHang(startTime, endTime);
return GlobalResponse.generate("重新报送实时放款数据成功");
}catch(Exception e){
log.error("重新报送实时放款数据异常", e);
return GlobalResponse.generate("重新报送实时放款数据成功");
}
}*/
/**
* 根据时间段重新报送实时还款数据
* @param startTime
* @param endTime
* @return
*/
/* @RequestMapping("/reSendRepaymentInfoByTime")
public GlobalResponse reSendRepaymentInfoByTime(String startTime, String endTime){
try{
reSendBaiHangService.sendRepaymentReportToBaiHang(startTime, endTime);
return GlobalResponse.generate("重新报送实时还款数据成功");
}catch(Exception e){
log.error("重新报送实时还款数据异常", e);
return GlobalResponse.generate("重新报送实时还款数据异常");
}
}*/
/**
* 存量申请用户数据清洗
* @return
*/
/*@RequestMapping("/stockApplyInfo")
public GlobalResponse stockApplyInfo(){
baiHangService.stockApplyLoanInfo();
return GlobalResponse.generate("存量申请数据整理完毕");
}*/
/**
* 存量还款数据清洗
* @return
*/
/* @RequestMapping("/stockRepaymentLoanInfo")
public GlobalResponse stockRepaymentLooanInfo(){
baiHangService.stockRepaymentLoanInfo();
return GlobalResponse.generate("存量还款数据整理完毕");
}*/
/**
* 存量放款数据报送
* @return
*/
/*@RequestMapping("/stockLoanInfo")
public GlobalResponse stockLooanInfo(){
baiHangService.stockLoanInfo();
return GlobalResponse.generate("存量放款数据整理完毕");
}*/
/* @RequestMapping("/baihang_data")
public GlobalResponse baihangData(String readName, String writeName){
baiHangService.baihangData(readName, writeName);
return GlobalResponse.generate("成功");
}*/
/** /**
* 描述: 百行-助贷放款存量数据 整理 <br/> * 描述: 百行-助贷放款存量数据 整理 <br/>
...@@ -237,8 +157,8 @@ public class ExZhuDaiBaiHangReSendController { ...@@ -237,8 +157,8 @@ public class ExZhuDaiBaiHangReSendController {
} }
//test3.接口测试 手动调用 //test3.接口测试 手动调用
@RequestMapping("/test/apiSend2") @RequestMapping("/test/scheduled")
public String apiSend2(String type, String startDate, String endDate) { public String scheduledSend(String type, String startDate, String endDate) {
try { try {
//"2019-05-07T00:00:00" //"2019-05-07T00:00:00"
if (StringUtils.isAnyBlank(type, startDate, endDate)) { if (StringUtils.isAnyBlank(type, startDate, endDate)) {
...@@ -297,4 +217,18 @@ public class ExZhuDaiBaiHangReSendController { ...@@ -297,4 +217,18 @@ public class ExZhuDaiBaiHangReSendController {
return e.getMessage(); return e.getMessage();
} }
} }
@RequestMapping("/manual/build/zhuDaiStockSyn")
public String zhuDaiStockSyn(String type, String startDate, String noEndDate) {
if (StringUtils.isAnyBlank(type, startDate, noEndDate)) {
return "参数为空";
}
startDate=startDate+"T00:00:00";
noEndDate = noEndDate+"T00:00:00";
baiHangZhuDaiService.zhuDaiStockSyn(type, startDate, noEndDate);
return "请求type=" + type + ",startDate=" + startDate + ",noEndDate=" + noEndDate + ",调度结束";
}
} }
package cn.quantgroup.report.job;
import cn.quantgroup.report.service.baihang.BaiHangService;
import cn.quantgroup.report.service.baihang.constant.Constant;
import com.google.common.base.Stopwatch;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.util.concurrent.TimeUnit;
/**
* 广达小贷定时批量报送非循环贷(贷款申请信息/放款信息/还款信息三类数据)
* 每日凌晨2点报送
*
* @Author fengjunkai
* @Date 2019-03-26 14:24
*/
@Deprecated //2019.10.29
@Component
public class QuantGroupLoanInfoReportToBaiHang {
private static final Logger log = LoggerFactory.getLogger(QuantGroupLoanInfoReportToBaiHang.class);
@Autowired
private BaiHangService baiHangService;
@Autowired
private RedisTemplate<String,String> redisTemplate;
@Async
// @Scheduled(cron = "0 0 0 */1 * ?")
/*@Scheduled(cron = "0 0 6 * * ?")*/
// @Scheduled(cron = "*/2 * * * * ?")
public void startReport(){
if(increment()){
redisTemplate.expire(Constant.QG_LOAN_INFO_REPORT_LOCK_KEY, 10, TimeUnit.SECONDS);
Stopwatch stopwatch = Stopwatch.createStarted();
log.info("量化派报送广大小贷贷款信息开始, startTime: {} ", LocalDateTime.now());
// baiHangService.sendApplyLoanInfoReportToBaiHang(); //生产广达小贷非循环贷贷款申请报送T+1 暂时先不报送C1 因为百行还没有开放查询接口
baiHangService.sendLoaInfoReportToBaiHang(); //生产广达小贷非循环贷放款信息报送T+1
baiHangService.sendRepaymentReportToBaiHang(); //生产广达小贷非循环贷还款信息报送T+1
log.info("量化派报送广大小贷贷款信息结束, endTime: {}, 耗时: {} ", LocalDateTime.now(), stopwatch.stop().elapsed(TimeUnit.MILLISECONDS));
}
}
public Boolean increment(){
Long increment = redisTemplate.opsForValue().increment(Constant.QG_LOAN_INFO_REPORT_LOCK_KEY, 1);
return increment <= 1;
}
}
package cn.quantgroup.report.mapper.baihang; package cn.quantgroup.report.mapper.baihang;
import cn.quantgroup.report.domain.baihang.ApplyLoanInfo;
import cn.quantgroup.report.domain.baihang.ApplyLoanInfoZhuDai; import cn.quantgroup.report.domain.baihang.ApplyLoanInfoZhuDai;
import cn.quantgroup.report.domain.baihang.BaiHangThreeElements;
import cn.quantgroup.report.domain.baihang.BaiHangTimeRecord; import cn.quantgroup.report.domain.baihang.BaiHangTimeRecord;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
/** /**
* 贷款申请信息查询mapper * -----------------------------------------------------------------------------<br>
* * 描述: 贷款申请信息查询mapper <br>
* @Author fengjunkai * 作者:yanhui.Hao <br>
* @Date 2019-03-26 15:25 * 时间:2019.11.06 <br>
* 授权: (C) Copyright (c) 2017 <br>
* 公司: 北京众信利民信息技术有限公司 <br>
* -----------------------------------------------------------------------------
*/ */
@Repository @Repository
public interface ApplyLoanInfoMapper { public interface ApplyLoanInfoMapper {
//广达小贷-申请实时 //广达小贷-申请实时
List<ApplyLoanInfo> findApplyLoanInfo(); //List<ApplyLoanInfo> findApplyLoanInfo();
ApplyLoanInfo findApplyLoanInfoByThreeElements(BaiHangThreeElements baiHangThreeElements);
//广达小贷-申请存量 //广达小贷-申请存量
List<ApplyLoanInfo> findStockApplyLoanInfo(); //List<ApplyLoanInfo> findStockApplyLoanInfo();
......
...@@ -16,15 +16,20 @@ import java.util.List; ...@@ -16,15 +16,20 @@ import java.util.List;
@Repository @Repository
public interface LoanInfoMapper { public interface LoanInfoMapper {
//报送实时放款数据(百行征信报送) //报送实时放款数据(广达百行征信报送)
List<LoanInfoZhuDai> findLoanInfo(); //List<LoanInfoZhuDai> findLoanInfo();
List<LoanInfoZhuDai> findLoanInfoByTime(BaiHangTimeRecord baiHangTimeRecord); //List<LoanInfoZhuDai> findLoanInfoByTime(BaiHangTimeRecord baiHangTimeRecord);
//List<LoanInfoZhuDai> stockLoanInfo();
//根据loan_application_history_id查询最晚还款日 /**
* 描述: 根据loan_application_history_id查询xyqb_i_repayment_plan表最晚还款日 <br/>
* 参数: loan_application_history_id <br/>
* 返回值: <br/>
* 创建人: yanhui.Hao <br/>
* 创建时间: 2019.11.06 <br/>
*/
List<String> findTargetRepaymentDayList(String reqId); List<String> findTargetRepaymentDayList(String reqId);
List<LoanInfoZhuDai> stockLoanInfo();
/** /**
* 描述: 根据order_no查询 loan_application_history_id <br/> * 描述: 根据order_no查询 loan_application_history_id <br/>
......
package cn.quantgroup.report.mapper.baihang; package cn.quantgroup.report.mapper.baihang;
import cn.quantgroup.report.domain.baihang.BaiHangName;
import cn.quantgroup.report.domain.baihang.BaiHangNameResult;
import cn.quantgroup.report.domain.baihang.BaiHangTimeRecord; import cn.quantgroup.report.domain.baihang.BaiHangTimeRecord;
import cn.quantgroup.report.domain.baihang.RepaymentInfoZhuDai; import cn.quantgroup.report.domain.baihang.RepaymentInfoZhuDai;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
...@@ -17,16 +15,13 @@ import java.util.List; ...@@ -17,16 +15,13 @@ import java.util.List;
@Repository @Repository
public interface RepaymentLoanInfoMapper { public interface RepaymentLoanInfoMapper {
//实时还款(百行征信报送) //实时还款(广达百行征信报送)
List<RepaymentInfoZhuDai> findRepayMentLoanInfo(BaiHangTimeRecord baiHangTimeRecord); //List<RepaymentInfoZhuDai> findRepayMentLoanInfo(BaiHangTimeRecord baiHangTimeRecord);
//实时逾期还款(广达百行征信报送)
//实时逾期还款(百行征信报送) //List<RepaymentInfoZhuDai> findRepayMentLoanInfoOverdue(BaiHangTimeRecord baiHangTimeRecord);
List<RepaymentInfoZhuDai> findRepayMentLoanInfoOverdue(BaiHangTimeRecord baiHangTimeRecord); ///List<RepaymentInfoZhuDai> findStockRepayMentLoanInfo(BaiHangTimeRecord baiHangTimeRecord);
//List<RepaymentInfoZhuDai> findStockRepayMentLoanInfoOverdue(BaiHangTimeRecord baiHangTimeRecord);
List<RepaymentInfoZhuDai> findStockRepayMentLoanInfo(BaiHangTimeRecord baiHangTimeRecord); //BaiHangNameResult findName(BaiHangName baiHangName);
List<RepaymentInfoZhuDai> findStockRepayMentLoanInfoOverdue(BaiHangTimeRecord baiHangTimeRecord);
BaiHangNameResult findName(BaiHangName baiHangName);
/** /**
......
...@@ -4,19 +4,20 @@ import cn.quantgroup.report.domain.baihang.BaiHangUpDateRecord; ...@@ -4,19 +4,20 @@ import cn.quantgroup.report.domain.baihang.BaiHangUpDateRecord;
import cn.quantgroup.report.domain.baihang.LoanInfoZhuDai; import cn.quantgroup.report.domain.baihang.LoanInfoZhuDai;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List;
/** /**
* 放款信息查询 * -----------------------------------------------------------------------------<br>
* * 描述: 放款信息查询 <br>
* @Author fengjunkai * 作者:yanhui.Hao <br>
* @Date 2019-03-26 15:26 * 时间:2019.11.06 <br>
* 授权: (C) Copyright (c) 2017 <br>
* 公司: 北京众信利民信息技术有限公司 <br>
* -----------------------------------------------------------------------------
*/ */
@Repository @Repository
public interface LoanInfoDbMapper { public interface LoanInfoDbMapper {
void saveLoanInfoRecordLog(LoanInfoZhuDai loanInfo); void saveLoanInfoRecordLog(LoanInfoZhuDai loanInfo);
List<LoanInfoZhuDai> findAll();
void updateCurrentRecordEnableFalce(BaiHangUpDateRecord baiHangUpDateRecord); void updateCurrentRecordEnableFalce(BaiHangUpDateRecord baiHangUpDateRecord);
} }
...@@ -9,17 +9,19 @@ import org.springframework.stereotype.Repository; ...@@ -9,17 +9,19 @@ import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
/** /**
* 还款信息查询 * -----------------------------------------------------------------------------<br>
* * 描述: 还款信息查询 <br>
* @Author fengjunkai * 作者:yanhui.Hao <br>
* @Date 2019-03-26 15:27 * 时间:2019.11.06 <br>
* 授权: (C) Copyright (c) 2017 <br>
* 公司: 北京众信利民信息技术有限公司 <br>
* -----------------------------------------------------------------------------
*/ */
@Repository @Repository
public interface RepaymentLoanInfoDbMapper { public interface RepaymentLoanInfoDbMapper {
void saveRepaymentLoanInfoLog(RepaymentInfoZhuDai repaymentLoanInfo); void saveRepaymentLoanInfoLog(RepaymentInfoZhuDai repaymentLoanInfo);
List<RepaymentInfoZhuDai> findAll();
void updateCurrentRecordEnableFalse(BaiHangUpDateRecord baiHangUpDateRecord); void updateCurrentRecordEnableFalse(BaiHangUpDateRecord baiHangUpDateRecord);
......
package cn.quantgroup.report.service.baihang;
import cn.quantgroup.report.domain.baihang.*;
import cn.quantgroup.report.domain.sdk.SdkUser;
import cn.quantgroup.report.enums.RequestUrlType;
import cn.quantgroup.report.mapper.baihang.ApplyLoanInfoMapper;
import cn.quantgroup.report.mapper.baihang.LoanInfoMapper;
import cn.quantgroup.report.mapper.baihang.RepaymentLoanInfoMapper;
import cn.quantgroup.report.mapper.master.ApplyLoanInfoDbMapper;
import cn.quantgroup.report.service.baihang.client.BhFileCreditApiClient;
import cn.quantgroup.report.service.baihang.client.BhInterfaceCreditApiClient;
import cn.quantgroup.report.service.baihang.request.FileUploadRequest;
import cn.quantgroup.report.service.baihang.request.InterfaceUploadValidationRequest;
import cn.quantgroup.report.service.baihang.response.FileUploadResponse;
import cn.quantgroup.report.service.baihang.response.FileUploadValidationResponse;
import cn.quantgroup.report.service.baihang.response.InterfaceUploadResponse;
import cn.quantgroup.report.service.baihang.response.InterfaceUploadValidationResponse;
import cn.quantgroup.report.service.baihang.util.BHRSAUtils;
import cn.quantgroup.report.service.http.IHttpService;
import cn.quantgroup.report.service.thirdpartymonitor.ThirdpartyApiMonitorService;
import cn.quantgroup.report.service.usersdk.IUserCenterService;
import cn.quantgroup.report.mapper.master.LoanInfoDbMapper;
import cn.quantgroup.report.mapper.master.RepaymentLoanInfoDbMapper;
import cn.quantgroup.report.service.baihang.request.FileUploadValidationRequest;
import cn.quantgroup.report.service.baihang.request.InterfaceUploadRequest;
import cn.quantgroup.report.service.baihang.util.Base64;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.base.Stopwatch;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.io.File;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
@Service
public class BaiHangService {
private static final Logger log = LoggerFactory.getLogger(BaiHangService.class);
// private static String ERLY_DATE = "2017-10-20T00:00:00";
private static String ERLY_DATE = "2019-05-07T00:00:00";
// private static String ERLY_DATE = "2017-10-22T00:00:00";
private static String END_DATE = "2019-05-29T00:00:00";
// private static String END_DATE = "2017-10-29T00:00:00";
@Autowired
public ApplyLoanInfoMapper applyLoanInfoMapper;
@Autowired
public LoanInfoMapper loanInfoMapper;
@Autowired
public RepaymentLoanInfoMapper repaymentLoanInfoMapper;
@Autowired
public ApplyLoanInfoDbMapper applyLoanInfoDbMapper;
@Autowired
public LoanInfoDbMapper loanInfoDbMapper;
@Autowired
public RepaymentLoanInfoDbMapper repaymentLoanInfoDbMapper;
@Autowired
private ThirdpartyApiMonitorService thirdpartyApiMonitorService;
@Autowired
private IUserCenterService iUserCenterService;
@Autowired
public IHttpService iHttpService;
@Value("${baihang.zhudai.D2.data.url}")
public String baihangHandD2DataUrl;
@Value("${baihang.zhudai.D3.data.url}")
public String baihangHandD3DataUrl;
@Value("${baihang.zhudai.applyloan.url}")
public String baiHangApplyLoanInfoUrl;
@Value("${baihang.zhudai.loaninfo.url}")
public String baiHangLoanInfoUrl;
@Value("${baihang.zhudai.repaymentloaninfo.url}")
public String baiHangRepayMentLoanInfoUrl;
@Value("${baihang.zhudai.account.name}")
public String account;
@Value("${baihang.zhudai.password}")
public String password;
/**
* 实时报送用户贷款申请数据
* //Scheduled 贷款申请(百行征信报送)
*/
public void sendApplyLoanInfoReportToBaiHang() {
Stopwatch queryWatch = Stopwatch.createStarted();
List<ApplyLoanInfo> applyLoanInfos = applyLoanInfoMapper.findApplyLoanInfo();
log.info("广达小贷TO百行征信报送非循环贷贷款申请查询完成, 耗时: {} ", queryWatch.stop().elapsed(TimeUnit.MILLISECONDS));
Stopwatch sendWatch = Stopwatch.createStarted();
AtomicInteger atomicInteger = new AtomicInteger();
for (int i = 0; i < applyLoanInfos.size(); i++) {
try {
ApplyLoanInfo applyLoanInfo = applyLoanInfos.get(i);
applyLoanInfo.setName(interfaceUploadClient(applyLoanInfo.getName()));
applyLoanInfo.setMobile(interfaceUploadClient(applyLoanInfo.getMobile()));
applyLoanInfo.setPid(interfaceUploadClient(applyLoanInfo.getPid()));
String resultStr = iHttpService.postBaiHang(baiHangApplyLoanInfoUrl, getHeader(), JSON.toJSONString(applyLoanInfo));
if (Objects.isNull(resultStr) || !(resultStr.contains("queryHistory") && resultStr.contains("nonRevolvingLoan") && resultStr.contains("revolvingLoan"))) {
log.info("广达小贷TO百行征信报送贷款申请返回结果不正确, loanId: {} ", applyLoanInfo.getLoanId());
} else {
atomicInteger.getAndIncrement();
}
} catch (Exception e) {
log.error("广达小贷TO百行征信报送贷款申请信息异常", e);
}
}
log.info("广达小贷TO百行征贷款申请报送完成, 实际大小: {} , 报送成功大小: {} , 耗时: {} ", applyLoanInfos.size(), atomicInteger.get(), sendWatch.stop().elapsed(TimeUnit.MILLISECONDS));
}
/**
* 重新报送实时放款数据
* Scheduled 实时放款数据(百行征信报送)
*/
public void sendLoaInfoReportToBaiHang() {
AtomicInteger atomicInteger = new AtomicInteger();
List<LoanInfoZhuDai> loanInfos = new ArrayList<>();
Stopwatch sendWatch = Stopwatch.createStarted();
try{
Stopwatch queryWatch = Stopwatch.createStarted();
loanInfos = loanInfoMapper.findLoanInfo();
log.info("广达小贷TO百行放款申请报送开始, 大小: {} , 耗时: {} ", loanInfos.size(), queryWatch.stop().elapsed(TimeUnit.MILLISECONDS));
for (int i = 0; i < loanInfos.size(); i++) {
LoanInfoZhuDai loanInfo = loanInfos.get(i);
String id = "";
try {
String loanInfoReqId = loanInfo.getReqID();
if (loanInfo.getTotalTerm() > 1) {
List<String> targetRepaymentDayList = loanInfoMapper.findTargetRepaymentDayList(loanInfoReqId);
loanInfo.setTargetRepayDateList(String.join(",", targetRepaymentDayList));
}
UUID loanInfoId = UUID.randomUUID();
id = loanInfoId.toString().replaceAll("-", "");
loanInfo.setRecordId(id);
try{
loanInfoDbMapper.saveLoanInfoRecordLog(loanInfo);
}catch(Exception e){}
loanInfo.setRecordId(null);
loanInfo.setReqID(id);
loanInfo.setName(interfaceUploadClient(loanInfo.getName()));
loanInfo.setPid(interfaceUploadClient(loanInfo.getPid()));
loanInfo.setMobile(interfaceUploadClient(loanInfo.getMobile()));
String resultStr = iHttpService.postBaiHang(baiHangLoanInfoUrl, getHeader(), JSON.toJSONString(loanInfo));
log.info("放款用户报送结果, param: {} , resultStr: {} ", JSON.toJSONString(loanInfo), resultStr);
if (Objects.isNull(resultStr) || !"success".equalsIgnoreCase(JSON.parseObject(resultStr).getString("status"))) {
log.info("广达小贷TO百行征信报送放款返回结果不正确, recordId: {} , loanId: {} , bean: {} ", id, loanInfo.getLoanId(), JSON.toJSONString(loanInfo));
loanInfoDbMapper.updateCurrentRecordEnableFalce(BaiHangUpDateRecord.builder().enable("0").recordId(id).build());
} else {
atomicInteger.getAndIncrement();
}
} catch (Exception e) {
log.error("广达小贷TO百行征信报送放款信息异常, recordId: {} , loanId: {} ", id, loanInfo.getLoanId(), e);
}
}
}catch(Exception e){
log.error("广达小贷放款报送异常", e);
}
log.info("广达小贷TO百行征信报送放款申请完成, 实际大小: {} , 报送成功大小: {} , 耗时: {} ", loanInfos.size(), atomicInteger.get(), sendWatch.stop().elapsed(TimeUnit.MILLISECONDS));
}
/**
*Scheduled 实时还款&实时逾期还款(百行征信报送)
*/
public void sendRepaymentReportToBaiHang() {
String startTime = LocalDateTime.now().plusDays(-1).format(DateTimeFormatter.ISO_DATE);
String endTime = LocalDateTime.now().format(DateTimeFormatter.ISO_DATE);
for (int j = 0; j < 2; j++) {
Stopwatch sendWatch = Stopwatch.createStarted();
try {
List<RepaymentInfoZhuDai> repaymentLoanInfos = null;
if (j == 0) {
Stopwatch realTimeStopWatch = Stopwatch.createStarted();
repaymentLoanInfos = repaymentLoanInfoMapper.findRepayMentLoanInfo(BaiHangTimeRecord.builder().startTime(startTime).endTime(endTime).build());
log.info("广达小贷TO百行征信报送实时还款, startTime: {} , endTime: {} , 大小: {} , 耗时: {} ", startTime, endTime, repaymentLoanInfos.size(), realTimeStopWatch.stop().elapsed(TimeUnit.MILLISECONDS));
} else {
Stopwatch realTimeOverdueStopWatch = Stopwatch.createStarted();
repaymentLoanInfos = repaymentLoanInfoMapper.findRepayMentLoanInfoOverdue(BaiHangTimeRecord.builder().startTime(startTime).endTime(endTime).build());
log.info("广达小贷TO百行征信报送实时还款逾期, startTime: {} , endTime: {} , 大小: {} , 耗时: {} ", startTime, endTime, repaymentLoanInfos.size(), realTimeOverdueStopWatch.stop().elapsed(TimeUnit.MILLISECONDS));
}
AtomicInteger atomicInteger = new AtomicInteger();
for (int i = 0; i < repaymentLoanInfos.size(); i++) {
RepaymentInfoZhuDai repaymentLoanInfo = repaymentLoanInfos.get(i);
String id = "";
try {
RepaymentInfoZhuDai repaymentLoanInfo1 = repaymentLoanInfoDbMapper.findLastOne(BaiHangRepayment.builder().loanId(repaymentLoanInfo.getLoanId()).termNo(repaymentLoanInfo.getTermNo()).build());
if (j > 0 && Objects.nonNull(repaymentLoanInfo1)) {
log.info("广达小贷TO百行征信报送实时还款逾期跳过报送, startTime: {} , endTime: {} , bean: {} ", startTime, endTime, JSON.toJSONString(repaymentLoanInfo1));
continue;
}
id = UUID.randomUUID().toString().replaceAll("-", "");
repaymentLoanInfo.setRecordId(id);
try {
repaymentLoanInfoDbMapper.saveRepaymentLoanInfoLog(repaymentLoanInfo);
} catch (Exception e) {
}
repaymentLoanInfo.setPid(interfaceUploadClient(repaymentLoanInfo.getPid()));
repaymentLoanInfo.setName(interfaceUploadClient(repaymentLoanInfo.getName()));
repaymentLoanInfo.setMobile(interfaceUploadClient(repaymentLoanInfo.getMobile()));
repaymentLoanInfo.setReqID(id);
repaymentLoanInfo.setRecordId(null);
String resultStr = iHttpService.postBaiHang(baiHangRepayMentLoanInfoUrl, getHeader(), JSON.toJSONString(repaymentLoanInfo));
log.info("还款用户报送结果, param: {} , resultStr: {} ", JSON.toJSONString(repaymentLoanInfo), resultStr);
if (Objects.isNull(resultStr) || !"success".equalsIgnoreCase(JSON.parseObject(resultStr).getString("status"))) {
log.info("广达小贷TO百行征信报送还款返回结果不正确, 开始时间: {} , 结束时间: {} , recordId: {} , loanId: {} , bean: {} ", startTime, endTime, id, repaymentLoanInfo.getLoanId(), JSON.toJSONString(repaymentLoanInfo));
repaymentLoanInfoDbMapper.updateCurrentRecordEnableFalse(BaiHangUpDateRecord.builder().enable("0").recordId(id).build());
} else {
atomicInteger.getAndIncrement();
}
} catch (Exception e) {
log.error("广达小贷TO百行征信报送还款信息异常, recordId: {} , loanId: {} ", id, repaymentLoanInfo.getLoanId(), e);
}
}
log.info("广达小贷TO百行征信报送还款申请完成 J: {} , 开始时间: {} , 结束时间: {} , 实际大小: {} , 报送成功大小: {} , 耗时: {} ", j, startTime, endTime, repaymentLoanInfos.size(), atomicInteger.get(), sendWatch.stop().elapsed(TimeUnit.MILLISECONDS));
} catch (Exception e) {
log.error("广达小贷TO百行征信还款报送异常 J: {} , 开始时间: {} , 结束时间: {} ", j, startTime, endTime, e);
}
}
}
/**
* 重新报送实时还款数据 (手动报送D2)
* @throws Exception
*/
public void sendHandLoaInfoReportToBaiHang() throws Exception {
List<String> handLoanInfos = FileUtils.readLines(new File(baihangHandD2DataUrl), "utf-8");
log.info("百行征信报送放款数据, {}", JSON.toJSONString(handLoanInfos));
for(int i=0;i<handLoanInfos.size();i++){
LoanInfoZhuDai loanInfo = new Gson().fromJson(handLoanInfos.get(i), new TypeToken<LoanInfoZhuDai>(){}.getType());
log.info("百行征信报送放款数据单个数据, {}", JSON.toJSONString(loanInfo));
String loanInfoReqId = loanInfo.getReqID();
if(loanInfo.getTotalTerm() > 1){
List<String> targetRepaymentDayList = loanInfoMapper.findTargetRepaymentDayList(loanInfoReqId);
loanInfo.setTargetRepayDateList(String.join(",", targetRepaymentDayList));
}
try{
loanInfoDbMapper.saveLoanInfoRecordLog(loanInfo);
}catch(Exception e){}
loanInfo.setMobile(interfaceUploadClient(loanInfo.getMobile()));
loanInfo.setName(interfaceUploadClient(loanInfo.getName()));
loanInfo.setPid(interfaceUploadClient(loanInfo.getPid()));
String resultStr = iHttpService.postBaiHang(baiHangLoanInfoUrl, getHeader(), JSON.toJSONString(loanInfo));
log.info("广达小贷TO百行征信报送放款记录(手动) loanId: {} , bean: {} , result: {} ", loanInfo.getLoanId(), JSON.toJSONString(loanInfo), resultStr);
// log.info("广达小贷TO百行征信报送放款记录(手动) loanId: {} , bean: {} , result: {} ", loanInfo.getLoanId(), JSON.toJSONString(loanInfo), "");
}
}
/**
* 手动报送实时还款数据 (手动报送D3)
*/
public void sendHandRepaymentReportToBaiHang1() {
try {
List<String> repaymentLoanInfos = FileUtils.readLines(new File(baihangHandD3DataUrl), "utf-8");
log.info("百行征信报送还款数据, {}", JSON.toJSONString(repaymentLoanInfos));
for(int i=0;i<repaymentLoanInfos.size();i++){
RepaymentInfoZhuDai repaymentLoanInfo = new Gson().fromJson(repaymentLoanInfos.get(i), new TypeToken<RepaymentInfoZhuDai>(){}.getType());
log.info("百行征信报送还款数据单个数据, {}", JSON.toJSONString(repaymentLoanInfo));
try {
repaymentLoanInfoDbMapper.saveRepaymentLoanInfoLog(repaymentLoanInfo);
} catch (Exception e) {
}
repaymentLoanInfo.setPid(interfaceUploadClient(repaymentLoanInfo.getPid()));
repaymentLoanInfo.setName(interfaceUploadClient(repaymentLoanInfo.getName()));
repaymentLoanInfo.setMobile(interfaceUploadClient(repaymentLoanInfo.getMobile()));
repaymentLoanInfo.setReqID(repaymentLoanInfo.getRecordId());
repaymentLoanInfo.setRecordId(null);
String resultStr = iHttpService.postBaiHang(baiHangRepayMentLoanInfoUrl, getHeader(), JSON.toJSONString(repaymentLoanInfo));
log.info("百行征信手动报送还款记录 json: {} , result: {} ", JSON.toJSONString(repaymentLoanInfo), resultStr);
// log.info("百行征信手动报送还款记录 json: {} , result: {} ", JSON.toJSONString(repaymentLoanInfo), "");
}
} catch (Exception e) {
log.error("百行征信手动报送还款异常", e);
}
}
/**
* http 存量数据整理(主要是)
* 申请
*/
public void stockApplyLoanInfo() {
List<ApplyLoanInfo> applyLoanInfos = applyLoanInfoMapper.findStockApplyLoanInfo();
String upladTs = LocalDateTime.now().toString().substring(0, 19);
for (int i = 0; i < applyLoanInfos.size(); i++) {
try {
ApplyLoanInfo applyLoanInfo = applyLoanInfos.get(i);
applyLoanInfo.setUploadTs(upladTs);
applyLoanInfo.setReqID(UUID.randomUUID().toString().replaceAll("-", ""));
// FileUtils.write(new File("/Users/fengjunkai/Desktop/new/20190508/baihang_source_c1.txt"), JSON.toJSONString(applyLoanInfo)+"\r\n", true);
FileUtils.write(new File("/Users/fengjunkai/Desktop/new/20190529/xinjiangguangda_C1_2019052910580303_0001.txt"), JSON.toJSONString(applyLoanInfo) + "\r\n", true);
System.out.println("第" + i + "个");
} catch (Exception e) {
e.printStackTrace();
}
}
}
//http 存量放款数据报送
public void stockLoanInfo() {
List<LoanInfoZhuDai> loanInfos = loanInfoMapper.stockLoanInfo();
for (int i = 0; i < loanInfos.size(); i++) {
LoanInfoZhuDai loanInfo = loanInfos.get(i);
String id = "";
try {
String loanInfoReqId = loanInfo.getReqID();
if (loanInfo.getTotalTerm() > 1) {
List<String> targetRepaymentDayList = loanInfoMapper.findTargetRepaymentDayList(loanInfoReqId);
loanInfo.setTargetRepayDateList(String.join(",", targetRepaymentDayList));
}
loanInfo.setReqID(UUID.randomUUID().toString().replaceAll("-", ""));
// FileUtils.write(new File("/Users/fengjunkai/Desktop/new/20190508/baihang_source_d2.txt"), JSON.toJSONString(loanInfo)+"\r\n", true);
// FileUtils.write(new File("/Users/fengjunkai/Desktop/new/20190529/xinjiangguangda_D2_2019052910580303_0001.txt"), JSON.toJSONString(loanInfo) + "\r\n", true);
FileUtils.write(new File("/Users/fengjunkai/Documents/百行征信数据报送20190702/xinjiangguangda_D2_20190702113409_0001.txt"), JSON.toJSONString(loanInfo) + "\r\n", true);
} catch (Exception e) {
log.error("广达小贷TO百行征信报送放款信息异常, recordId: {} , loanId: {} ", id, loanInfo.getLoanId(), e);
}
}
}
//http 存量还款数据清洗
public void stockRepaymentLoanInfo() {
int counter = 0;
LocalDateTime erlyDate = LocalDateTime.parse(ERLY_DATE);
LocalDateTime endDate = LocalDateTime.parse(END_DATE);
log.info("开始整理还款存量信息......");
while (true) {
counter++;
if (erlyDate.plusDays(counter + 1).compareTo(endDate) >= 0) {
break;
}
List<RepaymentInfoZhuDai> repaymentLoanInfos = new ArrayList<>();
String starTime = erlyDate.plusDays(counter).format(DateTimeFormatter.ISO_DATE);
String endTime = erlyDate.plusDays(counter + 1).format(DateTimeFormatter.ISO_DATE);
log.info("整理startTime: {} , endTime: {} ", starTime, endTime);
for (int i = 0; i < 2; i++) {
try {
if (i == 0) {
Stopwatch stopwatch = Stopwatch.createStarted();
repaymentLoanInfos = repaymentLoanInfoMapper.findStockRepayMentLoanInfo(BaiHangTimeRecord.builder().startTime(starTime).endTime(endTime).build());
log.info("查询还款 startTime: {} , endTime: {} , 大小: {} , 耗时: {} ", starTime, endTime, repaymentLoanInfos.size(), stopwatch.stop().elapsed(TimeUnit.MILLISECONDS));
} else {
Stopwatch stopwatch = Stopwatch.createStarted();
repaymentLoanInfos = repaymentLoanInfoMapper.findStockRepayMentLoanInfoOverdue(BaiHangTimeRecord.builder().startTime(starTime).endTime(endTime).build());
log.info("查询逾期还款 startTime: {} , endTime: {} , 大小: {} , 耗时: {} ", starTime, endTime, repaymentLoanInfos.size(), stopwatch.stop().elapsed(TimeUnit.MILLISECONDS));
}
for (int j = 0; j < repaymentLoanInfos.size(); j++) {
RepaymentInfoZhuDai repaymentLoanInfo = repaymentLoanInfos.get(j);
// FileUtils.write(new File("/Users/fengjunkai/Desktop/new/20190508/baihang_source_d3.txt"), JSON.toJSONString(repaymentLoanInfo)+"\r\n", true);
// FileUtils.write(new File("/vpants/shaun/risk-datasource/鹰潭市信江广达小额贷款股份有限公司_D3_2019050805310101_0001.txt"), JSON.toJSONString(repaymentLoanInfo)+"\r\n", true);
FileUtils.write(new File("/Users/fengjunkai/Desktop/new/20190529/xinjiangguangda_D3_2019052910580303_0001.txt"), JSON.toJSONString(repaymentLoanInfo) + "\r\n", true);
}
} catch (Exception e) {
log.error("整理存量数据发生异常, startTime: {} , endTime: {} , num: {} ", starTime, endTime, e);
}
}
}
log.info("整理还款存量信息结束......");
// try{
// List<String> list = FileUtils.readLines(new File("/Users/fengjunkai/Desktop/new/鹰潭市信江广达小额贷款股份有限公司_D3_20190422110303_0003_new1.txt"), "utf-8");
//// List<RepaymentLoanInfo> repaymentLoanInfos = new Gson().fromJson(JSON.toJSONString(list), new TypeToken<ArrayList<RepaymentLoanInfo>>(){}.getType());
// Map<String, RepaymentLoanInfo> speedMap = new HashMap<>();
//
// for(int i=0;i<list.size();i++){
// RepaymentLoanInfo repaymentLoanInfo = new Gson().fromJson(list.get(i), new TypeToken<RepaymentLoanInfo>(){}.getType());
// BaiHangNameResult baiHangNameResult = repaymentLoanInfoMapper.findName(BaiHangName.builder().loanId(repaymentLoanInfo.getLoanId()).build());
// repaymentLoanInfo.setName(baiHangNameResult.getName());
// repaymentLoanInfo.setPid(baiHangNameResult.getPid());
// repaymentLoanInfo.setMobile(baiHangNameResult.getMobile());
//// UUID uuid = UUID.randomUUID();
//// FileUtils.write(new File("/Users/fengjunkai/Desktop/new/reqIdMappingToUuid.txt"), repaymentLoanInfo.getReqID()+":"+uuid.toString().replaceAll("-", "")+"\r\n", true);
//// repaymentLoanInfo.setReqID(uuid.toString().replaceAll("-",""));
//// if(repaymentLoanInfo.getLoanStatus()==3 && "overdue".equalsIgnoreCase(repaymentLoanInfo.getTermStatus())){
//// System.out.println("跳过第"+i+"个"+" "+JSON.toJSONString(repaymentLoanInfo));
//// continue;
//// }
//// loanId+termNo+状态确认时间一样的 把没有实际还款时间的删掉
// RepaymentLoanInfo repaymentLoanInfoCache = speedMap.get(repaymentLoanInfo.getLoanId()+repaymentLoanInfo.getTermNo()+repaymentLoanInfo.getStatusConfirmAt());
// if(repaymentLoanInfoCache!=null){ //说明里面包含了同样的记录
// String realRepaymentDate = repaymentLoanInfoCache.getRealRepaymentDate();
// if(StringUtils.isBlank(realRepaymentDate)){
// System.out.println("----------------------------------------------------------------跳过"+i);
// continue;
// }else{
// System.out.println("----------覆盖保存"+i);
// speedMap.put(repaymentLoanInfo.getLoanId()+repaymentLoanInfo.getTermNo()+repaymentLoanInfo.getStatusConfirmAt(), repaymentLoanInfo);
// }
// }else{
// System.out.println("---------------正常保存"+i);
// speedMap.put(repaymentLoanInfo.getLoanId()+repaymentLoanInfo.getTermNo()+repaymentLoanInfo.getStatusConfirmAt(), repaymentLoanInfo);
// }
// }
//
// speedMap.forEach((k, v)->{
// RepaymentLoanInfo repaymentLoanInfo = speedMap.get(k);
// try {
// FileUtils.write(new File("/Users/fengjunkai/Desktop/new/鹰潭市信江广达小额贷款股份有限公司_D3_201904241037_0004.txt"), JSON.toJSONString(repaymentLoanInfo)+"\r\n", true);
// } catch (IOException e) {
// e.printStackTrace();
// }
// });
// System.out.println("完事");
// }catch(Exception e){
// e.printStackTrace();
// }
}
public Map<String, String> getHeader() {
Map<String, String> headerMap = new HashMap<>();
headerMap.put("Authorization", "Basic " + Base64.byteArrayToBase64((account + ":" + password).getBytes()));
headerMap.put("Content-Type", "application/json");
return headerMap;
}
public static String interfaceUploadClient(String param) throws Exception {
InterfaceUploadRequest req = new InterfaceUploadRequest();
List<String> datas = new ArrayList<String>();
datas.add(param);
//设置待加密的原始数据集合
req.setData(datas);
BhInterfaceCreditApiClient client = new BhInterfaceCreditApiClient();
//初始化设置RSA公钥
client.init(BHRSAUtils.readRSAPublicKey("/baihang/rsa_public_key.pem"));
//执行加密操作
InterfaceUploadResponse response = client.execute(req);
if (response.isSuccess) {
List<String> data = response.getEncryptData();
return data.get(0);
}
throw new Exception();
}
/**
* 解密
*
* @throws Exception
*/
public static void interfaceUploadValidationClient() throws Exception {
//RSA私钥文件路径(百行提供测试环境私钥文件)
// String RSA_PRIVATE_KEY = "d:\\rsa_private_key.pem";
InterfaceUploadValidationRequest req = new InterfaceUploadValidationRequest();
List<String> datas = new ArrayList<String>();
String name = "J6kssxkrOSWPOh4XHk5cZEAEKNEQyUQeY3VNNpFHQaBJhp4lxnx+PeHgWt3uSW9A/wZf3jd5rFpdw21C55BSHHob7kU41n00Tfbt4dFy8u6lS16UaFSdNdrvZ6Y8iokVujq54zd96jggbHPK258qlrW8rkvaWp0KIWBgJesp2UQ=";//加密后的密文
// String pid = "CSdFOGhhZS1eX5NnPAIR6/vh3FzgMBRSvJVcgf4WI8d4zStBjXKUf7UfsjGfcdMjPLkPQ93sD0OqkF5XuMWaCSkt1gHkvQCmxvErBYDfaYKI6rMY4QdJ4BPxau/IStAo+hXNdlD9gGBZpIjEtickDIw1YYdLfqRw4mZdNuMkMXI=";//加密后的密文
// String mobile= "B5F2ozIoPbXpv65rk7fStPsVmpF0xoB+wpTc++1EvWqoDYZ5epWGmBdtxCElgvdflBcWDzB0oPPM8PclG0p/EPmJcrbivkFHN65HViTvfk2Xxs+sss9IomhmuWiLS5BTpxyTlMsPnSPjmE8so6S16YiiW3ZVble2CijUKPV+Luk=";//加密后的密文
datas.add(name);
// datas.add(pid);
// datas.add(mobile);
//设置待解密的密文数据集合
req.setData(datas);
BhInterfaceCreditApiClient client = new BhInterfaceCreditApiClient();
//初始化设置RSA私钥
client.init(BHRSAUtils.readRSAPrivateKey("/baihang/rsa_private_key.pem"));
//执行解密操作
InterfaceUploadValidationResponse response = client.execute(req);
if (response.isSuccess) {
List<String> data = response.getDecryptData();
for (int i = 0; i < data.size(); i++) {
System.out.println(data.get(i));
}
System.out.println("decrypt success;decrypt data = " + response.getDecryptData());
} else {
System.out.println("decrypt fail;errorMessage = " + response.getErrorMessage());
}
}
public static void main(String[] args) {
// String startTime = DateUtils.getYesterdayDateStr();
// System.out.println(startTime);
try {
// interfaceUploadValidationClient();
// interfaceUploadClient();
// fileUploadClient();
// System.out.println("fdsfsa");
// fileUploadValidationClient();
// convertApplyLoanInfo();
// convertLoanInfo();
// convertRepaymentLoanInfo();
// System.out.println(interfaceUploadClient("15045300259"));
// Map<String,Object> map = new HashMap<>();
// RepaymentLoanInfo repaymentLoanInfo = new RepaymentLoanInfo();
// repaymentLoanInfo.setRealRepayment(new BigDecimal("11.11"));
// System.out.println(JSON.toJSONString(repaymentLoanInfo));
// List<String> list = FileUtils.readLines(new File("/Users/fengjunkai/Documents/repaymentLoanInfo11.json"), "utf-8");
// for(int i=0;i<list.size();i++){
// try{
// RepaymentLoanInfo repaymentLoanInfo = new Gson().fromJson(list.get(i), new TypeToken<RepaymentLoanInfo>(){}.getType());
//// repaymentLoanInfo.setPid(interfaceUploadClient(repaymentLoanInfo.getPid()));
//// repaymentLoanInfo.setName(interfaceUploadClient(repaymentLoanInfo.getName()));
//// repaymentLoanInfo.setMobile(interfaceUploadClient(repaymentLoanInfo.getMobile()));
//
// Map<String,Object> repaymentLoanInfoMap = new HashMap<>();
// repaymentLoanInfoMap.put("reqID", repaymentLoanInfo.getReqID());
// repaymentLoanInfoMap.put("uploadTs", repaymentLoanInfo.getUploadTs());
// repaymentLoanInfoMap.put("opCode", repaymentLoanInfo.getOpCode());
// repaymentLoanInfoMap.put("loanId", repaymentLoanInfo.getLoanId());
// repaymentLoanInfoMap.put("name", interfaceUploadClient(repaymentLoanInfo.getName()));
// repaymentLoanInfoMap.put("mobile", interfaceUploadClient(repaymentLoanInfo.getMobile()));
// repaymentLoanInfoMap.put("pid", interfaceUploadClient(repaymentLoanInfo.getPid()));
// repaymentLoanInfoMap.put("termNo", repaymentLoanInfo.getTermNo());
// repaymentLoanInfoMap.put("termStatus", repaymentLoanInfo.getTermStatus());
// repaymentLoanInfoMap.put("targetRepaymentDate", repaymentLoanInfo.getTargetRepaymentDate());
//// if(!"overdue".equals(repaymentLoanInfo.getTermStatus())){
// repaymentLoanInfoMap.put("realRepaymentDate", repaymentLoanInfo.getRealRepaymentDate());
//// }
// repaymentLoanInfoMap.put("plannedPayment", repaymentLoanInfo.getPlannedPayment());
// repaymentLoanInfoMap.put("targetRepayment", repaymentLoanInfo.getTargetRepayment());
// repaymentLoanInfoMap.put("realRepayment", repaymentLoanInfo.getRealRepayment());
// repaymentLoanInfoMap.put("overdueStatus", repaymentLoanInfo.getOverdueStatus());
// repaymentLoanInfoMap.put("statusConfirmAt", repaymentLoanInfo.getStatusConfirmAt());
// repaymentLoanInfoMap.put("overdueAmount", repaymentLoanInfo.getOverdueAmount());
// repaymentLoanInfoMap.put("remainingAmount", repaymentLoanInfo.getRemainingAmount());
// repaymentLoanInfoMap.put("loanStatus", repaymentLoanInfo.getLoanStatus());
//// String resultStr = iHttpService.postBaiHang(baiHangRepayMentLoanInfoUrl, getHeader(), JSON.toJSONString(repaymentLoanInfoMap));
// System.out.println(JSON.toJSONString(repaymentLoanInfoMap));
//
// }catch(Exception e){
// log.error("广达小贷TO百行征信报送非循环贷还款信息异常", e);
// }
// }
// UUID uuid = UUID.randomUUID();
// System.out.println(uuid.toString().replaceAll("-",""));
// System.out.println(LocalDateTime.now().format(DateTimeFormatter.ISO_DATE));
// System.out.println(LocalDateTime.now().plusDays(-1).format(DateTimeFormatter.ISO_DATE));
// String str = FileUtils.readFileToString(new File("/Users/fengjunkai/Downloads/111.txt"), "utf-8");
// String str = FileUtils.readFileToString(new File("/Users/fengjunkai/Desktop/20190421/loanInfo_0421"), "utf-8");
// String str = FileUtils.readFileToString(new File("/Users/fengjunkai/Desktop/20190421/repaymentInfo_0421"), "utf-8");
// JSONArray jsonArray = JSON.parseArray(str);
// for(int i=0;i<jsonArray.size();i++){
// JSONObject jsonObject = jsonArray.getJSONObject(i);
// FileUtils.write(new File("/Users/fengjunkai/Desktop/20190421/鹰潭市信江广达小额贷款股份有限公司_D2_20190421141422_0002.txt"), JSON.toJSONString(jsonObject)+"\r\n", true);
// FileUtils.write(new File("/Users/fengjunkai/Desktop/20190421/鹰潭市信江广达小额贷款股份有限公司_D3_20190421141422_0003.txt"), JSON.toJSONString(jsonObject)+"\r\n", true);
// }
// String startTime = LocalDateTime.now().plusDays(-1).format(DateTimeFormatter.ISO_DATE);
// String endTime = LocalDateTime.now().format(DateTimeFormatter.ISO_DATE);
// for(int i=0;i<100;i++){
// System.out.println("startTime : "+LocalDateTime.now().plusDays(-(i+1)).format(DateTimeFormatter.ISO_DATE)+", "+"endTime : "+LocalDateTime.now().plusDays(-i).format(DateTimeFormatter.ISO_DATE));
// }
// int counter = 0;
// LocalDateTime erlyDate = LocalDateTime.parse(ERLY_DATE);
// LocalDateTime endDate = LocalDateTime.parse(END_DATE);
// while (true){
// counter++;
// if(endDate.compareTo(erlyDate.plusDays(counter))>0){
// break;
// }
// System.out.println("startTime : "+erlyDate.plusDays(counter).format(DateTimeFormatter.ISO_DATE)+", "+"endTime : "+erlyDate.plusDays(counter+1).format(DateTimeFormatter.ISO_DATE));
// }
// System.out.println(LocalDateTime.now().plusDays(-1).compareTo(LocalDateTime.now())>=0);
// System.out.println(LocalDateTime.now().compareTo(LocalDateTime.now()));
// System.out.println(0>0);
// System.out.println(LocalDateTime.parse("2017-09-31").format(DateTimeFormatter.ISO_DATE));;
// String s = LocalDateTime.parse("2017-09-31").format(DateTimeFormatter.ISO_DATE);
// System.out.println(LocalDateTime.parse("2017-09-29T00:00:00").format(DateTimeFormatter.ISO_DATE));
// List<String> list = FileUtils.readLines(new File("/Users/fengjunkai/Desktop/new/鹰潭市信江广达小额贷款股份有限公司_D3_20190422110303_0003_new2.txt"), "utf-8");
// List<RepaymentLoanInfo> repaymentLoanInfos = new Gson().fromJson(JSON.toJSONString(list), new TypeToken<ArrayList<RepaymentLoanInfo>>(){}.getType());
// Map<String, RepaymentLoanInfo> speedMap = new HashMap<>();
//
// for(int i=0;i<list.size();i++){
// RepaymentLoanInfo repaymentLoanInfo = new Gson().fromJson(list.get(i), new TypeToken<RepaymentLoanInfo>(){}.getType());
//// UUID uuid = UUID.randomUUID();
//// FileUtils.write(new File("/Users/fengjunkai/Desktop/new/reqIdMappingToUuid.txt"), repaymentLoanInfo.getReqID()+":"+uuid.toString().replaceAll("-", "")+"\r\n", true);
//// repaymentLoanInfo.setReqID(uuid.toString().replaceAll("-",""));
//// if(repaymentLoanInfo.getLoanStatus()==3 && "overdue".equalsIgnoreCase(repaymentLoanInfo.getTermStatus())){
//// System.out.println("跳过第"+i+"个"+" "+JSON.toJSONString(repaymentLoanInfo));
//// continue;
//// }
//// loanId+termNo+状态确认时间一样的 把没有实际还款时间的删掉
// RepaymentLoanInfo repaymentLoanInfoCache = speedMap.get(repaymentLoanInfo.getLoanId()+repaymentLoanInfo.getTermNo()+repaymentLoanInfo.getStatusConfirmAt());
// if(repaymentLoanInfoCache!=null){ //说明里面包含了同样的记录
// String realRepaymentDate = repaymentLoanInfoCache.getRealRepaymentDate();
// if(StringUtils.isBlank(realRepaymentDate)){
// continue;
// }else{
// speedMap.put(repaymentLoanInfo.getLoanId()+repaymentLoanInfo.getTermNo()+repaymentLoanInfo.getStatusConfirmAt(), repaymentLoanInfo);
// }
// }else{
// speedMap.put(repaymentLoanInfo.getLoanId()+repaymentLoanInfo.getTermNo()+repaymentLoanInfo.getStatusConfirmAt(), repaymentLoanInfo);
// }
// }
//
// speedMap.forEach((k, v)->{
// RepaymentLoanInfo repaymentLoanInfo = speedMap.get(k);
// try {
// FileUtils.write(new File("/Users/fengjunkai/Desktop/new/鹰潭市信江广达小额贷款股份有限公司_D3_201904241037_0004.txt"), JSON.toJSONString(repaymentLoanInfo)+"\r\n", true);
// } catch (IOException e) {
// e.printStackTrace();
// }
// });
// System.out.println("完事");
//
// LocalDateTime localDateTime = LocalDateTime.now();
// System.out.println(localDateTime);
// System.out.println(localDateTime.toString().substring(0,19));
// System.out.println(localDateTime.format(DateTimeFormatter.ISO_LOCAL_DATE));
// List<String> list = FileUtils.readLines(new File("/Users/fengjunkai/Desktop/new/鹰潭市信江广达小额贷款股份有限公司_D3_201904241037_0004.txt"), "utf-8");
// Map<String,RepaymentLoanInfo> repaymentLoanInfoMap = new HashMap<>();
// for(int i=1;i<list.size();i++){
// RepaymentLoanInfo repaymentLoanInfo = new Gson().fromJson(list.get(i), new TypeToken<RepaymentLoanInfo>(){}.getType());
// repaymentLoanInfoMap.put(repaymentLoanInfo.getLoanId()+repaymentLoanInfo.getTermNo()+repaymentLoanInfo.getLoanStatus(), repaymentLoanInfo);
// }
// List<String> list1 = FileUtils.readLines(new File("/Users/fengjunkai/Desktop/new/CRY/11111111"), "utf-8");
// for(int i=0;i<list1.size();i++){
// RepaymentLoanInfo repaymentLoanInfo = repaymentLoanInfoMap.get(list1.get(i));
// System.out.println(JSON.toJSONString(repaymentLoanInfo));
//
// repaymentLoanInfo.setLoanStatus(2);
// repaymentLoanInfo.setOpCode("M");
// FileUtils.write(new File("/Users/fengjunkai/Desktop/new/CRY/鹰潭市信江广达小额贷款股份有限公司_D3_201904241037_0004_tmp1.txt"), JSON.toJSONString(repaymentLoanInfo)+"\r\n", true);
// }
// for(int i=1;i<list.size();i++){
// RepaymentLoanInfo repaymentLoanInfo = new Gson().fromJson(list.get(i), new TypeToken<RepaymentLoanInfo>(){}.getType());
// repaymentLoanInfo.setOpCode("M");
// if("967167083".equals(repaymentLoanInfo.getLoanId()+repaymentLoanInfo.getLoanStatus())){
// repaymentLoanInfo.setRealRepayment(repaymentLoanInfo.getPlannedPayment());
// FileUtils.write(new File("/Users/fengjunkai/Desktop/new/CRY/鹰潭市信江广达小额贷款股份有限公司_D3_201904241037_0004_tmp.txt"), JSON.toJSONString(repaymentLoanInfo)+"\r\n", true);
// }else if("967175963".equals(repaymentLoanInfo.getLoanId()+repaymentLoanInfo.getLoanStatus())){
// repaymentLoanInfo.setRealRepayment(repaymentLoanInfo.getPlannedPayment());
// FileUtils.write(new File("/Users/fengjunkai/Desktop/new/CRY/鹰潭市信江广达小额贷款股份有限公司_D3_201904241037_0004_tmp.txt"), JSON.toJSONString(repaymentLoanInfo)+"\r\n", true);
// }else if("967162983".equals(repaymentLoanInfo.getLoanId()+repaymentLoanInfo.getLoanStatus())){
// repaymentLoanInfo.setRealRepayment(repaymentLoanInfo.getPlannedPayment());
// FileUtils.write(new File("/Users/fengjunkai/Desktop/new/CRY/鹰潭市信江广达小额贷款股份有限公司_D3_201904241037_0004_tmp.txt"), JSON.toJSONString(repaymentLoanInfo)+"\r\n", true);
// }else if("967167603".equals(repaymentLoanInfo.getLoanId()+repaymentLoanInfo.getLoanStatus())){
// repaymentLoanInfo.setRealRepayment(repaymentLoanInfo.getPlannedPayment());
// FileUtils.write(new File("/Users/fengjunkai/Desktop/new/CRY/鹰潭市信江广达小额贷款股份有限公司_D3_201904241037_0004_tmp.txt"), JSON.toJSONString(repaymentLoanInfo)+"\r\n", true);
// }else if("967141803".equals(repaymentLoanInfo.getLoanId()+repaymentLoanInfo.getLoanStatus())){
// repaymentLoanInfo.setRealRepayment(repaymentLoanInfo.getPlannedPayment());
// FileUtils.write(new File("/Users/fengjunkai/Desktop/new/CRY/鹰潭市信江广达小额贷款股份有限公司_D3_201904241037_0004_tmp.txt"), JSON.toJSONString(repaymentLoanInfo)+"\r\n", true);
// }
// }
// List<String> list = FileUtils.readLines(new File("/Users/fengjunkai/Desktop/new/CRY/鹰潭市信江广达小额贷款股份有限公司_D3_201904241037_0004_M_logicerror.log"), "utf-8");
// List<String> list1 = new ArrayList<>();
// for(int i=1;i<list.size();i++){
// JSONObject jsonObject = JSON.parseObject(list.get(i));
// String reqId = jsonObject.getString("reqID");
// list1.add(reqId);
// }
//
// List<String> list2 = FileUtils.readLines(new File("/Users/fengjunkai/Desktop/new/CRY/鹰潭市信江广达小额贷款股份有限公司_D3_201904241037_0004_tmp1.txt"), "utf-8");
// Map<String,RepaymentLoanInfo> repaymentLoanInfoMap = new HashMap<>();
// for(int i=0;i<list2.size();i++){
// RepaymentLoanInfo repaymentLoanInfo = new Gson().fromJson(list2.get(i), new TypeToken<RepaymentLoanInfo>(){}.getType());
// repaymentLoanInfoMap.put(repaymentLoanInfo.getReqID(), repaymentLoanInfo);
// }
//
//// repaymentLoanInfoMap.forEach((k,v)->{
//// try {
//// FileUtils.write(new File("/Users/fengjunkai/Desktop/new/CRY/鹰潭市信江广达小额贷款股份有限公司_D3_201904241037_0004_MM.txt"), JSON.toJSONString(v)+"\r\n", true);
//// } catch (IOException e) {
//// e.printStackTrace();
//// }
//// });
// for(int i=0;i<list1.size();i++){
// FileUtils.write(new File("/Users/fengjunkai/Desktop/new/CRY/鹰潭市信江广达小额贷款股份有限公司_D3_201904241037_0004_MM.txt"), JSON.toJSONString(repaymentLoanInfoMap.get(list1.get(i)))+"\r\n", true);
// }
// List<String> list3 = FileUtils.readLines(new File("/Users/fengjunkai/Desktop/new/CRY/鹰潭市信江广达小额贷款股份有限公司_D3_201904241037_0004_MM.txt"), "utf-8");
// for(int i=0;i<list3.size();i++){
// RepaymentLoanInfo repaymentLoanInfo = new Gson().fromJson(list3.get(i), new TypeToken<RepaymentLoanInfo>(){}.getType());
// repaymentLoanInfo.setLoanStatus(1);
// FileUtils.write(new File("/Users/fengjunkai/Desktop/new/CRY/鹰潭市信江广达小额贷款股份有限公司_D3_201904241037_0004_M1.txt"), JSON.toJSONString(repaymentLoanInfo)+"\r\n", true);
// }
// List<String> list = FileUtils.readLines(new File("/Users/fengjunkai/Desktop/new/鹰潭市信江广达小额贷款股份有限公司_D3_201904241037_0004.txt"), "utf-8");
// for(int i=0;i<list.size();i++){
//
// }
// List<String> list1 = FileUtils.readLines(new File("/Users/fengjunkai/Desktop/new/22222"), "utf-8");
// Map<String,String> map = new HashMap<>();
// for(int i=0;i<list1.size();i++){
// String str[] = list1.get(i).split(":");
// map.put(str[0]+str[1]+str[2], str[3]);
// }
//
// List<String> list = FileUtils.readLines(new File("/Users/fengjunkai/Desktop/new/鹰潭市信江广达小额贷款股份有限公司_D3_201904241037_0004.txt"), "utf-8");
// Map<String,RepaymentLoanInfo> repaymentLoanInfoMap = new HashMap<>();
// for(int i=1;i<list.size();i++){
// RepaymentLoanInfo repaymentLoanInfo = new Gson().fromJson(list.get(i), new TypeToken<RepaymentLoanInfo>(){}.getType());
// repaymentLoanInfoMap.put(repaymentLoanInfo.getLoanId()+repaymentLoanInfo.getLoanStatus()+repaymentLoanInfo.getTermNo()+repaymentLoanInfo.getOverdueStatus(), repaymentLoanInfo);
// }
// for(int i=0;i<list.size();i++){
// if(list.get(i).contains("90987526")){
// System.out.println(list.get(i));
// }
// }
//
// map.forEach((k,v)->{
// RepaymentLoanInfo repaymentLoanInfo = repaymentLoanInfoMap.get(k);
// repaymentLoanInfo.setRemainingAmount(new BigDecimal(v).setScale(2, BigDecimal.ROUND_HALF_UP));
// repaymentLoanInfo.setOpCode("M");
// try {
// FileUtils.write(new File("/Users/fengjunkai/Desktop/new/CRY/鹰潭市信江广达小额贷款股份有限公司_D3_201904241037_0004_M2.txt"), JSON.toJSONString(repaymentLoanInfo)+"\r\n", true);
// } catch (IOException e) {
// e.printStackTrace();
// }
// });
// List<String> list = FileUtils.readLines(new File("/Users/fengjunkai/Desktop/new/鹰潭市信江广达小额贷款股份有限公司_D3_201904241037_0004.txt"), "utf-8");
// Map<String,RepaymentLoanInfo> map = new HashMap<>();
// for(int i=1;i<list.size();i++){
// RepaymentLoanInfo repaymentLoanInfo = new Gson().fromJson(list.get(i), new TypeToken<RepaymentLoanInfo>(){}.getType());
// map.put(repaymentLoanInfo.getLoanId()+repaymentLoanInfo.getLoanStatus()+repaymentLoanInfo.getTermNo()+repaymentLoanInfo.getOverdueStatus(), repaymentLoanInfo);
// map.put(repaymentLoanInfo.getLoanId()+repaymentLoanInfo.getLoanStatus()+repaymentLoanInfo.getTermNo(), repaymentLoanInfo);
// map.put(repaymentLoanInfo.getLoanId()+repaymentLoanInfo.getLoanStatus()+repaymentLoanInfo.getTermNo(), repaymentLoanInfo);
// }
// System.out.println(map.size());
//
// List<String> list1 = FileUtils.readLines(new File("/Users/fengjunkai/Desktop/new/CRY/20190428/鹰潭市信江广达小额贷款股份有限公司_D3_201904241037_0004_20190428"), "utf-8");
// for(int i=0;i<list1.size();i++){
// String tmp[] = list1.get(i).split("#");
//// RepaymentLoanInfo repaymentLoanInfo = map.get(tmp[0]+tmp[1]+tmp[2]+tmp[3]);
//// repaymentLoanInfo.setRealRepaymentDate(tmp[4]);
//// repaymentLoanInfo.setTargetRepayment(new BigDecimal(tmp[5]).setScale(2, BigDecimal.ROUND_HALF_UP));
//// repaymentLoanInfo.setRealRepayment(new BigDecimal(6).setScale(2, BigDecimal.ROUND_HALF_UP));
//// repaymentLoanInfo.setOpCode("M");
//// FileUtils.write(new File("/Users/fengjunkai/Desktop/new/CRY/20190428/鹰潭市信江广达小额贷款股份有限公司_D3_201904241037_0004_M3.txt"), JSON.toJSONString(repaymentLoanInfo)+"\r\n", true);
//
//// RepaymentLoanInfo repaymentLoanInfo = map.get(tmp[0]+tmp[1]+tmp[2]);
//// repaymentLoanInfo.setOpCode("M");
//// repaymentLoanInfo.setLoanStatus(1);
//// repaymentLoanInfo.setRemainingAmount(new BigDecimal(tmp[3]).setScale(2, BigDecimal.ROUND_HALF_UP));
//// FileUtils.write(new File("/Users/fengjunkai/Desktop/new/CRY/20190428/鹰潭市信江广达小额贷款股份有限公司_D3_201904241037_0004_1.txt"), JSON.toJSONString(repaymentLoanInfo)+"\r\n", true);
//
// RepaymentLoanInfo repaymentLoanInfo = map.get(tmp[0]+tmp[1]+tmp[2]);
// repaymentLoanInfo.setOpCode("M");
// repaymentLoanInfo.setLoanStatus(1);
//
// FileUtils.write(new File("/Users/fengjunkai/Desktop/new/CRY/20190428/鹰潭市信江广达小额贷款股份有限公司_D3_201904241037_0004_2.txt"), JSON.toJSONString(repaymentLoanInfo)+"\r\n", true);
// }
// String key = "9168549029D1";
// RepaymentLoanInfo repaymentLoanInfo = map.get(key);
// repaymentLoanInfo.setRealRepayment(new BigDecimal("2392.39").setScale(2, BigDecimal.ROUND_HALF_UP));
// repaymentLoanInfo.setOpCode("M");
// FileUtils.write(new File("/Users/fengjunkai/Desktop/new/CRY/20190430/鹰潭市信江广达小额贷款股份有限公司_D3_201904241037_0004_M4.txt"), JSON.toJSONString(repaymentLoanInfo)+"\r\n", true);
// List<String> list1 = FileUtils.readLines(new File("/Users/fengjunkai/Desktop/new/20190509/tmp"), "utf-8");
// Map<String,String> map = new HashMap<>();
// for(int i=0;i<list1.size();i++){
// String tmp = list1.get(i);
// map.put(tmp, "1");
// }
//
// List<String> list = FileUtils.readLines(new File("/Users/fengjunkai/Desktop/new/20190509/鹰潭市信江广达小额贷款股份有限公司_D3_2019050805310101_0008.txt"), "utf-8");
//// for(int i=0;i<list.size();i++){
//// RepaymentLoanInfo repaymentLoanInfo = new Gson().fromJson(list.get(i), new TypeToken<RepaymentLoanInfo>(){}.getType());
//// repaymentLoanInfo.setReqID(UUID.randomUUID().toString().replaceAll("-", ""));
//// FileUtils.write(new File("/Users/fengjunkai/Desktop/new/20190509/鹰潭市信江广达小额贷款股份有限公司_D3_2019050805310101_0004.txt"), JSON.toJSONString(repaymentLoanInfo)+"\r\n", true);
//// }
// for(int i=0;i<list.size();i++){
// RepaymentLoanInfo repaymentLoanInfo = new Gson().fromJson(list.get(i), new TypeToken<RepaymentLoanInfo>(){}.getType());
//// String key = repaymentLoanInfo.getLoanId()+repaymentLoanInfo.getLoanStatus()+repaymentLoanInfo.getOverdueStatus()+repaymentLoanInfo.getTermNo()+"0"+repaymentLoanInfo.getStatusConfirmAt();
//// if(map.containsKey(key) && StringUtils.isBlank(repaymentLoanInfo.getRealRepaymentDate())){
//// System.out.println("包含key=="+key);
//// continue;
//// }
//
// if(repaymentLoanInfo.getLoanStatus()==3 && "overdue".equalsIgnoreCase(repaymentLoanInfo.getTermStatus())){
// System.out.println("shanchu"+repaymentLoanInfo.getLoanStatus()+"###"+repaymentLoanInfo.getTermStatus());
// continue;
// }
//
// FileUtils.write(new File("/Users/fengjunkai/Desktop/new/20190509/鹰潭市信江广达小额贷款股份有限公司_D3_2019050805310101_0009.txt"), JSON.toJSONString(repaymentLoanInfo)+"\r\n", true);
// }
// System.out.println("完事");
// List<String> list = FileUtils.readLines(new File("/Users/fengjunkai/Desktop/new/20190509/鹰潭市信江广达小额贷款股份有限公司_D3_2019050805310101_0009.txt"), "utf-8");
// List<String> tmp = FileUtils.readLines(new File("/Users/fengjunkai/Desktop/new/20190509/tmp.txt"), "utf-8");
//// Map<String,RepaymentLoanInfo> repaymentLoanInfoMap = new HashMap<>();
//
//
// Map<String,String> map = new HashMap<>();
// for(int i=0;i<tmp.size();i++){
// String tmpargs[] = tmp.get(i).split("###");
// map.put(tmpargs[0]+tmpargs[1]+tmpargs[2], tmpargs[3]);
// }
//
// for(int i=1;i<list.size();i++){
// RepaymentLoanInfo repaymentLoanInfo = new Gson().fromJson(list.get(i), new TypeToken<RepaymentLoanInfo>(){}.getType());
// String key = repaymentLoanInfo.getLoanId()+repaymentLoanInfo.getPlannedPayment()+repaymentLoanInfo.getTermNo();
// if(map.containsKey(key)){
// repaymentLoanInfo.setPlannedPayment(new BigDecimal(map.get(key)).setScale(2, BigDecimal.ROUND_HALF_UP));
// repaymentLoanInfo.setOpCode("M");
// FileUtils.write(new File("/Users/fengjunkai/Desktop/new/20190509/鹰潭市信江广达小额贷款股份有限公司_D3_2019050805310101_0009_M.txt"), JSON.toJSONString(repaymentLoanInfo)+"\r\n", true);
// }
// }
// List<String> list = FileUtils.readLines(new File("/Users/fengjunkai/Desktop/new/20190509/鹰潭市信江广达小额贷款股份有限公司_D3_2019050805310101_0009.txt"), "utf-8");
// List<String> tmp = FileUtils.readLines(new File("/Users/fengjunkai/Desktop/new/20190509/tmp.txt"), "utf-8");
//// Map<String,RepaymentLoanInfo> repaymentLoanInfoMap = new HashMap<>();
//
//
// Map<String,String> map = new HashMap<>();
// for(int i=0;i<tmp.size();i++){
// String tmpargs[] = tmp.get(i).split("###");
// map.put(tmpargs[0]+tmpargs[1]+tmpargs[2], tmpargs[3]);
// }
//
// for(int i=1;i<list.size();i++){
// RepaymentLoanInfo repaymentLoanInfo = new Gson().fromJson(list.get(i), new TypeToken<RepaymentLoanInfo>(){}.getType());
// String key = repaymentLoanInfo.getLoanId()+repaymentLoanInfo.getPlannedPayment()+repaymentLoanInfo.getTermNo();
// if(map.containsKey(key)){
// repaymentLoanInfo.setPlannedPayment(new BigDecimal(map.get(key)).setScale(2, BigDecimal.ROUND_HALF_UP));
//// repaymentLoanInfo.setOpCode("M");
// System.out.println(JSON.toJSONString(repaymentLoanInfo));
// FileUtils.write(new File("/Users/fengjunkai/Desktop/new/20190509/鹰潭市信江广达小额贷款股份有限公司_D3_2019052418260303_0001.txt"), JSON.toJSONString(repaymentLoanInfo)+"\r\n", true);
// }else{
// FileUtils.write(new File("/Users/fengjunkai/Desktop/new/20190509/鹰潭市信江广达小额贷款股份有限公司_D3_2019052418260303_0001.txt"), JSON.toJSONString(repaymentLoanInfo)+"\r\n", true);
// }
// }
// System.out.println("wanshi");
// List<String> list = FileUtils.readLines(new File("/Users/fengjunkai/Desktop/new/20190509/鹰潭市信江广达小额贷款股份有限公司_D3_2019052418260303_0001.txt"), "utf-8");
// for(int i=0;i<list.size();i++){
// RepaymentLoanInfo repaymentLoanInfo = new Gson().fromJson(list.get(i), new TypeToken<RepaymentLoanInfo>(){}.getType());
//// repaymentLoanInfo.setName(interfaceUploadClient(repaymentLoanInfo.getName()));
//// repaymentLoanInfo.setMobile(interfaceUploadClient(repaymentLoanInfo.getMobile()));
//// repaymentLoanInfo.setPid(interfaceUploadClient(repaymentLoanInfo.getPid()));
// FileUtils.write(new File("/Users/fengjunkai/Desktop/new/20190509/鹰潭市信江广达小额贷款股份有限公司_D3_2019052418260303_0003_M.txt"), JSON.toJSONString(repaymentLoanInfo)+"\r\n", true);
// }
// System.out.println("wanshi");
//
// List<String> list = FileUtils.readLines(new File("/Users/fengjunkai/Desktop/new/20190509/鹰潭市信江广达小额贷款股份有限公司_C1_2019050805310101_0001.txt"), "utf-8");
// for(int i=1;i<list.size();i++){
// ApplyLoanInfo applyLoanInfo = new Gson().fromJson(list.get(i), new TypeToken<ApplyLoanInfo>(){}.getType());
//// applyLoanInfo.setName(interfaceUploadClient(applyLoanInfo.getName()));
//// applyLoanInfo.setMobile(interfaceUploadClient(applyLoanInfo.getMobile()));
//// applyLoanInfo.setPid(interfaceUploadClient(applyLoanInfo.getPid()));
// FileUtils.write(new File("/Users/fengjunkai/Desktop/new/20190509/鹰潭市信江广达小额贷款股份有限公司_C1_2019052418260303_0001_M.txt"), JSON.toJSONString(applyLoanInfo)+"\r\n", true);
// }
// System.out.println("wanshi");
// List<String> list = FileUtils.readLines(new File("/Users/fengjunkai/Desktop/new/20190529/xinjiangguangda_D3_2019052910580303_0001.txt"), "utf-8");
// for(int i=0;i<list.size();i++){
// RepaymentLoanInfo repaymentLoanInfo = new Gson().fromJson(list.get(i), new TypeToken<RepaymentLoanInfo>(){}.getType());
// repaymentLoanInfo.setReqID(UUID.randomUUID().toString().replaceAll("-", ""));
// FileUtils.write(new File("/Users/fengjunkai/Desktop/new/20190529/xinjiangguangda_D3_2019052910580303_0002.txt"), JSON.toJSONString(repaymentLoanInfo)+"\r\n", true);
// }
// System.out.println(LocalDateTime.now().plusDays(-1).format(DateTimeFormatter.ISO_DATE));
// System.out.println(LocalDateTime.now().format(DateTimeFormatter.ISO_DATE));
// System.out.println(LocalDateTime.now().plusDays(-1).format(DateTimeFormatter.ISO_DATE));
// List<String> list = FileUtils.readLines(new File("/Users/fengjunkai/Downloads/baihang/百行2019-08-09至2019-08-10调用命中数据.txt"), "utf-8");
// for(int i=0;i<list.size();i++){
// String uuid = list.get(i);
// FileUtils.write(new File("/Users/fengjunkai/Downloads/baihang/data.txt"), uuid+"\t"+uuid+"\r\n", "utf-8", true);
// }
} catch (Exception e) {
e.printStackTrace();
}
}
//文件方式上报的客户端代码
public static void fileUploadClient() throws Exception {
//RSA公钥文件路径(百行提供公钥文件)
// String RSA_PUBLIC_KEY = "d:\\rsa_public_key.pem";
//AES密钥(机构自行设置)
String AES_KEY = "fc4c1cbca5a46840f60";
FileUploadRequest req = new FileUploadRequest();
//设置未作压缩加密前的原始数据文件路径
// req.setDataFile("/Users/fengjunkai/Desktop/new/鹰潭市信江广达小额贷款股份有限公司_C1_201904241037_0002.txt");
// req.setDataFile("/Users/fengjunkai/Desktop/new/鹰潭市信江广达小额贷款股份有限公司_D2_201904241037_0003.txt");
// req.setDataFile("/Users/fengjunkai/Desktop/new/鹰潭市信江广达小额贷款股份有限公司_D3_201904241037_0004.txt");
// req.setDataFile("/Users/fengjunkai/Desktop/new/CRY/鹰潭市信江广达小额贷款股份有限公司_D2_201904241037_0003_M.txt");
// req.setDataFile("/Users/fengjunkai/Desktop/new/201905060525/鹰潭市信江广达小额贷款股份有限公司_D3_201904241037_0004_M6.txt");
// req.setDataFile("/Users/fengjunkai/Desktop/new/20190509/鹰潭市信江广达小额贷款股份有限公司_C1_2019050805310101_0001.txt");
// req.setDataFile("/Users/fengjunkai/Desktop/new/20190509/鹰潭市信江广达小额贷款股份有限公司_D2_2019050805310101_0001.txt");
// req.setDataFile("/Users/fengjunkai/Desktop/new/20190509/鹰潭市信江广达小额贷款股份有限公司_D3_2019050805310101_0009.txt");
// req.setDataFile("/Users/fengjunkai/Desktop/new/20190509/鹰潭市信江广达小额贷款股份有限公司_D3_2019050805310101_0009_M.txt");
// req.setDataFile("/Users/fengjunkai/Desktop/new/20190509/鹰潭市信江广达小额贷款股份有限公司_C1_2019052418260303_0001_M.txt");
// req.setDataFile("/Users/fengjunkai/Desktop/new/20190509/鹰潭市信江广达小额贷款股份有限公司_D2_2019052418260303_0001_M.txt");
// req.setDataFile("/Users/fengjunkai/Desktop/new/20190509/鹰潭市信江广达小额贷款股份有限公司_D3_2019052418260303_0003_M.txt");
// req.setDataFile("/Users/fengjunkai/Desktop/new/20190529/xinjiangguangda_C1_2019052910580303_0001.txt");
// req.setDataFile("/Users/fengjunkai/Desktop/new/20190529/xinjiangguangda_D2_2019052910580303_0001.txt");
req.setDataFile("/Users/fengjunkai/Desktop/new/20190529/xinjiangguangda_D3_2019052910580303_0002.txt");
//设置压缩加密后的密文文件输出路径(为空表示与原始数据文件同目录)
req.setTargetFilePath("/Users/fengjunkai/Desktop/new/20190529");
BhFileCreditApiClient client = new BhFileCreditApiClient();
//初始化设置AES密钥和RSA公钥
client.init(BHRSAUtils.readRSAPublicKey("/baihang/rsa_public_key.pem"), AES_KEY);
//执行压缩加密操作
FileUploadResponse response = client.execute(req);
if (response.isSuccess) {
System.out.println("zip And encrypt success;fileName = " + response.getEncryptFilePath() + response.getEncryptFileName());
} else {
System.out.println("zip And encrypt fail;errorMessage = " + response.getErrorMessage());
}
}
//文件方式上报的客户端本地测试代码
public static void fileUploadValidationClient() throws Exception {
//RSA私钥文件路径(百行提供测试环境私钥文件)
// String RSA_PRIVATE_KEY = "d:\\rsa_private_key.pem";
FileUploadValidationRequest req = new FileUploadValidationRequest();
//设置压缩加密后的数据文件路径
req.setDataFile("/Users/fengjunkai/Desktop/鹰潭市信江广达小额贷款股份有限公司_C1_20190420172012_0001.cry");
// req.setDataFile("/Users/fengjunkai/Desktop/鹰潭市信江广达小额贷款股份有限公司_D2_20190420172012_0002.cry");
// req.setDataFile("/Users/fengjunkai/Desktop/鹰潭市信江广达小额贷款股份有限公司_D3_20190420172012_0003.cry");
//设置解密解压的原始文件输出路径(为空表示与加密数据文件同目录)
req.setTargetFilePath("/Users/fengjunkai/Documents/send1");
BhFileCreditApiClient client = new BhFileCreditApiClient();
//初始化设置RSA私钥
client.init(BHRSAUtils.readRSAPrivateKey("/baihang/rsa_private_key.pem"));
//执行解密解压操作
FileUploadValidationResponse response = client.execute(req);
if (response.isSuccess) {
System.out.println("decrypt And unzip success;fileName = " + response.getDecryptFilePath() + response.getDecryptFileName());
} else {
System.out.println("decrypt And unzip fail;errorMessage = " + response.getErrorMessage());
}
}
public static void convertRepaymentLoanInfo() {
try {
String readAddr = "/Users/fengjunkai/Documents/鹰潭市信江广达小额贷款股份有限公司_D3_201904011543_0003.json";
String sourceStr = FileUtils.readFileToString(new File(readAddr), "utf-8");
String writeAddr = "/Users/fengjunkai/Documents/baihang_test_data_file/鹰潭市信江广达小额贷款股份有限公司_D3_20190401_0003.txt";
JSONObject sourceJson = JSON.parseObject(sourceStr);
JSONArray recordsJsonArr = sourceJson.getJSONArray("RECORDS");
FileUtils.write(new File(writeAddr), "#singleLoanRepayInfo" + "\r\n", "utf-8", true);
for (int i = 0; i < recordsJsonArr.size(); i++) {
JSONObject recordJson = recordsJsonArr.getJSONObject(i);
FileUtils.write(new File(writeAddr), JSON.toJSONString(recordJson) + "\r\n", "utf-8", true);
}
System.out.println("完事");
} catch (IOException e) {
e.printStackTrace();
}
}
public static void convertLoanInfo() {
try {
String readAddr = "/Users/fengjunkai/Documents/鹰潭市信江广达小额贷款股份有限公司_D2_201904011543_0002.json";
String sourceStr = FileUtils.readFileToString(new File(readAddr), "utf-8");
String writeAddr = "/Users/fengjunkai/Documents/baihang_test_data_file/鹰潭市信江广达小额贷款股份有限公司_D2_20190401_0002.txt";
JSONObject sourceJson = JSON.parseObject(sourceStr);
JSONArray recordsJsonArr = sourceJson.getJSONArray("RECORDS");
FileUtils.write(new File(writeAddr), "#singleLoanAccountInfo" + "\r\n", "utf-8", true);
for (int i = 0; i < recordsJsonArr.size(); i++) {
JSONObject recordJson = recordsJsonArr.getJSONObject(i);
FileUtils.write(new File(writeAddr), JSON.toJSONString(recordJson) + "\r\n", "utf-8", true);
}
System.out.println("完事");
} catch (Exception e) {
e.printStackTrace();
}
}
public static void convertApplyLoanInfo() {
try {
String readAddr = "/Users/fengjunkai/Documents/鹰潭市信江广达小额贷款股份有限公司_C1_201904011543_0001.json";
String writeAddr = "/Users/fengjunkai/Documents/baihang_test_data_file/鹰潭市信江广达小额贷款股份有限公司_C1_20190401_0001.txt";
String sourceStr = FileUtils.readFileToString(new File(readAddr), "utf-8");
JSONObject sourceJson = JSON.parseObject(sourceStr);
JSONArray recordsJsonArr = sourceJson.getJSONArray("RECORDS");
FileUtils.write(new File(writeAddr), "#loanApplyInfo" + "\r\n", "utf-8", true);
for (int i = 0; i < recordsJsonArr.size(); i++) {
JSONObject recordJson = recordsJsonArr.getJSONObject(i);
FileUtils.write(new File(writeAddr), JSON.toJSONString(recordJson) + "\r\n", "utf-8", true);
}
System.out.println("完事");
} catch (Exception e) {
e.printStackTrace();
}
}
@Async
public void baihangData(String readName, String writeName){
try{
// List<String> list = FileUtils.readLines(new File("/Users/fengjunkai/Downloads/baihang/"+readName+".txt"), "utf-8");
List<String> list = FileUtils.readLines(new File("/home/quant_group/risk-datasource/data/baihang/"+readName+".txt"), "utf-8");
for(int i=0;i<list.size();i++){
String uuid = list.get(i);
SdkUser userFullInfoByUuid = iUserCenterService.getUserFullInfoByUuid(uuid);
String responseInHBase = thirdpartyApiMonitorService.loadInHBaseAndCheckTimeOut(RequestUrlType.BaiHangPersionalCreditReport, uuid, 1000);
String reportId = "";
String reportTime = "";
String pid = "";
String name = Objects.nonNull(userFullInfoByUuid)?userFullInfoByUuid.getName():"";
if(StringUtils.isNotBlank(responseInHBase)){
JSONObject jsonObject = JSONObject.parseObject(responseInHBase);
reportId = jsonObject.getJSONObject("reportHeader").getString("reportId");
reportTime = jsonObject.getJSONObject("reportHeader").getString("reportTime");
pid = jsonObject.getJSONObject("personalProfile").getString("pid");
// name = jsonObject.getJSONObject("personalProfile").getString("name");
}
// FileUtils.write(new File("/Users/fengjunkai/Downloads/baihang/"+writeName+".txt"), uuid+"\t"+reportId+"\t"+reportTime+"\t"+name+"\t"+pid+"\r\n", "utf-8", true);
FileUtils.write(new File("/home/quant_group/risk-datasource/data/baihang/"+writeName+".txt"), uuid+"\t"+reportId+"\t"+reportTime+"\t"+name+"\t"+pid+"\r\n", "utf-8", true);
}
}catch(Exception e){
e.printStackTrace();
}
}
// Map<String,Object> repaymentLoanInfoMap = new HashMap<>();
// repaymentLoanInfoMap.put("reqID", repaymentLoanInfo.getReqID());
// repaymentLoanInfoMap.put("uploadTs", repaymentLoanInfo.getUploadTs());
// repaymentLoanInfoMap.put("loanId", repaymentLoanInfo.getLoanId());
// repaymentLoanInfoMap.put("opCode", repaymentLoanInfo.getOpCode());
// repaymentLoanInfoMap.put("name", interfaceUploadClient(repaymentLoanInfo.getName()));
// repaymentLoanInfoMap.put("mobile", interfaceUploadClient(repaymentLoanInfo.getMobile()));
// repaymentLoanInfoMap.put("pid", interfaceUploadClient(repaymentLoanInfo.getPid()));
// repaymentLoanInfoMap.put("termNo", repaymentLoanInfo.getTermNo());
// repaymentLoanInfoMap.put("targetRepaymentDate", repaymentLoanInfo.getTargetRepaymentDate());
// repaymentLoanInfoMap.put("termStatus", repaymentLoanInfo.getTermStatus());
// repaymentLoanInfoMap.put("realRepaymentDate", repaymentLoanInfo.getRealRepaymentDate());
// repaymentLoanInfoMap.put("plannedPayment", repaymentLoanInfo.getPlannedPayment());
// repaymentLoanInfoMap.put("targetRepayment", repaymentLoanInfo.getTargetRepayment());
// repaymentLoanInfoMap.put("overdueStatus", repaymentLoanInfo.getOverdueStatus());
// repaymentLoanInfoMap.put("statusConfirmAt", repaymentLoanInfo.getStatusConfirmAt());
// repaymentLoanInfoMap.put("overdueAmount", repaymentLoanInfo.getOverdueAmount());
// repaymentLoanInfoMap.put("realRepayment", repaymentLoanInfo.getRealRepayment());
// repaymentLoanInfoMap.put("remainingAmount", repaymentLoanInfo.getRemainingAmount());
// repaymentLoanInfoMap.put("loanStatus", repaymentLoanInfo.getLoanStatus());
}
package cn.quantgroup.report.service.baihang;
import cn.quantgroup.report.service.CommonSuperService;
import cn.quantgroup.report.config.aop.DistributedLock;
import cn.quantgroup.report.config.aop.Monitor;
import cn.quantgroup.report.config.aop.MonitorType;
import cn.quantgroup.report.constant.TransactionCodeEnum;
import cn.quantgroup.report.enums.RequestUrlType;
import cn.quantgroup.report.response.GlobalResponse;
import cn.quantgroup.report.service.AbstractBaseService;
import cn.quantgroup.report.service.baihang.client.BhInterfaceCreditApiClient;
import cn.quantgroup.report.service.baihang.request.InterfaceUploadRequest;
import cn.quantgroup.report.service.baihang.response.InterfaceUploadResponse;
import cn.quantgroup.report.service.baihang.util.BHRSAUtils;
import cn.quantgroup.report.service.baihang.util.Base64;
import cn.quantgroup.report.service.http.IHttpService;
import cn.quantgroup.report.service.thirdpartymonitor.ThirdpartyApiMonitorService;
import com.alibaba.fastjson.JSON;
import com.google.common.base.Stopwatch;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
/**
* 百行征信查询用户征信报告
*
* @Author fengjunkai
* @Date 2019-03-29 11:26
*/
@Deprecated
@Slf4j
@Service
public class BaiHangZhengXinService extends AbstractBaseService implements CommonSuperService {
@Autowired
private ThirdpartyApiMonitorService thirdpartyApiMonitorService;
@Autowired
private IHttpService iHttpService;
@Value("${baihang.zhudai.applyloan.url}")
private String baiHangApplyLoanInfoUrl;
@Value("${baihang.zhudai.loaninfo.url}")
private String baiHangLoanInfoUrl;
@Value("${baihang.zhudai.repaymentloaninfo.url}")
private String baiHangRepayMentLoanInfoUrl;
@Value("${baihang.zhudai.account.name}")
private String account;
@Value("${baihang.zhudai.password}")
private String password;
@Monitor({MonitorType.EXCEPTION, MonitorType.FEE, MonitorType.HIT, MonitorType.RESULT})
@DistributedLock
public GlobalResponse baiHangZxQuery(String transactionId, String uuid, String name, String idCard, String mobile, String orderNo, boolean isReadCache){
log.info("开始查询百行征信报告, transactionId: {} , uuid: {} , name: {} , idCard: {} , mobile: {} , orderNo: {} ",
transactionId, uuid, name, idCard, mobile, orderNo);
RequestUrlType requestUrlType = RequestUrlType.BaiHangCreditReport;
Integer cacheTime = isReadCache? cacheConfigService.getTestCacheTime(requestUrlType.name()):cacheConfigService.getCacheTime(requestUrlType.name());
if(isReadCache){
String responseInHBase = thirdpartyApiMonitorService.loadInHBaseAndCheckTimeOut(requestUrlType, uuid, cacheTime);
if(StringUtils.isNotBlank(responseInHBase)){
log.info("百行征信hbase查询到结果, transactionId: {} , urlType : {}, uuid: {} , name: {} , idNo: {} , phoneNo: {} , isReadCache: {} , cacheTime: {} ",
transactionId, requestUrlType, uuid, name, idCard, mobile, isReadCache, cacheTime);
return GlobalResponse.builder(transactionId, JSON.parseObject(responseInHBase)).addUuid(uuid).addTransactionResult(requestUrlType, TransactionCodeEnum.HitInHbase);
}else{
log.info("百行征信hbase未查询到结果, transactionId: {} , urlType : {}, uuid: {} , name: {} , idNo: {} , phoneNo: {} , isReadCache: {} , cacheTime: {} ",
transactionId, requestUrlType, uuid, name, idCard, mobile, isReadCache, cacheTime);
return GlobalResponse.builder(transactionId, null).addUuid(uuid).addTransactionResult(requestUrlType, TransactionCodeEnum.Fail);
}
}else{
if(cacheTime>0){
String responseInHBase = thirdpartyApiMonitorService.loadInHBaseAndCheckTimeOut(requestUrlType, uuid, cacheTime);
if (responseInHBase != null) {
log.info("百行征信从hbase拿到数据, transactionId : {} urlType : {} , uuid: {}", transactionId, requestUrlType, uuid);
if(StringUtils.isBlank(responseInHBase)) {
return GlobalResponse.builder(transactionId, null).addUuid(uuid).addTransactionResult(requestUrlType, TransactionCodeEnum.HitInHbase);
} else {
return GlobalResponse.builder(transactionId, JSON.parseObject(responseInHBase)).addUuid(uuid).addTransactionResult(requestUrlType, TransactionCodeEnum.HitInHbase);
}
}
}
}
String isbilling = "1";
TransactionCodeEnum transCode = null;
Stopwatch stopwatch = Stopwatch.createStarted();
String code = null;
String msg = null;
long elapsed = 0;
boolean charge = false;
try{
Map<String,String> applyLoanInfoReqMap = new HashMap<>();
applyLoanInfoReqMap.put("name", interfaceUploadClient(name));
applyLoanInfoReqMap.put("pid", interfaceUploadClient(idCard));
applyLoanInfoReqMap.put("mobile", interfaceUploadClient(mobile));
applyLoanInfoReqMap.put("queryReason", "1");
applyLoanInfoReqMap.put("guaranteeType", "1");
applyLoanInfoReqMap.put("loanPurpose", "1");
applyLoanInfoReqMap.put("customType", "99");
applyLoanInfoReqMap.put("applyAmount", "-1");
applyLoanInfoReqMap.put("loanId", orderNo);
String resultStr = iHttpService.post(baiHangApplyLoanInfoUrl, getHeader(), applyLoanInfoReqMap);
System.out.println(resultStr);
}catch(Exception e){
log.error("百行征信查询征信报告异常, transactionid: {} , uuid: {} , name: {} , idCard: {} , mobile: {} , orderNo: {} ",
transactionId, uuid, name, idCard, mobile, orderNo, e);
}finally {
thirdpartyApiMonitorService.create(uuid, requestUrlType, isbilling, msg, (int)elapsed, code);
}
log.info("查询百行征信报告结束, transactionId: {} , uuid: {} , name: {} , idCard: {} , mobile: {} , orderNo: {} ,result: {} ,耗时: {} ",
transactionId, uuid, name, idCard, mobile, orderNo, "", stopwatch.stop().elapsed(TimeUnit.MILLISECONDS));
return null;
}
public static String interfaceUploadClient(String param) throws Exception{
InterfaceUploadRequest req = new InterfaceUploadRequest();
List<String> datas = new ArrayList<String>();
datas.add(param);
//设置待加密的原始数据集合
req.setData(datas);
BhInterfaceCreditApiClient client = new BhInterfaceCreditApiClient();
//初始化设置RSA公钥
client.init(BHRSAUtils.readRSAPublicKey("/baihang/rsa_public_key.pem"));
//执行加密操作
InterfaceUploadResponse response = client.execute(req);
if(response.isSuccess){
List<String> data = response.getEncryptData();
return data.get(0);
}
throw new Exception();
}
public Map<String,String> getHeader(){
Map<String,String> headerMap = new HashMap<>();
headerMap.put("Authorization", "Basic "+ Base64.byteArrayToBase64((account+":"+password).getBytes()));
return headerMap;
}
}
...@@ -18,9 +18,9 @@ import cn.quantgroup.report.service.baihang.response.InterfaceUploadResponse; ...@@ -18,9 +18,9 @@ import cn.quantgroup.report.service.baihang.response.InterfaceUploadResponse;
import cn.quantgroup.report.service.baihang.response.InterfaceUploadValidationResponse; import cn.quantgroup.report.service.baihang.response.InterfaceUploadValidationResponse;
import cn.quantgroup.report.service.baihang.util.BHRSAUtils; import cn.quantgroup.report.service.baihang.util.BHRSAUtils;
import cn.quantgroup.report.service.baihang.util.Base64; import cn.quantgroup.report.service.baihang.util.Base64;
import cn.quantgroup.report.service.baihang.util.TuoMinUtils;
import cn.quantgroup.report.service.http.IHttpService; import cn.quantgroup.report.service.http.IHttpService;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.google.common.base.Stopwatch; import com.google.common.base.Stopwatch;
import com.google.gson.Gson; import com.google.gson.Gson;
...@@ -32,15 +32,16 @@ import org.slf4j.LoggerFactory; ...@@ -32,15 +32,16 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.security.PublicKey; import java.security.PublicKey;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
...@@ -103,16 +104,39 @@ public class BaiHangZhuDaiService { ...@@ -103,16 +104,39 @@ public class BaiHangZhuDaiService {
@Value("${baihang.zhudai.cunliang.data.url}") @Value("${baihang.zhudai.cunliang.data.url}")
public String zl_file_path_name; // = "D:\\JavaTeam\\baihang\\cunLiang\\";存量数据整理目录 public String zl_file_path_name; // = "D:\\JavaTeam\\baihang\\cunLiang\\";存量数据整理目录
private static PublicKey baihang_zhudai_publickey = null; private static PublicKey baihang_zhudai_publickey = null;
//测试环境报送,用户三要素需要脱敏
private static Map<String,String> testBaoSongUserInfoTuoMingMap = new ConcurrentHashMap<>();
@PostConstruct @PostConstruct
public void init(){ public void init(){
try{ try{
long log_stUtc1 = System.currentTimeMillis();
baihang_zhudai_publickey = BHRSAUtils.readRSAPublicKey("/baihang/rsa_public_key.pem"); baihang_zhudai_publickey = BHRSAUtils.readRSAPublicKey("/baihang/rsa_public_key.pem");
log.info("初始化百行助贷PublicKey实例完成"); log.info("初始化百行助贷PublicKey实例完成, 耗时: {} ",System.currentTimeMillis()-log_stUtc1);
}catch(Exception e){ }catch(Exception e){
log.error("初始化百行助贷PublicKey实例", e); log.error("初始化百行助贷PublicKey实例", e);
} }
try{
long log_stUtc2 = System.currentTimeMillis();
List<String> contextList = FileUtils.readLines(new File(zl_file_path_name + "TEST_BS_USER_TM_201911061315.txt"), "utf-8");
if(contextList!=null && contextList.size()>0){
Map<String,String> tmpMap = new ConcurrentHashMap<>(contextList.size());
for(String context: contextList){
String[] tmp = context.split("=");
tmpMap.put(tmp[0],tmp[1]);
}
testBaoSongUserInfoTuoMingMap = tmpMap;
}
log.info("初始化测试环境百行报送-用户三要素脱敏字典结束, 耗时: {} ",System.currentTimeMillis()-log_stUtc2);
}catch(Exception e){
log.error("初始化测试环境百行报送-用户三要素脱敏字典异常", e);
}
} }
private static PublicKey getBaihangZDPublickey(){ private static PublicKey getBaihangZDPublickey(){
...@@ -530,7 +554,7 @@ public class BaiHangZhuDaiService { ...@@ -530,7 +554,7 @@ public class BaiHangZhuDaiService {
return "日期格式有误"; return "日期格式有误";
} }
final String fileName = zl_file_path_name + "zhudai_A1_" + startDate.substring(0, startDate.indexOf("T")).replace("-", "") + "_" + noEndDate.substring(0, noEndDate.indexOf("T")).replace("-", "") + "_0001.txt"; final String fileName = zl_file_path_name + "lhp_A1_" + startDate.substring(0, startDate.indexOf("T")).replace("-", "") + "_" + noEndDate.substring(0, noEndDate.indexOf("T")).replace("-", "");
LocalDateTime erlyDate = LocalDateTime.parse(startDate); LocalDateTime erlyDate = LocalDateTime.parse(startDate);
LocalDateTime endDate = LocalDateTime.parse(noEndDate); LocalDateTime endDate = LocalDateTime.parse(noEndDate);
...@@ -577,7 +601,11 @@ public class BaiHangZhuDaiService { ...@@ -577,7 +601,11 @@ public class BaiHangZhuDaiService {
applyLoanInfo.setUploadTs(upladTs); applyLoanInfo.setUploadTs(upladTs);
applyLoanInfo.setReqID(UUID.randomUUID().toString().replaceAll("-", "")); //??? applyLoanInfo.setReqID(UUID.randomUUID().toString().replaceAll("-", "")); //???
FileUtils.write(new File(fileName), JSON.toJSONString(applyLoanInfo) + "\r\n", true); FileUtils.write(new File(fileName+"_01.txt"), JSON.toJSONString(applyLoanInfo)+"\r\n", "UTF-8", true);
//脱敏数据写一份
testTuoMinFileWrite(fileName+"_TEST_01.txt",applyLoanInfo,null,null);
} catch (Exception e) { } catch (Exception e) {
log.error("百行-助贷申请存量数据处理异常, startTime: {} , endTime: {} ",starTime, endTime, e); log.error("百行-助贷申请存量数据处理异常, startTime: {} , endTime: {} ",starTime, endTime, e);
} }
...@@ -608,7 +636,7 @@ public class BaiHangZhuDaiService { ...@@ -608,7 +636,7 @@ public class BaiHangZhuDaiService {
log.warn("stockLoanInfoZhuDai日期格式有误, startDate : {} , noEndDate : {} ",startDate,noEndDate); log.warn("stockLoanInfoZhuDai日期格式有误, startDate : {} , noEndDate : {} ",startDate,noEndDate);
return "日期格式有误"; return "日期格式有误";
} }
final String fileName = zl_file_path_name+"zhudai_D2_" + startDate.substring(0,startDate.indexOf("T")).replace("-","") + "_" + noEndDate.substring(0,noEndDate.indexOf("T")).replace("-","")+ "_0001.txt"; final String fileName = zl_file_path_name+"lhp_D2_" + startDate.substring(0,startDate.indexOf("T")).replace("-","") + "_" + noEndDate.substring(0,noEndDate.indexOf("T")).replace("-","");
LocalDateTime erlyDate = LocalDateTime.parse(startDate); LocalDateTime erlyDate = LocalDateTime.parse(startDate);
LocalDateTime endDate = LocalDateTime.parse(noEndDate); LocalDateTime endDate = LocalDateTime.parse(noEndDate);
...@@ -675,7 +703,11 @@ public class BaiHangZhuDaiService { ...@@ -675,7 +703,11 @@ public class BaiHangZhuDaiService {
} }
loanInfoZhuDaiVo.setReqID(id); loanInfoZhuDaiVo.setReqID(id);
FileUtils.write(new File(fileName), JSON.toJSONString(loanInfoZhuDaiVo) + "\r\n", true); FileUtils.write(new File(fileName+"_01.txt"), JSON.toJSONString(loanInfoZhuDaiVo)+"\r\n", "UTF-8", true);
//脱敏数据写一份
testTuoMinFileWrite(fileName+"_TEST_01.txt",null,loanInfoZhuDaiVo,null);
} catch (Exception e) { } catch (Exception e) {
log.error("百行-助贷放款存量数据处理异常, startTime: {} , endTime: {} , recordId: {} , loanId: {} ",starTime, endTime, id, loanInfoZhuDaiVo.getLoanId(), e); log.error("百行-助贷放款存量数据处理异常, startTime: {} , endTime: {} , recordId: {} , loanId: {} ",starTime, endTime, id, loanInfoZhuDaiVo.getLoanId(), e);
} }
...@@ -705,7 +737,7 @@ public class BaiHangZhuDaiService { ...@@ -705,7 +737,7 @@ public class BaiHangZhuDaiService {
log.warn("stockRepayMentInfoZhuDai日期格式有误, startDate : {} , noEndDate : {} ",startDate,noEndDate); log.warn("stockRepayMentInfoZhuDai日期格式有误, startDate : {} , noEndDate : {} ",startDate,noEndDate);
return "日期格式有误"; return "日期格式有误";
} }
final String fileName = zl_file_path_name+"zhudai_D3_" + startDate.substring(0,startDate.indexOf("T")).replace("-","") + "_" + noEndDate.substring(0,noEndDate.indexOf("T")).replace("-","")+ "_0001.txt"; final String fileName = zl_file_path_name+"lhp_D3_" + startDate.substring(0,startDate.indexOf("T")).replace("-","") + "_" + noEndDate.substring(0,noEndDate.indexOf("T")).replace("-","");
LocalDateTime erlyDate = LocalDateTime.parse(startDate); LocalDateTime erlyDate = LocalDateTime.parse(startDate);
LocalDateTime endDate = LocalDateTime.parse(noEndDate); LocalDateTime endDate = LocalDateTime.parse(noEndDate);
...@@ -767,7 +799,10 @@ public class BaiHangZhuDaiService { ...@@ -767,7 +799,10 @@ public class BaiHangZhuDaiService {
RepaymentInfoZhuDai repaymentInfo = repaymentInfoList.get(j); RepaymentInfoZhuDai repaymentInfo = repaymentInfoList.get(j);
String id = UUID.randomUUID().toString().replaceAll("-", ""); String id = UUID.randomUUID().toString().replaceAll("-", "");
repaymentInfo.setReqID(id); repaymentInfo.setReqID(id);
FileUtils.write(new File(fileName), JSON.toJSONString(repaymentInfo) + "\r\n", true); FileUtils.write(new File(fileName+"_01.txt"), JSON.toJSONString(repaymentInfo)+"\r\n", "UTF-8", true);
//脱敏数据写一份
testTuoMinFileWrite(fileName+"_TEST_01.txt",null,null,repaymentInfo);
} }
} catch (Exception e) { } catch (Exception e) {
...@@ -785,10 +820,10 @@ public class BaiHangZhuDaiService { ...@@ -785,10 +820,10 @@ public class BaiHangZhuDaiService {
} }
log.info("结束<<百行-助贷还款整理......"); log.info("结束<<百行-助贷还款整理......");
return "百行-助贷还款整理结束"; return "百行-助贷还款整理结束";
} }
//-----------------------------------------------其他工具--------------------------------------------------------------------- //-----------------------------------------------其他工具---------------------------------------------------------------------
private Map<String, String> getHeader() { private Map<String, String> getHeader() {
Map<String, String> headerMap = new HashMap<>(); Map<String, String> headerMap = new HashMap<>();
headerMap.put("Authorization", "Basic " + Base64.byteArrayToBase64((account + ":" + password).getBytes())); headerMap.put("Authorization", "Basic " + Base64.byteArrayToBase64((account + ":" + password).getBytes()));
...@@ -796,7 +831,7 @@ public class BaiHangZhuDaiService { ...@@ -796,7 +831,7 @@ public class BaiHangZhuDaiService {
return headerMap; return headerMap;
} }
public static String interfaceUploadClient(String param) throws Exception { private static String interfaceUploadClient(String param) throws Exception {
InterfaceUploadRequest req = new InterfaceUploadRequest(); InterfaceUploadRequest req = new InterfaceUploadRequest();
List<String> datas = new ArrayList<String>(); List<String> datas = new ArrayList<String>();
datas.add(param); datas.add(param);
...@@ -947,7 +982,7 @@ public class BaiHangZhuDaiService { ...@@ -947,7 +982,7 @@ public class BaiHangZhuDaiService {
} }
private static void convertRepaymentLoanInfo() { /*private static void convertRepaymentLoanInfo() {
try { try {
String readAddr = "/Users/fengjunkai/Documents/鹰潭市信江广达小额贷款股份有限公司_D3_201904011543_0003.json"; String readAddr = "/Users/fengjunkai/Documents/鹰潭市信江广达小额贷款股份有限公司_D3_201904011543_0003.json";
String sourceStr = FileUtils.readFileToString(new File(readAddr), "utf-8"); String sourceStr = FileUtils.readFileToString(new File(readAddr), "utf-8");
...@@ -964,9 +999,9 @@ public class BaiHangZhuDaiService { ...@@ -964,9 +999,9 @@ public class BaiHangZhuDaiService {
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }*/
private static void convertLoanInfo() { /*private static void convertLoanInfo() {
try { try {
String readAddr = "/Users/fengjunkai/Documents/鹰潭市信江广达小额贷款股份有限公司_D2_201904011543_0002.json"; String readAddr = "/Users/fengjunkai/Documents/鹰潭市信江广达小额贷款股份有限公司_D2_201904011543_0002.json";
String sourceStr = FileUtils.readFileToString(new File(readAddr), "utf-8"); String sourceStr = FileUtils.readFileToString(new File(readAddr), "utf-8");
...@@ -983,8 +1018,8 @@ public class BaiHangZhuDaiService { ...@@ -983,8 +1018,8 @@ public class BaiHangZhuDaiService {
e.printStackTrace(); e.printStackTrace();
} }
} }
*/
private static void convertApplyLoanInfo() { /*private static void convertApplyLoanInfo() {
try { try {
String readAddr = "/Users/fengjunkai/Documents/鹰潭市信江广达小额贷款股份有限公司_C1_201904011543_0001.json"; String readAddr = "/Users/fengjunkai/Documents/鹰潭市信江广达小额贷款股份有限公司_C1_201904011543_0001.json";
String writeAddr = "/Users/fengjunkai/Documents/baihang_test_data_file/鹰潭市信江广达小额贷款股份有限公司_C1_20190401_0001.txt"; String writeAddr = "/Users/fengjunkai/Documents/baihang_test_data_file/鹰潭市信江广达小额贷款股份有限公司_C1_20190401_0001.txt";
...@@ -1002,10 +1037,11 @@ public class BaiHangZhuDaiService { ...@@ -1002,10 +1037,11 @@ public class BaiHangZhuDaiService {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }*/
//test2.接口测试 手动调用 //test2.接口测试 手动调用
@Deprecated
public String apiSend(String type,String startDate, String endDate) { public String apiSend(String type,String startDate, String endDate) {
//"2019-05-07T00:00:00" //"2019-05-07T00:00:00"
if(StringUtils.isAnyBlank(type,startDate,endDate)){ if(StringUtils.isAnyBlank(type,startDate,endDate)){
...@@ -1184,6 +1220,105 @@ public class BaiHangZhuDaiService { ...@@ -1184,6 +1220,105 @@ public class BaiHangZhuDaiService {
return type+"手动报送结束"; return type+"手动报送结束";
} }
//test3
@Async
public void zhuDaiStockSyn(String type, String startDate, String noEndDate) {
//"2019-05-07T00:00:00"
if (StringUtils.isAnyBlank(type,startDate, noEndDate)) {
log.warn("Async zhuDaiStockSyn 参数不能为空, startDate : {} , noEndDate : {} ", startDate, noEndDate);
return;
}
if (startDate.length() != 19 || noEndDate.length() != 19 || !startDate.contains("T") || !noEndDate.contains("T")) {
log.warn("Async zhuDaiStockSyn 日期格式有误, startDate : {} , noEndDate : {} ", startDate, noEndDate);
return;
}
if("A1".equalsIgnoreCase(type)) {
//贷款申请信息(A1)
log.warn("Async zhuDaiStockSyn Start {}, {}, {}, ", type, startDate, noEndDate);
stockApplyLoanInfoZhuDai(startDate,noEndDate);
}else if("D2".equalsIgnoreCase(type)) {
//非循环贷款账户数据信息(D2)
stockLoanInfoZhuDai(startDate,noEndDate);
} else if("D3".equalsIgnoreCase(type)) {
//非循环贷款贷后数据信息(D3)
stockRepayMentInfoZhuDai(startDate, noEndDate);
}else{
log.warn("Async zhuDaiStockSyn 参数 type: {} 未知.", type);
}
}
//用户三要素脱敏后数据写一份
private void testTuoMinFileWrite(String fileName, ApplyLoanInfoZhuDai bean_a1, LoanInfoZhuDaiVo bean_d2, RepaymentInfoZhuDai bean_d3) {
String pid = null, mapVal = null, jsonContext = "";
try {
if (bean_a1 != null) {
pid = bean_a1.getPid();
mapVal = testBaoSongUserInfoTuoMingMap.get(pid);
if (StringUtils.isNotEmpty(mapVal)) {
String[] arry = mapVal.split(",");//pid,mobile,name
bean_a1.setPid(arry[0]);
bean_a1.setMobile(arry[1]);
bean_a1.setName(arry[2]);
} else {
//addUserMap(pid,mobile,name);
log.warn(" TEST FILE A1 发现其他不在字典中用户, pid: {} ", pid);
}
jsonContext = JSON.toJSONString(bean_a1);
} else if (bean_d2 != null) {
pid = bean_d2.getPid();
mapVal = testBaoSongUserInfoTuoMingMap.get(pid);
if (StringUtils.isNotEmpty(mapVal)) {
String[] arry = mapVal.split(",");//pid,mobile,name
bean_d2.setPid(arry[0]);
bean_d2.setMobile(arry[1]);
bean_d2.setName(arry[2]);
} else {
//addUserMap(pid,mobile,name);
log.warn(" TEST FILE D2 发现其他不在字典中用户, pid: {} ", pid);
}
jsonContext = JSON.toJSONString(bean_d2);
} else if (bean_d3 != null) {
pid = bean_d3.getPid();
mapVal = testBaoSongUserInfoTuoMingMap.get(pid);
if (StringUtils.isNotEmpty(mapVal)) {
String[] arry = mapVal.split(",");//pid,mobile,name
bean_d3.setPid(arry[0]);
bean_d3.setMobile(arry[1]);
bean_d3.setName(arry[2]);
} else {
//addUserMap(pid,mobile,name);
log.warn(" TEST FILE D3 发现其他不在字典中用户, pid: {} ", pid);
}
jsonContext = JSON.toJSONString(bean_d3);
} else {
log.error(" TEST FILE testTuoMinFileWrite()实体对象都为空.");
return;
}
FileUtils.write(new File(fileName), jsonContext+"\r\n", "UTF-8", true);
} catch (Exception e) {
log.error(" TEST FILE testTuoMinFileWrite()写入文件异常, pid: {} ", pid, e);
}
}
private String addUserMap(String pid, String mobile, String name) {
log.warn(" find other user: {} , {} , {} ", pid, mobile, name);
synchronized (testBaoSongUserInfoTuoMingMap) {
if (testBaoSongUserInfoTuoMingMap.containsKey(pid)) {
return testBaoSongUserInfoTuoMingMap.get(pid); //pid,mobile,name
} else {
String mapValue = TuoMinUtils.random_idcard(pid) + "," + TuoMinUtils.random_mobile(mobile) + "," + TuoMinUtils.random_name(name);
testBaoSongUserInfoTuoMingMap.put(pid, mapValue);
return mapValue;
}
}
}
} }
package cn.quantgroup.report.service.baihang;
import cn.quantgroup.report.domain.baihang.*;
import com.alibaba.fastjson.JSON;
import com.google.common.base.Stopwatch;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
/**
* @Author fengjunkai
* @Date 2019-07-10 16:14
*/
@Slf4j
@Service
public class ReSendBaiHangService extends BaiHangService {
/**
* 重新报送实时放款数据
*/
public void sendLoaInfoReportToBaiHang(String startTime, String endTime) {
AtomicInteger atomicInteger = new AtomicInteger();
List<LoanInfoZhuDai> loanInfos = new ArrayList<>();
Stopwatch sendWatch = Stopwatch.createStarted();
try{
Stopwatch queryWatch = Stopwatch.createStarted();
loanInfos = loanInfoMapper.findLoanInfoByTime(BaiHangTimeRecord.builder().startTime(startTime).endTime(endTime).build());
log.info("广达小贷TO百行放款申请报送开始, 大小: {} , 耗时: {} ", loanInfos.size(), queryWatch.stop().elapsed(TimeUnit.MILLISECONDS));
for (int i = 0; i < loanInfos.size(); i++) {
LoanInfoZhuDai loanInfo = loanInfos.get(i);
String id = "";
try {
String loanInfoReqId = loanInfo.getReqID();
if (loanInfo.getTotalTerm() > 1) {
List<String> targetRepaymentDayList = loanInfoMapper.findTargetRepaymentDayList(loanInfoReqId);
loanInfo.setTargetRepayDateList(String.join(",", targetRepaymentDayList));
}
UUID loanInfoId = UUID.randomUUID();
id = loanInfoId.toString().replaceAll("-", "");
loanInfo.setRecordId(id);
loanInfoDbMapper.saveLoanInfoRecordLog(loanInfo);
loanInfo.setRecordId(null);
loanInfo.setReqID(id);
loanInfo.setName(interfaceUploadClient(loanInfo.getName()));
loanInfo.setPid(interfaceUploadClient(loanInfo.getPid()));
loanInfo.setMobile(interfaceUploadClient(loanInfo.getMobile()));
String resultStr = iHttpService.postBaiHang(baiHangLoanInfoUrl, getHeader(), JSON.toJSONString(loanInfo));
if (Objects.isNull(resultStr) || !"success".equalsIgnoreCase(JSON.parseObject(resultStr).getString("status"))) {
log.warn("(重发)广达小贷TO百行征信报送放款返回结果不正确, recordId: {} , loanId: {} , bean: {} ", id, loanInfo.getLoanId(), JSON.toJSONString(loanInfo));
loanInfoDbMapper.updateCurrentRecordEnableFalce(BaiHangUpDateRecord.builder().enable("0").recordId(id).build());
} else {
atomicInteger.getAndIncrement();
}
} catch (Exception e) {
log.error("广达小贷TO百行征信报送放款信息异常, recordId: {} , loanId: {} ", id, loanInfo.getLoanId(), e);
}
}
}catch(Exception e){
log.error("广达小贷放款报送异常", e);
}
log.info("广达小贷TO百行征信报送放款申请完成, 实际大小: {} , 报送成功大小: {} , 耗时: {} ", loanInfos.size(), atomicInteger.get(), sendWatch.stop().elapsed(TimeUnit.MILLISECONDS));
}
/**
* 手动报送实时还款数据
*/
public void sendRepaymentReportToBaiHang(String startTime, String endTime) {
for (int j = 0; j < 2; j++) {
Stopwatch sendWatch = Stopwatch.createStarted();
try {
List<RepaymentInfoZhuDai> repaymentLoanInfos = null;
if (j == 0) {
Stopwatch realTimeStopWatch = Stopwatch.createStarted();
repaymentLoanInfos = repaymentLoanInfoMapper.findRepayMentLoanInfo(BaiHangTimeRecord.builder().startTime(startTime).endTime(endTime).build());
log.info("广达小贷TO百行征信报送实时还款, startTime: {} , endTime: {} , 大小: {} , 耗时: {} ", startTime, endTime, repaymentLoanInfos.size(), realTimeStopWatch.stop().elapsed(TimeUnit.MILLISECONDS));
} else {
Stopwatch realTimeOverdueStopWatch = Stopwatch.createStarted();
repaymentLoanInfos = repaymentLoanInfoMapper.findRepayMentLoanInfoOverdue(BaiHangTimeRecord.builder().startTime(startTime).endTime(endTime).build());
log.info("广达小贷TO百行征信报送实时还款逾期, startTime: {} , endTime: {} , 大小: {} , 耗时: {} ", startTime, endTime, repaymentLoanInfos.size(), realTimeOverdueStopWatch.stop().elapsed(TimeUnit.MILLISECONDS));
}
AtomicInteger atomicInteger = new AtomicInteger();
for (int i = 0; i < repaymentLoanInfos.size(); i++) {
RepaymentInfoZhuDai repaymentLoanInfo = repaymentLoanInfos.get(i);
String id = "";
try {
RepaymentInfoZhuDai repaymentLoanInfo1 = repaymentLoanInfoDbMapper.findLastOne(BaiHangRepayment.builder().loanId(repaymentLoanInfo.getLoanId()).termNo(repaymentLoanInfo.getTermNo()).build());
if (j > 0 && Objects.nonNull(repaymentLoanInfo1)) {
log.info("广达小贷TO百行征信报送实时还款逾期跳过报送, startTime: {} , endTime: {} , bean: {} ", startTime, endTime, JSON.toJSONString(repaymentLoanInfo1));
continue;
}
id = UUID.randomUUID().toString().replaceAll("-", "");
repaymentLoanInfo.setRecordId(id);
try {
repaymentLoanInfoDbMapper.saveRepaymentLoanInfoLog(repaymentLoanInfo);
} catch (Exception e) {
}
repaymentLoanInfo.setPid(interfaceUploadClient(repaymentLoanInfo.getPid()));
repaymentLoanInfo.setName(interfaceUploadClient(repaymentLoanInfo.getName()));
repaymentLoanInfo.setMobile(interfaceUploadClient(repaymentLoanInfo.getMobile()));
repaymentLoanInfo.setReqID(id);
repaymentLoanInfo.setRecordId(null);
String resultStr = iHttpService.postBaiHang(baiHangRepayMentLoanInfoUrl, getHeader(), JSON.toJSONString(repaymentLoanInfo));
if (Objects.isNull(resultStr) || !"success".equalsIgnoreCase(JSON.parseObject(resultStr).getString("status"))) {
log.warn("广达小贷TO百行征信报送还款返回结果不正确, 开始时间: {} , 结束时间: {} , recordId: {} , loanId: {} , bean: {} ", startTime, endTime, id, repaymentLoanInfo.getLoanId(), JSON.toJSONString(repaymentLoanInfo));
repaymentLoanInfoDbMapper.updateCurrentRecordEnableFalse(BaiHangUpDateRecord.builder().enable("0").recordId(id).build());
} else {
atomicInteger.getAndIncrement();
}
} catch (Exception e) {
log.error("广达小贷TO百行征信报送还款信息异常, recordId: {} , loanId: {} ", id, repaymentLoanInfo.getLoanId(), e);
}
}
log.info("广达小贷TO百行征信报送还款申请完成 J: {} , 开始时间: {} , 结束时间: {} , 实际大小: {} , 报送成功大小: {} , 耗时: {} ", j, startTime, endTime, repaymentLoanInfos.size(), atomicInteger.get(), sendWatch.stop().elapsed(TimeUnit.MILLISECONDS));
} catch (Exception e) {
log.error("广达小贷TO百行征信还款报送异常 J: {} , 开始时间: {} , 结束时间: {} ", j, startTime, endTime, e);
}
}
}
}
package cn.quantgroup.report.service.baihang.util; package cn.quantgroup.report.service.baihang.util;
import cn.quantgroup.report.service.baihang.response.FileUploadResponse; import cn.quantgroup.report.service.baihang.response.FileUploadResponse;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.io.FileUtils;
import org.apache.tools.ant.Project; import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.Expand; import org.apache.tools.ant.taskdefs.Expand;
import org.apache.tools.ant.taskdefs.Zip; import org.apache.tools.ant.taskdefs.Zip;
import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.FileSet;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.util.Random; import java.util.Random;
...@@ -73,7 +78,44 @@ public class TuoMinUtils { ...@@ -73,7 +78,44 @@ public class TuoMinUtils {
// System.out.println(random_idcard("622726198911100236")); // System.out.println(random_idcard("622726198911100236"));
System.out.println(random_mobile("18010105506")); // System.out.println(random_mobile("18010105506"));
String readAddr = "E:\\桌面_工作\\数据备份\\201911061315贷款申请关联用户.json";
String writeAddr = "E:\\桌面_工作\\数据备份\\201911061315用户脱敏.txt";
try {
long log_stUtc = System.currentTimeMillis();
String sourceStr = FileUtils.readFileToString(new File(readAddr), "utf-8");
JSONObject sourceJson = JSON.parseObject(sourceStr);
JSONArray recordsJsonArr = sourceJson.getJSONArray("RECORDS");
System.out.println("总条数:"+recordsJsonArr.size());
for (int i = 0; i < recordsJsonArr.size(); i++) {
System.out.println("第:"+i);
JSONObject jsonObj = recordsJsonArr.getJSONObject(i);
try {
String name = jsonObj.getString("name");
String pid = jsonObj.getString("pid");
String mobile = jsonObj.getString("mobile");
StringBuffer out = new StringBuffer();
out.append(pid);
out.append("=");
out.append(random_idcard(pid));
out.append(",");
out.append(random_mobile(mobile));
out.append(",");
out.append(random_name(name));
out.append("\n");
FileUtils.write(new File(writeAddr), out , "utf-8", true);
}catch (Exception e){
System.err.println("Error 第:"+i+",pid="+jsonObj.getString("pid"));
}
}
System.out.println("脱敏结束, 耗时: "+((System.currentTimeMillis()-log_stUtc)/1000)+".s");
} catch (IOException e) {
e.printStackTrace();
}
} }
} }
...@@ -14,54 +14,20 @@ ...@@ -14,54 +14,20 @@
<result column="loanId" jdbcType="VARCHAR" property="loanId"/> <result column="loanId" jdbcType="VARCHAR" property="loanId"/>
</resultMap> </resultMap>
<select id="findApplyLoanInfo" resultMap="ApplyLoanInfoBaseResultMap"> <!--<select id="findApplyLoanInfo" resultMap="ApplyLoanInfoBaseResultMap">
select b.name as name, b.id_no as pid, b.phone_no as mobile, '1' as queryReason, '1' as guaranteeType, '1' as loanPurpose, '99' as customType, '-1' as applyAmount, a.order_no as loanId select b.name as name, b.id_no as pid, b.phone_no as mobile, '1' as queryReason, '1' as guaranteeType, '1' as loanPurpose, '99' as customType, '-1' as applyAmount, a.order_no as loanId
from xyqb_i_apply_quota_record a left join xyqb_user_i_user_detail b on a.user_id=b.user_id from xyqb_i_apply_quota_record a left join xyqb_user_i_user_detail b on a.user_id=b.user_id
where a.created_at>=DATE_FORMAT(DATE_ADD(NOW(), INTERVAL -1 DAY), '%Y-%m-%d'); where a.created_at>=DATE_FORMAT(DATE_ADD(NOW(), INTERVAL -1 DAY), '%Y-%m-%d');
</select> </select>-->
<select id="findApplyLoanInfoByThreeElements" parameterType="cn.quantgroup.report.domain.baihang.BaiHangThreeElements" resultMap="ApplyLoanInfoBaseResultMap"> <!--<select id="findApplyLoanInfoByThreeElements" parameterType="cn.quantgroup.report.domain.baihang.BaiHangThreeElements" resultMap="ApplyLoanInfoBaseResultMap">
select b.name as name, b.id_no as pid, b.phone_no as mobile, '1' as queryReason, '1' as guaranteeType, '1' as loanPurpose, '99' as customType, '-1' as applyAmount, a.order_no as loanId select b.name as name, b.id_no as pid, b.phone_no as mobile, '1' as queryReason, '1' as guaranteeType, '1' as loanPurpose, '99' as customType, '-1' as applyAmount, a.order_no as loanId
from xyqb_i_apply_quota_record a left join xyqb_user_i_user_detail b on a.user_id=b.user_id from xyqb_i_apply_quota_record a left join xyqb_user_i_user_detail b on a.user_id=b.user_id
where b.name=#{name} and b.id_no=#{idCard} and b.phone_no=#{phone} limit 1; where b.name=#{name} and b.id_no=#{idCard} and b.phone_no=#{phone} limit 1;
</select> </select>-->
<!--申请--> <!--申请-->
<select id="findStockApplyLoanInfo" resultMap="ApplyLoanInfoBaseResultMap"> <!--<select id="findStockApplyLoanInfo" resultMap="ApplyLoanInfoBaseResultMap">
-- select * from
-- (select
-- b.name name
-- ,b.id_no pid
-- ,b.phone_no mobile
-- ,'1' queryReason
-- ,'1' guaranteeType
-- ,'1' loanPurpose
-- ,'99' customType
-- ,'-1' applyAmount
-- ,if(d.order_no is null,a.loan_application_history_id,d.order_no) loanId
-- from xyqb_i_loan_application_manifest_history a
-- left join xyqb_user_i_user_detail b on a.user_id=b.user_id
-- left join xyqb_i_loan_account_ext c on a.loan_application_history_id=c.loan_id
-- left join xyqb_i_apply_quota_record d on c.order_no=d.order_no
-- where a.funding_corp_id=480 and a.transaction_status in (2,5)) a
-- union all
-- select * from
-- (select
-- b.name name
-- ,b.id_no pid
-- ,b.phone_no mobile
-- ,'1' queryReason
-- ,'1' guaranteeType
-- ,'1' loanPurpose
-- ,'99' customType
-- ,'-1' applyAmount
-- ,if(d.order_no is null,a.loan_application_history_id,d.order_no) loanId
-- from xyqb_i_loan_application_manifest_history a
-- left join xyqb_user_i_user_detail b on a.user_id=b.user_id
-- left join xyqb_i_loan_account_ext c on a.loan_application_history_id=c.loan_id
-- left join xyqb_i_apply_quota_record d on c.order_no=d.order_no
-- where a.transaction_status in (2,5) and a.loan_paid_at>='2018-01-01 00:00:00'
-- and a.funding_corp_id!=480 order by rand() limit 212342) b;
select * from select * from
(select (select
b.name name b.name name
...@@ -78,7 +44,7 @@ ...@@ -78,7 +44,7 @@
left join xyqb_i_loan_account_ext c on a.loan_application_history_id=c.loan_id left join xyqb_i_loan_account_ext c on a.loan_application_history_id=c.loan_id
left join xyqb_i_apply_quota_record d on c.order_no=d.order_no left join xyqb_i_apply_quota_record d on c.order_no=d.order_no
where a.funding_corp_id=480 and a.transaction_status in (2,5) and a.loan_paid_at > '2019-05-09 19:07:00' and a.loan_paid_at &lt; '2019-05-29') a where a.funding_corp_id=480 and a.transaction_status in (2,5) and a.loan_paid_at > '2019-05-09 19:07:00' and a.loan_paid_at &lt; '2019-05-29') a
</select> </select>-->
<!--百行-助贷申请存量数据 整理 2019.10.23--> <!--百行-助贷申请存量数据 整理 2019.10.23-->
......
...@@ -49,8 +49,8 @@ ...@@ -49,8 +49,8 @@
</resultMap> </resultMap>
<!--报送实时放款数据(百行征信报送)--> <!--报送实时放款数据(广达百行征信报送)-->
<select id="findLoanInfo" resultMap="LoanInfoResultMap" > <!-- <select id="findLoanInfo" resultMap="LoanInfoResultMap" >
select a.loan_application_history_id reqID select a.loan_application_history_id reqID
,'A' opCode ,'A' opCode
,DATE_FORMAT(now(),'%Y-%m-%dT%H:%i:%S') uploadTs ,DATE_FORMAT(now(),'%Y-%m-%dT%H:%i:%S') uploadTs
...@@ -83,15 +83,15 @@ ...@@ -83,15 +83,15 @@
left join xyqb_i_repayment_plan g on a.loan_application_history_id=g.loan_application_history_id left join xyqb_i_repayment_plan g on a.loan_application_history_id=g.loan_application_history_id
left join xyqb_i_loan_application_history h on a.loan_application_history_id=h.id left join xyqb_i_loan_application_history h on a.loan_application_history_id=h.id
left join xyqb_i_quota_credit i on d.order_no=i.order_no left join xyqb_i_quota_credit i on d.order_no=i.order_no
-- where a.funding_corp_id in (480,710) and e.term_no=a.contract_term and g.term_no=1 /*where a.funding_corp_id in (480,710) and e.term_no=a.contract_term and g.term_no=1*/
where a.funding_corp_id in (480,710,630,790,820) and e.term_no=a.contract_term and g.term_no=1 where a.funding_corp_id in (480,710,630,790,820) and e.term_no=a.contract_term and g.term_no=1
and a.transaction_status in (2,5) and a.transaction_status in (2,5)
and a.created_at>=DATE_FORMAT(DATE_ADD(NOW(), INTERVAL -1 DAY), '%Y-%m-%d') and a.created_at>=DATE_FORMAT(DATE_ADD(NOW(), INTERVAL -1 DAY), '%Y-%m-%d')
and a.created_at&lt;DATE_FORMAT(NOW(), '%Y-%m-%d'); and a.created_at&lt;DATE_FORMAT(NOW(), '%Y-%m-%d');
</select> </select>-->
<!--重新报送实时放款数据--> <!--广达重新报送实时放款数据-->
<select id="findLoanInfoByTime" resultMap="LoanInfoResultMap" parameterType="cn.quantgroup.report.domain.baihang.BaiHangTimeRecord"> <!--<select id="findLoanInfoByTime" resultMap="LoanInfoResultMap" parameterType="cn.quantgroup.report.domain.baihang.BaiHangTimeRecord">
select a.loan_application_history_id reqID select a.loan_application_history_id reqID
,'A' opCode ,'A' opCode
,DATE_FORMAT(now(),'%Y-%m-%dT%H:%i:%S') uploadTs ,DATE_FORMAT(now(),'%Y-%m-%dT%H:%i:%S') uploadTs
...@@ -128,51 +128,11 @@ ...@@ -128,51 +128,11 @@
and a.transaction_status in (2,5) and a.transaction_status in (2,5)
and a.created_at>=#{startTime} and a.created_at>=#{startTime}
and a.created_at&lt;#{endTime}; and a.created_at&lt;#{endTime};
</select>-->
</select> <!--广达存量放款数据报送-->
<!-- <select id="stockLoanInfo" resultMap="LoanInfoResultMap" >
<!--根据loan_application_history_id查询最晚还款日--> select a.loan_application_history_id reqID
<select id="findTargetRepaymentDayList" parameterType="java.lang.String" resultType="java.lang.String">
select date(DATE_SUB(deadline,INTERVAL 1 second)) from xyqb_i_repayment_plan where loan_application_history_id=#{reqID}
</select>
<!--存量放款数据报送-->
<select id="stockLoanInfo" resultMap="LoanInfoResultMap" >
-- select a.loan_application_history_id reqID
-- ,'A' opCode
-- ,DATE_FORMAT(now(),'%Y-%m-%dT%H:%i:%S') uploadTs
-- ,b.name name
-- ,b.id_no pid
-- ,b.phone_no mobile
-- ,if(d.order_no is null,a.loan_application_history_id,d.order_no) loanId
-- ,'1' guaranteeType
-- ,'1' loanPurpose
-- ,DATE_FORMAT(case when i.created_at is null and h.created_at&lt;=f.created_at then h.created_at
-- when i.created_at is null and h.created_at>f.created_at then f.created_at
-- else i.created_at end,'%Y-%m-%dT%H:%i:%S') as applyDate
-- ,DATE_FORMAT(case when d.created_at is null and f.created_at>=h.created_at then f.created_at
-- when d.created_at is null and f.created_at&lt;h.created_at then h.created_at
-- else d.created_at end,'%Y-%m-%dT%H:%i:%S') as accountOpenDate
-- ,DATE_FORMAT(a.loan_paid_at,'%Y-%m-%dT%H:%i:%S') issueDate
-- ,date(date_sub(e.deadline,INTERVAL 1 second)) dueDate
-- ,a.contract_loan_amount loanAmount
-- ,a.contract_term totalTerm
-- ,if(a.contract_term=1,'1','2') targetRepayDateType
-- ,if(a.contract_term=1,'30','-1') termPeriod
-- ,date(date_sub(g.deadline,INTERVAL 1 second)) firstRepaymentDate
-- ,'0' gracePeriod
-- from xyqb_i_loan_application_manifest_history a
-- left join xyqb_user_i_user_detail b on a.user_id=b.user_id
-- left join xyqb_i_loan_account_ext c on a.loan_application_history_id=c.loan_id
-- left join xyqb_i_apply_quota_record d on c.order_no=d.order_no
-- left join xyqb_i_repayment_plan e on a.loan_application_history_id=e.loan_application_history_id
-- left join xyqb_i_loan_submit_info f on a.loan_application_history_id=f.loan_id
-- left join xyqb_i_repayment_plan g on a.loan_application_history_id=g.loan_application_history_id
-- left join xyqb_i_loan_application_history h on a.loan_application_history_id=h.id
-- left join xyqb_i_quota_credit i on d.order_no=i.order_no
-- where a.funding_corp_id=480 and e.term_no=a.contract_term and g.term_no=1
-- and a.transaction_status in (2,5) order by a.loan_paid_at;
select a.loan_application_history_id reqID
,'A' opCode ,'A' opCode
,DATE_FORMAT(now(),'%Y-%m-%dT%H:%i:%S') uploadTs ,DATE_FORMAT(now(),'%Y-%m-%dT%H:%i:%S') uploadTs
,b.name name ,b.name name
...@@ -205,9 +165,14 @@ ...@@ -205,9 +165,14 @@
left join xyqb_i_loan_application_history h on a.loan_application_history_id=h.id left join xyqb_i_loan_application_history h on a.loan_application_history_id=h.id
left join xyqb_i_quota_credit i on d.order_no=i.order_no left join xyqb_i_quota_credit i on d.order_no=i.order_no
where a.funding_corp_id in (480,710) and e.term_no=a.contract_term and g.term_no=1 where a.funding_corp_id in (480,710) and e.term_no=a.contract_term and g.term_no=1
and a.transaction_status in (2,5) and a.transaction_status in (2,5);
/* and a.loan_paid_at > '2019-05-09 10:30:07' and a.loan_paid_at &lt; '2019-05-29' order by a.loan_paid_at;*/
</select>-->
-- and a.loan_paid_at > '2019-05-09 10:30:07' and a.loan_paid_at &lt; '2019-05-29' order by a.loan_paid_at; <!--根据loan_application_history_id查询最晚还款日-->
<select id="findTargetRepaymentDayList" parameterType="java.lang.String" resultType="java.lang.String">
select date(DATE_SUB(deadline,INTERVAL 1 second)) from xyqb_i_repayment_plan where loan_application_history_id=#{reqID}
</select> </select>
......
...@@ -25,8 +25,8 @@ ...@@ -25,8 +25,8 @@
<!--<result column="loanStatus" jdbcType="VARCHAR" property="loanStatus"/>--> <!--<result column="loanStatus" jdbcType="VARCHAR" property="loanStatus"/>-->
<!--</resultMap>--> <!--</resultMap>-->
<!--实时逾期还款(百行征信报送)--> <!--实时逾期还款(广达百行征信报送)-->
<select id="findRepayMentLoanInfoOverdue" <!--<select id="findRepayMentLoanInfoOverdue"
parameterType="cn.quantgroup.report.domain.baihang.BaiHangTimeRecord" parameterType="cn.quantgroup.report.domain.baihang.BaiHangTimeRecord"
resultType="cn.quantgroup.report.domain.baihang.RepaymentInfoZhuDai"> resultType="cn.quantgroup.report.domain.baihang.RepaymentInfoZhuDai">
select select
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
where a.repayment_status not in (3,4) and where a.repayment_status not in (3,4) and
if(b.contract_term>a.term_no,DATEDIFF(#{endTime,jdbcType=VARCHAR},a.deadline)=0,DATEDIFF(#{endTime,jdbcType=VARCHAR},a.deadline)>=0) if(b.contract_term>a.term_no,DATEDIFF(#{endTime,jdbcType=VARCHAR},a.deadline)=0,DATEDIFF(#{endTime,jdbcType=VARCHAR},a.deadline)>=0)
and floor(DATEDIFF(#{endTime,jdbcType=VARCHAR},a.deadline)/30)=DATEDIFF(#{endTime,jdbcType=VARCHAR,jdbcType=VARCHAR},a.deadline)/30 and floor(DATEDIFF(#{endTime,jdbcType=VARCHAR},a.deadline)/30)=DATEDIFF(#{endTime,jdbcType=VARCHAR,jdbcType=VARCHAR},a.deadline)/30
-- and (b.funding_corp_id=480 or (b.funding_corp_id=710 and b.loan_paid_at>='2019-05-29')) and b.transaction_status in (2,5) ) a &#45;&#45; and (b.funding_corp_id=480 or (b.funding_corp_id=710 and b.loan_paid_at>='2019-05-29')) and b.transaction_status in (2,5) ) a
and (b.funding_corp_id=480 or (b.funding_corp_id=710 and b.loan_paid_at>='2019-05-29') or and (b.funding_corp_id=480 or (b.funding_corp_id=710 and b.loan_paid_at>='2019-05-29') or
(b.funding_corp_id in (630,790,820) and b.loan_paid_at>='2019-10-16') (b.funding_corp_id in (630,790,820) and b.loan_paid_at>='2019-10-16')
) and b.transaction_status in (2,5) ) a ) and b.transaction_status in (2,5) ) a
...@@ -75,15 +75,15 @@ ...@@ -75,15 +75,15 @@
left join xyqb_i_loan_application_manifest_history b left join xyqb_i_loan_application_manifest_history b
on a.loan_application_history_id=b.loan_application_history_id on a.loan_application_history_id=b.loan_application_history_id
left join xyqb_i_repayment_record g on a.id=g.repayment_plan_id left join xyqb_i_repayment_record g on a.id=g.repayment_plan_id
-- where b.funding_corp_id in (480,710) &#45;&#45; where b.funding_corp_id in (480,710)
where b.funding_corp_id in (480,710,630,790,820) where b.funding_corp_id in (480,710,630,790,820)
group by a.loan_application_history_id) f on a.loan_application_history_id=f.loan_application_history_id group by a.loan_application_history_id) f on a.loan_application_history_id=f.loan_application_history_id
left join xyqb_i_repayment_record g on a.id=g.repayment_plan_id; left join xyqb_i_repayment_record g on a.id=g.repayment_plan_id;
</select> </select>
-->
<!--实时还款(广达百行征信报送)-->
<!--实时还款(百行征信报送)--> <!--<select id="findRepayMentLoanInfo" parameterType="cn.quantgroup.report.domain.baihang.BaiHangTimeRecord"
<select id="findRepayMentLoanInfo" parameterType="cn.quantgroup.report.domain.baihang.BaiHangTimeRecord"
resultType="cn.quantgroup.report.domain.baihang.RepaymentInfoZhuDai"> resultType="cn.quantgroup.report.domain.baihang.RepaymentInfoZhuDai">
select select
a.id reqID a.id reqID
...@@ -119,7 +119,6 @@ ...@@ -119,7 +119,6 @@
left join xyqb_i_repayment_plan c on a.loan_application_history_id=c.loan_application_history_id left join xyqb_i_repayment_plan c on a.loan_application_history_id=c.loan_application_history_id
and a.term_no=c.term_no-1 and a.term_no=c.term_no-1
where a.repaid_at>=#{startTime,jdbcType=VARCHAR} and a.repaid_at &lt; #{endTime,jdbcType=VARCHAR} and a.repayment_status=3 where a.repaid_at>=#{startTime,jdbcType=VARCHAR} and a.repaid_at &lt; #{endTime,jdbcType=VARCHAR} and a.repayment_status=3
-- and (b.funding_corp_id=480 or (b.funding_corp_id=710 and b.loan_paid_at>='2019-05-29'))) a
and (b.funding_corp_id=480 or (b.funding_corp_id=710 and b.loan_paid_at>='2019-05-29') or and (b.funding_corp_id=480 or (b.funding_corp_id=710 and b.loan_paid_at>='2019-05-29') or
(b.funding_corp_id in (630,790,820) and b.loan_paid_at>='2019-10-16') )) a (b.funding_corp_id in (630,790,820) and b.loan_paid_at>='2019-10-16') )) a
left join xyqb_user_i_user_detail b on a.user_id=b.user_id left join xyqb_user_i_user_detail b on a.user_id=b.user_id
...@@ -135,7 +134,6 @@ ...@@ -135,7 +134,6 @@
left join xyqb_i_loan_application_manifest_history b left join xyqb_i_loan_application_manifest_history b
on a.loan_application_history_id=b.loan_application_history_id on a.loan_application_history_id=b.loan_application_history_id
left join xyqb_i_repayment_record g on a.id=g.repayment_plan_id left join xyqb_i_repayment_record g on a.id=g.repayment_plan_id
-- where b.funding_corp_id in (480,710)
where b.funding_corp_id in (480,710,630,790,820) where b.funding_corp_id in (480,710,630,790,820)
group by a.loan_application_history_id) f on a.loan_application_history_id=f.loan_application_history_id group by a.loan_application_history_id) f on a.loan_application_history_id=f.loan_application_history_id
left join xyqb_i_repayment_record g on a.id=g.repayment_plan_id left join xyqb_i_repayment_record g on a.id=g.repayment_plan_id
...@@ -148,7 +146,6 @@ ...@@ -148,7 +146,6 @@
on a.loan_application_history_id=b.loan_application_history_id on a.loan_application_history_id=b.loan_application_history_id
left join xyqb_i_repayment_plan c on a.loan_application_history_id=c.loan_application_history_id left join xyqb_i_repayment_plan c on a.loan_application_history_id=c.loan_application_history_id
where DATEDIFF(a.repaid_at,c.deadline)>=-1 where DATEDIFF(a.repaid_at,c.deadline)>=-1
-- and b.funding_corp_id in (480,710)
and b.funding_corp_id in (480,710,630,790,820) and b.funding_corp_id in (480,710,630,790,820)
group by a.loan_application_history_id,a.term_no) h group by a.loan_application_history_id,a.term_no) h
on a.loan_application_history_id=h.loan_application_history_id and a.term_no=h.term_no on a.loan_application_history_id=h.loan_application_history_id and a.term_no=h.term_no
...@@ -160,7 +157,6 @@ ...@@ -160,7 +157,6 @@
left join xyqb_i_loan_application_manifest_history b left join xyqb_i_loan_application_manifest_history b
on a.loan_application_history_id=b.loan_application_history_id on a.loan_application_history_id=b.loan_application_history_id
left join xyqb_i_repayment_record d on a.loan_application_history_id=d.loan_application_history_id left join xyqb_i_repayment_record d on a.loan_application_history_id=d.loan_application_history_id
-- where b.funding_corp_id in (480,710)
where b.funding_corp_id in (480,710,630,790,820) where b.funding_corp_id in (480,710,630,790,820)
group by a.loan_application_history_id,a.term_no) i group by a.loan_application_history_id,a.term_no) i
on a.loan_application_history_id=i.loan_application_history_id and a.term_no=i.term_no on a.loan_application_history_id=i.loan_application_history_id and a.term_no=i.term_no
...@@ -169,9 +165,9 @@ ...@@ -169,9 +165,9 @@
group by if(d.order_no is null,a.loan_application_history_id,d.order_no), group by if(d.order_no is null,a.loan_application_history_id,d.order_no),
if(DATEDIFF(a.next_deadline,a.repaid_at)>1,a.term_no,h.max_term) if(DATEDIFF(a.next_deadline,a.repaid_at)>1,a.term_no,h.max_term)
</select> </select>
-->
<!-- <select id="findName" parameterType="cn.quantgroup.report.domain.baihang.BaiHangName"
<select id="findName" parameterType="cn.quantgroup.report.domain.baihang.BaiHangName"
resultType="cn.quantgroup.report.domain.baihang.BaiHangNameResult"> resultType="cn.quantgroup.report.domain.baihang.BaiHangNameResult">
select d.NAME name select d.NAME name
,d.id_no pid ,d.id_no pid
...@@ -190,7 +186,7 @@ ...@@ -190,7 +186,7 @@
left join xyqb_i_apply_quota_record c on b.order_no=c.order_no left join xyqb_i_apply_quota_record c on b.order_no=c.order_no
left join xyqb_user_i_user_detail d on a.user_id=d.user_id left join xyqb_user_i_user_detail d on a.user_id=d.user_id
where a.id=#{loanId}; where a.id=#{loanId};
</select> </select>-->
<!--百行-助贷“逾期还款”存量数据 整理 2019.10.23--> <!--百行-助贷“逾期还款”存量数据 整理 2019.10.23-->
......
...@@ -27,12 +27,10 @@ ...@@ -27,12 +27,10 @@
</resultMap> </resultMap>
<select id="saveLoanInfoRecordLog" parameterType="cn.quantgroup.report.domain.baihang.LoanInfoZhuDai"> <select id="saveLoanInfoRecordLog" parameterType="cn.quantgroup.report.domain.baihang.LoanInfoZhuDai">
<!-- <!--insert into loan_info_zhudai (record_id, req_id, name, pid,mobile,op_Code,upload_ts,loan_id,guarantee_type,loan_purpose,apply_date,account_open_date,
insert into loan_info_zhudai (record_id, req_id, name, pid,mobile,op_Code,upload_ts,loan_id,guarantee_type,loan_purpose,apply_date,account_open_date,
issue_date,due_date,loan_amount,total_term,target_repay_date_type,term_period,first_repayment_date,grace_period) issue_date,due_date,loan_amount,total_term,target_repay_date_type,term_period,first_repayment_date,grace_period)
VALUES (#{recordId},#{reqID},#{name},#{pid},#{mobile},#{opCode},#{uploadTs},#{loanId},#{guaranteeType},#{loanPurpose},#{applyDate} VALUES (#{recordId},#{reqID},#{name},#{pid},#{mobile},#{opCode},#{uploadTs},#{loanId},#{guaranteeType},#{loanPurpose},#{applyDate}
,#{accountOpenDate},#{issueDate},#{dueDate},#{loanAmount},#{totalTerm},#{targetRepayDateType},#{termPeriod},#{firstRepaymentDate},#{gracePeriod})*/ ,#{accountOpenDate},#{issueDate},#{dueDate},#{loanAmount},#{totalTerm},#{targetRepayDateType},#{termPeriod},#{firstRepaymentDate},#{gracePeriod})*/-->
-->
insert into loan_info_zhudai (record_id, req_id, name, pid,mobile,op_Code,upload_ts,loan_id,guarantee_type,loan_purpose,apply_date,account_open_date, insert into loan_info_zhudai (record_id, req_id, name, pid,mobile,op_Code,upload_ts,loan_id,guarantee_type,loan_purpose,apply_date,account_open_date,
issue_date,due_date,loan_amount,total_term,target_repay_date_type,term_period,first_repayment_date,grace_period, issue_date,due_date,loan_amount,total_term,target_repay_date_type,term_period,first_repayment_date,grace_period,
institutional_funding_partner,institutional_funding_partner_id,institutional_funding_partner_loan_id,relation_id,order_id,pre_credit_limit) institutional_funding_partner,institutional_funding_partner_id,institutional_funding_partner_loan_id,relation_id,order_id,pre_credit_limit)
...@@ -45,8 +43,8 @@ ...@@ -45,8 +43,8 @@
update loan_info_zhudai set enable = #{enable, jdbcType=VARCHAR} where record_id = #{recordId, jdbcType=VARCHAR}; update loan_info_zhudai set enable = #{enable, jdbcType=VARCHAR} where record_id = #{recordId, jdbcType=VARCHAR};
</update> </update>
<select id="findAll" resultMap="LoanInfoResultMap"> <!--<select id="findAll" resultMap="LoanInfoResultMap">
select * from loan_info_zhudai where enable = false; select * from loan_info_zhudai where enable = false;
</select> </select>-->
</mapper> </mapper>
\ No newline at end of file
...@@ -68,9 +68,9 @@ ...@@ -68,9 +68,9 @@
update repayment_loan_info_zhudai set enable = #{enable, jdbcType=VARCHAR}, updated_at = CURRENT_TIMESTAMP() where record_id = #{recordId, jdbcType=VARCHAR}; update repayment_loan_info_zhudai set enable = #{enable, jdbcType=VARCHAR}, updated_at = CURRENT_TIMESTAMP() where record_id = #{recordId, jdbcType=VARCHAR};
</update> </update>
<select id="findAll" resultMap="RepaymetnLoanInfoResultMap"> <!-- <select id="findAll" resultMap="RepaymetnLoanInfoResultMap">
select * from repayment_loan_info_zhudai where enable = false; select * from repayment_loan_info_zhudai where enable = false;
</select> </select>-->
<select id="findLastOne" parameterType="cn.quantgroup.report.domain.baihang.BaiHangRepayment" resultType="cn.quantgroup.report.domain.baihang.RepaymentInfoZhuDai"> <select id="findLastOne" parameterType="cn.quantgroup.report.domain.baihang.BaiHangRepayment" resultType="cn.quantgroup.report.domain.baihang.RepaymentInfoZhuDai">
select * from repayment_loan_info_zhudai where loan_id = #{loanId} and term_no = #{termNo} limit 1; select * from repayment_loan_info_zhudai where loan_id = #{loanId} and term_no = #{termNo} limit 1;
......
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