hfxc226 2 yıl önce
ebeveyn
işleme
4349c239e9

+ 4 - 0
platform-dao/src/main/java/com/platform/dao/dto/remote/RemoteOpcDTO.java

@@ -21,6 +21,10 @@ import java.time.LocalDateTime;
 @Accessors(chain = true)
 @EqualsAndHashCode(callSuper = true)
 public class RemoteOpcDTO extends BaseDTO implements Serializable {
+    /**
+     * 是否配置了显示位置:0否,1是,导入的时候默认0
+     */
+    private Integer positionFlag;
     /**
      * x轴位置
      */

+ 4 - 0
platform-dao/src/main/java/com/platform/dao/entity/remote/RemoteOpc.java

@@ -21,6 +21,10 @@ import java.time.LocalDateTime;
 @Accessors(chain = true)
 @Table(name = "t_remote_opc")
 public class RemoteOpc implements Serializable {
+    /**
+     * 是否配置了显示位置:0否,1是,导入的时候默认0
+     */
+    private Integer positionFlag;
     /**
      * x轴位置
      */

+ 4 - 0
platform-dao/src/main/java/com/platform/dao/vo/query/remote/RemoteOpcVO.java

@@ -19,6 +19,10 @@ import java.time.LocalDateTime;
 @Accessors(chain = true)
 @EqualsAndHashCode(callSuper = true)
 public class RemoteOpcVO extends BaseVO implements Serializable {
+    /**
+     * 是否配置了显示位置:0否,1是,导入的时候默认0
+     */
+    private Integer positionFlag;
     /**
      * x轴位置
      */

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

@@ -15,6 +15,7 @@
                                      opc.result,
                                      opc.av_flag,
                                      opc.created_flag,
+                                     opc.position_flag,
                                      opc.x_position,
                                      opc.y_position,
                                      opc.width,
@@ -39,6 +40,7 @@
                                      opc.result,
                                      opc.av_flag,
                                      opc.created_flag,
+                                     opc.position_flag,
                                      opc.x_position,
                                      opc.y_position,
                                      opc.width,
@@ -57,6 +59,9 @@
         <if test="avFlag != null and avFlag != ''">
             and opc.av_flag = #{avFlag}
         </if>
+        <if test="positionFlag != null and positionFlag != ''">
+            and opc.position_flag = #{positionFlag}
+        </if>
         <if test="sbId != null and sbId != ''">
             and opc.sb_id = #{sbId}
         </if>
@@ -149,6 +154,21 @@
                 <if test="item.createdFlag != null">
                     created_flag = #{item.createdFlag}
                 </if>
+                <if test="item.positionFlag != null">
+                    position_flag = #{item.positionFlag}
+                </if>
+                <if test="item.xPosition != null">
+                    x_position = #{item.xPosition}
+                </if>
+                <if test="item.yPosition != null">
+                    y_position = #{item.yPosition}
+                </if>
+                <if test="item.width != null">
+                    width = #{item.width}
+                </if>
+                <if test="item.height != null">
+                    height = #{item.height}
+                </if>
             </set>
             where position_num = #{item.positionNum}
         </foreach>

+ 2 - 0
platform-iec/src/main/java/com/ydl/iec/iec104/core/ScheduledTaskPool.java

@@ -203,6 +203,8 @@ public class ScheduledTaskPool {
                                 if(list.size() < count){
                                     LOGGER.info("电度已采集数量:" + list.size() + ", 总电度数量:" + count);
                                     ctx.channel().writeAndFlush(BasicInstruction104.getGeneralCallRuleDetail104Degree());
+                                }else{
+                                    LOGGER.info("电度已采集数量:" + list.size() + ", 总电度数量:" + count + ",此时间范围内不再采集");
                                 }
                             }else{
                                 LOGGER.info("电度已采集数量:0" + ", 总电度数量:" + count);

+ 18 - 8
platform-opc/src/main/java/com/platform/opc/servie/OpcTaskService.java

@@ -1,8 +1,10 @@
 package com.platform.opc.servie;
 
+import com.alibaba.fastjson.JSON;
 import com.platform.common.constant.UpmsRedisKeyConstants;
 import com.platform.common.util.BeanUtils;
 import com.platform.common.util.RedisUtils;
+import com.platform.common.util.StringUtils;
 import com.platform.dao.entity.remote.RemoteOpc;
 import com.platform.dao.mapper.remote.RemoteOpcMapper;
 import com.platform.dao.mapper.upms.SysDictMapper;
@@ -16,8 +18,10 @@ import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
 
 import javax.annotation.PostConstruct;
+import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
@@ -38,9 +42,11 @@ public class OpcTaskService {
     public void getValue(){
         log.info("开始定时任务");
         List<OpcResult> resultList = OpcDAClient.getItemValuesList();
-        log.info("resultList数量:" + resultList.size());
-        log.info("数据存入redis");
-        RedisUtils.setList("opcList", resultList);
+        if(!CollectionUtils.isEmpty(resultList)){
+            log.info("resultList数量:" + resultList.size());
+            String str = JSON.toJSONString(resultList);
+            RedisUtils.setString("opcList", str);
+        }
         log.info("结束定时任务");
     }
 
@@ -55,11 +61,15 @@ public class OpcTaskService {
     @Scheduled(fixedDelay = 60000)  //间隔60秒
     public void saveValue(){
         log.info("开始读取redis");
-        List<OpcResult>  resultList = RedisUtils.getList("opcList", 0 , -1);
-        log.info("resultList数量:" + resultList.size());
-        /*for(OpcResult result: resultList){
-            log.info("id: " + result.getId() + ", value: " + result.getValue() + ", time: " + result.getTime());
-        }*/
+        String jsonStr= RedisUtils.getString("opcList");
+        if(StringUtils.isNotBlank(jsonStr)){
+            log.info("jsonStr2:" + jsonStr);
+            List<OpcResult>  resultList = JSON.parseArray(jsonStr, OpcResult.class);
+            log.info("resultList数量:" + resultList.size());
+            /*for(OpcResult result: resultList){
+                log.info("id: " + result.getId() + ", value: " + result.getValue() + ", time: " + result.getTime());
+            }*/
+        }
         log.info("结束读取redis");
     }
 }