|
|
|
@ -31,9 +31,7 @@ import org.apache.poi.ss.usermodel.*;
|
|
|
|
|
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
|
|
|
|
import org.apache.poi.xssf.usermodel.*;
|
|
|
|
|
|
|
|
|
|
import java.io.FileInputStream;
|
|
|
|
|
import java.io.FileOutputStream;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.io.*;
|
|
|
|
|
import java.text.ParseException;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.*;
|
|
|
|
@ -671,6 +669,7 @@ public class CollectModel {
|
|
|
|
|
for (int colNum = 0; colNum < ed.getLastCellNum(); colNum++) {
|
|
|
|
|
if (StrKit.isBlank(ed.getCell(colNum).toString())) {//下面没有,应该听上面的
|
|
|
|
|
original_name = CommonUtil.removeKuoHao(st.getCell(colNum).toString().replace("\n", ""));
|
|
|
|
|
if (StrKit.isBlank(original_name)) continue;
|
|
|
|
|
column_name = ChineseCharacterUtil.getColumnNameByMemo(CommonUtil.removeKuoHao(st.getCell(colNum).toString()));
|
|
|
|
|
Record record = new Record();
|
|
|
|
|
record.set("original_name", original_name);
|
|
|
|
@ -3125,10 +3124,81 @@ public class CollectModel {
|
|
|
|
|
/**
|
|
|
|
|
* 功能:更新Excel中Sheet表与学段的对应关系
|
|
|
|
|
*/
|
|
|
|
|
public void updateSheetStage(int job_id, int sheet_index, int stage_id) {
|
|
|
|
|
public void updateSheetStage(int job_id, int sheet_index, int stage_id, int b_use) {
|
|
|
|
|
String sql = "delete from t_collect_sheet_stage where job_id=? and sheet_index=?";
|
|
|
|
|
Db.update(sql, job_id, sheet_index);
|
|
|
|
|
sql = "insert into t_collect_sheet_stage(job_id,sheet_index,stage_id) values(?,?,?)";
|
|
|
|
|
sql = "insert into t_collect_sheet_stage(job_id,sheet_index,stage_id,b_use) values(?,?,?,?)";
|
|
|
|
|
Db.update(sql, job_id, sheet_index, stage_id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:获取指定任务的模板与学段的对应关系
|
|
|
|
|
*
|
|
|
|
|
* @param job_id
|
|
|
|
|
*/
|
|
|
|
|
public List<Record> getSheetStage(int job_id) {
|
|
|
|
|
String sql = "select * from t_collect_sheet_stage where job_id=?";
|
|
|
|
|
return Db.find(sql, job_id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:一键智能处理哪些Sheet对应哪些学段
|
|
|
|
|
*
|
|
|
|
|
* @param job_id
|
|
|
|
|
*/
|
|
|
|
|
public void intelligenceSheetStage(int job_id) {
|
|
|
|
|
//1、整体上都修改为0,表示一个都不要
|
|
|
|
|
String sql = "update t_collect_sheet_stage set b_use=0 where job_id=?";
|
|
|
|
|
Db.update(sql, job_id);
|
|
|
|
|
|
|
|
|
|
//2、遍历这个任务的所有Sheet表
|
|
|
|
|
sql = "select sheet_index,sheet_name from t_collect_job_sheet where job_id=?";
|
|
|
|
|
List<Record> list = Db.find(sql, job_id);
|
|
|
|
|
|
|
|
|
|
//3、如果Sheet表的表名中存在小学,初中,高中字样,那么认为这个Sheet表对应小学,初中,高中
|
|
|
|
|
for (Record record : list) {
|
|
|
|
|
int sheet_index = record.getInt("sheet_index");
|
|
|
|
|
String sheetName = record.getStr("sheet_name");
|
|
|
|
|
|
|
|
|
|
sql = "update t_collect_sheet_stage set b_use=1 where job_id=? and sheet_index=? and stage_id=";
|
|
|
|
|
if (sheetName.indexOf("小学") >= 0) {
|
|
|
|
|
sql += 4;
|
|
|
|
|
} else if (sheetName.indexOf("初中") >= 0) {
|
|
|
|
|
sql += 5;
|
|
|
|
|
} else if (sheetName.indexOf("高中") >= 0) {
|
|
|
|
|
sql += 6;
|
|
|
|
|
}
|
|
|
|
|
Db.update(sql, job_id, sheet_index);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:通过用户设置过的此模板中,学段与Sheet表的对应关系,删除一些不在上面学段内需要填报的表格,提供新的上报模板文件给用户
|
|
|
|
|
*
|
|
|
|
|
* @param job_id
|
|
|
|
|
* @param excelPath
|
|
|
|
|
* @param schoolStageList
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public File getReduceExcel(int job_id, String excelPath, List<Integer> schoolStageList) {
|
|
|
|
|
String stageIds = "";
|
|
|
|
|
for (Integer i : schoolStageList) {
|
|
|
|
|
stageIds += i + ",";
|
|
|
|
|
}
|
|
|
|
|
if (stageIds.length() > 0) stageIds = stageIds.substring(0, stageIds.length() - 1);
|
|
|
|
|
List<Integer> sheetIndexList = new ArrayList<>();
|
|
|
|
|
String sql = "select sheet_index from t_collect_sheet_stage where job_id=? and stage_id in (" + stageIds + ") and b_use=1 order by sheet_index";//要保留哪些
|
|
|
|
|
List<Record> list = Db.find(sql, job_id);
|
|
|
|
|
for (Record record : list) {
|
|
|
|
|
sheetIndexList.add(record.getInt("sheet_index"));
|
|
|
|
|
}
|
|
|
|
|
// 生成随机UUID
|
|
|
|
|
UUID uuid = UUID.randomUUID();
|
|
|
|
|
// 将UUID转换为字符串
|
|
|
|
|
String uuidString = uuid.toString();
|
|
|
|
|
// 创建临时文件路径
|
|
|
|
|
File tempFile = new File(System.getProperty("java.io.tmpdir") + File.separator + uuidString + ".xlsx");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|