Commit f136ed8c by 邓敏

签到数据存储到Redis

1 parent bd196736
...@@ -11,6 +11,7 @@ import com.subsidy.model.*; ...@@ -11,6 +11,7 @@ import com.subsidy.model.*;
import com.subsidy.service.SignInRecordService; import com.subsidy.service.SignInRecordService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils; import com.subsidy.util.ConstantUtils;
import com.subsidy.util.DateFormatUtil;
import com.subsidy.util.MathUtil; import com.subsidy.util.MathUtil;
import com.subsidy.util.RedisUtil; import com.subsidy.util.RedisUtil;
import com.subsidy.vo.member.GetMemberSignInfoVO; import com.subsidy.vo.member.GetMemberSignInfoVO;
...@@ -21,6 +22,7 @@ import org.springframework.stereotype.Service; ...@@ -21,6 +22,7 @@ import org.springframework.stereotype.Service;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
...@@ -69,19 +71,21 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig ...@@ -69,19 +71,21 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
*/ */
List<ClassDictDO> classDictDOS = classMemberMappingMapper.getMemberClass(signInRecordDO.getMemberId()); List<ClassDictDO> classDictDOS = classMemberMappingMapper.getMemberClass(signInRecordDO.getMemberId());
this.baseMapper.delete(new QueryWrapper<SignInRecordDO>() /*this.baseMapper.delete(new QueryWrapper<SignInRecordDO>()
.lambda() .lambda()
.eq(SignInRecordDO::getMemberId, signInRecordDO.getMemberId()) .eq(SignInRecordDO::getMemberId, signInRecordDO.getMemberId())
.gt(SignInRecordDO::getSignInDate, LocalDate.now())); .gt(SignInRecordDO::getSignInDate, LocalDate.now()));*/
for (ClassDictDO classDictDO : classDictDOS) { for (ClassDictDO classDictDO : classDictDOS) {
/*
SignInRecordDO signInRecordDO1 = new SignInRecordDO(); SignInRecordDO signInRecordDO1 = new SignInRecordDO();
signInRecordDO1.setClassId(classDictDO.getId()); signInRecordDO1.setClassId(classDictDO.getId());
signInRecordDO1.setMemberId(signInRecordDO.getMemberId()); signInRecordDO1.setMemberId(signInRecordDO.getMemberId());
signInRecordDO1.setSignInDate(LocalDateTime.now()); signInRecordDO1.setSignInDate(LocalDateTime.now());
*/
//redisUtil.set("signInStatus"+signInRecordDO.getMemberId()+classDictDO.getId(),LocalDateTime.now()); redisUtil.set("subsidySignInfo_"+signInRecordDO.getMemberId()+"_"+classDictDO.getId()+"_"+DateFormatUtil.format(new Date(), "yyyyMMdd")+"_"+System.currentTimeMillis(), null);
this.baseMapper.insert(signInRecordDO1); // this.baseMapper.insert(signInRecordDO1);
} }
return ConstantUtils.ADD_SUCCESS; return ConstantUtils.ADD_SUCCESS;
...@@ -179,13 +183,13 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig ...@@ -179,13 +183,13 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
List<ClassDictDO> classDictDOS = classMemberMappingMapper.getMemberClass(signInRecordDO.getMemberId()); List<ClassDictDO> classDictDOS = classMemberMappingMapper.getMemberClass(signInRecordDO.getMemberId());
for (ClassDictDO classDictDO : classDictDOS) { for (ClassDictDO classDictDO : classDictDOS) {
Integer count = this.baseMapper.selectCount(new QueryWrapper<SignInRecordDO>() /*Integer count = this.baseMapper.selectCount(new QueryWrapper<SignInRecordDO>()
.lambda() .lambda()
.eq(SignInRecordDO::getClassId, classDictDO.getId()) .eq(SignInRecordDO::getClassId, classDictDO.getId())
.eq(SignInRecordDO::getMemberId, signInRecordDO.getMemberId()) .eq(SignInRecordDO::getMemberId, signInRecordDO.getMemberId())
.gt(SignInRecordDO::getSignInDate, LocalDate.now())); .gt(SignInRecordDO::getSignInDate, LocalDate.now()));*/
//String count = redisUtil.get("signInStatus:"+signInRecordDO.getMemberId()+":"+classDictDO.getId()).toString(); long count = redisUtil.keys("*subsidySignInfo_"+signInRecordDO.getMemberId()+"_"+classDictDO.getId()+"_"+DateFormatUtil.format(new Date(), "yyyyMMdd")+"*").stream().count();
if (count == 0) { if (count == 0) {
flag = false; //没有签到 flag = false; //没有签到
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!