main
黄海 8 months ago
parent d47379889d
commit 8190dc2844

@ -30,6 +30,13 @@ public class A1 {
//有好多EXCEL啥样的有用必须带有关键字字样的才有用!
static String fileNameKey = "发展规模数据";
//第二个表格的表头信息
static String tableKeyword = "自动计算招生数、在校生数";
//第二个表格的表头有几行
static int tableHeadRows = 2;
//第二个表格的最后一列的列名
static String tableLetterIndex = "K";
public static void main(String[] args) throws IOException, InvalidFormatException {
//初始化数据库连接
LocalMysqlConnectUtil.Init();
@ -75,11 +82,6 @@ public class A1 {
if (!file.getName().contains(fileNameKey)) continue;
//县区名称
String areaName = ru.getCityOrAreaName(file.getName());
if (StrKit.isBlank(areaName)) {
System.out.println("发现异常数据,请人工处理:" + file.getName());
System.exit(0);
}
//市州名称
//此文件的路径中最后一层的目录名称,应该是带着市州名称 ,把最后一层子目录的名称提出
String parentPathName = file.getParentFile().getName();
@ -88,15 +90,16 @@ public class A1 {
parentPathName = file.getParentFile().getParentFile().getName();
cityName = ru.getCityOrAreaName(parentPathName);
}
if (StrKit.isBlank(cityName)) {
if (StrKit.isBlank(cityName)||StrKit.isBlank(areaName)) {
System.out.println("发现异常数据,请人工处理:" + file.getName());
System.exit(0);
}
//县区名称
System.out.println("正在进行" + cityName + "-" + areaName + "的数据填充~");
String sourceExcel = file.getAbsolutePath();
List<List<String>> dataList = ExcelKit.readSecondTable(sourceExcel, 0, "自动计算招生数、在校生数",
2, "K");
List<List<String>> dataList = ExcelKit.readSecondTable(sourceExcel, 0, tableKeyword,
tableHeadRows, tableLetterIndex);
//这个工作表有四个蓝色列D:预测总招生数E:修正城区招生AF:修正镇区招生BG:修正乡村招生C
//有时有也三个蓝色列D:预测总招生数E:修正县城内招生G:修正县城外招生
@ -108,12 +111,11 @@ public class A1 {
int cnt = 0;
for (String s : x) if (s == null) cnt++;
int colsCount = x.size() - cnt;
//System.out.println("列数=" + colsCount);
//入园总数
for (List<String> stringList : dataList) {
//年份
int year = Integer.parseInt(stringList.get(0));
int year = Integer.parseInt(stringList.getFirst());
//D预测总招生数
String v = stringList.get(ExcelKit.transLetter2Num("D")).split("\\.")[0];
Row outRow = outSheet.createRow(++rowIndex);

Loading…
Cancel
Save