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 96e8e93cf..82a7a8f19 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 @@ -2,6 +2,7 @@ package com.jsowell.netty.handler; import com.alibaba.fastjson2.JSON; 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; @@ -347,15 +348,18 @@ public class UploadRealTimeMonitorHandler extends AbstractHandler { return; } String pileConnectorCode = pileSn + connectorCode; + // 将枪口状态转换成对接平台的状态 + String changedStatus = changeConnectorStatus(connectorStatus, realTimeMonitorData.getPutGunType()); + if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getCode(), relationInfo.getThirdPartyType())) { // 联联 OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode); if (orderInfo == null) { return; } - log.info("推送联联平台实时数据 params: orderBasicInfo:{}", JSON.toJSONString(orderInfo)); + // log.info("推送联联平台实时数据 params: orderBasicInfo:{}", JSON.toJSONString(orderInfo)); // 设备状态变化推送 notification_stationStatus - lianLianService.pushConnectorStatus(pileConnectorCode, connectorStatus); + lianLianService.pushConnectorStatus(pileConnectorCode, changedStatus); if (StringUtils.equals(connectorStatus, "03")) { // 充电中 lianLianService.pushPileChargeStatusChange(orderInfo.getOrderCode()); @@ -365,8 +369,8 @@ public class UploadRealTimeMonitorHandler extends AbstractHandler { } if (StringUtils.equals(ThirdPlatformTypeEnum.ZHONG_DIAN_LIAN_PLATFORM.getCode(), relationInfo.getThirdPartyType())) { // 中电联 - log.info("推送中电联平台实时数据 pileConnectorCode:{}, connectorStatus:{}", pileConnectorCode, connectorStatus); - zdlService.notificationStationStatus(pileConnectorCode, connectorStatus); + // log.info("推送中电联平台实时数据 pileConnectorCode:{}, connectorStatus:{}", pileConnectorCode, connectorStatus); + zdlService.notificationStationStatus(pileConnectorCode, changedStatus); } if (StringUtils.equals(ThirdPlatformTypeEnum.JIANG_SU_PLATFORM.getCode(), relationInfo.getThirdPartyType())) { // 先判断缓存中是否有数据 @@ -378,25 +382,25 @@ public class UploadRealTimeMonitorHandler extends AbstractHandler { // 充电状态 // 如果缓存有数据,证明上次推送未超过一分钟,不予推送,若缓存中无数据,说明需要推送 if (cacheObject == null) { - log.info("推送江苏省平台 充电状态 params:{}", realTimeMonitorData); + // log.info("推送江苏省平台 充电状态 params:{}", realTimeMonitorData); String result = nrService.pushPileStatus(realTimeMonitorData); redisCache.setCacheObject(redisKey, realTimeMonitorData, 1, TimeUnit.MINUTES); - log.info("推送江苏省平台 充电状态 result:{}", result); + // log.info("推送江苏省平台 充电状态 result:{}", result); } } else { // 如果不是充电状态,直接推送就可以 - log.info("推送江苏省平台 非充电状态 params:{}", realTimeMonitorData); + // log.info("推送江苏省平台 非充电状态 params:{}", realTimeMonitorData); String result = nrService.pushPileStatus(realTimeMonitorData); - log.info("推送江苏省平台 非充电状态 result:{}", result); + // log.info("推送江苏省平台 非充电状态 result:{}", result); } // log.info("推送江苏省平台实时数据 result:{}", result); } if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getCode(), relationInfo.getThirdPartyType())) { // 新电途平台 - log.info("推送新电途平台设备状态变化推送 pileConnectorCode:{}, connectorStatus:{}", pileConnectorCode, connectorStatus); - String result1 = xdtService.notificationStationStatus(pileConnectorCode, connectorStatus); - log.info("推送新电途平台设备状态变化推送 result:{}", result1); + log.info("新电途平台设备状态变化推送 pileConnectorCode:{}, changedStatus:{}", pileConnectorCode, changedStatus); + String result1 = xdtService.notificationStationStatus(pileConnectorCode, changedStatus); + log.info("新电途平台设备状态变化推送 result:{}", result1); OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode); if (orderInfo == null) { return; @@ -408,19 +412,19 @@ public class UploadRealTimeMonitorHandler extends AbstractHandler { if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), relationInfo.getThirdPartyType())) { // 甬城泊车 - log.info("推送甬城泊车平台设备状态变化推送 pileConnectorCode:{}, connectorStatus:{}", pileConnectorCode, connectorStatus); + // log.info("推送甬城泊车平台设备状态变化推送 pileConnectorCode:{}, changedStatus:{}", pileConnectorCode, changedStatus); // 设备状态变化推送 notification_stationStatus - String result1 = ycbcService.notificationStationStatus(pileConnectorCode, connectorStatus); - log.info("推送甬城泊车平台设备状态变化推送 result:{}", result1); + String result1 = ycbcService.notificationStationStatus(pileConnectorCode, changedStatus); + // log.info("推送甬城泊车平台设备状态变化推送 result:{}", result1); // 推送充电状态 OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode); if (orderInfo == null) { return; } if (StringUtils.equals(orderInfo.getStartMode(), StartModeEnum.THIRD_PARTY_PLATFORM.getValue())) { - log.info("推送甬城泊车充电订单状态 param:{}", orderInfo); + // log.info("推送甬城泊车充电订单状态 param:{}", orderInfo); String result2 = ycbcService.pushChargeStatus(orderInfo.getOrderCode()); - log.info("推送甬城泊车充电订单状态 result:{}", result2); + // log.info("推送甬城泊车充电订单状态 result:{}", result2); } } } catch (Exception e) { @@ -428,6 +432,28 @@ public class UploadRealTimeMonitorHandler extends AbstractHandler { } } + /** + * 转换枪口状态 + * @param connectorStatus 有电充平台枪口状态 + * @param putGunType 是否插枪 + * @return 第三方平台枪口状态 + */ + private String changeConnectorStatus(String connectorStatus, String putGunType) { + if (StringUtils.equals(connectorStatus, "02")) { + // 空闲 + return Constants.ONE; + } else if (StringUtils.equals(connectorStatus, "02") && StringUtils.equals(putGunType, "01")) { + // 占用(未充电) + return Constants.TWO; + } else if (StringUtils.equals(connectorStatus, "01")) { + // 故障 + return "255"; + }else { + // 0-离网和 3-充电中不需要转换,直接返回 + return connectorStatus; + } + } + public static void main(String[] args) { StringBuffer sb = new StringBuffer("0100"); String lowOrder = sb.substring(0, 2); 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 2620c5760..20576e157 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 @@ -719,12 +719,12 @@ public class LianLianServiceImpl implements LianLianService { String operatorName = ThirdPlatformTypeEnum.getLabelByCode(type); // 通过订单号查询订单信息 OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(dto.getStartChargeSeq()); - logger.info(operatorName + "查询订单信息 orderInfo:{}", orderInfo); + // logger.info(operatorName + "查询订单信息 orderInfo:{}", orderInfo); if (orderInfo == null) { return null; } ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(operatorID); - logger.info(operatorName + "查询密钥信息 configInfo:{}", configInfo); + // logger.info(operatorName + "查询密钥信息 configInfo:{}", configInfo); if (configInfo == null) { return null; } diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/util/HttpRequestUtil.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/util/HttpRequestUtil.java index a059ff93e..5b723231c 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/util/HttpRequestUtil.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/util/HttpRequestUtil.java @@ -95,7 +95,7 @@ public class HttpRequestUtil { /** * 发送请求 * - * @param token 联联平台令牌 + * @param token 令牌 * @param data 要传输的JsonString格式数据 * @param url 请求地址 * @param dataSecret 消息密钥