From abbc8d7b3157c29b6ab4e72ea3dec48c993bf5a7 Mon Sep 17 00:00:00 2001 From: huangfeng Date: Tue, 4 Mar 2025 10:07:21 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=87=87=E9=9B=86=E7=9A=84=E6=98=AF?= =?UTF-8?q?=E7=A7=91=E5=AD=A6=E8=AE=A1=E6=95=B0=E6=B3=95=E6=97=A5=E6=9C=9F?= =?UTF-8?q?=E7=9A=84=E7=89=B9=E6=AE=8A=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/xydl/cac/service/impl/DataServiceImpl.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/xydl/cac/service/impl/DataServiceImpl.java b/src/main/java/com/xydl/cac/service/impl/DataServiceImpl.java index 356eb29..7a24e89 100644 --- a/src/main/java/com/xydl/cac/service/impl/DataServiceImpl.java +++ b/src/main/java/com/xydl/cac/service/impl/DataServiceImpl.java @@ -20,6 +20,7 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import javax.annotation.Resource; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -301,13 +302,13 @@ public class DataServiceImpl implements DataService { } else if (Constants.Text.equalsIgnoreCase(type)) { value = "'" + value + "'"; } else if (Constants.DateTime.equalsIgnoreCase(type)) { - if (value.length() == 10) { - value = value + "000"; - } - if (value.length() == 13) { - Date date = new Date(Long.parseLong(value)); - value = DateUtil.format(date); + BigDecimal bigval = new BigDecimal(value); + Long ts = bigval.longValue(); + if (ts.toString().length() < 11) { + ts = ts * 1000; } + Date date = new Date(ts); + value = DateUtil.format(date); value = "'" + value + "'"; } if (count > 0) {