From 4e7907983a99e695f2acba4dec8bd73b7dbe6b2b Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期四, 29 六月 2023 14:41:33 +0800
Subject: [PATCH] optimize

---
 java110-core/src/main/java/com/java110/core/factory/GenerateCodeFactory.java |   22 +++++++++++++++++++---
 1 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/java110-core/src/main/java/com/java110/core/factory/GenerateCodeFactory.java b/java110-core/src/main/java/com/java110/core/factory/GenerateCodeFactory.java
index 5b379d5..bdfac71 100644
--- a/java110-core/src/main/java/com/java110/core/factory/GenerateCodeFactory.java
+++ b/java110-core/src/main/java/com/java110/core/factory/GenerateCodeFactory.java
@@ -1,7 +1,7 @@
 package com.java110.core.factory;
 
 import com.alibaba.fastjson.JSONObject;
-import com.java110.dto.idSeq.IdSeqDto;
+import com.java110.dto.system.IdSeqDto;
 import com.java110.intf.code.ICodeApi;
 import com.java110.intf.order.IIdSeqInnerServiceSMO;
 import com.java110.utils.cache.MappingCache;
@@ -346,8 +346,24 @@
      * @throws GenerateCodeException
      */
     public static String getGeneratorId(String prefix) throws GenerateCodeException {
+        return getGeneratorId(prefix,false);
+    }
+
+    /**
+     * pgId鐢熸垚
+     *
+     * @return
+     * @throws GenerateCodeException
+     */
+    public static String getGeneratorId(String prefix,boolean longId) throws GenerateCodeException {
         if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
-            return prefix + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
+            //2+14+4+6
+            //7920230518235714886
+            if(longId) {
+                return prefix + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_DEFAULT) + nextId("%06d");
+            }else {
+                return prefix + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
+            }
         }
         //璋冪敤鏈嶅姟
         return getCode(prefix);
@@ -360,7 +376,7 @@
      */
     public static String getDetailId(String prefix) throws GenerateCodeException {
         if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
-            return prefix + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_O) + nextId("%04d",false);
+            return prefix + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_O) + nextId("%06d",false);
         }
         //璋冪敤鏈嶅姟
         return getCode(prefix);

--
Gitblit v1.8.0