|
|
|
@ -45,6 +45,7 @@ public class TagExcelUtil {
|
|
|
|
|
if (isInventoryFlag) {
|
|
|
|
|
List<Map<String, String>> tagList = parseTagList(sheet, 1);
|
|
|
|
|
result.put("tagList", tagList);
|
|
|
|
|
result.put("orderInfo", new HashMap<>());
|
|
|
|
|
} else {
|
|
|
|
|
// 解析订单信息
|
|
|
|
|
Map<String, String> orderInfo = parseOrderInfo(sheet);
|
|
|
|
@ -151,8 +152,18 @@ public class TagExcelUtil {
|
|
|
|
|
// 获取表头
|
|
|
|
|
Row headerRow = sheet.getRow(startRow - 1);
|
|
|
|
|
List<String> headers = new ArrayList<>();
|
|
|
|
|
for (Cell cell : headerRow) {
|
|
|
|
|
headers.add(getCellStringValue(cell));
|
|
|
|
|
// 获取最后一列的索引
|
|
|
|
|
int lastColumn = headerRow.getLastCellNum();
|
|
|
|
|
|
|
|
|
|
// 处理表头
|
|
|
|
|
for (int i = 0; i < lastColumn; i++) {
|
|
|
|
|
Cell cell = headerRow.getCell(i);
|
|
|
|
|
String headerValue = getCellStringValue(cell);
|
|
|
|
|
// 如果表头为空,使用列索引作为键
|
|
|
|
|
if (!StringUtils.hasText(headerValue)) {
|
|
|
|
|
headerValue = "Column_" + i;
|
|
|
|
|
}
|
|
|
|
|
headers.add(headerValue);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 解析数据行
|
|
|
|
@ -162,7 +173,8 @@ public class TagExcelUtil {
|
|
|
|
|
Map<String, String> tagData = new HashMap<>();
|
|
|
|
|
boolean hasData = false;
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < headers.size(); i++) {
|
|
|
|
|
// 使用lastColumn而不是headers.size()
|
|
|
|
|
for (int i = 0; i < lastColumn; i++) {
|
|
|
|
|
String value = getCellStringValue(row.getCell(i));
|
|
|
|
|
if (StringUtils.hasText(value)) {
|
|
|
|
|
hasData = true;
|
|
|
|
|