wfansh il y a 5 mois
Parent
commit
0e6dbaf353

+ 5 - 4
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/common/util/GeoIpUtil.java

@@ -134,10 +134,11 @@ public class GeoIpUtil {
     public Date getLocalhostTime(String ip, Date date) {
         SimpleDateFormat sdf = new SimpleDateFormat(DateUtil.DATE_TIME_FORMAT);
         String timeZone = getTimeZone(ip);
-        if (StringUtils.isEmpty(timeZone)) {
-            timeZone = "Asia/Shanghai";
-        }
-        sdf.setTimeZone(TimeZone.getTimeZone(timeZone));
+        sdf.setTimeZone(
+                StringUtils.isNotEmpty(timeZone)
+                        ? TimeZone.getTimeZone(timeZone)
+                        : TimeZone.getTimeZone(DateUtil.DEFAULT_ZONE_ID));
+
         String dateStr = sdf.format(date);
         Date res = new Date();
         try {