cl
7 天以前 9b6fd1e261d3e6546d300ff1f8b875b3a105c451
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/CloudWmsNotifyLogServiceImpl.java
@@ -22,16 +22,22 @@
    @Override
    public List<CloudWmsNotifyLog> listPending(int limit, int maxRetry) {
        Page<CloudWmsNotifyLog> page = new Page<>(1, Math.max(1, limit));
        LambdaQueryWrapper<CloudWmsNotifyLog> wrapper = new LambdaQueryWrapper<CloudWmsNotifyLog>()
                // 仅查询数据库配置状态:待通知 + 失败(可重试)
                .in(CloudWmsNotifyLog::getNotifyStatus, getNotifyStatusPending(), getNotifyStatusFail())
                // 仅查询可重试数据:无限重试、未配置上限、或未达到上限
                .apply("(max_retry_count IS NULL OR max_retry_count = -1 OR retry_count < max_retry_count)")
                // 仅查询已到重试时间的数据,避免前 50 条未到间隔导致后续记录长期饥饿
                .apply("(last_notify_time IS NULL OR retry_interval_seconds IS NULL OR retry_interval_seconds <= 0 OR TIMESTAMPDIFF(SECOND, last_notify_time, NOW()) >= retry_interval_seconds)")
                .orderByAsc(CloudWmsNotifyLog::getLastNotifyTime)
                .orderByAsc(CloudWmsNotifyLog::getId);
        if (maxRetry >= 0) {
            wrapper.lt(CloudWmsNotifyLog::getRetryCount, maxRetry);
        }
        if (limit < 0) {
            return list(wrapper);
        }
        Page<CloudWmsNotifyLog> page = new Page<>(1, Math.max(1, limit));
        return page(page, wrapper).getRecords();
    }
@@ -61,7 +67,10 @@
    }
    private String getConfigString(String flag, String defaultVal) {
        Config c = configService.getOne(new LambdaQueryWrapper<Config>().eq(Config::getFlag, flag).last("LIMIT 1"));
        Config c = configService.getOne(new LambdaQueryWrapper<Config>()
                .eq(Config::getFlag, flag)
                .orderByDesc(Config::getId)
                .last("LIMIT 1"));
        if (c != null && c.getVal() != null && !c.getVal().isEmpty()) {
            return c.getVal().trim();
        }
@@ -85,7 +94,10 @@
    /** 返回 null 表示未配置或解析失败 */
    private Integer getConfigInt(String flag) {
        try {
            Config c = configService.getOne(new LambdaQueryWrapper<Config>().eq(Config::getFlag, flag).last("LIMIT 1"));
            Config c = configService.getOne(new LambdaQueryWrapper<Config>()
                    .eq(Config::getFlag, flag)
                    .orderByDesc(Config::getId)
                    .last("LIMIT 1"));
            if (c != null && c.getVal() != null && !c.getVal().isEmpty()) {
                return Integer.parseInt(c.getVal().trim());
            }