main
黄海 8 months ago
parent df65c37758
commit d81b4f65cc

@ -29,7 +29,7 @@ public class C10 {
//示例Excel
static String sampleExcelPath = "D:\\dsWork\\YunNanDsBase\\Doc\\待处理\\市\\【10】城镇&乡村人口变化及预测-双\\城镇&乡村人口变化及预测-双.xlsx";
public static void main(String[] args) throws IOException, InvalidFormatException {
public static void main(String[] args) throws IOException, InvalidFormatException, InterruptedException {
//初始化数据库连接
LocalMysqlConnectUtil.Init();
//实例化
@ -66,34 +66,25 @@ public class C10 {
if (fileName.endsWith(".docx") && !fileName.startsWith("~")) {
System.out.println("正在处理" + cityName + "市州文件:" + fileName);
//读取文件
String inputUrl = file.getAbsolutePath();
InputStream is = new FileInputStream(inputUrl);
ZipSecureFile.setMinInflateRatio(-1.0d);
XWPFDocument doc = new XWPFDocument(is);
//排序后的图表
List<XWPFChart> charts = ExcelKit.getSortListForXWPFChart(doc.getCharts());
//数据在图表2,图3
int firstChartNumber = 2, secondChartNumber = 3;
XSSFWorkbook workbook = charts.get(firstChartNumber - 1).getWorkbook();
List<List<String>> source1 = ExcelKit.readSheet(workbook, 6);//从2017年开始
List<List<String>> source1 = ExcelKit.getChartData(file.getAbsolutePath(), firstChartNumber, 6, 10);;//从2017年开始
workbook = charts.get(secondChartNumber - 1).getWorkbook();
List<List<String>> source3 = ExcelKit.readSheet(workbook, 2);//从2023年开始
List<List<String>> source3 = ExcelKit.getChartData(file.getAbsolutePath(), secondChartNumber, 2, 10);;//从2023年开始
//遍历source1
for (List<String> r : source1) {
// 导出数据
//上级行政区划,行政区划,年份,城镇人口变化,城镇人口预测,乡村人口变化,乡村人口预测
int year = Integer.parseInt(r.getFirst());
int year = Integer.parseInt(r.getFirst().substring(0,4));
//城镇
double cvalue = Double.parseDouble(r.get(1));
//乡村
double xvalue = Double.parseDouble(r.get(2));
if (year < 2023) {
Row outRow = outSheet.createRow(++rowIndex);
ExcelKit.putData(outRow, new ArrayList<>(Arrays.asList("云南省", cityName, r.getFirst(), String.format("%.2f", cvalue), "", String.format("%.2f", xvalue), "")), dataStyle);
ExcelKit.putData(outRow, new ArrayList<>(Arrays.asList("云南省", cityName, String.valueOf(year), String.format("%.2f", cvalue), "", String.format("%.2f", xvalue), "")), dataStyle);
}
}

@ -28,7 +28,7 @@ public class C11 {
//示例Excel
static String sampleExcelPath = "D:\\dsWork\\YunNanDsBase\\Doc\\待处理\\市\\【11】教育资源配置发展预测\\教育资源配置发展预测(人).xlsx";
public static void main(String[] args) throws IOException, InvalidFormatException {
public static void main(String[] args) throws IOException, InvalidFormatException, InterruptedException {
//初始化数据库连接
LocalMysqlConnectUtil.Init();
//实例化
@ -65,19 +65,12 @@ public class C11 {
if (fileName.endsWith(".docx") && !fileName.startsWith("~")) {
System.out.println("正在处理" + cityName + "市州文件...");
//读取文件
String inputUrl = file.getAbsolutePath();
InputStream is = new FileInputStream(inputUrl);
ZipSecureFile.setMinInflateRatio(-1.0d);
XWPFDocument doc = new XWPFDocument(is);
//排序后的图表
List<XWPFChart> charts = ExcelKit.getSortListForXWPFChart(doc.getCharts());
//数据在图表36教职工总量
int firstChartNumber = 36, secondChartNumber = 37;
//占地面积37
XSSFWorkbook workbook = charts.get(firstChartNumber - 1).getWorkbook();
List<List<String>> source1 = ExcelKit.readSheet(workbook, 1);
List<List<String>> source1 = ExcelKit.getChartData(file.getAbsolutePath(), firstChartNumber, 1, 10);
//年份,学前,小学,初中,高中
// 0 1 2 3 4
//所有相关2022基数的列都使用2022的数据
@ -90,8 +83,7 @@ public class C11 {
String gxjzg = firRow.get(4);//高中教职工2022基数
workbook = charts.get(secondChartNumber - 1).getWorkbook();
List<List<String>> source2 = ExcelKit.readSheet(workbook, 1);
List<List<String>> source2 = ExcelKit.getChartData(file.getAbsolutePath(), secondChartNumber, 1, 10);
//年份,学前,小学,初中,高中
// 0 1 2 3 4
List<String> secRow = source2.getFirst();

@ -28,7 +28,7 @@ public class C2 {
//示例Excel
static String sampleExcelPath = "D:\\dsWork\\YunNanDsBase\\Doc\\待处理\\市\\【2】学前教育幼儿在园总量变化及预测\\学前教育幼儿在园总量变化及预测.xlsx";
public static void main(String[] args) throws IOException, InvalidFormatException {
public static void main(String[] args) throws IOException, InvalidFormatException, InterruptedException {
//初始化数据库连接
LocalMysqlConnectUtil.Init();
//实例化
@ -65,19 +65,11 @@ public class C2 {
if (fileName.endsWith(".docx") && !fileName.startsWith("~")) {
System.out.println("正在处理" + cityName + "市州文件...");
//读取文件
String inputUrl = file.getAbsolutePath();
InputStream is = new FileInputStream(inputUrl);
ZipSecureFile.setMinInflateRatio(-1.0d);
XWPFDocument doc = new XWPFDocument(is);
//排序后的图表
List<XWPFChart> charts = ExcelKit.getSortListForXWPFChart(doc.getCharts());
//1号模板数据在图表6和29中
int firstChartNumber = 6, secondChartNumber = 29;
XSSFWorkbook workbook = charts.get(firstChartNumber - 1).getWorkbook();
List<List<String>> source1 = ExcelKit.readSheet(workbook);
XSSFWorkbook workbook2 = charts.get(secondChartNumber - 1).getWorkbook();
List<List<String>> source2 = ExcelKit.readSheet(workbook2);
List<List<String>> source1 = ExcelKit.getChartData(file.getAbsolutePath(), firstChartNumber, 1, 10);
List<List<String>> source2 = ExcelKit.getChartData(file.getAbsolutePath(), secondChartNumber, 1, 10);
String c2 = "总在园数";
//遍历source1

@ -39,7 +39,7 @@ public class C3 {
String stageName;
}
public static void main(String[] args) throws IOException, InvalidFormatException {
public static void main(String[] args) throws IOException, InvalidFormatException, InterruptedException {
//初始化数据库连接
LocalMysqlConnectUtil.Init();
//实例化
@ -76,12 +76,6 @@ public class C3 {
if (fileName.endsWith(".docx") && !fileName.startsWith("~")) {
System.out.println("正在处理" + cityName + "市州文件...");
//读取文件
String inputUrl = file.getAbsolutePath();
InputStream is = new FileInputStream(inputUrl);
ZipSecureFile.setMinInflateRatio(-1.0d);
XWPFDocument doc = new XWPFDocument(is);
//排序后的图表
List<XWPFChart> charts = ExcelKit.getSortListForXWPFChart(doc.getCharts());
List<Node> listNode = new ArrayList<>();
Node x = new Node();
@ -101,10 +95,8 @@ public class C3 {
int firstChartNumber = listNode.get(q).getFirst(), secondChartNumber = listNode.get(q).getSecond();
String stageName=listNode.get(q).getStageName();
XSSFWorkbook workbook = charts.get(firstChartNumber - 1).getWorkbook();
List<List<String>> source1 = ExcelKit.readSheet(workbook);
XSSFWorkbook workbook2 = charts.get(secondChartNumber - 1).getWorkbook();
List<List<String>> source2 = ExcelKit.readSheet(workbook2);
List<List<String>> source1 = ExcelKit.getChartData(file.getAbsolutePath(), firstChartNumber, 1, 10);
List<List<String>> source2 = ExcelKit.getChartData(file.getAbsolutePath(), secondChartNumber, 1, 10);
String c2 = "总招生数";
//遍历source1

@ -38,7 +38,7 @@ public class C4 {
String stageName;
}
public static void main(String[] args) throws IOException, InvalidFormatException {
public static void main(String[] args) throws IOException, InvalidFormatException, InterruptedException {
//初始化数据库连接
LocalMysqlConnectUtil.Init();
//实例化
@ -75,13 +75,6 @@ public class C4 {
if (fileName.endsWith(".docx") && !fileName.startsWith("~")) {
System.out.println("正在处理" + cityName + "市州文件...");
//读取文件
String inputUrl = file.getAbsolutePath();
InputStream is = new FileInputStream(inputUrl);
ZipSecureFile.setMinInflateRatio(-1.0d);
XWPFDocument doc = new XWPFDocument(is);
//排序后的图表
List<XWPFChart> charts = ExcelKit.getSortListForXWPFChart(doc.getCharts());
List<Node> listNode = new ArrayList<>();
Node x = new Node();
x.setFirst(8);
@ -100,10 +93,8 @@ public class C4 {
int firstChartNumber = listNode.get(q).getFirst(), secondChartNumber = listNode.get(q).getSecond();
String stageName=listNode.get(q).getStageName();
XSSFWorkbook workbook = charts.get(firstChartNumber - 1).getWorkbook();
List<List<String>> source1 = ExcelKit.readSheet(workbook);
XSSFWorkbook workbook2 = charts.get(secondChartNumber - 1).getWorkbook();
List<List<String>> source2 = ExcelKit.readSheet(workbook2);
List<List<String>> source1 = ExcelKit.getChartData(file.getAbsolutePath(), firstChartNumber, 1, 10);
List<List<String>> source2 = ExcelKit.getChartData(file.getAbsolutePath(), secondChartNumber, 1, 10);
String c2 = "总在校生";
//遍历source1

@ -28,7 +28,7 @@ public class C5 {
//示例Excel
static String sampleExcelPath = "D:\\dsWork\\YunNanDsBase\\Doc\\待处理\\市\\【5】普通高中招生总量规模变化及预测\\普通高中招生总量规模变化及预测.xlsx";
public static void main(String[] args) throws IOException, InvalidFormatException {
public static void main(String[] args) throws IOException, InvalidFormatException, InterruptedException {
//初始化数据库连接
LocalMysqlConnectUtil.Init();
//实例化
@ -65,19 +65,10 @@ public class C5 {
if (fileName.endsWith(".docx") && !fileName.startsWith("~")) {
System.out.println("正在处理" + cityName + "市州文件...");
//读取文件
String inputUrl = file.getAbsolutePath();
InputStream is = new FileInputStream(inputUrl);
ZipSecureFile.setMinInflateRatio(-1.0d);
XWPFDocument doc = new XWPFDocument(is);
//排序后的图表
List<XWPFChart> charts = ExcelKit.getSortListForXWPFChart(doc.getCharts());
//1号模板数据在图表11和34中
int firstChartNumber = 11, secondChartNumber = 34;
XSSFWorkbook workbook = charts.get(firstChartNumber - 1).getWorkbook();
List<List<String>> source1 = ExcelKit.readSheet(workbook);
XSSFWorkbook workbook2 = charts.get(secondChartNumber - 1).getWorkbook();
List<List<String>> source2 = ExcelKit.readSheet(workbook2);
List<List<String>> source1 = ExcelKit.getChartData(file.getAbsolutePath(), firstChartNumber, 1, 10);
List<List<String>> source2 = ExcelKit.getChartData(file.getAbsolutePath(), secondChartNumber, 1, 10);
String c2 = "总招生数";
//遍历source1

@ -28,7 +28,7 @@ public class C6 {
//示例Excel
static String sampleExcelPath = "D:\\dsWork\\YunNanDsBase\\Doc\\待处理\\市\\【6】普通高中在校生规模总量变化及预测\\普通高中在校生规模总量变化及预测.xlsx";
public static void main(String[] args) throws IOException, InvalidFormatException {
public static void main(String[] args) throws IOException, InvalidFormatException, InterruptedException {
//初始化数据库连接
LocalMysqlConnectUtil.Init();
//实例化
@ -65,19 +65,10 @@ public class C6 {
if (fileName.endsWith(".docx") && !fileName.startsWith("~")) {
System.out.println("正在处理" + cityName + "市州文件...");
//读取文件
String inputUrl = file.getAbsolutePath();
InputStream is = new FileInputStream(inputUrl);
ZipSecureFile.setMinInflateRatio(-1.0d);
XWPFDocument doc = new XWPFDocument(is);
//排序后的图表
List<XWPFChart> charts = ExcelKit.getSortListForXWPFChart(doc.getCharts());
//1号模板数据在图表12和35中
int firstChartNumber = 12, secondChartNumber = 35;
XSSFWorkbook workbook = charts.get(firstChartNumber - 1).getWorkbook();
List<List<String>> source1 = ExcelKit.readSheet(workbook);
XSSFWorkbook workbook2 = charts.get(secondChartNumber - 1).getWorkbook();
List<List<String>> source2 = ExcelKit.readSheet(workbook2);
List<List<String>> source1 = ExcelKit.getChartData(file.getAbsolutePath(), firstChartNumber, 1, 10);
List<List<String>> source2 = ExcelKit.getChartData(file.getAbsolutePath(), secondChartNumber, 1, 10);
String c2 = "总在校生数";
//遍历source1

Loading…
Cancel
Save