From 39be193dece5ad6314aa22a41a2c8675e8057be3 Mon Sep 17 00:00:00 2001 From: zhubaomin <zhubaomin> Date: 星期二, 12 十一月 2024 15:19:36 +0800 Subject: [PATCH] Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV --- pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/rtuMw/ToRtuMwCom.java | 35 +++++++++++++++++++++++++++++++++++ 1 files changed, 35 insertions(+), 0 deletions(-) diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/rtuMw/ToRtuMwCom.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/rtuMw/ToRtuMwCom.java index 74099ea..dbe7d40 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/rtuMw/ToRtuMwCom.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/rtuMw/ToRtuMwCom.java @@ -3,6 +3,7 @@ import com.dy.common.multiDataSource.DataSourceContext; import com.dy.common.mw.protocol.Command; import com.dy.common.mw.protocol.CommandType; +import com.dy.common.softUpgrade.state.UpgradeTaskVo; import com.dy.common.webUtil.BaseResponse; import org.springframework.core.env.Environment; import org.springframework.http.HttpEntity; @@ -25,6 +26,7 @@ */ private static final String pro_mw = "mw"; private static final String key_mw = "comSendUrl"; + private static final String keyUg_mw = "ugTaskSendUrl"; /** @@ -34,6 +36,15 @@ */ protected String getToMwUrl(Environment env) { return env.getProperty(pro_mw + "." + DataSourceContext.get() + "." + key_mw); + } + + /** + * 寰楀埌鍚戦�氫俊涓棿浠跺彂閫佹暟鎹殑URL + * @param env + * @return + */ + protected String getToMwUgUrl(Environment env) { + return env.getProperty(pro_mw + "." + DataSourceContext.get() + "." + keyUg_mw); } /** @@ -82,4 +93,28 @@ } return response.getBody(); } + + + /** + * 鍚戦�氫俊涓棿浠跺彂閫乺tu杩滅▼鍗囩骇浠诲姟 + * @param restTemplate + * @param comSendUrl + * @param vo + * @return + */ + protected BaseResponse sendUpgradeTask2Mw(RestTemplate restTemplate, String comSendUrl, UpgradeTaskVo vo) { + String url = UriComponentsBuilder.fromUriString(comSendUrl) + .build() + .toUriString(); + HttpHeaders headers = new HttpHeaders(); + HttpEntity<UpgradeTaskVo> httpEntity = new HttpEntity<>(vo, headers); + ResponseEntity<BaseResponse> response = null; + try { + // 閫氳繃Post鏂瑰紡璋冪敤鎺ュ彛 + response = restTemplate.exchange(url, HttpMethod.POST, httpEntity, BaseResponse.class); + } catch (Exception e) { + e.printStackTrace(); + } + return response.getBody(); + } } -- Gitblit v1.8.0