fix: CacheManager 消除双括号初始化,改用标准 HashMap 写法

This commit is contained in:
yukaidi
2026-05-29 02:55:32 +08:00
parent fa4028296f
commit da715c8a8f

View File

@@ -153,13 +153,13 @@ public class CacheManager {
getShareKeyTotal(shareKey, fieldLower).onSuccess(total -> { getShareKeyTotal(shareKey, fieldLower).onSuccess(total -> {
Integer newTotal = (total == null ? 0 : total) + 1; Integer newTotal = (total == null ? 0 : total) + 1;
Map<String, Object> updateParams = new HashMap<>();
updateParams.put("panType", getShareType(shareKey));
updateParams.put("shareKey", shareKey);
updateParams.put("total", newTotal);
updateParams.put("ts", System.currentTimeMillis());
SqlTemplate.forUpdate(jdbcPool, sql) SqlTemplate.forUpdate(jdbcPool, sql)
.execute(new HashMap<>() {{ .execute(updateParams)
put("panType", getShareType(shareKey));
put("shareKey", shareKey);
put("total", newTotal);
put("ts", System.currentTimeMillis());
}})
.onSuccess(res -> promise.complete(res.rowCount())) .onSuccess(res -> promise.complete(res.rowCount()))
.onFailure(e->{ .onFailure(e->{
promise.fail(e); promise.fail(e);
@@ -265,10 +265,9 @@ public class CacheManager {
.onSuccess(res -> { .onSuccess(res -> {
if(res.iterator().hasNext()) { if(res.iterator().hasNext()) {
JsonObject next = res.iterator().next(); JsonObject next = res.iterator().next();
Map<String, Integer> resp = new HashMap<>(){{ Map<String, Integer> resp = new HashMap<>();
put("hit_total" ,next.getInteger("hit_total")); resp.put("hit_total", next.getInteger("hit_total"));
put("parser_total" ,next.getInteger("parser_total")); resp.put("parser_total", next.getInteger("parser_total"));
}};
promise.complete(resp); promise.complete(resp);
} else { } else {
promise.complete(); promise.complete();