diff --git a/src/main/java/neatlogic/framework/process/constvalue/IProcessTaskSource.java b/src/main/java/neatlogic/framework/process/constvalue/IProcessTaskSource.java index dbf4e9ab4c6d6cbd57e36ef330b2163a3386d721..0773c5fcf53f8754d973c434243016d134ede853 100644 --- a/src/main/java/neatlogic/framework/process/constvalue/IProcessTaskSource.java +++ b/src/main/java/neatlogic/framework/process/constvalue/IProcessTaskSource.java @@ -16,6 +16,10 @@ limitations under the License. package neatlogic.framework.process.constvalue; +import com.alibaba.fastjson.JSONObject; +import neatlogic.framework.process.dto.ProcessTaskStepVo; +import neatlogic.framework.process.dto.ProcessTaskVo; + /** * 工单上报来源或办理渠道 * @@ -27,4 +31,26 @@ public interface IProcessTaskSource { String getValue(); String getText(); + + default String getType(){ + return ProcessTaskSourceType.ITSM.getValue(); + } + + /** + * 保存工单会执行的操作 + * + * @param paramObj 上报暂存入参 + * @param processTaskVo 工单对象 + */ + default void saveDraft(JSONObject paramObj, ProcessTaskVo processTaskVo){ + } + + /** + * 保存工单会执行的操作 + * + * @param processTaskStepVo 工单步骤对象 + */ + default void complete (ProcessTaskStepVo processTaskStepVo){ + + } } diff --git a/src/main/java/neatlogic/framework/process/constvalue/ProcessTaskSourceFactory.java b/src/main/java/neatlogic/framework/process/constvalue/ProcessTaskSourceFactory.java index da44354f19a0ca7a73e3b02fbd62df3672daab68..8e7721d56beba1c23c86401779117becd6371aed 100644 --- a/src/main/java/neatlogic/framework/process/constvalue/ProcessTaskSourceFactory.java +++ b/src/main/java/neatlogic/framework/process/constvalue/ProcessTaskSourceFactory.java @@ -16,24 +16,35 @@ limitations under the License. package neatlogic.framework.process.constvalue; +import neatlogic.framework.applicationlistener.core.ModuleInitializedListenerBase; +import neatlogic.framework.bootstrap.NeatLogicWebApplicationContext; +import neatlogic.framework.common.RootComponent; import org.reflections.Reflections; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.HashMap; import java.util.Map; import java.util.Set; - -public class ProcessTaskSourceFactory { - +@RootComponent +public class ProcessTaskSourceFactory extends ModuleInitializedListenerBase { + Logger logger = LoggerFactory.getLogger(ProcessTaskSourceFactory.class); private static final Map sourcelValueTextMap = new HashMap<>(); + private static final Map sourcelMap = new HashMap<>(); + private static final Map handlerMap = new HashMap<>(); static { Reflections reflections = new Reflections("neatlogic"); Set> clazz = reflections.getSubTypesOf(IProcessTaskSource.class); for (Class c : clazz) { try { + if (!c.isEnum()) { + continue; + } Object[] objects = c.getEnumConstants(); for (Object o : objects) { sourcelValueTextMap.put(((IProcessTaskSource) o).getValue(), ((IProcessTaskSource) o).getText()); + sourcelMap.put(((IProcessTaskSource) o).getValue(),(IProcessTaskSource)o); } } catch (Exception e) { e.printStackTrace(); @@ -45,4 +56,34 @@ public class ProcessTaskSourceFactory { return sourcelValueTextMap.get(value); } + public static IProcessTaskSource getSource(String value) { + return sourcelMap.get(value); + } + + public static IProcessTaskSource getHandler(String handler) { + return handlerMap.get(handler); + } + + @Override + protected void onInitialized(NeatLogicWebApplicationContext context) { + Map myMap = context.getBeansOfType(IProcessTaskSource.class); + for (Map.Entry entry : myMap.entrySet()) { + try { + IProcessTaskSource handler = entry.getValue(); + if (handlerMap.containsKey(handler.getValue())) { + logger.error("IProcessTaskSource '" + handler.getClass().getSimpleName() + "(" + handler.getValue() + ")' repeat"); + System.exit(1); + } + handlerMap.put(handler.getValue(), handler); + } catch (Exception e) { + logger.error(e.getMessage(), e); + } + } + } + + @Override + protected void myInit() { + + } + } diff --git a/src/main/java/neatlogic/framework/process/constvalue/ProcessTaskSourceType.java b/src/main/java/neatlogic/framework/process/constvalue/ProcessTaskSourceType.java new file mode 100644 index 0000000000000000000000000000000000000000..68187767f60df3a12146525f466e240dca3cf2a8 --- /dev/null +++ b/src/main/java/neatlogic/framework/process/constvalue/ProcessTaskSourceType.java @@ -0,0 +1,23 @@ +package neatlogic.framework.process.constvalue; + +import neatlogic.framework.util.$; + +public enum ProcessTaskSourceType { + ITSM("itsm", "term.itsm.groupname"); + + private final String value; + private final String text; + + private ProcessTaskSourceType(String value, String text) { + this.value = value; + this.text = text; + } + + public String getValue() { + return value; + } + + public String getText() { + return $.t(text); + } +} diff --git a/src/main/java/neatlogic/framework/process/constvalue/ProcessTaskStepTaskSource.java b/src/main/java/neatlogic/framework/process/constvalue/ProcessTaskStepTaskSource.java new file mode 100644 index 0000000000000000000000000000000000000000..1911a4e220693ed8695c929f1845722ab3f5046d --- /dev/null +++ b/src/main/java/neatlogic/framework/process/constvalue/ProcessTaskStepTaskSource.java @@ -0,0 +1,23 @@ +package neatlogic.framework.process.constvalue; + +public enum ProcessTaskStepTaskSource implements IProcessTaskSource { + PROCESSTASKSTEP("工单步骤", "processtaskstep"); + private final String text; + private final String value; + + + ProcessTaskStepTaskSource(String _text, String _value) { + this.text = _text; + this.value = _value; + } + + @Override + public String getValue() { + return value; + } + + @Override + public String getText() { + return text; + } +} diff --git a/src/main/java/neatlogic/framework/process/dao/mapper/ChannelMapper.java b/src/main/java/neatlogic/framework/process/dao/mapper/ChannelMapper.java index f0a5a32b8d5cdcf8e96c48e79b01b11515daaf7c..3492a1d7b4577eef2a71d39de3a3085352a7c413 100644 --- a/src/main/java/neatlogic/framework/process/dao/mapper/ChannelMapper.java +++ b/src/main/java/neatlogic/framework/process/dao/mapper/ChannelMapper.java @@ -81,6 +81,8 @@ public interface ChannelMapper { List getChannelListByChannelTypeUuidList(List channelTypeUuidList); + List getChannelListByChannelUuidList(List channelUuidList); + List getChannelRelationListBySource(String channelUuid); List getChannelRelationAuthorityListBySource(String channelUuid); diff --git a/src/main/java/neatlogic/framework/process/dao/mapper/ChannelMapper.xml b/src/main/java/neatlogic/framework/process/dao/mapper/ChannelMapper.xml index f7306467718e31dab27680bb06dcc2ab7f1f6c9f..947ce6bf13d7465b5a4ec16791ab2146437364b6 100644 --- a/src/main/java/neatlogic/framework/process/dao/mapper/ChannelMapper.xml +++ b/src/main/java/neatlogic/framework/process/dao/mapper/ChannelMapper.xml @@ -548,6 +548,21 @@ limitations under the License. + + + + + + + +