mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +08:00
update 电单车
This commit is contained in:
@@ -13,6 +13,22 @@ import java.util.Arrays;
|
||||
@Slf4j
|
||||
public class YouDianUtils {
|
||||
|
||||
public static boolean isEBikePileSn(String pileSn) {
|
||||
// 判断是否为电单车桩号, 电单车pileSn长度为8, 前6位是十六进制, 尾部是07
|
||||
if (pileSn.length() == 8 && pileSn.endsWith("07")) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String pileSN = "15540507";
|
||||
if (isEBikePileSn(pileSN)) {
|
||||
pileSN = resolvePhysicalId(pileSN);
|
||||
}
|
||||
System.out.println(pileSN);
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析物理id
|
||||
* 电单车二维码地址:https://api.jsowellcloud.com/app-xcx-h5/pile/pileDetail/1921ed07/ff
|
||||
@@ -23,7 +39,12 @@ public class YouDianUtils {
|
||||
public static String resolvePhysicalId(String pileSN) {
|
||||
byte[] bytes = BytesUtil.str2Bcd(pileSN);
|
||||
int i = convertToPhysicalId(bytes);
|
||||
return i + "";
|
||||
String resolvedPhysicalID = String.valueOf(i);
|
||||
if (resolvedPhysicalID.length() < 8) {
|
||||
// 转换完成后长度小于8, 返回原字符串
|
||||
return pileSN;
|
||||
}
|
||||
return resolvedPhysicalID;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user