update 电单车

This commit is contained in:
Guoqs
2024-09-30 15:49:55 +08:00
parent ff459818ce
commit a8d7e76d25
3 changed files with 34 additions and 5 deletions

View File

@@ -13,6 +13,26 @@ import java.util.Arrays;
@Slf4j
public class YouDianUtils {
public static void main(String[] args) {
String s = "1921ed07";
String s1 = resolvePhysicalId(s);
System.out.println(s1);
}
/**
* 解析物理id
* 电单车二维码地址:https://api.jsowellcloud.com/app-xcx-h5/pile/pileDetail/1921ed07/ff
* 1921ed07是前端解析出来的pileSn, 但不是实际的物理ID需要通过识别码和编号计算出物理ID, 解析后为15540505
* @param pileSN
* @return
*/
public static String resolvePhysicalId(String pileSN) {
byte[] bytes = BytesUtil.str2Bcd(pileSN);
int i = convertToPhysicalId(bytes);
return i + "";
}
/**
* 将byte数组转换为物理ID