From c42614978ff12013a1eabebd0289b27169a5784f Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期二, 06 五月 2025 17:25:56 +0800 Subject: [PATCH] 1、实现万功能token(0000-0000-1234-9876-5); 2、web端单独实现命令结果等待器,并相应修改相关部分; 3、web端实现透传命令; 4、修改一些不当注释; 5、优化一些代码。 --- pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/tasks/SendMsConstantTask.java | 81 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 81 insertions(+), 0 deletions(-) diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/tasks/SendMsConstantTask.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/tasks/SendMsConstantTask.java new file mode 100644 index 0000000..a57a546 --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/tasks/SendMsConstantTask.java @@ -0,0 +1,81 @@ +package com.dy.rtuMw.server.tasks; + +import com.dy.common.mw.core.CoreTask; +import com.dy.common.queue.Node; +import com.dy.rtuMw.server.forMs.MsObj4Ding; +import com.dy.rtuMw.server.forMs.SendMsCache; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +/** + * @Author: liurunyu + * @Date: 2024/7/31 18:45 + * @Description + */ +public class SendMsConstantTask extends CoreTask { + + private static final Logger log = LogManager.getLogger(SendMsConstantTask.class.getName()); + + /** + * 鍦ㄥ崟绾跨▼鐜涓繍琛� + */ + @Override + public Integer execute() { + try{ + //log.info("褰撳墠娑堟伅闃熷垪涓繕鏈夌粨鐐规暟閲忥細" + SendMsCache.size()); + dealMs() ; + }catch(Exception e){ + log.error(e); + } + return SendMsCache.size()>0?0:1 ; + } + + /** + * 澶勭悊涓嬭鍛戒护 + */ + public void dealMs() { + Node first = SendMsCache.getFirstQueueNode() ; + if(first != null){ + Node last = SendMsCache.getLastQueueNode() ; + while (last != null){ + last = this.doDealMs(first, last); + } + } + } + /** + * 澶勭悊缂撳瓨鐨勪笅琛岃妭鐐� + * @param first 绗竴涓妭鐐� + * @param last 鏈�鍚庝竴涓妭鐐� + */ + private Node doDealMs(Node first, Node last){ + if(last != null){ + //鍦╠ealNode鏂规硶涓紝鍙兘瑕佹妸last浠庨槦鍒椾腑绉婚櫎锛岃繖鏃秎ast.pre涓虹┖锛屾墍浠ユ彁鍓嶆妸last.pre鍙栧嚭鏉� + Node pre = last.pre ; + dealNode(last) ; + if(first != last){ + return pre ; + }else{ + //鍋滄 + return null ; + } + }else{ + return null ; + } + } + + /** + * 澶勭悊涓�涓妭鐐� + * @param node 鑺傜偣 + */ + private void dealNode(Node node){ + if(node != null && node.obj != null){ + MsObj4Ding obj = (MsObj4Ding)node.obj ; + boolean removeNode = obj.dealSelf() ; + if(removeNode){ + SendMsCache.removeNode(node); + } + } + } + + +} -- Gitblit v1.8.0