|
|
|
@ -111,15 +111,15 @@ public class GenericTemplateUtil {
|
|
|
|
|
* @return 不一样的位置集合
|
|
|
|
|
* @throws IOException
|
|
|
|
|
*/
|
|
|
|
|
public static List<Map.Entry<Integer, Integer>> checkYiZhi(String f1, String f2, int startRow, int endRow, int startCol, int endCol) throws IOException {
|
|
|
|
|
public static List<Map.Entry<Integer, Integer>> checkYiZhi(String f1, String f2, int sheetIdx, int startRow, int endRow, int startCol, int endCol) throws IOException {
|
|
|
|
|
FileInputStream file1 = new FileInputStream(f1);
|
|
|
|
|
FileInputStream file2 = new FileInputStream(f2);
|
|
|
|
|
List<Map.Entry<Integer, Integer>> errList = new ArrayList<>();
|
|
|
|
|
Workbook wb1 = WorkbookFactory.create(file1);
|
|
|
|
|
Workbook wb2 = WorkbookFactory.create(file2);
|
|
|
|
|
|
|
|
|
|
Sheet sheet1 = wb1.getSheetAt(0);
|
|
|
|
|
Sheet sheet2 = wb2.getSheetAt(0);
|
|
|
|
|
Sheet sheet1 = wb1.getSheetAt(sheetIdx);
|
|
|
|
|
Sheet sheet2 = wb2.getSheetAt(sheetIdx);
|
|
|
|
|
|
|
|
|
|
for (int i = startRow; i <= endRow; i++) {
|
|
|
|
|
Row row1 = sheet1.getRow(i);
|
|
|
|
@ -187,14 +187,21 @@ public class GenericTemplateUtil {
|
|
|
|
|
kv.set("success", true);
|
|
|
|
|
kv.set("message", "表结构获取成功!");
|
|
|
|
|
kv.set("list", list);
|
|
|
|
|
kv.set("start_row", st.getRowNum());//表头开始行
|
|
|
|
|
kv.set("end_row", ed.getRowNum());//表头结束行
|
|
|
|
|
kv.set("start_column", 0);//表头开始列
|
|
|
|
|
kv.set("end_column", ed.getLastCellNum());//表头结束列
|
|
|
|
|
|
|
|
|
|
kv.set("data_start_row", ed.getRowNum() + 1);//真实数据的起始行索引
|
|
|
|
|
kv.set("column_num", ed.getLastCellNum());//一共多少列
|
|
|
|
|
kv.set("sheet_name", sheetName);
|
|
|
|
|
kv.set("sheet_index", sheetIdx);//Sheet索引号
|
|
|
|
|
kv.set("sheet_name", sheetName);//Sheet名称
|
|
|
|
|
return kv;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:PG数据库数据类型与EXCEL中数据类型的转换关系
|
|
|
|
|
*
|
|
|
|
|
* @param pgColumnDataType
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
@ -260,6 +267,32 @@ public class GenericTemplateUtil {
|
|
|
|
|
}
|
|
|
|
|
Db.batchSave("t_importexcel_mapping", writeList, 100);
|
|
|
|
|
|
|
|
|
|
//记录模板文件的头文件位置,开始行,结束行,开始列,结束列
|
|
|
|
|
sql = "delete from t_importexcel_config where upload_excel_filename=? and table_name=?";
|
|
|
|
|
Db.update(sql, upload_excel_filename, tableName);
|
|
|
|
|
|
|
|
|
|
int start_row = input.getInt("start_row");
|
|
|
|
|
int end_row = input.getInt("end_row");
|
|
|
|
|
int start_column = input.getInt("start_column");
|
|
|
|
|
int end_column = input.getInt("end_column");
|
|
|
|
|
int sheet_index = input.getInt("sheet_index");
|
|
|
|
|
int data_start_row = input.getInt("data_start_row");
|
|
|
|
|
int column_num = input.getInt("column_num");
|
|
|
|
|
|
|
|
|
|
String sheet_name = input.getStr("sheet_name");
|
|
|
|
|
Record record = new Record();
|
|
|
|
|
record.set("upload_excel_filename", upload_excel_filename);
|
|
|
|
|
record.set("table_name", tableName);
|
|
|
|
|
record.set("start_row", start_row);
|
|
|
|
|
record.set("end_row", end_row);
|
|
|
|
|
record.set("start_column", start_column);
|
|
|
|
|
record.set("end_column", end_column);
|
|
|
|
|
record.set("sheet_index", sheet_index);
|
|
|
|
|
record.set("sheet_name", sheet_name);
|
|
|
|
|
record.set("data_start_row", data_start_row);
|
|
|
|
|
record.set("column_num", column_num);
|
|
|
|
|
Db.save("t_importexcel_config", "id", record);
|
|
|
|
|
|
|
|
|
|
Kv kv = Kv.create();
|
|
|
|
|
kv.set("success", true);
|
|
|
|
|
kv.set("message", "表结构创建成功!");
|
|
|
|
|