From e48d097ca0532090a7a109af4c2c9c6e1b288a34 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期四, 05 十二月 2024 15:06:43 +0800
Subject: [PATCH] 优化代码
---
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/MonitorSv.java | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/MonitorSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/MonitorSv.java
index e4df6c0..4dd99a2 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/MonitorSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/MonitorSv.java
@@ -61,7 +61,7 @@
* @param rtuAddr
* @return
*/
- public RtuStatus rtuStatus(String rtuAddr){
+ public RtuStatus rtuStatus(String rtuAddr) throws Exception{
//鍚戦�氫俊涓棿浠跺彂鍏冲懡浠わ紝鏌ヨ閮ㄥ垎RTU鍦ㄧ嚎鎯呭喌
RtuStatus rtuStatus = null ;
Command com = this.createInnerCommand(CodeLocal.oneRtuStates);
@@ -75,16 +75,23 @@
if(bakParam != null){
if(bakParam.getSuccess().booleanValue()){
//閫氫俊涓棿浠舵垚鍔熻繑鍥炲懡浠ょ粨鏋�
- rtuStatus = JSON.parseObject(JSON.toJSONString(reCom.getAttachment()), RtuStatus.class);
+ if(reCom.getAttachment() != null){
+ rtuStatus = JSON.parseObject(JSON.toJSONString(reCom.getAttachment()), RtuStatus.class);
+ }else{
+ throw new Exception("閫氫俊涓棿浠舵湭鎺屾彙璇TU鐨勭姸鎬侊紝鍙兘璇TU鏈笂绾�") ;
+ }
}
}else{
log.error("閫氫俊涓棿浠惰繑鍥炲唴閮ㄥ懡浠ょ粨鏋滀腑涓嶅寘鍚獵ommandBackParam绫诲瀷鍙傛暟");
+ throw new Exception("閫氫俊涓棿浠舵墽琛屽懡浠ゅ嚭閿�") ;
}
}else{
log.error("閫氫俊涓棿浠惰繑鍥炲唴閮ㄥ懡浠ゆ墽琛屽け璐�" + (res.getMsg() == null? "" : ("锛�" + res.getMsg()))) ;
+ throw new Exception("閫氫俊涓棿浠舵墽琛屽懡浠ゅ嚭閿�" + (res.getMsg() == null? "" : ("锛�" + res.getMsg()))) ;
}
}else{
log.error("閫氫俊涓棿浠惰繑鍥炲唴閮ㄥ懡浠ょ粨鏋滀负null");
+ throw new Exception("閫氫俊涓棿浠舵墽琛屽懡浠ゅ嚭閿欙紝杩斿洖鍐呴儴鍛戒护缁撴灉涓簄ull") ;
}
return rtuStatus ;
}
--
Gitblit v1.8.0