| | |
| | | import org.springblade.mdm.flow.service.FlowCommonService; |
| | | import org.springblade.mdm.flow.service.FlowProgramFileService; |
| | | import org.springblade.mdm.flow.service.FlowProgramProperties; |
| | | import org.springblade.system.feign.IUserClient; |
| | | import org.springblade.system.pojo.entity.User; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | @Override |
| | | public void completeTask(String taskId, String processInstanceId, String comment, Map<String, Object> variables) { |
| | | Task task = currentTask(taskId); |
| | | |
| | | // 非空判断 |
| | | if (Func.isEmpty(variables)) { |
| | | variables = Kv.create(); |
| | | } |
| | | String operateResult = this.getApproveResult(variables); |
| | | |
| | | FlowProgramProperties props = flowCommonService.getProgramProperties(processInstanceId); |
| | |
| | | throw new ServiceException("请指定流程下一步处理人"); |
| | | } |
| | | |
| | | // 非空判断 |
| | | if (Func.isEmpty(variables)) { |
| | | variables = Kv.create(); |
| | | } |
| | | |
| | | if(task.getTaskDefinitionKey().equals("programmingTask") ) {//编制节点 |
| | | //记录实际编程员 |
| | | variables.put(FlowVariableContants.ACT_PROGRAMMER,Func.toStr(AuthUtil.getUserId())); |
| | | |
| | | if(this.needUploadProgramFile(props.getMachineCode())) { |
| | | String programOnMachine = Func.toStr(variables.getOrDefault("programOnMachine",FlowContants.N));//是否现场编程 |
| | | if(this.needUploadProgramFile(props.getMachineCode()) && programOnMachine.equals(FlowContants.N)) { |
| | | flowProgramFileService.checkProgramFiles(processInstanceId, FlowContants.Y.equals(operateResult)); |
| | | } |
| | | }else if(task.getTaskDefinitionKey().equals("teamLeaderTask")){ |
| | | if(FlowContants.Y.equals(operateResult)) { |
| | | runtimeService.setVariable(task.getExecutionId(),FlowContants.PROGRAMMER_NAME,userCommonService.getUserNameById(Func.toLong(variables.get("assignee")))); |
| | | } |
| | | |
| | | }else if(task.getTaskDefinitionKey().equals("check")){ |
| | | variables.put(FlowVariableContants.ACT_CHECKER,Func.toStr(AuthUtil.getUserId())); |
| | | }else if(task.getTaskDefinitionKey().equals("approveTask")){ |
| | | variables.put(FlowVariableContants.ACT_SENIOR,Func.toStr(AuthUtil.getUserId())); |
| | | } |
| | | variables.remove("programOnMachine");//其他节点,忽略现场编程标记 |
| | | if (StringUtil.isNoneBlank(processInstanceId, comment)) { |
| | | taskService.addComment(taskId, processInstanceId, comment); |
| | | } |
| | | |
| | | variables.put(FlowContants.LAST_STEP_USER_NICKNAME, AuthUtil.getNickName()); |
| | | |
| | | |
| | | addApproveRecord(taskId,comment,variables); |
| | | |
| | |
| | | |
| | | if("confirmIsUseableTask".equals(task.getTaskDefinitionKey())){ |
| | | variables.put(FlowContants.CURE_PROGRAM_USEABLE,operateResult); |
| | | |
| | | if(FlowContants.Y.equals(operateResult)) { |
| | | //判定可用,记录为实际编程员 |
| | | variables.put(FlowVariableContants.ACT_PROGRAMMER,Func.toStr(AuthUtil.getUserId())); |
| | | } |
| | | } |
| | | taskService.complete(taskId, variables); |
| | | } |