Browse Source

印章申请流程 和 项目启动流程

xieyn 1 year ago
parent
commit
598d1d8f6b

+ 68 - 0
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/activiti/listener/ListenerApplySeal.java

@@ -0,0 +1,68 @@
+package org.jeecg.modules.activiti.listener;
+
+import org.activiti.engine.delegate.*;
+import org.apache.shiro.SecurityUtils;
+import org.jeecg.common.system.api.ISysBaseAPI;
+import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.modules.activiti.mapper.TbTableInfoMapper;
+import org.jeecg.modules.oa.entity.SealArchives;
+import org.jeecg.modules.oa.entity.SealTurn;
+import org.jeecg.modules.oa.mapper.SealArchivesMapper;
+import org.jeecg.modules.oa.mapper.SealTurnMapper;
+import org.jeecg.modules.oa.service.IActivitiService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.util.HashMap;
+import java.util.Map;
+
+//流程监听,固资在转移、报废等操作时回写状态
+@Component
+public class ListenerApplySeal implements TaskListener, ExecutionListener {
+
+    @Autowired
+    private SealArchivesMapper sealArchivesMapper;
+
+    /**
+     * 执行监听
+     *
+     * @param delegateExecution
+     * @throws Exception
+     */
+    @Override
+    public void notify(DelegateExecution delegateExecution) throws Exception {
+
+        String eventName = delegateExecution.getEventName();
+        if ("start".equals(eventName)) {
+            // 流程开始
+        } else if ("end".equals(eventName)) {
+            //todo
+            Map<String, Object> variables = delegateExecution.getVariables();
+//            //印章类别
+//            String type = String.valueOf(variables.get("sealType"));
+//            //印章名称
+//            String name = String.valueOf(variables.get("sealName"));
+//            //
+//            SealArchives sealArchives = new SealArchives();
+//            sealArchivesMapper.insert(sealArchives);
+        } else if ("take".equals(eventName)) {
+            // 连线监听器
+        }
+    }
+
+    /**
+     * 任务监听
+     *
+     * @param delegateTask
+     */
+    @Override
+    public void notify(DelegateTask delegateTask) {
+        String eventName = delegateTask.getEventName();
+        if ("create".endsWith(eventName)) {
+        } else if ("assignment".endsWith(eventName)) {
+        } else if ("complete".endsWith(eventName)) {
+        } else if ("delete".endsWith(eventName)) {
+        }
+    }
+}

+ 51 - 0
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/activiti/listener/ListenerProjectStart.java

@@ -0,0 +1,51 @@
+package org.jeecg.modules.activiti.listener;
+
+import org.activiti.engine.delegate.DelegateExecution;
+import org.activiti.engine.delegate.DelegateTask;
+import org.activiti.engine.delegate.ExecutionListener;
+import org.activiti.engine.delegate.TaskListener;
+import org.jeecg.modules.oa.mapper.SealArchivesMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+//流程监听,固资在转移、报废等操作时回写状态
+@Component
+public class ListenerProjectStart implements TaskListener, ExecutionListener {
+
+    /**
+     * 执行监听
+     *
+     * @param delegateExecution
+     * @throws Exception
+     */
+    @Override
+    public void notify(DelegateExecution delegateExecution) throws Exception {
+
+        String eventName = delegateExecution.getEventName();
+        if ("start".equals(eventName)) {
+            // 流程开始
+        } else if ("end".equals(eventName)) {
+            //todo
+            Map<String, Object> variables = delegateExecution.getVariables();
+        } else if ("take".equals(eventName)) {
+            // 连线监听器
+        }
+    }
+
+    /**
+     * 任务监听
+     *
+     * @param delegateTask
+     */
+    @Override
+    public void notify(DelegateTask delegateTask) {
+        String eventName = delegateTask.getEventName();
+        if ("create".endsWith(eventName)) {
+        } else if ("assignment".endsWith(eventName)) {
+        } else if ("complete".endsWith(eventName)) {
+        } else if ("delete".endsWith(eventName)) {
+        }
+    }
+}