Commit e98d562a by liuyf

使用hutool雪花算法

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@32481 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent 0d4f439a
package com.glsx.ordercenter.service.impl; package com.glsx.ordercenter.service.impl;
import cn.hutool.core.lang.Snowflake;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
...@@ -31,7 +32,6 @@ import com.glsx.ordercenter.strategy.OrderSyncStrategy; ...@@ -31,7 +32,6 @@ import com.glsx.ordercenter.strategy.OrderSyncStrategy;
import com.glsx.ordercenter.thread.OrderStatusNotifyTask; import com.glsx.ordercenter.thread.OrderStatusNotifyTask;
import com.glsx.ordercenter.utils.OrderUtil; import com.glsx.ordercenter.utils.OrderUtil;
import com.glsx.ordercenter.utils.SpringContextUtils; import com.glsx.ordercenter.utils.SpringContextUtils;
import com.glsx.plat.common.utils.SnowFlake;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -2203,7 +2203,7 @@ public class OrderServiceImpl implements IOrderService { ...@@ -2203,7 +2203,7 @@ public class OrderServiceImpl implements IOrderService {
public String getOrderSn(int orderType) { public String getOrderSn(int orderType) {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
buffer.append(OrderTypeEnum.getOrderNoPrefix(orderType)); buffer.append(OrderTypeEnum.getOrderNoPrefix(orderType));
String snowId = String.valueOf(SnowFlake.nextId()); String snowId = String.valueOf(new Snowflake().nextId());
int len = snowId.length(); int len = snowId.length();
if (len == 16) { //长度16直接返回 if (len == 16) { //长度16直接返回
return buffer.append(snowId).toString(); return buffer.append(snowId).toString();
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!