mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 19:15:35 +08:00
update 电单车
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user