copy from dyh-service/dyh-utils/src/main/java/cn/huge/module/common/utils/JudicIdUtils.java
copy to dyh-service/dyh-utils/src/main/java/cn/huge/module/mediate/utils/MediateIdUtils.java
File was copied from dyh-service/dyh-utils/src/main/java/cn/huge/module/common/utils/JudicIdUtils.java |
| | |
| | | package cn.huge.module.common.utils; |
| | | package cn.huge.module.mediate.utils; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @title: 司法确认ID生成工具 |
| | | * @description: 司法确认ID生成工具 |
| | | * @title: 公共ID生成工具 |
| | | * @description: 公共ID生成工具 |
| | | * @company: hugeinfo |
| | | * @author: liyj |
| | | * @time: 2021-11-05 16:51:48 |
| | | * @version: 1.0.0 |
| | | */ |
| | | public class JudicIdUtils { |
| | | public class MediateIdUtils { |
| | | |
| | | /** |
| | | * 时间Id统计常量 |
| | | */ |
| | | private static int COUNT_NUM = 1000; |
| | | private static int COUNT_NUM = 10000; |
| | | |
| | | /** |
| | | * 时间Id统计常量,常量前缀 |
| | | */ |
| | | private static int SIGN_COUNT_NUM = 1000; |
| | | private static int SIGN_COUNT_NUM = 10000; |
| | | |
| | | /** |
| | | * 时间Id统计常量,常量后缀 |
| | | */ |
| | | private static int COUNT_NUM_SIGN = 1000; |
| | | private static int COUNT_NUM_SIGN = 10000; |
| | | |
| | | /** |
| | | * 获取时间Id,后四位常量 |
| | |
| | | */ |
| | | public synchronized static String getNewTimeId(){ |
| | | String timeId = getNowTime() + (COUNT_NUM++); |
| | | if(COUNT_NUM > 9999){ |
| | | COUNT_NUM = 1000; |
| | | if(COUNT_NUM > 99999){ |
| | | COUNT_NUM = 10000; |
| | | } |
| | | timeId=timeId.substring(2, timeId.length()); |
| | | return timeId; |
| | |
| | | */ |
| | | public synchronized static String getSignNewTimeId(String sign){ |
| | | String timeId = getNowTime() + sign + (SIGN_COUNT_NUM++); |
| | | if(SIGN_COUNT_NUM > 9999){ |
| | | SIGN_COUNT_NUM = 1000; |
| | | if(SIGN_COUNT_NUM > 99999){ |
| | | SIGN_COUNT_NUM = 10000; |
| | | } |
| | | timeId=timeId.substring(2, timeId.length()); |
| | | return timeId; |
| | |
| | | */ |
| | | public synchronized static String getNewTimeIdSign(String sign){ |
| | | String timeId = getNowTime() + (COUNT_NUM_SIGN++) + sign; |
| | | if(COUNT_NUM_SIGN > 9999){ |
| | | COUNT_NUM_SIGN = 1000; |
| | | if(COUNT_NUM_SIGN > 99999){ |
| | | COUNT_NUM_SIGN = 10000; |
| | | } |
| | | timeId=timeId.substring(2, timeId.length()); |
| | | return timeId; |