Browse Source

redis时间戳有时候是13位

xushili 1 năm trước cách đây
mục cha
commit
bf32fac218

+ 2 - 2
redisread/src/main/java/com/gyee/redisread/task/TaskRedisRead.java

@@ -74,7 +74,7 @@ public class TaskRedisRead implements Runnable {
                     if (ChangedSave.map.containsKey(pointid)) {
                         if (!Objects.equals(ChangedSave.map.get(pointid), datetime)) {
                             ChangedSave.map.put(pointid, datetime);
-                            ts = Long.valueOf(datetime) * 1000;
+                            ts = datetime.length()>10?Long.valueOf(datetime): Long.valueOf(datetime)* 1000;
                             bl = Double.valueOf(value) == 1;
                             //j++;
                             sb.append(pointid).append(" VALUES (").append(ts).append(",").append(bl).append(") ");
@@ -111,7 +111,7 @@ public class TaskRedisRead implements Runnable {
                     if (ChangedSave.map.containsKey(pointid)) {
                         if (!Objects.equals(ChangedSave.map.get(pointid), datetime)) {
                             ChangedSave.map.put(pointid, datetime);
-                            ts = Long.valueOf(datetime) * 1000;
+                            ts = datetime.length()>10?Long.valueOf(datetime): Long.valueOf(datetime)* 1000;
                             val = Double.valueOf(value);
 
                             //j++;