Browse Source

opc完善

hfxc226 2 years ago
parent
commit
5ca784b628

+ 6 - 1
platform-opc/src/main/java/com/platform/opc/servie/OpcTaskService.java

@@ -161,7 +161,7 @@ public class OpcTaskService {
                 remoteOpcLog.setDay(localDateTime.getDayOfMonth());
                 // remoteOpcLog.setHour(localDateTime.getHour());
                 // remoteOpcLog.setMinute(localDateTime.getMinute());
-                remoteOpcLog.setRemark(localDateTime.getHour() + ":" + localDateTime.getMinute() + ":" + localDateTime.getSecond() + ":" + "," + result.getValue() + ";");
+                remoteOpcLog.setRemark(result.getTime().split(" ")[1] + "," + result.getValue() + ";");
                 remoteOpcLogList.add(remoteOpcLog);
                 //log.info("id: " + result.getId() + ", value: " + result.getValue() + ", time: " + result.getTime());
             }
@@ -176,4 +176,9 @@ public class OpcTaskService {
         }
         log.info("结束读取redis1");
     }
+
+    public static void main(String[] args) {
+        String time = "2022-11-12 12:04:06";
+        System.out.println(time.split(" ")[1]);
+    }
 }

+ 1 - 1
platform-opc/src/main/resources/application-prod.yml

@@ -4,7 +4,7 @@ spring:
   redis:
     password:
     port: 6379
-    host: localhost
+    host: 192.168.16.222
     database: 1
     timeout: 0            # 连接空闲超过 N(毫秒)后关闭,0为禁用
     # 使用jedis连接池,需要排除lettuce-core,依赖jedis

+ 1 - 1
platform-opc/src/main/resources/application-test.yml

@@ -4,7 +4,7 @@ spring:
   redis:
     password:
     port: 6379
-    host: localhost
+    host: 192.168.16.222
     database: 1
     timeout: 0            # 连接空闲超过 N(毫秒)后关闭,0为禁用
     # 使用jedis连接池,需要排除lettuce-core,依赖jedis