From 5c49c6f9a7e377bb46f7cb617f72b11fc17d5331 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期三, 24 五月 2023 14:10:14 +0800 Subject: [PATCH] 1 --- src/main/resources/logback-spring.xml | 0 src/main/java/com/yssh/utils/CsvParser.java | 15 +++++++++------ src/main/resources/application.yml | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/yssh/utils/CsvParser.java b/src/main/java/com/yssh/utils/CsvParser.java index 04aadee..abf6a9c 100644 --- a/src/main/java/com/yssh/utils/CsvParser.java +++ b/src/main/java/com/yssh/utils/CsvParser.java @@ -12,27 +12,27 @@ import com.yssh.entity.SuYuan; import com.yssh.service.ISuYuanService; -public class CsvParser extends AbstractCsvFileParser<SuYuan>{ +public class CsvParser extends AbstractCsvFileParser<SuYuan> { protected final Log logger = LogFactory.getLog(this.getClass()); /** * 姣忛殧3000鏉″瓨鍌ㄦ暟鎹簱锛岀劧鍚庢竻鐞唋ist 锛屾柟渚垮唴瀛樺洖鏀� */ public static final int BATCH_COUNT = 100000; - + /** * 缂撳瓨鐨勬暟鎹� */ private List<SuYuan> cachedData = new ArrayList<>(BATCH_COUNT); - + private ISuYuanService suYuanService; private String time; - + public CsvParser(ISuYuanService suYuanService, String time) { this.suYuanService = suYuanService; this.time = time; } - + /** * 鎵�鏈夋暟鎹В鏋愬畬鎴愪簡 浼氭潵璋冪敤,闃叉鏈夋暟鎹病鏈夎淇濆瓨 */ @@ -49,6 +49,10 @@ @Override protected void invoke(SuYuan t) { t.setId(t.getX() + "_" + t.getY() + "_" + t.getZ()); + if ("0_0_0".equals(t.getId())) { + return; // 瑙e喅涓婚敭閲嶅 + } + //System.err.println(t.getId()); cachedData.add(t); // 杈惧埌BATCH_COUNT浜嗭紝闇�瑕佸幓瀛樺偍涓�娆℃暟鎹簱锛岄槻姝㈡暟鎹嚑涓囨潯鏁版嵁鍦ㄥ唴瀛橈紝瀹规槗OOM @@ -67,5 +71,4 @@ private void saveSuYuanData() throws Exception { suYuanService.insertSuYuanDatas(cachedData, time); } - } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index f882cb0..32f01dc 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -29,7 +29,7 @@ # 鏃ュ織閰嶇疆 logging: - config: classpath:logback-all.xml + config: classpath:logback-spring.xml #MyBatis閰嶇疆 mybatis: diff --git a/src/main/resources/logback-all.xml b/src/main/resources/logback-spring.xml similarity index 100% rename from src/main/resources/logback-all.xml rename to src/main/resources/logback-spring.xml -- Gitblit v1.9.3