package com.ping.study.controller.tx; import com.ping.study.model.dto.tx.MatchListRequest; import com.ping.study.service.tx.MatchService; import com.ping.study.service.tx.SportsQqService; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import reactor.core.publisher.Mono; import java.time.LocalDate; import java.util.List; @RestController @RequestMapping("/tx/nba") public class MatchController { private final SportsQqService sportsQqService; private final MatchService matchService; public MatchController(MatchService matchService,SportsQqService sportsQqService) { this.sportsQqService = sportsQqService; this.matchService = matchService; } @GetMapping("/matches") public Mono getMatches( @RequestParam(required = false, defaultValue = "100000") Integer columnId, @RequestParam String startTime, @RequestParam String endTime) { MatchListRequest request = new MatchListRequest(); request.setColumnId(columnId); request.setStartTime(LocalDate.parse(startTime)); request.setEndTime(LocalDate.parse(endTime)); return sportsQqService.getMatchList(request); } @GetMapping("/lives") public List getPlayoffLiveIds( @RequestParam String startTime, @RequestParam String endTime) { LocalDate startDate = LocalDate.parse(startTime); LocalDate endDate = LocalDate.parse(endTime); return matchService.getPlayoffLiveIdsBlocking(startDate, endDate); } }