Jelajahi Sumber

Merge remote-tracking branch 'origin/pre' into pre

dzx 1 tahun lalu
induk
melakukan
d96e7b3a17

+ 12 - 2
src/main/java/com/xjrsoft/module/workflow/service/impl/WorkflowExecuteServiceImpl.java

@@ -37,7 +37,6 @@ import com.xjrsoft.module.form.mapper.FormTemplateMapper;
 import com.xjrsoft.module.form.service.IFormExecuteService;
 import com.xjrsoft.module.magicapi.service.IMagicApiService;
 import com.xjrsoft.module.magicapi.vo.MagicApiInfoVo;
-import com.xjrsoft.module.oa.entity.News;
 import com.xjrsoft.module.organization.entity.User;
 import com.xjrsoft.module.organization.entity.UserRoleRelation;
 import com.xjrsoft.module.organization.service.IUserService;
@@ -530,7 +529,18 @@ public class WorkflowExecuteServiceImpl implements IWorkflowExecuteService {
         WorkflowSchema workflowSchema = workflowSchemaMapper.selectOne(Wrappers.lambdaQuery(WorkflowSchema.class).eq(WorkflowSchema::getId, schemaIdVar.get().getValue()));
 
         //获取到整个流程模板的配置
-        WorkflowSchemaConfig workflowSchemaConfig = JSONUtil.toBean(workflowSchema.getJsonContent(), WorkflowSchemaConfig.class);
+        // TODO 判断当前流程是否发生了变更
+        WorkflowSchemaConfig workflowSchemaConfig = null;
+        if (workflowSchema.getDefinitionId().equals(historicProcessInstance.getProcessDefinitionId())) {
+            workflowSchemaConfig = JSONUtil.toBean(workflowSchema.getJsonContent(), WorkflowSchemaConfig.class);
+        } else {
+            WorkflowSchemaHistory workflowSchemaHistory = workflowSchemaHistoryMapper.selectOne(Wrappers.lambdaQuery(WorkflowSchemaHistory.class).eq(WorkflowSchemaHistory::getDefinitionId, historicProcessInstance.getProcessDefinitionId()));
+            if (workflowSchemaHistory == null) {
+                throw new MyException("流转历史记录已丢失!");
+            }
+            workflowSchemaConfig = JSONUtil.toBean(workflowSchemaHistory.getJsonContent(), WorkflowSchemaConfig.class);
+        }
+//        WorkflowSchemaConfig workflowSchemaConfig = JSONUtil.toBean(workflowSchema.getJsonContent(), WorkflowSchemaConfig.class);
 
         UserTaskInfoVo vo = new UserTaskInfoVo();
         vo.setWorkflowChat(workflowSchema.getWorkflowChat());