diff --git a/FreeCarRegistration/src/main/java/com/nmgs/controller/ImportController.java b/FreeCarRegistration/src/main/java/com/nmgs/controller/ImportController.java index e6e3ff5..aa7e8de 100644 --- a/FreeCarRegistration/src/main/java/com/nmgs/controller/ImportController.java +++ b/FreeCarRegistration/src/main/java/com/nmgs/controller/ImportController.java @@ -41,6 +41,8 @@ import java.io.InputStream; import java.net.URLEncoder; import java.nio.file.Files; import java.nio.file.Path; +import java.text.ParseException; +import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; @@ -161,12 +163,27 @@ public class ImportController { template.setTypename(getStringCellValue(row.getCell(2)).toString()); template.setPhoneNumber(getStringCellValue(row.getCell(3)).toString()); template.setFreetypename(getStringCellValue(row.getCell(4)).toString()); - template.setFreeStartTime((Date) getStringCellValue(row.getCell(5))); - template.setFreeEndTime((Date) getStringCellValue(row.getCell(6))); + //template.setFreeStartTime((Date) getStringCellValue(row.getCell(5))); + //template.setFreeEndTime((Date) getStringCellValue(row.getCell(6))); + // 处理日期字段 + Date freeStartTime = parseDate(getStringCellValue(row.getCell(5))); + Date freeEndTime = parseDate(getStringCellValue(row.getCell(6))); + template.setFreeStartTime(freeStartTime); + template.setFreeEndTime(freeEndTime); + template.setFreeTimes(getStringCellValue(row.getCell(7)).toString()); template.setAdduserid(manno); template.setAdduser(man); - template.setFreesta(getStringCellValue(row.getCell(8)).toString()); + //template.setFreesta(getStringCellValue(row.getCell(8)).toString()); + String freesta = getStringCellValue(row.getCell(8)).toString(); + if ("台格".equals(freesta)) { + freesta = "T"; + } else if ("嘎鲁图".equals(freesta)) { + freesta = "G"; + } else { + freesta = "T,G"; + } + template.setFreesta(freesta); template.setAdvancefee(getStringCellValue(row.getCell(9)).toString()); result.add(template); } @@ -181,7 +198,26 @@ public class ImportController { return result; } - + // 辅助方法:解析日期字符串为 Date 对象 + private Date parseDate(Object cellValue) { + if (cellValue == null) { + return null; + } + if (cellValue instanceof Date) { + return (Date) cellValue; + } + if (cellValue instanceof String) { + String dateStr = (String) cellValue; + try { + // 假设日期格式为 yyyy-MM-dd,根据实际情况调整 + return new SimpleDateFormat("yyyy-MM-dd").parse(dateStr); + } catch (ParseException e) { + log.warn("无法解析日期字符串: {}", dateStr); + return null; + } + } + return null; + } private Object getStringCellValue(Cell cell) { if (cell == null) { return ""; diff --git a/FreeCarRegistration/src/main/resources/template/设备车牌绑定管理导入模板.xlsx b/FreeCarRegistration/src/main/resources/template/设备车牌绑定管理导入模板.xlsx index feb5af6..594033b 100644 Binary files a/FreeCarRegistration/src/main/resources/template/设备车牌绑定管理导入模板.xlsx and b/FreeCarRegistration/src/main/resources/template/设备车牌绑定管理导入模板.xlsx differ diff --git a/FreeCarRegistration/src/main/resources/version/1.0.5.txt b/FreeCarRegistration/src/main/resources/version/1.0.8.txt similarity index 72% rename from FreeCarRegistration/src/main/resources/version/1.0.5.txt rename to FreeCarRegistration/src/main/resources/version/1.0.8.txt index d586b8b..3c70734 100644 --- a/FreeCarRegistration/src/main/resources/version/1.0.5.txt +++ b/FreeCarRegistration/src/main/resources/version/1.0.8.txt @@ -6,3 +6,5 @@ 5 2024年10月10日 1.0.4 增加解除绑定页面 6 2025年03月03日 1.0.5 增加预存明细,预存剩余次数不从流水中查询,增加预存追加,优化相关逻辑等 7 2025年05月20日 1.0.6 增加批量导入模板下载、批量导入功能,主键冲突时执行更新操作(只更新开始时间和结束时间) +8 2025年06月18日 1.0.7 处理批量上传时freeStartTime,freeEndTime时间格式问题 +9 2025年06月19日 1.0.8 批量导入时处理免费站时字段赋值问题(如果是台格改为T,嘎鲁图改为G,台格,嘎鲁图改为T,G) diff --git a/FreeCarRegistration/target/FreeCarRegistration.war b/FreeCarRegistration/target/FreeCarRegistration.war index 2c9eb88..ae0652e 100644 Binary files a/FreeCarRegistration/target/FreeCarRegistration.war and b/FreeCarRegistration/target/FreeCarRegistration.war differ diff --git a/FreeCarRegistration/target/FreeCarRegistration.war.original b/FreeCarRegistration/target/FreeCarRegistration.war.original index 20d0a0d..a882f2b 100644 Binary files a/FreeCarRegistration/target/FreeCarRegistration.war.original and b/FreeCarRegistration/target/FreeCarRegistration.war.original differ diff --git a/FreeCarRegistration/target/FreeCarRegistration/WEB-INF/classes/com/nmgs/controller/ImportController.class b/FreeCarRegistration/target/FreeCarRegistration/WEB-INF/classes/com/nmgs/controller/ImportController.class index 8ca8e44..040ac4a 100644 Binary files a/FreeCarRegistration/target/FreeCarRegistration/WEB-INF/classes/com/nmgs/controller/ImportController.class and b/FreeCarRegistration/target/FreeCarRegistration/WEB-INF/classes/com/nmgs/controller/ImportController.class differ diff --git a/FreeCarRegistration/target/FreeCarRegistration/WEB-INF/classes/template/设备车牌绑定管理导入模板.xlsx b/FreeCarRegistration/target/FreeCarRegistration/WEB-INF/classes/template/设备车牌绑定管理导入模板.xlsx index feb5af6..594033b 100644 Binary files a/FreeCarRegistration/target/FreeCarRegistration/WEB-INF/classes/template/设备车牌绑定管理导入模板.xlsx and b/FreeCarRegistration/target/FreeCarRegistration/WEB-INF/classes/template/设备车牌绑定管理导入模板.xlsx differ diff --git a/FreeCarRegistration/target/FreeCarRegistration/WEB-INF/classes/version/1.0.5.txt b/FreeCarRegistration/target/FreeCarRegistration/WEB-INF/classes/version/1.0.5.txt deleted file mode 100644 index d586b8b..0000000 --- a/FreeCarRegistration/target/FreeCarRegistration/WEB-INF/classes/version/1.0.5.txt +++ /dev/null @@ -1,8 +0,0 @@ -序号 日期 版本号 说明 -1 2023年11月27日 1.0.0 初始版本号 -2 2023年11月29日 1.0.1 增加微信解绑申请操作 -3 2024年04月16日 1.0.2 增加使用次数及剩余次数 -4 2024年07月02日 1.0.3 优化查询语句 -5 2024年10月10日 1.0.4 增加解除绑定页面 -6 2025年03月03日 1.0.5 增加预存明细,预存剩余次数不从流水中查询,增加预存追加,优化相关逻辑等 -7 2025年05月20日 1.0.6 增加批量导入模板下载、批量导入功能,主键冲突时执行更新操作(只更新开始时间和结束时间) diff --git a/FreeCarRegistration/target/classes/com/nmgs/controller/ImportController.class b/FreeCarRegistration/target/classes/com/nmgs/controller/ImportController.class index 8ca8e44..040ac4a 100644 Binary files a/FreeCarRegistration/target/classes/com/nmgs/controller/ImportController.class and b/FreeCarRegistration/target/classes/com/nmgs/controller/ImportController.class differ diff --git a/FreeCarRegistration/target/classes/template/设备车牌绑定管理导入模板.xlsx b/FreeCarRegistration/target/classes/template/设备车牌绑定管理导入模板.xlsx index feb5af6..594033b 100644 Binary files a/FreeCarRegistration/target/classes/template/设备车牌绑定管理导入模板.xlsx and b/FreeCarRegistration/target/classes/template/设备车牌绑定管理导入模板.xlsx differ diff --git a/FreeCarRegistration/target/classes/version/1.0.5.txt b/FreeCarRegistration/target/classes/version/1.0.5.txt deleted file mode 100644 index d586b8b..0000000 --- a/FreeCarRegistration/target/classes/version/1.0.5.txt +++ /dev/null @@ -1,8 +0,0 @@ -序号 日期 版本号 说明 -1 2023年11月27日 1.0.0 初始版本号 -2 2023年11月29日 1.0.1 增加微信解绑申请操作 -3 2024年04月16日 1.0.2 增加使用次数及剩余次数 -4 2024年07月02日 1.0.3 优化查询语句 -5 2024年10月10日 1.0.4 增加解除绑定页面 -6 2025年03月03日 1.0.5 增加预存明细,预存剩余次数不从流水中查询,增加预存追加,优化相关逻辑等 -7 2025年05月20日 1.0.6 增加批量导入模板下载、批量导入功能,主键冲突时执行更新操作(只更新开始时间和结束时间)