update 并充启动充电给两把枪都下发启动充电指令

This commit is contained in:
Lemon
2025-08-06 15:09:03 +08:00
parent 62bf644be4
commit 68c65d42c3
2 changed files with 35 additions and 16 deletions

View File

@@ -12,13 +12,16 @@ import com.jsowell.common.enums.ykc.ReturnCodeEnum;
import com.jsowell.common.exception.BusinessException; import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.util.BytesUtil; import com.jsowell.common.util.BytesUtil;
import com.jsowell.common.util.StringUtils; import com.jsowell.common.util.StringUtils;
import com.jsowell.common.util.YKCUtils;
import com.jsowell.pile.domain.PileBillingTemplate; import com.jsowell.pile.domain.PileBillingTemplate;
import com.jsowell.pile.domain.PileConnectorInfo;
import com.jsowell.pile.domain.PileFirmwareInfo; import com.jsowell.pile.domain.PileFirmwareInfo;
import com.jsowell.pile.domain.ebike.deviceupload.ChargingOperationResponse; import com.jsowell.pile.domain.ebike.deviceupload.ChargingOperationResponse;
import com.jsowell.pile.domain.ykcCommond.*; import com.jsowell.pile.domain.ykcCommond.*;
import com.jsowell.pile.dto.PublishBillingTemplateDTO; import com.jsowell.pile.dto.PublishBillingTemplateDTO;
import com.jsowell.pile.dto.RemoteAccountBalanceUpdateDTO; import com.jsowell.pile.dto.RemoteAccountBalanceUpdateDTO;
import com.jsowell.pile.dto.UpdateFirmwareDTO; import com.jsowell.pile.dto.UpdateFirmwareDTO;
import com.jsowell.pile.vo.base.ConnectorInfoVO;
import com.jsowell.pile.vo.web.BillingTemplateVO; import com.jsowell.pile.vo.web.BillingTemplateVO;
import com.jsowell.pile.vo.web.PileDetailVO; import com.jsowell.pile.vo.web.PileDetailVO;
import com.jsowell.wxpay.service.WxAppletRemoteService; import com.jsowell.wxpay.service.WxAppletRemoteService;
@@ -65,6 +68,9 @@ public class PileRemoteService {
@Autowired @Autowired
private OrderBasicInfoService orderBasicInfoService; private OrderBasicInfoService orderBasicInfoService;
@Autowired
private PileConnectorInfoService pileConnectorInfoService;
@Value("${remoteUpdate.server}") @Value("${remoteUpdate.server}")
private String serverAddress; private String serverAddress;
@@ -132,18 +138,30 @@ public class PileRemoteService {
/** /**
* 远程启动并充充电 0xA4 * 远程启动并充充电 0xA4
* @param pileSn * @param pileSn
* @param connectorCode
* @param transactionCode * @param transactionCode
* @param chargeAmount * @param chargeAmount
*/ */
public void remoteStartMergeCharging(String pileSn, String connectorCode, String transactionCode, public void remoteStartMergeCharging(String pileSn, String transactionCode,
BigDecimal chargeAmount, String mergeChargeCode) { BigDecimal chargeAmount, String mergeChargeCode) {
if (StringUtils.isEmpty(pileSn) || StringUtils.isEmpty(connectorCode)) { if (StringUtils.isEmpty(pileSn)) {
log.warn("远程启动充电, 充电桩编号和枪口号不能为空"); log.warn("远程启动并充充电, 充电桩编号不能为空");
return; return;
} }
log.info("【=====平台下发指令=====】: 远程启动并充充电, 桩号:{}, 枪口号:{}", pileSn, connectorCode); List<PileConnectorInfo> pileConnectorInfos = pileConnectorInfoService.selectPileConnectorInfoList(pileSn);
log.info("【=====平台下发指令=====】: 远程启动并充充电, 桩号:{}", pileSn);
if (CollectionUtils.isEmpty(pileConnectorInfos)) {
log.info("远程启动并充充电, 枪口列表为空");
return;
}
// 筛选出枪口号
List<String> connectorCodeList = pileConnectorInfos.stream()
.map(PileConnectorInfo::getPileConnectorCode)
.collect(Collectors.toList());
for (String pileConnectorCode : connectorCodeList) {
// 获取枪口号
String connectorCode = YKCUtils.getConnectorCode(pileConnectorCode);
// 两把枪都要下发启动充电指令
StartMergeChargeCommand command = StartMergeChargeCommand.builder() StartMergeChargeCommand command = StartMergeChargeCommand.builder()
.pileSn(pileSn) .pileSn(pileSn)
.connectorCode(connectorCode) .connectorCode(connectorCode)
@@ -156,6 +174,7 @@ public class PileRemoteService {
.build(); .build();
ykcPushCommandService.pushStartMergeChargingCommand(command); ykcPushCommandService.pushStartMergeChargingCommand(command);
} }
}
/** /**
* 电单车远程启动充电 * 电单车远程启动充电

View File

@@ -4283,7 +4283,7 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
String orderType = orderInfo.getOrderType(); String orderType = orderInfo.getOrderType();
if (StringUtils.equals(OrderTypeEnum.MERGE_CHARGE_ORDER.getValue(), orderType)) { if (StringUtils.equals(OrderTypeEnum.MERGE_CHARGE_ORDER.getValue(), orderType)) {
// 并充订单,调用并充启动充电 // 并充订单,调用并充启动充电
pileRemoteService.remoteStartMergeCharging(pileSn, orderInfo.getConnectorCode(), orderInfo.getTransactionCode(), chargeAmount, orderInfo.getMergeChargeNumber()); pileRemoteService.remoteStartMergeCharging(pileSn, orderInfo.getTransactionCode(), chargeAmount, orderInfo.getMergeChargeNumber());
}else { }else {
// 普通订单启动充电 // 普通订单启动充电
pileRemoteService.remoteStartCharging(pileSn, orderInfo.getConnectorCode(), orderInfo.getTransactionCode(), chargeAmount); pileRemoteService.remoteStartCharging(pileSn, orderInfo.getConnectorCode(), orderInfo.getTransactionCode(), chargeAmount);