fuliqi
2024-12-26 b809036ade43c97f86a0802fed57177884cc61f7
flowable/src/main/java/com/ycl/service/impl/FlowTaskServiceImpl.java
@@ -792,6 +792,11 @@
                    .processInstanceId(procInsId)
                    .orderByHistoricActivityInstanceStartTime()
                    .desc().list();
            Date now =new Date();
            //扩展
            List<HistoricTaskInstance> taskList = historyService.createHistoricTaskInstanceQuery()
                    .processInstanceId(procInsId)
                    .list();
            List<FlowTaskDto> hisFlowList = new ArrayList<>();
            for (HistoricActivityInstance histIns : list) {
                // 展示开始节点
@@ -850,6 +855,23 @@
                    }
                    flowTask.setDuration(histIns.getDurationInMillis() == null || histIns.getDurationInMillis() == 0 ? null : getDate(histIns.getDurationInMillis()));
                    String taskId = histIns.getTaskId();
                    //扩展 判断是否超时
                    for (HistoricTaskInstance taskInstance : taskList) {
                        Date dueDate = taskInstance.getDueDate();
                        //找到对应任务节点
                        if(dueDate!=null && taskInstance.getId().equals(taskId) ) {
                            //如果任务还没完成
                            if(flowTask.getDuration()==null) {
                                //判断当前时间是否超过到期时间
                                if (now.after(dueDate)) flowTask.setOvertime(Boolean.TRUE);
                            }else {
                                //如果任务节点已经完成了,用完成时间判断
                                if(histIns.getEndTime().after(dueDate)) flowTask.setOvertime(Boolean.TRUE);
                            }
                        }
                    }
                    // 获取意见评论内容
                    List<Comment> commentList = taskService.getProcessInstanceComments(histIns.getProcessInstanceId());
                    commentList.forEach(comment -> {
@@ -1095,9 +1117,15 @@
    @Override
    public AjaxResult flowXmlAndNode(String procInsId, String deployId) {
        try {
            Date now = new Date();
            List<FlowViewerDto> flowViewerList = new ArrayList<>();
            // 获取已经完成的节点
            List<HistoricActivityInstance> listFinished = historyService.createHistoricActivityInstanceQuery()
                    .processInstanceId(procInsId)
                    .finished()
                    .list();
            //获取所有任务节点信息(扩展)
            List<HistoricTaskInstance> taskList = historyService.createHistoricTaskInstanceQuery()
                    .processInstanceId(procInsId)
                    .finished()
                    .list();
@@ -1107,6 +1135,15 @@
                FlowViewerDto flowViewerDto = new FlowViewerDto();
                flowViewerDto.setKey(s.getActivityId());
                flowViewerDto.setCompleted(true);
                //扩展内容 已完成的用完成时间判断
                Date endTime = s.getEndTime();
                for (HistoricTaskInstance task : taskList) {
                    if(s.getTaskId()!=null && s.getTaskId().equals(task.getId())){
                        if(task.getDueDate()!=null && endTime.after(task.getDueDate())){
                            flowViewerDto.setOvertime(true);
                        }
                    }
                }
                // 退回节点不进行展示
                if (StringUtils.isBlank(s.getDeleteReason())) {
                    flowViewerList.add(flowViewerDto);
@@ -1126,6 +1163,14 @@
                FlowViewerDto flowViewerDto = new FlowViewerDto();
                flowViewerDto.setKey(s.getActivityId());
                flowViewerDto.setCompleted(false);
                //扩展内容 代办的通过当前时间去判断
                for (HistoricTaskInstance task : taskList) {
                    if(s.getTaskId()!=null && s.getTaskId().equals(task.getId())){
                        if(task.getDueDate()!=null && now.after(task.getDueDate())){
                            flowViewerDto.setOvertime(true);
                        }
                    }
                }
                flowViewerList.add(flowViewerDto);
            });
            Map<String, Object> result = new HashMap();