|
@@ -0,0 +1,58 @@
|
|
|
|
|
+package com.wx.blink.backend.factory;
|
|
|
|
|
+
|
|
|
|
|
+import com.wx.blink.backend.handler.*;
|
|
|
|
|
+import com.wx.blink.base.common.code.SystemErrorCode;
|
|
|
|
|
+import com.wx.blink.base.common.domain.ResponseDTO;
|
|
|
|
|
+
|
|
|
|
|
+import java.util.HashMap;
|
|
|
|
|
+import java.util.Map;
|
|
|
|
|
+
|
|
|
|
|
+public class CustomizeProcessFactory {
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 状态
|
|
|
|
|
+ * 0:保存未提交
|
|
|
|
|
+ * 1:驳回到发起人
|
|
|
|
|
+ * 2:运行中
|
|
|
|
|
+ * 3:流程异常
|
|
|
|
|
+ * 4:完成
|
|
|
|
|
+ * 5:取消
|
|
|
|
|
+ */
|
|
|
|
|
+ private static final Map<Integer, Map<String, CustomizeProcessEventHandler>> processorMap = new HashMap<>();
|
|
|
|
|
+
|
|
|
|
|
+ static {
|
|
|
|
|
+ processorMap.put(0, new HashMap<String, CustomizeProcessEventHandler>() {{
|
|
|
|
|
+ //put("PROVIDER_REGISTER", new ProviderRegisterProcessEventHandler());
|
|
|
|
|
+ }});
|
|
|
|
|
+
|
|
|
|
|
+ processorMap.put(1, new HashMap<String, CustomizeProcessEventHandler>() {{
|
|
|
|
|
+ }});
|
|
|
|
|
+
|
|
|
|
|
+ processorMap.put(2, new HashMap<String, CustomizeProcessEventHandler>() {{
|
|
|
|
|
+ put("PROVIDER_REGISTER", new ProviderRegisterProcessEventHandler());
|
|
|
|
|
+ }});
|
|
|
|
|
+
|
|
|
|
|
+ processorMap.put(3, new HashMap<String, CustomizeProcessEventHandler>() {{
|
|
|
|
|
+ }});
|
|
|
|
|
+
|
|
|
|
|
+ processorMap.put(4, new HashMap<String, CustomizeProcessEventHandler>() {{
|
|
|
|
|
+ //费用报销流程
|
|
|
|
|
+ put("EXPENSE_STATEMENT", new ExpenseStatementProcessEventHandler());
|
|
|
|
|
+ //借款申请流程
|
|
|
|
|
+ put("LOAN_APPLY", new LoanApplyProcessEventHandler());
|
|
|
|
|
+ }});
|
|
|
|
|
+
|
|
|
|
|
+ processorMap.put(5, new HashMap<String, CustomizeProcessEventHandler>() {{
|
|
|
|
|
+ }});
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public static ResponseDTO<CustomizeProcessEventHandler> getProcessor(int state, String flowCode) {
|
|
|
|
|
+ Map<String, CustomizeProcessEventHandler> processors = processorMap.get(state);
|
|
|
|
|
+ if (processors != null) {
|
|
|
|
|
+ CustomizeProcessEventHandler processor = processors.get(flowCode);
|
|
|
|
|
+ if (processor != null) {
|
|
|
|
|
+ return ResponseDTO.ok(processor);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return ResponseDTO.error(SystemErrorCode.SYSTEM_ERROR, "No processor found for state: " + state + " and flowCode: " + flowCode);
|
|
|
|
|
+ }
|
|
|
|
|
+}
|