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
54210b2e
Commit
54210b2e
authored
Jul 23, 2021
by
lenx065@gmail.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整数据结构
parent
5c400388
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
100 additions
and
69 deletions
+100
-69
MatchHomeListByDayResponse.java
...ive/common/domain/dto/api/MatchHomeListByDayResponse.java
+3
-0
GetMatchListByRequest.java
...com/live/common/domain/request/GetMatchListByRequest.java
+3
-1
MatchServiceImpl.java
...n/java/com/live/common/service/impl/MatchServiceImpl.java
+63
-51
UserServiceImpl.java
...in/java/com/live/common/service/impl/UserServiceImpl.java
+0
-5
DateUtil.java
...-common/src/main/java/com/live/common/utils/DateUtil.java
+31
-12
No files found.
score-common/src/main/java/com/live/common/domain/dto/api/MatchHomeListByDayResponse.java
View file @
54210b2e
...
...
@@ -15,6 +15,8 @@ public class MatchHomeListByDayResponse {
private
String
matchDay
;
private
String
weekNum
;
private
List
<
MatchInfo
>
matchInfos
;
@Data
...
...
@@ -22,6 +24,7 @@ public class MatchHomeListByDayResponse {
@NoArgsConstructor
@AllArgsConstructor
public
static
class
MatchInfo
{
private
String
matchId
;
// 0足球 1篮球
private
Integer
sportsType
;
private
String
matchShortName
;
...
...
score-common/src/main/java/com/live/common/domain/request/GetMatchListByRequest.java
View file @
54210b2e
...
...
@@ -2,9 +2,11 @@ package com.live.common.domain.request;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
@Data
public
class
GetMatchListByRequest
{
@EqualsAndHashCode
(
callSuper
=
true
)
public
class
GetMatchListByRequest
extends
CommonPage
{
private
String
sportsId
;
...
...
score-common/src/main/java/com/live/common/service/impl/MatchServiceImpl.java
View file @
54210b2e
...
...
@@ -117,7 +117,7 @@ public class MatchServiceImpl implements MatchService {
wrapper
.
eq
(
"source_type"
,
1
);
if
(
StringUtils
.
isNotBlank
(
commonStringId
.
getSportsId
()))
{
if
(
commonStringId
.
getSportsId
().
equals
(
"-1"
))
{
if
(
commonStringId
.
getSportsId
().
equals
(
"-1"
))
{
wrapper
.
eq
(
"hot"
,
1
);
}
else
{
wrapper
.
eq
(
"sports_id"
,
commonStringId
.
getSportsId
());
...
...
@@ -126,96 +126,108 @@ public class MatchServiceImpl implements MatchService {
if
(
StringUtils
.
isNotBlank
(
commonStringId
.
getMatchTime
()))
{
wrapper
.
ge
(
"match_time"
,
commonStringId
.
getMatchTime
()
+
" 00:00:00"
);
wrapper
.
le
(
"match_time"
,
commonStringId
.
getSportsId
()
+
" 23:59:59"
);
}
else
{
wrapper
.
ge
(
"match_time"
,
DateUtil
.
getYsdStartTime
());
}
//-1 全部 0 展示正在进行 和 未开始 1 正在进行 2未开始 3完场
//1正在进行 2未开始 3完场 4 未知
Integer
status
=
commonStringId
.
getStatus
()
==
null
?
0
:
commonStringId
.
getStatus
();
int
jumpNum
=
(
commonStringId
.
getPageNum
()
-
1
)
*
commonStringId
.
getPageSize
();
long
count
=
0
;
switch
(
status
)
{
case
-
1
:
wrapper
.
notIn
(
"competition_status"
,
4
);
wrapper
.
orderBy
De
sc
(
"match_time"
);
wrapper
.
last
(
String
.
format
(
" limit %s,%s"
,
0
,
30
)
);
wrapper
.
orderBy
A
sc
(
"match_time"
);
count
=
matchMapper
.
selectCount
(
wrapper
);
wrapper
.
last
(
String
.
format
(
" limit %s,%s"
,
jumpNum
,
commonStringId
.
getPageSize
()));
matches
=
matchMapper
.
selectList
(
wrapper
);
break
;
case
1
:
case
2
:
case
3
:
wrapper
.
eq
(
"competition_status"
,
status
);
wrapper
.
orderBy
De
sc
(
"match_time"
);
wrapper
.
last
(
String
.
format
(
" limit %s,%s"
,
0
,
30
)
);
wrapper
.
orderBy
A
sc
(
"match_time"
);
count
=
matchMapper
.
selectCount
(
wrapper
);
wrapper
.
last
(
String
.
format
(
" limit %s,%s"
,
jumpNum
,
commonStringId
.
getPageSize
()));
matches
=
matchMapper
.
selectList
(
wrapper
);
break
;
default
:
wrapper
.
in
(
"competition_status"
,
1
,
2
);
wrapper
.
orderBy
De
sc
(
"match_time"
);
wrapper
.
last
(
String
.
format
(
" limit %s,%s"
,
0
,
30
)
);
wrapper
.
orderBy
A
sc
(
"match_time"
);
count
=
matchMapper
.
selectCount
(
wrapper
);
wrapper
.
last
(
String
.
format
(
" limit %s,%s"
,
jumpNum
,
commonStringId
.
getPageSize
()));
matches
=
matchMapper
.
selectList
(
wrapper
);
break
;
}
MatchHomeListByDayResponse
response
=
new
MatchHomeListByDayResponse
();
response
.
setMatchInfos
(
new
ArrayList
<>());
for
(
int
i
=
matches
.
size
()
-
1
;
i
>=
0
;
i
--)
{
if
(
i
==
matches
.
size
()
-
1
)
{
response
.
setMatchDay
(
DateUtil
.
format
(
matches
.
get
(
0
).
getMatchTime
(),
DateUtil
.
YMD_
));
}
Match
match
=
matches
.
get
(
i
);
Map
<
String
,
List
<
MatchHomeListByDayResponse
.
MatchInfo
>>
responseMap
=
new
LinkedHashMap
<>();
for
(
Match
match
:
matches
)
{
MatchHomeListByDayResponse
.
MatchInfo
matchInfo
=
new
MatchHomeListByDayResponse
.
MatchInfo
();
matchInfo
.
setSubscribed
(
false
);
matchInfo
.
setMatchId
(
match
.
getId
());
if
(
DateUtil
.
format
(
match
.
getMatchTime
(),
DateUtil
.
YMD_
).
equals
(
response
.
getMatchDay
()))
{
try
{
String
phone
=
CommonMethod
.
getUserPhone
(
request
);
User
account
=
userMapper
.
selectOne
(
Wrappers
.<
User
>
lambdaQuery
()
.
eq
(
User:
:
getPhone
,
phone
)
try
{
String
phone
=
CommonMethod
.
getUserPhone
(
request
);
User
account
=
userMapper
.
selectOne
(
Wrappers
.<
User
>
lambdaQuery
()
.
eq
(
User:
:
getPhone
,
phone
)
);
if
(
account
!=
null
)
{
UserReserve
userReserves
=
userReserveMapper
.
selectOne
(
Wrappers
.<
UserReserve
>
lambdaQuery
()
.
eq
(
UserReserve:
:
getUserId
,
account
.
getId
())
.
eq
(
UserReserve:
:
getMatchId
,
match
.
getId
())
.
eq
(
UserReserve:
:
getDeleted
,
0
)
);
if
(
account
!=
null
)
{
UserReserve
userReserves
=
userReserveMapper
.
selectOne
(
Wrappers
.<
UserReserve
>
lambdaQuery
()
.
eq
(
UserReserve:
:
getUserId
,
account
.
getId
())
.
eq
(
UserReserve:
:
getMatchId
,
match
.
getId
())
.
eq
(
UserReserve:
:
getDeleted
,
0
)
);
if
(
userReserves
!=
null
)
matchInfo
.
setSubscribed
(
true
);
}
}
catch
(
Exception
e
)
{
log
.
warn
(
"未携带 Token"
);
if
(
userReserves
!=
null
)
matchInfo
.
setSubscribed
(
true
);
}
}
catch
(
Exception
e
)
{
log
.
warn
(
"未携带 Token"
);
}
Team
home
=
teamMapper
.
selectById
(
match
.
getHomeId
());
Team
away
=
teamMapper
.
selectById
(
match
.
getAwayId
());
Sports
sports
=
sportsMapper
.
selectById
(
match
.
getSportsId
());
Team
home
=
teamMapper
.
selectById
(
match
.
getHomeId
());
Team
away
=
teamMapper
.
selectById
(
match
.
getAwayId
());
Sports
sports
=
sportsMapper
.
selectById
(
match
.
getSportsId
());
matchInfo
.
setMatchShortName
(
match
.
getCompetitionShortName
());
matchInfo
.
setAway
(
MatchListInfo
.
builder
()
.
teamName
(
away
.
getTeamName
())
.
teamLogo
(
away
.
getTeamIcon
())
.
score
(
match
.
getAwayScore
())
.
build
());
matchInfo
.
setHome
(
MatchListInfo
.
builder
()
.
teamName
(
home
.
getTeamName
())
.
teamLogo
(
home
.
getTeamIcon
())
.
score
(
match
.
getHomeScore
())
.
build
());
matchInfo
.
setMatchTime
(
DateUtil
.
format
(
match
.
getMatchTime
(),
DateUtil
.
HM_
));
matchInfo
.
setSportsType
(
sports
.
getSportsId
());
matchInfo
.
setMatchShortName
(
match
.
getCompetitionShortName
());
matchInfo
.
setAway
(
MatchListInfo
.
builder
()
.
teamName
(
away
.
getTeamName
())
.
teamLogo
(
away
.
getTeamIcon
())
.
score
(
match
.
getAwayScore
())
.
build
());
matchInfo
.
setHome
(
MatchListInfo
.
builder
()
.
teamName
(
home
.
getTeamName
())
.
teamLogo
(
home
.
getTeamIcon
())
.
score
(
match
.
getHomeScore
())
.
build
());
matchInfo
.
setMatchTime
(
DateUtil
.
format
(
match
.
getMatchTime
(),
DateUtil
.
HM_
));
matchInfo
.
setSportsType
(
sports
.
getSportsId
());
response
.
getMatchInfos
().
add
(
matchInfo
);
}
responseMap
.
computeIfAbsent
(
DateUtil
.
format
(
match
.
getMatchTime
(),
DateUtil
.
YMD_
),
m
->
new
ArrayList
<>()).
add
(
matchInfo
);
}
return
ResponseData
.
successResponse
(
response
);
List
<
MatchHomeListByDayResponse
>
responses
=
new
ArrayList
<>();
for
(
String
key
:
responseMap
.
keySet
()){
responses
.
add
(
MatchHomeListByDayResponse
.
builder
()
.
matchDay
(
key
)
.
weekNum
(
DateUtil
.
returnWeek
(
DateUtil
.
getDateByStringYMD
(
key
)))
.
matchInfos
(
responseMap
.
get
(
key
))
.
build
());
}
return
ResponseData
.
successResponse
(
new
ResultPage
(
commonStringId
.
getPageNum
(),
commonStringId
.
getPageSize
(),
(
int
)
count
,
responses
));
}
@Override
public
ResponseData
<?>
getMatchTypeInfoList
(
HttpServletRequest
request
)
{
String
key
=
RedisKeySplicing
.
requestLock
(
"getMatchTypeInfoList"
,
"0"
);
if
(
redisUtilsService
.
existsKey
(
key
))
{
if
(
redisUtilsService
.
existsKey
(
key
))
{
String
cacheInfo
=
redisUtilsService
.
getCacheStringInfo
(
key
);
GetMatchTypeInfoListResponse
response
=
JSONObject
.
toJavaObject
(
JSONObject
.
parseObject
(
cacheInfo
),
GetMatchTypeInfoListResponse
.
class
);
return
ResponseData
.
successResponse
(
response
);
...
...
@@ -250,7 +262,7 @@ public class MatchServiceImpl implements MatchService {
public
ResponseData
<?>
getTeamInfoList
(
HttpServletRequest
request
)
{
String
key
=
RedisKeySplicing
.
requestLock
(
"getTeamInfoList"
,
"0"
);
if
(
redisUtilsService
.
existsKey
(
key
))
{
if
(
redisUtilsService
.
existsKey
(
key
))
{
String
cacheInfo
=
redisUtilsService
.
getCacheStringInfo
(
key
);
GetTeamInfoListResponse
response
=
JSONObject
.
toJavaObject
(
JSONObject
.
parseObject
(
cacheInfo
),
GetTeamInfoListResponse
.
class
);
return
ResponseData
.
successResponse
(
response
);
...
...
score-common/src/main/java/com/live/common/service/impl/UserServiceImpl.java
View file @
54210b2e
...
...
@@ -239,11 +239,6 @@ public class UserServiceImpl implements UserService {
.
gold
(
0
)
.
userId
(
accountDb
.
getId
())
.
build
());
huanXinIMService
.
registerUser
(
HuanXinIMServiceImpl
.
UserRegistration
.
builder
()
.
nickName
(
accountDb
.
getUserName
())
.
password
(
"123456"
)
.
username
(
"live_"
+
accountDb
.
getId
()
+
surroundings
)
.
build
());
}
}
...
...
score-common/src/main/java/com/live/common/utils/DateUtil.java
View file @
54210b2e
...
...
@@ -33,6 +33,8 @@ public class DateUtil {
public
final
static
String
MM
=
"MM"
;
public
final
static
String
YYYY
=
"yyyy"
;
public
final
static
Map
<
Integer
,
String
>
weekMap
=
new
HashMap
<>(
7
);
/**
* 返回一个ThreadLocal的sdf,每个线程只会new一次sdf
*
...
...
@@ -326,6 +328,7 @@ public class DateUtil {
/**
* 获取多少天以后开始时间
*
* @return
*/
public
static
Date
getAddDayStartTime
(
int
addDay
)
{
...
...
@@ -340,6 +343,7 @@ public class DateUtil {
/**
* 获取多少天以后结束时间
*
* @return
*/
public
static
Date
getAddDayEndTime
(
int
addDay
)
{
...
...
@@ -377,20 +381,24 @@ public class DateUtil {
}
}
public
static
void
main
(
String
[]
args
)
{
// System.out.println(DateUtil.isEffectiveDate(DateUtil.parse(DateUtil.format(new Date(), "HH:mm:ss"), "HH:mm:ss"), DateUtil.parse("00:00:00", "HH:mm:ss"), DateUtil.parse("16:00:00", "HH:mm:ss")));
// System.out.println(getYsdStartTime());
public
static
String
returnWeek
(
Date
date
)
{
if
(
weekMap
.
size
()
==
0
){
weekMap
.
put
(
1
,
"星期日"
);
weekMap
.
put
(
2
,
"星期一"
);
weekMap
.
put
(
3
,
"星期二"
);
weekMap
.
put
(
4
,
"星期三"
);
weekMap
.
put
(
5
,
"星期四"
);
weekMap
.
put
(
6
,
"星期五"
);
weekMap
.
put
(
7
,
"星期六"
);
}
// System.out.println("25/06/2015".indexOf("/") > 3);
// System.out.println("2015/06/06".indexOf("/") > 3);
// System.out.println(parse("25/06/2015",DMY));
// Map<Date,Integer> map = new HashMap<>();
// map.put(getStartTime(),1);
// Integer num = map.get(getStartTime());
// System.out.println(num);
//
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
date
);
return
weekMap
.
get
(
calendar
.
get
(
Calendar
.
DAY_OF_WEEK
));
}
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
returnWeek
(
getDateByStringYMD
(
"2021-07-23"
)));
System
.
out
.
println
(
"AD"
+
IdGen
.
randomLong
(
3
)
+
String
.
valueOf
(
System
.
currentTimeMillis
()).
substring
(
5
));
}
...
...
@@ -423,6 +431,17 @@ public class DateUtil {
return
0
;
}
public
static
Date
getDateByStringYMD
(
String
str
)
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
YMD_
,
Locale
.
ENGLISH
);
Date
d2
=
null
;
try
{
d2
=
sdf
.
parse
(
str
);
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
return
d2
;
}
public
static
Date
getEnlishDate
(
String
str
)
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"MMM d, yyyy K:m:s a"
,
Locale
.
ENGLISH
);
Date
d2
=
null
;
...
...
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