update 电单车

This commit is contained in:
Guoqs
2024-09-12 15:47:08 +08:00
parent 64698a943f
commit 5094db6096
2 changed files with 9 additions and 14 deletions

View File

@@ -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<String> 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);
}
/**