| | |
| | | .likeRight(XpSchedulingDetail::getPlanTime, LocalDate.now().minusDays(1))); |
| | | |
| | | if(!CollectionUtils.isEmpty(clockOutPlanList)){ |
| | | List<Long> fleetIds = clockOutPlanList.stream().map(XpSchedulingDetail::getFleetId).collect(Collectors.toList()); |
| | | List<Long> fleetIds = clockOutPlanList.stream().map(XpSchedulingDetail::getFleetId).distinct().collect(Collectors.toList()); |
| | | // 查询所有车队的绑定人员 |
| | | List<XpFleetOperations> xpFleetOperations = xpFleetOperationsClient.getOperationsIdsByFleetIds(fleetIds).getData(); |
| | | // 查询班次 |
| | | List<Long> shiftIds = clockOutPlanList.stream().map(XpSchedulingDetail::getShiftId).collect(Collectors.toList()); |
| | | List<XpShift> xpShifts = xpShiftService.list(Wrappers.lambdaQuery(XpShift.class) |
| | | .eq(XpShift::getId, shiftIds)); |
| | | .in(XpShift::getId, shiftIds)); |
| | | log.info("========== 查询到{}个车队 ==========", xpFleetOperations.size()); |
| | | if(!CollectionUtils.isEmpty(xpShifts) && !CollectionUtils.isEmpty(xpFleetOperations)){ |
| | | // 处理上班卡缺卡情况 |
| | |
| | | .map(XpFleetOperations::getOperationsUserId).distinct().collect(Collectors.toList()); |
| | | // 批量查询人员打卡信息 |
| | | List<XpClockIn> clockInList = xpClockInService.list(Wrappers.lambdaQuery(XpClockIn.class) |
| | | .eq(XpClockIn::getAppUserId, operationsUserIds)); |
| | | .in(XpClockIn::getAppUserId, operationsUserIds)); |
| | | // 判断有哪些人员没有打卡信息 |
| | | List<Long> noClockInUserIds = operationsUserIds.stream().filter(id -> clockInList.stream().noneMatch(clockIn -> clockIn.getAppUserId().equals(id))).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(noClockInUserIds)){ |
| | |
| | | } |
| | | if (!CollectionUtils.isEmpty(noClockInList)){ |
| | | log.info("添加上班缺卡信息:{}", noClockInList); |
| | | xpClockInService.saveOrUpdateBatch(noClockInList); |
| | | xpClockInService.saveBatch(noClockInList); |
| | | } |
| | | } |
| | | } |
| | |
| | | List<Long> fiveIds = shiftListFive.stream().map(XpShift::getId).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(fiveIds)){ |
| | | log.info("========== 进入下班过期的班次 =========="); |
| | | List<XpSchedulingDetail> clockOutPlans = clockOutPlanList.stream().filter(xpSchedulingDetail -> fiveIds.contains(xpSchedulingDetail.getShiftId())).collect(Collectors.toList()); |
| | | List<Long> fleetIdOut = clockOutPlans.stream().map(XpSchedulingDetail::getFleetId).collect(Collectors.toList()); |
| | | // 查询所有车队的绑定人员 |
| | | List<XpFleetOperations> xpFleetOperationsList = xpFleetOperationsClient.getOperationsIdsByFleetIds(fleetIdOut).getData(); |
| | | // 获取过期当前班次的排班明细 覆盖 |
| | | List<XpSchedulingDetail> fiveClockOutPlans = clockOutPlanList.stream().filter(xpSchedulingDetail -> fiveIds.contains(xpSchedulingDetail.getShiftId())).collect(Collectors.toList()); |
| | | List<Long> fiveFleetIdIn = fiveClockOutPlans.stream().map(XpSchedulingDetail::getFleetId).collect(Collectors.toList()); |
| | | // 查询所有车队的绑定人员 |
| | | if(!CollectionUtils.isEmpty(xpFleetOperations)){ |
| | | List<Long> operationsUserIdsFive = xpFleetOperations.stream().filter(x -> fiveFleetIdIn.contains(x.getFleetId())) |
| | | if(!CollectionUtils.isEmpty(xpFleetOperationsList)){ |
| | | List<Long> operationsUserIdsFive = xpFleetOperationsList.stream().filter(x -> fiveFleetIdIn.contains(x.getFleetId())) |
| | | .map(XpFleetOperations::getOperationsUserId).distinct().collect(Collectors.toList()); |
| | | // 批量查询人员打卡信息 |
| | | List<XpClockIn> clockInListFive = xpClockInService.list(Wrappers.lambdaQuery(XpClockIn.class) |
| | | .eq(XpClockIn::getAppUserId, operationsUserIdsFive) |
| | | .in(XpClockIn::getAppUserId, operationsUserIdsFive) |
| | | .isNull(XpClockIn::getClockOutTime)); |
| | | log.info("========== 获取到{}个人员没有下班打卡信息 ==========", clockInListFive.size()); |
| | | if(!CollectionUtils.isEmpty(clockInListFive)){ |
| | | for (XpClockIn xpClockIn : clockInListFive) { |
| | | xpClockIn.setClockOutTime(LocalDateTime.now()); |
| | | xpClockIn.setClockOutResult(3); |
| | | xpClockIn.setAppUserId(null); |
| | | } |
| | | xpClockInService.updateBatchById(clockInListFive); |
| | | log.info("========== 修改为下班缺卡 =========="); |
| | |
| | | // 批量查询人员打卡信息 |
| | | List<XpClockIn> clockInListFive = xpClockInService.list(Wrappers.lambdaQuery(XpClockIn.class) |
| | | .in(XpClockIn::getAppUserId, operationsUserIdsFive) |
| | | .likeRight(XpClockIn::getClockInTime,LocalDate.now().minusDays(1)) |
| | | .isNull(XpClockIn::getClockOutTime)); |
| | | log.info("========== 获取到{}个人员没有下班打卡信息 ==========", clockInListFive.size()); |
| | | if(!CollectionUtils.isEmpty(clockInListFive)){ |