Commit 97c0ab9e authored by liming's avatar liming

生成日常赛归集日志

parent 32e7b583
...@@ -16,9 +16,11 @@ import com.antai.sport.http.server.server.api.business.praise.service.PraiseServ ...@@ -16,9 +16,11 @@ import com.antai.sport.http.server.server.api.business.praise.service.PraiseServ
import com.antai.sport.http.server.server.api.business.simplematch.converter.SimpleMatchConverter; import com.antai.sport.http.server.server.api.business.simplematch.converter.SimpleMatchConverter;
import com.antai.sport.http.server.server.api.business.simplematch.dto.*; import com.antai.sport.http.server.server.api.business.simplematch.dto.*;
import com.antai.sport.http.server.server.api.business.simplematch.mapper.SimpleMatchBusinessMapper; import com.antai.sport.http.server.server.api.business.simplematch.mapper.SimpleMatchBusinessMapper;
import com.antai.sport.http.server.server.api.business.traininglog.service.SportUserTrainingLogService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.LocalDateTime; import java.time.LocalDateTime;
...@@ -43,6 +45,8 @@ public class SimpleMatchService { ...@@ -43,6 +45,8 @@ public class SimpleMatchService {
@Resource @Resource
private PraiseService praiseService; private PraiseService praiseService;
@Resource
private SportUserTrainingLogService sportUserTrainingLogService;
/** /**
* 创建比赛 * 创建比赛
...@@ -173,11 +177,20 @@ public class SimpleMatchService { ...@@ -173,11 +177,20 @@ public class SimpleMatchService {
/** /**
* 比赛记录上传 * 比赛记录上传
*/ */
@Transactional
public void recordUpload(List<ReqSimpleMatchRecord> dataList) { public void recordUpload(List<ReqSimpleMatchRecord> dataList) {
dataList.forEach(item -> { dataList.forEach(item -> {
SimpleMatchPlayerRecord record = simpleMatchConverter.toSimpleMatchPlayerRecord(item); SimpleMatchPlayerRecord oldRecord = simpleMatchPlayerRecordMapper.selectById(item.getRecordId());
record.setPraiseNum(praiseService.getPraiseByGameModeAndRecordId(GameMode.SIMPLE_MATCH, item.getRecordId())); if (oldRecord.getStatus() == null) {
simpleMatchPlayerRecordMapper.updateById(record); SimpleMatchPlayerRecord record = simpleMatchConverter.toSimpleMatchPlayerRecord(item);
record.setPraiseNum(praiseService.getPraiseByGameModeAndRecordId(GameMode.SIMPLE_MATCH, item.getRecordId()));
simpleMatchPlayerRecordMapper.updateById(record);
//生成骑行日志
SimpleMatch match = simpleMatchMapper.selectById(oldRecord.getMatchId());
sportUserTrainingLogService.createBicycleTrainingLog(oldRecord.getPlayerId(), GameMode.SIMPLE_MATCH,
oldRecord.getId(), match.getMap(), match.getPath(), record.getPraiseNum(), item);
}
}); });
} }
......
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