| | |
| | | import com.vci.ubcs.flow.engine.entity.FlowProcess; |
| | | import com.vci.ubcs.flow.engine.utils.FlowCache; |
| | | import lombok.AllArgsConstructor; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.flowable.engine.HistoryService; |
| | | import org.flowable.engine.TaskService; |
| | | import org.flowable.engine.history.HistoricProcessInstance; |
| | |
| | | |
| | | HistoricProcessInstanceQuery historyQuery = historyService.createHistoricProcessInstanceQuery().startedBy(taskUser).orderByProcessInstanceStartTime().desc(); |
| | | |
| | | if (bladeFlow.getCategory() != null) { |
| | | if (StringUtils.isNotEmpty(bladeFlow.getCategory())) { |
| | | historyQuery.processDefinitionCategory(bladeFlow.getCategory()); |
| | | } |
| | | if (bladeFlow.getProcessDefinitionName() != null) { |
| | |
| | | String[] businessKey = Func.toStrArray(StringPool.COLON, historicProcessInstance.getBusinessKey()); |
| | | if (businessKey.length > 1) { |
| | | flow.setBusinessTable(businessKey[0]); |
| | | flow.setBusinessId(businessKey[1]); |
| | | flow.setBusinessId(businessKey.length>1?businessKey[1]:"1"); |
| | | } |
| | | flow.setHistoryActivityName(historicProcessInstance.getName()); |
| | | flow.setProcessInstanceId(historicProcessInstance.getId()); |
| | |
| | | HistoricTaskInstanceQuery doneQuery = historyService.createHistoricTaskInstanceQuery().taskAssignee(taskUser).finished() |
| | | .includeProcessVariables().orderByHistoricTaskInstanceEndTime().desc(); |
| | | |
| | | if (bladeFlow.getCategory() != null) { |
| | | if (StringUtils.isNotEmpty(bladeFlow.getCategory())) { |
| | | doneQuery.processCategoryIn(Func.toStrList(bladeFlow.getCategory())); |
| | | } |
| | | if (bladeFlow.getProcessDefinitionName() != null) { |
| | |
| | | if (Func.isNotEmpty(historicProcessInstance)) { |
| | | String[] businessKey = Func.toStrArray(StringPool.COLON, historicProcessInstance.getBusinessKey()); |
| | | flow.setBusinessTable(businessKey[0]); |
| | | flow.setBusinessId(businessKey[1]); |
| | | flow.setBusinessId(businessKey.length>1?businessKey[1]:"1"); |
| | | if (historicProcessInstance.getEndActivityId() != null) { |
| | | flow.setProcessIsFinished(FlowEngineConstant.STATUS_FINISHED); |
| | | } else { |
| | |
| | | variables = Kv.create(); |
| | | } |
| | | variables.put(ProcessConstant.PASS_KEY, flow.isPass()); |
| | | variables.put("yn","y"); |
| | | // 完成任务 |
| | | taskService.complete(taskId, variables); |
| | | return true; |
| | |
| | | * @param status 状态 |
| | | */ |
| | | private void buildFlowTaskList(BladeFlow bladeFlow, List<BladeFlow> flowList, TaskQuery taskQuery, String status) { |
| | | if (bladeFlow.getCategory() != null) { |
| | | // if (bladeFlow.getCategory() != null) { |
| | | if (StringUtils.isNotEmpty(bladeFlow.getCategory())) { |
| | | taskQuery.processCategoryIn(Func.toStrList(bladeFlow.getCategory())); |
| | | } |
| | | if (bladeFlow.getProcessDefinitionName() != null) { |
| | |
| | | if (Func.isNotEmpty(historicProcessInstance)) { |
| | | String[] businessKey = Func.toStrArray(StringPool.COLON, historicProcessInstance.getBusinessKey()); |
| | | flow.setBusinessTable(businessKey[0]); |
| | | flow.setBusinessId(businessKey[1]); |
| | | flow.setBusinessId(businessKey.length>1?businessKey[1]:"1"); |
| | | } |
| | | |
| | | FlowProcess processDefinition = FlowCache.getProcessDefinition(task.getProcessDefinitionId()); |