diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/ServiceWorkOrdersServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/ServiceWorkOrdersServiceImpl.java index 870b515d..4acdfb3f 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/ServiceWorkOrdersServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/ServiceWorkOrdersServiceImpl.java @@ -239,14 +239,15 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService { LocalDate today = LocalDate.now(); // 1. 获取今日排班人员(优先查缓存,未命中则查询数据库并缓存) List attendanceUserGroups = RedisUtils.getCacheList(DateUtil.today()); - if (CollUtil.isEmpty(attendanceUserGroups)) { - attendanceUserGroups = attendanceUserGroupMapper.selectList( - new LambdaQueryWrapper() - .le(AttendanceUserGroup::getStartDate, today) - .ge(AttendanceUserGroup::getEndDate, today) - .eq(AttendanceUserGroup::getDeptId, serviceWorkOrders.getCreateDept()) - .orderByAsc(AttendanceUserGroup::getStartDate) - ); + List attendanceUserGroupList = attendanceUserGroupMapper.selectList( + new LambdaQueryWrapper() + .le(AttendanceUserGroup::getStartDate, today) + .ge(AttendanceUserGroup::getEndDate, today) + .eq(AttendanceUserGroup::getDeptId, serviceWorkOrders.getCreateDept()) + .orderByAsc(AttendanceUserGroup::getStartDate) + ); + if (CollUtil.isEmpty(attendanceUserGroups)|| attendanceUserGroups.size() != attendanceUserGroupList.size()) { + attendanceUserGroups=attendanceUserGroupList; Assert.isTrue(CollUtil.isNotEmpty(attendanceUserGroups), "暂无排班人员"); // 缓存当天排班数据(假设当天不会变) RedisUtils.setCacheList(DateUtil.today(), attendanceUserGroups);