记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
董敬伟
liquidnet-bus-v1
Commits
563adf9c
Commit
563adf9c
authored
Nov 04, 2021
by
jiangxiulong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
抽奖列表
parent
2f10f380
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
12 deletions
+30
-12
RedisDataUtils.java
...ava/com/liquidnet/service/sweet/utils/RedisDataUtils.java
+30
-12
No files found.
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/utils/RedisDataUtils.java
View file @
563adf9c
...
@@ -428,6 +428,7 @@ public class RedisDataUtils {
...
@@ -428,6 +428,7 @@ public class RedisDataUtils {
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_ANSWER_PHONE
.
concat
(
sweetAnswerVo
.
getPhone
());
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_ANSWER_PHONE
.
concat
(
sweetAnswerVo
.
getPhone
());
redisUtil
.
set
(
redisKey
,
sweetAnswerVo
);
redisUtil
.
set
(
redisKey
,
sweetAnswerVo
);
}
}
public
SweetAnswerVo
getSweetAnswer
(
String
phone
)
{
public
SweetAnswerVo
getSweetAnswer
(
String
phone
)
{
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_ANSWER_PHONE
.
concat
(
phone
);
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_ANSWER_PHONE
.
concat
(
phone
);
SweetAnswerVo
sweetAnswerVo
=
(
SweetAnswerVo
)
redisUtil
.
get
(
redisKey
);
SweetAnswerVo
sweetAnswerVo
=
(
SweetAnswerVo
)
redisUtil
.
get
(
redisKey
);
...
@@ -440,6 +441,7 @@ public class RedisDataUtils {
...
@@ -440,6 +441,7 @@ public class RedisDataUtils {
.
concat
(
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE_STAT_LIST
);
.
concat
(
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE_STAT_LIST
);
redisUtil
.
set
(
redisKey
,
sweetCItyVoteStatVo
);
redisUtil
.
set
(
redisKey
,
sweetCItyVoteStatVo
);
}
}
public
List
<
SweetCItyVoteStatVo
>
getSweetCityVoteStatList
(
Integer
type
)
{
public
List
<
SweetCItyVoteStatVo
>
getSweetCityVoteStatList
(
Integer
type
)
{
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE
.
concat
(
String
.
valueOf
(
type
))
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE
.
concat
(
String
.
valueOf
(
type
))
.
concat
(
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE_STAT_LIST
);
.
concat
(
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE_STAT_LIST
);
...
@@ -450,11 +452,13 @@ public class RedisDataUtils {
...
@@ -450,11 +452,13 @@ public class RedisDataUtils {
}
}
return
sweetCityVoteStatList
;
return
sweetCityVoteStatList
;
}
}
public
void
incrSweetCityVote
(
String
cityCode
,
Integer
type
)
{
public
void
incrSweetCityVote
(
String
cityCode
,
Integer
type
)
{
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE
.
concat
(
String
.
valueOf
(
type
))
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE
.
concat
(
String
.
valueOf
(
type
))
.
concat
(
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE_CITY_CODE
).
concat
(
cityCode
);
.
concat
(
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE_CITY_CODE
).
concat
(
cityCode
);
redisUtil
.
incr
(
redisKey
,
1
);
redisUtil
.
incr
(
redisKey
,
1
);
}
}
public
Integer
getSweetCityVote
(
String
cityCode
,
Integer
type
)
{
public
Integer
getSweetCityVote
(
String
cityCode
,
Integer
type
)
{
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE
.
concat
(
String
.
valueOf
(
type
))
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE
.
concat
(
String
.
valueOf
(
type
))
.
concat
(
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE_CITY_CODE
).
concat
(
cityCode
);
.
concat
(
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE_CITY_CODE
).
concat
(
cityCode
);
...
@@ -465,11 +469,13 @@ public class RedisDataUtils {
...
@@ -465,11 +469,13 @@ public class RedisDataUtils {
return
(
Integer
)
obj
;
return
(
Integer
)
obj
;
}
}
}
}
public
void
setUserVote
(
String
phone
,
String
openId
,
SweetCityVoteParam
param
)
{
public
void
setUserVote
(
String
phone
,
String
openId
,
SweetCityVoteParam
param
)
{
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE
.
concat
(
String
.
valueOf
(
param
.
getType
()))
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE
.
concat
(
String
.
valueOf
(
param
.
getType
()))
.
concat
(
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE_USER
).
concat
(
phone
).
concat
(
"-"
).
concat
(
openId
);
.
concat
(
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE_USER
).
concat
(
phone
).
concat
(
"-"
).
concat
(
openId
);
redisUtil
.
set
(
redisKey
,
param
);
redisUtil
.
set
(
redisKey
,
param
);
}
}
public
SweetCityVoteParam
getUserVote
(
String
phone
,
String
openId
,
Integer
type
)
{
public
SweetCityVoteParam
getUserVote
(
String
phone
,
String
openId
,
Integer
type
)
{
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE
.
concat
(
String
.
valueOf
(
type
))
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE
.
concat
(
String
.
valueOf
(
type
))
.
concat
(
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE_USER
).
concat
(
phone
).
concat
(
"-"
).
concat
(
openId
);
.
concat
(
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE_USER
).
concat
(
phone
).
concat
(
"-"
).
concat
(
openId
);
...
@@ -480,11 +486,13 @@ public class RedisDataUtils {
...
@@ -480,11 +486,13 @@ public class RedisDataUtils {
return
(
SweetCityVoteParam
)
obj
;
return
(
SweetCityVoteParam
)
obj
;
}
}
}
}
public
void
setSweetCityVoteStatUpdateTime
(
Integer
type
)
{
public
void
setSweetCityVoteStatUpdateTime
(
Integer
type
)
{
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE
.
concat
(
String
.
valueOf
(
type
))
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE
.
concat
(
String
.
valueOf
(
type
))
.
concat
(
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE_STAT_UPDATE_TIME
);
.
concat
(
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE_STAT_UPDATE_TIME
);
redisUtil
.
set
(
redisKey
,
DateUtil
.
getNowTime
());
redisUtil
.
set
(
redisKey
,
DateUtil
.
getNowTime
());
}
}
public
String
getSweetCityVoteStatUpdateTime
(
Integer
type
)
{
public
String
getSweetCityVoteStatUpdateTime
(
Integer
type
)
{
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE
.
concat
(
String
.
valueOf
(
type
))
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE
.
concat
(
String
.
valueOf
(
type
))
.
concat
(
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE_STAT_UPDATE_TIME
);
.
concat
(
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE_STAT_UPDATE_TIME
);
...
@@ -509,14 +517,17 @@ public class RedisDataUtils {
...
@@ -509,14 +517,17 @@ public class RedisDataUtils {
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_WECHAT_USER_UNIONID_PHONE
.
concat
(
phone
);
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_WECHAT_USER_UNIONID_PHONE
.
concat
(
phone
);
redisUtil
.
set
(
redisKey
,
unionId
);
redisUtil
.
set
(
redisKey
,
unionId
);
}
}
public
void
setUnionIdByUserId
(
String
userId
,
String
unionId
)
{
public
void
setUnionIdByUserId
(
String
userId
,
String
unionId
)
{
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_WECHAT_USER_UNIONID_UID
.
concat
(
userId
);
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_WECHAT_USER_UNIONID_UID
.
concat
(
userId
);
redisUtil
.
set
(
redisKey
,
unionId
);
redisUtil
.
set
(
redisKey
,
unionId
);
}
}
public
void
setUnionIdByPhoneSky
(
String
phone
,
String
unionId
)
{
public
void
setUnionIdByPhoneSky
(
String
phone
,
String
unionId
)
{
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_WECHAT_USER_UNIONID_PHONE_MODERNSKY
.
concat
(
phone
);
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_WECHAT_USER_UNIONID_PHONE_MODERNSKY
.
concat
(
phone
);
redisUtil
.
set
(
redisKey
,
unionId
);
redisUtil
.
set
(
redisKey
,
unionId
);
}
}
public
void
setUnionIdByUserIdSky
(
String
userId
,
String
unionId
)
{
public
void
setUnionIdByUserIdSky
(
String
userId
,
String
unionId
)
{
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_WECHAT_USER_UNIONID_UID_MODERNSKY
.
concat
(
userId
);
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_WECHAT_USER_UNIONID_UID_MODERNSKY
.
concat
(
userId
);
redisUtil
.
set
(
redisKey
,
unionId
);
redisUtil
.
set
(
redisKey
,
unionId
);
...
@@ -568,22 +579,22 @@ public class RedisDataUtils {
...
@@ -568,22 +579,22 @@ public class RedisDataUtils {
public
void
setIntegralActivityDraw
(
IntegralActivityDrawVo
integralActivityDrawVo
)
{
public
void
setIntegralActivityDraw
(
IntegralActivityDrawVo
integralActivityDrawVo
)
{
Integer
prizeType
=
integralActivityDrawVo
.
getPrizeType
();
Integer
prizeType
=
integralActivityDrawVo
.
getPrizeType
();
String
redisKey
=
""
;
String
userId
=
integralActivityDrawVo
.
getUserId
();
String
userId
=
integralActivityDrawVo
.
getUserId
();
String
integralActivityId
=
integralActivityDrawVo
.
getIntegralActivityId
();
String
integralActivityId
=
integralActivityDrawVo
.
getIntegralActivityId
();
LinkedList
<
IntegralActivityDrawVo
>
activityDrawArrayList
=
SweetNewObjectUtil
.
getSweetIntegralActivityDrawVoLinkedList
();
if
(
prizeType
>
1
)
{
// 写入中奖列表
if
(
prizeType
==
1
)
{
// 谢谢惠顾 写入抽奖列表
String
redisKeyIn
=
SweetConstant
.
REDIS_KEY_SWEET_INTEGRAL_ACTIVITY_DRAW_IN_USER
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_INTEGRAL_ACTIVITY_DRAW_USER
.
concat
(
integralActivityId
)
.
concat
(
":userId:"
)
.
concat
(
userId
);
activityDrawArrayList
=
this
.
getIntegralActivityDrawList
(
2
,
userId
,
integralActivityId
,
1
);
}
else
{
// 中奖列表
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_INTEGRAL_ACTIVITY_DRAW_IN_USER
.
concat
(
integralActivityId
)
.
concat
(
integralActivityId
)
.
concat
(
":userId:"
)
.
concat
(
":userId:"
)
.
concat
(
userId
);
.
concat
(
userId
);
activityDrawArrayList
=
this
.
getIntegralActivityDrawList
(
1
,
userId
,
integralActivityId
,
1
);
LinkedList
<
IntegralActivityDrawVo
>
activityDrawArrayListIn
=
this
.
getIntegralActivityDrawList
(
1
,
userId
,
integralActivityId
,
1
);
// 先获取set到20条
if
(!
CollectionUtil
.
isEmpty
(
activityDrawArrayListIn
))
{
if
(
activityDrawArrayListIn
.
size
()
>=
20
)
{
activityDrawArrayListIn
.
remove
(
0
);
}
}
activityDrawArrayListIn
.
addFirst
(
integralActivityDrawVo
);
redisUtil
.
set
(
redisKeyIn
,
activityDrawArrayListIn
);
// all用户中奖列表
// all用户中奖列表
String
redisKeyAll
=
SweetConstant
.
REDIS_KEY_SWEET_INTEGRAL_ACTIVITY_DRAW_ALL_LIST
String
redisKeyAll
=
SweetConstant
.
REDIS_KEY_SWEET_INTEGRAL_ACTIVITY_DRAW_ALL_LIST
...
@@ -597,6 +608,12 @@ public class RedisDataUtils {
...
@@ -597,6 +608,12 @@ public class RedisDataUtils {
integralActivityDrawAll
.
addFirst
(
integralActivityDrawVo
);
integralActivityDrawAll
.
addFirst
(
integralActivityDrawVo
);
redisUtil
.
set
(
redisKeyAll
,
integralActivityDrawAll
);
redisUtil
.
set
(
redisKeyAll
,
integralActivityDrawAll
);
}
}
// 写入抽奖列表
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_INTEGRAL_ACTIVITY_DRAW_USER
.
concat
(
integralActivityId
)
.
concat
(
":userId:"
)
.
concat
(
userId
);
LinkedList
<
IntegralActivityDrawVo
>
activityDrawArrayList
=
this
.
getIntegralActivityDrawList
(
2
,
userId
,
integralActivityId
,
1
);
// 先获取set到20条
// 先获取set到20条
if
(!
CollectionUtil
.
isEmpty
(
activityDrawArrayList
))
{
if
(!
CollectionUtil
.
isEmpty
(
activityDrawArrayList
))
{
if
(
activityDrawArrayList
.
size
()
>=
20
)
{
if
(
activityDrawArrayList
.
size
()
>=
20
)
{
...
@@ -605,7 +622,7 @@ public class RedisDataUtils {
...
@@ -605,7 +622,7 @@ public class RedisDataUtils {
}
}
activityDrawArrayList
.
addFirst
(
integralActivityDrawVo
);
activityDrawArrayList
.
addFirst
(
integralActivityDrawVo
);
redisUtil
.
set
(
redisKey
,
activityDrawArrayList
);
redisUtil
.
set
(
redisKey
,
activityDrawArrayList
);
// 抽奖详情
String
redisKeyDraw
=
SweetConstant
.
REDIS_KEY_SWEET_INTEGRAL_ACTIVITY_DRAW_INFO
String
redisKeyDraw
=
SweetConstant
.
REDIS_KEY_SWEET_INTEGRAL_ACTIVITY_DRAW_INFO
.
concat
(
integralActivityDrawVo
.
getDrawId
());
.
concat
(
integralActivityDrawVo
.
getDrawId
());
redisUtil
.
set
(
redisKeyDraw
,
integralActivityDrawVo
);
redisUtil
.
set
(
redisKeyDraw
,
integralActivityDrawVo
);
...
@@ -699,6 +716,7 @@ public class RedisDataUtils {
...
@@ -699,6 +716,7 @@ public class RedisDataUtils {
return
(
IntegralActivityDrawVo
)
obj
;
return
(
IntegralActivityDrawVo
)
obj
;
}
}
}
}
public
void
setIntegralActivityDrawInfo
(
String
drawId
,
IntegralActivityDrawVo
drawVo
)
{
public
void
setIntegralActivityDrawInfo
(
String
drawId
,
IntegralActivityDrawVo
drawVo
)
{
String
redisKeyDraw
=
SweetConstant
.
REDIS_KEY_SWEET_INTEGRAL_ACTIVITY_DRAW_INFO
String
redisKeyDraw
=
SweetConstant
.
REDIS_KEY_SWEET_INTEGRAL_ACTIVITY_DRAW_INFO
.
concat
(
drawId
);
.
concat
(
drawId
);
...
...
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