refactor(schedule): 重构调度线程任务初始化逻辑
- 移除BeanUtil等无关注入工具类 - 使用SpringUtils手动获取依赖服务实例 - 调整设备读取逻辑,从连接判断改为直接加载列表 - 注释掉部分冗余或暂时不用的启动线程代码 - 新增对TSJ、CDZ等设备的支持与初始化配置 - 更新XML映射文件中的SQL查询条件及格式化内容 - 优化SRGV任务中断处理逻辑,增加break语句防止空循环 - 暂时注释实际下发指令方法以避免执行真实操作
This commit is contained in:
@@ -11,9 +11,12 @@ import com.ruoyi.device.ssj.service.IDeviceSsjService;
|
||||
import com.ruoyi.schedule.plcRead.ddj.PlcDdjRead;
|
||||
import com.ruoyi.schedule.plcRead.srgv.PlcSrgvRead;
|
||||
import com.ruoyi.schedule.plcRead.ssj.PlcSsjRead;
|
||||
import com.ruoyi.schedule.scheduleTask.cdz.CdzThread;
|
||||
import com.ruoyi.schedule.scheduleTask.ddj.impl.Ddj1Thread;
|
||||
import com.ruoyi.schedule.scheduleTask.monit.MonitoringThread;
|
||||
import com.ruoyi.schedule.scheduleTask.srgv.impl.SRgv1Thread;
|
||||
import com.ruoyi.schedule.scheduleTask.ssj.SsjThread;
|
||||
import com.ruoyi.schedule.scheduleTask.tsj.TsjThread;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -34,6 +37,9 @@ public class ScheduleThread {
|
||||
|
||||
public CustomThread<MonitoringThread> monitoringCustomThread;
|
||||
public CustomThread<SsjThread> ssjThreadCustomThread;
|
||||
public CustomThread<SRgv1Thread> sRgvThreadCustomThread;
|
||||
public CustomThread<TsjThread> tsjThreadCustomThread;
|
||||
public CustomThread<CdzThread> cdzThreadCustomThread;
|
||||
// public CustomThread<Ddj1Thread> ddj1CustomThread;
|
||||
/*public CustomThread<Ddj2Thread> ddj2CustomThread;
|
||||
public CustomThread<Ddj3Thread> ddj3CustomThread;
|
||||
@@ -43,8 +49,6 @@ public class ScheduleThread {
|
||||
@Autowired
|
||||
private IDeviceSsjService deviceSsjService;
|
||||
@Autowired
|
||||
private IMsgDdjService msgDdjService;
|
||||
@Autowired
|
||||
private IDeviceSrgvService deviceSrgvService;
|
||||
|
||||
private boolean isRun = false;
|
||||
@@ -71,6 +75,12 @@ public class ScheduleThread {
|
||||
monitoringCustomThread = new CustomThread<MonitoringThread>(new Thread(monitoringThread), monitoringThread);
|
||||
SsjThread ssjThread=new SsjThread();
|
||||
ssjThreadCustomThread=new CustomThread<SsjThread>(new Thread(ssjThread),ssjThread);
|
||||
SRgv1Thread srgvThread=new SRgv1Thread();
|
||||
sRgvThreadCustomThread=new CustomThread<>(new Thread(srgvThread),srgvThread);
|
||||
TsjThread tsjThread=new TsjThread();
|
||||
tsjThreadCustomThread=new CustomThread<>(new Thread(tsjThread),tsjThread);
|
||||
CdzThread cdzThread = new CdzThread();
|
||||
cdzThreadCustomThread=new CustomThread<>(new Thread(cdzThread),cdzThread);
|
||||
// Ddj1Thread ddj1Thread = new Ddj1Thread();
|
||||
// ddj1CustomThread = new CustomThread<>(new Thread(ddj1Thread), ddj1Thread);
|
||||
/*Ddj2Thread ddj2Thread = new Ddj2Thread();
|
||||
@@ -135,8 +145,9 @@ public class ScheduleThread {
|
||||
public void startAllThread() {
|
||||
plcSsjReadCustomThread.getThread().start();
|
||||
plcSrgvReadCustomThread1.getThread().start();
|
||||
plcSrgvReadCustomThread2.getThread().start();
|
||||
plcSrgvReadCustomThread3.getThread().start();
|
||||
//plcSrgvReadCustomThread2.getThread().start();
|
||||
//plcSrgvReadCustomThread3.getThread().start();
|
||||
|
||||
|
||||
isRun = true;
|
||||
}
|
||||
@@ -147,6 +158,9 @@ public class ScheduleThread {
|
||||
public void startAllThread2() {
|
||||
monitoringCustomThread.thread.start();
|
||||
ssjThreadCustomThread.thread.start();
|
||||
//tsjThreadCustomThread.thread.start();
|
||||
sRgvThreadCustomThread.thread.start();
|
||||
//cdzThreadCustomThread.thread.start();
|
||||
// ddj1CustomThread.thread.start();
|
||||
/*ddj2CustomThread.thread.start();
|
||||
ddj3CustomThread.thread.start();
|
||||
|
||||
Reference in New Issue
Block a user