| | |
| | | import org.springblade.core.tool.utils.StringUtil; |
| | | import org.springblade.mdm.flow.constants.FlowContants; |
| | | import org.springblade.mdm.flow.entity.ApproveRecord; |
| | | import org.springblade.mdm.flow.entity.TaskDispatch; |
| | | import org.springblade.mdm.flow.excution.StartDispatcher; |
| | | import org.springblade.mdm.flow.service.ApproveRecordService; |
| | | import org.springblade.mdm.flow.service.FlowCommonService; |
| | |
| | | import org.springblade.mdm.program.entity.ProcessProgRef; |
| | | import org.springblade.mdm.program.service.NcNodeAutoCreateService; |
| | | import org.springblade.mdm.program.service.ProcessProgRefService; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | |
| | | @Operation(summary = "任务计划(派工流程)", description = "启动派工流程") |
| | | public R<Boolean> start(@RequestBody TaskAssignVO startVO) { |
| | | try { |
| | | long id= taskDispatchService.saveTask(startVO); |
| | | String instId = dispatcher.start(startVO); |
| | | taskDispatchService.updateSuccess(id,instId); |
| | | return R.data(true); |
| | | TaskDispatch dispatch = taskDispatchService.saveTask(startVO); |
| | | boolean isDup = taskDispatchService.checkIsDuplicate(startVO); |
| | | if (isDup) { |
| | | dispatch.setStatus(TaskDispatch.STATUS_DUP); |
| | | taskDispatchService.updateById(dispatch); |
| | | return R.fail("重复派工"); |
| | | }else { |
| | | try { |
| | | String instId = dispatcher.start(startVO); |
| | | dispatch.setStatus(TaskDispatch.STATUS_STARTED); |
| | | dispatch.setProcessInstanceId(instId); |
| | | taskDispatchService.updateById(dispatch); |
| | | return R.data(true); |
| | | }catch (Exception e) { |
| | | dispatch.setStatus(TaskDispatch.STATUS_EXCEPTION); |
| | | taskDispatchService.updateById(dispatch); |
| | | return R.fail("任务启动异常"); |
| | | } |
| | | } |
| | | |
| | | }catch(Exception e){ |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | 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) |