| | |
| | | import org.jeecg.common.util.SpringContextUtils; |
| | | import org.jeecg.modules.flowable.apithird.business.entity.FlowMyBusiness; |
| | | import org.jeecg.modules.flowable.apithird.business.service.impl.FlowMyBusinessServiceImpl; |
| | | import org.jeecg.modules.flowable.apithird.entity.ActStatus; |
| | | import org.jeecg.modules.flowable.apithird.common.constant.ProcessConstants; |
| | | import org.jeecg.modules.flowable.apithird.common.enums.FlowComment; |
| | | import org.jeecg.modules.flowable.apithird.entity.SysUser; |
| | | import org.jeecg.modules.flowable.apithird.service.FlowCallBackServiceI; |
| | | import org.jeecg.modules.flowable.apithird.service.IFlowThirdService; |
| | | import org.jeecg.modules.flowable.apithird.common.constant.ProcessConstants; |
| | | import org.jeecg.modules.flowable.apithird.common.enums.FlowComment; |
| | | import org.jeecg.modules.flowable.domain.dto.FlowNextDto; |
| | | import org.jeecg.modules.flowable.domain.dto.FlowProcDefDto; |
| | | import org.jeecg.modules.flowable.factory.FlowServiceFactory; |
| | |
| | | ProcessDefinitionQuery processDefinitionQuery |
| | | = repositoryService.createProcessDefinitionQuery().processDefinitionKey(processDefinitionKey); |
| | | long count = processDefinitionQuery.count(); |
| | | return count > 0 ? true : false; |
| | | return count > 0; |
| | | } |
| | | |
| | | |
| | |
| | | public Result readXml(String deployId) throws IOException { |
| | | ProcessDefinition definition = repositoryService.createProcessDefinitionQuery().deploymentId(deployId).singleResult(); |
| | | InputStream inputStream = repositoryService.getResourceAsStream(definition.getDeploymentId(), definition.getResourceName()); |
| | | String result = IOUtils.toString(inputStream, StandardCharsets.UTF_8.name()); |
| | | String result = IOUtils.toString(inputStream, StandardCharsets.UTF_8); |
| | | return Result.OK("", result); |
| | | } |
| | | |
| | |
| | | FlowMyBusiness business = flowMyBusinessService.getOne(flowMyBusinessLambdaQueryWrapper); |
| | | ProcessDefinition definition = repositoryService.createProcessDefinitionQuery().processDefinitionId(business.getProcessDefinitionId()).singleResult(); |
| | | InputStream inputStream = repositoryService.getResourceAsStream(definition.getDeploymentId(), definition.getResourceName()); |
| | | String result = IOUtils.toString(inputStream, StandardCharsets.UTF_8.name()); |
| | | String result = IOUtils.toString(inputStream, StandardCharsets.UTF_8); |
| | | return Result.OK("", result); |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result startProcessInstanceByKey(String procDefKey, Map<String, Object> variables) { |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public Result<?> startProcessInstanceByKey(String procDefKey, Map<String, Object> variables) { |
| | | ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery() |
| | | .processDefinitionKey(procDefKey) |
| | | .latestVersion().singleResult(); |
| | | return startProcessInstanceById(processDefinition.getId(),variables); |
| | | Result result = startProcessInstanceById(processDefinition.getId(),variables); |
| | | return result; |
| | | } |
| | | /** |
| | | * 根据流程定义ID启动流程实例 |
| | |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public Result startProcessInstanceById(String procDefId, Map<String, Object> variables) { |
| | | public Result<?> startProcessInstanceById(String procDefId, Map<String, Object> variables) { |
| | | ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery() |
| | | .processDefinitionId(procDefId) |
| | | .singleResult(); |
| | |
| | | // 给第一步申请人节点设置任务执行人和意见 |
| | | Task task = taskService.createTaskQuery().processInstanceId(processInstance.getProcessInstanceId()).active().singleResult(); |
| | | if (Objects.nonNull(task)) { |
| | | taskService.addComment(task.getId(), processInstance.getProcessInstanceId(), FlowComment.NORMAL.getType(), sysUser.getRealname() + "发起流程申请"); |
| | | taskService.addComment(task.getId(), processInstance.getProcessInstanceId(), FlowComment.NORMAL.getType(), variables.get("organization").toString()); |
| | | taskService.setAssignee(task.getId(), sysUser.getUsername()); |
| | | task.setDescription(variables.get("organization").toString()); |
| | | //taskService.complete(task.getId(), variables); |
| | | } |
| | | //设置所有申请人 |
| | |
| | | |
| | | business.setProcessDefinitionId(procDefId) |
| | | .setProcessInstanceId(processInstance.getProcessInstanceId()) |
| | | .setActStatus(ActStatus.start) |
| | | //// .setActStatus(ActStatus.start) |
| | | .setProposer(sysUser.getUsername()) |
| | | .setTaskId(task2.getId()) |
| | | .setTaskName(nextTask.getName()) |
| | |
| | | // **没有下一个节点,流程已经结束了 |
| | | business.setProcessDefinitionId(procDefId) |
| | | .setProcessInstanceId(processInstance.getProcessInstanceId()) |
| | | .setActStatus(ActStatus.pass) |
| | | // .setActStatus(ActStatus.pass) |
| | | .setProposer(sysUser.getUsername()) |
| | | .setDoneUsers(doneUserList.toJSONString()) |
| | | ; |