首页>代码>基于SpringBoot+Vue实现的二手交易系统>/源代码/后端代码/FleaMarketApi/src/main/java/com/rabbiter/fm/common/utils/IdFactoryUtil.java
package com.rabbiter.fm.common.utils; import java.util.concurrent.atomic.AtomicInteger; public class IdFactoryUtil { private static AtomicInteger orderIdEnd=new AtomicInteger(1); private static AtomicInteger fileIdEnd=new AtomicInteger(1); public static String getOrderId(){ int newI; int ord; do{ ord=orderIdEnd.get(); newI=(ord+1)%10000; } while (!orderIdEnd.compareAndSet(ord,newI)); return System.currentTimeMillis()+""+(newI+10000); } public static String getFileId(){ int newI; int ord; do{ ord=fileIdEnd.get(); newI=(ord+1)%1000; } while (!fileIdEnd.compareAndSet(ord,newI)); return System.currentTimeMillis()+""+(newI+1000); } }


dadassss LV5
2024年12月27日
taidan
2024年11月29日
暂无贡献等级
xianyu091012 LV5
2024年11月18日
微信网友_7177544545669120 LV1
2024年9月21日
hrbylw LV9
2024年9月21日
zvcbnlk LV2
2024年9月20日
Peny_ZH LV5
2024年9月20日
abdkfksdkf LV16
2024年9月18日
微信网友_7134912998903808 LV15
2024年9月11日
yyhrhv LV8
2024年9月10日