From 5ca038d888922e93bf45c7bd37f3c6dce849dcff Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期五, 24 十二月 2021 11:36:02 +0800 Subject: [PATCH] update 调整监控依赖 从 common 迁移到 framework --- ruoyi-common/src/main/java/com/ruoyi/common/excel/DefaultExcelListener.java | 18 ++++++++++++------ 1 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/excel/DefaultExcelListener.java b/ruoyi-common/src/main/java/com/ruoyi/common/excel/DefaultExcelListener.java index 04bee4f..9936f67 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/excel/DefaultExcelListener.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/excel/DefaultExcelListener.java @@ -5,7 +5,7 @@ import com.alibaba.excel.event.AnalysisEventListener; import com.alibaba.excel.exception.ExcelAnalysisException; import com.alibaba.excel.exception.ExcelDataConvertException; -import com.alibaba.fastjson.JSON; +import com.ruoyi.common.utils.JsonUtils; import com.ruoyi.common.utils.ValidatorUtils; import lombok.NoArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -32,6 +32,11 @@ private Boolean isValidate = Boolean.TRUE; /** + * excel 琛ㄥご鏁版嵁 + */ + private Map<Integer, String> headMap; + + /** * 瀵煎叆鍥炴墽 */ private ExcelResult<T> excelResult; @@ -52,11 +57,11 @@ String errMsg = null; if (exception instanceof ExcelDataConvertException) { // 濡傛灉鏄煇涓�涓崟鍏冩牸鐨勮浆鎹㈠紓甯� 鑳借幏鍙栧埌鍏蜂綋琛屽彿 - // 濡傛灉瑕佽幏鍙栧ご鐨勪俊鎭� 閰嶅悎doAfterAllAnalysedHeadMap浣跨敤 ExcelDataConvertException excelDataConvertException = (ExcelDataConvertException) exception; - errMsg = StrUtil.format("绗瑊}琛�-绗瑊}鍒楄В鏋愬紓甯�<br/>", - excelDataConvertException.getRowIndex() + 1, - excelDataConvertException.getColumnIndex() + 1); + Integer rowIndex = excelDataConvertException.getRowIndex(); + Integer columnIndex = excelDataConvertException.getColumnIndex(); + errMsg = StrUtil.format("绗瑊}琛�-绗瑊}鍒�-琛ㄥご{}: 瑙f瀽寮傚父<br/>", + rowIndex + 1, columnIndex + 1, headMap.get(columnIndex)); if (log.isDebugEnabled()) { log.error(errMsg); } @@ -78,7 +83,8 @@ @Override public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) { - log.debug("瑙f瀽鍒颁竴鏉″ご鏁版嵁: {}", JSON.toJSONString(headMap)); + this.headMap = headMap; + log.debug("瑙f瀽鍒颁竴鏉¤〃澶存暟鎹�: {}", JsonUtils.toJsonString(headMap)); } @Override -- Gitblit v1.9.3