diff --git a/src/main/java/com/subsidy/jobs/Scheduler.java b/src/main/java/com/subsidy/jobs/Scheduler.java index e1f42ce..63e5eef 100644 --- a/src/main/java/com/subsidy/jobs/Scheduler.java +++ b/src/main/java/com/subsidy/jobs/Scheduler.java @@ -72,7 +72,7 @@ public class Scheduler { */ //@Scheduled(cron = "0 39 18 * * ?") public void getOprMemRecord() { - Set set = redisUtil.keys("*memberLogin*"); + Set set = redisUtil.scan("*memberLogin*"); if(set != null) { for (String str : set) { int result = (Integer) redisUtil.get(str); diff --git a/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java b/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java index 1ed4138..cf47d81 100644 --- a/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java @@ -468,7 +468,7 @@ public class AdministerServiceImpl extends ServiceImpl summaryTask3(ClassSummaryVO classSummaryVO, Long classId) { //签到总次数 - long signCount = redisUtil.keys("subsidySignInfo*_classId_" + classId + "*").stream().count(); + long signCount = redisUtil.scan("subsidySignInfo*_classId_" + classId + "*").stream().count(); classSummaryVO.setAvgSignCount(MathUtil.intDivCeil(signCount, classSummaryVO.getMemberCount())); return new AsyncResult<>(classSummaryVO); } @@ -600,7 +600,7 @@ public class AdministerServiceImpl extends ServiceImpl classDetailTask3(ClassDetailVO classDetailVO, ClassDetailDTO classDetailDTO) { ////签到次数 - long set = redisUtil.keys(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "memberId_" + classDetailVO.getId() + "_classId_" + classDetailDTO.getId() + "*").stream().count(); + long set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "memberId_" + classDetailVO.getId() + "_classId_" + classDetailDTO.getId() + "*").stream().count(); classDetailVO.setSignCounts(set); return new AsyncResult<>(classDetailVO); } @@ -793,7 +793,7 @@ public class AdministerServiceImpl extends ServiceImpl set = redisUtil.keys(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "memberId_" + classSignVO.getId() + "_classId_" + classDetailDTO.getId() + "*"); + Set set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "memberId_" + classSignVO.getId() + "_classId_" + classDetailDTO.getId() + "*"); classSignVO.setSignCounts(set.size()); StringBuilder stringBuilder = new StringBuilder(); diff --git a/src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java b/src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java index 3318e44..6005cdc 100644 --- a/src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java @@ -103,7 +103,7 @@ public class SignInRecordServiceImpl extends ServiceImpl(classSignInfoVO); } @@ -116,7 +116,7 @@ public class SignInRecordServiceImpl extends ServiceImpl>) redisConnection -> { + Set keys = new HashSet<>(); + Cursor cursor = redisConnection.scan(new ScanOptions.ScanOptionsBuilder().match(pattern).count(1000).build()); + while (cursor.hasNext()) { + keys.add(new String(cursor.next())); + } + return keys; + }); + } + + /** * 使用Redis的消息队列 * @param channel * @param message 消息内容