diff --git a/jsowell-netty/pom.xml b/jsowell-netty/pom.xml
index b174b8f71..30096c99e 100644
--- a/jsowell-netty/pom.xml
+++ b/jsowell-netty/pom.xml
@@ -21,6 +21,11 @@
jsowell-pile
1.0.0
+
+ com.jsowell
+ jsowell-thirdparty
+
+
diff --git a/jsowell-netty/src/main/java/com/jsowell/netty/handler/ChargeEndHandler.java b/jsowell-netty/src/main/java/com/jsowell/netty/handler/ChargeEndHandler.java
index f226b80da..6a7b87b60 100644
--- a/jsowell-netty/src/main/java/com/jsowell/netty/handler/ChargeEndHandler.java
+++ b/jsowell-netty/src/main/java/com/jsowell/netty/handler/ChargeEndHandler.java
@@ -9,7 +9,10 @@ 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.ThirdPartySettingInfo;
import com.jsowell.pile.service.IOrderBasicInfoService;
+import com.jsowell.pile.service.IThirdPartySettingInfoService;
+import com.jsowell.thirdparty.lianlian.service.LianLianService;
import io.netty.channel.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -33,6 +36,12 @@ public class ChargeEndHandler extends AbstractHandler{
@Autowired
private IOrderBasicInfoService orderBasicInfoService;
+ @Autowired
+ private IThirdPartySettingInfoService thirdPartySettingInfoService;
+
+ @Autowired
+ private LianLianService lianLianService;
+
@Override
public void afterPropertiesSet() throws Exception {
YKCOperateFactory.register(type, this);
@@ -115,6 +124,18 @@ public class ChargeEndHandler extends AbstractHandler{
orderInfo.setChargeEndTime(new Date()); // 结束充电时间
}
orderBasicInfoService.updateOrderBasicInfo(orderInfo);
+
+ try {
+ // 查询该站点是否已对接互联互通平台,如果对接则发送充电结束
+ ThirdPartySettingInfo info = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(orderInfo.getStationId()));
+ if (Objects.nonNull(info)) {
+ // 推送停止充电结果
+ lianLianService.pushStopChargeResult(orderInfo.getOrderCode());
+ }
+ } catch (Exception e) {
+ log.error("联联平台推送停止充电结果异常", e);
+ }
+
}
return null;
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 7f70ee422..b6c162c88 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
@@ -24,6 +24,7 @@ import com.jsowell.pile.service.IOrderBasicInfoService;
import com.jsowell.pile.service.IPileAuthCardService;
import com.jsowell.pile.service.IPileMsgRecordService;
import com.jsowell.pile.service.IThirdPartySettingInfoService;
+import com.jsowell.thirdparty.lianlian.service.LianLianService;
import io.netty.channel.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -68,6 +69,9 @@ public class TransactionRecordsRequestHandler extends AbstractHandler {
@Autowired
private IThirdPartySettingInfoService thirdPartySettingInfoService;
+ @Autowired
+ private LianLianService lianLianService;
+
public static void main(String[] args) {
// 获取消息体
String msg = "000000000000000000000000000000008823000000030601a08c2e0d0404170000380d0404170000000000000000000000000000000000000000000000000000000000000000400d0300ee250000ee250000c84b000000000000000000000000000000000000e0bb040000cee1040000ee250000ee250000c84b00000000000000000000000000000000000000010000380d04041745a511101970000000";
@@ -609,18 +613,24 @@ public class TransactionRecordsRequestHandler extends AbstractHandler {
// 结算订单操作
try {
orderBasicInfoService.settleOrder(data, orderBasicInfo);
+ } catch (Exception e) {
+ log.error("结算订单发生异常", e);
+ }
+ try {
+ // 联联平台 推送订单信息 notification_orderInfo
// 查询该站点是否推送联联平台
String stationId = orderBasicInfo.getStationId();
ThirdPartySettingInfo infoByStationId = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(stationId));
if (Objects.nonNull(infoByStationId)) {
- // TODO 推送联联平台 订单信息推送接口
-
+ // 推送订单信息
+ lianLianService.pushOrderInfo(orderBasicInfo.getOrderCode());
+ // 推送充电订单信息
+ lianLianService.pushChargeOrderInfo(orderBasicInfo.getOrderCode());
}
// 调用相关接口
-
} catch (Exception e) {
- log.error("结算订单发生异常", e);
+ log.error("联联平台 推送订单信息发生异常", e);
}
} else {
// 平台没有查到订单
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 dba0b87c8..3115dbdbe 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
@@ -1,6 +1,7 @@
package com.jsowell.netty.handler;
import com.alibaba.fastjson2.JSONObject;
+import com.google.common.collect.Lists;
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
@@ -11,14 +12,20 @@ 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.ThirdPartySettingInfo;
import com.jsowell.pile.service.IOrderBasicInfoService;
import com.jsowell.pile.service.IPileBasicInfoService;
+import com.jsowell.pile.service.IPileConnectorInfoService;
+import com.jsowell.pile.service.IThirdPartySettingInfoService;
+import com.jsowell.thirdparty.lianlian.service.LianLianService;
import io.netty.channel.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Date;
+import java.util.Map;
import java.util.Objects;
/**
@@ -45,6 +52,15 @@ public class UploadRealTimeMonitorHandler extends AbstractHandler {
@Autowired
private IOrderBasicInfoService orderBasicInfoService;
+ @Autowired
+ private IPileConnectorInfoService pileConnectorInfoService;
+
+ @Autowired
+ private IThirdPartySettingInfoService thirdPartySettingInfoService;
+
+ @Autowired
+ private LianLianService lianLianService;
+
@Override
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
log.info("[===获取桩上传的实时监测数据===] param:{}, channel:{}", JSONObject.toJSONString(ykcDataProtocol), channel.toString());
@@ -262,6 +278,33 @@ public class UploadRealTimeMonitorHandler extends AbstractHandler {
}
}
}
+
+ try {
+ // 推送联联平台
+ OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode);
+ Map pileStatusMap = pileConnectorInfoService.getPileStatus(Lists.newArrayList(pileSn));
+ String pileStatus = pileStatusMap.get(pileSn);
+ if (StringUtils.equals(connectorStatus, pileStatus)) {
+ return null;
+ }
+ // 状态不一样,传给联联
+ PileBasicInfo pileBasicInfo = pileBasicInfoService.selectPileBasicInfoBySN(pileSn);
+ ThirdPartySettingInfo thirdPartySettingInfo = thirdPartySettingInfoService.getInfoByStationId(pileBasicInfo.getStationId());
+ if (Objects.nonNull(thirdPartySettingInfo)) {
+ String pileConnectorCode = pileSn + connectorCode;
+ // 设备状态变化推送 notification_stationStatus
+ lianLianService.pushConnectorStatus(pileConnectorCode, connectorStatus);
+ if (StringUtils.equals(connectorStatus, "03")) {
+ // 充电中
+ lianLianService.pushPileChargeStatusChange(orderInfo.getOrderCode());
+ }
+ // 推送充电状态
+ lianLianService.pushChargeStatus(orderInfo.getOrderCode());
+ }
+ } catch (Exception e) {
+ log.error("推送联联平台 实时数据 异常", e);
+ }
+
return null;
}
diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java
index ca324dd34..5987eb3fb 100644
--- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java
+++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java
@@ -776,7 +776,6 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
logger.error("redis中取出实时记录保存到表 发生异常", e);
}
- // TODO 推送停止充电结果 notification_stop_charge_result
}
/**
diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/service/LianLianService.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/service/LianLianService.java
index 997e4bb66..a8883ba30 100644
--- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/service/LianLianService.java
+++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/service/LianLianService.java
@@ -113,7 +113,7 @@ public interface LianLianService {
String pushChargeStatus(String orderCode) throws UnsupportedEncodingException;
/**
- * 推送停止充电结果(仅在 交易记录的帧类型中调用)
+ * 推送停止充电结果(仅在 0x19的帧类型中调用)
* @param orderCode
* @return
*/