瀏覽代碼

s7设备删除时删除连接池连接

fenze 7 月之前
父節點
當前提交
74b2048876

+ 1 - 1
jeecg-module-conn/src/main/java/org/jeecg/modules/watch/PushWatch.java

@@ -34,7 +34,7 @@ import java.util.List;
 
 
 @Component
-@EnableScheduling
+//@EnableScheduling
 public class PushWatch {
     @Autowired
     MongoUtil mongoUtil;

+ 8 - 0
jeecg-module-gather/src/main/java/org/jeecg/modules/device/controller/DeviceInformationController.java

@@ -31,6 +31,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import lombok.extern.slf4j.Slf4j;
 
 import org.jeecg.common.system.base.controller.JeecgController;
+import org.jeecg.modules.watch.s7gatherWatch;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
 import org.jeecgframework.poi.excel.def.NormalExcelConstants;
 import org.jeecgframework.poi.excel.entity.ExportParams;
@@ -63,6 +64,8 @@ public class DeviceInformationController extends JeecgController<DeviceInformati
 	private IDeviceInformationService deviceInformationService;
 	@Autowired
 	private IDeviceRegionService deviceRegionService;
+	@Autowired
+	private s7gatherWatch s7gatherWatch;
 
 	/**
 	 * 分页列表查询
@@ -113,6 +116,7 @@ public class DeviceInformationController extends JeecgController<DeviceInformati
 	@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
 	public Result<String> edit(@RequestBody DeviceInformation deviceInformation) {
 		deviceInformationService.updateById(deviceInformation);
+		s7gatherWatch.closeS7(deviceInformation.getId());
 		return Result.OK("编辑成功!");
 	}
 	
@@ -128,6 +132,7 @@ public class DeviceInformationController extends JeecgController<DeviceInformati
 	@DeleteMapping(value = "/delete")
 	public Result<String> delete(@RequestParam(name="id",required=true) String id) {
 		deviceInformationService.removeById(id);
+		s7gatherWatch.closeS7(id);
 		return Result.OK("删除成功!");
 	}
 	
@@ -143,6 +148,9 @@ public class DeviceInformationController extends JeecgController<DeviceInformati
 	@DeleteMapping(value = "/deleteBatch")
 	public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
 		this.deviceInformationService.removeByIds(Arrays.asList(ids.split(",")));
+		Arrays.asList(ids.split(",")).forEach(id->{
+			s7gatherWatch.closeS7(id);
+		});
 		return Result.OK("批量删除成功!");
 	}
 	

+ 1 - 1
jeecg-module-gather/src/main/java/org/jeecg/modules/watch/DbWatch.java

@@ -16,7 +16,7 @@ import org.springframework.stereotype.Component;
 
 import java.util.Calendar;
 
-@EnableScheduling
+//@EnableScheduling
 @EnableAsync
 @Component
 @Slf4j

+ 1 - 1
jeecg-module-gather/src/main/java/org/jeecg/modules/watch/OpcGatherWatch.java

@@ -23,7 +23,7 @@ import java.util.List;
 @Slf4j
 @EnableAsync
 @Component
-@EnableScheduling
+//@EnableScheduling
 public class OpcGatherWatch {
 
     @Autowired

+ 1 - 1
jeecg-module-gather/src/main/java/org/jeecg/modules/watch/modBusGatherWatch.java

@@ -22,7 +22,7 @@ import java.util.List;
 @Slf4j
 @EnableAsync
 @Component
-@EnableScheduling
+//@EnableScheduling
 public class modBusGatherWatch {
 
     @Autowired

+ 1 - 1
jeecg-module-gather/src/main/java/org/jeecg/modules/watch/s7gatherWatch.java

@@ -21,7 +21,7 @@ import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 
-@EnableScheduling
+//@EnableScheduling
 @EnableAsync
 @Component
 @Slf4j