【修改】 修改学生端倒计时闪烁补充项
This commit is contained in:
@@ -402,6 +402,8 @@ public class AutoToolsController {
|
|||||||
stringRedisTemplate.opsForValue().set(key, JsonUtils.toJsonString(info));
|
stringRedisTemplate.opsForValue().set(key, JsonUtils.toJsonString(info));
|
||||||
monitorMapper.updateById(info);
|
monitorMapper.updateById(info);
|
||||||
}
|
}
|
||||||
|
// 删除对应任务
|
||||||
|
taskManager.stopTaskByUserId(userId);
|
||||||
return CommonResult.success(true);
|
return CommonResult.success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -412,13 +414,9 @@ public class AutoToolsController {
|
|||||||
* @return true
|
* @return true
|
||||||
*/
|
*/
|
||||||
@GetMapping("/stopExamForAdmin")
|
@GetMapping("/stopExamForAdmin")
|
||||||
public CommonResult<Boolean> stopExamForAdmin(@RequestParam("userId") String userId, @RequestParam("taskId") String taskId, @RequestParam("paperNum") String paperNum) {
|
public CommonResult<Boolean> stopExamForAdmin(@RequestParam("userId") String userId) {
|
||||||
String paperId = educationPaperService.selectPaperByPaperNum(paperNum);
|
|
||||||
// 将userId 拼接 taskId 作为key
|
|
||||||
// 防止不同试卷ID冲突
|
|
||||||
userId += "_" + taskId + "_" + paperId;
|
|
||||||
// 删除对应的线程池
|
// 删除对应的线程池
|
||||||
taskManager.stopTask(userId);
|
taskManager.stopTaskByUserId(userId);
|
||||||
return CommonResult.success(true);
|
return CommonResult.success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -95,9 +95,13 @@ public class TaskManager {
|
|||||||
|
|
||||||
/**通过ID结束任务*/
|
/**通过ID结束任务*/
|
||||||
public void stopTaskByUserId(String userId) {
|
public void stopTaskByUserId(String userId) {
|
||||||
tasks.keySet().stream()
|
String taskId = tasks.keySet().stream()
|
||||||
.filter(key -> key.startsWith(userId + "_"))
|
.filter(key -> key.startsWith(userId + "_"))
|
||||||
.findFirst().ifPresent(this::stopTask);
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
if (taskId != null) {
|
||||||
|
stopTask(taskId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user