From ae60ad1dd19a86dd9723b199111bc3e2fb45f126 Mon Sep 17 00:00:00 2001
From: yubo <autumnal_wind@yeah.net>
Date: 星期五, 03 四月 2026 20:58:59 +0800
Subject: [PATCH] refactor(hr): 移除保险提醒相关冗余代码并调整退休延迟计算

---
 febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/util/PoiImportExcel.java |  124 +++++++++++++++++++++++++++++++++--------
 1 files changed, 99 insertions(+), 25 deletions(-)

diff --git a/febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/util/PoiImportExcel.java b/febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/util/PoiImportExcel.java
index 3f5b6e7..726aeb1 100644
--- a/febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/util/PoiImportExcel.java
+++ b/febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/util/PoiImportExcel.java
@@ -8,6 +8,8 @@
 import java.util.Date;
 import java.util.List;
 
+import cn.hutool.core.util.StrUtil;
+import com.esotericsoftware.minlog.Log;
 import org.apache.poi.hssf.usermodel.HSSFDataFormat;
 import org.apache.poi.hssf.usermodel.HSSFDateUtil;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
@@ -24,16 +26,16 @@
 
 	/**
 	 * 描述:获取IO流中的数据,组装成List<List<Object>>对象
-	 * 
+	 *
 	 * @param in,fileName
 	 * @return
 	 * @throws IOException
 	 */
-	public List<List<Object>> getListByExcel(InputStream in, String fileName) throws Exception {
+	public static List<List<Object>> getListByExcel(InputStream in, String fileName) throws Exception {
 		List<List<Object>> list = null;
 
 		// 创建Excel工作薄
-		Workbook work = this.getWorkbook(in, fileName);
+		Workbook work = getWorkbook(in, fileName);
 		if (null == work) {
 			throw new Exception("创建Excel工作薄为空!");
 		}
@@ -79,14 +81,14 @@
 		// 遍历当前sheet中的所有行
 		/*
 		 * int countCellNum = 0; for (int j = sheet.getFirstRowNum(); j <=
-		 * sheet.getLastRowNum(); j++) { row = sheet.getRow(j); if (row == null
-		 * || row.getFirstCellNum() == j) { if (row != null) countCellNum =
+		 * sheet.getLastRowNum(); j++) { row = sheet.getRow(j); if (row == null ||
+		 * row.getFirstCellNum() == j) { if (row != null) countCellNum =
 		 * row.getLastCellNum(); continue; }
-		 * 
+		 *
 		 * // 遍历所有的列 List<Object> li = new ArrayList<Object>(); for (int y = row
 		 * .getFirstCellNum(); y <= countCellNum; y++) { cell = row.getCell(y);
 		 * li.add(this.getCellValue(cell));
-		 * 
+		 *
 		 * } list.add(li); }
 		 */
 
@@ -95,13 +97,87 @@
 	}
 
 	/**
+	 * 描述:获取IO流中的数据,组装成List<List<List<Object>>>对象,多个sheet
+	 *
+	 * @param in,fileName
+	 * @return
+	 * @throws IOException
+	 */
+	public static List<List<List<Object>>> getMulitListByExcel(InputStream in, String fileName) throws Exception {
+		List<List<Object>> list = null;
+
+		// 创建Excel工作薄
+		Workbook work = getWorkbook(in, fileName);
+		if (null == work) {
+			throw new Exception("创建Excel工作薄为空!");
+		}
+		List<List<List<Object>>> returnList = new ArrayList<List<List<Object>>>();
+		try {
+            for (Sheet sheet : work) {
+                Row row = null;
+                Cell cell = null;
+
+                list = new ArrayList<List<Object>>();
+                if (sheet == null) {
+                    continue;
+                }
+                // 取得Excel的总列数,总行数
+                int columns = 0;
+                Row firstRow = sheet.getRow((short) 0);
+                if (firstRow != null) {
+                    columns = firstRow.getPhysicalNumberOfCells();
+                }
+
+                int rows = sheet.getPhysicalNumberOfRows();
+                List<Object> dataRow = null;
+
+                // 首行为定义标题的行,数据从第2行开始
+                for (int i = 1; i < rows; i++) {
+                    dataRow = new ArrayList<Object>();
+                    // 获取行
+                    row = sheet.getRow(i);
+                    if (row == null) {
+                        break;
+                    }
+
+                    cell = row.getCell(0);
+                    if (StrUtil.isBlank(getCellValue(cell).toString())) {
+                        break;
+                    }
+
+                    if (row != null) {
+                        // columns=row.getPhysicalNumberOfCells();//不在这里设置,通过firstRow来获取列数信息。
+                        for (int j = 0; j < columns; j++) {
+                            // 获取某行某列的某一个单元格
+                            cell = row.getCell(j);
+
+                            // 往dataRow存值
+                            dataRow.add(getCellValue(cell));
+                        }
+                        list.add(dataRow);
+                    } else {
+                        list.add(new ArrayList<>());
+                    }
+                }
+
+                work.close();
+                returnList.add(list);
+            }
+        } catch (Exception e){
+            Log.error(e.getMessage());
+        }
+
+		return returnList;
+	}
+
+	/**
 	 * 描述:根据文件后缀,自适应上传文件的版本
-	 * 
+	 *
 	 * @param inStr,fileName
 	 * @return
 	 * @throws Exception
 	 */
-	public Workbook getWorkbook(InputStream inStr, String fileName) throws Exception {
+	public static Workbook getWorkbook(InputStream inStr, String fileName) throws Exception {
 		Workbook wb = null;
 		String fileType = fileName.substring(fileName.lastIndexOf("."));
 		if (excel2003L.equals(fileType)) {
@@ -116,12 +192,12 @@
 
 	/**
 	 * 描述:对表格中数值进行格式化
-	 * 
+	 *
 	 * @param cell
 	 * @return
 	 */
 	@SuppressWarnings("deprecation")
-	public Object getCellValue(Cell cell) {
+	public static Object getCellValue(Cell cell) {
 		try {
 			Object value = null;
 
@@ -129,25 +205,23 @@
 				value = "";
 				return value;
 			}
-
-			DecimalFormat df = new DecimalFormat("0"); // 格式化number String字符
-			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // 日期格式化
-			DecimalFormat df2 = new DecimalFormat("0.00"); // 格式化数字
+            // 格式化number String字符
+			DecimalFormat df = new DecimalFormat("0");
+            // 日期格式化
+			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            // 格式化数字
+			DecimalFormat df2 = new DecimalFormat("0.00");
 
 			switch (cell.getCellType()) {
 			case Cell.CELL_TYPE_STRING:
 				value = cell.getRichStringCellValue().getString();
 				break;
 			case Cell.CELL_TYPE_NUMERIC:
-				if (HSSFDateUtil.isCellDateFormatted(cell)) {// 处理日期格式、时间格式
-
-					if (cell.getCellStyle().getDataFormat() == HSSFDataFormat.getBuiltinFormat("h:mm")
-							|| cell.getCellStyle().getDataFormat() == 176) {
-						sdf = new SimpleDateFormat("HH:mm");
-					}
-					Date date = cell.getDateCellValue();
-					value = sdf.format(date);
-
+				if (HSSFDateUtil.isCellDateFormatted(cell)) {
+                        // 处理日期格式、时间格式
+                    Date date = cell.getDateCellValue();
+                    sdf = new SimpleDateFormat("yyyy-MM-dd");
+                    value = sdf.format(date);
 				} else if (cell.getCellStyle().getDataFormat() == 58) {
 					// 处理自定义日期格式:m月d日(通过判断单元格的格式id解决,id的值是58)
 					SimpleDateFormat sdf2 = new SimpleDateFormat("MM-dd");
@@ -187,4 +261,4 @@
 
 	}
 
-}
\ No newline at end of file
+}

--
Gitblit v1.8.0