| | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.flowable.engine.RuntimeService; |
| | | import org.flowable.engine.TaskService; |
| | | import org.flowable.engine.runtime.ProcessInstance; |
| | | import org.springblade.core.log.exception.ServiceException; |
| | | import org.springblade.core.tool.api.IResultCode; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.mdm.flow.constants.FlowContants; |
| | | import org.springblade.mdm.flow.constants.FlowConstant; |
| | | import org.springblade.mdm.flow.constants.FlowVariableConstant; |
| | | import org.springblade.mdm.flow.entity.TaskDispatch; |
| | | import org.springblade.mdm.flow.excution.StartDispatcher; |
| | | import org.springblade.mdm.flow.service.FlowProgramFileService; |
| | | import org.springblade.mdm.flow.service.TaskDispatchService; |
| | | import org.springblade.mdm.flow.service.execute.*; |
| | | import org.springblade.mdm.flow.vo.BatchDispatchVO; |
| | |
| | | boolean isDuplicate = taskDispatchService.checkIsDuplicate(startVO); |
| | | |
| | | TaskDispatch dispatch = taskDispatchService.saveTask(startVO,isDuplicate); |
| | | startVO.setCreateUser(dispatch.getCreateUser()); |
| | | if(isDuplicate){ |
| | | throw new ServiceException("重复派工"); |
| | | } |
| | |
| | | */ |
| | | AbstractFlowCompleteService getActualService(String processInstanceId){ |
| | | ProcessInstance inst = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).includeProcessVariables().singleResult(); |
| | | 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)){ |
| | | if(inst.getProcessDefinitionKey().equals(FlowConstant.TRY_PROCESS_KEY) |
| | | || inst.getProcessDefinitionKey().equals(FlowConstant.UNLOCK_PROCESS_KEY)){ |
| | | String isTempFlow = Func.toStr(inst.getProcessVariables().get(FlowVariableConstant.IS_TEMP_FLOW)); |
| | | if(FlowConstant.N.equals(isTempFlow)){ |
| | | return tryFlowCompleteService; |
| | | }else{ |
| | | return tempFlowCompleteService; |
| | | } |
| | | }else if(inst.getProcessDefinitionKey().equals(FlowContants.CURE_PROCESS_KEY)){ |
| | | }else if(inst.getProcessDefinitionKey().equals(FlowConstant.CURE_PROCESS_KEY)){ |
| | | return cureFlowCompleteService; |
| | | }else if(inst.getProcessDefinitionKey().equals(FlowContants.REPLACE_PROCESS_KEY)){ |
| | | }else if(inst.getProcessDefinitionKey().equals(FlowConstant.REPLACE_PROCESS_KEY)){ |
| | | return replaceFlowCompleteService; |
| | | }else{ |
| | | return defaultFlowCompleteService; |
| | |
| | | }catch(Exception e){ |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | @Operation(summary = "编程员现场编制批量处理", description = "编程员现场编制批量处理") |
| | | @PostMapping("batch-program-on-machine") |
| | | public R<Void> batchProgramOnMachine(@RequestBody BatchDispatchVO batchDispatchVO) { |
| | | try { |
| | | dispatchService.batchProgramOnMachine(batchDispatchVO); |
| | | return R.success("流程提交成功"); |
| | | }catch(Exception e){ |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | /* |
| | | void addApproveRecord(String taskId,String comment,Map<String, Object> variables){ |
| | | String operateResult = variables.get("approve")+""; |
| | | |
| | | Task task = taskService.createTaskQuery() |
| | | .taskId(taskId) |
| | | .singleResult(); |
| | | approveRecordService.saveApproveRecords(task,operateResult,comment); |
| | | |
| | | }*/ |
| | | } |