From b02beccf4567068cb47a3f1181a00039456c872d Mon Sep 17 00:00:00 2001 From: zqy <2522236926@qq.com> Date: 星期三, 06 八月 2025 15:37:20 +0800 Subject: [PATCH] 用户修改姓名和电话同步修改uaid --- ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 44 insertions(+), 1 deletions(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java index 755292b..81c0188 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java @@ -24,6 +24,8 @@ import java.util.UUID; import java.util.stream.Collectors; import javax.servlet.http.HttpServletResponse; + +import com.alibaba.excel.EasyExcel; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.RegExUtils; import org.apache.commons.lang3.reflect.FieldUtils; @@ -428,6 +430,11 @@ { if (val instanceof String) { + System.out.println("====++++++++"); + System.out.println(val); + if(((String) val).contains("/")) + val = ((String) val).replace("/","-"); + System.out.println(val); val = DateUtils.parseDate(val); } else if (val instanceof Double) @@ -1569,8 +1576,10 @@ for (int i = row.getFirstCellNum(); i < row.getLastCellNum(); i++) { Cell cell = row.getCell(i); - if (cell != null && cell.getCellType() != CellType.BLANK) +// System.out.println("11111111111111:/"+(cell != null)+"\n2222222222:/"+cell+"\n333333:/"+String.valueOf(cell).length()); + if (cell != null && cell.getCellType() != CellType.BLANK && !cell.toString().equals("")) { +// System.out.println("444444+/"+(cell.getCellType())); return false; } } @@ -1731,4 +1740,38 @@ } return method; } + + + /** + * 瀵筫xcel琛ㄥ崟榛樿绗竴涓储寮曞悕杞崲鎴恖ist锛圗asyExcel锛� + * + * @param is 杈撳叆娴� + * @return 杞崲鍚庨泦鍚� + */ + public List<T> importEasyExcel(InputStream is) throws Exception + { + return EasyExcel.read(is).head(clazz).sheet().doReadSync(); + } + + /** + * 瀵筶ist鏁版嵁婧愬皢鍏堕噷闈㈢殑鏁版嵁瀵煎叆鍒癳xcel琛ㄥ崟锛圗asyExcel锛� + * + * @param list 瀵煎嚭鏁版嵁闆嗗悎 + * @param sheetName 宸ヤ綔琛ㄧ殑鍚嶇О + * @return 缁撴灉 + */ + public void exportEasyExcel(HttpServletResponse response, List<T> list, String sheetName) + { + try + { + EasyExcel.write(response.getOutputStream(), clazz).sheet(sheetName).doWrite(list); + } + catch (IOException e) + { + log.error("瀵煎嚭EasyExcel寮傚父{}", e.getMessage()); + } + } + + + } -- Gitblit v1.9.1