parent
71aeacce5b
commit
a2e0968266
@ -1,67 +0,0 @@
|
||||
package com.dsideal.base.Tools.Test;
|
||||
|
||||
import com.dsideal.base.DataEase.Model.DataEaseModel;
|
||||
import com.dsideal.base.Tools.Util.LocalMysqlConnectUtil;
|
||||
import com.jcraft.jsch.JSchException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import com.jfinal.plugin.activerecord.Record;
|
||||
|
||||
public class ExportExcel {
|
||||
public static DataEaseModel dm = new DataEaseModel();
|
||||
|
||||
public static void main(String[] args) throws IOException, JSchException {
|
||||
LocalMysqlConnectUtil.Init();
|
||||
|
||||
//Excel的保存目录
|
||||
String exportPath = "D:/360Downloads/Excel";
|
||||
File directory = new File(exportPath);
|
||||
// 检查目录是否存在
|
||||
if (!directory.exists()) {
|
||||
directory.mkdirs();
|
||||
}
|
||||
String privinceName = "云南省";
|
||||
//一、导出省的数据集
|
||||
System.out.println("正在处理省数据集...");
|
||||
List<Record> list = dm.getDataSetByIdentityId(1,null);
|
||||
System.out.println("数据集个数=" + list.size());
|
||||
for (Record record : list) {
|
||||
String tableName = record.getStr("table_name");
|
||||
String dataSetName = record.getStr("dataset_name");
|
||||
System.out.println("正在处理数据集:" + dataSetName);
|
||||
dm.exportExcel(1, tableName, exportPath, privinceName);
|
||||
}
|
||||
//二、导出市的数据集
|
||||
System.out.println("正在处理市数据集...");
|
||||
String city_name = "昆明市";
|
||||
list = dm.getDataSetByIdentityId(2,null);
|
||||
System.out.println("数据集个数=" + list.size());
|
||||
for (Record record : list) {
|
||||
String tableName = record.getStr("table_name");
|
||||
String dataSetName = record.getStr("dataset_name").replace("\\", "").replace("/", "");
|
||||
System.out.println("正在处理数据集:" + dataSetName);
|
||||
|
||||
Record cityRecord = dm.getAreaByName(city_name);
|
||||
String cityName = cityRecord.getStr("area_name");
|
||||
dm.exportExcel(2, tableName, exportPath, cityName);
|
||||
}
|
||||
//三、导出县区的数据集
|
||||
System.out.println("正在处理县区数据集...");
|
||||
String area_name = "寻甸县";
|
||||
list = dm.getDataSetByIdentityId(3,null);
|
||||
System.out.println("数据集个数=" + list.size());
|
||||
for (Record record : list) {
|
||||
String tableName = record.getStr("table_name");
|
||||
String dataSetName = record.getStr("dataset_name").replace("\\", "").replace("/", "");
|
||||
System.out.println("正在处理数据集:" + dataSetName);
|
||||
|
||||
Record areaRecord = dm.getAreaByName(area_name);
|
||||
String areaName = areaRecord.getStr("area_name");
|
||||
dm.exportExcel(3, tableName, exportPath, areaName);
|
||||
}
|
||||
System.out.println("导出完成!");
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
package com.dsideal.base.Tools.Test;
|
||||
|
||||
import com.dsideal.base.Tools.FillData.ExcelKit.ExcelKit;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.List;
|
||||
|
||||
public class TestCallPython {
|
||||
|
||||
|
||||
public static void main(String[] args) throws InterruptedException, IOException {
|
||||
//哪个word文档
|
||||
String docPath = "D:\\dsWork\\YunNanDsBase\\Doc\\全省及州市县区人口与教育报告集20241023\\16个州市报告2022\\分析报告20240510\\丽江市人口变化及其对教育的影响20240418.docx";
|
||||
//第几个图表
|
||||
int tuBiaoNum = 1;
|
||||
//Excel文件生成位置
|
||||
String excelPath = "c:/task.xlsx";
|
||||
|
||||
//读取生成的EXCEL,使用POI就可以了
|
||||
List<List<String>> sheetList = ExcelKit.readSheet(excelPath, 1);
|
||||
System.out.println(sheetList);
|
||||
}
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
package com.dsideal.base.Tools.Test;
|
||||
|
||||
import com.dsideal.base.DataEase.Model.DataEaseModel;
|
||||
import com.dsideal.base.Tools.Util.LocalMysqlConnectUtil;
|
||||
import com.jfinal.plugin.activerecord.Db;
|
||||
import com.jfinal.plugin.activerecord.Record;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TestCityArea {
|
||||
public static void main(String[] args) throws Exception {
|
||||
LocalMysqlConnectUtil.Init();
|
||||
//实例化
|
||||
DataEaseModel dm=new DataEaseModel();
|
||||
List<String> list = dm.getCityNameList();
|
||||
for (String s : list) {
|
||||
String sql = "select id from t_dm_area where area_name=?";
|
||||
String area_id = Db.queryStr(sql, s);
|
||||
sql = "select * from t_dm_area where parent_id=?";
|
||||
List<Record> records = Db.find(sql, area_id);
|
||||
for (Record record : records) {
|
||||
String area_name = record.getStr("area_name");
|
||||
System.out.println(s+" "+area_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
package com.dsideal.base.Tools.Test;
|
||||
|
||||
import com.dsideal.base.Tools.FillData.ExcelKit.ExcelKit;
|
||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||
import org.dom4j.DocumentException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
public class TestXml {
|
||||
|
||||
|
||||
public static void main(String[] args) throws DocumentException, IOException, InterruptedException, InvalidFormatException {
|
||||
String sourceDoc = "c:/西双版纳州人口变化及其对教育的影响20240420.docx";
|
||||
List<List<String>> res = ExcelKit.getChartData(sourceDoc, 1,0);
|
||||
ExcelKit.printTable(res);
|
||||
// for (int chartNumber = 1; chartNumber <= 37; chartNumber++) {
|
||||
// String xml = ExcelKit.DocxUnzipDirectory + "word\\charts\\chart" + chartNumber + ".xml";
|
||||
// List<List<String>> res = ExcelKit.getChartDataByXml(xml);
|
||||
// //输出转置后的数据
|
||||
// System.out.println("正在输出第" + chartNumber + "个图表的数据");
|
||||
// ExcelKit.printTable(res);
|
||||
// }
|
||||
}
|
||||
}
|
Loading…
Reference in new issue