From ba262a5e8ce59bcf661a40ce33bba60e4a0a2400 Mon Sep 17 00:00:00 2001 From: Administrator <zhubaomin> Date: 星期一, 20 五月 2024 11:12:38 +0800 Subject: [PATCH] 2024-05-20 朱宝民 远程模块测试 --- pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/web/com/CommandCtrl.java | 32 ++++++++++---------------------- 1 files changed, 10 insertions(+), 22 deletions(-) diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/web/com/CommandCtrl.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/web/com/CommandCtrl.java index ddfb760..9e7ba68 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/web/com/CommandCtrl.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/web/com/CommandCtrl.java @@ -1,5 +1,6 @@ package com.dy.aceMw.web.com; +import com.dy.aceMw.server.ServerProperties; import com.dy.aceMw.server.forTcp.TcpSessionCache; import com.dy.aceMw.server.local.CommandInnerDeaLer; import com.dy.aceMw.server.local.ReturnCommand; @@ -11,10 +12,7 @@ import com.dy.common.webUtil.BaseResponseUtils; import lombok.extern.slf4j.Slf4j; import org.springframework.http.MediaType; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; /** @@ -28,6 +26,11 @@ @RequestMapping(path="com") @SuppressWarnings("unchecked")//java鐗堟湰瓒婇珮锛屽娉涘瀷绾︽潫瓒婁弗锛屾墍浠ラ厤缃甋uppressWarnings("unchecked") public class CommandCtrl { + + @GetMapping(path = "test") + public BaseResponse<String> test(){ + return BaseResponseUtils.buildSuccess("ok"); + } @PostMapping(path = "send", consumes = MediaType.APPLICATION_JSON_VALUE) public BaseResponse<Command> send(@RequestBody Command com) { @@ -97,7 +100,9 @@ if(onLine == null){ return BaseResponseUtils.buildError(ReturnCommand.errored("鍑洪敊锛孯TU锛堝湴鍧�=" + rtuAddr + "锛夋湭涓婄嚎锛�", command.getId(), command.getCode())) ; }else if(!onLine.booleanValue()){ - return BaseResponseUtils.buildError(ReturnCommand.errored("鍑洪敊锛孯TU锛堝湴鍧�=" + rtuAddr + "锛夌绾匡紒", command.getId(), command.getCode())) ; + if(!ServerProperties.isLowPower){ + return BaseResponseUtils.buildError(ReturnCommand.errored("鍑洪敊锛孯TU锛堝湴鍧�=" + rtuAddr + "锛夌绾匡紒", command.getId(), command.getCode())) ; + } } //鐢熸垚寮傛浠诲姟 @@ -114,21 +119,4 @@ return BaseResponseUtils.buildSuccess(ReturnCommand.successed("鍛戒护宸叉帴鍙楋紝鍗冲皢鏋勯�犲苟涓嬪彂鍛戒护銆�", command.getId(), command.getCode())); } - /** - * 鏀跺埌鍛戒护缁撴灉 - * @param command - private void dealCommandResult(String jgSenderName, Command command){ - Object obj = command.getParam() ; - if(obj != null){ - CommandBackParam p = (CommandBackParam)obj ; - if(p.getSuccess()){ - log.info("鍛戒护" + (command.getId().equals(Command.defaultId)?"":("(id=" + command.getId() + ")")) + "鎵ц鎴愬姛" - + (p.getMessage() == null?"":(p.getMessage().equals("")?"":("锛�" + p.getMessage())))); - }else{ - log.error("鍛戒护" + (command.getId().equals(Command.defaultId)?"":("(id=" + command.getId() + ")")) + "鎵ц澶辫触" - + (p.getMessage() == null?"":(p.getMessage().equals("")?"":("锛�" + p.getMessage())))); - } - } - } - */ } -- Gitblit v1.8.0