mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-12 11:19:52 +08:00
update 华为平台充电设备编码同步接口
This commit is contained in:
@@ -22,7 +22,7 @@ public class HWStationInfo {
|
|||||||
/**
|
/**
|
||||||
* 充电站ID
|
* 充电站ID
|
||||||
*/
|
*/
|
||||||
@JsonProperty(value = "StationId")
|
@JsonProperty(value = "StationID")
|
||||||
private String stationId;
|
private String stationId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -95,6 +95,9 @@ public class HuaweiServiceV2 {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private MemberPlateNumberRelationService memberPlateNumberRelationService;
|
private MemberPlateNumberRelationService memberPlateNumberRelationService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IThirdpartySnRelationService thirdpartySnRelationService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private TransactionService transactionService;
|
private TransactionService transactionService;
|
||||||
|
|
||||||
@@ -157,13 +160,14 @@ public class HuaweiServiceV2 {
|
|||||||
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64((String) commonResult.getData()),
|
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64((String) commonResult.getData()),
|
||||||
dataSecret.getBytes(), dataSecretIv.getBytes());
|
dataSecret.getBytes(), dataSecretIv.getBytes());
|
||||||
String dataStr = new String(plainText, StandardCharsets.UTF_8);
|
String dataStr = new String(plainText, StandardCharsets.UTF_8);
|
||||||
Map<String, String> resultMap = (Map<String, String>) JSON.parse(dataStr);
|
// Map<String, Object> resultMap = (Map<String, Object>) JSON.parse(dataStr);
|
||||||
int succStat = Integer.parseInt(resultMap.get("SuccStat"));
|
JSONObject resultJson = JSONObject.parseObject(dataStr);
|
||||||
|
int succStat = resultJson.getInteger("SuccStat");
|
||||||
if (succStat != 0) {
|
if (succStat != 0) {
|
||||||
return resultMap.get("FailReason");
|
return resultJson.getString("FailReason");
|
||||||
}
|
}
|
||||||
String token = resultMap.get("AccessToken");
|
String token = resultJson.getString("AccessToken");
|
||||||
int tokenAvailableTime = Integer.parseInt(resultMap.get("TokenAvailableTime")); // 凭证有效期,单位秒
|
int tokenAvailableTime = resultJson.getInteger("TokenAvailableTime"); // 凭证有效期,单位秒
|
||||||
// 存入缓存
|
// 存入缓存
|
||||||
redisCache.setCacheObject(redisKey, token, tokenAvailableTime, TimeUnit.SECONDS);
|
redisCache.setCacheObject(redisKey, token, tokenAvailableTime, TimeUnit.SECONDS);
|
||||||
return token;
|
return token;
|
||||||
@@ -202,7 +206,7 @@ public class HuaweiServiceV2 {
|
|||||||
|
|
||||||
.build();
|
.build();
|
||||||
// 查询桩列表
|
// 查询桩列表
|
||||||
equipmentLogicInfos = getPileList(stationId);
|
equipmentLogicInfos = getPileListV2(stationId);
|
||||||
|
|
||||||
hwStationInfo.setEquipmentInfoNum(equipmentLogicInfos.size());
|
hwStationInfo.setEquipmentInfoNum(equipmentLogicInfos.size());
|
||||||
hwStationInfo.setEquipmentLogicInfos(equipmentLogicInfos);
|
hwStationInfo.setEquipmentLogicInfos(equipmentLogicInfos);
|
||||||
@@ -924,6 +928,42 @@ public class HuaweiServiceV2 {
|
|||||||
return resultMap;
|
return resultMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private List<HWStationInfo.EquipmentLogicInfo> getPileListV2(String stationId) {
|
||||||
|
List<HWStationInfo
|
||||||
|
.EquipmentLogicInfo> equipmentLogicInfos = new ArrayList<>();
|
||||||
|
HWStationInfo
|
||||||
|
.EquipmentLogicInfo equipmentLogicInfo = null;
|
||||||
|
// 根据站点 id 查询第三方平台对应 sn 关系表
|
||||||
|
ThirdpartySnRelation snRelation = ThirdpartySnRelation.builder()
|
||||||
|
.stationId(stationId)
|
||||||
|
.build();
|
||||||
|
List<ThirdpartySnRelation> snRelations = thirdpartySnRelationService.selectThirdpartySnRelationList(snRelation);
|
||||||
|
if (CollectionUtils.isEmpty(snRelations)) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
for (ThirdpartySnRelation relation : snRelations) {
|
||||||
|
String pileSn = relation.getPileSn();
|
||||||
|
equipmentLogicInfo = HWStationInfo.EquipmentLogicInfo.builder()
|
||||||
|
.equipmentId(pileSn)
|
||||||
|
// .equipmentType()
|
||||||
|
.chargeHostESN(relation.getThirdpartyPileSn())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// 获取枪口信息
|
||||||
|
List<HWStationInfo.EquipmentLogicInfo
|
||||||
|
.ConnectorInfo> connectorInfoList = getConnectorInfoList(pileSn);
|
||||||
|
if (CollectionUtils.isEmpty(connectorInfoList)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
equipmentLogicInfo.setConnectorInfoNum(connectorInfoList.size());
|
||||||
|
equipmentLogicInfo.setConnectorInfos(connectorInfoList);
|
||||||
|
|
||||||
|
equipmentLogicInfos.add(equipmentLogicInfo);
|
||||||
|
}
|
||||||
|
return equipmentLogicInfos;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取桩列表
|
* 获取桩列表
|
||||||
* @param stationId
|
* @param stationId
|
||||||
@@ -941,6 +981,7 @@ public class HuaweiServiceV2 {
|
|||||||
}
|
}
|
||||||
for (PileBasicInfo pileBasicInfo : pileBasicInfos) {
|
for (PileBasicInfo pileBasicInfo : pileBasicInfos) {
|
||||||
String pileSn = pileBasicInfo.getSn();
|
String pileSn = pileBasicInfo.getSn();
|
||||||
|
|
||||||
equipmentLogicInfo = HWStationInfo.EquipmentLogicInfo.builder()
|
equipmentLogicInfo = HWStationInfo.EquipmentLogicInfo.builder()
|
||||||
.equipmentId(pileSn)
|
.equipmentId(pileSn)
|
||||||
// .equipmentType()
|
// .equipmentType()
|
||||||
@@ -975,10 +1016,12 @@ public class HuaweiServiceV2 {
|
|||||||
if (CollectionUtils.isEmpty(pileConnectorInfos)) {
|
if (CollectionUtils.isEmpty(pileConnectorInfos)) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
int connectorNumber = 0;
|
||||||
for (PileConnectorInfo pileConnectorInfo : pileConnectorInfos) {
|
for (PileConnectorInfo pileConnectorInfo : pileConnectorInfos) {
|
||||||
|
connectorNumber += 1;
|
||||||
connectorInfo = HWStationInfo.EquipmentLogicInfo.ConnectorInfo.builder()
|
connectorInfo = HWStationInfo.EquipmentLogicInfo.ConnectorInfo.builder()
|
||||||
.connectorID(pileConnectorInfo.getPileConnectorCode())
|
.connectorID(pileConnectorInfo.getPileConnectorCode())
|
||||||
.connectorNumber(pileConnectorInfo.getId())
|
.connectorNumber(connectorNumber)
|
||||||
|
|
||||||
.build();
|
.build();
|
||||||
connectorInfoList.add(connectorInfo);
|
connectorInfoList.add(connectorInfo);
|
||||||
|
|||||||
@@ -384,11 +384,10 @@ public class LianLianServiceImpl implements LianLianService {
|
|||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) throws UnsupportedEncodingException {
|
public static void main(String[] args) throws UnsupportedEncodingException {
|
||||||
String dataSecret = "KnGhAb88GtUEPb0j"; // SPBNJ1Z5EQNmpK08 VTAEKDPVN9CUS7WO
|
String dataSecret = "E6gnWuz0QzBW75CR"; // SPBNJ1Z5EQNmpK08 VTAEKDPVN9CUS7WO
|
||||||
String dataSecretIV = "XZ4wURhuo2y8s4ZS"; // peRoTcb2C7zqKeII 83UZFFRRZDYNF5CR
|
String dataSecretIV = "SXejaSUx5yud8UHm"; // peRoTcb2C7zqKeII 83UZFFRRZDYNF5CR
|
||||||
String signSecret = "sRjCDeokckFGpYpA"; // sRjCDeokckFGpYpA
|
String signSecret = "sRjCDeokckFGpYpA"; // sRjCDeokckFGpYpA
|
||||||
String dataString = "pZLkdIJdqGhgVcTEhSQXv3cbkBYiaI4Wk0SOKEaKbzMowLZ/Qvpy1ZeMZ+yEWhkHwn8oZwQhuIUMWxYmIXgnDNRcHU6sNW8LPbQOpB1qhfFS398c+sSU2rlv/I7kqsCJntM3Sn\n" +
|
String dataString = "GZlmSIZOVzT+Yvpc2PmvNr2P2qkhe5aubvzxs/F8zMuiJdVOJZ8JkH8x1UbBloCETEcTrxb1F/VIeQqnMVE+9nDv5/mg3717jl9Tk6sHCBxfCH8lO9jisLF58YNcKzJB";
|
||||||
"NV5SKdNtKX0gzFpsO0pl0ybHX3E6UyArdIqvhDmAbiw78/RwQRxGYsfk/cFW2PPhynTGc2ydZOb6TYFGgAh0RlHND17d3p5S4A3UJbM+mM4R4Nk2FeNJ7LESLfzDvt6RBUVOKlhl+yfzQypSSxj9X6GGAA4GZavmUUVXQwRe1fWsEqapYH2gL9mHPhg2+tNtVJlMju4iHhCftNFJBRsVpGfwJuvU0EUpo4cTm/YZ4bs5qAIC+SiLmKSmtPAL19GxPJ5hHGz2hNsCuL3rUc+cfYSfM0QKzZc6SwpikT2uwgPUy2Dq1T7POq95/4gsHu1ftW42MoG4exjtT/W74lUl3xibeLG+RqBSSWr8tDlRqQaTlz1GXYQcFG8vWREnBFuWz9NfNepN8ps0Xq7/Pzv7LHcTpAs0y1tWLo0GmYG6z32IOK9zqPd9DtAyBvW9bs5xhYVXkTzNN/g2RaGCpo3KDuq0uVRUIO0+1WVVdA6P/4jpTZ3Sc9GhtS4zYZ5YCTLbt0tEv8CUtodzmSdvbBMWUr0KGlS0lNq7ztAkJ+NprzC5Tvb4HG/pXVEwXz";
|
|
||||||
|
|
||||||
// 解密data
|
// 解密data
|
||||||
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes());
|
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes());
|
||||||
|
|||||||
Reference in New Issue
Block a user