登录 权限 放行 功能整理
This commit is contained in:
@@ -5,6 +5,7 @@ import com.roomroot.jwgl.dto.courserunning.SemesterImportDTO;
|
||||
import com.roomroot.jwgl.dto.courserunning.SingleCourseImportDTO;
|
||||
import com.roomroot.jwgl.dto.departmentpersonnel.DepartmentPersonnelCreateDTO;
|
||||
import com.roomroot.jwgl.entity.JXSSJH;
|
||||
import com.roomroot.jwgl.entity.JYSB;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.CellType;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
@@ -169,6 +170,51 @@ public class ExcelParseUtil {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析教研室数据导入 Excel 文件。
|
||||
* Excel 表头顺序:教研室标识号、序号、教研室名称、简称、部系
|
||||
*
|
||||
* @param inputStream Excel 文件输入流
|
||||
* @param fileName 文件名
|
||||
* @return 教研室实体列表(默认字段与必填校验由外部完成)
|
||||
* @throws Exception 解析异常
|
||||
*/
|
||||
public static List<JYSB> parseJYSBExcel(InputStream inputStream, String fileName) throws Exception {
|
||||
List<JYSB> result = new ArrayList<>();
|
||||
|
||||
Workbook workbook = createWorkbook(inputStream, fileName);
|
||||
try {
|
||||
Sheet sheet = workbook.getSheetAt(0);
|
||||
int firstDataRow = 1;
|
||||
int lastRowNum = sheet.getLastRowNum();
|
||||
|
||||
for (int rowNum = firstDataRow; rowNum <= lastRowNum; rowNum++) {
|
||||
Row row = sheet.getRow(rowNum);
|
||||
if (row == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
JYSB entity = new JYSB();
|
||||
// 教研室标识号
|
||||
entity.setJysdh(getCellStringValue(row.getCell(0)));
|
||||
// 序号
|
||||
entity.setXh(getCellStringValue(row.getCell(1)));
|
||||
// 教研室名称
|
||||
entity.setJysmc(getCellStringValue(row.getCell(2)));
|
||||
// 简称
|
||||
entity.setJc(getCellStringValue(row.getCell(3)));
|
||||
// 部系
|
||||
entity.setBx(getCellStringValue(row.getCell(4)));
|
||||
|
||||
result.add(entity);
|
||||
}
|
||||
} finally {
|
||||
workbook.close();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static Workbook createWorkbook(InputStream inputStream, String fileName) throws Exception {
|
||||
String name = fileName == null ? "" : fileName.toLowerCase();
|
||||
if (!name.endsWith(".xlsx") && !name.endsWith(".xls")) {
|
||||
|
||||
Reference in New Issue
Block a user