mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-13 03:39:55 +08:00
update 电单车
This commit is contained in:
@@ -133,4 +133,18 @@ public class YouDianUtils {
|
|||||||
// 转换为字节数组
|
// 转换为字节数组
|
||||||
return BytesUtil.intToBytesLittle(hexValue, 1);
|
return BytesUtil.intToBytesLittle(hexValue, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 端口号从0开始
|
||||||
|
* @param portNumber
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String convertPortNumberToString(int portNumber) {
|
||||||
|
if (portNumber < 0 || portNumber > 15) {
|
||||||
|
throw new IllegalArgumentException("Port number must be between 0 and 15.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 转换为字节数组
|
||||||
|
return String.format("%02d", portNumber + 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.jsowell.pile.domain.ebike.deviceupload;
|
package com.jsowell.pile.domain.ebike.deviceupload;
|
||||||
|
|
||||||
|
import com.jsowell.common.YouDianUtils;
|
||||||
import com.jsowell.common.util.BytesUtil;
|
import com.jsowell.common.util.BytesUtil;
|
||||||
import com.jsowell.pile.domain.ebike.AbsEBikeMessage;
|
import com.jsowell.pile.domain.ebike.AbsEBikeMessage;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
@@ -42,7 +43,7 @@ public class EBikeMessageCmd06 extends AbsEBikeMessage {
|
|||||||
@Setter
|
@Setter
|
||||||
public static class PowerHeartbeat {
|
public static class PowerHeartbeat {
|
||||||
/**
|
/**
|
||||||
* 端口号:当前充电的端口号。注:00表示1号端口,01表示2号端口
|
* 端口号:当前充电的端口号。注:00表示1号端口,01表示2号端口; port+1为实际端口
|
||||||
*/
|
*/
|
||||||
private String port;
|
private String port;
|
||||||
|
|
||||||
@@ -135,7 +136,8 @@ public class EBikeMessageCmd06 extends AbsEBikeMessage {
|
|||||||
public PowerHeartbeat(byte[] dataBytes) {
|
public PowerHeartbeat(byte[] dataBytes) {
|
||||||
int startIndex = 0;
|
int startIndex = 0;
|
||||||
int length = 1;
|
int length = 1;
|
||||||
this.port = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, startIndex, startIndex = startIndex + length)) + "";
|
int i = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, startIndex, startIndex = startIndex + length));
|
||||||
|
this.port = i + YouDianUtils.convertPortNumberToString(i);
|
||||||
|
|
||||||
length = 1;
|
length = 1;
|
||||||
this.portStatus = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, startIndex, startIndex = startIndex + length)) + "";
|
this.portStatus = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, startIndex, startIndex = startIndex + length)) + "";
|
||||||
|
|||||||
@@ -1954,12 +1954,13 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
|||||||
String redisKey = CacheConstants.PILE_REAL_TIME_MONITOR_DATA + pileConnectorCode + "_" + transactionCode;
|
String redisKey = CacheConstants.PILE_REAL_TIME_MONITOR_DATA + pileConnectorCode + "_" + transactionCode;
|
||||||
// 拿到所有数据
|
// 拿到所有数据
|
||||||
Map<Object, Object> map = redisCache.hmget(redisKey);
|
Map<Object, Object> map = redisCache.hmget(redisKey);
|
||||||
|
logger.info("查redis中的实时数据, pileConnectorCode:{}, transactionCode:{}, map:{}", pileConnectorCode, transactionCode, map);
|
||||||
if (map == null) {
|
if (map == null || map.isEmpty()) {
|
||||||
// 按照电单车重新查
|
// 按照电单车重新查
|
||||||
pileConnectorCode = transactionCode.substring(0, 10); // 电单车车桩
|
pileConnectorCode = transactionCode.substring(0, 10); // 电单车车桩
|
||||||
redisKey = CacheConstants.PILE_REAL_TIME_MONITOR_DATA + pileConnectorCode + "_" + transactionCode;
|
redisKey = CacheConstants.PILE_REAL_TIME_MONITOR_DATA + pileConnectorCode + "_" + transactionCode;
|
||||||
map = redisCache.hmget(redisKey);
|
map = redisCache.hmget(redisKey);
|
||||||
|
logger.info("按照电单车重新查, pileConnectorCode:{}, transactionCode:{}, map:{}", pileConnectorCode, transactionCode, map);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (map != null && !map.isEmpty()) {
|
if (map != null && !map.isEmpty()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user