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 | 70 ++++++++++++++++++++++++++++++++++-
1 files changed, 68 insertions(+), 2 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 c8436a0..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,13 +2,17 @@
import com.dy.common.aop.SsoAop;
import com.dy.common.multiDataSource.DataSourceContext;
+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.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;
@@ -23,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;
/**
@@ -95,6 +101,7 @@
BaseResponse res = sendUpgradeTask2Mw(restTemplate, ugSendUrl, vo) ;
if(res != null){
if(res.isSuccess()){
+ this.sv.setUpgradeTaskExecuted(id);
return BaseResponseUtils.buildSuccess(true) ;
}else{
log.error("閫氫俊涓棿浠舵墽琛屼笅鍙戝崌绾т换鍔″け璐�" + (res.getMsg() == null? "" : ("锛�" + res.getMsg()))) ;
@@ -116,4 +123,63 @@
vo.softByteSrc16 = ppo.programCrc16 ;
}
+ /**
+ * 鐩戣锛�
+ * 褰撳墠rtu杩滅▼鍗囩骇浠诲姟鎵ц鐘舵��
+ * @return 鎿嶄綔缁撴灉
+ */
+ @Operation(summary = "褰撳墠rtu杩滅▼鍗囩骇浠诲姟鎵ц鐘舵��", description = "褰撳墠rtu杩滅▼鍗囩骇浠诲姟鎵ц鐘舵��")
+ @ApiResponses(value = {
+ @ApiResponse(
+ responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
+ description = "杩斿洖鎿嶄綔鎴愬姛涓庡惁鏁版嵁锛圔aseResponse.content:Boolean锛�",
+ content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
+ schema = @Schema(implementation = Boolean.class))}
+ )
+ })
+ @GetMapping(path = "/curUpgradeState")
+ @SsoAop()
+ public BaseResponse<QueryResultVo<VoWatch> > curUpgradeState(QueryVo qvo){
+ if(RtuUpgradeStateReceiverCtrl.cache == null){
+ //return BaseResponseUtils.buildError("褰撳墠娌℃湁鍗囩骇浠诲姟") ;
+ //姝e紡杩愯鏃讹紝涓嬮潰涓よ鍘绘帀锛屼笂闈竴琛屾墦寮�
+ RtuUpgradeStateReceiverCtrl ctrl = SpringContextUtil.getBean(RtuUpgradeStateReceiverCtrl.class);
+ ctrl.demo();
+ }
+
+ 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) ;
+ }
+ }
+ }
+ 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