修改了自动派单排序

This commit is contained in:
2025-08-29 17:19:48 +08:00
parent ce0c4b201c
commit 659f3089e4

View File

@@ -239,14 +239,15 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService {
LocalDate today = LocalDate.now();
// 1. 获取今日排班人员(优先查缓存,未命中则查询数据库并缓存)
List<AttendanceUserGroup> attendanceUserGroups = RedisUtils.getCacheList(DateUtil.today());
if (CollUtil.isEmpty(attendanceUserGroups)) {
attendanceUserGroups = attendanceUserGroupMapper.selectList(
new LambdaQueryWrapper<AttendanceUserGroup>()
.le(AttendanceUserGroup::getStartDate, today)
.ge(AttendanceUserGroup::getEndDate, today)
.eq(AttendanceUserGroup::getDeptId, serviceWorkOrders.getCreateDept())
.orderByAsc(AttendanceUserGroup::getStartDate)
);
List<AttendanceUserGroup> attendanceUserGroupList = attendanceUserGroupMapper.selectList(
new LambdaQueryWrapper<AttendanceUserGroup>()
.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);