rev:自动线程修改

This commit is contained in:
2026-07-16 16:43:37 +08:00
parent 1ab6715791
commit e76507fb9e
3 changed files with 8 additions and 2 deletions

View File

@@ -53,7 +53,8 @@ public class DeviceExecuteAutoRunable extends AbstractAutoRunnable {
@Override
public void autoRun() throws Exception {
for (int i = 0; !OpcConfig.OPC_START_TAG; ++i) {
// TODO本项目没有OPC
/*for (int i = 0; !OpcConfig.OPC_START_TAG; ++i) {
log.info("设备执行线程等待opc同步线程...");
Thread.sleep(1000L);
if (i > 60) {
@@ -87,6 +88,6 @@ public class DeviceExecuteAutoRunable extends AbstractAutoRunnable {
executorService.submit(runnable);
}
}
}
}*/
}
}

View File

@@ -21,6 +21,7 @@ public class AutoRunController {
@Log("查询自动线程")
@GetMapping
public ResponseEntity<Object> query(Map map) throws Exception {
List<AutoRunDto> ThreadDtos = autoRunService.findAll();
return new ResponseEntity<>(PageUtil.toPage(ThreadDtos, ThreadDtos.size()), HttpStatus.OK);

View File

@@ -2,6 +2,7 @@ package org.nl.acs.autoThread.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.nl.ApplicationAutoInitial;
@@ -79,6 +80,9 @@ public class AutoRunServiceImpl implements AutoRunService, ApplicationAutoInitia
AutoRunDto autoRunDto = new AutoRunDto();
BeanUtil.copyProperties(autoRunnable, autoRunDto, true);
Thread thread = code_Thread_Map.get(autoRunnable.getCode());
if (ObjectUtil.isEmpty(thread)) {
continue;
}
autoRunDto.setCode(autoRunnable.getCode());
autoRunDto.setName(autoRunnable.getName());
autoRunDto.setThread_alive(thread.isAlive());