update 电单车协议

This commit is contained in:
Guoqs
2024-09-03 11:41:33 +08:00
parent 18de552bbc
commit f729431d7d
5 changed files with 63 additions and 5 deletions

View File

@@ -6,5 +6,5 @@ package com.jsowell.pile.service;
public interface EBikeSendCommandService {
// void send(String pileSn, AbsEBikeMessage msg);
void startCharging(String pileSn);
void startCharging(String pileSn, String connectorCode);
}

View File

@@ -3,6 +3,7 @@ package com.jsowell.pile.service.impl;
import com.jsowell.common.enums.ykc.PileChannelEntity;
import com.jsowell.common.util.BytesUtil;
import com.jsowell.common.util.RandomUtil;
import com.jsowell.common.util.id.IdUtils;
import com.jsowell.pile.domain.ebike.AbsEBikeMessage;
import com.jsowell.pile.domain.ebike.serversend.EBikeMessageCmd82;
import com.jsowell.pile.service.EBikeSendCommandService;
@@ -15,20 +16,31 @@ import java.util.Objects;
@Slf4j
@Service
public class EBikeSendCommandServiceImpl implements EBikeSendCommandService {
@Override
public void startCharging(String pileSn) {
public void startCharging(String pileSn, String connectorCode) {
EBikeMessageCmd82 message = new EBikeMessageCmd82();
message.setHeader("DNY");
message.setPhysicalId(Integer.parseInt(pileSn));
message.setMessageId(RandomUtil.getRandomNumber(4));
message.setCommand("82");
EBikeMessageCmd82.SpecificData data = new EBikeMessageCmd82.SpecificData();
// 充电模式
data.setRateMode("3");
// 余额或有效期
data.setBalanceOrValidity("0");
// 端口号
data.setPortNumber("0");
// 充电命令
data.setChargeCommand("1");
// 充电时长/功率
data.setChargeDurationOrPower("0");
data.setOrderNumber("0");
// 订单编号
String orderNumber = IdUtils.generateTransactionCode(pileSn, connectorCode);
data.setOrderNumber(orderNumber);
data.setMaxChargeDuration("0");
data.setOverloadPower("0");
data.setQrCodeLight("0");

View File

@@ -193,7 +193,7 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
CoordinateUtil.Coordinate coordinate = CoordinateUtil.gcj02ToWgs84(Double.parseDouble(pileStationInfo.getStationLng()), Double.parseDouble(pileStationInfo.getStationLat()));
vo.setStationLat(String.format("%.6f", coordinate.getLat()));
vo.setStationLng(String.format("%.6f", coordinate.getLng()));
log.info("高德坐标:{}, 转天地图坐标:{}", pileStationInfo.getStationLng() + ", " + pileStationInfo.getStationLat(), vo.getStationLng() + ", " + vo.getStationLat());
log.debug("高德坐标:{}, 转天地图坐标:{}", pileStationInfo.getStationLng() + ", " + pileStationInfo.getStationLat(), vo.getStationLng() + ", " + vo.getStationLat());
}
vo.setCountryCode(pileStationInfo.getCountryCode());