Commit 6a873119 authored by 陈宏杰's avatar 陈宏杰

三要素保持一致

parent c541232b
......@@ -6,6 +6,7 @@ import cn.quantgroup.report.domain.baihang.RepaymentInfoZhuDai;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.math.BigDecimal;
import java.util.List;
/**
......@@ -123,4 +124,5 @@ public interface RepaymentLoanInfoMapper {
List<LoanApplicationHistoryIdInfo> queryLoanApplicationHistoryIdInfo(BaiHangTimeRecord baiHangTimeRecord);
Integer queryRepeatOfD3R(@Param("loanId") String loanId, @Param("termNo") Integer termNo, @Param("realRepayment") BigDecimal realRepayment);
}
......@@ -570,15 +570,18 @@ public class BaiHangFileReportService {
repaymentLoanInfos = repaymentLoanInfoMapper.queryOverdueRecordOfD3(BaiHangTimeRecord.builder().startTime(startTime).endTime(endTime).loanStartTime(loanStartTime).loanEndTime(loanEndTime).linkPointTime(linkPointTime).build());
log.info("量化派助贷TO百行报送(D3)-逾期记录查询结束, startTime: {} , endTime: {} , 大小: {} , 耗时: {} ", startTime, endTime, repaymentLoanInfos.size(), (queryStopwatch.stop().elapsed(TimeUnit.MILLISECONDS) / 1000) + ".s");
AtomicInteger atomicInteger = new AtomicInteger();
String id = "", nameForD3 = null;
String id = "";
JSONObject userInfoObject = null;
for (int i = 0; i < repaymentLoanInfos.size(); i++) {
RepaymentInfoZhuDai repaymentLoanInfo = repaymentLoanInfos.get(i);
try {
id = UUID.randomUUID().toString().replaceAll("-", "");
RepaymentInfoZhuDai record = new RepaymentInfoZhuDai();
nameForD3 = getNameForD3(repaymentLoanInfo.getLoanId());
if (StringUtils.isNotBlank(nameForD3)) {
repaymentLoanInfo.setName(nameForD3);
if (StringUtils.isNotBlank(linkPointTime)) {
userInfoObject = getUserInfoForD3(repaymentLoanInfo.getLoanId());
repaymentLoanInfo.setName(userInfoObject.getString("name"));
repaymentLoanInfo.setPid(userInfoObject.getString("pid"));
repaymentLoanInfo.setMobile(userInfoObject.getString("mobile"));
}
BeanUtils.copyProperties(repaymentLoanInfo, record);
record.setRecordId(id);
......@@ -624,7 +627,8 @@ public class BaiHangFileReportService {
List<RepaymentInfoZhuDai> repaymentLoanInfos = new ArrayList<>(D3_INITIAL_CAPACITY),tempRepaymentLoanInfos = null,recordList = new ArrayList<>(D3_INITIAL_CAPACITY);
Date stepEndDate = null;
Integer step = null;
String id = "" , nameForD3 = null;
String id = "";
JSONObject userInfoObject = null;
AtomicInteger atomicInteger = new AtomicInteger();
List<String> reportList = new ArrayList<>(D3_INITIAL_CAPACITY);
reportList.add("#singleLoanRepayInfo");
......@@ -659,9 +663,11 @@ public class BaiHangFileReportService {
try {
id = UUID.randomUUID().toString().replaceAll("-", "");
RepaymentInfoZhuDai record = new RepaymentInfoZhuDai();
nameForD3 = getNameForD3(repaymentLoanInfo.getLoanId());
if (StringUtils.isNotBlank(nameForD3)) {
repaymentLoanInfo.setName(nameForD3);
if (StringUtils.isNotBlank(linkPointTime)) {
userInfoObject = getUserInfoForD3(repaymentLoanInfo.getLoanId());
repaymentLoanInfo.setName(userInfoObject.getString("name"));
repaymentLoanInfo.setPid(userInfoObject.getString("pid"));
repaymentLoanInfo.setMobile(userInfoObject.getString("mobile"));
}
BeanUtils.copyProperties(repaymentLoanInfo, record);
record.setRecordId(id);
......@@ -715,10 +721,20 @@ public class BaiHangFileReportService {
repaymentLoanInfos = repaymentLoanInfoMapper.queryRepayMentRecordOfD3(BaiHangTimeRecord.builder().startTime(startTime).endTime(endTime).loanStartTime(loanStartTime).loanEndTime(loanEndTime).linkPointTime(linkPointTime).build());
log.info("量化派助贷TO百行报送(D3)-还款记录查询结束, startTime: {} , endTime: {} , 大小: {} , 耗时: {} ", startTime, endTime, repaymentLoanInfos.size(), (queryStopwatch.stop().elapsed(TimeUnit.MILLISECONDS) / 1000) + ".s");
AtomicInteger atomicInteger = new AtomicInteger();
String id = "" , nameForD3 = null;
String id = "";
JSONObject userInfoObject = null;
Integer repeatCount = null;
for (int i = 0; i < repaymentLoanInfos.size(); i++) {
RepaymentInfoZhuDai repaymentLoanInfo = repaymentLoanInfos.get(i);
try {
if (StringUtils.isNotBlank(linkPointTime)) {
//新老数据衔接避免重复报送
repeatCount = repaymentLoanInfoMapper.queryRepeatOfD3R(repaymentLoanInfo.getLoanId(),repaymentLoanInfo.getTermNo(),repaymentLoanInfo.getRealRepayment());
if (Objects.nonNull(repeatCount) && repeatCount > 0) {
log.info("量化派助贷TO百行报送(D3)-已报送,重复信息 {}",JSONObject.toJSONString(repaymentLoanInfo));
continue;
}
}
if (repairDataList_01.contains(repaymentLoanInfo.getLoanId())) {
log.error("量化派助贷TO百行报送(D3)-还款记录处理脏数据: {}",repaymentLoanInfo.getLoanId());
//脏数据特殊处理,不修改业务库数据
......@@ -728,9 +744,11 @@ public class BaiHangFileReportService {
}
id = UUID.randomUUID().toString().replaceAll("-", "");
RepaymentInfoZhuDai record = new RepaymentInfoZhuDai();
nameForD3 = getNameForD3(repaymentLoanInfo.getLoanId());
if (StringUtils.isNotBlank(nameForD3)) {
repaymentLoanInfo.setName(nameForD3);
if (StringUtils.isNotBlank(linkPointTime)) {
userInfoObject = getUserInfoForD3(repaymentLoanInfo.getLoanId());
repaymentLoanInfo.setName(userInfoObject.getString("name"));
repaymentLoanInfo.setPid(userInfoObject.getString("pid"));
repaymentLoanInfo.setMobile(userInfoObject.getString("mobile"));
}
BeanUtils.copyProperties(repaymentLoanInfo, record);
record.setRecordId(id);
......@@ -1005,16 +1023,20 @@ public class BaiHangFileReportService {
return headMark;
}
private String getNameForD3(String applyId) {
String name = null;
private JSONObject getUserInfoForD3(String applyId) {
JSONObject userInfoObject = new JSONObject();
LoanInfoZhuDai loanInfoZhuDaiOfLately = loanInfoMapper.findLoanInfoZhuDaiOfLately(applyId);
if (Objects.nonNull(loanInfoZhuDaiOfLately)) {
name = loanInfoZhuDaiOfLately.getName();
userInfoObject.put("name",loanInfoZhuDaiOfLately.getName());
userInfoObject.put("pid",loanInfoZhuDaiOfLately.getPid());
userInfoObject.put("mobile",loanInfoZhuDaiOfLately.getMobile());
} else {
ApplyLoanInfoZhuDai applyLoanInfoZhuDaiOfLately = applyLoanInfoMapper.findApplyLoanInfoZhuDaiOfLately(applyId);
name = Objects.nonNull(applyLoanInfoZhuDaiOfLately) ? applyLoanInfoZhuDaiOfLately.getName() : null;
userInfoObject.put("name",applyLoanInfoZhuDaiOfLately.getName());
userInfoObject.put("pid",applyLoanInfoZhuDaiOfLately.getPid());
userInfoObject.put("mobile",applyLoanInfoZhuDaiOfLately.getMobile());
}
return name;
return userInfoObject;
}
}
......@@ -1195,5 +1195,12 @@
group by a.loan_application_history_id
</select>
<select id="queryRepeatOfD3R" resultType="java.lang.Integer">
select count(*)
from risk_datasource.repayment_loan_info_zhudai
where loan_id = #{loanId,jdbcType=VARCHAR}
and term_no = #{termNo}
and real_repayment = #{realRepayment}
</select>
</mapper>
\ No newline at end of file
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