|
|
|
@ -24,6 +24,12 @@ public class A1 {
|
|
|
|
|
//源文件
|
|
|
|
|
static String parentPath = "D:\\dsWork\\YunNanDsBase\\Doc\\全省及州市县区人口与教育报告集20241023\\133个县区报告2022\\县区研究报告";
|
|
|
|
|
|
|
|
|
|
//哪些是处理不了的,就不处理了~
|
|
|
|
|
static String[] excludeCityList = {"~$", "磨憨-磨丁", "经开区", "阳宗海"};
|
|
|
|
|
|
|
|
|
|
//有好多EXCEL,啥样的有用?必须带有关键字字样的才有用!
|
|
|
|
|
static String fileNameKey="发展规模数据";
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) throws IOException, InvalidFormatException {
|
|
|
|
|
//初始化数据库连接
|
|
|
|
|
LocalMysqlConnectUtil.Init();
|
|
|
|
@ -46,11 +52,10 @@ public class A1 {
|
|
|
|
|
String excelPath = sampleExcelPath.replace(".xlsx", "【成果】.xlsx");
|
|
|
|
|
ExcelKit.delExcel(excelPath);
|
|
|
|
|
|
|
|
|
|
//开始填表
|
|
|
|
|
//找到parentPath下一级目录中所有文件
|
|
|
|
|
List<File> files = FileUtil.loopFiles(parentPath, file -> true);
|
|
|
|
|
int rowIndex = 0;
|
|
|
|
|
String[] excludeCityList = {"~$", "磨憨-磨丁", "经开区", "阳宗海"};
|
|
|
|
|
|
|
|
|
|
//处理这个目录
|
|
|
|
|
if (files != null) {
|
|
|
|
|
for (File file : files) {
|
|
|
|
@ -67,8 +72,7 @@ public class A1 {
|
|
|
|
|
}
|
|
|
|
|
if (flag) continue;
|
|
|
|
|
//只关心发展规模数据的表格
|
|
|
|
|
if (!file.getName().contains("发展规模数据")) continue;
|
|
|
|
|
|
|
|
|
|
if (!file.getName().contains(fileNameKey)) continue;
|
|
|
|
|
//县区名称
|
|
|
|
|
String areaName = ru.getCityOrAreaName(file.getName());
|
|
|
|
|
if (StrKit.isBlank(areaName)) {
|
|
|
|
@ -101,56 +105,59 @@ public class A1 {
|
|
|
|
|
if (stringList.isEmpty() || StrKit.isBlank(stringList.get(0))) break;
|
|
|
|
|
int year = Integer.parseInt(stringList.get(0));
|
|
|
|
|
//3预测总招生数
|
|
|
|
|
int zss = Integer.parseInt(stringList.get(3).split("\\.")[0]);
|
|
|
|
|
String zss = stringList.get(3).split("\\.")[0];
|
|
|
|
|
Row outRow = outSheet.createRow(++rowIndex);
|
|
|
|
|
ExcelKit.putData(outRow, Arrays.asList(String.valueOf(year),
|
|
|
|
|
"总入园数", "", String.valueOf(zss), "", areaName, cityName), dataStyle);
|
|
|
|
|
"总入园数", "", zss, "", areaName, cityName), dataStyle);
|
|
|
|
|
}
|
|
|
|
|
//2022入园基数
|
|
|
|
|
// for (List<String> ignored : dataList) {
|
|
|
|
|
// //年份
|
|
|
|
|
// int year = 2022;
|
|
|
|
|
// //3预测总招生数
|
|
|
|
|
// int zss = Integer.parseInt(dataList.getFirst().get(3).split("\\.")[0]);
|
|
|
|
|
// Row outRow = outSheet.createRow(++rowIndex);
|
|
|
|
|
// ExcelKit.putData(outRow, Arrays.asList(String.valueOf(year),
|
|
|
|
|
// "2022年基数", "", String.valueOf(zss), "", areaName, cityName), dataStyle);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// //城区
|
|
|
|
|
// for (List<String> stringList : dataList) {
|
|
|
|
|
// //年份
|
|
|
|
|
// int year = Integer.parseInt(stringList.get(0));
|
|
|
|
|
// //4修正城区招生A
|
|
|
|
|
// int v = Integer.parseInt(stringList.get(4).split("\\.")[0]);
|
|
|
|
|
// Row outRow = outSheet.createRow(++rowIndex);
|
|
|
|
|
// ExcelKit.putData(outRow, Arrays.asList(String.valueOf(year),
|
|
|
|
|
// "", "城区", "", String.valueOf(v), areaName, cityName), dataStyle);
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// //镇区
|
|
|
|
|
// for (List<String> stringList : dataList) {
|
|
|
|
|
// //年份
|
|
|
|
|
// int year = Integer.parseInt(stringList.get(0));
|
|
|
|
|
//
|
|
|
|
|
// int v = Integer.parseInt(stringList.get(5).split("\\.")[0]);
|
|
|
|
|
// Row outRow = outSheet.createRow(++rowIndex);
|
|
|
|
|
// ExcelKit.putData(outRow, Arrays.asList(String.valueOf(year),
|
|
|
|
|
// "", "镇区", "", String.valueOf(v), areaName, cityName), dataStyle);
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// //乡村
|
|
|
|
|
// for (List<String> stringList : dataList) {
|
|
|
|
|
// //年份
|
|
|
|
|
// int year = Integer.parseInt(stringList.get(0));
|
|
|
|
|
// int v = Integer.parseInt(stringList.get(5).split("\\.")[0]);
|
|
|
|
|
// Row outRow = outSheet.createRow(++rowIndex);
|
|
|
|
|
// ExcelKit.putData(outRow, Arrays.asList(String.valueOf(year),
|
|
|
|
|
// "", "乡村", "", String.valueOf(v), areaName, cityName), dataStyle);
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
for (List<String> ignored : dataList) {
|
|
|
|
|
//年份
|
|
|
|
|
int year = 2022;
|
|
|
|
|
//3预测总招生数
|
|
|
|
|
int zss = Integer.parseInt(dataList.getFirst().get(3).split("\\.")[0]);
|
|
|
|
|
Row outRow = outSheet.createRow(++rowIndex);
|
|
|
|
|
ExcelKit.putData(outRow, Arrays.asList(String.valueOf(year),
|
|
|
|
|
"2022年基数", "", String.valueOf(zss), "", areaName, cityName), dataStyle);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//城区
|
|
|
|
|
for (List<String> stringList : dataList) {
|
|
|
|
|
//年份
|
|
|
|
|
if(stringList.isEmpty() || StrKit.isBlank(stringList.get(0))) break;
|
|
|
|
|
int year = Integer.parseInt(stringList.get(0));
|
|
|
|
|
//4修正城区招生A
|
|
|
|
|
int v = Integer.parseInt(stringList.get(4).split("\\.")[0]);
|
|
|
|
|
Row outRow = outSheet.createRow(++rowIndex);
|
|
|
|
|
ExcelKit.putData(outRow, Arrays.asList(String.valueOf(year),
|
|
|
|
|
"", "城区", "", String.valueOf(v), areaName, cityName), dataStyle);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//镇区
|
|
|
|
|
for (List<String> stringList : dataList) {
|
|
|
|
|
if(stringList.isEmpty() || StrKit.isBlank(stringList.get(0))) break;
|
|
|
|
|
//年份
|
|
|
|
|
int year = Integer.parseInt(stringList.get(0));
|
|
|
|
|
|
|
|
|
|
int v = Integer.parseInt(stringList.get(5).split("\\.")[0]);
|
|
|
|
|
Row outRow = outSheet.createRow(++rowIndex);
|
|
|
|
|
ExcelKit.putData(outRow, Arrays.asList(String.valueOf(year),
|
|
|
|
|
"", "镇区", "", String.valueOf(v), areaName, cityName), dataStyle);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//乡村
|
|
|
|
|
for (List<String> stringList : dataList) {
|
|
|
|
|
if(stringList.isEmpty() || StrKit.isBlank(stringList.get(0))) break;
|
|
|
|
|
//年份
|
|
|
|
|
int year = Integer.parseInt(stringList.get(0));
|
|
|
|
|
int v = Integer.parseInt(stringList.get(5).split("\\.")[0]);
|
|
|
|
|
Row outRow = outSheet.createRow(++rowIndex);
|
|
|
|
|
ExcelKit.putData(outRow, Arrays.asList(String.valueOf(year),
|
|
|
|
|
"", "乡村", "", String.valueOf(v), areaName, cityName), dataStyle);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//保存文件
|
|
|
|
|