mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-07-03 13:38:02 +08:00
update 修复生成订单bug
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package com.jsowell.common.util.id;
|
package com.jsowell.common.util.id;
|
||||||
|
|
||||||
|
import com.jsowell.common.constant.Constants;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.RandomUtils;
|
import org.apache.commons.lang3.RandomUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -191,7 +192,12 @@ public class SnowflakeIdWorker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static Long getDataCenterId() {
|
private static Long getDataCenterId() {
|
||||||
int[] ints = StringUtils.toCodePoints(SystemUtils.getHostName());
|
String hostName = SystemUtils.getHostName();
|
||||||
|
if (StringUtils.isBlank(hostName)) {
|
||||||
|
hostName = Constants.DEFAULT;
|
||||||
|
}
|
||||||
|
int[] ints = StringUtils.toCodePoints(hostName);
|
||||||
|
log.info("HostName: {}", hostName);
|
||||||
int sums = 0;
|
int sums = 0;
|
||||||
for (int i : ints) {
|
for (int i : ints) {
|
||||||
sums += i;
|
sums += i;
|
||||||
|
|||||||
Reference in New Issue
Block a user