소스 검색

dcs完善

hfxc226 2 년 전
부모
커밋
b080a64165

+ 3 - 1
platform-opc/src/main/java/com/platform/opc/command/InitAddGroupAndItem.java

@@ -54,7 +54,9 @@ public class InitAddGroupAndItem implements CommandLineRunner {
         weekendCriteria.andEqualTo(RemoteOpc::getCreatedFlag, YesNoEnum.YES.getValue()).andEqualTo(RemoteOpc::getPositionFlag, YesNoEnum.YES.getValue());
         List<RemoteOpc> list = remoteOpcMapper.selectByExample(weekend);
         List<RemoteOpc> remoteOpcList = OpcDAClient.addGroupAndItems(list);
-        remoteOpcMapper.updateBatch(remoteOpcList);
+        if(CollectionUtils.isEmpty(remoteOpcList)){
+            remoteOpcMapper.updateBatch(remoteOpcList);
+        }
         RedisUtils.del(RedisKeyConstants.redis_ok);
         log.info("结束-初始化分组");
     }

+ 4 - 2
platform-opc/src/main/java/com/platform/opc/servie/OpcTask.java

@@ -46,8 +46,10 @@ public class OpcTask {
             List<String> uniqueStr = list.stream().distinct().collect(Collectors.toList());
             if (!CollectionUtils.isEmpty(uniqueStr)) {
                 List<RemoteOpc> remoteOpcList = OpcDAClient.addGroupAndItems(findAllItems(uniqueStr));
-                remoteOpcMapper.updateBatch(remoteOpcList);
-                log.info("添加新点位:" + uniqueStr);
+                if(CollectionUtils.isEmpty(remoteOpcList)){
+                    remoteOpcMapper.updateBatch(remoteOpcList);
+                    // log.info("添加新点位:" + uniqueStr);
+                }
             }
         }
         RedisUtils.del(RedisKeyConstants.redis_opc_wait_add_list);