From 6fa8408c8133e8c9aee2bbcdec37bf95c20951c0 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期五, 07 二月 2025 15:39:16 +0800
Subject: [PATCH] 涉嫌偷水功能增加查询条件用水时长,修改sql语句
---
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/rtuMw/Web2RtuMw.java | 45 ++++++++++++++++++++++++++++++++++++---------
1 files changed, 36 insertions(+), 9 deletions(-)
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/rtuMw/Web2RtuMw.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/rtuMw/Web2RtuMw.java
index 86fc954..728a1ae 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/rtuMw/Web2RtuMw.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/rtuMw/Web2RtuMw.java
@@ -3,7 +3,6 @@
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 com.dy.common.webUtil.BaseResponseUtils;
import org.springframework.core.env.Environment;
@@ -57,20 +56,15 @@
* 鍚戦�氫俊涓棿浠跺彂閫乺tu杩滅▼鍗囩骇浠诲姟
* @param restTemplate SpringBoot鐨凴estTemplate
* @param toMwUrl 鍒伴�氫俊涓棿浠剁殑web璇锋眰Url
- * @param param 璇锋眰鍙傛暟
+ * @param body 璇锋眰鏁版嵁
* @return
*/
- protected BaseResponse sendRequest2Mw(RestTemplate restTemplate, String toMwUrl, Object param) {
+ protected BaseResponse sendPostRequest2Mw(RestTemplate restTemplate, String toMwUrl, Object body) {
String url = UriComponentsBuilder.fromUriString(toMwUrl)
.build()
.toUriString();
HttpHeaders headers = new HttpHeaders();
- HttpEntity<?> httpEntity ;
- if(param != null){
- httpEntity = new HttpEntity<>(param, headers);
- }else{
- httpEntity = new HttpEntity<>(headers);
- }
+ HttpEntity<?> httpEntity = new HttpEntity<>(body, headers);
ResponseEntity<BaseResponse> response = null;
try {
// 閫氳繃Post鏂瑰紡璋冪敤鎺ュ彛
@@ -87,6 +81,39 @@
}
/**
+ * 鍚戦�氫俊涓棿浠跺彂閫乺tu杩滅▼鍗囩骇浠诲姟
+ * @param restTemplate SpringBoot鐨凴estTemplate
+ * @param toMwUrl 鍒伴�氫俊涓棿浠剁殑web璇锋眰Url
+ * @return
+ */
+ protected BaseResponse sendGetRequest2Mw(RestTemplate restTemplate, String toMwUrl) {
+ String url = UriComponentsBuilder.fromUriString(toMwUrl)
+ .build()
+ .toUriString();
+
+ //UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(url)
+ // .queryParam("test", test);
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(url) ;
+
+ ResponseEntity<BaseResponse> response = null;
+ try {
+ // 閫氳繃Get鏂瑰紡璋冪敤鎺ュ彛
+ response = restTemplate.exchange(builder.toUriString(),
+ HttpMethod.GET,
+ new HttpEntity<>(new HttpHeaders()),
+ BaseResponse.class);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return BaseResponseUtils.buildError("鍚庣绯荤粺鍑洪敊锛屼腑闂翠欢璋冪敤寮傚父");
+ }
+ if(response == null){
+ return BaseResponseUtils.buildError("鍚庣绯荤粺鍑洪敊锛屼腑闂翠欢璋冪敤寮傚父");
+ }else{
+ return response.getBody();
+ }
+ }
+
+ /**
* 鍒涘缓澶栭儴鍛戒护锛堝彂缁欐帶鍒跺櫒锛�
* @param code 鍛戒护code
* @return
--
Gitblit v1.8.0