From 10158625f1096c54664a5f87b3f32d33794e4eee Mon Sep 17 00:00:00 2001
From: tuqin <tuqin@tuqin.cn>
Date: 星期五, 11 九月 2026 12:13:59 +0800
Subject: [PATCH] fix(mdm): 物料导入“状态”列兼容中文,读表异常改为友好提示

---
 yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/controller/admin/item/MdmItemController.java |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/controller/admin/item/MdmItemController.java b/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/controller/admin/item/MdmItemController.java
index 4495e23..b570ded 100644
--- a/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/controller/admin/item/MdmItemController.java
+++ b/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/controller/admin/item/MdmItemController.java
@@ -333,7 +333,19 @@
     @PreAuthorize("@ss.hasPermission('mdm:item:import')")
     public CommonResult<MdmItemImportRespVO> importExcel(@RequestParam("file") MultipartFile file,
                                                          @RequestParam(value = "updateSupport", required = false, defaultValue = "false") Boolean updateSupport) throws Exception {
-        List<MdmItemImportExcelVO> list = ExcelUtils.read(file, MdmItemImportExcelVO.class);
+        List<MdmItemImportExcelVO> list;
+        try {
+            list = ExcelUtils.read(file, MdmItemImportExcelVO.class);
+        } catch (cn.idev.excel.exception.ExcelDataConvertException e) {
+            int row = e.getRowIndex() == null ? 0 : e.getRowIndex() + 1;
+            int col = e.getColumnIndex() == null ? 0 : e.getColumnIndex() + 1;
+            String cellVal = e.getCellData() == null ? "" : String.valueOf(e.getCellData().getStringValue());
+            throw new cn.iocoder.yudao.framework.common.exception.ServiceException(400,
+                    "Excel 绗� " + row + " 琛岀 " + col + " 鍒楁暟鎹��" + cellVal + "銆忔牸寮忎笉姝g‘锛岃妫�鏌ヨ鍒楀唴瀹癸紙渚嬪鈥滅姸鎬佲�濊濉� 0/1 鎴� 鍚敤/鍋滅敤锛�");
+        } catch (Exception e) {
+            throw new cn.iocoder.yudao.framework.common.exception.ServiceException(400,
+                    "Excel 瑙f瀽澶辫触锛�" + e.getMessage() + "锛岃浣跨敤绯荤粺鈥滀笅杞藉鍏ユā鏉库�濆苟鎸夋ā鏉垮~鍐欍��");
+        }
         return success(itemService.importItemList(list, updateSupport));
     }
 

--
Gitblit v1.9.3