| | |
| | | import com.ycl.domain.entity.*; |
| | | import com.ycl.domain.form.*; |
| | | import com.ycl.domain.json.*; |
| | | import com.ycl.domain.query.ProcessLogQuery; |
| | | import com.ycl.domain.vo.*; |
| | | import com.ycl.event.event.TaskLogEvent; |
| | | import com.ycl.mapper.ProjectEngineeringMapper; |
| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ycl.domain.query.ProjectProcessQuery; |
| | | import com.ycl.service.common.TaskCommonService; |
| | | import com.ycl.system.domain.base.AbsQuery; |
| | | import com.ycl.system.service.ISysDeptService; |
| | | import com.ycl.system.service.ISysDictTypeService; |
| | | import com.ycl.system.service.ISysRoleService; |
| | |
| | | .endOr(); |
| | | } |
| | | result.total(taskQuery.count()); |
| | | List<Task> taskList = taskQuery.listPage(pageSize * (pageNum - 1), pageSize); |
| | | List<Task> allTodoList = taskQuery.list(); |
| | | List<TaskOrderVO> orderList = new ArrayList<>(); |
| | | allTodoList.stream().forEach(task -> { |
| | | TaskOrderVO order = new TaskOrderVO(); |
| | | order.setTaskId(task.getId()); |
| | | // 计算办理时间,超时的排前面,没超时的由低到高排序,没超时时间的排最后 |
| | | ProcessCoding processCoding = processCodingService.getByTaskId(task.getId(), task.getProcessInstanceId()); |
| | | if (Objects.nonNull(processCoding)) { |
| | | if (StringUtils.isNotBlank(processCoding.getRedTime())) { |
| | | Long overtime = getTime(processCoding.getRedTime()); |
| | | long durationTime = 0l; |
| | | if (Objects.nonNull(processCoding.getStartTaskTime())) { |
| | | durationTime = ((new Date()).getTime() - processCoding.getStartTaskTime().getTime()) / 1000; |
| | | } |
| | | if (overtime > durationTime) { |
| | | order.setNum((overtime - durationTime) / 3600); |
| | | } else { |
| | | order.setNum(-2000000L); |
| | | } |
| | | } else { |
| | | order.setNum(2000000L); |
| | | } |
| | | } else { |
| | | order.setNum(2000000L); |
| | | } |
| | | orderList.add(order); |
| | | }); |
| | | // 升序排列 |
| | | Collections.sort(orderList, Comparator.comparingLong(TaskOrderVO::getNum)); |
| | | int startNum = pageSize * (pageNum - 1); |
| | | int endNum = startNum + pageSize; |
| | | if (startNum >= orderList.size()) { |
| | | result.data(new ArrayList<>()).total(0L); |
| | | return; |
| | | } |
| | | int end = Math.min(endNum, orderList.size()); |
| | | List<String> targetTaskIds = orderList.subList(startNum, end).stream().map(TaskOrderVO::getTaskId).collect(Collectors.toList()); |
| | | List<Task> taskList = targetTaskIds.stream().map(taskId -> { |
| | | List<Task> list = allTodoList.stream().filter(task -> task.getId().equals(taskId)).collect(Collectors.toList()); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return null; |
| | | } |
| | | return list.get(0); |
| | | }).filter(Objects::nonNull).collect(Collectors.toList()); |
| | | List<IndexCustomerTaskVO> vos = new ArrayList<>(); |
| | | for (Task task : taskList) { |
| | | IndexCustomerTaskVO taskVO = new IndexCustomerTaskVO(); |
| | |
| | | return Result.ok("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public Result getProcessMsg(AbsQuery q) { |
| | | // 查自己的日志 |
| | | ProcessLogQuery query = new ProcessLogQuery(); |
| | | if (! SecurityUtils.isAdmin(SecurityUtils.getUserId())) { |
| | | query.setUserId(SecurityUtils.getUserId()); |
| | | } |
| | | query.setEventTypeList(Arrays.asList(ProcessLogEventTypeEnum.DELEGATE.getValue(), |
| | | ProcessLogEventTypeEnum.REJECT.getValue(), |
| | | ProcessLogEventTypeEnum.JUMP.getValue(), |
| | | ProcessLogEventTypeEnum.FINISHED.getValue(), |
| | | ProcessLogEventTypeEnum.WAIT.getValue())); |
| | | query.setCurrentPage(q.getCurrentPage()); |
| | | query.setPageSize(q.getPageSize()); |
| | | Result result = processLogService.projectProcessLogPage(query); |
| | | List<ProcessLogVO> logs = (List<ProcessLogVO>) result.get("data"); |
| | | |
| | | logs.stream().forEach(log -> { |
| | | if (ProcessLogEventTypeEnum.FINISHED.equals(log.getEventType())) { |
| | | log.setContent("您完成了任务:" + log.getTaskName()); |
| | | } else if (ProcessLogEventTypeEnum.REJECT.equals(log.getEventType())) { |
| | | log.setContent("您驳回了任务:" + log.getTaskName()); |
| | | } else if (ProcessLogEventTypeEnum.WAIT.equals(log.getEventType())) { |
| | | log.setContent("您容缺了任务:" + log.getTaskName()); |
| | | } else if (ProcessLogEventTypeEnum.JUMP.equals(log.getEventType())) { |
| | | log.setContent("您跳过了任务:" + log.getTaskName()); |
| | | } |
| | | }); |
| | | return Result.ok().data(logs).total((Long) result.get("total")); |
| | | } |
| | | |
| | | /** |
| | | * 查询待办任务 |
| | | * |