Commit ba138579 authored by liming's avatar liming

骑行日志增加 源头名称

parent 2bf58d5a
...@@ -50,6 +50,11 @@ public class SportUserTrainingLog implements Serializable { ...@@ -50,6 +50,11 @@ public class SportUserTrainingLog implements Serializable {
*/ */
private Long sourceId; private Long sourceId;
/**
* 源头名称 比如比赛名称 团练名称 娱乐赛房间名称
*/
private String sourceName;
/** /**
* 运动记录id * 运动记录id
*/ */
...@@ -114,6 +119,11 @@ public class SportUserTrainingLog implements Serializable { ...@@ -114,6 +119,11 @@ public class SportUserTrainingLog implements Serializable {
*/ */
private Integer praiseNum; private Integer praiseNum;
/**
* fit文件url地址
*/
private String fitUrl;
/** /**
* 创建日期不带时分秒 * 创建日期不带时分秒
*/ */
......
...@@ -84,7 +84,7 @@ public class RoomModeService { ...@@ -84,7 +84,7 @@ public class RoomModeService {
public void upload(List<CyclingDataDTO> dataList) { public void upload(List<CyclingDataDTO> dataList) {
dataList.forEach(item -> { dataList.forEach(item -> {
RoomModePlayerRecord oldRecord = roomModePlayerRecordMapper.selectById(item.getRecordId()); RoomModePlayerRecord oldRecord = roomModePlayerRecordMapper.selectById(item.getRecordId());
if(oldRecord.getStatus().equals(RoomModeRecordStatus.UNFINISHED)){ if (oldRecord.getStatus().equals(RoomModeRecordStatus.UNFINISHED)) {
SportUser user = sportUserMapper.selectById(oldRecord.getPlayerId()); SportUser user = sportUserMapper.selectById(oldRecord.getPlayerId());
item.setWeight(user.getWeight()); item.setWeight(user.getWeight());
RoomModePlayerRecord record = roomModeConverter.toRoomModePlayerRecord(item, RoomModeRecordStatus.FINISHED); RoomModePlayerRecord record = roomModeConverter.toRoomModePlayerRecord(item, RoomModeRecordStatus.FINISHED);
...@@ -93,7 +93,7 @@ public class RoomModeService { ...@@ -93,7 +93,7 @@ public class RoomModeService {
//生成骑行日志 //生成骑行日志
RoomMode roomMode = roomModeMapper.selectById(oldRecord.getRoomId()); RoomMode roomMode = roomModeMapper.selectById(oldRecord.getRoomId());
sportUserTrainingLogService.createBicycleTrainingLog(oldRecord.getPlayerId(), GameMode.ROOM_MODE, sportUserTrainingLogService.createBicycleTrainingLog(oldRecord.getPlayerId(), GameMode.ROOM_MODE,
oldRecord.getId(), roomMode.getMap(), roomMode.getPath(), 0, item); roomMode.getId(), roomMode.getName(), roomMode.getMap(), roomMode.getPath(), 0, item);
} }
}); });
} }
......
...@@ -62,18 +62,15 @@ public class SimpleMatchService { ...@@ -62,18 +62,15 @@ public class SimpleMatchService {
throw new BusinessException("比赛名称不能为空"); throw new BusinessException("比赛名称不能为空");
} }
if (initData.getEntryTime() == null || initData.getStartTime() == null || if (initData.getEntryTime() == null || initData.getStartTime() == null || initData.getEndTime() == null) {
initData.getEndTime() == null) {
throw new BusinessException("所有输入时间不能为空"); throw new BusinessException("所有输入时间不能为空");
} }
if (initData.getEntryTime().equals(initData.getStartTime()) || if (initData.getEntryTime().equals(initData.getStartTime()) || initData.getEntryTime().isAfter(initData.getStartTime())) {
initData.getEntryTime().isAfter(initData.getStartTime())) {
throw new BusinessException("允许进入时间必须早于比赛开始时间"); throw new BusinessException("允许进入时间必须早于比赛开始时间");
} }
if (initData.getStartTime().equals(initData.getEndTime()) || if (initData.getStartTime().equals(initData.getEndTime()) || initData.getStartTime().isAfter(initData.getEndTime())) {
initData.getStartTime().isAfter(initData.getEndTime())) {
throw new BusinessException("比赛开始时间必须早于比赛结束时间"); throw new BusinessException("比赛开始时间必须早于比赛结束时间");
} }
...@@ -88,8 +85,7 @@ public class SimpleMatchService { ...@@ -88,8 +85,7 @@ public class SimpleMatchService {
*/ */
public List<RespSimpleMatchBanner> getSimpleMatchBannerList() { public List<RespSimpleMatchBanner> getSimpleMatchBannerList() {
QueryWrapper<SimpleMatchBanner> queryWrapper = new QueryWrapper<>(); QueryWrapper<SimpleMatchBanner> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("deleted", DeleteStatus.UNDELETED) queryWrapper.eq("deleted", DeleteStatus.UNDELETED).orderBy(true, true, "show_order");
.orderBy(true, true, "show_order");
List<SimpleMatchBanner> bannerList = simpleMatchBannerMapper.selectList(queryWrapper); List<SimpleMatchBanner> bannerList = simpleMatchBannerMapper.selectList(queryWrapper);
return simpleMatchConverter.toRespBannerList(bannerList); return simpleMatchConverter.toRespBannerList(bannerList);
} }
...@@ -195,7 +191,7 @@ public class SimpleMatchService { ...@@ -195,7 +191,7 @@ public class SimpleMatchService {
//生成骑行日志 //生成骑行日志
SimpleMatch match = simpleMatchMapper.selectById(oldRecord.getMatchId()); SimpleMatch match = simpleMatchMapper.selectById(oldRecord.getMatchId());
sportUserTrainingLogService.createBicycleTrainingLog(oldRecord.getPlayerId(), GameMode.SIMPLE_MATCH, sportUserTrainingLogService.createBicycleTrainingLog(oldRecord.getPlayerId(), GameMode.SIMPLE_MATCH,
oldRecord.getId(), match.getMap(), match.getPath(), record.getPraiseNum(), item); match.getId(), match.getName(), match.getMap(), match.getPath(), record.getPraiseNum(), item);
} }
}); });
} }
......
...@@ -4,7 +4,6 @@ import com.antai.sport.http.server.common.exception.BusinessException; ...@@ -4,7 +4,6 @@ import com.antai.sport.http.server.common.exception.BusinessException;
import com.antai.sport.http.server.constants.DeleteStatus; import com.antai.sport.http.server.constants.DeleteStatus;
import com.antai.sport.http.server.constants.GameMode; import com.antai.sport.http.server.constants.GameMode;
import com.antai.sport.http.server.constants.SportType; import com.antai.sport.http.server.constants.SportType;
import com.antai.sport.http.server.repository.simplematch.entity.SimpleMatch;
import com.antai.sport.http.server.repository.sport.entity.SportUser; import com.antai.sport.http.server.repository.sport.entity.SportUser;
import com.antai.sport.http.server.repository.sport.mapper.SportUserMapper; import com.antai.sport.http.server.repository.sport.mapper.SportUserMapper;
import com.antai.sport.http.server.repository.teamtraining.entity.*; import com.antai.sport.http.server.repository.teamtraining.entity.*;
...@@ -186,7 +185,7 @@ public class TeamTrainingService { ...@@ -186,7 +185,7 @@ public class TeamTrainingService {
//生成骑行日志 //生成骑行日志
TeamTraining teamTraining = teamTrainingMapper.selectById(oldRecord.getTeamTrainingId()); TeamTraining teamTraining = teamTrainingMapper.selectById(oldRecord.getTeamTrainingId());
sportUserTrainingLogService.createBicycleTrainingLog(oldRecord.getPlayerId(), GameMode.GROUP_TRAINING, sportUserTrainingLogService.createBicycleTrainingLog(oldRecord.getPlayerId(), GameMode.GROUP_TRAINING,
oldRecord.getId(), teamTraining.getMap(), teamTraining.getPath(), record.getPraiseNum(), item); teamTraining.getId(), teamTraining.getName(), teamTraining.getMap(), teamTraining.getPath(), record.getPraiseNum(), item);
} }
}); });
} }
......
...@@ -17,7 +17,6 @@ import org.springframework.stereotype.Service; ...@@ -17,7 +17,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.RoundingMode;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.List;
...@@ -77,7 +76,7 @@ public class TourService { ...@@ -77,7 +76,7 @@ public class TourService {
//生成骑行日志 //生成骑行日志
sportUserTrainingLogService.createBicycleTrainingLog(oldRecord.getPlayerId(), GameMode.TOUR, sportUserTrainingLogService.createBicycleTrainingLog(oldRecord.getPlayerId(), GameMode.TOUR,
oldRecord.getId(), oldRecord.getMap(), oldRecord.getPath(), tourRecord.getPraiseNum(), item); oldRecord.getId(), null, oldRecord.getMap(), oldRecord.getPath(), tourRecord.getPraiseNum(), item);
} }
}); });
} }
......
...@@ -19,6 +19,8 @@ public class SportUserTrainingLogVO { ...@@ -19,6 +19,8 @@ public class SportUserTrainingLogVO {
private Long playerId; private Long playerId;
@ApiModelProperty("主数据id 如比赛为比赛id 房间模式为房间id 漫游为漫游记录id") @ApiModelProperty("主数据id 如比赛为比赛id 房间模式为房间id 漫游为漫游记录id")
private Long sourceId; private Long sourceId;
@ApiModelProperty("源头名称")
private String sourceName;
@ApiModelProperty("运动记录Id") @ApiModelProperty("运动记录Id")
private Long recordId; private Long recordId;
@ApiModelProperty("地图名称") @ApiModelProperty("地图名称")
......
...@@ -65,12 +65,13 @@ public class SportUserTrainingLogService { ...@@ -65,12 +65,13 @@ public class SportUserTrainingLogService {
@Resource @Resource
private SportUserConverter sportUserConverter; private SportUserConverter sportUserConverter;
public void createBicycleTrainingLog(Long playerId, Integer gameMode, Long sourceId, String map, String path, Integer praiseNum, CyclingDataDTO sportData) { public void createBicycleTrainingLog(Long playerId, Integer gameMode, Long sourceId, String sourceName, String map, String path, Integer praiseNum, CyclingDataDTO sportData) {
SportUserTrainingLog log = sportUserTrainingLogConverter.toSportUserTrainingLog(sportData); SportUserTrainingLog log = sportUserTrainingLogConverter.toSportUserTrainingLog(sportData);
log.setSportType(SportType.BICYCLE); log.setSportType(SportType.BICYCLE);
log.setGameMode(gameMode); log.setGameMode(gameMode);
log.setPlayerId(playerId); log.setPlayerId(playerId);
log.setSourceId(sourceId); log.setSourceId(sourceId);
log.setSourceName(sourceName);
log.setMap(map); log.setMap(map);
log.setPath(path); log.setPath(path);
log.setPraiseNum(praiseNum); log.setPraiseNum(praiseNum);
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
</select> </select>
<select id="getSportUserTrainingLog" resultType="com.antai.sport.http.server.server.api.business.traininglog.dto.SportUserTrainingLogVO"> <select id="getSportUserTrainingLog" resultType="com.antai.sport.http.server.server.api.business.traininglog.dto.SportUserTrainingLogVO">
select t1.sport_type,t1.game_mode,t1.player_id,t1.source_id,t1.record_id, select t1.sport_type,t1.game_mode,t1.player_id,t1.source_id,t1.source_name,t1.record_id,
t2.map_name,t3.path_name,t1.calorie,t1.duration,t1.match_rank, t2.map_name,t3.path_name,t1.calorie,t1.duration,t1.match_rank,
t1.distance,t1.climb_distance,t1.avg_ftp,t1.avg_speed,t1.praise_num,t1.create_time t1.distance,t1.climb_distance,t1.avg_ftp,t1.avg_speed,t1.praise_num,t1.create_time
from sport_user_training_log t1 from sport_user_training_log t1
......
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