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

异常记录

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