From 092c7132a48494d69ebb3f72ff8cab3379f7c9ab Mon Sep 17 00:00:00 2001
From: 彭雪彬 <1724387007@qq.com>
Date: Wed, 03 Sep 2025 16:48:32 +0800
Subject: [PATCH] 骑手收入明细查询
---
oying-common/src/main/java/com/oying/utils/RedisUtils.java | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/oying-common/src/main/java/com/oying/utils/RedisUtils.java b/oying-common/src/main/java/com/oying/utils/RedisUtils.java
index 4467f18..361c573 100644
--- a/oying-common/src/main/java/com/oying/utils/RedisUtils.java
+++ b/oying-common/src/main/java/com/oying/utils/RedisUtils.java
@@ -392,6 +392,27 @@
}
}
+ /**
+ * 分布式ID生成器
+ *
+ * @param key 键
+ * @param value 值
+ * @param time 时间(秒) time要大于0 如果time小于等于0 将设置无限期,注意:这里将会替换原有的时间
+ * @return true成功 false 失败
+ */
+ public boolean setIfAbsent(String key, Object value, long time) {
+ try {
+ if (time > 0) {
+ Boolean result = redisTemplate.opsForValue().setIfAbsent(key, value, time, TimeUnit.SECONDS);
+ return result;
+ } else {
+ return false;
+ }
+ } catch (Exception e) {
+ log.error(e.getMessage(), e);
+ return false;
+ }
+ }
// ================================Map=================================
/**
--
Gitblit v1.9.3