| | |
| | | package org.springblade.mdm.flow.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | import org.flowable.engine.RuntimeService; |
| | | import org.flowable.engine.TaskService; |
| | | import org.flowable.engine.runtime.ProcessInstance; |
| | | import org.flowable.task.api.Task; |
| | | import org.springblade.core.log.exception.ServiceException; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.api.IResultCode; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.core.tool.utils.StringUtil; |
| | | import org.springblade.mdm.flow.constants.FlowContants; |
| | | import org.springblade.mdm.flow.entity.TaskDispatch; |
| | | import org.springblade.mdm.flow.excution.StartDispatcher; |
| | |
| | | private final BatchDispatchService dispatchService; |
| | | private final ReplaceFlowCompleteService replaceFlowCompleteService; |
| | | private final TempFlowCompleteService tempFlowCompleteService; |
| | | private final CureFlowCompleteService cureFlowCompleteService; |
| | | /** |
| | | * 发起派工流程 |
| | | */ |
| | |
| | | dispatch.setStatus(TaskDispatch.STATUS_EXCEPTION); |
| | | dispatch.setErrMsg(e.getMessage()); |
| | | taskDispatchService.updateById(dispatch); |
| | | return R.fail("任务启动异常:"+e.getMessage()); |
| | | //return R.fail("任务启动异常:"+e.getMessage()); |
| | | return R.fail(new IResultCode() { |
| | | @Override |
| | | public String getMessage() { |
| | | return e.getMessage(); |
| | | } |
| | | |
| | | @Override |
| | | public int getCode() { |
| | | return 201; |
| | | } |
| | | }); |
| | | } |
| | | }catch(Exception e){ |
| | | return R.fail(e.getMessage()); |
| | | return R.fail(new IResultCode() { |
| | | @Override |
| | | public String getMessage() { |
| | | return e.getMessage(); |
| | | } |
| | | |
| | | @Override |
| | | public int getCode() { |
| | | return 201; |
| | | } |
| | | }); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取实际审批流程执行服务 |
| | | * @param processInstanceId |
| | | * @return |
| | | */ |
| | | AbstractFlowCompleteService getActualService(String processInstanceId){ |
| | | ProcessInstance inst = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).includeProcessVariables().singleResult(); |
| | | if(inst.getProcessDefinitionKey().equals(FlowContants.TRY_PROCESS_KEY) || inst.getProcessDefinitionKey().equals(FlowContants.CURE_PROCESS_KEY) |
| | | if(inst.getProcessDefinitionKey().equals(FlowContants.TRY_PROCESS_KEY) |
| | | || inst.getProcessDefinitionKey().equals(FlowContants.UNLOCK_PROCESS_KEY)){ |
| | | String isTempFlow = Func.toStr(inst.getProcessVariables().get(FlowContants.IS_TEMP_FLOW)); |
| | | if(FlowContants.N.equals(isTempFlow)){ |
| | |
| | | }else{ |
| | | return tempFlowCompleteService; |
| | | } |
| | | }else if(inst.getProcessDefinitionKey().equals(FlowContants.CURE_PROCESS_KEY)){ |
| | | return cureFlowCompleteService; |
| | | }else if(inst.getProcessDefinitionKey().equals(FlowContants.REPLACE_PROCESS_KEY)){ |
| | | return replaceFlowCompleteService; |
| | | }else{ |