From 5bb3ad3944ff229baff1d8bb92caf55d816ee68b Mon Sep 17 00:00:00 2001
From: jiazx0107@163.com <jiazx0107@163.com>
Date: 星期六, 02 十二月 2023 18:34:45 +0800
Subject: [PATCH] 提交粮情协议1

---
 src/main/java/com/fzzy/api/utils/ContextUtil.java |   48 +++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 45 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/fzzy/api/utils/ContextUtil.java b/src/main/java/com/fzzy/api/utils/ContextUtil.java
index cc8cafe..287452f 100644
--- a/src/main/java/com/fzzy/api/utils/ContextUtil.java
+++ b/src/main/java/com/fzzy/api/utils/ContextUtil.java
@@ -4,14 +4,18 @@
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.time.DateUtils;
 
-import java.util.Calendar;
-import java.util.Date;
-import java.util.UUID;
+import java.util.*;
 
 /**
  *
  */
 public class ContextUtil {
+
+
+    /**
+     * 鍏ㄥ眬鍛戒护ID
+     */
+    public static Map<String, Integer> contextOrderId = new HashMap<>();
 
 
     public static String getUUID() {
@@ -147,4 +151,42 @@
     public static String getServerKey(String ip, Integer port) {
         return ip + ":" + port;
     }
+
+
+    /**
+     * 鏍规嵁鍙傛暟鐢熸垚 鎵ц鍛戒护鐨勭紦瀛楰EY
+     *
+     * @param companyId
+     * @param serId
+     * @param bizType
+     * @return
+     */
+    public static final String buildExeOrderId(String companyId, String serId, String bizType) {
+        Integer start = contextOrderId.get("ORDER_ID") == null ? 5000 : contextOrderId.get("ORDER_ID");
+
+        contextOrderId.put("ORDER_ID", start + 1);
+
+        return start + "";
+    }
+
+    /**
+     * 璁惧ID鐢熸垚瑙勫垯
+     *
+     * @param companyId
+     * @param depotId
+     * @param passCode
+     * @return
+     */
+    public static final String buildDeviceId(String companyId, String depotId, int passCode) {
+        return companyId + "_" + depotId + "_" + passCode;
+    }
+
+    public static String buildDeviceStatusKey(String companyId, String serId, String passCode) {
+        if (null == passCode) passCode = "NULL";
+        return companyId + "_" + serId + "_STATUS_" + passCode;
+    }
+
+    public static String buildDeviceStatusKey(String companyId, String serId, int passCode) {
+        return companyId + "_" + serId + "_STATUS_" + passCode;
+    }
 }

--
Gitblit v1.9.3