Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
A
antai-sport-http-server
Project
Project
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
antai-sport
antai-sport-http-server
Commits
56fde268
Commit
56fde268
authored
May 13, 2022
by
liming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
排行列表页
parent
b2cdc19b
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
136 additions
and
8 deletions
+136
-8
SimpleMatchUserScheduleVO.java
...i/business/simplematch/dto/SimpleMatchUserScheduleVO.java
+9
-0
SimpleMatchBusinessMapper.java
...usiness/simplematch/mapper/SimpleMatchBusinessMapper.java
+4
-0
SportUserTrainingLogBusinessMapper.java
...raininglog/mapper/SportUserTrainingLogBusinessMapper.java
+3
-0
SportUserTrainingLogService.java
...ness/traininglog/service/SportUserTrainingLogService.java
+52
-4
SportUserController.java
...ver/api/business/user/controller/SportUserController.java
+8
-4
ScheduleResponseDTO.java
...ver/server/api/business/user/dto/ScheduleResponseDTO.java
+25
-0
ScheduleVO.java
.../http/server/server/api/business/user/dto/ScheduleVO.java
+16
-0
SimpleMatchBusinessMapper.xml
...esources/mapper/simplematch/SimpleMatchBusinessMapper.xml
+8
-0
SportUserTrainingLogBusinessMapper.xml
...mapper/traininglog/SportUserTrainingLogBusinessMapper.xml
+11
-0
No files found.
server-api/src/main/java/com/antai/sport/http/server/server/api/business/simplematch/dto/SimpleMatchUserScheduleVO.java
0 → 100644
View file @
56fde268
package
com
.
antai
.
sport
.
http
.
server
.
server
.
api
.
business
.
simplematch
.
dto
;
import
lombok.Data
;
@Data
public
class
SimpleMatchUserScheduleVO
{
private
Integer
day
;
private
String
time
;
}
server-api/src/main/java/com/antai/sport/http/server/server/api/business/simplematch/mapper/SimpleMatchBusinessMapper.java
View file @
56fde268
...
...
@@ -2,8 +2,10 @@ package com.antai.sport.http.server.server.api.business.simplematch.mapper;
import
com.antai.sport.http.server.server.api.business.simplematch.dto.RespSimpleMatchList
;
import
com.antai.sport.http.server.server.api.business.simplematch.dto.RespSimpleMatchRank
;
import
com.antai.sport.http.server.server.api.business.simplematch.dto.SimpleMatchUserScheduleVO
;
import
org.apache.ibatis.annotations.Param
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.util.List
;
...
...
@@ -15,4 +17,6 @@ public interface SimpleMatchBusinessMapper {
List
<
RespSimpleMatchRank
>
getSimpleMatchRank
(
@Param
(
"matchId"
)
Long
matchId
);
List
<
Long
>
getRegisterList
(
@Param
(
"matchId"
)
Long
matchId
);
List
<
SimpleMatchUserScheduleVO
>
getUserRegistSchedule
(
@Param
(
"playerId"
)
Long
playerId
,
@Param
(
"beginDate"
)
LocalDate
beginDate
,
@Param
(
"endDate"
)
LocalDate
endDate
,
@Param
(
"today"
)
LocalDate
today
);
}
server-api/src/main/java/com/antai/sport/http/server/server/api/business/traininglog/mapper/SportUserTrainingLogBusinessMapper.java
View file @
56fde268
...
...
@@ -3,6 +3,7 @@ package com.antai.sport.http.server.server.api.business.traininglog.mapper;
import
com.antai.sport.http.server.repository.sport.entity.SportUserTrainingLog
;
import
com.antai.sport.http.server.server.api.business.traininglog.dto.SportUserTrainingLogSummaryVO
;
import
com.antai.sport.http.server.server.api.business.traininglog.dto.SportUserTrainingLogVO
;
import
com.antai.sport.http.server.server.api.business.user.dto.ScheduleResponseDTO
;
import
org.apache.ibatis.annotations.Param
;
import
java.time.LocalDate
;
...
...
@@ -17,4 +18,6 @@ public interface SportUserTrainingLogBusinessMapper {
@Param
(
"endDate"
)
LocalDate
endDate
);
List
<
SportUserTrainingLogVO
>
getSportUserTrainingLog
(
@Param
(
"userId"
)
Long
userId
,
@Param
(
"date"
)
LocalDate
date
,
@Param
(
"gameMode"
)
Integer
gameMod
);
List
<
ScheduleResponseDTO
>
getMonthTrainingSummary
(
@Param
(
"playerId"
)
Long
playerId
,
@Param
(
"beginDate"
)
LocalDate
beginDate
,
@Param
(
"endDate"
)
LocalDate
endDate
,
@Param
(
"today"
)
LocalDate
today
);
}
server-api/src/main/java/com/antai/sport/http/server/server/api/business/traininglog/service/SportUserTrainingLogService.java
View file @
56fde268
package
com
.
antai
.
sport
.
http
.
server
.
server
.
api
.
business
.
traininglog
.
service
;
import
com.antai.sport.http.server.constants.DeleteStatus
;
import
com.antai.sport.http.server.constants.GameMode
;
import
com.antai.sport.http.server.constants.RankType
;
import
com.antai.sport.http.server.constants.SportType
;
import
com.antai.sport.http.server.repository.sport.entity.SportUser
;
...
...
@@ -11,14 +12,14 @@ import com.antai.sport.http.server.repository.sport.mapper.SportUserMapper;
import
com.antai.sport.http.server.repository.sport.mapper.SportUserMonthRankMapper
;
import
com.antai.sport.http.server.repository.sport.mapper.SportUserSummaryMapper
;
import
com.antai.sport.http.server.repository.sport.mapper.SportUserTrainingLogMapper
;
import
com.antai.sport.http.server.server.api.business.simplematch.dto.SimpleMatchUserScheduleVO
;
import
com.antai.sport.http.server.server.api.business.simplematch.mapper.SimpleMatchBusinessMapper
;
import
com.antai.sport.http.server.server.api.business.traininglog.converter.SportUserTrainingLogConverter
;
import
com.antai.sport.http.server.server.api.business.traininglog.dto.SportUserTrainingLogSummaryVO
;
import
com.antai.sport.http.server.server.api.business.traininglog.dto.SportUserTrainingLogVO
;
import
com.antai.sport.http.server.server.api.business.traininglog.mapper.SportUserTrainingLogBusinessMapper
;
import
com.antai.sport.http.server.server.api.business.user.converter.SportUserConverter
;
import
com.antai.sport.http.server.server.api.business.user.dto.ReqSportUserTrainingLog
;
import
com.antai.sport.http.server.server.api.business.user.dto.SportUserMonthRankRequestDTO
;
import
com.antai.sport.http.server.server.api.business.user.dto.SportUserMonthRankResponseDTO
;
import
com.antai.sport.http.server.server.api.business.user.dto.*
;
import
com.antai.sport.http.server.server.api.business.user.mapper.SportUserMonthRankBusinessMapper
;
import
com.antai.sport.http.server.server.api.common.dto.CyclingDataDTO
;
import
com.antai.sport.http.server.server.api.utils.ScoreUtils
;
...
...
@@ -32,7 +33,10 @@ import javax.annotation.Resource;
import
java.math.BigDecimal
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@Service
public
class
SportUserTrainingLogService
{
...
...
@@ -49,6 +53,8 @@ public class SportUserTrainingLogService {
private
SportUserTrainingLogBusinessMapper
sportUserTrainingLogBusinessMapper
;
@Resource
private
SportUserMonthRankBusinessMapper
sportUserMonthRankBusinessMapper
;
@Resource
private
SimpleMatchBusinessMapper
simpleMatchBusinessMapper
;
@Resource
private
SportUserTrainingLogConverter
sportUserTrainingLogConverter
;
...
...
@@ -231,9 +237,51 @@ public class SportUserTrainingLogService {
pageParam
.
addOrder
(
new
OrderItem
(
"update_time"
,
true
));
pageParam
.
addOrder
(
new
OrderItem
(
"t1.id"
,
true
));
IPage
<
SportUserMonthRankResponseDTO
>
result
=
sportUserMonthRankBusinessMapper
.
getRank
(
pageParam
,
param
);
System
.
out
.
println
(
result
.
getPages
());
return
result
.
getRecords
();
}
/**
* 查询用户运动日历
*
* @param userId
* @return
*/
public
List
<
ScheduleResponseDTO
>
getSchedule
(
Long
userId
,
Integer
year
,
Integer
month
)
{
List
<
ScheduleResponseDTO
>
resultList
=
new
ArrayList
<>();
Map
<
Integer
,
ScheduleResponseDTO
>
resultMap
=
new
HashMap
<>();
LocalDate
beginDate
=
LocalDate
.
of
(
year
,
month
,
1
);
LocalDate
endDate
=
beginDate
.
plusMonths
(
1
);
LocalDate
today
=
LocalDate
.
now
();
List
<
ScheduleResponseDTO
>
trainList
=
sportUserTrainingLogBusinessMapper
.
getMonthTrainingSummary
(
userId
,
beginDate
,
endDate
,
today
);
trainList
.
forEach
(
item
->
{
item
.
setActive
(
true
);
item
.
setScheduleList
(
new
ArrayList
<>());
resultMap
.
put
(
item
.
getDay
(),
item
);
});
List
<
SimpleMatchUserScheduleVO
>
userScheduleList
=
simpleMatchBusinessMapper
.
getUserRegistSchedule
(
userId
,
beginDate
,
endDate
,
today
);
userScheduleList
.
forEach
(
item
->
{
if
(!
resultMap
.
containsKey
(
item
.
getDay
()))
{
ScheduleResponseDTO
scheduleResponseDTO
=
new
ScheduleResponseDTO
();
scheduleResponseDTO
.
setScheduleList
(
new
ArrayList
<>());
scheduleResponseDTO
.
setDay
(
item
.
getDay
());
scheduleResponseDTO
.
setActive
(
false
);
resultMap
.
put
(
item
.
getDay
(),
scheduleResponseDTO
);
}
ScheduleVO
schedule
=
new
ScheduleVO
();
schedule
.
setTime
(
item
.
getTime
());
schedule
.
setType
(
GameMode
.
SIMPLE_MATCH
);
schedule
.
setTypeName
(
"日常赛"
);
resultMap
.
get
(
item
.
getDay
()).
getScheduleList
().
add
(
schedule
);
});
for
(
Integer
i
=
1
;
i
<=
31
;
i
++)
{
if
(
resultMap
.
containsKey
(
i
))
{
resultList
.
add
(
resultMap
.
get
(
i
));
}
}
return
resultList
;
}
}
server-api/src/main/java/com/antai/sport/http/server/server/api/business/user/controller/SportUserController.java
View file @
56fde268
...
...
@@ -3,10 +3,7 @@ package com.antai.sport.http.server.server.api.business.user.controller;
import
com.antai.sport.http.server.common.base.Result
;
import
com.antai.sport.http.server.server.api.business.traininglog.dto.SportUserTrainingLogVO
;
import
com.antai.sport.http.server.server.api.business.traininglog.service.SportUserTrainingLogService
;
import
com.antai.sport.http.server.server.api.business.user.dto.ReqSportUserTrainingLog
;
import
com.antai.sport.http.server.server.api.business.user.dto.RespUserHomeInfo
;
import
com.antai.sport.http.server.server.api.business.user.dto.SportUserMonthRankRequestDTO
;
import
com.antai.sport.http.server.server.api.business.user.dto.SportUserMonthRankResponseDTO
;
import
com.antai.sport.http.server.server.api.business.user.dto.*
;
import
com.antai.sport.http.server.server.api.business.user.service.SportUserService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -51,4 +48,11 @@ public class SportUserController {
public
ResponseEntity
<
Result
<
List
<
SportUserMonthRankResponseDTO
>>>
geRank
(
@RequestBody
SportUserMonthRankRequestDTO
param
)
{
return
success
(
sportUserTrainingLogService
.
geRank
(
param
));
}
@ApiOperation
(
"查询玩家运动日历"
)
@PostMapping
(
"/{userId}/schedule"
)
public
ResponseEntity
<
Result
<
List
<
ScheduleResponseDTO
>>>
getSchedule
(
@PathVariable
(
"userId"
)
Long
userId
,
@RequestParam
Integer
year
,
@RequestParam
Integer
month
)
{
return
success
(
sportUserTrainingLogService
.
getSchedule
(
userId
,
year
,
month
));
}
}
server-api/src/main/java/com/antai/sport/http/server/server/api/business/user/dto/ScheduleResponseDTO.java
0 → 100644
View file @
56fde268
package
com
.
antai
.
sport
.
http
.
server
.
server
.
api
.
business
.
user
.
dto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.util.List
;
@Data
@ApiModel
(
"用户运动日历"
)
public
class
ScheduleResponseDTO
{
@ApiModelProperty
(
"日期"
)
private
Integer
day
;
@ApiModelProperty
(
"当日是否活跃 true 有训练记录 false 没有训练记录"
)
private
Boolean
active
;
@ApiModelProperty
(
"骑行长度"
)
private
BigDecimal
distance
;
@ApiModelProperty
(
"爬坡高度"
)
private
BigDecimal
climbDistance
;
@ApiModelProperty
(
"骑行时长"
)
private
Integer
duration
;
@ApiModelProperty
(
"日程安排"
)
List
<
ScheduleVO
>
scheduleList
;
}
server-api/src/main/java/com/antai/sport/http/server/server/api/business/user/dto/ScheduleVO.java
0 → 100644
View file @
56fde268
package
com
.
antai
.
sport
.
http
.
server
.
server
.
api
.
business
.
user
.
dto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
@ApiModel
(
"日程安排"
)
public
class
ScheduleVO
{
@ApiModelProperty
(
"日程时间"
)
private
String
time
;
@ApiModelProperty
(
"日程类型 20:日常赛 30:系列赛 40:训练模式 50: 团练"
)
private
Integer
type
;
@ApiModelProperty
(
"日程类型 20:日常赛 30:系列赛 40:训练模式 50: 团练"
)
private
String
typeName
;
}
server-api/src/main/resources/mapper/simplematch/SimpleMatchBusinessMapper.xml
View file @
56fde268
...
...
@@ -44,4 +44,12 @@
<select
id=
"getRegisterList"
resultType=
"java.lang.Long"
>
select player_id from simple_match_player_regist_log t1 where t1.match_id = #{matchId}
</select>
<select
id=
"getUserRegistSchedule"
resultType=
"com.antai.sport.http.server.server.api.business.simplematch.dto.SimpleMatchUserScheduleVO"
>
select DAYOFMONTH(t2.start_time) day,date_format(t2.start_time,'%H:%i') as time
from simple_match_player_regist_log t1
join simple_match t2 on t1.match_id = t2.id
where t1.player_id = #{playerId} and t2.start_time
>
= #{today} and t2.start_time
>
= #{beginDate} and t2.start_time
<
#{endDate}
order by t2.start_time asc
</select>
</mapper>
\ No newline at end of file
server-api/src/main/resources/mapper/traininglog/SportUserTrainingLogBusinessMapper.xml
View file @
56fde268
...
...
@@ -31,4 +31,15 @@
</if>
order by t1.id desc
</select>
<select
id=
"getMonthTrainingSummary"
resultType=
"com.antai.sport.http.server.server.api.business.user.dto.ScheduleResponseDTO"
>
select day,sum(distance) distance,sum(climb_distance) climb_distance,sum(duration) duration
from (
select DAYOFMONTH(create_time) as day,distance,climb_distance,duration
from sport_user_training_log
where player_id = #{playerId} and sport_type = 1
and create_date
>
= #{beginDate} and create_date
<
#{endDate} and create_date
<
#{today}
) t1
group by day
</select>
</mapper>
\ No newline at end of file
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