Commit d0c69bbb by 邓敏

签到记录修改

1 parent 7d846edc
...@@ -28,12 +28,14 @@ import com.subsidy.vo.sign.SignInStatusVO; ...@@ -28,12 +28,14 @@ import com.subsidy.vo.sign.SignInStatusVO;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneOffset; import java.time.ZoneOffset;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
...@@ -75,12 +77,18 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig ...@@ -75,12 +77,18 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
.orderByDesc(SignInRecordDO::getCreateDate)); .orderByDesc(SignInRecordDO::getCreateDate));
} }
@Transactional(rollbackFor = Exception.class)
public String signIn(SignInRecordDO signInRecordDO) { public String signIn(SignInRecordDO signInRecordDO) {
//查看学生所有在读班级 //查看学生所有在读班级
List<ClassDictDO> classDictDOS = classMemberMappingMapper.getMemberClass(signInRecordDO.getMemberId()); List<ClassDictDO> classDictDOS = classMemberMappingMapper.getMemberClass(signInRecordDO.getMemberId());
for (ClassDictDO classDictDO : classDictDOS) { for (ClassDictDO classDictDO : classDictDOS) {
Set<String> 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); redisUtil.set(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + signInRecordDO.getMemberId() + ":classId:" + classDictDO.getId() + ":" + DateFormatUtil.format(new Date(), "yyyy-MM-dd") + ":" + System.currentTimeMillis(), null);
} }
......
...@@ -102,6 +102,16 @@ public class RedisUtil { ...@@ -102,6 +102,16 @@ public class RedisUtil {
} }
} }
/**
* 删除缓存
* @param key 集合数据
*/
public void del(Set<String> key) {
if (key != null && key.size() > 0) {
redisTemplate.delete(key);
}
}
//============================String============================= //============================String=============================
/** /**
* 普通缓存获取 * 普通缓存获取
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!