From 082b9ab8643bc5e81f2e70b8e9400fdaba62e686 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期三, 03 九月 2025 17:19:18 +0800
Subject: [PATCH] 修改小程序首页查询重复bug
---
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/TCECUtil.java | 69 ++++++++++++++++++++++------------
1 files changed, 45 insertions(+), 24 deletions(-)
diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/TCECUtil.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/TCECUtil.java
index 8d147f0..b338caf 100644
--- a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/TCECUtil.java
+++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/TCECUtil.java
@@ -40,7 +40,7 @@
* 获取token
*/
public static String queryToken(Operator operator){
- HttpRequest post = HttpUtil.createPost(operator.getTestUrl() + InterfaceUrlEnum.QUERY_TOKEN.getUrl());
+ HttpRequest post = HttpUtil.createPost(operator.getUrl() + InterfaceUrlEnum.QUERY_TOKEN.getUrl());
JSONObject info = new JSONObject();
info.put("OperatorID", operator.getOurOperatorId());
info.put("OperatorSecret", operator.getOperatorSecret());
@@ -61,12 +61,13 @@
log.info("获取三方平台授权token请求Data:" + jsonString);
post.body(request_json);
HttpResponse execute = post.execute();
+ String body = execute.body();
if(200 != execute.getStatus()){
- log.error("获取三方平台授权token失败:" + execute.body());
+ log.error("获取三方平台授权token失败:" + body);
return null;
}
- log.info("获取三方平台授权token响应参数:" + execute.body());
- BaseResult baseResult = JSON.parseObject(execute.body(), BaseResult.class);
+ log.info("获取三方平台授权token响应参数:" + body);
+ BaseResult baseResult = JSON.parseObject(body, BaseResult.class);
Integer Ret = baseResult.getRet();
if(0 != Ret){
log.error("获取三方平台授权token失败:" + baseResult.getMsg());
@@ -104,15 +105,16 @@
* @param info
*/
public static NotificationStationStatusResult notificationStationStatus(Operator operator, ConnectorStatusInfo info) {
- HttpRequest post = HttpUtil.createPost(operator.getTestUrl() + InterfaceUrlEnum.NOTIFICATION_STATION_STATUS.getUrl());
+ HttpRequest post = HttpUtil.createPost(operator.getUrl() + InterfaceUrlEnum.NOTIFICATION_STATION_STATUS.getUrl());
buildBody(post, info, operator);
HttpResponse execute = post.execute();
+ String body = execute.body();
if(200 != execute.getStatus()){
- log.error("推送三方平台设备状态失败:" + execute.body());
+ log.error("推送三方平台设备状态失败:" + body);
return null;
}
- log.info("推送三方平台设备状态响应:" + execute.body());
- BaseResult baseResult = JSON.parseObject(execute.body(), BaseResult.class);
+ log.info("推送三方平台设备状态响应:" + body);
+ BaseResult baseResult = JSON.parseObject(body, BaseResult.class);
Integer Ret = baseResult.getRet();
if(0 != Ret){
log.error("推送三方平台设备状态失败:" + baseResult.getMsg());
@@ -136,15 +138,16 @@
* @return
*/
public static NotificationStartChargeResult notificationStartChargeResult(Operator operator, NotificationStartCharge info){
- HttpRequest post = HttpUtil.createPost(operator.getTestUrl() + InterfaceUrlEnum.NOTIFICATION_START_CHARGE_RESULT.getUrl());
+ HttpRequest post = HttpUtil.createPost(operator.getUrl() + InterfaceUrlEnum.NOTIFICATION_START_CHARGE_RESULT.getUrl());
buildBody(post, info, operator);
HttpResponse execute = post.execute();
+ String body = execute.body();
if(200 != execute.getStatus()){
- log.error("推送三方平台启动充电结果失败:" + execute.body());
+ log.error("推送三方平台启动充电结果失败:" + body);
return null;
}
- log.info("推送三方平台启动充电结果响应:" + execute.body());
- BaseResult baseResult = JSON.parseObject(execute.body(), BaseResult.class);
+ log.info("推送三方平台启动充电结果响应:" + body);
+ BaseResult baseResult = JSON.parseObject(body, BaseResult.class);
Integer Ret = baseResult.getRet();
if(0 != Ret){
log.error("推送三方平台启动充电结果失败:" + baseResult.getMsg());
@@ -169,15 +172,16 @@
* @return
*/
public static NotificationEquipChargeStatusResult notificationEquipChargeStatus(Operator operator, QueryEquipChargeStatusResult info){
- HttpRequest post = HttpUtil.createPost(operator.getTestUrl() + InterfaceUrlEnum.NOTIFICATION_EQUIP_CHARGE_STATUS.getUrl());
+ HttpRequest post = HttpUtil.createPost(operator.getUrl() + InterfaceUrlEnum.NOTIFICATION_EQUIP_CHARGE_STATUS.getUrl());
buildBody(post, info, operator);
HttpResponse execute = post.execute();
+ String body = execute.body();
if(200 != execute.getStatus()){
- log.error("推送三方平台充电状态失败:" + execute.body());
+ log.error("推送三方平台充电状态失败:" + body);
return null;
}
- log.info("推送三方平台充电状态响应:" + execute.body());
- BaseResult baseResult = JSON.parseObject(execute.body(), BaseResult.class);
+ log.info("推送三方平台充电状态响应:" + body);
+ BaseResult baseResult = JSON.parseObject(body, BaseResult.class);
Integer Ret = baseResult.getRet();
if(0 != Ret){
log.error("推送三方平台充电状态失败:" + baseResult.getMsg());
@@ -197,15 +201,16 @@
* @return
*/
public static NotificationStopCharge notificationStopChargeResult(Operator operator, NotificationStopChargeResult info){
- HttpRequest post = HttpUtil.createPost(operator.getTestUrl() + InterfaceUrlEnum.NOTIFICATION_STOP_CHARGE_RESULT.getUrl());
+ HttpRequest post = HttpUtil.createPost(operator.getUrl() + InterfaceUrlEnum.NOTIFICATION_STOP_CHARGE_RESULT.getUrl());
buildBody(post, info, operator);
HttpResponse execute = post.execute();
+ String body = execute.body();
if(200 != execute.getStatus()){
- log.error("推送三方平台停止充电结果失败:" + execute.body());
+ log.error("推送三方平台停止充电结果失败:" + body);
return null;
}
- log.info("推送三方平台停止充电结果响应:" + execute.body());
- BaseResult baseResult = JSON.parseObject(execute.body(), BaseResult.class);
+ log.info("推送三方平台停止充电结果响应:" + body);
+ BaseResult baseResult = JSON.parseObject(body, BaseResult.class);
Integer Ret = baseResult.getRet();
if(0 != Ret){
log.error("推送三方平台停止充电结果失败:" + baseResult.getMsg());
@@ -227,15 +232,17 @@
* @return
*/
public static NotificationChargeOrderInfoResult notificationChargeOrderInfo(Operator operator, NotificationChargeOrderInfo info){
- HttpRequest post = HttpUtil.createPost(operator.getTestUrl() + InterfaceUrlEnum.NOTIFICATION_CHARGE_ORDER_INFO.getUrl());
+ System.out.println("推送充电订单信息:--->" + JSON.toJSONString(info));
+ HttpRequest post = HttpUtil.createPost(operator.getUrl() + InterfaceUrlEnum.NOTIFICATION_CHARGE_ORDER_INFO.getUrl());
buildBody(post, info, operator);
HttpResponse execute = post.execute();
+ String body = execute.body();
if(200 != execute.getStatus()){
- log.error("推送三方平台充电订单信息失败:" + execute.body());
+ log.error("推送三方平台充电订单信息失败:" + body);
return null;
}
- log.info("推送三方平台充电订单信息响应:" + execute.body());
- BaseResult baseResult = JSON.parseObject(execute.body(), BaseResult.class);
+ log.info("推送三方平台充电订单信息响应:" + body);
+ BaseResult baseResult = JSON.parseObject(body, BaseResult.class);
Integer Ret = baseResult.getRet();
if(0 != Ret){
log.error("推送三方平台充电订单信息失败:" + baseResult.getMsg());
@@ -337,6 +344,20 @@
}
return sign;
}
+ public static String ourBuildSignJianGuan(BaseModel model){
+ Operator operator = model.getOperator();
+ if(null == operator){
+ return "";
+ }
+ //签名秘钥SigSecret
+ String key = operator.getOurSigSecret();
+ String sign = "";
+ //进行字符串拼接、计算
+ String m1 = new StringBuilder(model.getOperatorID()).append(model.getData()).append(model.getTimeStamp()).append(model.getSeq()).toString();
+ sign = SignUtil.hmacSign(m1, key);
+ return sign;
+ }
+
--
Gitblit v1.7.1