From 640b68436ecd7876041cc6931cb916bbe368ccc3 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期二, 22 十月 2024 13:46:38 +0800
Subject: [PATCH] #
---
zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/KernelScheduler.java | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/KernelScheduler.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/KernelScheduler.java
index 24f9ba0..d7b7119 100644
--- a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/KernelScheduler.java
+++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/KernelScheduler.java
@@ -14,6 +14,7 @@
import com.zy.acs.manager.manager.service.BusService;
import com.zy.acs.manager.manager.service.SegmentService;
import com.zy.acs.manager.manager.service.TaskService;
+import com.zy.acs.manager.system.service.ConfigService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
@@ -48,9 +49,12 @@
private SegmentService segmentService;
@Autowired
private TrafficService trafficService;
+ @Autowired
+ private ConfigService configService;
@Scheduled(cron = "0/3 * * * * ? ")
private void startupBus() throws InterruptedException {
+ if (!configService.getVal("TaskAssignMode", Boolean.class)) { return; }
if (!this.lock.tryLock(LOCK_TIMEOUT, TimeUnit.SECONDS)) { return; }
List<Bus> busList = busService.selectBySts(BusStsType.RECEIVE);
for (Bus bus : busList) {
@@ -116,6 +120,15 @@
}
if (finish) {
bus.setBusSts(BusStsType.FINISH.val());
+ bus.setEndTime(new Date());
+ bus.setUpdateTime(new Date());
+ if (!busService.updateById(bus)) {
+ log.error("Bus [{}] 鏇存柊澶辫触 锛侊紒锛�", bus.getUuid());
+ }
+ }
+ long cancelNum = taskList.stream().filter(task -> TaskStsType.CANCEL.val() == task.getTaskSts()).count();
+ if (cancelNum == taskList.size()) {
+ bus.setBusSts(BusStsType.CANCEL.val());
bus.setUpdateTime(new Date());
if (!busService.updateById(bus)) {
log.error("Bus [{}] 鏇存柊澶辫触 锛侊紒锛�", bus.getUuid());
--
Gitblit v1.9.1