Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Q
qk_backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
quanku
qk_backend
Commits
4f09fc9a
Commit
4f09fc9a
authored
Nov 22, 2024
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
签到5
parent
8ab6e421
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
18 deletions
+36
-18
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/UserSigninServiceImpl.java
.../main/java/com/wwdz/ch/wx/impl/UserSigninServiceImpl.java
+36
-18
No files found.
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/UserSigninServiceImpl.java
View file @
4f09fc9a
...
...
@@ -78,15 +78,19 @@ public class UserSigninServiceImpl implements UserSigninService {
case
7
:
userSignin
.
setIsReward
(
true
);
userSignin
.
setRewardLevel
(
SigninEnum
.
LevelEnum
.
FIRST
.
getCode
());
break
;
case
14
:
userSignin
.
setIsReward
(
true
);
userSignin
.
setRewardLevel
(
SigninEnum
.
LevelEnum
.
SECOND
.
getCode
());
break
;
case
21
:
userSignin
.
setIsReward
(
true
);
userSignin
.
setRewardLevel
(
SigninEnum
.
LevelEnum
.
THIRD
.
getCode
());
break
;
default
:
userSignin
.
setIsReward
(
false
);
userSignin
.
setRewardLevel
(
SigninEnum
.
LevelEnum
.
ZERO
.
getCode
());
break
;
}
userSignin
.
setIsGet
(
false
);
userSigninDao
.
insert
(
userSignin
);
...
...
@@ -150,7 +154,13 @@ public class UserSigninServiceImpl implements UserSigninService {
try
{
long
userId
=
dto
.
getUserId
();
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
//查询今天的打卡记录
UserSignIn
todayRecord
=
userSigninDao
.
findLastedRecord
(
userId
);
if
(
todayRecord
!=
null
)
{
resultMap
.
put
(
"todaySignIn"
,
true
);
}
else
{
resultMap
.
put
(
"todaySignIn"
,
false
);
}
//检查昨天是否打过卡
UserSignIn
yesterdaySignIn
=
userSigninDao
.
findYesterdayRecord
(
userId
);
...
...
@@ -160,8 +170,6 @@ public class UserSigninServiceImpl implements UserSigninService {
//还需签到的天数
resultMap
.
put
(
"needConsecutiveDays"
,
7
);
}
else
{
//查询今天的打卡记录
UserSignIn
todayRecord
=
userSigninDao
.
findLastedRecord
(
userId
);
if
(
todayRecord
!=
null
)
{
resultMap
.
put
(
"consecutiveDays"
,
todayRecord
.
getConsecutiveDays
());
}
else
{
...
...
@@ -194,6 +202,15 @@ public class UserSigninServiceImpl implements UserSigninService {
}
resultMap
.
put
(
"year"
,
year
);
resultMap
.
put
(
"month"
,
month
);
LocalDate
localDate
=
LocalDate
.
of
(
year
,
month
,
1
);
// 获取上个月的月份
resultMap
.
put
(
"lastMonth"
,
localDate
.
minusMonths
(
1
).
getMonthValue
());
resultMap
.
put
(
"lastYear"
,
localDate
.
minusMonths
(
1
).
getYear
());
resultMap
.
put
(
"nextMonth"
,
localDate
.
plusMonths
(
1
).
getMonthValue
());
resultMap
.
put
(
"nextYear"
,
localDate
.
plusMonths
(
1
).
getYear
());
//每个月一号是周几
resultMap
.
put
(
"firstDayOfWeek"
,
DateTimeUtil
.
getFirstDayOfMonth
(
year
,
month
));
...
...
@@ -219,6 +236,8 @@ public class UserSigninServiceImpl implements UserSigninService {
signDateRecord
.
setDateState
(
SigninEnum
.
DateStateEnum
.
CURRENT
.
getCode
());
}
else
{
signDateRecord
.
setDateState
(
SigninEnum
.
DateStateEnum
.
FUTURE
.
getCode
());
}
if
(
yesterdaySignIn
==
null
)
{
//昨天没签到就以今天的时间预测之后的奖励日期
if
(
today
.
plusDays
(
6
).
format
(
formatter
).
equals
(
dateStr
)
||
today
.
plusDays
(
13
).
format
(
formatter
).
equals
(
dateStr
)
...
...
@@ -235,7 +254,6 @@ public class UserSigninServiceImpl implements UserSigninService {
signDateRecord
.
setIsGet
(
false
);
}
}
}
//签到记录里包含该日期则表示已签到
if
(
signDateList
.
contains
(
dateStr
))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment