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

@@ -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);
}
}
}