| | |
| | | if (exist != null) { |
| | | return Result.error(name + ": 设备标准已存在,不能重复添加"); |
| | | } |
| | | |
| | | eamMaintenanceStandard.setInitialDate(new Date()); |
| | | eamMaintenanceStandardMapper.insert(eamMaintenanceStandard); |
| | | |
| | | Map<Integer, String> rowErrors = new HashMap<>(); |
| | |
| | | String fileName = file.getOriginalFilename(); |
| | | |
| | | try (XWPFDocument doc = new XWPFDocument(file.getInputStream())) { |
| | | // 获取文档标题(第一个非空段落) |
| | | String documentTitle = null; |
| | | for (XWPFParagraph p : doc.getParagraphs()) { |
| | | String text = p.getText(); |
| | | if (text != null && !text.trim().isEmpty()) { |
| | | documentTitle = text.trim(); |
| | | break; // 找到第一个非空段落即退出 |
| | | } |
| | | } |
| | | |
| | | // 基础验证 |
| | | if (doc.getTables().isEmpty()) { |
| | | return Result.error(fileName + ": 文档中未找到表格"); |
| | | } |
| | | |
| | | // 基础验证 |
| | | if (doc.getTables().isEmpty()) { |
| | | return Result.error(fileName + ": 文档中未找到表格"); |
| | |
| | | if (exist != null) { |
| | | return Result.error(fileName + ": 设备标准已存在,不能重复添加"); |
| | | } |
| | | standard.setStandardName(documentTitle); |
| | | eamMaintenanceStandardMapper.insert(standard); |
| | | standardId = standard.getId(); |
| | | |