From 7d7a68a9aded747dfb278ecec9ace5e7a6065327 Mon Sep 17 00:00:00 2001 From: Lemon Date: Thu, 9 Nov 2023 13:50:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=20=E7=94=AC=E5=9F=8E?= =?UTF-8?q?=E6=B3=8A=E8=BD=A6=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3=E3=80=81?= =?UTF-8?q?controller?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../thirdparty/ThirdPartyOperatorIdEnum.java | 66 ++++++++++ .../thirdparty/ThirdPlatformTypeEnum.java | 2 +- .../TransactionRecordsRequestHandler.java | 3 +- .../handler/UploadRealTimeMonitorHandler.java | 36 ++++-- .../yunkuaichong/NettyServerHandler.java | 2 +- .../service/impl/LianLianServiceImpl.java | 120 +++++++++++------- .../lianlian/vo/EquipmentAuthVO.java | 17 ++- .../lianlian/vo/QueryChargingStatusVO.java | 85 +++++++++---- .../lianlian/vo/QueryStartChargeVO.java | 16 ++- .../lianlian/vo/QueryStopChargeVO.java | 13 +- 10 files changed, 256 insertions(+), 104 deletions(-) create mode 100644 jsowell-common/src/main/java/com/jsowell/common/enums/thirdparty/ThirdPartyOperatorIdEnum.java diff --git a/jsowell-common/src/main/java/com/jsowell/common/enums/thirdparty/ThirdPartyOperatorIdEnum.java b/jsowell-common/src/main/java/com/jsowell/common/enums/thirdparty/ThirdPartyOperatorIdEnum.java new file mode 100644 index 000000000..012a0058e --- /dev/null +++ b/jsowell-common/src/main/java/com/jsowell/common/enums/thirdparty/ThirdPartyOperatorIdEnum.java @@ -0,0 +1,66 @@ +package com.jsowell.common.enums.thirdparty; + +import com.jsowell.common.util.StringUtils; + +/** + * TODO + * + * @author Lemon + * @Date 2023/11/8 9:11:55 + */ +public enum ThirdPartyOperatorIdEnum { + LIAN_LIAN_PLATFORM("1", "425010765"), + ZHONG_DIAN_LIAN_PLATFORM("2", "14405899X"), + JIANG_SU_PLATFORM("3", "726079387"), + YONG_CHENG_BO_CHE("4", "330205020"), + + ; + private String type; + + private String OperatorId; + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getOperatorId() { + return OperatorId; + } + + public void setOperatorId(String operatorId) { + OperatorId = operatorId; + } + + ThirdPartyOperatorIdEnum(String type, String operatorId) { + this.type = type; + OperatorId = operatorId; + } + + /** + * 根据 type 获取 operatorId + * + * @param type 编码 + * @return operatorId + */ + public static String getOperatorIdByType(String type) { + for (ThirdPartyOperatorIdEnum item : ThirdPartyOperatorIdEnum.values()) { + if (StringUtils.equals(item.getType(), type)) { + return item.getOperatorId(); + } + } + return null; + } + + public static String getTypeByOperatorId(String operatorId) { + for (ThirdPartyOperatorIdEnum item : ThirdPartyOperatorIdEnum.values()) { + if (StringUtils.equals(item.getOperatorId(), operatorId)) { + return item.getType(); + } + } + return null; + } +} diff --git a/jsowell-common/src/main/java/com/jsowell/common/enums/thirdparty/ThirdPlatformTypeEnum.java b/jsowell-common/src/main/java/com/jsowell/common/enums/thirdparty/ThirdPlatformTypeEnum.java index 05c00a4a5..1afba031b 100644 --- a/jsowell-common/src/main/java/com/jsowell/common/enums/thirdparty/ThirdPlatformTypeEnum.java +++ b/jsowell-common/src/main/java/com/jsowell/common/enums/thirdparty/ThirdPlatformTypeEnum.java @@ -47,7 +47,7 @@ public enum ThirdPlatformTypeEnum { * @param code 编码 * @return 停止原因描述 */ - public static String getMsgByCode(String code) { + public static String getLabelByCode(String code) { for (ThirdPlatformTypeEnum item : ThirdPlatformTypeEnum.values()) { if (StringUtils.equals(item.getCode(), code)) { return item.getLabel(); diff --git a/jsowell-netty/src/main/java/com/jsowell/netty/handler/TransactionRecordsRequestHandler.java b/jsowell-netty/src/main/java/com/jsowell/netty/handler/TransactionRecordsRequestHandler.java index fcce4907a..e4de99d23 100644 --- a/jsowell-netty/src/main/java/com/jsowell/netty/handler/TransactionRecordsRequestHandler.java +++ b/jsowell-netty/src/main/java/com/jsowell/netty/handler/TransactionRecordsRequestHandler.java @@ -682,7 +682,7 @@ public class TransactionRecordsRequestHandler extends AbstractHandler { if (Objects.isNull(relationInfo)) { return; } - String thirdPartyType = relation.getThirdPartyType(); + String thirdPartyType = relationInfo.getThirdPartyType(); if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getCode(), thirdPartyType)) { // 联联平台 // 推送订单信息 @@ -701,6 +701,7 @@ public class TransactionRecordsRequestHandler extends AbstractHandler { } if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), thirdPartyType)) { // 甬城泊车 + log.info("甬城泊车平台 推送充电订单信息 param:{}", orderBasicInfo.getOrderCode()); String result = ycbcService.pushChargeOrderInfo(orderBasicInfo.getOrderCode()); log.info("甬城泊车平台 推送充电订单信息 result:{}", result); } diff --git a/jsowell-netty/src/main/java/com/jsowell/netty/handler/UploadRealTimeMonitorHandler.java b/jsowell-netty/src/main/java/com/jsowell/netty/handler/UploadRealTimeMonitorHandler.java index 499159c1d..fc5c3cd64 100644 --- a/jsowell-netty/src/main/java/com/jsowell/netty/handler/UploadRealTimeMonitorHandler.java +++ b/jsowell-netty/src/main/java/com/jsowell/netty/handler/UploadRealTimeMonitorHandler.java @@ -4,18 +4,22 @@ import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONObject; import com.google.common.collect.Lists; import com.jsowell.common.constant.CacheConstants; +import com.jsowell.common.constant.Constants; import com.jsowell.common.core.domain.ykc.RealTimeMonitorData; import com.jsowell.common.core.domain.ykc.YKCDataProtocol; import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode; import com.jsowell.common.core.redis.RedisCache; import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum; import com.jsowell.common.enums.ykc.OrderStatusEnum; +import com.jsowell.common.enums.ykc.StartModeEnum; +import com.jsowell.common.enums.ykc.StartTypeEnum; import com.jsowell.common.enums.ykc.YKCPileFaultReasonEnum; import com.jsowell.common.util.BytesUtil; import com.jsowell.common.util.StringUtils; import com.jsowell.common.util.YKCUtils; import com.jsowell.netty.factory.YKCOperateFactory; import com.jsowell.pile.domain.OrderBasicInfo; +import com.jsowell.pile.domain.PileBasicInfo; import com.jsowell.pile.domain.ThirdPartyStationRelation; import com.jsowell.pile.service.*; import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO; @@ -305,11 +309,9 @@ public class UploadRealTimeMonitorHandler extends AbstractHandler { } try { - // 推送第三方平台 - OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode); - if (orderInfo == null) { - return null; - } + // 推送第三方平台,先通过桩编号查出站点信息 + PileBasicInfo pileBasicInfo = pileBasicInfoService.selectPileBasicInfoBySN(pileSn); + Map pileStatusMap = pileConnectorInfoService.getPileStatus(Lists.newArrayList(pileSn)); String pileStatus = pileStatusMap.get(pileSn); if (StringUtils.equals(connectorStatus, pileStatus)) { @@ -318,10 +320,10 @@ public class UploadRealTimeMonitorHandler extends AbstractHandler { // 状态不一样,传给第三方平台 // 查询该站点是否推送第三方平台 ThirdPartyStationRelation relation = new ThirdPartyStationRelation(); - if (StringUtils.isBlank(orderInfo.getStationId())) { + if (StringUtils.isBlank(String.valueOf(pileBasicInfo.getStationId()))) { return null; } - relation.setStationId(Long.parseLong(orderInfo.getStationId())); + relation.setStationId(pileBasicInfo.getStationId()); ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(relation); if (Objects.isNull(relationInfo)) { return null; @@ -329,6 +331,10 @@ public class UploadRealTimeMonitorHandler extends AbstractHandler { String pileConnectorCode = pileSn + connectorCode; if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getCode(), relationInfo.getThirdPartyType())) { // 联联 + OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode); + if (orderInfo == null) { + return null; + } log.info("推送联联平台实时数据 params: orderBasicInfo:{}", JSON.toJSONString(orderInfo)); // 设备状态变化推送 notification_stationStatus lianLianService.pushConnectorStatus(pileConnectorCode, connectorStatus); @@ -341,7 +347,7 @@ public class UploadRealTimeMonitorHandler extends AbstractHandler { } if (StringUtils.equals(ThirdPlatformTypeEnum.ZHONG_DIAN_LIAN_PLATFORM.getCode(), relationInfo.getThirdPartyType())) { // 中电联 - log.info("推送中电联平台实时数据 params: orderBasicInfo:{}", JSON.toJSONString(orderInfo)); + log.info("推送中电联平台实时数据 pileConnectorCode:{}, connectorStatus:{}", pileConnectorCode, connectorStatus); zdlService.notificationStationStatus(pileConnectorCode, connectorStatus); } if (StringUtils.equals(ThirdPlatformTypeEnum.JIANG_SU_PLATFORM.getCode(), relation.getThirdPartyType())) { @@ -351,12 +357,20 @@ public class UploadRealTimeMonitorHandler extends AbstractHandler { } if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), relationInfo.getThirdPartyType())) { // 甬城泊车 - log.info("推送甬城泊车平台实时数据 params: orderBasicInfo:{}", JSON.toJSONString(orderInfo)); + log.info("推送甬城泊车平台设备状态变化推送 pileConnectorCode:{}, connectorStatus:{}", pileConnectorCode, connectorStatus); // 设备状态变化推送 notification_stationStatus String result1 = ycbcService.notificationStationStatus(pileConnectorCode, connectorStatus); + log.info("推送甬城泊车平台设备状态变化推送 result:{}", result1); // 推送充电状态 - String result2 = ycbcService.pushChargeStatus(orderInfo.getOrderCode()); - log.info("推送甬城泊车平台实时数据 result1:{}\n result2:{}", result1, result2); + OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode); + if (orderInfo == null) { + return null; + } + if (StringUtils.equals(orderInfo.getStartMode(), StartModeEnum.THIRD_PARTY_PLATFORM.getValue())) { + log.info("推送甬城泊车充电订单状态 param:{}", orderInfo); + String result2 = ycbcService.pushChargeStatus(orderInfo.getOrderCode()); + log.info("推送甬城泊车充电订单状态 result:{}", result2); + } } } catch (Exception e) { log.error("推送第三方平台 实时数据 异常", e); diff --git a/jsowell-netty/src/main/java/com/jsowell/netty/server/yunkuaichong/NettyServerHandler.java b/jsowell-netty/src/main/java/com/jsowell/netty/server/yunkuaichong/NettyServerHandler.java index c5db0236c..3b530a7d9 100644 --- a/jsowell-netty/src/main/java/com/jsowell/netty/server/yunkuaichong/NettyServerHandler.java +++ b/jsowell-netty/src/main/java/com/jsowell/netty/server/yunkuaichong/NettyServerHandler.java @@ -211,7 +211,7 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter { // 删除桩编号和channel的关系 if (StringUtils.isNotBlank(pileSn)) { - PileChannelEntity.removeByPileSn(pileSn); + // PileChannelEntity.removeByPileSn(pileSn); } // 删除连接 CHANNEL_MAP.remove(channelId); 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 cc324cb4c..07bc316de 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 @@ -13,6 +13,7 @@ import com.jsowell.common.core.domain.ykc.RealTimeMonitorData; import com.jsowell.common.enums.lianlian.LianLianPileStatusEnum; import com.jsowell.common.enums.lianlian.PayChannelEnum; import com.jsowell.common.enums.lianlian.StationPaymentEnum; +import com.jsowell.common.enums.thirdparty.ThirdPartyOperatorIdEnum; import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum; import com.jsowell.common.enums.ykc.OrderPayModeEnum; import com.jsowell.common.enums.ykc.OrderStatusEnum; @@ -225,10 +226,10 @@ public class LianLianServiceImpl implements LianLianService { } public static void main(String[] args) throws UnsupportedEncodingException { - String dataSecret = "VTAEKDPVN9CUS7WO"; // SPBNJ1Z5EQNmpK08 - String dataSecretIV = "83UZFFRRZDYNF5CR"; // peRoTcb2C7zqKeII + String dataSecret = "SPBNJ1Z5EQNmpK08"; // SPBNJ1Z5EQNmpK08 VTAEKDPVN9CUS7WO + String dataSecretIV = "peRoTcb2C7zqKeII"; // peRoTcb2C7zqKeII 83UZFFRRZDYNF5CR String signSecret = "sRjCDeokckFGpYpA"; // sRjCDeokckFGpYpA - String dataString = "G1bRJULwSjloSpIrYO4fBIiNfQPxWKxtY3WZjdru78xkr6A2zggaIecRj4nxfGHyqbOx1mzmDR3nj4tTSfmlwFtdDTi38fdodI4AoPpf4naeOBvHzVzTapvnpGDU3txZxlyNx4axEWanyicO2y1EGSeP6d3oCdhK1N6ghfaEGPYVG2c/Y/cOqhrQ+xlwAB41"; + String dataString = "LrjN9OmwM1HLzq7ljVy4u+w9fjZ3Csfat1/t9JBRx7U2i/7k8pDbFMEj1hGy1hLYG3I4urpCIunP01xUUI2VC1PyTKxjLlJBhiSsnEGE1Nb78v8Zx8ESeh52oJ5se1h8vGTQIWG679Q1xO1yPINkMN4+wZXq3VsaJNaQ8PfzLn1j0kN0LP7h9SNpddwXQfxaZgAM64qxpzX15yZpAtNDAfv/R9+uTh4M32bipQSPOl0P7PUqNIDxRfKMe8u50tGzTUVjF/XgJB5TZkW0oU6lYLrTuFDeHS2NS4lR5BWRfiUY3Kf6sGC5PbZtaqrkK5zQw1slwNPHWDt3kMlVqrpawAdeBzoOtOn3csjr/wRMe4UNoAI/sVZWW+ha5HbfcHh3MUwQjzdmeTg1uBK76sOLvA=="; // 解密data byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes()); String dataStr = new String(plainText, StandardCharsets.UTF_8); @@ -631,11 +632,11 @@ public class LianLianServiceImpl implements LianLianService { // 拼装对应的数据并返回 QueryStartChargeVO vo = QueryStartChargeVO.builder() - .StartChargeSeq(orderCode) - .StartChargeSeqStat(1) // 1-启动中 - .ConnectorID(pileConnectorCode) - .SuccStat(0) - .FailReason(0) + .startChargeSeq(orderCode) + .startChargeSeqStat(2) // 1、启动中 ;2、充电中;3、停止中;4、已结束;5、未知 + .connectorID(pileConnectorCode) + .succStat(0) + .failReason(0) .build(); @@ -673,49 +674,68 @@ public class LianLianServiceImpl implements LianLianService { * @return */ public Map query_equip_charge_status(QueryEquipChargeStatusDTO dto) { + String operatorID = dto.getOperatorID(); + String type = ThirdPartyOperatorIdEnum.getTypeByOperatorId(operatorID); + String operatorName = ThirdPlatformTypeEnum.getLabelByCode(type); // 通过订单号查询订单信息 OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(dto.getStartChargeSeq()); - // 通过订单号查询实时数据 + logger.info(operatorName + "查询订单信息 orderInfo:{}", orderInfo); if (orderInfo == null) { return null; } - ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorID()); + ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(operatorID); + logger.info(operatorName + "查询密钥信息 configInfo:{}", configInfo); if (configInfo == null) { return null; } OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderInfo.getOrderCode()); + // 通过订单号查询实时数据 List realTimeData = orderBasicInfoService.getChargingRealTimeData(orderInfo.getTransactionCode()); - RealTimeMonitorData data = realTimeData.get(0); - String orderStatus = orderInfo.getOrderStatus(); - if (StringUtils.equals(orderStatus, OrderStatusEnum.IN_THE_CHARGING.getValue())) { - // 充电中 - orderStatus = "2"; - } - if (StringUtils.equals(orderStatus, OrderStatusEnum.ORDER_COMPLETE.getValue())) { - // 充电完成 - orderStatus = "4"; + QueryChargingStatusVO vo; + if (CollectionUtils.isEmpty(realTimeData)) { + vo = new QueryChargingStatusVO(); } else { - // 直接给 5-未知 - orderStatus = "5"; + RealTimeMonitorData data = realTimeData.get(0); + String orderStatus = orderInfo.getOrderStatus(); + if (StringUtils.equals(orderStatus, OrderStatusEnum.IN_THE_CHARGING.getValue())) { + // 充电中 + orderStatus = "2"; + }else if (StringUtils.equals(orderStatus, OrderStatusEnum.ORDER_COMPLETE.getValue())) { + // 充电完成 + orderStatus = "4"; + } else { + // 直接给 5-未知 + orderStatus = "5"; + } + String status = data.getConnectorStatus(); + int connectorStatus = 0; + if (StringUtils.isBlank(status)) { + // 查询当前枪口状态 + PileConnectorInfoVO connectorInfoVO = pileConnectorInfoService.getPileConnectorInfoByConnectorCode(orderInfo.getPileConnectorCode()); + connectorStatus = connectorInfoVO.getStatus(); + }else { + connectorStatus = Integer.parseInt(status); + } + BigDecimal totalElectricityAmount = orderDetail.getTotalElectricityAmount() == null ? BigDecimal.ZERO : orderDetail.getTotalElectricityAmount(); + BigDecimal totalServiceAmount = orderDetail.getTotalServiceAmount() == null ? BigDecimal.ZERO : orderDetail.getTotalServiceAmount(); + // 拼装联联平台数据 + vo = QueryChargingStatusVO.builder() + .startChargeSeq(dto.getStartChargeSeq()) // 订单号 + .startChargeSeqStat(Integer.parseInt(orderStatus)) // 订单状态 + .connectorID(orderInfo.getPileConnectorCode()) // 枪口编码 + .connectorStatus(connectorStatus) // 枪口状态 + .currentA(new BigDecimal(data.getOutputCurrent())) // 电流 + .voltageA(new BigDecimal(data.getOutputVoltage())) // 电压 + .soc(new BigDecimal(data.getSOC())) + .startTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderInfo.getChargeStartTime())) // 开始时间 + .endTime(DateUtils.getDateTime()) // 本次采样时间 + .totalPower(new BigDecimal(data.getChargingDegree()).setScale(2, BigDecimal.ROUND_HALF_UP)) // 累计充电量 + .elecMoney(totalElectricityAmount.setScale(2, BigDecimal.ROUND_HALF_UP)) // 累计电费 + .seviceMoney(totalServiceAmount.setScale(2, BigDecimal.ROUND_HALF_UP)) // 累计服务费 + .totalMoney(new BigDecimal(data.getChargingAmount())) // 已充金额 + + .build(); } - // 拼装联联平台数据 - QueryChargingStatusVO vo = QueryChargingStatusVO.builder() - .StartChargeSeq(dto.getStartChargeSeq()) // 订单号 - .StartChargeSeqStat(Integer.parseInt(orderStatus)) // 订单状态 - .ConnectorID(orderInfo.getPileConnectorCode()) // 枪口编码 - .ConnectorStatus(Integer.parseInt(data.getConnectorStatus())) // 枪口状态 - .CurrentA(new BigDecimal(data.getOutputCurrent())) // 电流 - .VoltageA(new BigDecimal(data.getOutputVoltage())) // 电压 - .Soc(new BigDecimal(data.getSOC())) - .StartTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderInfo.getChargeStartTime())) // 开始时间 - .EndTime(DateUtils.getDateTime()) // 本次采样时间 - .TotalPower(new BigDecimal(data.getChargingDegree())) // 累计充电量 - .ElecMoney(orderDetail.getTotalElectricityAmount()) // 累计电费 - .SeviceMoney(orderDetail.getTotalServiceAmount()) // 累计服务费 - .TotalMoney(new BigDecimal(data.getChargingAmount())) // 已充金额 - - .build(); - // 加密 Map resultMap = Maps.newLinkedHashMap(); @@ -762,7 +782,7 @@ public class LianLianServiceImpl implements LianLianService { .build(); ykcPushCommandService.pushStopChargingCommand(command); vo.setStartChargeSeq(orderCode); - vo.setStartChargeSeqStat(3); // 3-停止中 + vo.setStartChargeSeqStat(4); // 1、启动中 ;2、充电中;3、停止中;4、已结束;5、未知 } vo.setSuccStat(0); vo.setFailReason(0); @@ -1123,26 +1143,30 @@ public class LianLianServiceImpl implements LianLianService { String dataSecret = relationInfo.getDataSecret(); String dataSecretIv = relationInfo.getDataSecretIv(); String urlAddress = relationInfo.getUrlAddress(); - String thirdPartyType = relation.getThirdPartyType(); + String thirdPartyType = relationInfo.getThirdPartyType(); // 调用 查询充电状态方法 QueryEquipChargeStatusDTO dto = new QueryEquipChargeStatusDTO(); dto.setStartChargeSeq(orderCode); + // 根据type获取operatorId + String operatorIdByType = ThirdPartyOperatorIdEnum.getOperatorIdByType(thirdPartyType); + dto.setOperatorID(operatorIdByType); Map map = query_equip_charge_status(dto); if (map == null) { return null; } String data = map.get("Data"); - // 解密data + // 解密data (此处解密需用 thirdparty_platform_config 的密钥配置) + ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(operatorIdByType); byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(data), - dataSecret.getBytes(), dataSecretIv.getBytes()); + configInfo.getDataSecret().getBytes(), configInfo.getDataSecretIv().getBytes()); String dataStr = new String(plainText, StandardCharsets.UTF_8); // 转成对应的对象 - QueryEquipChargeStatusDTO queryEquipChargeStatusDTO = JSONObject.parseObject(dataStr, QueryEquipChargeStatusDTO.class); + QueryChargingStatusVO vo = JSONObject.parseObject(dataStr, QueryChargingStatusVO.class); String url = urlAddress + "notification_equip_charge_status"; // 调用联联平台接口 - String jsonString = JSONObject.toJSONString(queryEquipChargeStatusDTO); + String jsonString = JSONObject.toJSONString(vo); // 获取令牌 String token = ""; @@ -1166,7 +1190,7 @@ public class LianLianServiceImpl implements LianLianService { } /** - * 推送停止充电结果(仅在 交易记录的帧类型中调用) + * 推送停止充电结果(仅在 充电结束Handler的 0x19 帧类型中调用) * * @param orderCode * @return @@ -1193,7 +1217,7 @@ public class LianLianServiceImpl implements LianLianService { String dataSecret = relationInfo.getDataSecret(); String dataSecretIv = relationInfo.getDataSecretIv(); String urlAddress = relationInfo.getUrlAddress(); - String thirdPartyType = relation.getThirdPartyType(); + String thirdPartyType = relationInfo.getThirdPartyType(); String url = urlAddress + "notification_stop_charge_result"; @@ -1267,7 +1291,7 @@ public class LianLianServiceImpl implements LianLianService { String dataSecret = relationInfo.getDataSecret(); String dataSecretIv = relationInfo.getDataSecretIv(); String urlAddress = relationInfo.getUrlAddress(); - String thirdPartyType = relation.getThirdPartyType(); + String thirdPartyType = relationInfo.getThirdPartyType(); String url = urlAddress + "notification_charge_order_info"; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/vo/EquipmentAuthVO.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/vo/EquipmentAuthVO.java index 5c9a0024d..01db24fb6 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/vo/EquipmentAuthVO.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/vo/EquipmentAuthVO.java @@ -1,5 +1,7 @@ package com.jsowell.thirdparty.lianlian.vo; +import com.alibaba.fastjson2.annotation.JSONField; +import com.fasterxml.jackson.annotation.JsonProperty; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -21,19 +23,22 @@ public class EquipmentAuthVO { * 设备认证流水号 * 格式“运营商 ID+yyyyMMddHHmmss+4 位随机数” */ - private String EquipAuthSeq; + @JSONField(name = "EquipAuthSeq") + private String equipAuthSeq; /** * 充电设备接口编码 */ - private String ConnectorID; + @JSONField(name = "ConnectorID") + private String connectorID; /** * 成功状态 * 0:成功; * 1:失败 */ - private int SuccStat; + @JSONField(name = "SuccStat") + private int succStat; /** * 失败原因 @@ -42,11 +47,13 @@ public class EquipmentAuthVO { * 2:设备检测失败: * 3~99:自定义 */ - private int FailReason; + @JSONField(name = "FailReason") + private int failReason; /** * 失败原因描述 * 如果设备认证失败则必传,描述力求简单明了,用户一看即懂 */ - private String FailReasonMsg; + @JSONField(name = "FailReasonMsg") + private String failReasonMsg; } diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/vo/QueryChargingStatusVO.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/vo/QueryChargingStatusVO.java index 73494fa41..f7af4c37b 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/vo/QueryChargingStatusVO.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/vo/QueryChargingStatusVO.java @@ -1,5 +1,6 @@ package com.jsowell.thirdparty.lianlian.vo; +import com.alibaba.fastjson2.annotation.JSONField; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -23,107 +24,128 @@ public class QueryChargingStatusVO { /** * 充电订单号 */ - private String StartChargeSeq; + @JSONField(name = "StartChargeSeq") + private String startChargeSeq; /** * 充电订单状态 */ - private int StartChargeSeqStat; + @JSONField(name = "StartChargeSeqStat") + private int startChargeSeqStat; /** * 充电设备接口编码 */ - private String ConnectorID; + @JSONField(name = "ConnectorID") + private String connectorID; /** * 充电设备接口状态 */ - private int ConnectorStatus; + @JSONField(name = "ConnectorStatus") + private int connectorStatus; /** * 车辆识别码 */ - private String Vin; + @JSONField(name = "Vin") + private String vin; /** * A 相电流 */ - private BigDecimal CurrentA; + @JSONField(name = "CurrentA") + private BigDecimal currentA; /** * B 相电流 */ - private BigDecimal CurrentB; + @JSONField(name = "CurrentB") + private BigDecimal currentB; /** * C 相电流 */ - private BigDecimal CurrentC; + @JSONField(name = "CurrentC") + private BigDecimal currentC; /** * A 相电压 */ - private BigDecimal VoltageA; + @JSONField(name = "VoltageA") + private BigDecimal voltageA; /** * B 相电压 */ - private BigDecimal VoltageB; + @JSONField(name = "VoltageB") + private BigDecimal voltageB; /** * C 相电压 */ - private BigDecimal VoltageC; + @JSONField(name = "VoltageC") + private BigDecimal voltageC; /** * 电池剩余电量 */ - private BigDecimal Soc; + @JSONField(name = "Soc") + private BigDecimal soc; /** * 开始充电时间 */ - private String StartTime; + @JSONField(name = "StartTime") + private String startTime; /** * 本次采样时间 */ - private String EndTime; + @JSONField(name = "EndTime") + private String endTime; /** * 累计充电量 */ - private BigDecimal TotalPower; + @JSONField(name = "TotalPower") + private BigDecimal totalPower; /** * 累计电费 */ - private BigDecimal ElecMoney; + @JSONField(name = "ElecMoney") + private BigDecimal elecMoney; /** * 累计服务费 */ - private BigDecimal SeviceMoney; + @JSONField(name = "SeviceMoney") + private BigDecimal seviceMoney; /** * 累计总金额 */ - private BigDecimal TotalMoney; + @JSONField(name = "TotalMoney") + private BigDecimal totalMoney; /** * 是否可申请停车费减免 */ - private int ParkingFeeDiscount; + // @JSONField(name = "ParkingFeeDiscount") + // private int parkingFeeDiscount; /** * 时段数 N 范围:0~32 */ - private int SumPeriod; + // @JSONField(name = "SumPeriod") + // private int sumPeriod; /** * 充电明细信息 */ - private List ChargeDetails; + @JSONField(name = "ChargeDetails") + private List chargeDetails; /** * 充电明细信息体 @@ -133,36 +155,43 @@ public class QueryChargingStatusVO { /** * 开始时间 */ - private String DetailStartTime; + @JSONField(name = "DetailStartTime") + private String detailStartTime; /** * 结束时间 */ - private String DetailEndTime; + @JSONField(name = "DetailEndTime") + private String detailEndTime; /** * 时段电价 */ - private BigDecimal ElecPrice; + @JSONField(name = "ElecPrice") + private BigDecimal elecPrice; /** * 时段服务费价格 */ - private BigDecimal SevicePrice; + @JSONField(name = "SevicePrice") + private BigDecimal sevicePrice; /** * 时段充电量 */ - private BigDecimal DetailPower; + @JSONField(name = "DetailPower") + private BigDecimal detailPower; /** * 时段电费 */ - private BigDecimal DetailElecMoney; + @JSONField(name = "DetailElecMoney") + private BigDecimal detailElecMoney; /** * 时段服务费 */ - private BigDecimal DetailSeviceMoney; + @JSONField(name = "DetailSeviceMoney") + private BigDecimal detailSeviceMoney; } } diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/vo/QueryStartChargeVO.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/vo/QueryStartChargeVO.java index a99135793..1fd132345 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/vo/QueryStartChargeVO.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/vo/QueryStartChargeVO.java @@ -1,5 +1,6 @@ package com.jsowell.thirdparty.lianlian.vo; +import com.alibaba.fastjson2.annotation.JSONField; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -19,25 +20,30 @@ public class QueryStartChargeVO { /** * 充电订单号 */ - private String StartChargeSeq; + @JSONField(name = "StartChargeSeq") + private String startChargeSeq; /** * 充电订单状态 */ - private int StartChargeSeqStat; + @JSONField(name = "StartChargeSeqStat") + private int startChargeSeqStat; /** * 充电设备接口编码 */ - private String ConnectorID; + @JSONField(name = "ConnectorID") + private String connectorID; /** * 成功状态 */ - private int SuccStat; + @JSONField(name = "SuccStat") + private int succStat; /** * 失败原因 */ - private int FailReason; + @JSONField(name = "FailReason") + private int failReason; } diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/vo/QueryStopChargeVO.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/vo/QueryStopChargeVO.java index 4f50b10b2..3ba87ea71 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/vo/QueryStopChargeVO.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/vo/QueryStopChargeVO.java @@ -1,5 +1,6 @@ package com.jsowell.thirdparty.lianlian.vo; +import com.alibaba.fastjson2.annotation.JSONField; import lombok.Data; /** @@ -14,17 +15,20 @@ public class QueryStopChargeVO { /** * 充电订单号 */ - private String StartChargeSeq; + @JSONField(name = "StartChargeSeq") + private String startChargeSeq; /** * 充电订单状态 1、启动中 ;2、充电中;3、停止中;4、已结束;5、未知 */ - private int StartChargeSeqStat; + @JSONField(name = "StartChargeSeqStat") + private int startChargeSeqStat; /** * 成功状态 0:成功; 1:失败 */ - private int SuccStat; + @JSONField(name = "SuccStat") + private int succStat; /** * 失败原因 @@ -34,5 +38,6 @@ public class QueryStopChargeVO { * 3:设备已停止充电; * 4~99:自定义 */ - private int FailReason; + @JSONField(name = "FailReason") + private int failReason; }