From 5f933b4f2146c5f9c52877665dd2e0539324b84e Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期四, 14 十一月 2024 10:36:16 +0800
Subject: [PATCH] Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV
---
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeCtrl.java | 55 +++++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 43 insertions(+), 12 deletions(-)
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeCtrl.java
index 8b53bb0..bc79bf2 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeCtrl.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeCtrl.java
@@ -2,16 +2,17 @@
import com.dy.common.aop.SsoAop;
import com.dy.common.multiDataSource.DataSourceContext;
-import com.dy.common.softUpgrade.state.UpgradeInfo;
+import com.dy.common.softUpgrade.state.UpgradeRtu;
import com.dy.common.softUpgrade.state.UpgradeTaskVo;
import com.dy.common.springUtil.SpringContextUtil;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
+import com.dy.common.webUtil.QueryResultVo;
import com.dy.common.webUtil.ResultCodeMsg;
-import com.dy.pipIrrGlobal.pojoRm.UgRtuProgram;
-import com.dy.pipIrrGlobal.pojoRm.UgRtuTask;
+import com.dy.pipIrrGlobal.pojoUg.UgRtuProgram;
+import com.dy.pipIrrGlobal.pojoUg.UgRtuTask;
import com.dy.pipIrrGlobal.rtuMw.ToRtuMwCom;
-import com.dy.pipIrrGlobal.voRm.VoUpgradeDetail;
+import com.dy.pipIrrGlobal.voUg.VoWatch;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
@@ -26,6 +27,8 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
+
+import java.util.ArrayList;
import java.util.List;
/**
@@ -121,6 +124,7 @@
}
/**
+ * 鐩戣锛�
* 褰撳墠rtu杩滅▼鍗囩骇浠诲姟鎵ц鐘舵��
* @return 鎿嶄綔缁撴灉
*/
@@ -135,20 +139,47 @@
})
@GetMapping(path = "/curUpgradeState")
@SsoAop()
- public BaseResponse<UpgradeInfo> curUpgradeState(){
+ public BaseResponse<QueryResultVo<VoWatch> > curUpgradeState(QueryVo qvo){
if(RtuUpgradeStateReceiverCtrl.cache == null){
//return BaseResponseUtils.buildError("褰撳墠娌℃湁鍗囩骇浠诲姟") ;
//姝e紡杩愯鏃讹紝涓嬮潰涓よ鍘绘帀锛屼笂闈竴琛屾墦寮�
RtuUpgradeStateReceiverCtrl ctrl = SpringContextUtil.getBean(RtuUpgradeStateReceiverCtrl.class);
ctrl.demo();
}
- CurUpgradeStateVo vo = new CurUpgradeStateVo() ;
- List<VoUpgradeDetail> list = this.sv.selectTaskDetail(RtuUpgradeStateReceiverCtrl.cache.ugTaskId);
- if(list != null && list.size() > 0){
- vo.upgrade = list.get(0) ;
+
+ QueryResultVo<VoWatch> rsVo = new QueryResultVo();
+ VoWatch vo = new VoWatch() ;
+ vo.upgrade = this.sv.selectTaskDetail(RtuUpgradeStateReceiverCtrl.cache.ugTaskId);
+ vo.overall = RtuUpgradeStateReceiverCtrl.cache.ugOverallState ;
+ vo.rtus = new ArrayList<>() ;
+ if(RtuUpgradeStateReceiverCtrl.cache.ugRtuStateList != null && RtuUpgradeStateReceiverCtrl.cache.ugRtuStateList.size() > 0){
+ if(qvo.rtuAddr != null && !qvo.rtuAddr.trim().equals("")){
+ qvo.pageCurr = 1 ;
+ RtuUpgradeStateReceiverCtrl.cache.ugRtuStateList.stream().filter(rtu -> rtu.rtuAddr.equals(qvo.rtuAddr)).forEach(ugRtu -> {
+ VoWatch.VoWatchRtu rtu = new VoWatch.VoWatchRtu() ;
+ rtu.fromCache(ugRtu) ;
+ vo.rtus.add(rtu) ;
+ }); ;
+ }else{
+ if(qvo.pageCurr < 1){
+ qvo.pageCurr = 1 ;
+ }
+ int start = (qvo.pageCurr - 1) * qvo.pageSize ;
+ if(start >= RtuUpgradeStateReceiverCtrl.cache.ugRtuStateList.size()){
+ start = RtuUpgradeStateReceiverCtrl.cache.ugRtuStateList.size() - 1 ;
+ }
+ for(int i = start; i < (start + qvo.pageSize) && i < RtuUpgradeStateReceiverCtrl.cache.ugRtuStateList.size(); i++){
+ UpgradeRtu ugRtu = RtuUpgradeStateReceiverCtrl.cache.ugRtuStateList.get(i) ;
+ VoWatch.VoWatchRtu rtu = new VoWatch.VoWatchRtu() ;
+ rtu.fromCache(ugRtu) ;
+ vo.rtus.add(rtu) ;
+ }
+ }
}
- vo.ugOverallState = RtuUpgradeStateReceiverCtrl.cache.ugOverallState ;
- vo.ugRtuStateList = RtuUpgradeStateReceiverCtrl.cache.ugRtuStateList ;
- return BaseResponseUtils.buildSuccess(vo) ;
+ rsVo.obj = vo ;
+ rsVo.pageSize = qvo.pageSize ;
+ rsVo.pageCurr = qvo.pageCurr ;
+ rsVo.calculateAndSet(0L + vo.rtus.size(), null);
+ return BaseResponseUtils.buildSuccess(rsVo) ;
}
}
--
Gitblit v1.8.0