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

异常记录

parent 2f0b5070
......@@ -4,8 +4,10 @@ import cn.hutool.core.io.IoUtil;
import cn.hutool.json.JSONUtil;
import cn.quantgroup.report.domain.baihang.ApplyLoanInfoZhuDai;
import cn.quantgroup.report.mapper.master.ApplyLoanInfoZhuDaiMapper;
import cn.quantgroup.report.utils.DateUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -13,7 +15,10 @@ import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger;
......@@ -36,6 +41,7 @@ public class BaiHangDataDisposeService {
List<ApplyLoanInfoZhuDai> zhuDaiLogList = null;
ApplyLoanInfoZhuDai record = null;
AtomicInteger atomicInteger = new AtomicInteger();
List<String> reportList = new ArrayList<>();
try {
bis = new BufferedReader(new FileReader(HOST_PATH + plainTextFileName));
while(null != (dataStr = bis.readLine())) {
......@@ -43,6 +49,7 @@ public class BaiHangDataDisposeService {
ApplyLoanInfoZhuDai applyLoanInfoZhuDai = JSONUtil.toBean(dataStr, ApplyLoanInfoZhuDai.class);
zhuDaiLogList = applyLoanInfoZhuDaiMapper.findByApplyId(applyLoanInfoZhuDai.getApplyId());
if (CollectionUtils.isEmpty(zhuDaiLogList)) {
reportList.add(dataStr);
atomicInteger.getAndIncrement();
if (saveDb) {
record = new ApplyLoanInfoZhuDai();
......@@ -53,6 +60,11 @@ public class BaiHangDataDisposeService {
}
}
}
if (CollectionUtils.isNotEmpty(reportList)) {
File file = new File(HOST_PATH + "fixA1RefuseDataCauseByBatchSave_" + DateUtils.formatDate(new Date(),"yyyyMMddHHmmsss") + ".txt");
FileUtils.writeLines(file,reportList);
baiHangFileReportService.clear(reportList);
}
log.error("fixA1RefuseDataCauseByBatchSave处理数据结束,处理总量={}",atomicInteger.get());
} catch (Exception e) {
log.error("fixA1RefuseDataCauseByBatchSave处理数据异常",e.getMessage());
......
......@@ -742,7 +742,7 @@ public class BaiHangFileReportService {
return encryptFileName;
}
private void clear(Collection ... collections) {
public void clear(Collection ... collections) {
for (Collection col : collections) {
if (!CollectionUtils.isEmpty(col)) {
col.clear();
......
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