main
HuangHai 4 months ago
parent c6e219c4c0
commit c908478377

@ -1,5 +1,6 @@
{ {
"2019": { "2019": {
"skipRows": 7,
"基教小学": { "基教小学": {
"schoolName": { "schoolName": {
"index": 1, "index": 1,

@ -19,6 +19,9 @@ import java.util.List;
import java.util.Map; import java.util.Map;
public class SchoolCountSummary { public class SchoolCountSummary {
// 配置文件
public static final String configPath = "D:/dsWork/YunNanDsBase/src/main/java/com/dsideal/base/Tools/JkyNewData/Data/SchoolCount.json";
public static final String excelPath = "D:/dsWork/2025年收集的人口与教育数据库20250328/2015-2020年的数据/基础教育";
public static void main(String[] args) throws FileNotFoundException { public static void main(String[] args) throws FileNotFoundException {
// 一、关闭日志输出 // 一、关闭日志输出
@ -27,13 +30,12 @@ public class SchoolCountSummary {
// 二、初始化数据库连接 // 二、初始化数据库连接
LocalMysqlConnectUtil.Init(); LocalMysqlConnectUtil.Init();
// 读取配置文件 // 三、开始读取数据
String configPath = "D:/dsWork/YunNanDsBase/src/main/java/com/dsideal/base/Tools/JkyNewData/Data/SchoolCount.json";
String excelPath = "D:/dsWork/2025年收集的人口与教育数据库20250328/2015-2020年的数据/基础教育";
JSONObject config = JSON.parseObject(new FileReader(configPath)); JSONObject config = JSON.parseObject(new FileReader(configPath));
// 遍历年份 // 遍历年份
for (String year : config.keySet()) { for (String year : config.keySet()) {
//表头的行数
int skipRows = config.getJSONObject(year).getIntValue("skipRows");
JSONObject yearConfig = config.getJSONObject(year); JSONObject yearConfig = config.getJSONObject(year);
String filePath = String.format(excelPath + "/%s.xlsx", year); String filePath = String.format(excelPath + "/%s.xlsx", year);
@ -57,7 +59,7 @@ public class SchoolCountSummary {
} }
// 处理当前学校类型的数据 // 处理当前学校类型的数据
allResults.put(schoolType, processSheet(filePath, schoolType, 7, columnConfigs)); allResults.put(schoolType, processSheet(filePath, schoolType, skipRows, columnConfigs));
} }
// 保存统计结果到数据库 // 保存统计结果到数据库

Loading…
Cancel
Save