From 180645ffb2af9d89fef5f82709fea8cb87f6ddb8 Mon Sep 17 00:00:00 2001 From: Guoqs <123@jsowell.com> Date: Thu, 25 Jul 2024 13:42:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=8D=8F=E8=AE=AE0x65?= =?UTF-8?q?=E9=A2=84=E7=BA=A6=E5=85=85=E7=94=B5=E5=90=AF=E5=8A=A8=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application.yml | 1 + ...servationChargingStartupResultHandler.java | 15 +++++++ .../dto/ReservationChargingStartupResult.java | 42 +++++++++++++++++++ .../pile/service/PileBasicInfoService.java | 7 ++-- .../impl/PileBasicInfoServiceImpl.java | 18 ++++++-- .../wxpay/service/WxAppletRemoteService.java | 20 +++++---- 6 files changed, 86 insertions(+), 17 deletions(-) create mode 100644 jsowell-pile/src/main/java/com/jsowell/pile/dto/ReservationChargingStartupResult.java diff --git a/jsowell-admin/src/main/resources/application.yml b/jsowell-admin/src/main/resources/application.yml index de9bc248c..a11aaecb3 100644 --- a/jsowell-admin/src/main/resources/application.yml +++ b/jsowell-admin/src/main/resources/application.yml @@ -106,6 +106,7 @@ weixin: sendMsg: startChargingTmpId: BGgZe98QHr0I1S1GrtGps0y3uhvURtQNkbMAzI2D8g8 stopChargingTmpId: UyBPbADlZfsCj89rh_xvfR2ZP1iwtmPcMFA0sUOJwog + startupResultTmpId: BGgZe98QHr0I1S1GrtGps-Av8-Y6WoD2Ny8DZWvdhoQ #Sim卡信息 xunzhong: diff --git a/jsowell-netty/src/main/java/com/jsowell/netty/handler/yunkuaichong/ReservationChargingStartupResultHandler.java b/jsowell-netty/src/main/java/com/jsowell/netty/handler/yunkuaichong/ReservationChargingStartupResultHandler.java index 3c3799521..ba3cd3944 100644 --- a/jsowell-netty/src/main/java/com/jsowell/netty/handler/yunkuaichong/ReservationChargingStartupResultHandler.java +++ b/jsowell-netty/src/main/java/com/jsowell/netty/handler/yunkuaichong/ReservationChargingStartupResultHandler.java @@ -8,8 +8,11 @@ import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode; import com.jsowell.common.util.BytesUtil; import com.jsowell.common.util.YKCUtils; import com.jsowell.netty.factory.YKCOperateFactory; +import com.jsowell.pile.dto.ReservationChargingStartupResult; +import com.jsowell.pile.service.PileBasicInfoService; import io.netty.channel.Channel; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; /** @@ -21,6 +24,9 @@ public class ReservationChargingStartupResultHandler extends AbstractHandler{ private final String type = YKCUtils.frameType2Str(YKCFrameTypeCode.RESERVATION_CHARGING_STARTUP_RESULT_CODE.getBytes()); + @Autowired + private PileBasicInfoService pileBasicInfoService; + @Override public void afterPropertiesSet() throws Exception { YKCOperateFactory.register(type, this); @@ -76,6 +82,15 @@ public class ReservationChargingStartupResultHandler extends AbstractHandler{ transactionCode, pileSn, connectorCode, vinCode, startupResult, failReason); + ReservationChargingStartupResult chargingStartupResult = ReservationChargingStartupResult.builder() + .transactionCode(transactionCode) + .pileSn(pileSn) + .connectorCode(connectorCode) + .vinCode(vinCode) + .startupResult(startupResult) + .failReason(failReason) + .build(); + pileBasicInfoService.startupResult(chargingStartupResult); /* diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/dto/ReservationChargingStartupResult.java b/jsowell-pile/src/main/java/com/jsowell/pile/dto/ReservationChargingStartupResult.java new file mode 100644 index 000000000..089788305 --- /dev/null +++ b/jsowell-pile/src/main/java/com/jsowell/pile/dto/ReservationChargingStartupResult.java @@ -0,0 +1,42 @@ +package com.jsowell.pile.dto; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class ReservationChargingStartupResult { + /** + * 交易流水号 + */ + private String transactionCode; + + /** + * 桩编号 + */ + private String pileSn; + + /** + * 枪口号 + */ + private String connectorCode; + + /** + * vin + */ + private String vinCode; + + /** + * 启动结果 + */ + private String startupResult; + + /** + * 失败原因 + */ + private String failReason; +} diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/PileBasicInfoService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/PileBasicInfoService.java index e049d2d21..d0ff490df 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/PileBasicInfoService.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/PileBasicInfoService.java @@ -2,10 +2,7 @@ package com.jsowell.pile.service; import com.jsowell.common.core.domain.ykc.RealTimeMonitorData; import com.jsowell.pile.domain.PileBasicInfo; -import com.jsowell.pile.dto.IndexQueryDTO; -import com.jsowell.pile.dto.QueryPileDTO; -import com.jsowell.pile.dto.ReplaceMerchantStationDTO; -import com.jsowell.pile.dto.StartPersonPileDTO; +import com.jsowell.pile.dto.*; import com.jsowell.pile.thirdparty.ConnectorInfo; import com.jsowell.pile.thirdparty.EquipmentInfo; import com.jsowell.pile.thirdparty.ZDLConnectorInfo; @@ -222,4 +219,6 @@ public interface PileBasicInfoService { List getConnectorListForZDL(String pileSn); String startPersonalPileCharging(StartPersonPileDTO dto); + + void startupResult(ReservationChargingStartupResult chargingStartupResult); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java index 0c8baba83..10a7f37fb 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java @@ -18,10 +18,7 @@ import com.jsowell.pile.domain.PileBasicInfo; import com.jsowell.pile.domain.PileConnectorInfo; import com.jsowell.pile.domain.PileModelInfo; import com.jsowell.pile.domain.PileSimInfo; -import com.jsowell.pile.dto.IndexQueryDTO; -import com.jsowell.pile.dto.QueryPileDTO; -import com.jsowell.pile.dto.ReplaceMerchantStationDTO; -import com.jsowell.pile.dto.StartPersonPileDTO; +import com.jsowell.pile.dto.*; import com.jsowell.pile.mapper.PileBasicInfoMapper; import com.jsowell.pile.service.*; import com.jsowell.pile.service.programlogic.AbstractProgramLogic; @@ -37,6 +34,7 @@ import com.jsowell.pile.vo.uniapp.customer.GroundLockInfoVO; import com.jsowell.pile.vo.uniapp.customer.PersonalPileInfoVO; import com.jsowell.pile.vo.uniapp.customer.PileConnectorDetailVO; import com.jsowell.pile.vo.web.*; +import com.jsowell.wxpay.service.WxAppletRemoteService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.RandomStringUtils; @@ -89,6 +87,9 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService { @Autowired private PileReservationInfoService pileReservationInfoService; + @Autowired + private WxAppletRemoteService wxAppletRemoteService; + /** * 查询设备管理 * @@ -1211,4 +1212,13 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService { String orderCode = orderLogic.startPersonalPileCharging(dto); return orderCode; } + + /** + * 预约充电启动结果 + */ + @Override + public void startupResult(ReservationChargingStartupResult chargingStartupResult) { + // 小程序通知 + wxAppletRemoteService.reservationStartupResultSendMsg(); + } } diff --git a/jsowell-pile/src/main/java/com/jsowell/wxpay/service/WxAppletRemoteService.java b/jsowell-pile/src/main/java/com/jsowell/wxpay/service/WxAppletRemoteService.java index e8f5897f4..ee2f9f9e6 100644 --- a/jsowell-pile/src/main/java/com/jsowell/wxpay/service/WxAppletRemoteService.java +++ b/jsowell-pile/src/main/java/com/jsowell/wxpay/service/WxAppletRemoteService.java @@ -72,19 +72,14 @@ public class WxAppletRemoteService { @Value("${weixin.sendMsg.stopChargingTmpId}") private String stopChargingTmpId; + @Value("${weixin.sendMsg.startupResultTmpId}") + private String startupResultTmpId; /** * 获取accessToken * * @return */ public String getAccessToken() { - // String appid = Constants.APP_ID; - // String secret = Constants.APP_SECRET; - - // 这里我是从配置文件中取得appid和appsecret - // appid = properties.getAppId(); - // secret = properties.getAppSecret(); - //查询token是否存在 String redisKey = CacheConstants.ACCESS_TOKEN + appid; // 使用缓存先查询AccessToken是否存在 @@ -236,7 +231,6 @@ public class WxAppletRemoteService { return uniAppSendMsg(msgInfo); } - /** * 停止充电发送消息 * @param dto @@ -281,7 +275,15 @@ public class WxAppletRemoteService { } /** - * 小程序发送消息方法 + * 预约充电结果小程序服务通知 + */ + public Map reservationStartupResultSendMsg() { + AppletTemplateMessageSendDTO msgInfo = new AppletTemplateMessageSendDTO(); + return uniAppSendMsg(msgInfo); + } + + /** + * 小程序发送消息方法/小程序通知/服务通知 * @param dto * @return */