From 8f6dc8fa66aa3ee7a4f942068fb26d4d07a06815 Mon Sep 17 00:00:00 2001 From: "1437892690@qq.com" <1437892690@qq.com> Date: Tue, 25 Feb 2025 15:10:34 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BF=AE=E5=A4=8D]=20=E5=B7=A5=E5=8D=95?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E9=A1=B5=E6=AD=A5=E9=AA=A4=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E4=B8=AD=E5=8A=A8=E4=BD=9C=E6=98=BE=E7=A4=BA=E7=BC=BA=E5=B0=91?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1364484495474688]工单详情页步骤列表中动作显示缺少触发点 http://192.168.0.96:8090/demo/rdm.html#/bug-detail/939050947543040/939050947543057/1364484495474688 --- .../notify/core/NotifyTriggerTypeFactory.java | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 src/main/java/neatlogic/framework/notify/core/NotifyTriggerTypeFactory.java diff --git a/src/main/java/neatlogic/framework/notify/core/NotifyTriggerTypeFactory.java b/src/main/java/neatlogic/framework/notify/core/NotifyTriggerTypeFactory.java new file mode 100644 index 000000000..0a455851f --- /dev/null +++ b/src/main/java/neatlogic/framework/notify/core/NotifyTriggerTypeFactory.java @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2025 深圳极向量科技有限公司 All Rights Reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package neatlogic.framework.notify.core; + +import org.apache.commons.lang3.StringUtils; +import org.reflections.Reflections; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import java.util.Set; + +public class NotifyTriggerTypeFactory { + /** + * 标记是否未初始化数据,只初始化一次 + **/ + private static volatile boolean isUninitialized = true; + + private static final Set set = new HashSet<>(); + + public static Set getNotifyTriggerTypeList() { + if (isUninitialized) { + synchronized (NotifyTriggerTypeFactory.class) { + if (isUninitialized) { + Reflections reflections = new Reflections("neatlogic"); + Set> classSet = reflections.getSubTypesOf(INotifyTriggerType.class); + for (Class c : classSet) { + try { + set.addAll(Arrays.asList(c.getEnumConstants())); + } catch (Exception ignored) { + + } + } + isUninitialized = false; + } + } + } + return set; + } + + public static String getText(String value) { + for (INotifyTriggerType triggerType : getNotifyTriggerTypeList()) { + if (Objects.equals(triggerType.getTrigger(), value)) { + return triggerType.getText(); + } + } + return StringUtils.EMPTY; + } +} -- Gitee