From 1e133de871164bfd3f6c90f844a88165d986eab5 Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期三, 19 三月 2025 11:29:59 +0800 Subject: [PATCH] 任务日志查询bug --- business/src/main/java/com/ycl/service/impl/FlowTaskServiceImpl.java | 376 +++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 333 insertions(+), 43 deletions(-) diff --git a/business/src/main/java/com/ycl/service/impl/FlowTaskServiceImpl.java b/business/src/main/java/com/ycl/service/impl/FlowTaskServiceImpl.java index 6703b90..fdf46b4 100644 --- a/business/src/main/java/com/ycl/service/impl/FlowTaskServiceImpl.java +++ b/business/src/main/java/com/ycl/service/impl/FlowTaskServiceImpl.java @@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ycl.common.base.Result; import com.ycl.common.constant.ProcessConstants; import com.ycl.common.core.domain.AjaxResult; import com.ycl.common.core.domain.entity.SysDept; @@ -26,9 +27,8 @@ import com.ycl.domain.entity.ProjectProcess; import com.ycl.domain.entity.SysForm; import com.ycl.domain.json.RejectData; -import com.ycl.domain.vo.FlowQueryVo; -import com.ycl.domain.vo.FlowTaskVo; -import com.ycl.domain.vo.FormDetailVO; +import com.ycl.domain.query.ProcessLogQuery; +import com.ycl.domain.vo.*; import com.ycl.event.event.TaskLogEvent; import com.ycl.factory.FlowServiceFactory; import com.ycl.flow.CustomProcessDiagramGenerator; @@ -51,6 +51,7 @@ import org.flowable.bpmn.model.*; import org.flowable.common.engine.api.FlowableException; import org.flowable.common.engine.api.FlowableObjectNotFoundException; +import org.flowable.common.engine.impl.persistence.StrongUuidGenerator; import org.flowable.engine.ProcessEngineConfiguration; import org.flowable.engine.history.HistoricActivityInstance; import org.flowable.engine.history.HistoricProcessInstance; @@ -68,11 +69,13 @@ import org.flowable.task.api.TaskQuery; import org.flowable.task.api.history.HistoricTaskInstance; import org.flowable.task.api.history.HistoricTaskInstanceQuery; +import org.springframework.beans.BeanUtils; import org.springframework.context.ApplicationEventPublisher; +import org.springframework.context.annotation.Bean; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.io.InputStream; +import java.io.*; import java.lang.reflect.Field; import java.nio.charset.StandardCharsets; import java.util.*; @@ -134,11 +137,12 @@ * * @param taskId 浠诲姟id * @param variables 琛ㄥ崟鏁版嵁 + * @param addLog * @return */ @Override @Transactional(rollbackFor = Exception.class) - public AjaxResult completeSubmitForm(String taskId, Map<String, Object> variables) { + public AjaxResult completeSubmitForm(String taskId, Map<String, Object> variables, Boolean addLog) { Task task = taskService.createTaskQuery().taskId(taskId).singleResult(); if (Objects.isNull(task)) { return AjaxResult.error("浠诲姟涓嶅瓨鍦�"); @@ -151,21 +155,18 @@ return AjaxResult.error("椤圭洰娴佺▼鏈粦瀹�"); } - Map<String, Object> processVariables = new HashMap<>(); - //鏌ュ嚭瀛楀吀涓渶瑕佹敞鍏ョ殑瀛楁淇℃伅 + // 鏌ュ嚭瀛楀吀涓渶瑕佹敞鍏ョ殑瀛楁淇℃伅 List<String> dictList = sysDictDService.selectDictDataByType("flow_variables").stream().map(SysDictData::getDictValue).collect(Collectors.toList()); Map<String, Object> newV = new HashMap<>(2); if (!org.springframework.util.CollectionUtils.isEmpty(variables)) { for (String key : variables.keySet()) { newV.put(task.getTaskDefinitionKey() + "&" + key, variables.get(key)); - //瀛楀吀閲屾湁灏辨斁鍏ユ祦绋嬪彉閲忎腑 + // 瀛楀吀閲屾湁灏变笉鍋氬鐞� if (!CollectionUtils.isEmpty(dictList) && dictList.contains(key)) { - processVariables.put(key,variables.get(key)); + newV.put(key,variables.get(key)); } } } - //娣诲姞娴佺▼鍙橀噺 - if(!processVariables.isEmpty()) taskService.setVariables(taskId,processVariables); taskService.addComment(taskId, task.getProcessInstanceId(), FlowComment.SUBMIT.getType(), "瀹屾垚鎻愪氦"); if (DelegationState.PENDING.equals(task.getDelegationState())) { taskService.resolveTask(taskId, newV); @@ -175,15 +176,146 @@ taskService.complete(taskId, newV); } // 淇濆瓨鏃ュ織 + if (addLog) { + publisher.publishEvent(new TaskLogEvent(this, null, + SecurityUtils.getUserId(), + projectProcess.getProjectId(), + projectProcess.getProcessInsId(), + taskId, + task.getTaskDefinitionKey(), + task.getName(), + ProcessLogEventTypeEnum.FINISHED, + null)); + } + return AjaxResult.success("鎻愪氦鎴愬姛"); + } + + /** + * 瀹圭己琛ヤ氦 + * + * @param taskId 浠诲姟id + * @param variables 琛ㄥ崟鏁版嵁 + * @param addLog + * @return + */ + @Override + @Transactional(rollbackFor = Exception.class) + public AjaxResult waitCompleteSubmitForm(String taskId, Map<String, Object> variables, Boolean addLog) throws IOException { + List<HistoricTaskInstance> hisTasks = historyService.createHistoricTaskInstanceQuery().taskId(taskId).orderByHistoricTaskInstanceStartTime().desc().list(); + if (CollectionUtils.isEmpty(hisTasks) || Objects.isNull(hisTasks.get(0))) { + return AjaxResult.error("浠诲姟涓嶅瓨鍦�"); + } + HistoricTaskInstance task = hisTasks.get(0); + ProjectProcess projectProcess = new LambdaQueryChainWrapper<>(projectProcessMapper) + .eq(ProjectProcess::getProcessInsId, task.getProcessInstanceId()) + .eq(ProjectProcess::getProcessDefId, task.getProcessDefinitionId()) + .one(); + if (Objects.isNull(projectProcess)) { + return AjaxResult.error("椤圭洰娴佺▼鏈粦瀹�"); + } + // 鏌ュ嚭瀛楀吀涓渶瑕佹敞鍏ョ殑瀛楁淇℃伅 + List<String> dictList = sysDictDService.selectDictDataByType("flow_variables").stream().map(SysDictData::getDictValue).collect(Collectors.toList()); + Map<String, Object> newV = new HashMap<>(2); + if (!org.springframework.util.CollectionUtils.isEmpty(variables)) { + for (String key : variables.keySet()) { + newV.put(task.getTaskDefinitionKey() + "&" + key, variables.get(key)); + // 瀛楀吀閲屾湁灏变笉鍋氬鐞� + if (!CollectionUtils.isEmpty(dictList) && dictList.contains(key)) { + newV.put(key,variables.get(key)); + } + } + } + ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(task.getProcessInstanceId()).singleResult(); + Date now = new Date(); + for (String key : newV.keySet()) { + FlowableVarVO var = null; + if (Objects.isNull(processInstance)) { + // 鏌ヨ鍘嗗彶娴佺▼鍙橀噺 + var = projectProcessMapper.getHisByteId(projectProcess.getProcessInsId(), key); + } else { + // 鏌ヨ杩愯鏃舵祦绋嬪彉閲� + var = projectProcessMapper.getRuByteId(projectProcess.getProcessInsId(), key); + } + + if (Objects.isNull(var)) { + // 娌℃湁杩欎釜鍙橀噺鏂板鍗冲彲 + FlowableVarVO run = new FlowableVarVO(); + FlowableVarVO v = new FlowableVarVO(); + v.setNAME_(key); + v.setPROC_INST_ID_(task.getProcessInstanceId()); + v.setEXECUTION_ID_(task.getProcessInstanceId()); + v.setCREATE_TIME_(now); + v.setLAST_UPDATED_TIME_(now); + v.setID_(new StrongUuidGenerator().getNextId()); + + BeanUtils.copyProperties(v, run); + run.setID_(new StrongUuidGenerator().getNextId()); + if (newV.get(key) instanceof String) { + v.setVAR_TYPE_("string"); + v.setTEXT_((String) newV.get(key)); + run.setVAR_TYPE_("string"); + run.setTEXT_((String) newV.get(key)); + } else if (newV.get(key) instanceof Integer) { + v.setVAR_TYPE_("integer"); + v.setLONG_((Long) newV.get(key)); + v.setTEXT_((String) newV.get(key)); + run.setVAR_TYPE_("integer"); + run.setLONG_((Long) newV.get(key)); + run.setTEXT_((String) newV.get(key)); + } else if (newV.get(key) instanceof Long) { + v.setVAR_TYPE_("long"); + v.setLONG_((Long) newV.get(key)); + v.setTEXT_((String) newV.get(key)); + run.setVAR_TYPE_("long"); + run.setLONG_((Long) newV.get(key)); + run.setTEXT_((String) newV.get(key)); + } else if (newV.get(key) instanceof Boolean) { + v.setVAR_TYPE_("boolean"); + v.setLONG_((Long) newV.get(key)); + v.setTEXT_((String) newV.get(key)); + run.setVAR_TYPE_("boolean"); + run.setLONG_((Long) newV.get(key)); + run.setTEXT_((String) newV.get(key)); + } else { + // 鍏跺畠绫诲瀷鐨勮〃鍗曟暟鎹細濡傚浘鐗囥�佹枃浠跺崟鐙瓨琛ㄧ殑銆傚巻鍙层�佽繍琛屼腑鐨勬祦绋嬮渶鍚勫瓨涓�浠� + v.setVAR_TYPE_("serializable"); + v.setBYTEARRAY_ID_(new StrongUuidGenerator().getNextId()); + projectProcessMapper.insertByteArray(v.getBYTEARRAY_ID_(), 1, "hist.var-" + key, newV.get(key)); + + run.setVAR_TYPE_("serializable"); + run.setBYTEARRAY_ID_(new StrongUuidGenerator().getNextId()); + projectProcessMapper.insertByteArray(run.getBYTEARRAY_ID_(), 1, "var-" + key, newV.get(key)); + } + + projectProcessMapper.insertHisFlowableVar(v); + projectProcessMapper.insertRunFlowableVar(run); + } + } + // 淇濆瓨鏃ュ織 publisher.publishEvent(new TaskLogEvent(this, null, SecurityUtils.getUserId(), projectProcess.getProjectId(), projectProcess.getProcessInsId(), taskId, + task.getTaskDefinitionKey(), task.getName(), ProcessLogEventTypeEnum.FINISHED, null)); + return AjaxResult.success("鎻愪氦鎴愬姛"); + } + + // 灏嗗璞¤浆鎹负 byte[] + public static byte[] objectToBytes(Object obj) throws IOException { + if (Objects.isNull(obj)) { + return null; + } + try (ByteArrayOutputStream bos = new ByteArrayOutputStream(); + ObjectOutputStream oos = new ObjectOutputStream(bos)) { + oos.writeObject(obj); // 搴忓垪鍖栧璞� + oos.flush(); + return bos.toByteArray(); // 杩斿洖瀛楄妭鏁扮粍 + } } /** @@ -321,6 +453,7 @@ projectProcess.getProjectId(), projectProcess.getProcessInsId(), flowTaskVo.getTaskId(), + task.getTaskDefinitionKey(), task.getName(), ProcessLogEventTypeEnum.REJECT, new RejectData(flowTaskVo.getComment()))); @@ -1183,8 +1316,9 @@ .list(); //鎵╁睍 鑾峰彇杩欎釜娴佺▼瀹炰緥鐨勭洃鎺т俊鎭� key:TaskId value:瀹炰綋绫� - Map<String, ProcessCoding> processCodingMap = processCodingMapper - .selectList(new QueryWrapper<ProcessCoding>().eq("process_ins_id", procInsId)) + Map<String, ProcessCoding> processCodingMap = new LambdaQueryChainWrapper<>(processCodingMapper) + .eq(ProcessCoding::getProcessInsId, procInsId) + .list() .stream() .collect(Collectors.toMap(ProcessCoding::getTaskId, Function.identity())); // 淇濆瓨宸茬粡瀹屾垚鐨勬祦绋嬭妭鐐圭紪鍙� @@ -1202,6 +1336,8 @@ if (StringUtils.isBlank(s.getDeleteReason())) { flowViewerList.add(flowViewerDto); } + flowViewerDto.setHasJump(processLogService.taskIsJump(s.getTaskId(), procInsId)); + flowViewerDto.setHasWait(processLogService.taskIsWait(s.getTaskId(), procInsId)); }); // 鑾峰彇浠e姙鑺傜偣 @@ -1219,8 +1355,10 @@ // 鎵╁睍鍐呭 浠e姙鐨勯�氳繃褰撳墠鏃堕棿浣滀负endTime ProcessCoding processCoding = processCodingMap.get(s.getTaskId()); //濡傛灉鏈夌洃鎺ф暟鎹� 涓嶅弽鐨勮瘽鍓嶇榛樿鏄繘琛屼腑(钃濊壊) - if (processCoding != null && (RED.equals(processCoding.getStatus()) || YELLOW.equals(processCoding.getStatus()))) { - flowViewerDto.setOvertime(processCoding.getStatus()); + if (Objects.nonNull(processCoding)) { + if (RED.equals(processCoding.getStatus()) || YELLOW.equals(processCoding.getStatus())) { + flowViewerDto.setOvertime(processCoding.getStatus()); + } } flowViewerList.add(flowViewerDto); }); @@ -1264,55 +1402,207 @@ // 鍒ゆ柇鍓嶇疆浠诲姟鏄笉鏄拰褰撳墠浠诲姟涓哄悓涓�涓猠xecuteId // 鍒ゆ柇褰撳墠浠诲姟鏄惁琚寕璧蜂腑 String finalProcessInsId = processInsId; - beforeNodes = beforeNodes.stream().filter(node -> { + List<FormDetailVO> dataList = new ArrayList<>(2); + Map<String, List<FormDetailVO>> map = new HashMap<>(2); + beforeNodes.stream().forEach(node -> { if (node.getCurrent()) { - return Boolean.TRUE; + node.setTaskId(taskId); + dataList.add(node); + } else { + List<HistoricTaskInstance> beforeTasks = historyService.createHistoricTaskInstanceQuery() + .processInstanceId(finalProcessInsId) + .finished() + .taskDefinitionKey(node.getBeforeNodeDefId()) + .orderByTaskCreateTime() + .desc() + .list(); + if (CollectionUtils.isNotEmpty(beforeTasks) && Objects.nonNull(beforeTasks.get(0))) { + node.setTaskId(beforeTasks.get(0).getId()); + List<FormDetailVO> l = map.get(beforeTasks.get(0)); + if (CollectionUtils.isEmpty(l)) { + map.put(beforeTasks.get(0).getExecutionId(), Arrays.asList(node)); + } else { + l.add(node); + } + } } - HistoricTaskInstance beforeTask = historyService.createHistoricTaskInstanceQuery().processInstanceId(finalProcessInsId).finished().taskDefinitionKey(node.getBeforeNodeDefId()).singleResult(); - return Objects.nonNull(beforeTask); - }).collect(Collectors.toList()); - beforeNodes.forEach(node -> { + }); + for (String key : map.keySet()) { + if (StringUtils.isNotBlank(key)) { + // 鍚屼竴鎵ц鍣ㄤ笂鍙彇鏈�杩戠殑涓�涓� + dataList.add(map.get(key).get(0)); + } + } + List<DoFormDetailVO> vos = dataList.stream().map(node -> { if (node.getCurrent()) { if (processLogService.taskIsHangup(taskId, finalProcessInsId)) { node.setTaskStatus(TaskStatusEnum.HANGUP); } } - }); - return AjaxResult.success(beforeNodes); + // 鍒ゆ柇浠诲姟鏄惁瀛樺湪鐗规畩鎿嶄綔(濡傝烦杩囥�佽浆鍔炵瓑)锛岄渶瑕佸湪鍓嶇灞曠ず鍑烘潵 + ProcessLogQuery query = new ProcessLogQuery(); + query.setTaskId(node.getTaskId()); + query.setProcessInsId(finalProcessInsId); + Result result = processLogService.projectProcessLogPage(query); + List<ProcessLogVO> logList = (List<ProcessLogVO>) result.get("data"); + DoFormDetailVO vo = new DoFormDetailVO(); + BeanUtils.copyProperties(node, vo); + if (CollectionUtils.isNotEmpty(logList)) { + vo.setEvents(logList); + } + return vo; + }).collect(Collectors.toList()); + return AjaxResult.success(vos); } @Override - public AjaxResult detail(String taskId) { - Task task = taskService.createTaskQuery().taskId(taskId).singleResult(); + public AjaxResult detail(String processInsId, String taskId) { + ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().includeProcessVariables().processInstanceId(processInsId).singleResult(); // 娴佺▼鍙橀噺 Map<String, Object> parameters = new HashMap<>(); - if (Objects.isNull(task)) { - // 濡傛灉涓虹┖锛屽彲鑳芥槸浠诲姟宸茬粡缁撴潫 - HistoricTaskInstance hisTask = historyService.createHistoricTaskInstanceQuery().taskId(taskId).includeProcessVariables().singleResult(); - if (Objects.isNull(hisTask)) { + if (Objects.isNull(processInstance)) { + + // 濡傛灉涓虹┖锛岃〃鏄庢祦绋嬪凡缁忕粨鏉� + HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().includeProcessVariables().processInstanceId(processInsId).singleResult(); + if (Objects.isNull(historicProcessInstance)) { + throw new RuntimeException("娴佺▼涓嶅瓨鍦�"); + } + + List<HistoricTaskInstance> hisTasks = historyService.createHistoricTaskInstanceQuery() + .taskId(taskId) + .finished() + .includeProcessVariables() + .orderByHistoricTaskInstanceStartTime() + .desc() + .list(); + if (CollectionUtils.isNotEmpty(hisTasks) && Objects.isNull(hisTasks.get(0))) { throw new RuntimeException("璇ヤ换鍔′笉瀛樺湪"); } - parameters = hisTask.getProcessVariables(); + HistoricTaskInstance hisTask = hisTasks.get(0); + parameters = historicProcessInstance.getProcessVariables(); List<FormDetailVO> beforeNodes = this.getBeforeNodeForm(parameters, hisTask.getFormKey(), hisTask.getName(), hisTask.getProcessDefinitionId(), hisTask.getTaskDefinitionKey(), Boolean.TRUE); - List<FormDetailVO> dataList = beforeNodes.stream().filter(node -> { + List<FormDetailVO> dataList = new ArrayList<>(2); + Map<String, List<FormDetailVO>> map = new HashMap<>(2); + beforeNodes.stream().forEach(node -> { if (node.getCurrent()) { - return Boolean.TRUE; + node.setTaskId(taskId); + dataList.add(node); + } else { + List<HistoricTaskInstance> beforeTasks = historyService.createHistoricTaskInstanceQuery() + .processInstanceId(hisTask.getProcessInstanceId()) + .finished() + .taskDefinitionKey(node.getBeforeNodeDefId()) + .orderByTaskCreateTime() + .desc() + .list(); + if (CollectionUtils.isNotEmpty(beforeTasks) && Objects.nonNull(beforeTasks.get(0))) { + node.setTaskId(beforeTasks.get(0).getId()); + List<FormDetailVO> l = map.get(beforeTasks.get(0)); + if (CollectionUtils.isEmpty(l)) { + map.put(beforeTasks.get(0).getExecutionId(), Arrays.asList(node)); + } else { + l.add(node); + } + } } - HistoricTaskInstance beforeTask = historyService.createHistoricTaskInstanceQuery().processInstanceId(hisTask.getProcessInstanceId()).finished().taskDefinitionKey(node.getBeforeNodeDefId()).singleResult(); - return Objects.nonNull(beforeTask); + }); + for (String key : map.keySet()) { + if (StringUtils.isNotBlank(key)) { + // 鍚屼竴鎵ц鍣ㄤ笂鍙彇鏈�杩戠殑涓�涓� + dataList.add(map.get(key).get(0)); + } + } + List<DoFormDetailVO> vos = dataList.stream().map(node -> { + if (node.getCurrent()) { + if (processLogService.taskIsHangup(taskId, hisTask.getProcessInstanceId())) { + node.setTaskStatus(TaskStatusEnum.HANGUP); + } + } + // 鍒ゆ柇浠诲姟鏄惁瀛樺湪鐗规畩鎿嶄綔(濡傝烦杩囥�佽浆鍔炵瓑)锛岄渶瑕佸湪鍓嶇灞曠ず鍑烘潵 + ProcessLogQuery query = new ProcessLogQuery(); + query.setTaskId(node.getTaskId()); + query.setProcessInsId(hisTask.getProcessInstanceId()); + Result result = processLogService.projectProcessLogPage(query); + List<ProcessLogVO> logList = (List<ProcessLogVO>) result.get("data"); + DoFormDetailVO vo = new DoFormDetailVO(); + BeanUtils.copyProperties(node, vo); + if (CollectionUtils.isNotEmpty(logList)) { + vo.setEvents(logList); + } + return vo; }).collect(Collectors.toList()); - return AjaxResult.success(dataList); + return AjaxResult.success(vos); } else { - parameters = taskService.getVariables(taskId); - List<FormDetailVO> beforeNodes = this.getBeforeNodeForm(parameters, task.getFormKey(), task.getName(), task.getProcessDefinitionId(), task.getTaskDefinitionKey(), Boolean.TRUE); - List<FormDetailVO> dataList = beforeNodes.stream().filter(node -> { - if (node.getCurrent()) { - return Boolean.TRUE; + parameters = processInstance.getProcessVariables(); + Task task = taskService.createTaskQuery().taskId(taskId).processInstanceId(processInsId).singleResult(); + List<FormDetailVO> beforeNodes = new ArrayList<>(); + if (Objects.nonNull(task)) { + beforeNodes = this.getBeforeNodeForm(parameters, task.getFormKey(), task.getName(), task.getProcessDefinitionId(), task.getTaskDefinitionKey(), Boolean.TRUE); + } else { + List<HistoricTaskInstance> hisTasks = historyService.createHistoricTaskInstanceQuery() + .taskId(taskId) + .finished() + .includeProcessVariables() + .orderByHistoricTaskInstanceStartTime() + .desc() + .list(); + if (CollectionUtils.isNotEmpty(hisTasks) && Objects.isNull(hisTasks.get(0))) { + throw new RuntimeException("璇ヤ换鍔′笉瀛樺湪"); } - HistoricTaskInstance beforeTask = historyService.createHistoricTaskInstanceQuery().processInstanceId(task.getProcessInstanceId()).finished().taskDefinitionKey(node.getBeforeNodeDefId()).singleResult(); - return Objects.nonNull(beforeTask); + HistoricTaskInstance hisTask = hisTasks.get(0); + beforeNodes = this.getBeforeNodeForm(parameters, hisTask.getFormKey(), hisTask.getName(), hisTask.getProcessDefinitionId(), hisTask.getTaskDefinitionKey(), Boolean.TRUE); + } + List<FormDetailVO> dataList = new ArrayList<>(2); + Map<String, List<FormDetailVO>> map = new HashMap<>(2); + beforeNodes.stream().forEach(node -> { + if (node.getCurrent()) { + node.setTaskId(taskId); + dataList.add(node); + } else { + List<HistoricTaskInstance> beforeTasks = historyService.createHistoricTaskInstanceQuery() + .processInstanceId(processInsId) + .finished() + .taskDefinitionKey(node.getBeforeNodeDefId()) + .orderByTaskCreateTime() + .desc() + .list(); + if (CollectionUtils.isNotEmpty(beforeTasks) && Objects.nonNull(beforeTasks.get(0))) { + node.setTaskId(beforeTasks.get(0).getId()); + List<FormDetailVO> l = map.get(beforeTasks.get(0)); + if (CollectionUtils.isEmpty(l)) { + map.put(beforeTasks.get(0).getExecutionId(), Arrays.asList(node)); + } else { + l.add(node); + } + } + } + }); + for (String key : map.keySet()) { + if (StringUtils.isNotBlank(key)) { + // 鍚屼竴鎵ц鍣ㄤ笂鍙彇鏈�杩戠殑涓�涓� + dataList.add(map.get(key).get(0)); + } + } + List<DoFormDetailVO> vos = dataList.stream().map(node -> { + if (node.getCurrent()) { + if (processLogService.taskIsHangup(taskId, processInsId)) { + node.setTaskStatus(TaskStatusEnum.HANGUP); + } + } + // 鍒ゆ柇浠诲姟鏄惁瀛樺湪鐗规畩鎿嶄綔(濡傝烦杩囥�佽浆鍔炵瓑)锛岄渶瑕佸湪鍓嶇灞曠ず鍑烘潵 + ProcessLogQuery query = new ProcessLogQuery(); + query.setTaskId(node.getTaskId()); + query.setProcessInsId(processInsId); + Result result = processLogService.projectProcessLogPage(query); + List<ProcessLogVO> logList = (List<ProcessLogVO>) result.get("data"); + DoFormDetailVO vo = new DoFormDetailVO(); + BeanUtils.copyProperties(node, vo); + if (CollectionUtils.isNotEmpty(logList)) { + vo.setEvents(logList); + } + return vo; }).collect(Collectors.toList()); - return AjaxResult.success(dataList); + return AjaxResult.success(vos); } } -- Gitblit v1.8.0