From b5d060e1472246612a4398ab9ab50626da3740d5 Mon Sep 17 00:00:00 2001 From: "autumn.g@foxmail.com" Date: Sat, 25 Mar 2023 16:01:54 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E5=90=AF=E5=8A=A8=E9=A2=84=E7=BA=A6?= =?UTF-8?q?=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jsowell-admin/pom.xml | 4 +-- jsowell-quartz/pom.xml | 2 +- .../com/jsowell/quartz/task/JsowellTask.java | 35 ++++++++++++++----- 3 files changed, 30 insertions(+), 11 deletions(-) diff --git a/jsowell-admin/pom.xml b/jsowell-admin/pom.xml index 6ba438823..b0ebfe083 100644 --- a/jsowell-admin/pom.xml +++ b/jsowell-admin/pom.xml @@ -50,10 +50,10 @@ - + diff --git a/jsowell-quartz/pom.xml b/jsowell-quartz/pom.xml index 47bbe267d..1530ba2af 100644 --- a/jsowell-quartz/pom.xml +++ b/jsowell-quartz/pom.xml @@ -44,7 +44,7 @@ com.jsowell - jsowell-admin + jsowell-netty 1.0.0 diff --git a/jsowell-quartz/src/main/java/com/jsowell/quartz/task/JsowellTask.java b/jsowell-quartz/src/main/java/com/jsowell/quartz/task/JsowellTask.java index 9637294bc..60b4e530e 100644 --- a/jsowell-quartz/src/main/java/com/jsowell/quartz/task/JsowellTask.java +++ b/jsowell-quartz/src/main/java/com/jsowell/quartz/task/JsowellTask.java @@ -1,18 +1,21 @@ package com.jsowell.quartz.task; import com.jsowell.common.util.DateUtils; +import com.jsowell.common.util.StringUtils; +import com.jsowell.netty.command.ykc.PublishPileBillingTemplateCommand; +import com.jsowell.netty.command.ykc.StartChargingCommand; +import com.jsowell.netty.service.yunkuaichong.YKCPushCommandService; import com.jsowell.pile.domain.OrderBasicInfo; import com.jsowell.pile.service.IOrderBasicInfoService; import com.jsowell.pile.service.IPileBillingTemplateService; import com.jsowell.pile.vo.web.BillingTemplateVO; -import com.jsowell.service.OrderService; -import com.jsowell.service.PileRemoteService; import org.apache.commons.collections4.CollectionUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.Date; import java.util.List; @@ -25,14 +28,11 @@ public class JsowellTask { @Autowired private IOrderBasicInfoService orderBasicInfoService; - @Autowired - private OrderService orderService; - @Autowired private IPileBillingTemplateService pileBillingTemplateService; @Autowired - private PileRemoteService pileRemoteService; + private YKCPushCommandService ykcPushCommandService; /** * 关闭15分钟未支付的订单 @@ -69,10 +69,29 @@ public class JsowellTask { // 发送启动充电指令前,再次下发计费模板 BillingTemplateVO billingTemplateVO = pileBillingTemplateService.selectBillingTemplateDetailByPileSn(pileSn); if (billingTemplateVO != null) { - pileRemoteService.publishPileBillingTemplate(pileSn, billingTemplateVO); + PublishPileBillingTemplateCommand command = PublishPileBillingTemplateCommand.builder() + .billingTemplateVO(billingTemplateVO) + .pileSn(pileSn) + .build(); + ykcPushCommandService.pushPublishPileBillingTemplate(command); } // 发送启动指令 - pileRemoteService.remoteStartCharging(pileSn, orderInfo.getConnectorCode(), orderInfo.getTransactionCode(), orderInfo.getPayAmount()); + String connectorCode = orderInfo.getConnectorCode(); + String transactionCode = orderInfo.getTransactionCode(); + BigDecimal payAmount = orderInfo.getPayAmount(); + + if (StringUtils.isEmpty(pileSn) || StringUtils.isEmpty(connectorCode)) { + log.warn("appointmentOrderStart-远程启动充电, 充电桩编号和枪口号不能为空"); + return; + } + log.info("appointmentOrderStart 远程启动充电, 桩号:{}, 枪口号:{}", pileSn, connectorCode); + StartChargingCommand startChargingCommand = StartChargingCommand.builder() + .pileSn(pileSn) + .connectorCode(connectorCode) + .transactionCode(transactionCode) + .chargeAmount(payAmount) + .build(); + ykcPushCommandService.pushStartChargingCommand(startChargingCommand); } } }