From cef843b8175ab3775036f705f7cf69e4bd32c4f3 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期二, 16 一月 2024 16:53:07 +0800
Subject: [PATCH] 1、修改获得绑定控制器的方法; 2、添加文档“取水口控制哭喊及测控数据关系”

---
 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/ToRtuConstantTask.java |  120 ++++++++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 92 insertions(+), 28 deletions(-)

diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/ToRtuConstantTask.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/ToRtuConstantTask.java
index 08721c8..3de49a2 100644
--- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/ToRtuConstantTask.java
+++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/ToRtuConstantTask.java
@@ -5,9 +5,9 @@
 
 import com.dy.common.queue.Node;
 import com.dy.common.mw.core.CoreTask;
-import com.dy.aceMw.server.forTcp.TcpDownCommandCach;
+import com.dy.aceMw.server.forTcp.TcpDownCommandCache;
 import com.dy.aceMw.server.forTcp.TcpDownCommandObj;
-import com.dy.aceMw.server.forTcp.TcpSessionCach;
+import com.dy.aceMw.server.forTcp.TcpSessionCache;
 
 /**
  * 澶勭悊RTU涓嬭鍛戒护鏁版嵁鐨勬亽涔呬换鍔�
@@ -19,47 +19,88 @@
 	 * 鍦ㄥ崟绾跨▼鐜涓繍琛�
 	 */
 	@Override
-	public Integer excute() {
+	public Integer execute() {
 		try{
-			Long now = System.currentTimeMillis() ;
-			dealTcpSession(now) ;
-			return dealDownCommand(now) ;
+			dealTcpSession() ;
+		}catch(Exception e){
+			log.error("鏇存柊RTU浼氳瘽涓婃姤鏁版嵁鏃跺埢鏃跺彂鐢熼泦鍚堟搷浣滃紓甯革紝姝ゅ紓甯稿苟涓嶅奖鍝嶇郴缁熸甯歌繍琛�", e);
+		}
+		try{
+			//log.info("褰撳墠涓嬭鍛戒护闃熷垪涓繕鏈夌粨鐐规暟閲忥細" + TcpDownCommandCache.size());
+			dealDownCom() ;
 		}catch(Exception e){
 			log.error(e);
 		}
-		return null ;
+		return TcpDownCommandCache.size()>0?0:1 ;
 	}
 	/**
 	 * 澶勭悊TCP缂撳瓨涓殑鍚勪釜TCP Session鐨勪笂琛屾暟鎹椂鍒�
 	 */
-	private void dealTcpSession(Long now){
-		TcpSessionCach.updateUpDataTime(now) ;
+	private void dealTcpSession(){
+		TcpSessionCache.updateUpDataTime(System.currentTimeMillis() ) ;
 	}
-	
+
+
 	/**
 	 * 澶勭悊涓嬭鍛戒护
 	 */
-	public Integer dealDownCommand(Long now) {
-		try{
-			Node first = TcpDownCommandCach.getFirstQueueNode() ;
-			if(first != null){
-				Integer count = TcpDownCommandCach.size() ;
-				Node last = TcpDownCommandCach.getLastQueueNode() ;
-				this.doDealDownCommand(now, first, last);
-				return count ;
+	public void dealDownCom() {
+		Node first = TcpDownCommandCache.getFirstQueueNode() ;
+		if(first != null){
+			Node last = TcpDownCommandCache.getLastQueueNode() ;
+			while (last != null){
+				last = this.doDealDownComm(System.currentTimeMillis(), first, last);
 			}
-		}catch(Exception e){
-			log.error(e);
 		}
-		return null ;
 	}
 	/**
 	 * 澶勭悊缂撳瓨鐨勪笅琛屽懡浠よ妭鐐�
 	 * @param now 褰撳墠鏃跺埢
 	 * @param first 绗竴涓妭鐐�
-	 * @param last 鏄悗涓�涓妭鐐�
+	 * @param last 鏈�鍚庝竴涓妭鐐�
 	 */
-	private void doDealDownCommand(Long now, Node first, Node last){
+	private Node doDealDownComm(Long now, Node first, Node last){
+		if(last != null){
+			//鍦╠ealNode鏂规硶涓紝鍙兘瑕佹妸last浠庨槦鍒椾腑绉婚櫎锛岃繖鏃秎ast.pre涓虹┖锛屾墍浠ユ彁鍓嶆妸last.pre鍙栧嚭鏉�
+			Node pre = last.pre ;
+			dealNode(now, last) ;
+			if(first != last){
+				return pre ;
+			}else{
+				//鍋滄
+				return null ;
+			}
+		}else{
+			return null ;
+		}
+	}
+
+
+
+	////////////////////////////////////////////////
+	//
+	//浠ヤ笅瀹炵幇锛岄噰鐢ㄤ簡閫掑綊璋冪敤锛屽綋闃熷垪缂撳瓨缁撶偣寰堝鏃讹紝浼氫骇鐢熸爤婧㈠嚭寮傚父
+	//
+	////////////////////////////////////////////////
+	/**
+	 * 澶勭悊涓嬭鍛戒护
+	public Integer dealDownCommand(Long now) {
+		Node first = TcpDownCommandCache.getFirstQueueNode() ;
+		if(first != null){
+			Integer count = TcpDownCommandCache.size() ;
+			Node last = TcpDownCommandCache.getLastQueueNode() ;
+			this.doDealDownCommand(now, first, last);
+			return count ;
+		}
+		return null ;
+	}
+	 */
+	/**
+	 * 澶勭悊缂撳瓨鐨勪笅琛屽懡浠よ妭鐐�
+	 * @param now 褰撳墠鏃跺埢
+	 * @param first 绗竴涓妭鐐�
+	 * @param last 鏈�鍚庝竴涓妭鐐�
+	private void doDealDownCommand1(Long now, Node first, Node last){
 		if(first != null){
 			//鍦╠ealNode鏂规硶涓紝鍙兘瑕佹妸first浠庨槦鍒椾腑绉婚櫎锛岃繖鏃秄irst.next涓虹┖锛屾墍浠ユ彁鍓嶆妸first.next鍙栧嚭鏉�
 			Node next = first.next ;
@@ -74,17 +115,40 @@
 			}
 		}
 	}
-	
+	 */
+	/**
+	 * 澶勭悊缂撳瓨鐨勪笅琛屽懡浠よ妭鐐�
+	 * @param now 褰撳墠鏃跺埢
+	 * @param first 绗竴涓妭鐐�
+	 * @param last 鏈�鍚庝竴涓妭鐐�
+	private void doDealDownCommand(Long now, Node first, Node last){
+		if(last != null){
+			//鍦╠ealNode鏂规硶涓紝鍙兘瑕佹妸last浠庨槦鍒椾腑绉婚櫎锛岃繖鏃秎ast.pre涓虹┖锛屾墍浠ユ彁鍓嶆妸last.pre鍙栧嚭鏉�
+			Node pre = last.pre ;
+			dealNode(now, last) ;
+			if(first != null && first != last){
+				doDealDownCommand(now, first, pre) ;
+			}else if(first != null && first == last){
+				//鍋滄
+			}else if(first == null){
+				//杩欑鎯呭喌涓嶄細瀛樺湪
+				doDealDownCommand(now, null, pre) ;
+			}
+		}
+	}
+	 */
 	/**
 	 * 澶勭悊涓�涓妭鐐�
 	 * @param now 鐜板湪鏃跺埢
 	 * @param node 鑺傜偣
 	 */
 	private void dealNode(Long now, Node node){
-		TcpDownCommandObj obj = (TcpDownCommandObj)node.obj ;
-		boolean removeNode = obj.dealSelf(now) ;
-		if(removeNode){
-			TcpDownCommandCach.removeNode(node);
+		if(node != null && node.obj != null){
+			TcpDownCommandObj obj = (TcpDownCommandObj)node.obj ;
+			boolean removeNode = obj.dealSelf(now) ;
+			if(removeNode){
+				TcpDownCommandCache.removeNode(node);
+			}
 		}
 	}
 

--
Gitblit v1.8.0