Explorar el Código

完善opc展示

hfxc226 hace 1 año
padre
commit
a07e1c3ae9

+ 9 - 9
platform-dao/src/main/resources/mapper/remote/RemoteOpcMapper.xml

@@ -186,31 +186,31 @@
                     update_user_id = #{item.updateUserId},
                 </if>
                 <if test="item.updateTime != null">
-                    update_time = #{item.updateTime}
+                    update_time = #{item.updateTime},
                 </if>
                 <if test="item.avFlag != null">
-                    av_flag = #{item.avFlag}
+                    av_flag = #{item.avFlag},
                 </if>
                 <if test="item.createdFlag != null">
-                    created_flag = #{item.createdFlag}
+                    created_flag = #{item.createdFlag},
                 </if>
                 <if test="item.positionFlag != null">
-                    position_flag = #{item.positionFlag}
+                    position_flag = #{item.positionFlag},
                 </if>
                 <if test="item.fetchFlag != null">
-                    fetch_flag = #{fetchFlag}
+                    fetch_flag = #{item.fetchFlag},
                 </if>
                 <if test="item.portFlag != null">
-                    port_flag = #{portFlag}
+                    port_flag = #{item.portFlag},
                 </if>
                 <if test="item.xPosition != null">
-                    x_position = #{item.xPosition}
+                    x_position = #{item.xPosition},
                 </if>
                 <if test="item.yPosition != null">
-                    y_position = #{item.yPosition}
+                    y_position = #{item.yPosition},
                 </if>
                 <if test="item.width != null">
-                    width = #{item.width}
+                    width = #{item.width},
                 </if>
                 <if test="item.height != null">
                     height = #{item.height}

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

@@ -36,6 +36,7 @@ public class InitAddGroupAndItem implements CommandLineRunner {
         // 情况redis缓存
         RedisUtils.del(RedisKeyConstants.redis_ok);
         RedisUtils.del(RedisKeyConstants.redis_opc_update_flag);
+        RedisUtils.del(RedisKeyConstants.redis_opc_wait_add_list);
         OpcDAClient.connect();
     }
     /**
@@ -59,7 +60,8 @@ public class InitAddGroupAndItem implements CommandLineRunner {
         List<RemoteOpc> list = remoteOpcMapper.selectByExample(weekend);
         List<RemoteOpc> remoteOpcList = OpcDAClient.addGroupAndItems(list);
         if(!CollectionUtils.isEmpty(remoteOpcList)){
-            remoteOpcMapper.updateBatch(remoteOpcList);
+            //log.info("updateBatch: " + remoteOpcList);
+            //remoteOpcMapper.updateBatch(remoteOpcList);
         }
         RedisUtils.del(RedisKeyConstants.redis_ok);
         log.info("结束-初始化分组");

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

@@ -37,9 +37,10 @@ public class OpcTask {
      */
     @Scheduled(fixedDelay = 60000)
     public void addAndDelItems() {
-        log.info("启动追加");
+        log.info("尝试启动追加");
         String ok = RedisUtils.getString(RedisKeyConstants.redis_ok);
         if (StringUtils.isBlank(ok)) {
+            log.info("启动追加");
             RedisUtils.setString(RedisKeyConstants.redis_opc_update_flag, "1");
             List<String> list = RedisUtils.getList(RedisKeyConstants.redis_opc_wait_add_list, 0, -1);
             if (!CollectionUtils.isEmpty(list)) {
@@ -47,7 +48,7 @@ public class OpcTask {
                 if (!CollectionUtils.isEmpty(uniqueStr)) {
                     List<RemoteOpc> remoteOpcList = OpcDAClient.addGroupAndItems(findAllItems(uniqueStr));
                     if (!CollectionUtils.isEmpty(remoteOpcList)) {
-                        remoteOpcMapper.updateBatch(remoteOpcList);
+                        // remoteOpcMapper.updateBatch(remoteOpcList);
                         // log.info("添加新点位:" + uniqueStr);
                     }
                 }
@@ -67,6 +68,8 @@ public class OpcTask {
             }
             RedisUtils.del(RedisKeyConstants.redis_opc_wait_remove_list);
             RedisUtils.del(RedisKeyConstants.redis_opc_update_flag);
+        }else{
+            log.info("初始化启动未结束,不追加");
         }
     }
 

+ 2 - 0
platform-opc/src/main/java/com/platform/opc/util/OpcDAClient.java

@@ -161,7 +161,9 @@ public class OpcDAClient {
         Group group = null;
         try {
             if (!CollectionUtils.isEmpty(groupList)) {
+                log.info("groupList: " + groupList.size());
                 for (Group checkGroup : groupList) {
+                    log.info("checkGroup: " + checkGroup.getName());
                     if (checkGroup.getName().equals(entry.getKey())) {
                         log.info("已存在分组line id: " + entry.getKey());
                         group = checkGroup;