diff --git a/src/main/java/com/spring/GaoTaoApplication.java b/src/main/java/com/spring/GaoTaoApplication.java index e4b68ca1..129452aa 100644 --- a/src/main/java/com/spring/GaoTaoApplication.java +++ b/src/main/java/com/spring/GaoTaoApplication.java @@ -2,9 +2,11 @@ package com.spring; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.scheduling.annotation.EnableScheduling; @SpringBootApplication +@EnableScheduling public class GaoTaoApplication { public static void main(String[] args) { diff --git a/src/main/java/com/spring/modules/cdc/task/GatherDataTask.java b/src/main/java/com/spring/modules/cdc/task/GatherDataTask.java index 2948ea8b..963e953b 100644 --- a/src/main/java/com/spring/modules/cdc/task/GatherDataTask.java +++ b/src/main/java/com/spring/modules/cdc/task/GatherDataTask.java @@ -92,7 +92,7 @@ public class GatherDataTask { log.info("IP:{} 连接成功!!!",ip); for (Device device : deviceList) { List c1 = collectService.lambdaQuery().in(Collect::getCollectDesc, device.getDeviceType()).eq(Collect::getActive, "Y").list(); - int i = CollectUtils.readXMZValue(siemensS7Net, device.getDeviceAddress()); + int i = CollectUtils.readXMZValue(siemensS7Net, device.getDeviceIp()); log.info("设备:{} 读取值:{}",device.getDeviceDesc(),i); CollectRecord collectRecord = getCollectRecord(device, c1, i); collectRecordService.insertCollectRecord(collectRecord); @@ -117,7 +117,7 @@ public class GatherDataTask { log.info("IP:{} 连接成功!!!",ip); for (Device device : deviceList) { List c1 = collectService.lambdaQuery().in(Collect::getCollectDesc, device.getDeviceType()).eq(Collect::getActive, "Y").list(); - int i = CollectUtils.readSLValue(melsecMcNet, device.getDeviceAddress()); + int i = CollectUtils.readSLValue(melsecMcNet, device.getDeviceIp()); log.info("设备:{} 读取值:{}",device.getDeviceDesc(),i); CollectRecord collectRecord = getCollectRecord(device, c1, i); collectRecordService.insertCollectRecord(collectRecord); @@ -142,7 +142,7 @@ public class GatherDataTask { log.info("IP:{} 连接成功!!!",ip); for (Device device : deviceList) { List c1 = collectService.lambdaQuery().in(Collect::getCollectDesc, device.getDeviceType()).eq(Collect::getActive, "Y").list(); - int i = CollectUtils.readSLValue(melsecMcNet, device.getDeviceAddress()); + int i = CollectUtils.readSLValue(melsecMcNet, device.getDeviceIp()); log.info("设备:{} 读取值:{}",device.getDeviceDesc(),i); CollectRecord collectRecord = getCollectRecord(device, c1, i); collectRecordService.insertCollectRecord(collectRecord); diff --git a/src/main/java/com/spring/modules/cdc/utils/CollectUtils.java b/src/main/java/com/spring/modules/cdc/utils/CollectUtils.java index bf8adbb0..ba5e4af1 100644 --- a/src/main/java/com/spring/modules/cdc/utils/CollectUtils.java +++ b/src/main/java/com/spring/modules/cdc/utils/CollectUtils.java @@ -15,7 +15,7 @@ public class CollectUtils { int value = readResult.Content; return value; } else { - System.out.println("读取失败: " + readResult.ToMessageShowString()); + log.info("读取失败: {}" + readResult.ToMessageShowString(),address); return -1; } } @@ -26,7 +26,7 @@ public class CollectUtils { int value = readResult.Content; return value; } else { - System.out.println("读取失败: " + readResult.ToMessageShowString()); + log.info("读取失败: {}" + readResult.ToMessageShowString(),address); return -1; } }