diff --git a/jsowell-common/src/main/java/com/jsowell/common/util/id/IdUtils.java b/jsowell-common/src/main/java/com/jsowell/common/util/id/IdUtils.java index 3e6fe7f35..4aa428368 100644 --- a/jsowell-common/src/main/java/com/jsowell/common/util/id/IdUtils.java +++ b/jsowell-common/src/main/java/com/jsowell/common/util/id/IdUtils.java @@ -1,11 +1,8 @@ package com.jsowell.common.util.id; -import com.google.common.collect.Sets; import com.jsowell.common.util.DateUtils; import com.jsowell.common.util.RandomUtil; -import java.util.Set; - /** * ID生成器工具类 * @@ -78,9 +75,9 @@ public class IdUtils { } /** - * 生成交易流水号 + * 生成交易流水号共16字节 * 生成规则为 格式桩号(7bytes) +枪号(1byte) +年月日时分秒(6bytes) +自 增序号(2bytes); - * + * 电单车格式桩号(4bytes) +枪号(1byte) +年月日时分秒(6bytes) +自 增序号(5bytes) * @param pileConnectorCode 为已经拼好的充电桩枪口号 例如:3201060001923601 * @return 交易流水号 例如:32010600019236012001061803423060 88000000000001012211301501294274 */ @@ -89,7 +86,7 @@ public class IdUtils { // 随机生成一个四位整数 String randomNumber = null; if (pileConnectorCode.length() < 14) { - randomNumber = RandomUtil.getRandomNumberStr(8); + randomNumber = RandomUtil.getRandomNumberStr(10); } else { randomNumber = RandomUtil.getRandomNumberStr(4); } @@ -98,13 +95,10 @@ public class IdUtils { } public static void main(String[] args) { - Set set = Sets.newHashSet(); - for (int i = 0; i < 1000000; i++) { - String id = get16UUID("PC"); - set.add(id); - System.out.println(id); - } - System.out.println("set size = " + set.size()); + String pileSn = "13273881"; + String connectorCode = "09"; + String s = generateTransactionCode(pileSn, connectorCode); + System.out.println(s); } /** diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/domain/ebike/deviceupload/EBikeMessageCmd03.java b/jsowell-pile/src/main/java/com/jsowell/pile/domain/ebike/deviceupload/EBikeMessageCmd03.java index 3693c3a60..3f215d294 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/domain/ebike/deviceupload/EBikeMessageCmd03.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/domain/ebike/deviceupload/EBikeMessageCmd03.java @@ -54,7 +54,8 @@ public class EBikeMessageCmd03 extends AbsEBikeMessage { this.startMode = BytesUtil.bytesToIntLittle(new byte[]{dataBytes[7]}); this.cardNumberOrVerificationCode = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 8, 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.timestamp = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 31, 35)) + ""; // this.placeholderDuration = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 35, 37)) + "";