main
黄海 9 months ago
parent 570f08b135
commit 32bba254d6

@ -81,45 +81,29 @@ public class C1 {
List<List<String>> source2 = ExcelKit.readSheet(workbook2); List<List<String>> source2 = ExcelKit.readSheet(workbook2);
//遍历source1 //遍历source1
for (int i = 0; i < source1.size(); i++) { for (List<String> r : source1) {
List<String> r = source1.get(i);
Row outRow = outSheet.createRow(++rowIndex); Row outRow = outSheet.createRow(++rowIndex);
// 需要写死列的对应关系 // 导出数据
ExcelKit.putData(outRow, new ArrayList<>(Arrays.asList(r.getFirst(), "总入园数", "", r.get(4), "", cityName, "云南省")), dataStyle);
//年份,总量分类,区域分类,总量数值,区域数值,行政区划,上级行政区划 //年份,总量分类,区域分类,总量数值,区域数值,行政区划,上级行政区划
ExcelKit.putData(outRow, new ArrayList<>(Arrays.asList(r.getFirst(), "总入园数", "", r.get(4), "", cityName, "云南省")), dataStyle);
} }
//遍历source2 //遍历source2
for (int i = 0; i < source2.size(); i++) { for (int i = 0; i < source2.size(); i++) {
if (i == 0) continue;//跳过2022年这个年份重复了 if (i == 0) continue;//跳过2022年这个年份重复了
List<String> r = source2.get(i); List<String> r = source2.get(i);
Row outRow = outSheet.createRow(++rowIndex); Row outRow = outSheet.createRow(++rowIndex);
// 需要写死列的对应关系 // 导出数据
outRow.createCell(0).setCellValue(r.getFirst());//年份 //年份,总量分类,区域分类,总量数值,区域数值,行政区划,上级行政区划
outRow.createCell(1).setCellValue("总入园数");//总量分类 ExcelKit.putData(outRow, new ArrayList<>(Arrays.asList(r.getFirst(), "总入园数", "", r.get(4), "", cityName, "云南省")), dataStyle);
outRow.createCell(2).setCellValue("");//区域分类
outRow.createCell(3).setCellValue(r.get(4));//总量数值
outRow.createCell(4).setCellValue("");//区域数值
outRow.createCell(5).setCellValue(cityName);//行政区划
outRow.createCell(6).setCellValue("云南省");//上级行政区划
//应用一下样式
ExcelKit.applyStyle(outRow, 0, 6, dataStyle);
} }
//2022年基数:遍历source2 //2022年基数:遍历source2
for (int i = 0; i < source2.size(); i++) { for (int i = 0; i < source2.size(); i++) {
List<String> r = source2.get(i); List<String> r = source2.get(i);
Row outRow = outSheet.createRow(++rowIndex); Row outRow = outSheet.createRow(++rowIndex);
// 需要写死列的对应关系 // 导出数据
outRow.createCell(0).setCellValue(r.getFirst());//年份 //年份,总量分类,区域分类,总量数值,区域数值,行政区划,上级行政区划
outRow.createCell(1).setCellValue("2022年基数");//基数 ExcelKit.putData(outRow, new ArrayList<>(Arrays.asList(r.getFirst(), "2022年基数", "", source2.getFirst().get(4),
outRow.createCell(2).setCellValue("");//区域分类 "", cityName, "云南省")), dataStyle);
outRow.createCell(3).setCellValue(source2.getFirst().get(4));//总量数值
outRow.createCell(4).setCellValue("");//区域数值
outRow.createCell(5).setCellValue(cityName);//行政区划
outRow.createCell(6).setCellValue("云南省");//上级行政区划
//应用一下样式
ExcelKit.applyStyle(outRow, 0, 6, dataStyle);
} }
//城区+镇区+乡村 //城区+镇区+乡村
List<String> areaList = new ArrayList<>(); List<String> areaList = new ArrayList<>();

Loading…
Cancel
Save