感知设备心跳

develop
Angel 10 months ago
parent dd086364a1
commit ad134f2b7d

@ -45,25 +45,10 @@ public class DevopeDeviceTask {
Page<TJksbglMysql> page = new Page<>(1, 1000); Page<TJksbglMysql> page = new Page<>(1, 1000);
List<TJksbglMysql> resultList = jksbglMysqlService.page(page, queryWrapper).getRecords(); List<TJksbglMysql> resultList = jksbglMysqlService.page(page, queryWrapper).getRecords();
// CountDownLatch latch = new CountDownLatch(resultList.size());
// ExecutorService DevicePool = Executors.newFixedThreadPool(5);
for (TJksbglMysql bean : resultList) { for (TJksbglMysql bean : resultList) {
// DevicePool.submit(() -> {
cleanJksbInfo(bean); cleanJksbInfo(bean);
logger.info("清洗完成"); logger.info("清洗完成");
// latch.countDown();
// });
} }
// try {
// //Wait for all threads to complete
// latch.await();
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
// //关闭线程池
// DevicePool.shutdown();
} catch (Exception e) { } catch (Exception e) {
logger.info(StringKit.getTrace(e)); logger.info(StringKit.getTrace(e));
} }
@ -84,7 +69,6 @@ public class DevopeDeviceTask {
deviceStatus.setDeviceIp(jksbglMysqlCp.getIpdz()); deviceStatus.setDeviceIp(jksbglMysqlCp.getIpdz());
deviceInfo.setDeviceMac(jksbglMysqlCp.getMacdz()); deviceInfo.setDeviceMac(jksbglMysqlCp.getMacdz());
deviceInfo.setDeviceSn(jksbglMysqlCp.getId()); deviceInfo.setDeviceSn(jksbglMysqlCp.getId());
deviceStatus.setDeviceCode(jksbglMysqlCp.getId());
if (jksbglMysqlCp.getSbdk() != null && !jksbglMysqlCp.getSbdk().isEmpty()) { if (jksbglMysqlCp.getSbdk() != null && !jksbglMysqlCp.getSbdk().isEmpty()) {
deviceInfo.setDevicePort(Integer.parseInt(jksbglMysqlCp.getSbdk())); deviceInfo.setDevicePort(Integer.parseInt(jksbglMysqlCp.getSbdk()));
} else { } else {
@ -116,6 +100,7 @@ public class DevopeDeviceTask {
} else { } else {
deviceStatus.setIsOnline(null); deviceStatus.setIsOnline(null);
} }
deviceStatus.setHeartbeatTime(System.currentTimeMillis()/1000);
deviceInfo.setDeviceAddress(jksbglMysqlCp.getAzdz()); deviceInfo.setDeviceAddress(jksbglMysqlCp.getAzdz());
boolean a = devopsDeviceInfoService.save(deviceInfo); boolean a = devopsDeviceInfoService.save(deviceInfo);
boolean b = deviceStatusService.save(deviceStatus); boolean b = deviceStatusService.save(deviceStatus);

Loading…
Cancel
Save