fix: 修复一些警告

This commit is contained in:
2026-07-12 23:52:01 +08:00
parent 5de965327e
commit 391781306a
6 changed files with 14 additions and 9 deletions
@@ -70,13 +70,23 @@ public class ImportTaskRedisQueue {
* 阻塞读取新消息(>)。
*/
public List<ImportTaskStreamRecord> readNew(String streamKey, String groupName, String consumerName, long blockMs) {
List<MapRecord<String, Object, Object>> records = stringRedisTemplate.opsForStream().read(
StreamOffset<String> offset = StreamOffset.create(streamKey, ReadOffset.lastConsumed());
List<MapRecord<String, Object, Object>> records = readGroup(
Consumer.from(groupName, consumerName),
StreamReadOptions.empty().count(10).block(Duration.ofMillis(Math.max(1, blockMs))),
StreamOffset.create(streamKey, ReadOffset.lastConsumed()));
offset);
return toRecords(streamKey, records);
}
/** 封装 varargs 调用,避免泛型数组类型安全警告。 */
@SafeVarargs
private final List<MapRecord<String, Object, Object>> readGroup(
Consumer consumer,
StreamReadOptions options,
StreamOffset<String>... offsets) {
return stringRedisTemplate.opsForStream().read(consumer, options, offsets);
}
/**
* 回收超时 PEL 消息:先 XPENDING 再 XCLAIM(当前 Spring Data Redis 无 XAUTOCLAIM 封装)。
*/
@@ -37,7 +37,6 @@ public class ImportTaskConsumerServiceImpl implements ImportTaskConsumerService
private final ImportTaskRedisQueue redisQueue;
private final ImportTaskStreamNames streamNames;
private final ImportTaskProperties properties;
private final ImportTaskConsumerNameFactory consumerNameFactory;
private final ImportTaskRecoveryService recoveryService;
private ExecutorService executorService;
@@ -56,7 +55,6 @@ public class ImportTaskConsumerServiceImpl implements ImportTaskConsumerService
this.redisQueue = redisQueue;
this.streamNames = streamNames;
this.properties = properties;
this.consumerNameFactory = consumerNameFactory;
this.recoveryService = recoveryService;
this.consumerName = consumerNameFactory.current();
}
@@ -49,7 +49,6 @@ public class OrderStatCacheService {
}
}
@SuppressWarnings("unchecked")
public <T> T get(String cacheKey, Class<T> type) {
if (!isEnabled() || cacheKey == null) {
return null;
@@ -193,7 +193,6 @@ public class LicenseValidator {
try {
String url = properties.getLicenseServerUrl().replaceAll("/$", "")
+ "/api/licenses/status?jti=" + info.getJti();
@SuppressWarnings("unchecked")
var body = restTemplate.getForObject(URI.create(url), java.util.Map.class);
if (body != null && "revoked".equals(String.valueOf(body.get("status")))) {
revokedJtiSet = new HashSet<>(revokedJtiSet);
@@ -1,6 +1,5 @@
package top.xyquan.ecomdmbbackend.modules.org.position.menu.service.impl;
import top.xyquan.ecomdmbbackend.common.utils.BeanCopyUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
@@ -24,7 +23,6 @@ import top.xyquan.ecomdmbbackend.utils.CurrentUserContext;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
/**