|
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.io.FileUtil;
|
|
|
|
|
import com.dsideal.base.Tools.FillData.ExcelKit.ExcelKit;
|
|
|
|
|
import com.dsideal.base.Tools.Util.LocalMysqlConnectUtil;
|
|
|
|
|
import com.dsideal.base.Tools.Util.ReadDocxUtil;
|
|
|
|
|
import com.jfinal.kit.StrKit;
|
|
|
|
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
|
|
|
|
import org.apache.poi.openxml4j.util.ZipSecureFile;
|
|
|
|
|
import org.apache.poi.ss.usermodel.Row;
|
|
|
|
@ -63,7 +64,7 @@ public class C10 {
|
|
|
|
|
|
|
|
|
|
//判断是否为docx文件
|
|
|
|
|
if (fileName.endsWith(".docx") && !fileName.startsWith("~")) {
|
|
|
|
|
System.out.println("正在处理" + cityName + "市州文件...");
|
|
|
|
|
System.out.println("正在处理" + cityName + "市州文件:" + fileName);
|
|
|
|
|
//读取文件
|
|
|
|
|
String inputUrl = file.getAbsolutePath();
|
|
|
|
|
InputStream is = new FileInputStream(inputUrl);
|
|
|
|
@ -73,7 +74,7 @@ public class C10 {
|
|
|
|
|
List<XWPFChart> charts = ExcelKit.getSortListForXWPFChart(doc.getCharts());
|
|
|
|
|
|
|
|
|
|
//数据在图表2
|
|
|
|
|
int firstChartNumber = 1,secondChartNumber = 3;
|
|
|
|
|
int firstChartNumber = 1, secondChartNumber = 3;
|
|
|
|
|
|
|
|
|
|
XSSFWorkbook workbook = charts.get(firstChartNumber).getWorkbook();
|
|
|
|
|
List<List<String>> source1 = ExcelKit.readSheet(workbook, 6);//从2017年开始
|
|
|
|
@ -93,11 +94,26 @@ public class C10 {
|
|
|
|
|
double xvalue = Double.parseDouble(r.get(2));
|
|
|
|
|
|
|
|
|
|
if (year <= 2023) {
|
|
|
|
|
ExcelKit.putData(outRow, new ArrayList<>(Arrays.asList("云南省",cityName, r.getFirst(), String.format("%.2f", cvalue), "",String.format("%.2f", xvalue),"")), dataStyle);
|
|
|
|
|
} else {
|
|
|
|
|
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, r.getFirst(), String.format("%.2f", cvalue), "", String.format("%.2f", xvalue), "")), dataStyle);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//遍历source3
|
|
|
|
|
// for (List<String> r : source3) {
|
|
|
|
|
// Row outRow = outSheet.createRow(++rowIndex);
|
|
|
|
|
// // 导出数据
|
|
|
|
|
// //上级行政区划,行政区划,年份,城镇人口变化,城镇人口预测,乡村人口变化,乡村人口预测
|
|
|
|
|
// int year = Integer.parseInt(r.getFirst());
|
|
|
|
|
// //城镇
|
|
|
|
|
// double cvalue = 0;
|
|
|
|
|
// if (!StrKit.isBlank(r.get(1))) cvalue = Double.parseDouble(r.get(1));
|
|
|
|
|
// //乡村
|
|
|
|
|
// double xvalue = 0;
|
|
|
|
|
// if (!StrKit.isBlank(r.get(2))) xvalue = Double.parseDouble(r.get(2));
|
|
|
|
|
//
|
|
|
|
|
// if (year > 2023) {
|
|
|
|
|
// ExcelKit.putData(outRow, new ArrayList<>(Arrays.asList("云南省", cityName, r.getFirst(), "", String.format("%.2f", cvalue), "", String.format("%.2f", xvalue))), dataStyle);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|