hfxc226 2 anos atrás
pai
commit
ba827d6dac

+ 2 - 10
platform-opc/src/main/java/com/platform/opc/servie/OpcService.java

@@ -63,11 +63,7 @@ public class OpcService {
                     RemoteOpc remoteOpc = new RemoteOpc();
                     // 因为有些标签是:PT_9836_AV,不能用 entry.getKey().split("_")[0],需要找到最后一个_
                     int index = entry.getKey().lastIndexOf("_");
-                    if (index == -1) {
-                        remoteOpc.setPositionNum(entry.getKey());
-                    } else {
-                        remoteOpc.setPositionNum(entry.getKey().substring(0, index));
-                    }
+                    remoteOpc.setPositionNum(entry.getKey());
                     remoteOpc.setCreatedFlag(0);
                     remoteOpc.setRemark("opc server未找到改点位。可能原因1:AV/DV配置错误,2:opc server中未配置");
                     log.error("opc server未找到该点位。key: " + remoteOpc.getPositionNum() + ", value: " + entry.getValue());
@@ -79,11 +75,7 @@ public class OpcService {
                     RemoteOpc remoteOpc = new RemoteOpc();
                     // 因为有些标签是:PT_9836_AV,不能用 entry.getKey().split("_")[0],需要找到最后一个_
                     int index = entry.getKey().lastIndexOf("_");
-                    if (index == -1) {
-                        remoteOpc.setPositionNum(entry.getKey());
-                    } else {
-                        remoteOpc.setPositionNum(entry.getKey().substring(0, index));
-                    }
+                    remoteOpc.setPositionNum(entry.getKey());
                     remoteOpc.setCreatedFlag(1);
                     remoteOpc.setRemark("opc server已配置,AV/DV配置正确");
                     log.error("opc server已配置。key: " + remoteOpc.getPositionNum() + ", value: " + entry.getValue());