mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-26 18:18:01 +08:00
update 推送联联平台页面
This commit is contained in:
@@ -82,7 +82,7 @@ public interface LianLianService {
|
|||||||
* @param operatorSecret
|
* @param operatorSecret
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
String getToken(String urlAddress, String operatorId, String operatorSecret);
|
String getToken(String urlAddress, String operatorId, String operatorSecret, String dataSecretIv, String signSecret, String dataSecret);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 推送联联平台 设备状态变化推送
|
* 推送联联平台 设备状态变化推送
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ public class LianLianServiceImpl implements LianLianService {
|
|||||||
System.out.println("jsonString : " + jsonString);
|
System.out.println("jsonString : " + jsonString);
|
||||||
|
|
||||||
// 获取令牌
|
// 获取令牌
|
||||||
String token = getToken(urlAddress, operatorId, operatorSecret);
|
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
|
||||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret
|
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret
|
||||||
, dataSecretIv, operatorId, signSecret);
|
, dataSecretIv, operatorId, signSecret);
|
||||||
|
|
||||||
@@ -740,7 +740,7 @@ public class LianLianServiceImpl implements LianLianService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String getToken(String urlAddress, String operatorId, String operatorSecret) {
|
public String getToken(String urlAddress, String operatorId, String operatorSecret, String dataSecretIv, String signSecret, String dataSecret) {
|
||||||
// String operatorId = dto.getOperatorId();
|
// String operatorId = dto.getOperatorId();
|
||||||
// String operatorSecret = dto.getOperatorSecret();
|
// String operatorSecret = dto.getOperatorSecret();
|
||||||
String token = "";
|
String token = "";
|
||||||
@@ -752,11 +752,12 @@ public class LianLianServiceImpl implements LianLianService {
|
|||||||
Map<String, String> data = new HashMap<>();
|
Map<String, String> data = new HashMap<>();
|
||||||
data.put("OperatorID", operatorId);
|
data.put("OperatorID", operatorId);
|
||||||
data.put("OperatorSecret", operatorSecret);
|
data.put("OperatorSecret", operatorSecret);
|
||||||
|
data.put("DataSecretIV", dataSecretIv);
|
||||||
String dataJson = JSONUtil.toJsonStr(data);
|
String dataJson = JSONUtil.toJsonStr(data);
|
||||||
|
|
||||||
// 加密
|
// 加密
|
||||||
byte[] encryptText = Cryptos.aesEncrypt(dataJson.getBytes("UTF-8"),
|
byte[] encryptText = Cryptos.aesEncrypt(dataJson.getBytes("UTF-8"),
|
||||||
operatorSecret.getBytes(), operatorSecret.getBytes());
|
dataSecret.getBytes(), dataSecretIv.getBytes());
|
||||||
String strData = Encodes.encodeBase64(encryptText);
|
String strData = Encodes.encodeBase64(encryptText);
|
||||||
|
|
||||||
Map<String, String> request = new LinkedHashMap<>();
|
Map<String, String> request = new LinkedHashMap<>();
|
||||||
@@ -766,7 +767,7 @@ public class LianLianServiceImpl implements LianLianService {
|
|||||||
request.put("Seq", "0001");
|
request.put("Seq", "0001");
|
||||||
|
|
||||||
// 生成签名
|
// 生成签名
|
||||||
String sig = GBSignUtils.sign(request, operatorSecret);
|
String sig = GBSignUtils.sign(request, signSecret);
|
||||||
request.put("Sig", sig);
|
request.put("Sig", sig);
|
||||||
|
|
||||||
String tokenRequest = JSONUtil.toJsonStr(request);
|
String tokenRequest = JSONUtil.toJsonStr(request);
|
||||||
@@ -777,7 +778,7 @@ public class LianLianServiceImpl implements LianLianService {
|
|||||||
if (result.getRet() == 0) {
|
if (result.getRet() == 0) {
|
||||||
// 解密data
|
// 解密data
|
||||||
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64((String) result.getData()),
|
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64((String) result.getData()),
|
||||||
operatorSecret.getBytes(), operatorSecret.getBytes());
|
dataSecret.getBytes(), dataSecretIv.getBytes());
|
||||||
String dataStr = new String(plainText, "UTF-8");
|
String dataStr = new String(plainText, "UTF-8");
|
||||||
Map<String, String> resultMap = (Map<String, String>) JSON.parse(dataStr);
|
Map<String, String> resultMap = (Map<String, String>) JSON.parse(dataStr);
|
||||||
token = resultMap.get("AccessToken");
|
token = resultMap.get("AccessToken");
|
||||||
@@ -818,7 +819,7 @@ public class LianLianServiceImpl implements LianLianService {
|
|||||||
String url = urlAddress + "notification_stationStatus";
|
String url = urlAddress + "notification_stationStatus";
|
||||||
|
|
||||||
// 获取令牌
|
// 获取令牌
|
||||||
String token = getToken(urlAddress, operatorId, operatorSecret);
|
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
|
||||||
if (StringUtils.isBlank(token)) {
|
if (StringUtils.isBlank(token)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -949,7 +950,7 @@ public class LianLianServiceImpl implements LianLianService {
|
|||||||
orderInfo.setChargeDetails(chargeDetails);
|
orderInfo.setChargeDetails(chargeDetails);
|
||||||
|
|
||||||
// 获取令牌
|
// 获取令牌
|
||||||
String token = getToken(urlAddress, operatorId, operatorSecret);
|
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
|
||||||
if (StringUtils.isBlank(token)) {
|
if (StringUtils.isBlank(token)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -994,7 +995,7 @@ public class LianLianServiceImpl implements LianLianService {
|
|||||||
// 推送启动充电结果(调用接口 notification_start_charge_result)
|
// 推送启动充电结果(调用接口 notification_start_charge_result)
|
||||||
String url = urlAddress + "notification_start_charge_result";
|
String url = urlAddress + "notification_start_charge_result";
|
||||||
// 获取令牌
|
// 获取令牌
|
||||||
String token = getToken(urlAddress, operatorId, operatorSecret);
|
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
|
||||||
if (StringUtils.isBlank(token)) {
|
if (StringUtils.isBlank(token)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -1061,7 +1062,7 @@ public class LianLianServiceImpl implements LianLianService {
|
|||||||
// 转成对应的对象
|
// 转成对应的对象
|
||||||
QueryEquipChargeStatusDTO queryEquipChargeStatusDTO = JSONObject.parseObject(dataStr, QueryEquipChargeStatusDTO.class);
|
QueryEquipChargeStatusDTO queryEquipChargeStatusDTO = JSONObject.parseObject(dataStr, QueryEquipChargeStatusDTO.class);
|
||||||
// 获取令牌
|
// 获取令牌
|
||||||
String token = getToken(urlAddress, operatorId, operatorSecret);
|
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
|
||||||
if (StringUtils.isBlank(token)) {
|
if (StringUtils.isBlank(token)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -1118,7 +1119,7 @@ public class LianLianServiceImpl implements LianLianService {
|
|||||||
orderStatus = "5";
|
orderStatus = "5";
|
||||||
}
|
}
|
||||||
// 获取token
|
// 获取token
|
||||||
String token = getToken(urlAddress, operatorId, operatorSecret);
|
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
|
||||||
if (StringUtils.isBlank(token)) {
|
if (StringUtils.isBlank(token)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -1180,7 +1181,7 @@ public class LianLianServiceImpl implements LianLianService {
|
|||||||
json.put("StopReason", 2); // 2:BMS 停止充电
|
json.put("StopReason", 2); // 2:BMS 停止充电
|
||||||
|
|
||||||
String jsonString = JSONObject.toJSONString(json);
|
String jsonString = JSONObject.toJSONString(json);
|
||||||
String token = getToken(urlAddress, operatorId, operatorSecret);
|
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
|
||||||
if (token == null) {
|
if (token == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -1270,7 +1271,7 @@ public class LianLianServiceImpl implements LianLianService {
|
|||||||
String url = urlAddress + "query_order_settlement_info";
|
String url = urlAddress + "query_order_settlement_info";
|
||||||
|
|
||||||
// 获取令牌
|
// 获取令牌
|
||||||
String token = getToken(urlAddress, operatorId, operatorSecret);
|
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
|
||||||
if (StringUtils.isBlank(token)) {
|
if (StringUtils.isBlank(token)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -1331,7 +1332,7 @@ public class LianLianServiceImpl implements LianLianService {
|
|||||||
json.put("ChargeOrders", list);
|
json.put("ChargeOrders", list);
|
||||||
|
|
||||||
// 获取令牌
|
// 获取令牌
|
||||||
String token = getToken(urlAddress, operatorId, operatorSecret);
|
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
|
||||||
if (StringUtils.isBlank(token)) {
|
if (StringUtils.isBlank(token)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -1391,7 +1392,7 @@ public class LianLianServiceImpl implements LianLianService {
|
|||||||
String url = urlAddress + "notification_connector_charge_status";
|
String url = urlAddress + "notification_connector_charge_status";
|
||||||
|
|
||||||
// 获取令牌
|
// 获取令牌
|
||||||
String token = getToken(urlAddress, operatorId, operatorSecret);
|
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
|
||||||
if (StringUtils.isBlank(token)) {
|
if (StringUtils.isBlank(token)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user