From d0c69bbbcab31a9e0a65cead86e4d40afa1cab9e Mon Sep 17 00:00:00 2001 From: DengMin <16679070171@qq.com> Date: Tue, 8 Feb 2022 13:59:03 +0800 Subject: [PATCH] 签到记录修改 --- src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java | 8 ++++++++ src/main/java/com/subsidy/util/RedisUtil.java | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java b/src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java index f22cab8..6849279 100644 --- a/src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java @@ -28,12 +28,14 @@ import com.subsidy.vo.sign.SignInStatusVO; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.text.SimpleDateFormat; import java.time.LocalDateTime; import java.time.ZoneOffset; import java.util.Date; import java.util.List; +import java.util.Set; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -75,12 +77,18 @@ public class SignInRecordServiceImpl extends ServiceImpl classDictDOS = classMemberMappingMapper.getMemberClass(signInRecordDO.getMemberId()); for (ClassDictDO classDictDO : classDictDOS) { + Set set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + signInRecordDO.getMemberId() + ":classId:" + classDictDO.getId() + ":" + DateFormatUtil.format(new Date(), "yyyy-MM-dd")+":*"); + if(set.size() > 0) { + redisUtil.del(set); + } + redisUtil.set(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + signInRecordDO.getMemberId() + ":classId:" + classDictDO.getId() + ":" + DateFormatUtil.format(new Date(), "yyyy-MM-dd") + ":" + System.currentTimeMillis(), null); } diff --git a/src/main/java/com/subsidy/util/RedisUtil.java b/src/main/java/com/subsidy/util/RedisUtil.java index f8d317a..6ca603e 100644 --- a/src/main/java/com/subsidy/util/RedisUtil.java +++ b/src/main/java/com/subsidy/util/RedisUtil.java @@ -102,6 +102,16 @@ public class RedisUtil { } } + /** + * 删除缓存 + * @param key 集合数据 + */ + public void del(Set key) { + if (key != null && key.size() > 0) { + redisTemplate.delete(key); + } + } + //============================String============================= /** * 普通缓存获取 -- libgit2 0.25.0