Commit db21e652 authored by liming's avatar liming

修改骑行日志查询

parent fa675605
...@@ -7,6 +7,8 @@ import com.antai.sport.http.server.repository.club.mapper.ClubMapper; ...@@ -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.club.mapper.ClubMemberMapper;
import com.antai.sport.http.server.repository.roommode.entity.RoomMode; 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.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.SportUserGameCurrencyBaseRule;
import com.antai.sport.http.server.repository.shop.entity.SportUserGameCurrencyLog; import com.antai.sport.http.server.repository.shop.entity.SportUserGameCurrencyLog;
import com.antai.sport.http.server.repository.shop.entity.SportUserGameCurrencyMatchRule; import com.antai.sport.http.server.repository.shop.entity.SportUserGameCurrencyMatchRule;
...@@ -77,6 +79,8 @@ public class SportUserTrainingLogService { ...@@ -77,6 +79,8 @@ public class SportUserTrainingLogService {
private ClubMapper clubMapper; private ClubMapper clubMapper;
@Resource @Resource
private SportUserGameCurrencyLogMapper sportUserGameCurrencyLogMapper; private SportUserGameCurrencyLogMapper sportUserGameCurrencyLogMapper;
@Resource
private SeriesMatchMapper seriesMatchMapper;
@Resource @Resource
private SportUserTrainingLogBusinessMapper sportUserTrainingLogBusinessMapper; private SportUserTrainingLogBusinessMapper sportUserTrainingLogBusinessMapper;
...@@ -147,7 +151,7 @@ public class SportUserTrainingLogService { ...@@ -147,7 +151,7 @@ public class SportUserTrainingLogService {
//处理玩家成就 //处理玩家成就
achievementService.handleSportAchievement(gameMode, summary); achievementService.handleSportAchievement(gameMode, summary);
//处理ftp变化事件 //处理ftp变化事件
handleFtpChange(sportUser,sportData.getTwentyMinutesFtp()); handleFtpChange(sportUser, sportData.getTwentyMinutesFtp());
} }
void handleFtpChange(SportUser sportUser, BigDecimal twentyMinutesFtp) { void handleFtpChange(SportUser sportUser, BigDecimal twentyMinutesFtp) {
...@@ -157,7 +161,7 @@ public class SportUserTrainingLogService { ...@@ -157,7 +161,7 @@ public class SportUserTrainingLogService {
BigDecimal oldFtp = sportUser.getFtp() == null ? BigDecimal.ZERO : BigDecimal.valueOf(sportUser.getFtp()); BigDecimal oldFtp = sportUser.getFtp() == null ? BigDecimal.ZERO : BigDecimal.valueOf(sportUser.getFtp());
BigDecimal newFtp = twentyMinutesFtp.multiply(BigDecimal.valueOf(0.93)).setScale(0, RoundingMode.HALF_UP); 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()); sportUser.setFtp(newFtp.intValue());
sportUserMapper.updateById(sportUser); sportUserMapper.updateById(sportUser);
SportUserFtpChangeLog ftpChangeLog = new SportUserFtpChangeLog(); SportUserFtpChangeLog ftpChangeLog = new SportUserFtpChangeLog();
...@@ -173,12 +177,13 @@ public class SportUserTrainingLogService { ...@@ -173,12 +177,13 @@ public class SportUserTrainingLogService {
/** /**
* 计算积分 * 计算积分
*
* @param gameMode * @param gameMode
* @param calorie * @param calorie
* @param rank * @param rank
* @return * @return
*/ */
public Integer calcCurrency(Integer gameMode, Integer calorie , Integer rank){ public Integer calcCurrency(Integer gameMode, Integer calorie, Integer rank) {
if (calorie == null || calorie == 0) { if (calorie == null || calorie == 0) {
return 0; return 0;
} }
...@@ -191,14 +196,14 @@ public class SportUserTrainingLogService { ...@@ -191,14 +196,14 @@ public class SportUserTrainingLogService {
if (currency == 0) { if (currency == 0) {
return 0; return 0;
} }
if(rank !=null){ if (rank != null) {
SportUserGameCurrencyMatchRule matchRule = SportUserGameCurrencyMatchRule matchRule =
sportUserGameCurrencyMatchRuleMapper.selectOne(new QueryWrapper<SportUserGameCurrencyMatchRule>().lambda().eq(SportUserGameCurrencyMatchRule::getGameMode, gameMode).le(SportUserGameCurrencyMatchRule::getRankStart, rank).ge(SportUserGameCurrencyMatchRule::getRankEnd, rank)); sportUserGameCurrencyMatchRuleMapper.selectOne(new QueryWrapper<SportUserGameCurrencyMatchRule>().lambda().eq(SportUserGameCurrencyMatchRule::getGameMode, gameMode).le(SportUserGameCurrencyMatchRule::getRankStart, rank).ge(SportUserGameCurrencyMatchRule::getRankEnd, rank));
if (matchRule != null && matchRule.getRate() != null) { if (matchRule != null && matchRule.getRate() != null) {
currency = matchRule.getRate().multiply(BigDecimal.valueOf(currency)).intValue(); currency = matchRule.getRate().multiply(BigDecimal.valueOf(currency)).intValue();
} }
} }
return currency; return currency;
} }
/** /**
...@@ -229,7 +234,7 @@ public class SportUserTrainingLogService { ...@@ -229,7 +234,7 @@ public class SportUserTrainingLogService {
} }
String gameModeName = baseBusinessMapper.getGameMode(gameMode); String gameModeName = baseBusinessMapper.getGameMode(gameMode);
String description; String description;
if(gameMode == GameMode.TOUR || gameMode == GameMode.COURSE_TRAINING) { if (gameMode == GameMode.TOUR || gameMode == GameMode.COURSE_TRAINING) {
String pathName = baseBusinessMapper.getMapPath(pathKey); String pathName = baseBusinessMapper.getMapPath(pathKey);
description = gameModeName + ":" + pathName; description = gameModeName + ":" + pathName;
} else { } else {
...@@ -604,7 +609,18 @@ public class SportUserTrainingLogService { ...@@ -604,7 +609,18 @@ public class SportUserTrainingLogService {
result.setEventsClimbDistance(roomMode.getClimbDistance()); 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())); result.setRankList(sportUserTrainingLogBusinessMapper.getRank(result.getGameMode(), result.getSourceId()));
} }
return result; return result;
......
...@@ -68,6 +68,21 @@ ...@@ -68,6 +68,21 @@
where t1.match_id = #{sourceId} where t1.match_id = #{sourceId}
order by match_rank asc order by match_rank asc
</if> </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"> <if test="gameMode == 50">
select t1.*, select t1.*,
t1.training_rank as game_rank, t1.training_rank as game_rank,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment