From e75abff0e743fe1c83abeb64f2fe562bbf9ba07c Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期一, 03 三月 2025 11:32:01 +0800 Subject: [PATCH] bug --- business/src/main/java/com/ycl/service/impl/FlowTaskServiceImpl.java | 103 +++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 90 insertions(+), 13 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 d638720..c1585ec 100644 --- a/business/src/main/java/com/ycl/service/impl/FlowTaskServiceImpl.java +++ b/business/src/main/java/com/ycl/service/impl/FlowTaskServiceImpl.java @@ -23,9 +23,11 @@ import com.ycl.domain.dto.FlowTaskDto; import com.ycl.domain.dto.FlowViewerDto; import com.ycl.domain.entity.ProcessCoding; +import com.ycl.domain.entity.ProcessLog; import com.ycl.domain.entity.ProjectProcess; import com.ycl.domain.entity.SysForm; import com.ycl.domain.json.RejectData; +import com.ycl.domain.vo.DoFormDetailVO; import com.ycl.domain.vo.FlowQueryVo; import com.ycl.domain.vo.FlowTaskVo; import com.ycl.domain.vo.FormDetailVO; @@ -68,12 +70,14 @@ 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.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.io.InputStream; import java.lang.reflect.Field; +import java.math.BigDecimal; import java.nio.charset.StandardCharsets; import java.util.*; import java.util.concurrent.ConcurrentHashMap; @@ -160,7 +164,14 @@ newV.put(task.getTaskDefinitionKey() + "&" + key, variables.get(key)); //瀛楀吀閲屾湁灏辨斁鍏ユ祦绋嬪彉閲忎腑 if (!CollectionUtils.isEmpty(dictList) && dictList.contains(key)) { - processVariables.put(key,variables.get(key)); + if ("money".equals(key)) { + // 涓囧厓杞厓 + Object w = variables.get(key); + BigDecimal y = new BigDecimal(w.toString()).multiply(new BigDecimal(10000)); + processVariables.put(key, y); + } else { + processVariables.put(key,variables.get(key)); + } } } } @@ -180,6 +191,7 @@ projectProcess.getProjectId(), projectProcess.getProcessInsId(), taskId, + task.getTaskDefinitionKey(), task.getName(), ProcessLogEventTypeEnum.FINISHED, null)); @@ -321,6 +333,7 @@ projectProcess.getProjectId(), projectProcess.getProcessInsId(), flowTaskVo.getTaskId(), + task.getTaskDefinitionKey(), task.getName(), ProcessLogEventTypeEnum.REJECT, new RejectData(flowTaskVo.getComment()))); @@ -1183,8 +1196,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())); // 淇濆瓨宸茬粡瀹屾垚鐨勬祦绋嬭妭鐐圭紪鍙� @@ -1264,20 +1278,39 @@ // 鍒ゆ柇鍓嶇疆浠诲姟鏄笉鏄拰褰撳墠浠诲姟涓哄悓涓�涓猠xecuteId // 鍒ゆ柇褰撳墠浠诲姟鏄惁琚寕璧蜂腑 String finalProcessInsId = processInsId; - beforeNodes.stream().filter(node -> { + beforeNodes = beforeNodes.stream().filter(node -> { if (node.getCurrent()) { return Boolean.TRUE; } - HistoricTaskInstance beforeTask = historyService.createHistoricTaskInstanceQuery().processInstanceId(finalProcessInsId).finished().taskDefinitionKey(node.getBeforeNodeDefId()).singleResult(); - return Objects.nonNull(beforeTask); - }).forEach(node -> { + List<HistoricTaskInstance> beforeTasks = historyService.createHistoricTaskInstanceQuery() + .processInstanceId(finalProcessInsId) + .finished() + .taskDefinitionKey(node.getBeforeNodeDefId()) + .orderByTaskCreateTime() + .desc() + .list(); + return CollectionUtils.isNotEmpty(beforeTasks) && Objects.nonNull(beforeTasks.get(0)); + }).collect(Collectors.toList()); + List<DoFormDetailVO> vos = beforeNodes.stream().map(node -> { if (node.getCurrent()) { if (processLogService.taskIsHangup(taskId, finalProcessInsId)) { node.setTaskStatus(TaskStatusEnum.HANGUP); } } - }); - return AjaxResult.success(beforeNodes); + // 鍒ゆ柇浠诲姟鏄惁瀛樺湪鐗规畩鎿嶄綔(濡傝烦杩囥�佽浆鍔炵瓑)锛岄渶瑕佸湪鍓嶇灞曠ず鍑烘潵 + List<ProcessLog> logList = new LambdaQueryChainWrapper<>(processLogService.getBaseMapper()) + .eq(ProcessLog::getTaskDefKey, node.getBeforeNodeDefId()) + .eq(ProcessLog::getProcessInsId, finalProcessInsId) + .orderByDesc(ProcessLog::getGmtCreate) + .list(); + 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 @@ -1300,7 +1333,26 @@ HistoricTaskInstance beforeTask = historyService.createHistoricTaskInstanceQuery().processInstanceId(hisTask.getProcessInstanceId()).finished().taskDefinitionKey(node.getBeforeNodeDefId()).singleResult(); return Objects.nonNull(beforeTask); }).collect(Collectors.toList()); - return AjaxResult.success(dataList); + List<DoFormDetailVO> vos = dataList.stream().map(node -> { + if (node.getCurrent()) { + if (processLogService.taskIsHangup(taskId, hisTask.getProcessInstanceId())) { + node.setTaskStatus(TaskStatusEnum.HANGUP); + } + } + // 鍒ゆ柇浠诲姟鏄惁瀛樺湪鐗规畩鎿嶄綔(濡傝烦杩囥�佽浆鍔炵瓑)锛岄渶瑕佸湪鍓嶇灞曠ず鍑烘潵 + List<ProcessLog> logList = new LambdaQueryChainWrapper<>(processLogService.getBaseMapper()) + .eq(ProcessLog::getTaskId, hisTask.getId()) + .eq(ProcessLog::getProcessInsId, hisTask.getProcessInstanceId()) + .orderByDesc(ProcessLog::getGmtCreate) + .list(); + DoFormDetailVO vo = new DoFormDetailVO(); + BeanUtils.copyProperties(node, vo); + if (CollectionUtils.isNotEmpty(logList)) { + vo.setEvents(logList); + } + return vo; + }).collect(Collectors.toList()); + 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); @@ -1308,10 +1360,35 @@ if (node.getCurrent()) { return Boolean.TRUE; } - HistoricTaskInstance beforeTask = historyService.createHistoricTaskInstanceQuery().processInstanceId(task.getProcessInstanceId()).finished().taskDefinitionKey(node.getBeforeNodeDefId()).singleResult(); - return Objects.nonNull(beforeTask); + List<HistoricTaskInstance> beforeTaskList = historyService.createHistoricTaskInstanceQuery() + .processInstanceId(task.getProcessInstanceId()) + .finished() + .taskDefinitionKey(node.getBeforeNodeDefId()) + .orderByTaskCreateTime() + .desc() + .list(); + return CollectionUtils.isNotEmpty(beforeTaskList) && Objects.nonNull(beforeTaskList.get(0)); }).collect(Collectors.toList()); - return AjaxResult.success(dataList); + List<DoFormDetailVO> vos = dataList.stream().map(node -> { + if (node.getCurrent()) { + if (processLogService.taskIsHangup(taskId, task.getProcessInstanceId())) { + node.setTaskStatus(TaskStatusEnum.HANGUP); + } + } + // 鍒ゆ柇浠诲姟鏄惁瀛樺湪鐗规畩鎿嶄綔(濡傝烦杩囥�佽浆鍔炵瓑)锛岄渶瑕佸湪鍓嶇灞曠ず鍑烘潵 + List<ProcessLog> logList = new LambdaQueryChainWrapper<>(processLogService.getBaseMapper()) + .eq(ProcessLog::getTaskId, task.getId()) + .eq(ProcessLog::getProcessInsId, task.getProcessInstanceId()) + .orderByDesc(ProcessLog::getGmtCreate) + .list(); + DoFormDetailVO vo = new DoFormDetailVO(); + BeanUtils.copyProperties(node, vo); + if (CollectionUtils.isNotEmpty(logList)) { + vo.setEvents(logList); + } + return vo; + }).collect(Collectors.toList()); + return AjaxResult.success(vos); } } -- Gitblit v1.8.0