fix: top up queued tasks per department on approval
This commit is contained in:
parent
2331aec8c0
commit
7010098ab3
@ -425,6 +425,7 @@ public class TaskUnlockService {
|
||||
|
||||
LocalDate publishDate = task.getCreateTime() != null ? task.getCreateTime().toLocalDate() : LocalDate.now();
|
||||
int addedRows = 0;
|
||||
Set<Long> affectedDeptIds = new LinkedHashSet<>();
|
||||
|
||||
for (TaskItem item : items) {
|
||||
if (item.getId() == null) {
|
||||
@ -441,12 +442,28 @@ public class TaskUnlockService {
|
||||
if (deptId == null) {
|
||||
continue;
|
||||
}
|
||||
addedRows += unlockStatusMapper.insertIfNotExists(item.getId(), deptId, publishDate, 0);
|
||||
int inserted = unlockStatusMapper.insertIfNotExists(item.getId(), deptId, publishDate, 0);
|
||||
addedRows += inserted;
|
||||
if (inserted > 0) {
|
||||
affectedDeptIds.add(deptId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (addedRows > 0) {
|
||||
log.info("任务 {} 已写入 {} 条排队记录", task.getTaskNo(), addedRows);
|
||||
|
||||
int minUnlockedCount = getDailyUnlockMin();
|
||||
for (Long deptId : affectedDeptIds) {
|
||||
try {
|
||||
int unlocked = unlockTasksForDept(deptId, minUnlockedCount);
|
||||
if (unlocked > 0) {
|
||||
log.info("任务 {} 入队后,为部门 {} 立即补充解锁 {} 个任务", task.getTaskNo(), deptId, unlocked);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("任务 {} 入队后补充部门 {} 可接任务失败: {}", task.getTaskNo(), deptId, e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1916,7 +1916,7 @@
|
||||
|
||||
<a-alert
|
||||
message="功能说明"
|
||||
description="启用任务排队机制后,新发布的任务会进入排队池,系统每天凌晨1点自动解锁一批任务。确保发布时间早的任务优先被处理,避免任务积压。指定任务和流水线任务不受此限制。"
|
||||
description="启用任务排队机制后,新发布的任务会进入排队池。系统会按接单部门维度维持可接任务数量:新任务入队时会立即补足,每天凌晨1点也会继续检查并补充,确保发布时间早的任务优先被处理,避免任务积压。指定任务不受此限制。"
|
||||
type="info"
|
||||
show-icon
|
||||
style="margin-bottom: 24px;"
|
||||
@ -1943,7 +1943,7 @@
|
||||
style="width: 200px;"
|
||||
/>
|
||||
<div style="margin-top: 8px; font-size: 12px; color: #888;">
|
||||
每个接单部门每天凌晨自动解锁的最少任务数量(按发布时间从早到晚解锁)
|
||||
每个接单部门至少维持的可接任务数量。新任务入队和每天凌晨检查时,都会按发布时间从早到晚补足到这个数量
|
||||
</div>
|
||||
</a-form-item>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user