This commit is contained in:
dute7liang
2024-01-14 20:50:25 +08:00
parent 7f195c02be
commit b163213beb
6 changed files with 136 additions and 20 deletions

View File

@@ -8,10 +8,20 @@ public class OrderNoUtil {
public static final Snowflake snowflake = IdUtil.getSnowflake(1, 1);
public static final String VIP_ORDER_SUB = "V";
public static final String RECHARGE_ORDER_SUB = "R";
public static String createOrderNo(OrderTypeEnum sub){
return sub.getType() + snowflake.nextIdStr();
}
public static String createOrderNo(String sub){
return sub + snowflake.nextIdStr();
public static OrderTypeEnum getType(String orderNo){
if(orderNo == null){
return null;
}
OrderTypeEnum[] values = OrderTypeEnum.values();
for (OrderTypeEnum value : values) {
if(orderNo.startsWith(value.getType())){
return value;
}
}
return null;
}
}