update 华为相关接口添加日志

This commit is contained in:
Lemon
2024-03-13 14:00:30 +08:00
parent 07bb61fcb1
commit c506c390ed
3 changed files with 27 additions and 14 deletions

View File

@@ -229,7 +229,7 @@ public class HuaweiServiceV2 {
* @param stationIds
* @return
*/
public List<StationStatusInfo> queryStationStatus(List<String> stationIds) {
public String queryStationStatus(List<String> stationIds) {
String requestName = "query_station_status";
// 拼装参数
@@ -241,15 +241,18 @@ public class HuaweiServiceV2 {
String token = getHuaWeiToken();
// 发送请求
String result = sendMsg2HuaWei(jsonString, token, requestName);
if (result == null) {
return new ArrayList<>();
}
// 转换成 StationStatus 对象
List<StationStatusInfo> list = JSON.parseArray(result, StationStatusInfo.class);
return list;
// List<StationStatusInfo> list = JSON.parseArray(result, StationStatusInfo.class);
return result;
}
public static void main(String[] args) {
String result = "{\"StationStatusInfos\":[{\"ConnectorStatusInfos\":[{\"ConnectorID\":\"8823000000112302\",\"Status\":2},{\"ConnectorID\":\"8823000000112301\",\"Status\":2}],\"StationID\":\"19\"}]}";
JSONObject jsonObject = JSONObject.parseObject(result);
System.out.println(jsonObject);
}
/**
* 接收设备接口状态变化推送
* 需在Controller传入operatorId
@@ -857,6 +860,7 @@ public class HuaweiServiceV2 {
* @return 请求结果
*/
private String sendMsg2HuaWei(String jsonString, String token, String requestName) {
log.info("向华为发送请求 jsonString:{}, token:{}, requestName:{}", jsonString, token, requestName);
ThirdPartySettingInfo settingInfo = getHuaWeiSettingInfo();
if (settingInfo == null) {
return null;
@@ -909,6 +913,7 @@ public class HuaweiServiceV2 {
* @return
*/
private Map<String, String> getResultMap(JSONObject jsonObject) {
log.info("加密华为数据 jsonObject:{}", jsonObject.toJSONString());
String operatorId = ThirdPartyOperatorIdEnum.HUA_WEI.getOperatorId();
ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(operatorId);
if (platformConfig == null) {

View File

@@ -384,10 +384,10 @@ public class LianLianServiceImpl implements LianLianService {
public static void main(String[] args) throws UnsupportedEncodingException {
String dataSecret = "E6gnWuz0QzBW75CR"; // SPBNJ1Z5EQNmpK08 VTAEKDPVN9CUS7WO
String dataSecretIV = "SXejaSUx5yud8UHm"; // peRoTcb2C7zqKeII 83UZFFRRZDYNF5CR
String dataSecret = "zd4NrLWJ38XCTaqP"; // SPBNJ1Z5EQNmpK08 VTAEKDPVN9CUS7WO huawei: zd4NrLWJ38XCTaqP E6gnWuz0QzBW75CR
String dataSecretIV = "RJJecvNTJ48SGMG7"; // peRoTcb2C7zqKeII 83UZFFRRZDYNF5CR huawei: RJJecvNTJ48SGMG7 SXejaSUx5yud8UHm
String signSecret = "sRjCDeokckFGpYpA"; // sRjCDeokckFGpYpA
String dataString = "GZlmSIZOVzT+Yvpc2PmvNr2P2qkhe5aubvzxs/F8zMuiJdVOJZ8JkH8x1UbBloCETEcTrxb1F/VIeQqnMVE+9nDv5/mg3717jl9Tk6sHCBxfCH8lO9jisLF58YNcKzJB";
String dataString = "E+V2sg+xpOjwWcqI9IQVgrN0gIs6tfyeKltpvB2G4mbQLtZREPk7bo7Q22k00/ufrcz+xZa9x/MyAzA3Eo2ZEo9UFKKKG3VLB+nfYX/kWWk=";
// 解密data
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes());