mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-11 10:49:52 +08:00
update 电单车
This commit is contained in:
@@ -1,11 +1,8 @@
|
|||||||
package com.jsowell.common.util.id;
|
package com.jsowell.common.util.id;
|
||||||
|
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
import com.jsowell.common.util.DateUtils;
|
import com.jsowell.common.util.DateUtils;
|
||||||
import com.jsowell.common.util.RandomUtil;
|
import com.jsowell.common.util.RandomUtil;
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ID生成器工具类
|
* ID生成器工具类
|
||||||
*
|
*
|
||||||
@@ -78,9 +75,9 @@ public class IdUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成交易流水号
|
* 生成交易流水号共16字节
|
||||||
* 生成规则为 格式桩号(7bytes) +枪号(1byte) +年月日时分秒(6bytes) +自 增序号(2bytes);
|
* 生成规则为 格式桩号(7bytes) +枪号(1byte) +年月日时分秒(6bytes) +自 增序号(2bytes);
|
||||||
*
|
* 电单车格式桩号(4bytes) +枪号(1byte) +年月日时分秒(6bytes) +自 增序号(5bytes)
|
||||||
* @param pileConnectorCode 为已经拼好的充电桩枪口号 例如:3201060001923601
|
* @param pileConnectorCode 为已经拼好的充电桩枪口号 例如:3201060001923601
|
||||||
* @return 交易流水号 例如:32010600019236012001061803423060 88000000000001012211301501294274
|
* @return 交易流水号 例如:32010600019236012001061803423060 88000000000001012211301501294274
|
||||||
*/
|
*/
|
||||||
@@ -89,7 +86,7 @@ public class IdUtils {
|
|||||||
// 随机生成一个四位整数
|
// 随机生成一个四位整数
|
||||||
String randomNumber = null;
|
String randomNumber = null;
|
||||||
if (pileConnectorCode.length() < 14) {
|
if (pileConnectorCode.length() < 14) {
|
||||||
randomNumber = RandomUtil.getRandomNumberStr(8);
|
randomNumber = RandomUtil.getRandomNumberStr(10);
|
||||||
} else {
|
} else {
|
||||||
randomNumber = RandomUtil.getRandomNumberStr(4);
|
randomNumber = RandomUtil.getRandomNumberStr(4);
|
||||||
}
|
}
|
||||||
@@ -98,13 +95,10 @@ public class IdUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
Set<String> set = Sets.newHashSet();
|
String pileSn = "13273881";
|
||||||
for (int i = 0; i < 1000000; i++) {
|
String connectorCode = "09";
|
||||||
String id = get16UUID("PC");
|
String s = generateTransactionCode(pileSn, connectorCode);
|
||||||
set.add(id);
|
System.out.println(s);
|
||||||
System.out.println(id);
|
|
||||||
}
|
|
||||||
System.out.println("set size = " + set.size());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -54,7 +54,8 @@ public class EBikeMessageCmd03 extends AbsEBikeMessage {
|
|||||||
this.startMode = BytesUtil.bytesToIntLittle(new byte[]{dataBytes[7]});
|
this.startMode = BytesUtil.bytesToIntLittle(new byte[]{dataBytes[7]});
|
||||||
this.cardNumberOrVerificationCode = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 8, 12));
|
this.cardNumberOrVerificationCode = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 8, 12));
|
||||||
this.stopReason = BytesUtil.bytesToIntLittle(new byte[]{dataBytes[12]});
|
this.stopReason = BytesUtil.bytesToIntLittle(new byte[]{dataBytes[12]});
|
||||||
this.orderNumber = BytesUtil.bcd2Str(Arrays.copyOfRange(dataBytes, 13, 29));
|
// this.orderNumber = BytesUtil.bcd2Str(Arrays.copyOfRange(dataBytes, 13, 29));
|
||||||
|
this.orderNumber = BytesUtil.bcd2Str(BytesUtil.copyBytes(dataBytes, 13, 16));
|
||||||
this.secondMaxPower = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 29, 31));
|
this.secondMaxPower = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 29, 31));
|
||||||
// this.timestamp = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 31, 35)) + "";
|
// this.timestamp = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 31, 35)) + "";
|
||||||
// this.placeholderDuration = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 35, 37)) + "";
|
// this.placeholderDuration = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 35, 37)) + "";
|
||||||
|
|||||||
Reference in New Issue
Block a user