| | |
| | | import com.vci.ubcs.flow.engine.constant.FlowEngineConstant; |
| | | import com.vci.ubcs.flow.engine.entity.FlowProcess; |
| | | import com.vci.ubcs.flow.engine.utils.FlowCache; |
| | | import com.vci.ubcs.flow.engine.utils.FlowableUtils; |
| | | import com.vci.ubcs.starter.web.util.VciDateUtil; |
| | | import com.vci.ubcs.system.user.cache.UserCache; |
| | | import com.vci.ubcs.system.user.entity.User; |
| | |
| | | import org.flowable.task.api.TaskQuery; |
| | | import org.flowable.task.api.history.HistoricTaskInstance; |
| | | import org.flowable.task.api.history.HistoricTaskInstanceQuery; |
| | | import org.flowable.variable.api.history.HistoricVariableInstance; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.support.Kv; |
| | | import org.springblade.core.tool.utils.Func; |
| | |
| | | .includeProcessVariables().active().orderByTaskCreateTime().desc(); |
| | | |
| | | // 构建列表数据 |
| | | buildFlowTaskList(bladeFlow, flowList, claimUserQuery, FlowEngineConstant.STATUS_CLAIM); |
| | | buildFlowTaskList(bladeFlow, flowList, claimRoleWithTenantIdQuery, FlowEngineConstant.STATUS_CLAIM); |
| | | buildFlowTaskList(bladeFlow, flowList, claimRoleWithoutTenantIdQuery, FlowEngineConstant.STATUS_CLAIM); |
| | | buildFlowTaskList(bladeFlow, flowList, claimUserQuery, FlowEngineConstant.STATUS_CLAIM, page); |
| | | buildFlowTaskList(bladeFlow, flowList, claimRoleWithTenantIdQuery, FlowEngineConstant.STATUS_CLAIM, page); |
| | | buildFlowTaskList(bladeFlow, flowList, claimRoleWithoutTenantIdQuery, FlowEngineConstant.STATUS_CLAIM, page); |
| | | |
| | | // 计算总数 |
| | | long count = claimUserQuery.count() + claimRoleWithTenantIdQuery.count() + claimRoleWithoutTenantIdQuery.count(); |
| | |
| | | .includeProcessVariables().orderByTaskCreateTime().desc(); |
| | | |
| | | // 构建列表数据 |
| | | buildFlowTaskList(bladeFlow, flowList, todoQuery, FlowEngineConstant.STATUS_TODO); |
| | | buildFlowTaskList(bladeFlow, flowList, todoQuery, FlowEngineConstant.STATUS_TODO,page); |
| | | |
| | | // 计算总数 |
| | | long count = todoQuery.count(); |
| | |
| | | flow.setProcessIsFinished(FlowEngineConstant.STATUS_UNFINISHED); |
| | | } |
| | | flow.setStatus(FlowEngineConstant.STATUS_FINISH); |
| | | |
| | | //流程发起时间 |
| | | flow.setProcessDefinitionStartTime(VciDateUtil.date2Str(historicProcessInstance.getStartTime(),VciDateUtil.DateTimeFormat)); |
| | | |
| | | //流程变量 |
| | | |
| | | List<HistoricVariableInstance> variableInstances = historyService.createHistoricVariableInstanceQuery().processInstanceId(historicProcessInstance.getId()).list(); |
| | | Map<String,Object> variables = FlowableUtils.switchVariable(variableInstances); |
| | | flow.setVariables(variables); |
| | | |
| | | //businessKey |
| | | if (Func.isNotEmpty(historicProcessInstance)) { |
| | | flow.setBusinessId(businessKey.length>1 && StringUtils.isNotEmpty(businessKey[1])?businessKey[1]:"1"); |
| | | } |
| | | |
| | | flowList.add(flow); |
| | | }); |
| | | |
| | |
| | | // 完成任务 |
| | | taskService.complete(taskId, variables); |
| | | |
| | | // //设置下一步审核人 |
| | | // Task task = taskService.createTaskQuery().processInstanceId(processInstanceId).active().singleResult();//下一步节点 |
| | | // String taskKey = task.getTaskDefinitionKey();//就是流程配置的节点id |
| | | // Object to = getVar(processInstanceId,taskKey); |
| | | // if(to==null){ |
| | | // throw new ServiceException(taskKey+"没有设置审核人"); |
| | | // } |
| | | // String assignee = to.toString(); |
| | | // |
| | | // if(StringUtils.isNotEmpty(assignee)) { |
| | | // task.setAssignee(assignee); |
| | | // } |
| | | return true; |
| | | } |
| | | |
| | |
| | | * @param flowList 流程列表 |
| | | * @param taskQuery 任务查询类 |
| | | * @param status 状态 |
| | | * @param page |
| | | */ |
| | | private void buildFlowTaskList(BladeFlow bladeFlow, List<BladeFlow> flowList, TaskQuery taskQuery, String status) { |
| | | private void buildFlowTaskList(BladeFlow bladeFlow, List<BladeFlow> flowList, TaskQuery taskQuery, String status, IPage<BladeFlow> page) { |
| | | // if (bladeFlow.getCategory() != null) { |
| | | if (StringUtils.isNotEmpty(bladeFlow.getCategory())) { |
| | | taskQuery.processCategoryIn(Func.toStrList(bladeFlow.getCategory())); |
| | |
| | | if (bladeFlow.getEndDate() != null) { |
| | | taskQuery.taskCreatedBefore(bladeFlow.getEndDate()); |
| | | } |
| | | taskQuery.list().forEach(task -> { |
| | | int firstResult = (int) ((page.getCurrent()-1)* page.getSize()); |
| | | int maxResult = (int) page.getSize(); |
| | | taskQuery.listPage(firstResult,maxResult).forEach(task -> { |
| | | BladeFlow flow = new BladeFlow(); |
| | | flow.setTaskId(task.getId()); |
| | | flow.setTaskDefinitionKey(task.getTaskDefinitionKey()); |