From 39baeee8fe6d86d8898082c3f3100a810be91eec Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期五, 29 十一月 2024 15:45:24 +0800 Subject: [PATCH] 强制停止请求成功后,返回信息重构 --- pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeCtrl.java | 54 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 45 insertions(+), 9 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 d5929d6..bd975f9 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 @@ -3,7 +3,6 @@ import com.alibaba.excel.EasyExcel; import com.alibaba.excel.support.ExcelTypeEnum; import com.dy.common.aop.SsoAop; -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; @@ -12,8 +11,7 @@ import com.dy.common.webUtil.ResultCodeMsg; import com.dy.pipIrrGlobal.pojoUg.UgRtuProgram; import com.dy.pipIrrGlobal.pojoUg.UgRtuTask; -import com.dy.pipIrrGlobal.rtuMw.ToRtuMwCom; -import com.dy.pipIrrGlobal.voPr.VoDivide; +import com.dy.pipIrrGlobal.rtuMw.Web2RtuMw; import com.dy.pipIrrGlobal.voUg.VoUgRtuResult; import com.dy.pipIrrGlobal.voUg.VoWatch; import io.swagger.v3.oas.annotations.Operation; @@ -35,7 +33,6 @@ import java.io.UnsupportedEncodingException; import java.net.URLEncoder; -import java.util.ArrayList; import java.util.Base64; import java.util.List; @@ -48,7 +45,7 @@ @Tag(name = "rtu杩滅▼鍗囩骇浠诲姟", description = "rtu杩滅▼鍗囩骇浠诲姟鐩稿叧鎿嶄綔") @RestController @RequestMapping(path = "rtuUpgrade") -public class RtuUpgradeCtrl extends ToRtuMwCom { +public class RtuUpgradeCtrl extends Web2RtuMw { @Autowired private RtuUpgradeSv sv ; @@ -108,8 +105,8 @@ vo.rtuAddrList = taskRtuAddrs ; vo.callbackWebUrl = ugCallbackUrl_rm ; - String ugSendUrl = this.getToMwUgUrl(this.env) ; - BaseResponse res = sendUpgradeTask2Mw(restTemplate, ugSendUrl, vo) ; + String rqUrl = this.get2MwRequestUrl(this.env, ContextUgTaskSend) ; + BaseResponse res = sendPostRequest2Mw(restTemplate, rqUrl, vo) ; if(res != null){ if(res.isSuccess()){ this.sv.setUpgradeTaskExecuted(id); @@ -119,14 +116,53 @@ if(msg == null){ msg = res.getMsg() ; } - log.error("閫氫俊涓棿浠舵墽琛屼笅鍙戝崌绾т换鍔″け璐�" + msg) ; - return BaseResponseUtils.buildErrorMsg("閫氫俊涓棿浠舵墽琛屽け璐�" + msg) ; + log.error("閫氫俊涓棿浠舵墽琛屼笅鍙戝崌绾т换鍔″け璐ワ紝" + msg) ; + return BaseResponseUtils.buildErrorMsg("閫氫俊涓棿浠舵墽琛屽け璐ワ紝" + msg) ; } }else{ log.error("閫氫俊涓棿浠惰繑鍥炵粨鏋滀负null") ; return BaseResponseUtils.buildErrorMsg("閫氫俊涓棿浠惰繑鍥炵粨鏋滀负null") ; } } + /** + * 涓嬪彂寮哄埗缁撴潫褰撳墠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 = String.class))} + ) + }) + @GetMapping(path = "/forceOver") + @SsoAop() + public BaseResponse<String> forceOver() { + String rqUrl = this.get2MwRequestUrl(this.env, ContextUgForceOver) ; + BaseResponse res = sendGetRequest2Mw(restTemplate, rqUrl) ; + if(res != null){ + if(res.isSuccess()){ + String msg = res.getContent()==null?null:(String)res.getContent() ; + if(msg == null){ + msg = res.getMsg() ; + } + return BaseResponseUtils.buildResult(ResultCodeMsg.RsCode.SUCCESS_CODE, msg, msg) ; + }else{ + String msg = res.getContent()==null?null:(String)res.getContent() ; + if(msg == null){ + msg = res.getMsg() ; + } + log.error("閫氫俊涓棿浠舵墽琛屼笅鍙戝己鍒剁粨鏉熷綋鍓峳tu杩滅▼鍗囩骇浠诲姟澶辫触锛�" + msg) ; + return BaseResponseUtils.buildErrorMsg("閫氫俊涓棿浠舵墽琛屽己鍒剁粨鏉熷綋鍓峳tu杩滅▼鍗囩骇浠诲姟澶辫触锛�" + msg) ; + } + }else{ + log.error("閫氫俊涓棿浠惰繑鍥炵粨鏋滀负null") ; + return BaseResponseUtils.buildErrorMsg("閫氫俊涓棿浠惰繑鍥炵粨鏋滀负null") ; + } + } + private void valueFromPo(UpgradeTaskVo vo, UgRtuTask tpo, UgRtuProgram ppo){ vo.id = "" + tpo.id ; -- Gitblit v1.8.0