From 5dba9bce647d4b02e7d3d6e1cbe39c16c23d03b0 Mon Sep 17 00:00:00 2001 From: Lemon Date: Tue, 6 Jun 2023 11:24:08 +0800 Subject: [PATCH] update --- .../netty/handler/ChargeEndHandler.java | 14 ++++++++++++-- .../TransactionRecordsRequestHandler.java | 18 +++++++++++------- .../handler/UploadRealTimeMonitorHandler.java | 19 ++++++++++++------- 3 files changed, 35 insertions(+), 16 deletions(-) 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 6a7b87b60..579c850a7 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,9 +9,12 @@ 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.StationSettingRelation; import com.jsowell.pile.domain.ThirdPartySettingInfo; import com.jsowell.pile.service.IOrderBasicInfoService; +import com.jsowell.pile.service.IStationSettingRelationService; import com.jsowell.pile.service.IThirdPartySettingInfoService; +import com.jsowell.pile.vo.base.StationSettingRelationVO; import com.jsowell.thirdparty.lianlian.service.LianLianService; import io.netty.channel.Channel; import lombok.extern.slf4j.Slf4j; @@ -42,6 +45,9 @@ public class ChargeEndHandler extends AbstractHandler{ @Autowired private LianLianService lianLianService; + @Autowired + private IStationSettingRelationService stationSettingRelationService; + @Override public void afterPropertiesSet() throws Exception { YKCOperateFactory.register(type, this); @@ -127,8 +133,12 @@ public class ChargeEndHandler extends AbstractHandler{ try { // 查询该站点是否已对接互联互通平台,如果对接则发送充电结束 - ThirdPartySettingInfo info = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(orderInfo.getStationId())); - if (Objects.nonNull(info)) { + // 通过站点id查询相关配置信息 + StationSettingRelation relation = new StationSettingRelation(); + relation.setStationId(Long.parseLong(orderInfo.getStationId())); + StationSettingRelationVO relationInfo = stationSettingRelationService.selectRelationInfo(relation); + // ThirdPartySettingInfo info = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(orderInfo.getStationId())); + if (Objects.nonNull(relationInfo)) { // 推送停止充电结果 lianLianService.pushStopChargeResult(orderInfo.getOrderCode()); } 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 b6c162c88..fafda1327 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 @@ -19,11 +19,10 @@ import com.jsowell.common.util.id.IdUtils; import com.jsowell.netty.factory.YKCOperateFactory; import com.jsowell.pile.domain.OrderBasicInfo; import com.jsowell.pile.domain.PileAuthCard; +import com.jsowell.pile.domain.StationSettingRelation; import com.jsowell.pile.domain.ThirdPartySettingInfo; -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.pile.service.*; +import com.jsowell.pile.vo.base.StationSettingRelationVO; import com.jsowell.thirdparty.lianlian.service.LianLianService; import io.netty.channel.Channel; import lombok.extern.slf4j.Slf4j; @@ -72,6 +71,9 @@ public class TransactionRecordsRequestHandler extends AbstractHandler { @Autowired private LianLianService lianLianService; + @Autowired + private IStationSettingRelationService stationSettingRelationService; + public static void main(String[] args) { // 获取消息体 String msg = "000000000000000000000000000000008823000000030601a08c2e0d0404170000380d0404170000000000000000000000000000000000000000000000000000000000000000400d0300ee250000ee250000c84b000000000000000000000000000000000000e0bb040000cee1040000ee250000ee250000c84b00000000000000000000000000000000000000010000380d04041745a511101970000000"; @@ -620,9 +622,11 @@ public class TransactionRecordsRequestHandler extends AbstractHandler { try { // 联联平台 推送订单信息 notification_orderInfo // 查询该站点是否推送联联平台 - String stationId = orderBasicInfo.getStationId(); - ThirdPartySettingInfo infoByStationId = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(stationId)); - if (Objects.nonNull(infoByStationId)) { + StationSettingRelation relation = new StationSettingRelation(); + relation.setStationId(Long.parseLong(orderBasicInfo.getStationId())); + StationSettingRelationVO relationInfo = stationSettingRelationService.selectRelationInfo(relation); + // ThirdPartySettingInfo infoByStationId = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(stationId)); + if (Objects.nonNull(relationInfo)) { // 推送订单信息 lianLianService.pushOrderInfo(orderBasicInfo.getOrderCode()); // 推送充电订单信息 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 3115dbdbe..e36953216 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 @@ -13,11 +13,10 @@ 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.StationSettingRelation; 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.pile.service.*; +import com.jsowell.pile.vo.base.StationSettingRelationVO; import com.jsowell.thirdparty.lianlian.service.LianLianService; import io.netty.channel.Channel; import lombok.extern.slf4j.Slf4j; @@ -61,6 +60,9 @@ public class UploadRealTimeMonitorHandler extends AbstractHandler { @Autowired private LianLianService lianLianService; + @Autowired + private IStationSettingRelationService stationSettingRelationService; + @Override public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) { log.info("[===获取桩上传的实时监测数据===] param:{}, channel:{}", JSONObject.toJSONString(ykcDataProtocol), channel.toString()); @@ -288,9 +290,12 @@ public class UploadRealTimeMonitorHandler extends AbstractHandler { return null; } // 状态不一样,传给联联 - PileBasicInfo pileBasicInfo = pileBasicInfoService.selectPileBasicInfoBySN(pileSn); - ThirdPartySettingInfo thirdPartySettingInfo = thirdPartySettingInfoService.getInfoByStationId(pileBasicInfo.getStationId()); - if (Objects.nonNull(thirdPartySettingInfo)) { + // 查询该站点是否推送联联平台 + StationSettingRelation relation = new StationSettingRelation(); + relation.setStationId(Long.parseLong(orderInfo.getStationId())); + StationSettingRelationVO relationInfo = stationSettingRelationService.selectRelationInfo(relation); + // ThirdPartySettingInfo thirdPartySettingInfo = thirdPartySettingInfoService.getInfoByStationId(pileBasicInfo.getStationId()); + if (Objects.nonNull(relationInfo)) { String pileConnectorCode = pileSn + connectorCode; // 设备状态变化推送 notification_stationStatus lianLianService.pushConnectorStatus(pileConnectorCode, connectorStatus);