|
@@ -1,4 +1,4 @@
|
|
|
-package com.dtm.storage.service;
|
|
|
|
|
|
|
+package com.dtm.storage.service;
|
|
|
|
|
|
|
|
import com.dtm.storage.model.AssemblyRecord;
|
|
import com.dtm.storage.model.AssemblyRecord;
|
|
|
import com.dtm.storage.model.ProductInfo;
|
|
import com.dtm.storage.model.ProductInfo;
|
|
@@ -140,113 +140,140 @@ public class StorageDataLoader {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private List<PurchaseRecord> loadPurchaseRecords() {
|
|
private List<PurchaseRecord> loadPurchaseRecords() {
|
|
|
- ExcelSheet sheet = loadPurchaseSheet();
|
|
|
|
|
- if (sheet.getRows().isEmpty()) {
|
|
|
|
|
|
|
+ Path file = findPurchaseFile();
|
|
|
|
|
+ if (file == null) {
|
|
|
return Collections.emptyList();
|
|
return Collections.emptyList();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- List<String> headers = sheet.getHeaders();
|
|
|
|
|
- int dateIdx = findHeaderIndex(headers, new String[]{"业务日期", "日期"}, 0);
|
|
|
|
|
- int codeIdx = findHeaderIndex(headers, new String[]{"产品代码", "产品编码", "编码", "代码"}, 1);
|
|
|
|
|
- int qtyIdx = findHeaderIndex(headers, new String[]{"数量", "入库数量"}, 2);
|
|
|
|
|
- int amountIdx = findHeaderIndex(headers, new String[]{"实际金额", "金额"}, 3);
|
|
|
|
|
-
|
|
|
|
|
List<PurchaseRecord> records = new ArrayList<>();
|
|
List<PurchaseRecord> records = new ArrayList<>();
|
|
|
- for (List<Object> row : sheet.getRows()) {
|
|
|
|
|
- String code = toText(getValue(row, codeIdx)).trim();
|
|
|
|
|
- if (code.isEmpty()) {
|
|
|
|
|
- continue;
|
|
|
|
|
|
|
+ final int[] indexes = {-1, -1, -1, -1};
|
|
|
|
|
+ ExcelUtils.processSheet(file, 0, resolveRowLimit(), new ExcelUtils.SheetHandler() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onHeader(List<String> headers) {
|
|
|
|
|
+ indexes[0] = findHeaderIndex(headers, new String[]{"业务日期", "日期"}, 0);
|
|
|
|
|
+ indexes[1] = findHeaderIndex(headers, new String[]{"产品代码", "产品编码", "编码", "代码"}, 1);
|
|
|
|
|
+ indexes[2] = findHeaderIndex(headers, new String[]{"数量", "入库数量"}, 2);
|
|
|
|
|
+ indexes[3] = findHeaderIndex(headers, new String[]{"实际金额", "金额"}, 3);
|
|
|
}
|
|
}
|
|
|
- LocalDate date = toLocalDate(getValue(row, dateIdx));
|
|
|
|
|
- double qty = toDouble(getValue(row, qtyIdx));
|
|
|
|
|
- double amount = toDouble(getValue(row, amountIdx));
|
|
|
|
|
- records.add(new PurchaseRecord(code, date, qty, amount));
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onRow(List<Object> row) {
|
|
|
|
|
+ String code = toText(getValue(row, indexes[1])).trim();
|
|
|
|
|
+ if (code.isEmpty()) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ LocalDate date = toLocalDate(getValue(row, indexes[0]));
|
|
|
|
|
+ double qty = toDouble(getValue(row, indexes[2]));
|
|
|
|
|
+ double amount = toDouble(getValue(row, indexes[3]));
|
|
|
|
|
+ records.add(new PurchaseRecord(code, date, qty, amount));
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
return records;
|
|
return records;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private List<SalesRecord> loadSalesRecords() {
|
|
private List<SalesRecord> loadSalesRecords() {
|
|
|
- ExcelSheet sheet = loadSalesSheet();
|
|
|
|
|
- if (sheet.getRows().isEmpty()) {
|
|
|
|
|
|
|
+ Path file = findSalesFile();
|
|
|
|
|
+ if (file == null) {
|
|
|
return Collections.emptyList();
|
|
return Collections.emptyList();
|
|
|
}
|
|
}
|
|
|
- List<String> headers = sheet.getHeaders();
|
|
|
|
|
- int codeIdx = findHeaderIndex(headers, new String[]{"商家编码", "产品编码", "产品代码", "编码"}, 0);
|
|
|
|
|
- int qtyIdx = findHeaderIndex(headers, new String[]{"购买数量", "数量"}, 1);
|
|
|
|
|
- int dateIdx = findHeaderIndex(headers, new String[]{"订单创建时间", "创建时间", "日期"}, 2);
|
|
|
|
|
|
|
|
|
|
List<SalesRecord> records = new ArrayList<>();
|
|
List<SalesRecord> records = new ArrayList<>();
|
|
|
- for (List<Object> row : sheet.getRows()) {
|
|
|
|
|
- String code = toText(getValue(row, codeIdx)).trim();
|
|
|
|
|
- if (code.isEmpty()) {
|
|
|
|
|
- continue;
|
|
|
|
|
|
|
+ final int[] indexes = {-1, -1, -1};
|
|
|
|
|
+ ExcelUtils.processSheet(file, 0, resolveRowLimit(), new ExcelUtils.SheetHandler() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onHeader(List<String> headers) {
|
|
|
|
|
+ indexes[0] = findHeaderIndex(headers, new String[]{"商家编码", "产品编码", "产品代码", "编码"}, 0);
|
|
|
|
|
+ indexes[1] = findHeaderIndex(headers, new String[]{"购买数量", "数量"}, 1);
|
|
|
|
|
+ indexes[2] = findHeaderIndex(headers, new String[]{"订单创建时间", "创建时间", "日期"}, 2);
|
|
|
}
|
|
}
|
|
|
- LocalDate date = toLocalDate(getValue(row, dateIdx));
|
|
|
|
|
- double qty = toDouble(getValue(row, qtyIdx));
|
|
|
|
|
- records.add(new SalesRecord(code, date, qty));
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onRow(List<Object> row) {
|
|
|
|
|
+ String code = toText(getValue(row, indexes[0])).trim();
|
|
|
|
|
+ if (code.isEmpty()) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ LocalDate date = toLocalDate(getValue(row, indexes[2]));
|
|
|
|
|
+ double qty = toDouble(getValue(row, indexes[1]));
|
|
|
|
|
+ records.add(new SalesRecord(code, date, qty));
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
return records;
|
|
return records;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private List<AssemblyRecord> loadAssemblyRecords() {
|
|
private List<AssemblyRecord> loadAssemblyRecords() {
|
|
|
- ExcelSheet sheet = loadAssemblySheet();
|
|
|
|
|
- if (sheet.getRows().isEmpty()) {
|
|
|
|
|
|
|
+ Path file = findAssemblyFile();
|
|
|
|
|
+ if (file == null) {
|
|
|
return Collections.emptyList();
|
|
return Collections.emptyList();
|
|
|
}
|
|
}
|
|
|
- List<String> headers = sheet.getHeaders();
|
|
|
|
|
- int codeIdx = findHeaderIndex(headers, new String[]{"产品编码", "产品代码", "半成品"}, 0);
|
|
|
|
|
- int qtyIdx = findHeaderIndex(headers, new String[]{"数量", "入库数量"}, 1);
|
|
|
|
|
- int dateIdx = findHeaderIndex(headers, new String[]{"日期", "时间"}, 2);
|
|
|
|
|
|
|
|
|
|
List<AssemblyRecord> records = new ArrayList<>();
|
|
List<AssemblyRecord> records = new ArrayList<>();
|
|
|
- for (List<Object> row : sheet.getRows()) {
|
|
|
|
|
- String code = toText(getValue(row, codeIdx)).trim();
|
|
|
|
|
- if (code.isEmpty()) {
|
|
|
|
|
- continue;
|
|
|
|
|
|
|
+ final int[] indexes = {-1, -1, -1};
|
|
|
|
|
+ ExcelUtils.processSheet(file, 1, resolveRowLimit(), new ExcelUtils.SheetHandler() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onHeader(List<String> headers) {
|
|
|
|
|
+ indexes[0] = findHeaderIndex(headers, new String[]{"产品编码", "产品代码", "半成品"}, 0);
|
|
|
|
|
+ indexes[1] = findHeaderIndex(headers, new String[]{"数量", "入库数量"}, 1);
|
|
|
|
|
+ indexes[2] = findHeaderIndex(headers, new String[]{"日期", "时间"}, 2);
|
|
|
}
|
|
}
|
|
|
- LocalDate date = toLocalDate(getValue(row, dateIdx));
|
|
|
|
|
- double qty = toDouble(getValue(row, qtyIdx));
|
|
|
|
|
- if (qty <= 0) {
|
|
|
|
|
- continue;
|
|
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onRow(List<Object> row) {
|
|
|
|
|
+ String code = toText(getValue(row, indexes[0])).trim();
|
|
|
|
|
+ if (code.isEmpty()) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ LocalDate date = toLocalDate(getValue(row, indexes[2]));
|
|
|
|
|
+ double qty = toDouble(getValue(row, indexes[1]));
|
|
|
|
|
+ if (qty <= 0) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ records.add(new AssemblyRecord(code, date, qty));
|
|
|
}
|
|
}
|
|
|
- records.add(new AssemblyRecord(code, date, qty));
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ });
|
|
|
return records;
|
|
return records;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private List<ProductInfo> loadProductInfo() {
|
|
private List<ProductInfo> loadProductInfo() {
|
|
|
- ExcelSheet sheet = loadProductInfoSheet();
|
|
|
|
|
- if (sheet.getRows().isEmpty()) {
|
|
|
|
|
|
|
+ Path file = findProductInfoFile();
|
|
|
|
|
+ if (file == null) {
|
|
|
return Collections.emptyList();
|
|
return Collections.emptyList();
|
|
|
}
|
|
}
|
|
|
- List<String> headers = sheet.getHeaders();
|
|
|
|
|
- int codeIdx = findHeaderIndex(headers, new String[]{"产品代码", "产品编码", "编码", "代码"}, 0);
|
|
|
|
|
- int nameIdx = findHeaderIndex(headers, new String[]{"产品名称", "名称"}, 1);
|
|
|
|
|
- int categoryIdx = findHeaderIndex(headers, new String[]{"分类", "成品", "半成品", "辅料"}, 4);
|
|
|
|
|
- int attributeIdx = findHeaderIndex(headers, new String[]{"属性", "等级", "ABC"}, 10);
|
|
|
|
|
- int spuIdx = findHeaderIndex(headers, new String[]{"SPU"}, 5);
|
|
|
|
|
- int priceIdx = findHeaderIndex(headers, new String[]{"价格", "单价"}, 6);
|
|
|
|
|
|
|
|
|
|
List<ProductInfo> infos = new ArrayList<>();
|
|
List<ProductInfo> infos = new ArrayList<>();
|
|
|
- for (List<Object> row : sheet.getRows()) {
|
|
|
|
|
- String code = toText(getValue(row, codeIdx)).trim();
|
|
|
|
|
- if (code.isEmpty()) {
|
|
|
|
|
- continue;
|
|
|
|
|
|
|
+ final int[] indexes = {-1, -1, -1, -1, -1, -1};
|
|
|
|
|
+ ExcelUtils.processSheet(file, 0, resolveRowLimit(), new ExcelUtils.SheetHandler() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onHeader(List<String> headers) {
|
|
|
|
|
+ indexes[0] = findHeaderIndex(headers, new String[]{"产品代码", "产品编码", "编码", "代码"}, 0);
|
|
|
|
|
+ indexes[1] = findHeaderIndex(headers, new String[]{"产品名称", "名称"}, 1);
|
|
|
|
|
+ indexes[2] = findHeaderIndex(headers, new String[]{"分类", "成品", "半成品", "辅料"}, 4);
|
|
|
|
|
+ indexes[3] = findHeaderIndex(headers, new String[]{"属性", "等级", "ABC"}, 10);
|
|
|
|
|
+ indexes[4] = findHeaderIndex(headers, new String[]{"SPU"}, 5);
|
|
|
|
|
+ indexes[5] = findHeaderIndex(headers, new String[]{"价格", "单价"}, 6);
|
|
|
}
|
|
}
|
|
|
- String name = toText(getValue(row, nameIdx)).trim();
|
|
|
|
|
- String category = toText(getValue(row, categoryIdx)).trim();
|
|
|
|
|
- String attribute = toText(getValue(row, attributeIdx)).trim();
|
|
|
|
|
- String spu = toText(getValue(row, spuIdx)).trim();
|
|
|
|
|
- Double price = null;
|
|
|
|
|
- Object priceObj = getValue(row, priceIdx);
|
|
|
|
|
- if (priceObj != null) {
|
|
|
|
|
- double parsed = toDouble(priceObj);
|
|
|
|
|
- if (parsed > 0) {
|
|
|
|
|
- price = parsed;
|
|
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onRow(List<Object> row) {
|
|
|
|
|
+ String code = toText(getValue(row, indexes[0])).trim();
|
|
|
|
|
+ if (code.isEmpty()) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ String name = toText(getValue(row, indexes[1])).trim();
|
|
|
|
|
+ String category = toText(getValue(row, indexes[2])).trim();
|
|
|
|
|
+ String attribute = toText(getValue(row, indexes[3])).trim();
|
|
|
|
|
+ String spu = toText(getValue(row, indexes[4])).trim();
|
|
|
|
|
+ Double price = null;
|
|
|
|
|
+ Object priceValue = getValue(row, indexes[5]);
|
|
|
|
|
+ if (priceValue != null) {
|
|
|
|
|
+ double parsed = toDouble(priceValue);
|
|
|
|
|
+ if (parsed > 0) {
|
|
|
|
|
+ price = parsed;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+ infos.add(new ProductInfo(code, name, category, attribute, spu, price));
|
|
|
}
|
|
}
|
|
|
- infos.add(new ProductInfo(code, name, category, attribute, spu, price));
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ });
|
|
|
return infos;
|
|
return infos;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -266,38 +293,6 @@ public class StorageDataLoader {
|
|
|
return readSheet(file, 0);
|
|
return readSheet(file, 0);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private ExcelSheet loadPurchaseSheet() {
|
|
|
|
|
- Path file = findPurchaseFile();
|
|
|
|
|
- if (file == null) {
|
|
|
|
|
- return new ExcelSheet(Collections.emptyList(), Collections.emptyList());
|
|
|
|
|
- }
|
|
|
|
|
- return readSheet(file, 0);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- private ExcelSheet loadSalesSheet() {
|
|
|
|
|
- Path file = findSalesFile();
|
|
|
|
|
- if (file == null) {
|
|
|
|
|
- return new ExcelSheet(Collections.emptyList(), Collections.emptyList());
|
|
|
|
|
- }
|
|
|
|
|
- return readSheet(file, 0);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- private ExcelSheet loadAssemblySheet() {
|
|
|
|
|
- Path file = findAssemblyFile();
|
|
|
|
|
- if (file == null) {
|
|
|
|
|
- return new ExcelSheet(Collections.emptyList(), Collections.emptyList());
|
|
|
|
|
- }
|
|
|
|
|
- return readSheet(file, 1);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- private ExcelSheet loadProductInfoSheet() {
|
|
|
|
|
- Path file = findProductInfoFile();
|
|
|
|
|
- if (file == null) {
|
|
|
|
|
- return new ExcelSheet(Collections.emptyList(), Collections.emptyList());
|
|
|
|
|
- }
|
|
|
|
|
- return readSheet(file, 0);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
private ExcelSheet readSheet(Path file, int headerRowIndex) {
|
|
private ExcelSheet readSheet(Path file, int headerRowIndex) {
|
|
|
if (tempMode) {
|
|
if (tempMode) {
|
|
|
return ExcelUtils.readSheet(file, headerRowIndex, TEMP_MAX_ROWS);
|
|
return ExcelUtils.readSheet(file, headerRowIndex, TEMP_MAX_ROWS);
|
|
@@ -305,6 +300,10 @@ public class StorageDataLoader {
|
|
|
return ExcelUtils.readSheet(file, headerRowIndex);
|
|
return ExcelUtils.readSheet(file, headerRowIndex);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private int resolveRowLimit() {
|
|
|
|
|
+ return tempMode ? TEMP_MAX_ROWS : -1;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private Path resolveBasePath() {
|
|
private Path resolveBasePath() {
|
|
|
String envPath = Optional.ofNullable(System.getenv("DTM_DATA_PATH"))
|
|
String envPath = Optional.ofNullable(System.getenv("DTM_DATA_PATH"))
|
|
|
.filter(v -> !v.trim().isEmpty())
|
|
.filter(v -> !v.trim().isEmpty())
|
|
@@ -347,38 +346,45 @@ public class StorageDataLoader {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private Path findPurchaseFile() {
|
|
private Path findPurchaseFile() {
|
|
|
- Path dir = resolveDir("purchase");
|
|
|
|
|
|
|
+ Path dir = resolveDir("purchase", "入库数据");
|
|
|
return findFile(dir, "purchase", "入库", "采购");
|
|
return findFile(dir, "purchase", "入库", "采购");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private Path findSalesFile() {
|
|
private Path findSalesFile() {
|
|
|
- Path dir = resolveDir("sales");
|
|
|
|
|
|
|
+ Path dir = resolveDir("sales", "销售数据");
|
|
|
return findFile(dir, "sales", "订单", "销售");
|
|
return findFile(dir, "sales", "订单", "销售");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private Path findAssemblyFile() {
|
|
private Path findAssemblyFile() {
|
|
|
- Path dir = resolveDir("assembly");
|
|
|
|
|
|
|
+ Path dir = resolveDir("assembly", "半成品组装");
|
|
|
return findFile(dir, "assembly", "组装");
|
|
return findFile(dir, "assembly", "组装");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private Path findSemiMappingFile() {
|
|
private Path findSemiMappingFile() {
|
|
|
- Path dir = resolveDir("semi-mapping");
|
|
|
|
|
|
|
+ Path dir = resolveDir("semi-mapping", "半成品组装");
|
|
|
return findFile(dir, "semi-mapping", "匹配");
|
|
return findFile(dir, "semi-mapping", "匹配");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private Path findProductInfoFile() {
|
|
private Path findProductInfoFile() {
|
|
|
- Path dir = resolveDir("product");
|
|
|
|
|
|
|
+ Path dir = resolveDir("product", "产品资料", "入库数据");
|
|
|
return findFile(dir, "product", "产品", "资料");
|
|
return findFile(dir, "product", "产品", "资料");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private Path resolveDir(String dirName) {
|
|
|
|
|
|
|
+ private Path resolveDir(String... dirNames) {
|
|
|
ensureTempValid();
|
|
ensureTempValid();
|
|
|
if (basePath == null) {
|
|
if (basePath == null) {
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
- Path direct = basePath.resolve(dirName);
|
|
|
|
|
- if (Files.exists(direct)) {
|
|
|
|
|
- return direct;
|
|
|
|
|
|
|
+ if (dirNames != null) {
|
|
|
|
|
+ for (String dirName : dirNames) {
|
|
|
|
|
+ if (dirName == null || dirName.trim().isEmpty()) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ Path candidate = basePath.resolve(dirName);
|
|
|
|
|
+ if (Files.exists(candidate)) {
|
|
|
|
|
+ return candidate;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
return basePath;
|
|
return basePath;
|
|
|
}
|
|
}
|
|
@@ -418,7 +424,7 @@ public class StorageDataLoader {
|
|
|
try (Stream<Path> stream = Files.list(dir)) {
|
|
try (Stream<Path> stream = Files.list(dir)) {
|
|
|
List<Path> candidates = stream
|
|
List<Path> candidates = stream
|
|
|
.filter(Files::isRegularFile)
|
|
.filter(Files::isRegularFile)
|
|
|
- .filter(p -> p.getFileName().toString().toLowerCase(Locale.ROOT).endsWith(".xlsx"))
|
|
|
|
|
|
|
+ .filter(this::isExcelFile)
|
|
|
.sorted(Comparator.comparing(Path::getFileName))
|
|
.sorted(Comparator.comparing(Path::getFileName))
|
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
@@ -443,6 +449,14 @@ public class StorageDataLoader {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private boolean isExcelFile(Path path) {
|
|
|
|
|
+ if (path == null || path.getFileName() == null) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ String name = path.getFileName().toString().toLowerCase(Locale.ROOT);
|
|
|
|
|
+ return name.endsWith(".xlsx") || name.endsWith(".xls");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private int findHeaderIndex(List<String> headers, String[] keywords, int fallback) {
|
|
private int findHeaderIndex(List<String> headers, String[] keywords, int fallback) {
|
|
|
if (headers == null || headers.isEmpty()) {
|
|
if (headers == null || headers.isEmpty()) {
|
|
|
return fallback;
|
|
return fallback;
|
|
@@ -522,6 +536,16 @@ public class StorageDataLoader {
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
text = text.replace('/', '-').replace('.', '-');
|
|
text = text.replace('/', '-').replace('.', '-');
|
|
|
|
|
+ if (text.matches("\\d+(\\.0+)?")) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ double numeric = Double.parseDouble(text);
|
|
|
|
|
+ if (DateUtil.isValidExcelDate(numeric)) {
|
|
|
|
|
+ Date date = DateUtil.getJavaDate(numeric);
|
|
|
|
|
+ return Instant.ofEpochMilli(date.getTime()).atZone(ZoneId.systemDefault()).toLocalDate();
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (Exception ignored) {
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
List<String> patterns = new ArrayList<>();
|
|
List<String> patterns = new ArrayList<>();
|
|
|
patterns.add("yyyy-M-d");
|
|
patterns.add("yyyy-M-d");
|
|
|
patterns.add("yyyy-MM-dd");
|
|
patterns.add("yyyy-MM-dd");
|
|
@@ -573,6 +597,3 @@ public class StorageDataLoader {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|