Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sequoia_score
Overview
Overview
Details
Activity
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
mark
sequoia_score
Commits
f62515d2
Commit
f62515d2
authored
Jul 31, 2021
by
Lem
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
count
parent
2886f5e5
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
246 additions
and
246 deletions
+246
-246
MatchService.java
...n/src/main/java/com/live/common/service/MatchService.java
+1
-1
RoomService.java
...on/src/main/java/com/live/common/service/RoomService.java
+0
-6
MatchServiceImpl.java
...n/java/com/live/common/service/impl/MatchServiceImpl.java
+90
-84
RoomServiceImpl.java
...in/java/com/live/common/service/impl/RoomServiceImpl.java
+155
-155
No files found.
score-common/src/main/java/com/live/common/service/MatchService.java
View file @
f62515d2
...
@@ -35,7 +35,7 @@ public interface MatchService {
...
@@ -35,7 +35,7 @@ public interface MatchService {
ResponseData
<?>
getPlayerInfoSearch
(
PlayerInfoSearchRequest
searchRequest
,
HttpServletRequest
request
);
ResponseData
<?>
getPlayerInfoSearch
(
PlayerInfoSearchRequest
searchRequest
,
HttpServletRequest
request
);
ResponseData
<?>
getMatchList
(
GetMatchListRequest
commonStringId
,
HttpServletRequest
request
);
//
ResponseData<?> getMatchList(GetMatchListRequest commonStringId, HttpServletRequest request);
ResponseData
<?>
getMatchInfo
(
CommonStringId
commonStringId
,
HttpServletRequest
request
);
ResponseData
<?>
getMatchInfo
(
CommonStringId
commonStringId
,
HttpServletRequest
request
);
...
...
score-common/src/main/java/com/live/common/service/RoomService.java
View file @
f62515d2
...
@@ -11,12 +11,6 @@ import javax.servlet.http.HttpServletRequest;
...
@@ -11,12 +11,6 @@ import javax.servlet.http.HttpServletRequest;
public
interface
RoomService
{
public
interface
RoomService
{
ResponseData
<?>
getRoomInfo
(
CommonStringId
commonStringId
,
HttpServletRequest
request
);
ResponseData
<?>
anchorMatch
(
CommonStringId
commonIntId
,
HttpServletRequest
request
);
ResponseData
<?>
leaderboard
(
CommonStringId
commonStringId
);
ResponseData
<?>
getGiftList
(
HttpServletRequest
request
);
ResponseData
<?>
getGiftList
(
HttpServletRequest
request
);
ResponseData
<?>
sendGift
(
SendGiftRequest
sendGiftRequest
,
HttpServletRequest
request
);
ResponseData
<?>
sendGift
(
SendGiftRequest
sendGiftRequest
,
HttpServletRequest
request
);
...
...
score-common/src/main/java/com/live/common/service/impl/MatchServiceImpl.java
View file @
f62515d2
...
@@ -265,6 +265,7 @@ public class MatchServiceImpl implements MatchService {
...
@@ -265,6 +265,7 @@ public class MatchServiceImpl implements MatchService {
List
<
UserReserve
>
userReserves
=
userReserveMapper
.
selectList
(
Wrappers
.<
UserReserve
>
lambdaQuery
()
List
<
UserReserve
>
userReserves
=
userReserveMapper
.
selectList
(
Wrappers
.<
UserReserve
>
lambdaQuery
()
.
eq
(
UserReserve:
:
getUserId
,
account
.
getId
())
.
eq
(
UserReserve:
:
getUserId
,
account
.
getId
())
.
eq
(
UserReserve:
:
getDeleted
,
StatusEnum
.
ENABLE
.
getCode
())
.
eq
(
UserReserve:
:
getType
,
1
)
.
eq
(
UserReserve:
:
getType
,
1
)
.
orderByDesc
(
UserReserve:
:
getCreateTime
)
.
orderByDesc
(
UserReserve:
:
getCreateTime
)
);
);
...
@@ -622,85 +623,85 @@ public class MatchServiceImpl implements MatchService {
...
@@ -622,85 +623,85 @@ public class MatchServiceImpl implements MatchService {
return
ResponseData
.
successResponse
(
new
ResultPage
<>(
commonPage
.
getPageNum
(),
commonPage
.
getPageSize
(),
(
int
)
count
,
response
));
return
ResponseData
.
successResponse
(
new
ResultPage
<>(
commonPage
.
getPageNum
(),
commonPage
.
getPageSize
(),
(
int
)
count
,
response
));
}
}
@Override
//
@Override
public
ResponseData
<?>
getMatchList
(
GetMatchListRequest
commonStringId
,
HttpServletRequest
request
)
{
//
public ResponseData<?> getMatchList(GetMatchListRequest commonStringId, HttpServletRequest request) {
List
<
Match
>
matches
;
//
List<Match> matches;
//
QueryWrapper
<
Match
>
wrapper
=
new
QueryWrapper
<>();
//
QueryWrapper<Match> wrapper = new QueryWrapper<>();
wrapper
.
eq
(
"deleted"
,
StatusEnum
.
ENABLE
.
getCode
());
//
wrapper.eq("deleted", StatusEnum.ENABLE.getCode());
wrapper
.
eq
(
"source_type"
,
1
);
//
wrapper.eq("source_type", 1);
wrapper
.
ge
(
"match_time"
,
DateUtil
.
getStartTime
());
//
wrapper.ge("match_time", DateUtil.getStartTime());
//
Integer
status
=
commonStringId
.
getStatus
()
==
null
?
0
:
commonStringId
.
getStatus
();
//
Integer status = commonStringId.getStatus() == null ? 0 : commonStringId.getStatus();
switch
(
status
)
{
//
switch (status) {
case
-
1
:
//
case -1:
wrapper
.
notIn
(
"competition_status"
,
4
);
//
wrapper.notIn("competition_status", 4);
if
(
StringUtils
.
isNotBlank
(
commonStringId
.
getId
()))
{
//
if (StringUtils.isNotBlank(commonStringId.getId())) {
if
(
commonStringId
.
getId
().
length
()
<
10
)
{
//
if (commonStringId.getId().length() < 10) {
wrapper
.
apply
(
"FIND_IN_SET({0},category_id)"
,
commonStringId
.
getId
());
//
wrapper.apply("FIND_IN_SET({0},category_id)", commonStringId.getId());
}
else
{
//
} else {
wrapper
.
eq
(
"sports_id"
,
commonStringId
.
getId
());
//
wrapper.eq("sports_id", commonStringId.getId());
}
//
}
}
//
}
wrapper
.
orderByAsc
(
"match_time"
);
//
wrapper.orderByAsc("match_time");
matches
=
matchMapper
.
selectList
(
wrapper
);
//
matches = matchMapper.selectList(wrapper);
break
;
//
break;
case
1
:
//
case 1:
case
2
:
//
case 2:
case
3
:
//
case 3:
wrapper
.
eq
(
"competition_status"
,
status
);
//
wrapper.eq("competition_status", status);
if
(
StringUtils
.
isNotBlank
(
commonStringId
.
getId
()))
{
//
if (StringUtils.isNotBlank(commonStringId.getId())) {
if
(
commonStringId
.
getId
().
length
()
<
10
)
{
//
if (commonStringId.getId().length() < 10) {
wrapper
.
apply
(
"FIND_IN_SET({0},category_id)"
,
commonStringId
.
getId
());
//
wrapper.apply("FIND_IN_SET({0},category_id)", commonStringId.getId());
}
else
{
//
} else {
wrapper
.
eq
(
"sports_id"
,
commonStringId
.
getId
());
//
wrapper.eq("sports_id", commonStringId.getId());
}
//
}
}
//
}
//
wrapper
.
orderByAsc
(
"match_time"
);
//
wrapper.orderByAsc("match_time");
matches
=
matchMapper
.
selectList
(
wrapper
);
//
matches = matchMapper.selectList(wrapper);
break
;
//
break;
default
:
//
default:
wrapper
.
in
(
"competition_status"
,
1
,
2
);
//
wrapper.in("competition_status", 1, 2);
if
(
StringUtils
.
isNotBlank
(
commonStringId
.
getId
()))
{
//
if (StringUtils.isNotBlank(commonStringId.getId())) {
if
(
commonStringId
.
getId
().
length
()
<
10
)
{
//
if (commonStringId.getId().length() < 10) {
wrapper
.
apply
(
"FIND_IN_SET({0},category_id)"
,
commonStringId
.
getId
());
//
wrapper.apply("FIND_IN_SET({0},category_id)", commonStringId.getId());
}
else
{
//
} else {
wrapper
.
eq
(
"sports_id"
,
commonStringId
.
getId
());
//
wrapper.eq("sports_id", commonStringId.getId());
}
//
}
}
//
}
//
wrapper
.
orderByAsc
(
"match_time"
);
//
wrapper.orderByAsc("match_time");
matches
=
matchMapper
.
selectList
(
wrapper
);
//
matches = matchMapper.selectList(wrapper);
break
;
//
break;
}
//
}
//
MatchListResponse
matchListResponse
=
conversionByList
(
matches
,
true
);
//
MatchListResponse matchListResponse = conversionByList(matches, true);
//
try
{
//
try {
String
phone
=
CommonMethod
.
getUserPhone
(
request
);
//
String phone = CommonMethod.getUserPhone(request);
User
account
=
userMapper
.
selectOne
(
Wrappers
.<
User
>
lambdaQuery
()
//
User account = userMapper.selectOne(Wrappers.<User>lambdaQuery()
.
eq
(
User:
:
getPhone
,
phone
)
//
.eq(User::getPhone, phone)
);
//
);
//
List
<
UserReserve
>
userReserves
=
userReserveMapper
.
selectList
(
Wrappers
.<
UserReserve
>
lambdaQuery
()
//
List<UserReserve> userReserves = userReserveMapper.selectList(Wrappers.<UserReserve>lambdaQuery()
.
eq
(
UserReserve:
:
getUserId
,
account
.
getId
())
//
.eq(UserReserve::getUserId, account.getId())
.
eq
(
UserReserve:
:
getDeleted
,
0
)
//
.eq(UserReserve::getDeleted, 0)
);
//
);
Set
<
String
>
reservesId
=
userReserves
.
stream
().
map
(
UserReserve:
:
getMatchId
).
collect
(
Collectors
.
toSet
());
//
Set<String> reservesId = userReserves.stream().map(UserReserve::getMatchId).collect(Collectors.toSet());
//
matchListResponse
.
getMatchLists
().
forEach
(
match
->
{
//
matchListResponse.getMatchLists().forEach(match -> {
match
.
getMatchInfos
().
forEach
(
matchInfo
->
{
//
match.getMatchInfos().forEach(matchInfo -> {
if
(
reservesId
.
contains
(
matchInfo
.
getId
()))
{
//
if (reservesId.contains(matchInfo.getId())) {
matchInfo
.
setSubscribe
(
true
);
//
matchInfo.setSubscribe(true);
}
//
}
});
//
});
});
//
});
}
catch
(
RuntimeException
e
)
{
//
} catch (RuntimeException e) {
log
.
info
(
"未携带 token !"
);
//
log.info("未携带 token !");
}
//
}
return
ResponseData
.
successResponse
(
matchListResponse
);
//
return ResponseData.successResponse(matchListResponse);
}
//
}
@Override
@Override
public
ResponseData
<?>
getMatchInfo
(
CommonStringId
commonStringId
,
HttpServletRequest
request
)
{
public
ResponseData
<?>
getMatchInfo
(
CommonStringId
commonStringId
,
HttpServletRequest
request
)
{
...
@@ -781,22 +782,27 @@ public class MatchServiceImpl implements MatchService {
...
@@ -781,22 +782,27 @@ public class MatchServiceImpl implements MatchService {
long
count
=
userReserveMapper
.
selectCount
(
Wrappers
.<
UserReserve
>
lambdaQuery
()
long
count
=
userReserveMapper
.
selectCount
(
Wrappers
.<
UserReserve
>
lambdaQuery
()
.
eq
(
UserReserve:
:
getUserId
,
account
.
getId
())
.
eq
(
UserReserve:
:
getUserId
,
account
.
getId
())
.
eq
(
UserReserve:
:
getType
,
0
)
.
eq
(
UserReserve:
:
getDeleted
,
0
)
.
eq
(
UserReserve:
:
getDeleted
,
0
)
);
);
List
<
UserReserve
>
userReserves
=
userReserveMapper
.
selectList
(
Wrappers
.<
UserReserve
>
lambdaQuery
()
List
<
UserReserve
>
userReserves
=
userReserveMapper
.
selectList
(
Wrappers
.<
UserReserve
>
lambdaQuery
()
.
eq
(
UserReserve:
:
getUserId
,
account
.
getId
())
.
eq
(
UserReserve:
:
getUserId
,
account
.
getId
())
.
eq
(
UserReserve:
:
getDeleted
,
0
)
.
eq
(
UserReserve:
:
getDeleted
,
0
)
.
eq
(
UserReserve:
:
getType
,
0
)
.
last
(
String
.
format
(
" limit %s,%s"
,
jumpNum
,
commonPage
.
getPageSize
()))
.
last
(
String
.
format
(
" limit %s,%s"
,
jumpNum
,
commonPage
.
getPageSize
()))
);
);
List
<
Match
>
matches
=
new
ArrayList
<>();
List
<
Match
>
matches
=
new
ArrayList
<>();
if
(
userReserves
.
size
()
>
0
)
{
if
(
userReserves
.
size
()
>
0
)
{
matches
=
matchMapper
.
selectList
(
Wrappers
.<
Match
>
lambdaQuery
()
for
(
UserReserve
userReserve
:
userReserves
)
{
.
in
(
Match:
:
getId
,
userReserves
.
stream
().
map
(
UserReserve:
:
getMatchId
).
collect
(
Collectors
.
toSet
()))
Match
match
=
matchMapper
.
selectById
(
userReserve
.
getMatchId
());
.
eq
(
Match:
:
getDeleted
,
0
)
if
(
match
!=
null
)
{
.
orderByDesc
(
Match:
:
getMatchTime
)
matches
.
add
(
match
);
);
}
else
{
count
--;
}
}
}
}
MatchHomeListByDayResponse
response
=
new
MatchHomeListByDayResponse
();
MatchHomeListByDayResponse
response
=
new
MatchHomeListByDayResponse
();
...
...
score-common/src/main/java/com/live/common/service/impl/RoomServiceImpl.java
View file @
f62515d2
...
@@ -74,161 +74,161 @@ public class RoomServiceImpl implements RoomService {
...
@@ -74,161 +74,161 @@ public class RoomServiceImpl implements RoomService {
@Value
(
"${surroundings}"
)
@Value
(
"${surroundings}"
)
private
String
surroundings
;
private
String
surroundings
;
@Override
//
@Override
public
ResponseData
<?>
getRoomInfo
(
CommonStringId
commonStringId
,
HttpServletRequest
request
)
{
//
public ResponseData<?> getRoomInfo(CommonStringId commonStringId, HttpServletRequest request) {
if
(
StringUtils
.
isBlank
(
commonStringId
.
getId
()))
{
//
if (StringUtils.isBlank(commonStringId.getId())) {
return
ResponseData
.
fail400Response
(
"请传入房间ID"
);
//
return ResponseData.fail400Response("请传入房间ID");
}
//
}
//
Room
room
=
roomMapper
.
selectById
(
commonStringId
.
getId
());
//
Room room = roomMapper.selectById(commonStringId.getId());
if
(
room
==
null
)
{
//
if (room == null) {
return
ResponseData
.
fail400Response
(
"房间ID错误"
);
//
return ResponseData.fail400Response("房间ID错误");
}
//
}
User
anchor
=
userMapper
.
selectById
(
room
.
getUserId
());
//
User anchor = userMapper.selectById(room.getUserId());
//
GetRoomInfoResponse
getRoomInfoResponse
=
GetRoomInfoResponse
.
builder
()
//
GetRoomInfoResponse getRoomInfoResponse = GetRoomInfoResponse.builder()
.
roomId
(
room
.
getHuanXinRoomId
())
//
.roomId(room.getHuanXinRoomId())
.
roomNum
(
room
.
getRoomNum
())
//
.roomNum(room.getRoomNum())
.
roomName
(
room
.
getRoomName
())
//
.roomName(room.getRoomName())
.
roomAnnouncement
(
room
.
getAnnouncement
())
//
.roomAnnouncement(room.getAnnouncement())
.
anchorAvatar
(
ConstantValue
.
completeAddress
(
anchor
.
getUserIcon
()))
//
.anchorAvatar(ConstantValue.completeAddress(anchor.getUserIcon()))
.
anchorDesc
(
anchor
.
getUserDesc
())
//
.anchorDesc(anchor.getUserDesc())
.
anchorName
(
anchor
.
getUserName
())
//
.anchorName(anchor.getUserName())
.
isFollow
(
false
)
//
.isFollow(false)
.
hotNum
(
room
.
getHotNum
())
//
.hotNum(room.getHotNum())
.
userGold
(
0
)
//
.userGold(0)
.
userId
(
""
)
//
.userId("")
.
liveUrl
(
room
.
getLiveUrl
())
//
.liveUrl(room.getLiveUrl())
.
userName
(
""
)
//
.userName("")
.
userLevel
(
0
)
//
.userLevel(0)
.
qqNum
(
StringUtils
.
isBlank
(
room
.
getQqNum
())
?
""
:
room
.
getQqNum
())
//
.qqNum(StringUtils.isBlank(room.getQqNum()) ? "" : room.getQqNum())
.
qqGroupNum
(
StringUtils
.
isBlank
(
room
.
getQqGroupNum
())
?
""
:
room
.
getQqGroupNum
())
//
.qqGroupNum(StringUtils.isBlank(room.getQqGroupNum()) ? "" : room.getQqGroupNum())
.
wxNum
(
StringUtils
.
isBlank
(
room
.
getWxNum
())
?
""
:
room
.
getWxNum
())
//
.wxNum(StringUtils.isBlank(room.getWxNum()) ? "" : room.getWxNum())
.
roomStatus
(
room
.
getType
())
//
.roomStatus(room.getType())
.
matchId
(
room
.
getMatchId
())
//
.matchId(room.getMatchId())
.
build
();
//
.build();
//
String
phone
=
null
;
//
String phone = null;
User
account
=
null
;
//
User account = null;
try
{
//
try {
phone
=
CommonMethod
.
getUserPhone
(
request
);
//
phone = CommonMethod.getUserPhone(request);
account
=
userMapper
.
selectOne
(
Wrappers
.<
User
>
lambdaQuery
()
//
account = userMapper.selectOne(Wrappers.<User>lambdaQuery()
.
eq
(
User:
:
getPhone
,
phone
)
//
.eq(User::getPhone, phone)
);
//
);
}
catch
(
RuntimeException
e
)
{
//
} catch (RuntimeException e) {
log
.
info
(
"未携带 token 创建游客账户!"
);
//
log.info("未携带 token 创建游客账户!");
try
{
//
try {
String
deviceId
=
CommonMethod
.
getDeviceId
(
request
);
//
String deviceId = CommonMethod.getDeviceId(request);
account
=
userMapper
.
selectOne
(
Wrappers
.<
User
>
lambdaQuery
()
//
account = userMapper.selectOne(Wrappers.<User>lambdaQuery()
.
eq
(
User:
:
getDeviceId
,
deviceId
)
//
.eq(User::getDeviceId, deviceId)
.
eq
(
User:
:
getDeleted
,
0
)
//
.eq(User::getDeleted, 0)
);
//
);
if
(
account
==
null
)
{
//
if (account == null) {
account
=
userService
.
registerByDeviceId
(
deviceId
,
IPUtil
.
getClientIP
(
request
));
//
account = userService.registerByDeviceId(deviceId, IPUtil.getClientIP(request));
}
//
}
}
catch
(
RuntimeException
dev
)
{
//
} catch (RuntimeException dev) {
log
.
error
(
"未携带 DeviceId"
);
//
log.error("未携带 DeviceId");
}
//
}
}
//
}
//
if
(
account
!=
null
)
{
//
if (account != null) {
getRoomInfoResponse
.
setHuanXinUserId
(
"live_"
+
account
.
getId
()
+
surroundings
);
//
getRoomInfoResponse.setHuanXinUserId("live_" + account.getId() + surroundings);
getRoomInfoResponse
.
setUserId
(
account
.
getId
());
//
getRoomInfoResponse.setUserId(account.getId());
getRoomInfoResponse
.
setUserName
(
account
.
getUserName
());
//
getRoomInfoResponse.setUserName(account.getUserName());
getRoomInfoResponse
.
setUserLevel
(
account
.
getLevel
());
//
getRoomInfoResponse.setUserLevel(account.getLevel());
Follow
follow
=
followMapper
.
selectOne
(
Wrappers
.<
Follow
>
lambdaQuery
()
//
Follow follow = followMapper.selectOne(Wrappers.<Follow>lambdaQuery()
.
eq
(
Follow:
:
getUserId
,
account
.
getId
())
//
.eq(Follow::getUserId, account.getId())
.
eq
(
Follow:
:
getFollowId
,
anchor
.
getId
())
//
.eq(Follow::getFollowId, anchor.getId())
.
eq
(
Follow:
:
getDeleted
,
0
)
//
.eq(Follow::getDeleted, 0)
);
//
);
if
(
follow
!=
null
)
{
//
if (follow != null) {
getRoomInfoResponse
.
setFollow
(
true
);
//
getRoomInfoResponse.setFollow(true);
}
//
}
//
UserGold
userGold
=
userGoldMapper
.
selectById
(
account
.
getId
());
//
UserGold userGold = userGoldMapper.selectById(account.getId());
if
(
userGold
!=
null
)
{
//
if (userGold != null) {
getRoomInfoResponse
.
setUserGold
(
userGold
.
getGold
());
//
getRoomInfoResponse.setUserGold(userGold.getGold());
}
//
}
}
//
}
return
ResponseData
.
successResponse
(
getRoomInfoResponse
);
//
return ResponseData.successResponse(getRoomInfoResponse);
}
//
}
@Override
//
@Override
public
ResponseData
<?>
anchorMatch
(
CommonStringId
commonIntId
,
HttpServletRequest
request
)
{
//
public ResponseData<?> anchorMatch(CommonStringId commonIntId, HttpServletRequest request) {
if
(
commonIntId
.
getId
()
==
null
)
{
//
if (commonIntId.getId() == null) {
return
ResponseData
.
fail400Response
(
"请传入房间ID"
);
//
return ResponseData.fail400Response("请传入房间ID");
}
//
}
//
Room
room
=
roomMapper
.
selectById
(
commonIntId
.
getId
());
//
Room room = roomMapper.selectById(commonIntId.getId());
if
(
room
==
null
)
{
//
if (room == null) {
return
ResponseData
.
fail400Response
(
"房间ID错误"
);
//
return ResponseData.fail400Response("房间ID错误");
}
//
}
//
List
<
RoomHostRecord
>
roomHostRecords
=
roomHostRecordMapper
.
selectList
(
Wrappers
.<
RoomHostRecord
>
lambdaQuery
()
//
List<RoomHostRecord> roomHostRecords = roomHostRecordMapper.selectList(Wrappers.<RoomHostRecord>lambdaQuery()
.
eq
(
RoomHostRecord:
:
getDeleted
,
0
)
//
.eq(RoomHostRecord::getDeleted, 0)
.
eq
(
RoomHostRecord:
:
getRoomId
,
commonIntId
.
getId
())
//
.eq(RoomHostRecord::getRoomId, commonIntId.getId())
.
ge
(
RoomHostRecord:
:
getStartTime
,
new
Date
())
//
.ge(RoomHostRecord::getStartTime, new Date())
);
//
);
//
if
(
roomHostRecords
!=
null
&&
roomHostRecords
.
size
()
>
0
)
{
//
if (roomHostRecords != null && roomHostRecords.size() > 0) {
Set
<
String
>
matches
=
roomHostRecords
.
stream
().
map
(
RoomHostRecord:
:
getMatchId
).
collect
(
Collectors
.
toSet
());
//
Set<String> matches = roomHostRecords.stream().map(RoomHostRecord::getMatchId).collect(Collectors.toSet());
List
<
Match
>
matchDb
=
matchMapper
.
selectBatchIds
(
matches
);
//
List<Match> matchDb = matchMapper.selectBatchIds(matches);
//
MatchListResponse
matchListResponse
=
matchService
.
conversionByList
(
matchDb
,
false
);
//
MatchListResponse matchListResponse = matchService.conversionByList(matchDb, false);
//
try
{
//
try {
String
phone
=
CommonMethod
.
getUserPhone
(
request
);
//
String phone = CommonMethod.getUserPhone(request);
User
account
=
userMapper
.
selectOne
(
Wrappers
.<
User
>
lambdaQuery
()
//
User account = userMapper.selectOne(Wrappers.<User>lambdaQuery()
.
eq
(
User:
:
getPhone
,
phone
)
//
.eq(User::getPhone, phone)
);
//
);
//
List
<
UserReserve
>
userReserves
=
userReserveMapper
.
selectList
(
Wrappers
.<
UserReserve
>
lambdaQuery
()
//
List<UserReserve> userReserves = userReserveMapper.selectList(Wrappers.<UserReserve>lambdaQuery()
.
eq
(
UserReserve:
:
getUserId
,
account
.
getId
())
//
.eq(UserReserve::getUserId, account.getId())
.
eq
(
UserReserve:
:
getDeleted
,
0
)
//
.eq(UserReserve::getDeleted, 0)
);
//
);
Set
<
String
>
reservesId
=
userReserves
.
stream
().
map
(
UserReserve:
:
getMatchId
).
collect
(
Collectors
.
toSet
());
//
Set<String> reservesId = userReserves.stream().map(UserReserve::getMatchId).collect(Collectors.toSet());
//
matchListResponse
.
getMatchLists
().
forEach
(
match
->
{
//
matchListResponse.getMatchLists().forEach(match -> {
match
.
getMatchInfos
().
forEach
(
matchInfo
->
{
//
match.getMatchInfos().forEach(matchInfo -> {
if
(
reservesId
.
contains
(
matchInfo
.
getId
()))
{
//
if (reservesId.contains(matchInfo.getId())) {
matchInfo
.
setSubscribe
(
true
);
//
matchInfo.setSubscribe(true);
}
//
}
});
//
});
});
//
});
}
catch
(
RuntimeException
e
)
{
//
} catch (RuntimeException e) {
log
.
info
(
"未携带 token !"
);
//
log.info("未携带 token !");
}
//
}
return
ResponseData
.
successResponse
(
matchListResponse
);
//
return ResponseData.successResponse(matchListResponse);
}
//
}
return
ResponseData
.
successResponse
(
MatchListResponse
.
builder
()
//
return ResponseData.successResponse(MatchListResponse.builder()
.
matchLists
(
new
ArrayList
<>())
//
.matchLists(new ArrayList<>())
.
build
());
//
.build());
}
//
}
@Override
//
@Override
public
ResponseData
<?>
leaderboard
(
CommonStringId
commonStringId
)
{
//
public ResponseData<?> leaderboard(CommonStringId commonStringId) {
if
(
StringUtils
.
isBlank
(
commonStringId
.
getId
()))
{
//
if (StringUtils.isBlank(commonStringId.getId())) {
return
ResponseData
.
fail400Response
(
"请传入房间ID"
);
//
return ResponseData.fail400Response("请传入房间ID");
}
//
}
//
Room
room
=
roomMapper
.
selectById
(
commonStringId
.
getId
());
//
Room room = roomMapper.selectById(commonStringId.getId());
if
(
room
==
null
)
{
//
if (room == null) {
return
ResponseData
.
fail400Response
(
"房间ID错误"
);
//
return ResponseData.fail400Response("房间ID错误");
}
//
}
//
List
<
GetLeaderboardResponse
>
leaderboard
=
giftRecordMapper
.
getLeaderboard
(
room
.
getUserId
());
//
List<GetLeaderboardResponse> leaderboard = giftRecordMapper.getLeaderboard(room.getUserId());
List
<
LeaderboardResponse
>
responseList
=
leaderboard
.
stream
().
map
(
b
->
{
//
List<LeaderboardResponse> responseList = leaderboard.stream().map(b -> {
User
user
=
userMapper
.
selectById
(
b
.
getUserId
());
//
User user = userMapper.selectById(b.getUserId());
return
LeaderboardResponse
.
builder
()
//
return LeaderboardResponse.builder()
.
goldNum
(
b
.
getGiftGold
())
//
.goldNum(b.getGiftGold())
.
userAvatar
(
ConstantValue
.
completeAddress
(
user
.
getUserIcon
()))
//
.userAvatar(ConstantValue.completeAddress(user.getUserIcon()))
.
userId
(
user
.
getId
())
//
.userId(user.getId())
.
userLevel
(
user
.
getLevel
())
//
.userLevel(user.getLevel())
.
userName
(
user
.
getUserName
())
//
.userName(user.getUserName())
.
build
();
//
.build();
}).
collect
(
Collectors
.
toList
());
//
}).collect(Collectors.toList());
return
ResponseData
.
successResponse
(
responseList
);
//
return ResponseData.successResponse(responseList);
}
//
}
@Override
@Override
public
ResponseData
<?>
getGiftList
(
HttpServletRequest
request
)
{
public
ResponseData
<?>
getGiftList
(
HttpServletRequest
request
)
{
...
...
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