Commit ba138579 authored by liming's avatar liming

骑行日志增加 源头名称

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