|
|
@@ -9,11 +9,15 @@ import cn.hutool.json.JSONUtil;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.xjrsoft.common.enums.WorkflowNoticePolicyType;
|
|
|
+import com.xjrsoft.common.enums.YesOrNoEnum;
|
|
|
import com.xjrsoft.common.exception.MyException;
|
|
|
import com.xjrsoft.module.oa.utils.SendMessageUtil;
|
|
|
import com.xjrsoft.module.workflow.constant.WorkflowConstant;
|
|
|
import com.xjrsoft.module.workflow.entity.WorkflowSchema;
|
|
|
-import com.xjrsoft.module.workflow.model.*;
|
|
|
+import com.xjrsoft.module.workflow.model.MemberConfig;
|
|
|
+import com.xjrsoft.module.workflow.model.NoticePolicyParam;
|
|
|
+import com.xjrsoft.module.workflow.model.TimeoutRemidConfig;
|
|
|
+import com.xjrsoft.module.workflow.model.WorkflowSchemaConfig;
|
|
|
import com.xjrsoft.module.workflow.service.IWorkflowExecuteService;
|
|
|
import com.xjrsoft.module.workflow.service.IWorkflowSchemaService;
|
|
|
import com.xjrsoft.module.workflow.utils.WorkFlowUtil;
|
|
|
@@ -27,7 +31,6 @@ import org.springframework.data.redis.listener.RedisMessageListenerContainer;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.concurrent.CompletableFuture;
|
|
|
@@ -62,7 +65,13 @@ public class TaskTimeoutListener extends KeyExpirationEventMessageListener {
|
|
|
String taskId = split[0];
|
|
|
|
|
|
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
|
|
|
-
|
|
|
+ if (task == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ int code = Convert.toInt(taskService.getVariable(task.getId(),WorkflowConstant.TASK_IS_APPOINT_APPROVE));
|
|
|
+ if (code == YesOrNoEnum.NO.getCode()){
|
|
|
+ return;
|
|
|
+ }
|
|
|
//到期未指定的任务 将变量设置为不需要指定
|
|
|
// taskService.setVariableLocal(task.getId(), WorkflowConstant.TASK_IS_APPOINT_APPROVE, YesOrNoEnum.NO.getCode());
|
|
|
|
|
|
@@ -82,15 +91,15 @@ public class TaskTimeoutListener extends KeyExpirationEventMessageListener {
|
|
|
|
|
|
Map<String, Object> variables = taskService.getVariables(currentTask.getId(), variableNames);
|
|
|
|
|
|
- Long schemaId = Convert.toLong(taskService.getVariable(currentTask.getId(), WorkflowConstant.PROCESS_SCHEMA_ID_KEY));
|
|
|
+// Long schemaId = Convert.toLong(taskService.getVariable(currentTask.getId(), WorkflowConstant.PROCESS_SCHEMA_ID_KEY));
|
|
|
|
|
|
- IWorkflowSchemaService workflowSchemaService = SpringUtil.getBean(IWorkflowSchemaService.class);
|
|
|
- WorkflowSchema workflowSchema = workflowSchemaService.getOne(Wrappers.lambdaQuery(WorkflowSchema.class).eq(WorkflowSchema::getId, schemaId).select(WorkflowSchema::getJsonContent));
|
|
|
+// IWorkflowSchemaService workflowSchemaService = SpringUtil.getBean(IWorkflowSchemaService.class);
|
|
|
+// WorkflowSchema workflowSchema = workflowSchemaService.getOne(Wrappers.lambdaQuery(WorkflowSchema.class).eq(WorkflowSchema::getId, schemaId).select(WorkflowSchema::getJsonContent));
|
|
|
|
|
|
- WorkflowSchemaConfig workflowSchemaConfig = JSONUtil.toBean(workflowSchema.getJsonContent(), WorkflowSchemaConfig.class);
|
|
|
+// WorkflowSchemaConfig workflowSchemaConfig = JSONUtil.toBean(workflowSchema.getJsonContent(), WorkflowSchemaConfig.class);
|
|
|
|
|
|
- Map<String, Object> userTaskConfigMap = workflowSchemaConfig.getChildNodeConfig().stream().filter(x -> x.containsValue(currentTask.getTaskDefinitionKey())).findFirst().orElse(new HashMap<>());
|
|
|
- UserTaskConfig userTaskConfig = Convert.convert(UserTaskConfig.class, userTaskConfigMap);
|
|
|
+// Map<String, Object> userTaskConfigMap = workflowSchemaConfig.getChildNodeConfig().stream().filter(x -> x.containsValue(currentTask.getTaskDefinitionKey())).findFirst().orElse(new HashMap<>());
|
|
|
+// UserTaskConfig userTaskConfig = Convert.convert(UserTaskConfig.class, userTaskConfigMap);
|
|
|
|
|
|
List<String> approveIds = ListUtil.toList(Convert.toStr(approvedIds).split(StringPool.COMMA));
|
|
|
|
|
|
@@ -104,7 +113,7 @@ public class TaskTimeoutListener extends KeyExpirationEventMessageListener {
|
|
|
param.setSchemaName(MapUtil.get(variables, WorkflowConstant.PROCESS_SCHEMA_NAME_KEY, String.class));
|
|
|
param.setStartUserName(MapUtil.get(variables, WorkflowConstant.PROCESS_START_USER_NAME_KEY, String.class));
|
|
|
// 默认强制推送微信消息
|
|
|
- param.setNoticePolicyConfigs(new ArrayList(){{
|
|
|
+ param.setNoticePolicyConfigs(new ArrayList() {{
|
|
|
add(WorkflowNoticePolicyType.WECHAT.getCode());
|
|
|
}});
|
|
|
//超时消息
|