| | |
| | | // 创建项目详情 |
| | | EamMaintenanceStandardDetail detail = new EamMaintenanceStandardDetail(); |
| | | detail.setStandardId(standard.getId()); |
| | | detail.setItemCode(Integer.parseInt(getCellStringValue(row.getCell(0)))); |
| | | detail.setItemName(getCellStringValue(row.getCell(1))); |
| | | detail.setItemCategory(itemCategory); |
| | | |
| | |
| | | |
| | | List<XWPFTable> tables = doc.getTables(); |
| | | EamMaintenanceStandard standard = null; |
| | | boolean firstTableProcessed = false; |
| | | List<EamMaintenanceStandardDetail> items = new ArrayList<>(); |
| | | String standardId = null; |
| | | |
| | |
| | | if (!items.isEmpty()) { |
| | | items.remove(0); |
| | | } |
| | | |
| | | // 2. 为缺失部位的数据填充前一条的保养部位 |
| | | String lastPart = ""; |
| | | int i =1; |
| | | for (EamMaintenanceStandardDetail item : items) { |
| | | item.setItemCode(i); |
| | | if (item.getItemPart() != null && !item.getItemPart().isEmpty()) { |
| | | lastPart = item.getItemPart(); |
| | | } else if (!lastPart.isEmpty()) { |
| | | item.setItemPart(lastPart); |
| | | } |
| | | i++; |
| | | } |
| | | } |
| | | } |
| | |
| | | } else if (cellContents.size() == 1) { |
| | | // 单列模式:视为内容 |
| | | item.setItemName(cellContents.get(0)); |
| | | } else if (cellContents.isEmpty() && !isRowEmpty(row)) { |
| | | } else if (!isRowEmpty(row)) { |
| | | // 特殊处理:行非空但没有提取到内容(可能是复杂合并单元格) |
| | | // 尝试提取整行文本作为内容 |
| | | StringBuilder content = new StringBuilder(); |