Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
涂亚平
/
subsidy
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit f136ed8c
authored
Dec 23, 2021
by
邓敏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
签到数据存储到Redis
1 parent
bd196736
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java
src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java
View file @
f136ed8
...
...
@@ -11,6 +11,7 @@ import com.subsidy.model.*;
import
com.subsidy.service.SignInRecordService
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.subsidy.util.ConstantUtils
;
import
com.subsidy.util.DateFormatUtil
;
import
com.subsidy.util.MathUtil
;
import
com.subsidy.util.RedisUtil
;
import
com.subsidy.vo.member.GetMemberSignInfoVO
;
...
...
@@ -21,6 +22,7 @@ import org.springframework.stereotype.Service;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Set
;
...
...
@@ -69,19 +71,21 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
*/
List
<
ClassDictDO
>
classDictDOS
=
classMemberMappingMapper
.
getMemberClass
(
signInRecordDO
.
getMemberId
());
this
.
baseMapper
.
delete
(
new
QueryWrapper
<
SignInRecordDO
>()
/*
this.baseMapper.delete(new QueryWrapper<SignInRecordDO>()
.lambda()
.eq(SignInRecordDO::getMemberId, signInRecordDO.getMemberId())
.
gt
(
SignInRecordDO:
:
getSignInDate
,
LocalDate
.
now
()));
.gt(SignInRecordDO::getSignInDate, LocalDate.now()));
*/
for
(
ClassDictDO
classDictDO
:
classDictDOS
)
{
/*
SignInRecordDO signInRecordDO1 = new SignInRecordDO();
signInRecordDO1.setClassId(classDictDO.getId());
signInRecordDO1.setMemberId(signInRecordDO.getMemberId());
signInRecordDO1.setSignInDate(LocalDateTime.now());
*/
//redisUtil.set("signInStatus"+signInRecordDO.getMemberId()+classDictDO.getId(),LocalDateTime.now()
);
this
.
baseMapper
.
insert
(
signInRecordDO1
);
redisUtil
.
set
(
"subsidySignInfo_"
+
signInRecordDO
.
getMemberId
()+
"_"
+
classDictDO
.
getId
()+
"_"
+
DateFormatUtil
.
format
(
new
Date
(),
"yyyyMMdd"
)+
"_"
+
System
.
currentTimeMillis
(),
null
);
//
this.baseMapper.insert(signInRecordDO1);
}
return
ConstantUtils
.
ADD_SUCCESS
;
...
...
@@ -179,13 +183,13 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
List
<
ClassDictDO
>
classDictDOS
=
classMemberMappingMapper
.
getMemberClass
(
signInRecordDO
.
getMemberId
());
for
(
ClassDictDO
classDictDO
:
classDictDOS
)
{
Integer
count
=
this
.
baseMapper
.
selectCount
(
new
QueryWrapper
<
SignInRecordDO
>()
/*
Integer count = this.baseMapper.selectCount(new QueryWrapper<SignInRecordDO>()
.lambda()
.eq(SignInRecordDO::getClassId, classDictDO.getId())
.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
)
{
flag
=
false
;
//没有签到
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment