|
|
|
@ -95,7 +95,7 @@ public class CollectModel {
|
|
|
|
|
rSheet.set("end_column", end_column);
|
|
|
|
|
rSheet.set("data_start_row", data_start_row);
|
|
|
|
|
rSheet.set("column_num", column_num);
|
|
|
|
|
rSheet.set("upload_excel_filename", upload_excel_filename);
|
|
|
|
|
rSheet.set("upload_excel_filename_finish", "");
|
|
|
|
|
Db.save("t_collect_job_sheet", "job_id,sheet_index", rSheet);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -241,6 +241,12 @@ public class CollectModel {
|
|
|
|
|
public void saveJob(int job_id, String job_name, String upload_excel_filename_finish) {
|
|
|
|
|
String sql = "update t_collect_job set job_name=?,upload_excel_filename_finish=?,is_save=1 where job_id=?";
|
|
|
|
|
Db.update(sql, job_name, upload_excel_filename_finish, job_id);
|
|
|
|
|
|
|
|
|
|
sql = "update t_collect_job_sheet set upload_excel_filename_finish=? where job_id=?";
|
|
|
|
|
Db.update(sql, upload_excel_filename_finish, job_id);
|
|
|
|
|
|
|
|
|
|
sql = "update t_collect_mapping set upload_excel_filename_finish=? where job_id=?";
|
|
|
|
|
Db.update(sql, upload_excel_filename_finish, job_id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -358,7 +364,7 @@ public class CollectModel {
|
|
|
|
|
record.set("original_name", list.get(i).getStr("original_name"));
|
|
|
|
|
record.set("allow_blank", list.get(i).getBoolean("allow_blank"));
|
|
|
|
|
record.set("column_type", convertDataType(list.get(i).getStr("data_type_id")));
|
|
|
|
|
record.set("upload_excel_filename", upload_excel_filename);
|
|
|
|
|
record.set("upload_excel_filename_finish", "");
|
|
|
|
|
record.set("sheet_index", sheet_index);
|
|
|
|
|
record.set("sheet_name", sheet_name);
|
|
|
|
|
record.set("options", list.get(i).getStr("options"));
|
|
|
|
@ -406,7 +412,7 @@ public class CollectModel {
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public Record getSheetConfig(String upload_excel_filename, int sheet_index) {
|
|
|
|
|
String sql = "select * from t_collect_job_sheet where upload_excel_filename=? and sheet_index=?";
|
|
|
|
|
String sql = "select * from t_collect_job_sheet where upload_excel_filename_finish=? and sheet_index=?";
|
|
|
|
|
return Db.findFirst(sql, upload_excel_filename, sheet_index);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -417,7 +423,7 @@ public class CollectModel {
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public int getSheetCount(String upload_excel_filename) {
|
|
|
|
|
String sql = "select * from t_collect_job_sheet where upload_excel_filename=?";
|
|
|
|
|
String sql = "select * from t_collect_job_sheet where upload_excel_filename_finish=?";
|
|
|
|
|
List<Record> list = Db.find(sql, upload_excel_filename);
|
|
|
|
|
return list.size();
|
|
|
|
|
}
|
|
|
|
@ -425,13 +431,13 @@ public class CollectModel {
|
|
|
|
|
/**
|
|
|
|
|
* 功能:获取指定模板+指定Sheet中所有列的限制条件
|
|
|
|
|
*
|
|
|
|
|
* @param upload_excel_filename
|
|
|
|
|
* @param upload_excel_filename_finish
|
|
|
|
|
* @param sheet_index
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public List<Record> getSheetMapping(String upload_excel_filename, int sheet_index) {
|
|
|
|
|
String sql = "select * from t_collect_mapping where upload_excel_filename=? and sheet_index=?";
|
|
|
|
|
return Db.find(sql, upload_excel_filename, sheet_index);
|
|
|
|
|
public List<Record> getSheetMapping(String upload_excel_filename_finish, int sheet_index) {
|
|
|
|
|
String sql = "select * from t_collect_mapping where upload_excel_filename_finish=? and sheet_index=?";
|
|
|
|
|
return Db.find(sql, upload_excel_filename_finish, sheet_index);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -439,13 +445,13 @@ public class CollectModel {
|
|
|
|
|
*
|
|
|
|
|
* @throws ParseException
|
|
|
|
|
*/
|
|
|
|
|
public void importData(int job_id, String upload_excel_filename, XSSFWorkbook wb,
|
|
|
|
|
public void importData(int job_id, String upload_excel_filename_finish, XSSFWorkbook wb,
|
|
|
|
|
int sheetIdx, String bureau_id, String person_id) throws ParseException {
|
|
|
|
|
//读取sheet页
|
|
|
|
|
XSSFSheet sheet = wb.getSheetAt(sheetIdx);
|
|
|
|
|
//通过表名获取到它的读取起始行,终止列
|
|
|
|
|
String sql = "select * from t_collect_job_sheet where upload_excel_filename=? and sheet_index=?";
|
|
|
|
|
Record record = Db.findFirst(sql, upload_excel_filename, sheetIdx);
|
|
|
|
|
String sql = "select * from t_collect_job_sheet where upload_excel_filename_finish=? and sheet_index=?";
|
|
|
|
|
Record record = Db.findFirst(sql, upload_excel_filename_finish, sheetIdx);
|
|
|
|
|
String table_name = record.getStr("table_name");
|
|
|
|
|
|
|
|
|
|
//先删除
|
|
|
|
@ -456,8 +462,8 @@ public class CollectModel {
|
|
|
|
|
int column_num = record.getInt("column_num");
|
|
|
|
|
|
|
|
|
|
//获取字段与EXCEL列的映射信息
|
|
|
|
|
sql = "select * from t_collect_mapping where upload_excel_filename=? and sheet_index=?";
|
|
|
|
|
List<Record> list = Db.find(sql, upload_excel_filename, sheetIdx);
|
|
|
|
|
sql = "select * from t_collect_mapping where upload_excel_filename_finish=? and sheet_index=?";
|
|
|
|
|
List<Record> list = Db.find(sql, upload_excel_filename_finish, sheetIdx);
|
|
|
|
|
Map<Integer, Record> _map = new HashMap<>();
|
|
|
|
|
for (Record r : list) {
|
|
|
|
|
int excel_column_idx = r.getInt("excel_column_idx");
|
|
|
|
|