Commit fb0a5656 authored by hezhen's avatar hezhen

Merge branch 'master-tiande' into dev-tiande

parents 0d4c3a9f 208e4939
...@@ -6,14 +6,16 @@ import cn.hutool.core.util.StrUtil; ...@@ -6,14 +6,16 @@ import cn.hutool.core.util.StrUtil;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.Random; import java.util.Random;
import java.util.concurrent.atomic.AtomicInteger;
public class OrderUtil { public class OrderUtil {
public static final String DEFAULT_MID = "00"; public static final String DEFAULT_MID = "00";
public static final String APP_MID = "01"; public static final String APP_MID = "01";
public static final String COMPANY_MID = "05";
static Date today = new Date(); static Date today = new Date();
static int orderIndex = 0; static AtomicInteger orderIndex = new AtomicInteger(0);
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
private static String getIndex(String midFix) { private static String getIndex(String midFix) {
...@@ -24,19 +26,19 @@ public class OrderUtil { ...@@ -24,19 +26,19 @@ public class OrderUtil {
SimpleDateFormat outFormat = new SimpleDateFormat("yyyyMMddHHmmss"); SimpleDateFormat outFormat = new SimpleDateFormat("yyyyMMddHHmmss");
String currTime = outFormat.format(n); String currTime = outFormat.format(n);
if (orderIndex > 0) { if (orderIndex.intValue() > 0) {
if (n.getYear() == today.getYear() && n.getMonth() == today.getMonth() && n.getDay() == today.getDay()) { if (n.getYear() == today.getYear() && n.getMonth() == today.getMonth() && n.getDay() == today.getDay()) {
orderIndex += 1; orderIndex.getAndIncrement();
} else { } else {
today = n; today = n;
orderIndex = 1; orderIndex = new AtomicInteger(1);
} }
} else { } else {
today = n; today = n;
orderIndex = 1; orderIndex = new AtomicInteger(1);
} }
if (orderIndex > 9999) { if (orderIndex.intValue() > 9999) {
orderIndex = 1; orderIndex = new AtomicInteger(1);
} }
String indexString = String.format("%s%s%04d", currTime, midFix, orderIndex); String indexString = String.format("%s%s%04d", currTime, midFix, orderIndex);
return indexString; return indexString;
...@@ -44,7 +46,7 @@ public class OrderUtil { ...@@ -44,7 +46,7 @@ public class OrderUtil {
/** /**
* 生成订单号 * 生成订单号
* *
* @param preFixString * @param preFixString
* @return * @return
*/ */
...@@ -66,7 +68,7 @@ public class OrderUtil { ...@@ -66,7 +68,7 @@ public class OrderUtil {
/** /**
* 获取时间戳 * 获取时间戳
* *
* @return * @return
*/ */
public static String GetTimestamp() { public static String GetTimestamp() {
...@@ -75,7 +77,7 @@ public class OrderUtil { ...@@ -75,7 +77,7 @@ public class OrderUtil {
/** /**
* 生成随机数 * 生成随机数
* *
* @return * @return
*/ */
public static String CreateNoncestr() { public static String CreateNoncestr() {
...@@ -83,3 +85,4 @@ public class OrderUtil { ...@@ -83,3 +85,4 @@ public class OrderUtil {
return MD5.GetMD5String(String.valueOf(random.nextInt(10000))); return MD5.GetMD5String(String.valueOf(random.nextInt(10000)));
} }
} }
...@@ -34,7 +34,6 @@ public class MemberLevelController extends BaseController<UserMemberLevelBiz, Ba ...@@ -34,7 +34,6 @@ public class MemberLevelController extends BaseController<UserMemberLevelBiz, Ba
@RequestMapping(value = "/app/unauth/level/list", method = RequestMethod.GET) @RequestMapping(value = "/app/unauth/level/list", method = RequestMethod.GET)
public ObjectRestResponse<List<BaseUserMemberLevel>>list(BaseUserMemberLevel baseUserMemberLevel) throws Exception { public ObjectRestResponse<List<BaseUserMemberLevel>>list(BaseUserMemberLevel baseUserMemberLevel) throws Exception {
baseUserMemberLevel.setIsShow(1);
return ObjectRestResponse.succ(memberBiz.getList(baseUserMemberLevel)); return ObjectRestResponse.succ(memberBiz.getList(baseUserMemberLevel));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment