| | |
| | | * 步骤: |
| | | * 1. 获取当前用户部门ID和用户ID |
| | | * 2. 判断是否为管理员,设置状态列表 |
| | | * 3. 根据事件状态参数调整状态列表 |
| | | * 4. 查询分页数据 |
| | | * 3. 根据includeReturned参数决定是否包含已退回状态 |
| | | * 4. 根据事件状态参数调整状态列表 |
| | | * 5. 查询分页数据 |
| | | * </p> |
| | | * |
| | | * @param page 分页对象 |
| | | * @param onlyMine 是否仅我的数据 |
| | | * @param keyword 事件编号关键字 |
| | | * @param eventStatus 事件状态 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @param page 分页对象 |
| | | * @param onlyMine 是否仅我的数据 |
| | | * @param keyword 事件编号关键字 |
| | | * @param eventStatus 事件状态 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @param includeReturned 是否包含已退回数据,1为是,0为否 |
| | | * @return 分页数据 |
| | | */ |
| | | @Override |
| | | public IPage<GdClueEventListVO> pageGdClueEventByDept(IPage<GdClueEventListVO> page, Integer onlyMine, String keyword, |
| | | Integer eventStatus, String startTime, String endTime) { |
| | | Integer eventStatus, String startTime, String endTime, Integer includeReturned) { |
| | | // 1. 获取当前用户部门ID和用户ID |
| | | Long deptId = null; |
| | | Long userId = null; |
| | |
| | | |
| | | // 2. 判断是否为管理员 |
| | | boolean isAdmin = AuthUtil.isAdministrator() || AuthUtil.isAdmin(); |
| | | |
| | | if (!isAdmin) { |
| | | // 非管理员:获取部门ID和用户ID |
| | | deptId = Long.valueOf(AuthUtil.getDeptId()); |
| | | mine = onlyMine == null ? 0 : onlyMine; |
| | | if (mine == 1) { |
| | | // 管理员:仅查询当前用户数据 |
| | | userId = AuthUtil.getUserId(); |
| | | mine = onlyMine == null ? 0 : onlyMine; |
| | | // 非管理员:排除已退回状态(状态2) |
| | | statusList = java.util.Arrays.asList(0, 1, 3, 4); |
| | | } else { |
| | | // 管理员:可以查询所有状态 |
| | | statusList = java.util.Arrays.asList(0, 1, 2, 3, 4); |
| | | } |
| | | |
| | | // 3. 如果指定了事件状态,优先使用指定的状态 |
| | | // 3. 根据includeReturned参数构建状态列表 |
| | | boolean shouldIncludeReturned = includeReturned != null && includeReturned == 1; |
| | | if (!isAdmin) { |
| | | // 非管理员:获取部门ID |
| | | deptId = Long.valueOf(AuthUtil.getDeptId()); |
| | | // 非管理员:根据includeReturned参数决定是否包含已退回状态(状态2) |
| | | statusList = java.util.Arrays.asList(0, 1, 3, 4); |
| | | } else { |
| | | // 管理员:根据includeReturned参数决定是否包含已退回状态 |
| | | if (shouldIncludeReturned) { |
| | | statusList = java.util.Arrays.asList(0, 1, 2, 3, 4); |
| | | } else { |
| | | statusList = java.util.Arrays.asList(0, 1, 3, 4); |
| | | } |
| | | } |
| | | |
| | | // 4. 如果指定了事件状态,优先使用指定的状态 |
| | | if (eventStatus != null) { |
| | | // 检查指定的状态是否在允许的状态列表中 |
| | | if (statusList.contains(eventStatus)) { |
| | | statusList = java.util.Arrays.asList(eventStatus); |
| | | } else { |
| | | // 如果指定的状态不在允许列表中(如非管理员查询状态2),返回空结果 |
| | | // 如果指定的状态不在允许列表中,返回空结果 |
| | | statusList = java.util.Collections.emptyList(); |
| | | } |
| | | } |
| | | |
| | | // 4. 查询分页数据 |
| | | // 5. 查询分页数据 |
| | | return page.setRecords(baseMapper.selectGdClueEventSimpleList(page, deptId, userId, mine, keyword, statusList, startTime, endTime)); |
| | | } |
| | | |
| | |
| | | |
| | | if (isAdmin) { |
| | | // 管理员:可以查询所有状态 |
| | | statusList = java.util.Arrays.asList(0, 1, 2, 3, 4); |
| | | userId = AuthUtil.getUserId(); |
| | | statusList = java.util.Arrays.asList(0, 1, 3, 4); |
| | | } else { |
| | | deptId = Long.valueOf(AuthUtil.getDeptId()); |
| | | userId = AuthUtil.getUserId(); |
| | |
| | | GdClueEventCountVO empty = new GdClueEventCountVO(); |
| | | empty.setTotalCount(0L); |
| | | empty.setMyCount(0L); |
| | | empty.setReturnedCount(0L); |
| | | empty.setDisposingCount(0L); |
| | | empty.setDisposedCount(0L); |
| | | empty.setCompletedCount(0L); |
| | | return empty; |
| | |
| | | if (taskResult == null || (taskResult.getIsDeleted() != null && taskResult.getIsDeleted() != 0)) { |
| | | throw new RuntimeException("成果不存在"); |
| | | } |
| | | // 判断是否已分发, 不为空,并且不能是退回状态,则不能分发 |
| | | if (taskResult.getDistributeStatus() != null && !EventStatusEnum.RETURNED.getCode().equals(taskResult.getDistributeStatus())) { |
| | | // 判断是否已分发,只有"已退回(2)"和"待确认(0)"状态才允许分发,其他状态均不能分发 |
| | | if (!EventStatusEnum.RETURNED.getCode().equals(taskResult.getDistributeStatus()) |
| | | && !EventStatusEnum.PENDING_CONFIRM.getCode().equals(taskResult.getDistributeStatus())) { |
| | | throw new RuntimeException("成果已分发,无法再次分发"); |
| | | } |
| | | |
| | | // 查看事件直接是否分发过 |
| | | GdClueEventEntity clueEvent = getOne(Wrappers.<GdClueEventEntity>query().lambda() |
| | | .eq(GdClueEventEntity::getResultId, distributeParam.getResultId()) |
| | |
| | | clueEvent = new GdClueEventEntity(); |
| | | } |
| | | clueEvent.setResultId(distributeParam.getResultId()); |
| | | clueEvent.setWorkOrderId(distributeParam.getWorkOrderId()); |
| | | clueEvent.setWorkOrderId(taskResult.getPatrolTaskId()); |
| | | clueEvent.setDisposeUser(distributeParam.getDisposeUser()); |
| | | clueEvent.setDisposeDept(distributeParam.getDisposeDept()); |
| | | clueEvent.setLongitude(distributeParam.getLongitude()); |