diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/domain/huawei/HWStationInfo.java b/jsowell-pile/src/main/java/com/jsowell/pile/domain/huawei/HWStationInfo.java index 3fc3812c9..cf809affd 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/domain/huawei/HWStationInfo.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/domain/huawei/HWStationInfo.java @@ -22,7 +22,7 @@ public class HWStationInfo { /** * 充电站ID */ - @JsonProperty(value = "StationId") + @JsonProperty(value = "StationID") private String stationId; /** diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/huawei/HuaweiServiceV2.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/huawei/HuaweiServiceV2.java index d541c7d43..e60554427 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/huawei/HuaweiServiceV2.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/huawei/HuaweiServiceV2.java @@ -95,6 +95,9 @@ public class HuaweiServiceV2 { @Autowired private MemberPlateNumberRelationService memberPlateNumberRelationService; + @Autowired + private IThirdpartySnRelationService thirdpartySnRelationService; + @Resource private TransactionService transactionService; @@ -157,13 +160,14 @@ public class HuaweiServiceV2 { byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64((String) commonResult.getData()), dataSecret.getBytes(), dataSecretIv.getBytes()); String dataStr = new String(plainText, StandardCharsets.UTF_8); - Map resultMap = (Map) JSON.parse(dataStr); - int succStat = Integer.parseInt(resultMap.get("SuccStat")); + // Map resultMap = (Map) JSON.parse(dataStr); + JSONObject resultJson = JSONObject.parseObject(dataStr); + int succStat = resultJson.getInteger("SuccStat"); if (succStat != 0) { - return resultMap.get("FailReason"); + return resultJson.getString("FailReason"); } - String token = resultMap.get("AccessToken"); - int tokenAvailableTime = Integer.parseInt(resultMap.get("TokenAvailableTime")); // 凭证有效期,单位秒 + String token = resultJson.getString("AccessToken"); + int tokenAvailableTime = resultJson.getInteger("TokenAvailableTime"); // 凭证有效期,单位秒 // 存入缓存 redisCache.setCacheObject(redisKey, token, tokenAvailableTime, TimeUnit.SECONDS); return token; @@ -202,7 +206,7 @@ public class HuaweiServiceV2 { .build(); // 查询桩列表 - equipmentLogicInfos = getPileList(stationId); + equipmentLogicInfos = getPileListV2(stationId); hwStationInfo.setEquipmentInfoNum(equipmentLogicInfos.size()); hwStationInfo.setEquipmentLogicInfos(equipmentLogicInfos); @@ -924,6 +928,42 @@ public class HuaweiServiceV2 { return resultMap; } + + private List getPileListV2(String stationId) { + List equipmentLogicInfos = new ArrayList<>(); + HWStationInfo + .EquipmentLogicInfo equipmentLogicInfo = null; + // 根据站点 id 查询第三方平台对应 sn 关系表 + ThirdpartySnRelation snRelation = ThirdpartySnRelation.builder() + .stationId(stationId) + .build(); + List 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 connectorInfoList = getConnectorInfoList(pileSn); + if (CollectionUtils.isEmpty(connectorInfoList)) { + continue; + } + equipmentLogicInfo.setConnectorInfoNum(connectorInfoList.size()); + equipmentLogicInfo.setConnectorInfos(connectorInfoList); + + equipmentLogicInfos.add(equipmentLogicInfo); + } + return equipmentLogicInfos; + } + /** * 获取桩列表 * @param stationId @@ -941,6 +981,7 @@ public class HuaweiServiceV2 { } for (PileBasicInfo pileBasicInfo : pileBasicInfos) { String pileSn = pileBasicInfo.getSn(); + equipmentLogicInfo = HWStationInfo.EquipmentLogicInfo.builder() .equipmentId(pileSn) // .equipmentType() @@ -975,10 +1016,12 @@ public class HuaweiServiceV2 { if (CollectionUtils.isEmpty(pileConnectorInfos)) { return new ArrayList<>(); } + int connectorNumber = 0; for (PileConnectorInfo pileConnectorInfo : pileConnectorInfos) { + connectorNumber += 1; connectorInfo = HWStationInfo.EquipmentLogicInfo.ConnectorInfo.builder() .connectorID(pileConnectorInfo.getPileConnectorCode()) - .connectorNumber(pileConnectorInfo.getId()) + .connectorNumber(connectorNumber) .build(); connectorInfoList.add(connectorInfo); diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/service/impl/LianLianServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/service/impl/LianLianServiceImpl.java index b88fe6e34..8cb5118ee 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/service/impl/LianLianServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/service/impl/LianLianServiceImpl.java @@ -384,11 +384,10 @@ public class LianLianServiceImpl implements LianLianService { public static void main(String[] args) throws UnsupportedEncodingException { - String dataSecret = "KnGhAb88GtUEPb0j"; // SPBNJ1Z5EQNmpK08 VTAEKDPVN9CUS7WO - String dataSecretIV = "XZ4wURhuo2y8s4ZS"; // peRoTcb2C7zqKeII 83UZFFRRZDYNF5CR + String dataSecret = "E6gnWuz0QzBW75CR"; // SPBNJ1Z5EQNmpK08 VTAEKDPVN9CUS7WO + String dataSecretIV = "SXejaSUx5yud8UHm"; // peRoTcb2C7zqKeII 83UZFFRRZDYNF5CR String signSecret = "sRjCDeokckFGpYpA"; // sRjCDeokckFGpYpA - String dataString = "pZLkdIJdqGhgVcTEhSQXv3cbkBYiaI4Wk0SOKEaKbzMowLZ/Qvpy1ZeMZ+yEWhkHwn8oZwQhuIUMWxYmIXgnDNRcHU6sNW8LPbQOpB1qhfFS398c+sSU2rlv/I7kqsCJntM3Sn\n" + - "NV5SKdNtKX0gzFpsO0pl0ybHX3E6UyArdIqvhDmAbiw78/RwQRxGYsfk/cFW2PPhynTGc2ydZOb6TYFGgAh0RlHND17d3p5S4A3UJbM+mM4R4Nk2FeNJ7LESLfzDvt6RBUVOKlhl+yfzQypSSxj9X6GGAA4GZavmUUVXQwRe1fWsEqapYH2gL9mHPhg2+tNtVJlMju4iHhCftNFJBRsVpGfwJuvU0EUpo4cTm/YZ4bs5qAIC+SiLmKSmtPAL19GxPJ5hHGz2hNsCuL3rUc+cfYSfM0QKzZc6SwpikT2uwgPUy2Dq1T7POq95/4gsHu1ftW42MoG4exjtT/W74lUl3xibeLG+RqBSSWr8tDlRqQaTlz1GXYQcFG8vWREnBFuWz9NfNepN8ps0Xq7/Pzv7LHcTpAs0y1tWLo0GmYG6z32IOK9zqPd9DtAyBvW9bs5xhYVXkTzNN/g2RaGCpo3KDuq0uVRUIO0+1WVVdA6P/4jpTZ3Sc9GhtS4zYZ5YCTLbt0tEv8CUtodzmSdvbBMWUr0KGlS0lNq7ztAkJ+NprzC5Tvb4HG/pXVEwXz"; + String dataString = "GZlmSIZOVzT+Yvpc2PmvNr2P2qkhe5aubvzxs/F8zMuiJdVOJZ8JkH8x1UbBloCETEcTrxb1F/VIeQqnMVE+9nDv5/mg3717jl9Tk6sHCBxfCH8lO9jisLF58YNcKzJB"; // 解密data byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes());