Commit 5f8720d8 authored by hongguangwu's avatar hongguangwu

回盘

parent a6a2a0d5
...@@ -113,6 +113,23 @@ public class TStatisticsCurrentReportMarketServiceImpl extends ServiceImpl<TStat ...@@ -113,6 +113,23 @@ public class TStatisticsCurrentReportMarketServiceImpl extends ServiceImpl<TStat
cachedDataList.add(data); cachedDataList.add(data);
} }
if (cachedDataList.size() >= BATCH_COUNT) { if (cachedDataList.size() >= BATCH_COUNT) {
saveData();
// 存储完成清理 list
cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
}
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
saveData();
}
/**
* 加上存储数据库
*/
private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size());
if (!cachedDataList.isEmpty()) {
if (Common.isEmpty(declareMonth)) { if (Common.isEmpty(declareMonth)) {
if (Common.isNotNull(cachedDataList.get(0).getCreateStart())) { if (Common.isNotNull(cachedDataList.get(0).getCreateStart())) {
declareMonth = DateUtil.getYearMonth(cachedDataList.get(0).getCreateStart()); declareMonth = DateUtil.getYearMonth(cachedDataList.get(0).getCreateStart());
...@@ -141,26 +158,9 @@ public class TStatisticsCurrentReportMarketServiceImpl extends ServiceImpl<TStat ...@@ -141,26 +158,9 @@ public class TStatisticsCurrentReportMarketServiceImpl extends ServiceImpl<TStat
} }
} }
if (errorMessageList.isEmpty()) { if (errorMessageList.isEmpty()) {
saveData(declareMonth);
}
// 存储完成清理 list
cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
}
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
saveData(declareMonth);
}
/**
* 加上存储数据库
*/
private void saveData(String declareMonth) {
log.info("{}条数据,开始存储数据库!", cachedDataList.size());
if (!cachedDataList.isEmpty()) {
importTStatisticsCurrentReportMarket(declareMonth, cachedDataList); importTStatisticsCurrentReportMarket(declareMonth, cachedDataList);
} }
}
log.info("存储数据库成功!"); log.info("存储数据库成功!");
} }
}).sheet().doRead(); }).sheet().doRead();
......
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