Commit d7569334 authored by 陈宏杰's avatar 陈宏杰

替换表

parent 55279f2f
package cn.quantgroup.report.mapper.master;
import cn.quantgroup.report.domain.baihang.ApplyLoanInfoZhuDai;
import cn.quantgroup.report.domain.baihang.ApplyLoanInfoZhuDaiRefuse;
import org.springframework.stereotype.Repository;
import java.util.List;
......@@ -21,4 +22,6 @@ public interface ApplyLoanInfoZhuDaiMapper {
List<ApplyLoanInfoZhuDai> findByApplyId(String applyId);
void batchSaveLog(List<ApplyLoanInfoZhuDai> list);
}
......@@ -253,7 +253,7 @@ public class BaiHangFileReportService {
private String reportA1Refuse(String starTime, String endTime){
String encryptFileName = null;
List<ApplyLoanInfoZhuDaiRefuse> recordList = new ArrayList<>(A1_INITIAL_CAPACITY),zhuDaiRefuseLogList = null;
List<ApplyLoanInfoZhuDai> recordList = new ArrayList<>(A1_INITIAL_CAPACITY);
List<ApplyLoanInfoZhuDai> zhuDaiLogList = null,applyLoanInfos = null;
List<String> reportList = new ArrayList<>();
try {
......@@ -268,14 +268,14 @@ public class BaiHangFileReportService {
Stopwatch sendWatch = Stopwatch.createStarted();
reportList.add("#applyInfo");
String reqId_log = "";
ApplyLoanInfoZhuDai record = null;
for (int i = 0; i < applyLoanInfos.size(); i++) {
try {
ApplyLoanInfoZhuDai applyLoanInfo = applyLoanInfos.get(i);
reqId_log = applyLoanInfo.getReqID();
zhuDaiLogList = applyLoanInfoZhuDaiMapper.findByApplyId(applyLoanInfo.getApplyId());
zhuDaiRefuseLogList = applyLoanInfoZhuDaiRefuseMapper.findApplyLoanInfoZhuDaiRefuseLog(applyLoanInfo.getReqID());
if (CollectionUtils.isEmpty(zhuDaiLogList) && CollectionUtils.isEmpty(zhuDaiRefuseLogList)) {
ApplyLoanInfoZhuDaiRefuse record = new ApplyLoanInfoZhuDaiRefuse();
if (CollectionUtils.isEmpty(zhuDaiLogList)) {
record = new ApplyLoanInfoZhuDai();
BeanUtils.copyProperties(applyLoanInfo, record);
record.setRecordId(UUID.randomUUID().toString().replaceAll("-", ""));
recordList.add(record);
......@@ -295,7 +295,7 @@ public class BaiHangFileReportService {
log.error("量化派助贷TO百行报送(A1Refuse)-贷款申请信息异常, reqId_log: {} ", reqId_log, e);
}
}
saveApplyLoanInfoZhuDaiRefuse(recordList,starTime,endTime);
saveApplyLoanInfoZhuDai(recordList,starTime,endTime);
File file = new File(HOST_PATH+"量子数科科技有限公司_A1Re_"+fileNameReplaceAll(starTime.split("T")[0])+"_"+fileNameReplaceAll(endTime.split("T")[0])+"_"+String.format("%06d",new Random().nextInt(999999))+".txt");
FileUtils.writeLines(file,reportList);
if (reportList.size()<=1) {
......@@ -762,18 +762,18 @@ public class BaiHangFileReportService {
}
}
private void saveApplyLoanInfoZhuDaiRefuse(List<ApplyLoanInfoZhuDaiRefuse> recordList,String startTime, String endTime) {
private void saveApplyLoanInfoZhuDai(List<ApplyLoanInfoZhuDai> recordList,String startTime, String endTime) {
if (!CollectionUtils.isEmpty(recordList)) {
List<List<ApplyLoanInfoZhuDaiRefuse>> allList = null;
List<List<ApplyLoanInfoZhuDai>> allList = null;
try {
allList = Lists.partition(recordList, LISTS_PARTITION_SIZE);
Stopwatch saveStopwatch = Stopwatch.createStarted();
allList.stream().forEach(pRecordList -> {
applyLoanInfoZhuDaiRefuseMapper.batchSaveLog(pRecordList);
applyLoanInfoZhuDaiMapper.batchSaveLog(pRecordList);
});
log.info("量化派助贷TO百行报送(A1Refuse)批量插入结束, startTime: {} , endTime: {} , 大小: {} , 耗时: {} ", startTime, endTime, recordList.size(), (saveStopwatch.stop().elapsed(TimeUnit.MILLISECONDS) / 1000) + ".s");
log.info("量化派助贷TO百行报送(A1)批量插入结束, startTime: {} , endTime: {} , 大小: {} , 耗时: {} ", startTime, endTime, recordList.size(), (saveStopwatch.stop().elapsed(TimeUnit.MILLISECONDS) / 1000) + ".s");
} catch (Exception e) {
log.error("量化派助贷TO百行报送(A1Refuse)保存异常", e);
log.error("量化派助贷TO百行报送(A1)保存异常", e);
} finally {
clear(recordList,allList);
}
......@@ -816,6 +816,7 @@ public class BaiHangFileReportService {
if (subFile.exists()) {
log.info("开始上传文件 {} 到百行ftp服务器...",fileName);
SftpUtil.uploadFile(sftp,baiHangFtpDataDirectory,HOST_PATH + fileName);
log.info("文件 {} 已上传到百行ftp服务器",fileName);
}
}
}
......
......@@ -50,5 +50,18 @@
where apply_id = #{applyId,jdbcType=VARCHAR}
</select>
<insert id="batchSaveLog" parameterType="java.util.List">
insert into apply_loan_info_zhudai (record_id,req_id,op_code,upload_ts,is_fin_tech_agency_business,apply_date,
apply_id,apply_type,name,id_type,pid,mobile,email_address,edu_background,
degree,guarantee_type,loan_purpose,custom_type,apply_amount,business_org_credit_code,
living_condition,marriage_status,spouse_name)
values
<foreach collection="list" item="item" index="index" separator="," >
(#{recordId},#{reqID},#{opCode},#{uploadTs},#{isFinTechAgencyBusiness},#{applyDate},#{applyId},#{applyType},#{name},#{idType},
#{pid},#{mobile},#{emailAddress},#{eduBackground},#{degree},#{guaranteeType},#{loanPurpose},#{customType},#{applyAmount},
#{businessOrgCreditCode},#{livingCondition},#{marriageStatus},#{spouseName})
</foreach>
</insert>
</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