main
黄海 2 years ago
parent 7d2dac0972
commit 744ccccae6

@ -483,7 +483,7 @@ public class CollectController extends Controller {
}
// 检查通过,导入数据
for (int i = 0; i < sheetCnt; i++)
cm.importData(upload_excel_filename, wb, i, bureau_id, person_id);
cm.importData(job_id,upload_excel_filename, wb, i, bureau_id, person_id);
//回写完成标记
cm.writeJobFinish(job_id, bureau_id, upload_excel_filename_user);

@ -328,6 +328,7 @@ public class CollectModel {
finalSql += "\"id\" serial4,";
finalSql += "\"bureau_id\" char(36) NOT NULL,";
finalSql += "\"person_id\" char(36) NOT NULL,";
finalSql += "\"job_id\" int(4) NOT NULL,";
finalSql += colSql;
finalSql += "PRIMARY KEY (\"id\")";
finalSql += ");\n";
@ -335,6 +336,7 @@ public class CollectModel {
finalSql += "COMMENT ON COLUMN \"public\".\"" + table_name + "\".\"id\" IS '主键自增长ID';\n";
finalSql += "COMMENT ON COLUMN \"public\".\"" + table_name + "\".\"bureau_id\" IS '单位ID';\n";
finalSql += "COMMENT ON COLUMN \"public\".\"" + table_name + "\".\"person_id\" IS '上传人员ID';\n";
finalSql += "COMMENT ON COLUMN \"public\".\"" + table_name + "\".\"job_id\" IS '任务ID';\n";
finalSql += commentSql;
finalSql += "COMMENT ON TABLE \"public\".\"" + table_name + "\" IS '" + sheetName + "';";
//添加索引
@ -441,7 +443,7 @@ public class CollectModel {
*
* @throws ParseException
*/
public void importData(String upload_excel_filename, XSSFWorkbook wb,
public void importData(int job_id, String upload_excel_filename, XSSFWorkbook wb,
int sheetIdx, String bureau_id, String person_id) throws ParseException {
//读取sheet页
XSSFSheet sheet = wb.getSheetAt(sheetIdx);
@ -451,8 +453,8 @@ public class CollectModel {
String table_name = record.getStr("table_name");
//先删除
sql = "delete from " + table_name + " where bureau_id=?";
Db.update(sql, bureau_id);
sql = "delete from " + table_name + " where bureau_id=? and job_id=?";
Db.update(sql, bureau_id, job_id);
int data_start_row = record.getInt("data_start_row");
int column_num = record.getInt("column_num");
@ -481,6 +483,7 @@ public class CollectModel {
Record writeRecord = new Record();
writeRecord.set("bureau_id", bureau_id);
writeRecord.set("person_id", person_id);
writeRecord.set("job_id", job_id);
for (int j = 0; j < column_num; j++) {
XSSFCell cell = row.getCell(j);
String colType = _map.get(j).getStr("column_type");

Loading…
Cancel
Save