fix: 修复排队状态查询逻辑
当任务没有 receiver_dept_id 时,从 task_unlock_status 表中查询对应的部门ID
This commit is contained in:
parent
4d4b1e2189
commit
bf2f720fe7
@ -187,14 +187,27 @@ public class TaskItemService {
|
|||||||
// 确定目标部门
|
// 确定目标部门
|
||||||
Long targetDeptId = deptId;
|
Long targetDeptId = deptId;
|
||||||
if (targetDeptId == null) {
|
if (targetDeptId == null) {
|
||||||
|
// 优先使用已接单的部门
|
||||||
targetDeptId = item.getReceiverDeptId();
|
targetDeptId = item.getReceiverDeptId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (targetDeptId == null) {
|
||||||
|
// 🔥 从 task_unlock_status 表中查询该任务对应的部门
|
||||||
|
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<com.designhub.entity.TaskUnlockStatus> wrapper =
|
||||||
|
new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(com.designhub.entity.TaskUnlockStatus::getTaskItemId, item.getId())
|
||||||
|
.last("LIMIT 1");
|
||||||
|
com.designhub.entity.TaskUnlockStatus unlockStatus = taskUnlockService.getUnlockStatusMapper().selectOne(wrapper);
|
||||||
|
if (unlockStatus != null) {
|
||||||
|
targetDeptId = unlockStatus.getDeptId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 填充解锁状态
|
// 填充解锁状态
|
||||||
if (targetDeptId != null) {
|
if (targetDeptId != null) {
|
||||||
taskUnlockService.fillUnlockStatus(item, targetDeptId, releaseType);
|
taskUnlockService.fillUnlockStatus(item, targetDeptId, releaseType);
|
||||||
} else {
|
} else {
|
||||||
// 无法确定部门,默认可抢
|
// 无法确定部门,默认可抢(兼容旧数据)
|
||||||
item.setUnlockStatus("unlocked");
|
item.setUnlockStatus("unlocked");
|
||||||
item.setCanGrab(true);
|
item.setCanGrab(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -46,6 +46,13 @@ public class TaskUnlockService {
|
|||||||
private static final int DEFAULT_DAILY_UNLOCK_MIN = 5;
|
private static final int DEFAULT_DAILY_UNLOCK_MIN = 5;
|
||||||
private static final int DEFAULT_BATCH_SIZE = 5;
|
private static final int DEFAULT_BATCH_SIZE = 5;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取 TaskUnlockStatusMapper(供其他 Service 使用)
|
||||||
|
*/
|
||||||
|
public TaskUnlockStatusMapper getUnlockStatusMapper() {
|
||||||
|
return unlockStatusMapper;
|
||||||
|
}
|
||||||
|
|
||||||
// ==================== 配置相关 ====================
|
// ==================== 配置相关 ====================
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user