Commit 82f0ed5f authored by liming's avatar liming

人员编排

parent c335445c
...@@ -141,8 +141,7 @@ public class SeriesController { ...@@ -141,8 +141,7 @@ public class SeriesController {
} }
@GetMapping("record/result/confirm/status/{recordId}/{status}") @GetMapping("record/result/confirm/status/{recordId}/{status}")
public ResponseEntity<Result> changeMatchRecordStatus(@PathVariable("recordId") Long recordId, public ResponseEntity<Result> changeMatchRecordStatus(@PathVariable("recordId") Long recordId, @PathVariable("status") Integer status) {
@PathVariable("status") Integer status) {
seriesService.changeMatchRecordStatus(recordId, status); seriesService.changeMatchRecordStatus(recordId, status);
return success(); return success();
} }
...@@ -157,4 +156,22 @@ public class SeriesController { ...@@ -157,4 +156,22 @@ public class SeriesController {
return success(seriesService.getSeriesMatchFinalists(dto)); return success(seriesService.getSeriesMatchFinalists(dto));
} }
@PostMapping("match/candidate")
public ResponseEntity<Result<SeriesMatchFinalistsPageVO>> getKnockoutMatchCandidate(@RequestBody SeriesMatchFinalistsPageDTO dto) {
return success(seriesService.getKnockoutMatchCandidate(dto));
}
@GetMapping("match/finalists/{matchId}/{sportUserId}")
public ResponseEntity<Result> addToFinalists(@PathVariable("matchId") Long matchId,
@PathVariable("sportUserId") Long sportUserId) {
seriesService.addToFinalists(matchId, sportUserId);
return success();
}
@DeleteMapping("match/finalists/{id}")
public ResponseEntity<Result> deleteFinalists(@PathVariable("id") Long id) {
seriesService.deleteFinalists(id);
return success();
}
} }
...@@ -29,4 +29,15 @@ public interface SeriesBusinessMapper { ...@@ -29,4 +29,15 @@ public interface SeriesBusinessMapper {
@Param("seriesId") Long seriesId, @Param("seriesId") Long seriesId,
@Param("matchId") Long matchId, @Param("matchId") Long matchId,
@Param("preRoundId") Long preRoundId); @Param("preRoundId") Long preRoundId);
IPage<SeriesMatchFinalistsVO> getCandidateWithoutQualifying(IPage<SeriesMatchFinalistsVO> page,
@Param("seriesId") Long seriesId,
@Param("roundId") Long roundId);
IPage<SeriesMatchFinalistsVO> getCandidate(IPage<SeriesMatchFinalistsVO> page,
@Param("seriesId") Long seriesId,
@Param("preRoundId") Long preRoundId,
@Param("roundId") Long roundId);
} }
...@@ -45,6 +45,8 @@ public class SeriesService { ...@@ -45,6 +45,8 @@ public class SeriesService {
private SeriesMatchMapper seriesMatchMapper; private SeriesMatchMapper seriesMatchMapper;
@Resource @Resource
private SeriesMatchPlayerRecordMapper seriesMatchPlayerRecordMapper; private SeriesMatchPlayerRecordMapper seriesMatchPlayerRecordMapper;
@Resource
private SeriesMatchFinalistsMapper seriesMatchFinalistsMapper;
@Resource @Resource
private SeriesConverter seriesConverter; private SeriesConverter seriesConverter;
...@@ -365,4 +367,47 @@ public class SeriesService { ...@@ -365,4 +367,47 @@ public class SeriesService {
return result; return result;
} }
public SeriesMatchFinalistsPageVO getKnockoutMatchCandidate(SeriesMatchFinalistsPageDTO dto) {
SeriesMatchFinalistsPageVO result = new SeriesMatchFinalistsPageVO();
result.setPageNo(dto.getPageNo());
SeriesMatch match = seriesMatchMapper.selectById(dto.getMatchId());
SeriesRound round = seriesRoundMapper.selectById(match.getRoundId());
Page<SeriesMatchFinalistsVO> pageParam = new Page<>(dto.getPageNo(), dto.getPageSize());
IPage<SeriesMatchFinalistsVO> candidatePage;
if (round.getPreRoundId() == null) {
pageParam.addOrder(new OrderItem("t1.id", true));
candidatePage = seriesBusinessMapper
.getCandidateWithoutQualifying(pageParam, round.getSeriesId(), round.getId());
} else {
pageParam.addOrder(new OrderItem("t1.duration", true));
pageParam.addOrder(new OrderItem("t1.id", true));
candidatePage = seriesBusinessMapper
.getCandidate(pageParam, match.getSeriesId(), round.getPreRoundId(), round.getId());
}
result.setData(candidatePage.getRecords());
result.setTotalCount(candidatePage.getTotal());
return result;
}
public void addToFinalists(Long matchId, Long sportUserId) {
SeriesMatch match = seriesMatchMapper.selectById(matchId);
QueryWrapper<SeriesMatchFinalists> finalistsQuery = new QueryWrapper<>();
finalistsQuery.lambda().eq(SeriesMatchFinalists::getRoundId, match.getRoundId())
.eq(SeriesMatchFinalists::getSportUserId, sportUserId);
Integer count = seriesMatchFinalistsMapper.selectCount(finalistsQuery);
if (count > 0) {
throw new BusinessException("当前用户已经加入到当前轮次当中,不能重复添加");
}
SeriesMatchFinalists finalists = new SeriesMatchFinalists();
finalists.setMatchId(matchId);
finalists.setRoundId(match.getRoundId());
finalists.setSportUserId(sportUserId);
seriesMatchFinalistsMapper.insert(finalists);
}
public void deleteFinalists(Long id) {
seriesMatchFinalistsMapper.deleteById(id);
}
} }
...@@ -80,4 +80,35 @@ ...@@ -80,4 +80,35 @@
left join series_match_player_record t5 on t5.id = t4.record_id left join series_match_player_record t5 on t5.id = t4.record_id
where t1.match_id = #{matchId} where t1.match_id = #{matchId}
</select> </select>
<select id="getCandidateWithoutQualifying"
resultType="com.antai.sport.http.server.management.api.business.series.vo.SeriesMatchFinalistsVO">
select t1.sport_user_id,t1.name as real_name,if(t1.sex = 1,'男','女') as sex,
t1.height,t1.weight,t2.name as area,t1.ftp
from series_apply t1
left join series_area t2 on t1.area_id = t2.id
where t1.series_id = #{seriesId}
and t1.sport_user_id not in (
select w1.sport_user_id
from series_match_finalists w1
where w1.round_id = #{roundId}
)
</select>
<select id="getCandidate"
resultType="com.antai.sport.http.server.management.api.business.series.vo.SeriesMatchFinalistsVO">
select t1.player_id as sport_user_id,t2.name as real_name,
if(t2.sex = 1,'男','女') as sex,t2.height,t2.weight,t3.name as area,
t2.ftp,t1.avg_ftp,t1.one_minutes_ftp as cp1,t1.five_minutes_ftp as cp5,
t1.twenty_minutes_ftp as cp20,t1.duration
from series_match_player_record t1
left join series_apply t2 on t2.series_id = #{seriesId} and t1.player_id = t2.sport_user_id
left join series_area t3 on t2.area_id = t3.id
where t1.result_confirm_status = 40 and t1.round_id = #{preRoundId}
and t1.player_id not in (
select w1.sport_user_id
from series_match_finalists w1
where w1.round_id = #{roundId}
)
</select>
</mapper> </mapper>
\ No newline at end of file
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