fuliqi
2024-10-14 e4c69bcd4ba18dd022dd4ed86da96c5e4b8b3150
ycl-server/src/main/java/com/ycl/task/PlatformTask.java
@@ -44,11 +44,11 @@
    private static final String DICT_TYPE = "platform_online";
    private static final ExecutorService executorService = new ThreadPoolExecutor(8,
            24,
    private static final ExecutorService executorService = new ThreadPoolExecutor(16,
            128,
            5000,
            TimeUnit.SECONDS,
            new ArrayBlockingQueue<>(10),
            new ArrayBlockingQueue<>(1000),
            new ThreadPoolExecutor.CallerRunsPolicy()
    );
@@ -81,7 +81,6 @@
                    log.error("检查平台连通性时发生错误", e);
                }
            });
            executorService.shutdown();
        }
    }
@@ -100,20 +99,18 @@
            Object outLineTime = redisTemplate.opsForValue().get(REDIS_KEY_PREFIX + platform.getPlatformIP());
            Integer outlineTimeSed = Objects.isNull(outLineTime) ? 0 : (Integer) outLineTime;
            PlatformOnline one = new LambdaQueryChainWrapper<>(platformOnlineService.getBaseMapper())
                    .eq(PlatformOnline::getPlatformIp, platform.getPlatformIP())
                    .eq(PlatformOnline::getPlatformId, platform.getId())
                    .eq(PlatformOnline::getCreateDate, sqlDate)
                    .one();
            if (Objects.isNull(one)) {
                one = new PlatformOnline();
                one.setPlatformIp(platform.getPlatformIP());
                one.setPlatformName(platform.getPlatformName());
                one.setPlatformId(platform.getId());
                one.setCreateDate(sqlDate);
                one.setTodayOutlineSed(outlineTimeSed);
            } else {
                one.setTodayOutlineSed(one.getTodayOutlineSed() + outlineTimeSed);
            }
            one.setPlatformIp(platform.getPlatformIP());
            one.setPlatformName(platform.getPlatformName());
            one.setPlatformId(platform.getId());
            one.setCreateDate(sqlDate);
            platformOnlineService.saveOrUpdate(one);