From 34981c30a78e8bbd7791131059a9210f9928b62c Mon Sep 17 00:00:00 2001
From: 刘光辉 <347230014@qq.com>
Date: 星期四, 17 九月 2026 09:24:09 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master' into master

---
 jnpf-lims/jnpf-lims-biz/src/main/java/jnpf/limsService/LimsFlowTemplateResolver.java |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/jnpf-lims/jnpf-lims-biz/src/main/java/jnpf/limsService/LimsFlowTemplateResolver.java b/jnpf-lims/jnpf-lims-biz/src/main/java/jnpf/limsService/LimsFlowTemplateResolver.java
new file mode 100644
index 0000000..73ac7d6
--- /dev/null
+++ b/jnpf-lims/jnpf-lims-biz/src/main/java/jnpf/limsService/LimsFlowTemplateResolver.java
@@ -0,0 +1,33 @@
+package jnpf.limsService;
+
+import jnpf.limsMapper.WorkflowTemplateMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * enCode 鈫� 娴佺▼妯℃澘 templateId 瑙f瀽锛堝甫杩涚▼鍐呯紦瀛橈級銆�
+ * templateId 鏄幆澧冪浉鍏抽洩鑺� id銆佷細闅忛噸瀵兼ā鏉垮彉鍖栵紱enCode 绋冲畾锛屾晠浠g爜鍐� enCode銆佽繍琛屾椂鍙嶈В id銆�
+ * 娉細缂撳瓨涓鸿繘绋嬪唴銆佹棤澶辨晥鈥斺�旇嫢杩愯鏈熼噸瀵�/閲嶅缓娴佺▼妯℃澘瀵艰嚧 id 鍙樺寲锛岄渶閲嶅惎鏈嶅姟鍒锋柊锛堝睘浣庨杩愮淮鎿嶄綔锛屽彲鎺ュ彈锛夈��
+ */
+@Service
+public class LimsFlowTemplateResolver {
+
+    @Autowired
+    private WorkflowTemplateMapper workflowTemplateMapper;
+
+    private final ConcurrentHashMap<String, String> cache = new ConcurrentHashMap<>();
+
+    /** 瑙f瀽 templateId锛沞nCode 涓虹┖鎴栨煡涓嶅埌杩斿洖 null锛坣ull 涓嶈繘缂撳瓨锛屼究浜庢ā鏉夸笂鏋跺悗閲嶈瘯鍛戒腑锛夈�� */
+    public String resolveTemplateId(String enCode) {
+        if (enCode == null || enCode.isEmpty()) {
+            return null;
+        }
+        // computeIfAbsent 鏄犲皠鍑芥暟杩斿洖 null 鏃朵笉鍐欏叆 map锛屽ぉ鐒跺疄鐜�"null 涓嶇紦瀛�"锛屼笖 get-鏌�-put 鍘熷瓙鍖�
+        return cache.computeIfAbsent(enCode, k -> {
+            String id = workflowTemplateMapper.findTemplateIdByEnCode(k);
+            return (id != null && !id.isEmpty()) ? id : null;
+        });
+    }
+}

--
Gitblit v1.8.0