update 启动预约订单

This commit is contained in:
2023-03-25 16:01:54 +08:00
parent 0f15ad93cd
commit b5d060e147
3 changed files with 30 additions and 11 deletions

View File

@@ -50,10 +50,10 @@
</dependency> </dependency>
<!-- 定时任务--> <!-- 定时任务-->
<!--<dependency> <dependency>
<groupId>com.jsowell</groupId> <groupId>com.jsowell</groupId>
<artifactId>jsowell-quartz</artifactId> <artifactId>jsowell-quartz</artifactId>
</dependency>--> </dependency>
<!-- 代码生成--> <!-- 代码生成-->
<dependency> <dependency>

View File

@@ -44,7 +44,7 @@
<dependency> <dependency>
<groupId>com.jsowell</groupId> <groupId>com.jsowell</groupId>
<artifactId>jsowell-admin</artifactId> <artifactId>jsowell-netty</artifactId>
<version>1.0.0</version> <version>1.0.0</version>
</dependency> </dependency>

View File

@@ -1,18 +1,21 @@
package com.jsowell.quartz.task; package com.jsowell.quartz.task;
import com.jsowell.common.util.DateUtils; 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.domain.OrderBasicInfo;
import com.jsowell.pile.service.IOrderBasicInfoService; import com.jsowell.pile.service.IOrderBasicInfoService;
import com.jsowell.pile.service.IPileBillingTemplateService; import com.jsowell.pile.service.IPileBillingTemplateService;
import com.jsowell.pile.vo.web.BillingTemplateVO; 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.apache.commons.collections4.CollectionUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@@ -25,14 +28,11 @@ public class JsowellTask {
@Autowired @Autowired
private IOrderBasicInfoService orderBasicInfoService; private IOrderBasicInfoService orderBasicInfoService;
@Autowired
private OrderService orderService;
@Autowired @Autowired
private IPileBillingTemplateService pileBillingTemplateService; private IPileBillingTemplateService pileBillingTemplateService;
@Autowired @Autowired
private PileRemoteService pileRemoteService; private YKCPushCommandService ykcPushCommandService;
/** /**
* 关闭15分钟未支付的订单 * 关闭15分钟未支付的订单
@@ -69,10 +69,29 @@ public class JsowellTask {
// 发送启动充电指令前,再次下发计费模板 // 发送启动充电指令前,再次下发计费模板
BillingTemplateVO billingTemplateVO = pileBillingTemplateService.selectBillingTemplateDetailByPileSn(pileSn); BillingTemplateVO billingTemplateVO = pileBillingTemplateService.selectBillingTemplateDetailByPileSn(pileSn);
if (billingTemplateVO != null) { 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);
} }
} }
} }