|
|
|
@ -7,6 +7,7 @@ import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.time.LocalDate; |
|
|
|
import java.util.Date; |
|
|
|
|
|
|
|
@Component |
|
|
|
public class SnowFlakeUtil { |
|
|
|
@ -26,7 +27,7 @@ public class SnowFlakeUtil { |
|
|
|
|
|
|
|
public String getSnowflakeOrderCode() { |
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd"); |
|
|
|
return "D" + dateFormat.format(LocalDate.now()) + getSnowflakeId(); |
|
|
|
return "D" + dateFormat.format(new Date()) + getSnowflakeId(); |
|
|
|
} |
|
|
|
|
|
|
|
public long snowflakeId(long workerId, long datacenterId) { |
|
|
|
|