Commit 5f8720d8 authored by hongguangwu's avatar hongguangwu

回盘

parent a6a2a0d5
......@@ -113,6 +113,23 @@ public class TStatisticsCurrentReportMarketServiceImpl extends ServiceImpl<TStat
cachedDataList.add(data);
}
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.isNotNull(cachedDataList.get(0).getCreateStart())) {
declareMonth = DateUtil.getYearMonth(cachedDataList.get(0).getCreateStart());
......@@ -141,25 +158,8 @@ public class TStatisticsCurrentReportMarketServiceImpl extends ServiceImpl<TStat
}
}
if (errorMessageList.isEmpty()) {
saveData(declareMonth);
importTStatisticsCurrentReportMarket(declareMonth, cachedDataList);
}
// 存储完成清理 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);
}
log.info("存储数据库成功!");
}
......
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