记得上下班打卡 | 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
ec8edfb5
Commit
ec8edfb5
authored
Oct 28, 2021
by
jiangxiulong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
set redis 中奖记录
parent
edfc5552
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
36 deletions
+68
-36
SweetNewObjectUtil.java
...com/liquidnet/service/sweet/utils/SweetNewObjectUtil.java
+4
-3
RedisDataUtils.java
...ava/com/liquidnet/service/sweet/utils/RedisDataUtils.java
+64
-33
No files found.
liquidnet-bus-api/liquidnet-service-sweet-api/src/main/java/com/liquidnet/service/sweet/utils/SweetNewObjectUtil.java
View file @
ec8edfb5
...
@@ -6,19 +6,20 @@ import com.liquidnet.service.sweet.entity.SweetIntegralActivityDraw;
...
@@ -6,19 +6,20 @@ import com.liquidnet.service.sweet.entity.SweetIntegralActivityDraw;
import
com.liquidnet.service.sweet.entity.SweetIntegralActivityPrize
;
import
com.liquidnet.service.sweet.entity.SweetIntegralActivityPrize
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.LinkedList
;
public
class
SweetNewObjectUtil
{
public
class
SweetNewObjectUtil
{
private
static
final
ArrayList
<
SweetIntegralActivityPrizeVo
>
sweetIntegralActivityPrizeVoArrayList
=
new
ArrayList
<>();
private
static
final
ArrayList
<
SweetIntegralActivityPrizeVo
>
sweetIntegralActivityPrizeVoArrayList
=
new
ArrayList
<>();
private
static
final
ArrayList
<
SweetIntegralActivityPrize
>
sweetIntegralActivityPrizeArrayList
=
new
ArrayList
<>();
private
static
final
ArrayList
<
SweetIntegralActivityPrize
>
sweetIntegralActivityPrizeArrayList
=
new
ArrayList
<>();
private
static
final
ArrayList
<
SweetIntegralActivityDraw
>
sweetIntegralActivityDrawArrayList
=
new
Array
List
<>();
private
static
final
LinkedList
<
SweetIntegralActivityDraw
>
sweetIntegralActivityDrawArrayList
=
new
Linked
List
<>();
private
static
final
PagedResult
<
SweetIntegralActivityDraw
>
sweetIntegralActivityDrawPagedResult
=
new
PagedResult
<>();
private
static
final
PagedResult
<
SweetIntegralActivityDraw
>
sweetIntegralActivityDrawPagedResult
=
new
PagedResult
<>();
public
static
ArrayList
<
SweetIntegralActivityPrizeVo
>
getSweetIntegralActivityPrizeVoArrayList
()
{
public
static
ArrayList
<
SweetIntegralActivityPrizeVo
>
getSweetIntegralActivityPrizeVoArrayList
()
{
return
(
ArrayList
<
SweetIntegralActivityPrizeVo
>)
sweetIntegralActivityPrizeVoArrayList
.
clone
();
return
(
ArrayList
<
SweetIntegralActivityPrizeVo
>)
sweetIntegralActivityPrizeVoArrayList
.
clone
();
}
}
public
static
ArrayList
<
SweetIntegralActivityDraw
>
getSweetIntegralActivityDrawArray
List
()
{
public
static
LinkedList
<
SweetIntegralActivityDraw
>
getSweetIntegralActivityDrawLinked
List
()
{
return
(
Array
List
<
SweetIntegralActivityDraw
>)
sweetIntegralActivityDrawArrayList
.
clone
();
return
(
Linked
List
<
SweetIntegralActivityDraw
>)
sweetIntegralActivityDrawArrayList
.
clone
();
}
}
public
static
PagedResult
<
SweetIntegralActivityDraw
>
getSweetIntegralActivityDrawPagedResult
()
{
public
static
PagedResult
<
SweetIntegralActivityDraw
>
getSweetIntegralActivityDrawPagedResult
()
{
...
...
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/utils/RedisDataUtils.java
View file @
ec8edfb5
...
@@ -346,6 +346,7 @@ public class RedisDataUtils {
...
@@ -346,6 +346,7 @@ public class RedisDataUtils {
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_WECHAT_USER_INFO
.
concat
(
unionid
);
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_WECHAT_USER_INFO
.
concat
(
unionid
);
return
(
SweetWechatUser
)
redisUtil
.
get
(
redisKey
);
return
(
SweetWechatUser
)
redisUtil
.
get
(
redisKey
);
}
}
public
String
getSweetWechatOpenId
(
String
unionid
)
{
public
String
getSweetWechatOpenId
(
String
unionid
)
{
if
(
unionid
.
isEmpty
())
{
if
(
unionid
.
isEmpty
())
{
return
""
;
return
""
;
...
@@ -405,10 +406,10 @@ public class RedisDataUtils {
...
@@ -405,10 +406,10 @@ public class RedisDataUtils {
public
int
getLuckDrawStatus
(
String
mobile
,
String
luckDrawNum
)
{
public
int
getLuckDrawStatus
(
String
mobile
,
String
luckDrawNum
)
{
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_LUCK_DRAW
.
concat
(
mobile
).
concat
(
":luckDrawNum:"
+
luckDrawNum
);
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_LUCK_DRAW
.
concat
(
mobile
).
concat
(
":luckDrawNum:"
+
luckDrawNum
);
Object
obj
=
redisUtil
.
get
(
redisKey
);
Object
obj
=
redisUtil
.
get
(
redisKey
);
if
(
obj
==
null
)
{
if
(
obj
==
null
)
{
redisUtil
.
set
(
redisKey
,
0
);
redisUtil
.
set
(
redisKey
,
0
);
return
0
;
return
0
;
}
else
{
}
else
{
return
(
int
)
redisUtil
.
get
(
redisKey
);
return
(
int
)
redisUtil
.
get
(
redisKey
);
}
}
}
}
...
@@ -417,15 +418,15 @@ public class RedisDataUtils {
...
@@ -417,15 +418,15 @@ public class RedisDataUtils {
public
int
getLuckDrawResult
(
String
mobile
,
String
luckDrawNum
)
{
public
int
getLuckDrawResult
(
String
mobile
,
String
luckDrawNum
)
{
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_LUCK_DRAW_RESULT
.
concat
(
luckDrawNum
).
concat
(
":mobile:"
+
mobile
);
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_LUCK_DRAW_RESULT
.
concat
(
luckDrawNum
).
concat
(
":mobile:"
+
mobile
);
Object
obj
=
redisUtil
.
get
(
redisKey
);
Object
obj
=
redisUtil
.
get
(
redisKey
);
if
(
obj
==
null
)
{
if
(
obj
==
null
)
{
return
0
;
return
0
;
}
else
{
}
else
{
return
(
int
)
redisUtil
.
get
(
redisKey
);
return
(
int
)
redisUtil
.
get
(
redisKey
);
}
}
}
}
//修改抽奖状态
//修改抽奖状态
public
SweetPrizeVo
changeLuckDrawStatus
(
String
mobile
,
String
unionId
,
String
luckDrawNum
)
{
public
SweetPrizeVo
changeLuckDrawStatus
(
String
mobile
,
String
unionId
,
String
luckDrawNum
)
{
LinkedList
<
String
>
sqls
=
CollectionUtil
.
linkedListString
();
LinkedList
<
String
>
sqls
=
CollectionUtil
.
linkedListString
();
LinkedList
<
Object
[]>
sqlsDataA
=
CollectionUtil
.
linkedListObjectArr
();
LinkedList
<
Object
[]>
sqlsDataA
=
CollectionUtil
.
linkedListObjectArr
();
LocalDateTime
now
=
LocalDateTime
.
now
();
LocalDateTime
now
=
LocalDateTime
.
now
();
...
@@ -464,14 +465,14 @@ public class RedisDataUtils {
...
@@ -464,14 +465,14 @@ public class RedisDataUtils {
if
(
surplus
<
prizeALl
)
{
if
(
surplus
<
prizeALl
)
{
prize
=
(
int
)
redisUtil
.
incr
(
redisSurplus
,
1
);
prize
=
(
int
)
redisUtil
.
incr
(
redisSurplus
,
1
);
redisUtil
.
set
(
redisKey
,
2
);
redisUtil
.
set
(
redisKey
,
2
);
redisUtil
.
set
(
SweetConstant
.
REDIS_KEY_SWEET_LUCK_DRAW_RESULT
.
concat
(
luckDrawNum
).
concat
(
":mobile:"
+
mobile
),
prize
);
redisUtil
.
set
(
SweetConstant
.
REDIS_KEY_SWEET_LUCK_DRAW_RESULT
.
concat
(
luckDrawNum
).
concat
(
":mobile:"
+
mobile
),
prize
);
}
}
}
}
}
}
sqls
.
add
(
SqlMapping
.
get
(
"sweet_luck_draw.insert"
));
sqls
.
add
(
SqlMapping
.
get
(
"sweet_luck_draw.insert"
));
sqlsDataA
.
add
(
new
Object
[]{
sqlsDataA
.
add
(
new
Object
[]{
mobile
,
unionId
,
luckDrawNum
,
prize
,
prizeALl
,
now
mobile
,
unionId
,
luckDrawNum
,
prize
,
prizeALl
,
now
});
});
queueUtils
.
sendMsgByRedis
(
MQConst
.
SweetQueue
.
LUCK_DRAW
.
getKey
(),
queueUtils
.
sendMsgByRedis
(
MQConst
.
SweetQueue
.
LUCK_DRAW
.
getKey
(),
SqlMapping
.
gets
(
sqls
,
sqlsDataA
));
SqlMapping
.
gets
(
sqls
,
sqlsDataA
));
...
@@ -486,6 +487,7 @@ public class RedisDataUtils {
...
@@ -486,6 +487,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
);
...
@@ -498,6 +500,7 @@ public class RedisDataUtils {
...
@@ -498,6 +500,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
);
...
@@ -508,11 +511,13 @@ public class RedisDataUtils {
...
@@ -508,11 +511,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
);
...
@@ -523,11 +528,13 @@ public class RedisDataUtils {
...
@@ -523,11 +528,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
);
...
@@ -538,11 +545,13 @@ public class RedisDataUtils {
...
@@ -538,11 +545,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
);
...
@@ -555,7 +564,7 @@ public class RedisDataUtils {
...
@@ -555,7 +564,7 @@ public class RedisDataUtils {
}
}
// wechat user 摩登
// wechat user 摩登
public
void
setSweetWechatUserModernsky
(
SweetWechatUser
sweetWechatUser
)
{
public
void
setSweetWechatUserModernsky
(
SweetWechatUser
sweetWechatUser
)
{
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_WECHAT_USER_INFO_MODERNSKY
.
concat
(
sweetWechatUser
.
getUnionId
());
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_WECHAT_USER_INFO_MODERNSKY
.
concat
(
sweetWechatUser
.
getUnionId
());
String
redisKeyUnid
=
SweetConstant
.
REDIS_KEY_SWEET_WECHAT_USER_UNIONID_MODERNSKY
.
concat
(
sweetWechatUser
.
getOpenId
());
String
redisKeyUnid
=
SweetConstant
.
REDIS_KEY_SWEET_WECHAT_USER_UNIONID_MODERNSKY
.
concat
(
sweetWechatUser
.
getOpenId
());
...
@@ -578,6 +587,7 @@ public class RedisDataUtils {
...
@@ -578,6 +587,7 @@ public class RedisDataUtils {
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_WECHAT_USER_INFO_MODERNSKY
.
concat
(
unionid
);
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_WECHAT_USER_INFO_MODERNSKY
.
concat
(
unionid
);
return
(
SweetWechatUser
)
redisUtil
.
get
(
redisKey
);
return
(
SweetWechatUser
)
redisUtil
.
get
(
redisKey
);
}
}
public
String
getSweetWechatOpenIdModernsky
(
String
unionid
)
{
public
String
getSweetWechatOpenIdModernsky
(
String
unionid
)
{
if
(
unionid
.
isEmpty
())
{
if
(
unionid
.
isEmpty
())
{
return
""
;
return
""
;
...
@@ -591,6 +601,7 @@ public class RedisDataUtils {
...
@@ -591,6 +601,7 @@ public class RedisDataUtils {
return
sweetWechatUser
.
getOpenId
();
return
sweetWechatUser
.
getOpenId
();
}
}
}
}
public
void
delSweetWechatUserModernsky
(
String
unionid
,
String
openid
)
{
public
void
delSweetWechatUserModernsky
(
String
unionid
,
String
openid
)
{
if
(!
unionid
.
isEmpty
())
{
if
(!
unionid
.
isEmpty
())
{
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_WECHAT_USER_INFO_MODERNSKY
.
concat
(
unionid
);
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_WECHAT_USER_INFO_MODERNSKY
.
concat
(
unionid
);
...
@@ -621,38 +632,58 @@ public class RedisDataUtils {
...
@@ -621,38 +632,58 @@ public class RedisDataUtils {
}
}
public
void
setIntegralActivityDraw
(
SweetIntegralActivityDraw
sweetIntegralActivityDraw
)
{
public
void
setIntegralActivityDraw
(
SweetIntegralActivityDraw
sweetIntegralActivityDraw
)
{
// TODO: 2021/10/26 1用户中奖列表 2用户抽奖列表 3all用户中奖列表
Integer
prizeType
=
sweetIntegralActivityDraw
.
getPrizeType
();
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_INTEGRAL_ACTIVITY_DRAW_ALL_LIST
String
redisKey
=
""
;
.
concat
(
sweetIntegralActivityDraw
.
getIntegralActivityId
());
String
userId
=
sweetIntegralActivityDraw
.
getUserId
();
String
redisKey1
=
SweetConstant
.
REDIS_KEY_SWEET_INTEGRAL_ACTIVITY_DRAW_USER
String
integralActivityId
=
sweetIntegralActivityDraw
.
getIntegralActivityId
();
.
concat
(
sweetIntegralActivityDraw
.
getIntegralActivityId
())
LinkedList
<
SweetIntegralActivityDraw
>
activityDrawArrayList
=
SweetNewObjectUtil
.
getSweetIntegralActivityDrawLinkedList
();
.
concat
(
":userId:"
)
if
(
prizeType
==
1
)
{
// 谢谢惠顾 写入抽奖列表
.
concat
(
sweetIntegralActivityDraw
.
getUserId
());
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_INTEGRAL_ACTIVITY_DRAW_USER
String
redisKey2
=
SweetConstant
.
REDIS_KEY_SWEET_INTEGRAL_ACTIVITY_DRAW_IN_USER
.
concat
(
integralActivityId
)
.
concat
(
sweetIntegralActivityDraw
.
getIntegralActivityId
())
.
concat
(
":userId:"
)
.
concat
(
":userId:"
)
.
concat
(
userId
);
.
concat
(
sweetIntegralActivityDraw
.
getUserId
());
activityDrawArrayList
=
this
.
getIntegralActivityDrawList
(
2
,
userId
,
integralActivityId
,
1
);
// TODO: 2021/10/26 先获取set到10条
}
else
{
// 中奖列表
// TODO: 2021/10/27 判断是否中奖 再看写入中奖还是抽奖
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_INTEGRAL_ACTIVITY_DRAW_IN_USER
ArrayList
<
SweetIntegralActivityDraw
>
sweetIntegralActivityDrawArrayList
=
SweetNewObjectUtil
.
getSweetIntegralActivityDrawArrayList
();
.
concat
(
integralActivityId
)
sweetIntegralActivityDrawArrayList
.
add
(
sweetIntegralActivityDraw
);
.
concat
(
":userId:"
)
redisUtil
.
set
(
redisKey
,
sweetIntegralActivityDrawArrayList
);
.
concat
(
userId
);
redisUtil
.
set
(
redisKey1
,
sweetIntegralActivityDrawArrayList
);
activityDrawArrayList
=
this
.
getIntegralActivityDrawList
(
1
,
userId
,
integralActivityId
,
1
);
redisUtil
.
set
(
redisKey2
,
sweetIntegralActivityDrawArrayList
);
}
// all用户中奖列表
String
redisKeyAll
=
SweetConstant
.
REDIS_KEY_SWEET_INTEGRAL_ACTIVITY_DRAW_ALL_LIST
public
List
<
SweetIntegralActivityDraw
>
getIntegralActivityDrawAll
(
String
integralActivityId
)
{
.
concat
(
integralActivityId
);
LinkedList
<
SweetIntegralActivityDraw
>
integralActivityDrawAll
=
this
.
getIntegralActivityDrawAll
(
integralActivityId
);
if
(!
CollectionUtil
.
isEmpty
(
integralActivityDrawAll
))
{
if
(
integralActivityDrawAll
.
size
()
>=
20
)
{
integralActivityDrawAll
.
remove
(
0
);
}
}
integralActivityDrawAll
.
addFirst
(
sweetIntegralActivityDraw
);
redisUtil
.
set
(
redisKeyAll
,
integralActivityDrawAll
);
}
// 先获取set到20条
if
(!
CollectionUtil
.
isEmpty
(
activityDrawArrayList
))
{
if
(
activityDrawArrayList
.
size
()
>=
20
)
{
activityDrawArrayList
.
remove
(
0
);
}
}
activityDrawArrayList
.
addFirst
(
sweetIntegralActivityDraw
);
redisUtil
.
set
(
redisKey
,
activityDrawArrayList
);
}
public
LinkedList
<
SweetIntegralActivityDraw
>
getIntegralActivityDrawAll
(
String
integralActivityId
)
{
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_INTEGRAL_ACTIVITY_DRAW_ALL_LIST
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_INTEGRAL_ACTIVITY_DRAW_ALL_LIST
.
concat
(
integralActivityId
);
.
concat
(
integralActivityId
);
Object
obj
=
redisUtil
.
get
(
redisKey
);
Object
obj
=
redisUtil
.
get
(
redisKey
);
if
(
null
==
obj
)
{
if
(
null
==
obj
)
{
return
null
;
return
null
;
}
else
{
}
else
{
return
(
List
<
SweetIntegralActivityDraw
>)
obj
;
return
(
Li
nkedLi
st
<
SweetIntegralActivityDraw
>)
obj
;
}
}
}
}
public
List
<
SweetIntegralActivityDraw
>
getIntegralActivityDrawList
(
Integer
type
,
String
uid
,
String
integralActivityId
,
Integer
pageNum
)
{
public
Li
nkedLi
st
<
SweetIntegralActivityDraw
>
getIntegralActivityDrawList
(
Integer
type
,
String
uid
,
String
integralActivityId
,
Integer
pageNum
)
{
String
redisKey
=
""
;
String
redisKey
=
""
;
if
(
type
==
1
)
{
if
(
type
==
1
)
{
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_INTEGRAL_ACTIVITY_DRAW_IN_USER
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_INTEGRAL_ACTIVITY_DRAW_IN_USER
...
@@ -669,7 +700,7 @@ public class RedisDataUtils {
...
@@ -669,7 +700,7 @@ public class RedisDataUtils {
if
(
null
==
obj
)
{
if
(
null
==
obj
)
{
return
null
;
return
null
;
}
else
{
}
else
{
return
(
List
<
SweetIntegralActivityDraw
>)
obj
;
return
(
Li
nkedLi
st
<
SweetIntegralActivityDraw
>)
obj
;
}
}
// TODO: 2021/10/27 page大于1 去mongo里面取
// TODO: 2021/10/27 page大于1 去mongo里面取
}
}
...
...
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