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
db21e652
Commit
db21e652
authored
Sep 18, 2022
by
liming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改骑行日志查询
parent
fa675605
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
7 deletions
+38
-7
SportUserTrainingLogService.java
...ness/traininglog/service/SportUserTrainingLogService.java
+23
-7
SportUserTrainingLogBusinessMapper.xml
...mapper/traininglog/SportUserTrainingLogBusinessMapper.xml
+15
-0
No files found.
server-api/src/main/java/com/antai/sport/http/server/server/api/business/traininglog/service/SportUserTrainingLogService.java
View file @
db21e652
...
...
@@ -7,6 +7,8 @@ import com.antai.sport.http.server.repository.club.mapper.ClubMapper;
import
com.antai.sport.http.server.repository.club.mapper.ClubMemberMapper
;
import
com.antai.sport.http.server.repository.roommode.entity.RoomMode
;
import
com.antai.sport.http.server.repository.roommode.mapper.RoomModeMapper
;
import
com.antai.sport.http.server.repository.series.entity.SeriesMatch
;
import
com.antai.sport.http.server.repository.series.mapper.SeriesMatchMapper
;
import
com.antai.sport.http.server.repository.shop.entity.SportUserGameCurrencyBaseRule
;
import
com.antai.sport.http.server.repository.shop.entity.SportUserGameCurrencyLog
;
import
com.antai.sport.http.server.repository.shop.entity.SportUserGameCurrencyMatchRule
;
...
...
@@ -77,6 +79,8 @@ public class SportUserTrainingLogService {
private
ClubMapper
clubMapper
;
@Resource
private
SportUserGameCurrencyLogMapper
sportUserGameCurrencyLogMapper
;
@Resource
private
SeriesMatchMapper
seriesMatchMapper
;
@Resource
private
SportUserTrainingLogBusinessMapper
sportUserTrainingLogBusinessMapper
;
...
...
@@ -147,7 +151,7 @@ public class SportUserTrainingLogService {
//处理玩家成就
achievementService
.
handleSportAchievement
(
gameMode
,
summary
);
//处理ftp变化事件
handleFtpChange
(
sportUser
,
sportData
.
getTwentyMinutesFtp
());
handleFtpChange
(
sportUser
,
sportData
.
getTwentyMinutesFtp
());
}
void
handleFtpChange
(
SportUser
sportUser
,
BigDecimal
twentyMinutesFtp
)
{
...
...
@@ -157,7 +161,7 @@ public class SportUserTrainingLogService {
BigDecimal
oldFtp
=
sportUser
.
getFtp
()
==
null
?
BigDecimal
.
ZERO
:
BigDecimal
.
valueOf
(
sportUser
.
getFtp
());
BigDecimal
newFtp
=
twentyMinutesFtp
.
multiply
(
BigDecimal
.
valueOf
(
0.93
)).
setScale
(
0
,
RoundingMode
.
HALF_UP
);
if
(
newFtp
.
compareTo
(
oldFtp
)
==
1
)
{
if
(
newFtp
.
compareTo
(
oldFtp
)
==
1
)
{
sportUser
.
setFtp
(
newFtp
.
intValue
());
sportUserMapper
.
updateById
(
sportUser
);
SportUserFtpChangeLog
ftpChangeLog
=
new
SportUserFtpChangeLog
();
...
...
@@ -173,12 +177,13 @@ public class SportUserTrainingLogService {
/**
* 计算积分
*
* @param gameMode
* @param calorie
* @param rank
* @return
*/
public
Integer
calcCurrency
(
Integer
gameMode
,
Integer
calorie
,
Integer
rank
)
{
public
Integer
calcCurrency
(
Integer
gameMode
,
Integer
calorie
,
Integer
rank
)
{
if
(
calorie
==
null
||
calorie
==
0
)
{
return
0
;
}
...
...
@@ -191,14 +196,14 @@ public class SportUserTrainingLogService {
if
(
currency
==
0
)
{
return
0
;
}
if
(
rank
!=
null
)
{
if
(
rank
!=
null
)
{
SportUserGameCurrencyMatchRule
matchRule
=
sportUserGameCurrencyMatchRuleMapper
.
selectOne
(
new
QueryWrapper
<
SportUserGameCurrencyMatchRule
>().
lambda
().
eq
(
SportUserGameCurrencyMatchRule:
:
getGameMode
,
gameMode
).
le
(
SportUserGameCurrencyMatchRule:
:
getRankStart
,
rank
).
ge
(
SportUserGameCurrencyMatchRule:
:
getRankEnd
,
rank
));
if
(
matchRule
!=
null
&&
matchRule
.
getRate
()
!=
null
)
{
currency
=
matchRule
.
getRate
().
multiply
(
BigDecimal
.
valueOf
(
currency
)).
intValue
();
}
}
return
currency
;
return
currency
;
}
/**
...
...
@@ -229,7 +234,7 @@ public class SportUserTrainingLogService {
}
String
gameModeName
=
baseBusinessMapper
.
getGameMode
(
gameMode
);
String
description
;
if
(
gameMode
==
GameMode
.
TOUR
||
gameMode
==
GameMode
.
COURSE_TRAINING
)
{
if
(
gameMode
==
GameMode
.
TOUR
||
gameMode
==
GameMode
.
COURSE_TRAINING
)
{
String
pathName
=
baseBusinessMapper
.
getMapPath
(
pathKey
);
description
=
gameModeName
+
":"
+
pathName
;
}
else
{
...
...
@@ -604,7 +609,18 @@ public class SportUserTrainingLogService {
result
.
setEventsClimbDistance
(
roomMode
.
getClimbDistance
());
}
}
if
(
SportType
.
BICYCLE
.
equals
(
result
.
getSportType
())
&&
(
GameMode
.
SIMPLE_MATCH
.
equals
(
result
.
getGameMode
())
||
GameMode
.
GROUP_TRAINING
.
equals
(
result
.
getGameMode
())
||
GameMode
.
ROOM_MODE
.
equals
(
result
.
getGameMode
())))
{
if
(
GameMode
.
SERIES_MATCH
.
equals
(
result
.
getGameMode
()))
{
SeriesMatch
seriesMatch
=
seriesMatchMapper
.
selectById
(
result
.
getSourceId
());
if
(
seriesMatch
!=
null
)
{
result
.
setEventsDistance
(
seriesMatch
.
getDistance
());
result
.
setEventsClimbDistance
(
seriesMatch
.
getClimbDistance
());
}
}
if
(
SportType
.
BICYCLE
.
equals
(
result
.
getSportType
())
&&
(
GameMode
.
SIMPLE_MATCH
.
equals
(
result
.
getGameMode
())
||
GameMode
.
GROUP_TRAINING
.
equals
(
result
.
getGameMode
())
||
GameMode
.
ROOM_MODE
.
equals
(
result
.
getGameMode
())
||
GameMode
.
SERIES_MATCH
.
equals
(
result
.
getGameMode
())))
{
result
.
setRankList
(
sportUserTrainingLogBusinessMapper
.
getRank
(
result
.
getGameMode
(),
result
.
getSourceId
()));
}
return
result
;
...
...
server-api/src/main/resources/mapper/traininglog/SportUserTrainingLogBusinessMapper.xml
View file @
db21e652
...
...
@@ -68,6 +68,21 @@
where t1.match_id = #{sourceId}
order by match_rank asc
</if>
<if
test=
"gameMode == 30"
>
select t1.*,
t1.match_rank as game_rank,
t2.avatar,
t2.nickname,
t3.ftp,
t3.heart_rate,
t3.avg_heart_rate,
t3.height
from series_match_player_record t1
left join sport_user t2 on t1.player_id = t2.id
left join sport_user_training_log t3 on t3.game_mode = 20 and t1.id = t3.record_id
where t1.match_id = #{sourceId}
order by match_rank asc
</if>
<if
test=
"gameMode == 50"
>
select t1.*,
t1.training_rank as game_rank,
...
...
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