Race card
This commit is contained in:
parent
813d8056a1
commit
876d7b5c35
@ -0,0 +1,9 @@
|
|||||||
|
package com.example.cezenBTC.DTO.race_card;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public record Pools(Map<String, Set<Integer>> comboRaces) {
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
package com.example.cezenBTC.DTO.race_card;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public record RaceCard(String Venue, LocalDate date, RaceVenueRaces raceVenueRaces, Pools pools) {
|
||||||
|
}
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
package com.example.cezenBTC.DTO.race_card;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public record RaceVenueRaces(Set<Set<Integer>> races) {
|
||||||
|
}
|
||||||
@ -103,6 +103,7 @@ public class CezenRoutsSecurityChain {
|
|||||||
"/btc/get_all_venues",
|
"/btc/get_all_venues",
|
||||||
"/btc/get_races_by_venue_id",
|
"/btc/get_races_by_venue_id",
|
||||||
"/btc/get_all_races_by_today",
|
"/btc/get_all_races_by_today",
|
||||||
|
"/btc/get_race_card",
|
||||||
"/cezen/set_aors",
|
"/cezen/set_aors",
|
||||||
"/cezen/set_password",
|
"/cezen/set_password",
|
||||||
"/cezen/add_extension"
|
"/cezen/add_extension"
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
package com.example.cezenBTC.controller;
|
package com.example.cezenBTC.controller;
|
||||||
|
|
||||||
|
import com.example.cezenBTC.DTO.race_card.RaceCard;
|
||||||
import com.example.cezenBTC.entity.btc_entity.RaceNumber;
|
import com.example.cezenBTC.entity.btc_entity.RaceNumber;
|
||||||
import com.example.cezenBTC.entity.btc_entity.RaceVenue;
|
import com.example.cezenBTC.entity.btc_entity.RaceVenue;
|
||||||
import com.example.cezenBTC.service.BtcRaceService;
|
import com.example.cezenBTC.service.BtcRaceService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
@ -39,4 +41,10 @@ public class BtcOperations {
|
|||||||
|
|
||||||
return this.btcRaceService.getAllRacesByDateService(LocalDate.now());
|
return this.btcRaceService.getAllRacesByDateService(LocalDate.now());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get_race_card")
|
||||||
|
public ResponseEntity<RaceCard> getRaceCard(){
|
||||||
|
|
||||||
|
return this.btcRaceService.getRaceCard(LocalDate.now());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,13 +2,17 @@ package com.example.cezenBTC.service;
|
|||||||
|
|
||||||
import com.example.cezenBTC.DAO.BtcOpsDAO;
|
import com.example.cezenBTC.DAO.BtcOpsDAO;
|
||||||
import com.example.cezenBTC.DTO.ReturnStatus;
|
import com.example.cezenBTC.DTO.ReturnStatus;
|
||||||
|
import com.example.cezenBTC.DTO.race_card.Pools;
|
||||||
|
import com.example.cezenBTC.DTO.race_card.RaceCard;
|
||||||
|
import com.example.cezenBTC.DTO.race_card.RaceVenueRaces;
|
||||||
import com.example.cezenBTC.entity.btc_entity.RaceNumber;
|
import com.example.cezenBTC.entity.btc_entity.RaceNumber;
|
||||||
import com.example.cezenBTC.entity.btc_entity.RaceVenue;
|
import com.example.cezenBTC.entity.btc_entity.RaceVenue;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.*;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class BtcRaceService {
|
public class BtcRaceService {
|
||||||
@ -79,4 +83,35 @@ public class BtcRaceService {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ResponseEntity<RaceCard> getRaceCard(LocalDate date){
|
||||||
|
|
||||||
|
//create race numbers
|
||||||
|
Set<Integer> races1 = new LinkedHashSet<>(List.of(1,2,3,4,5,6,7,8,10));
|
||||||
|
Set<Integer> races2 = new LinkedHashSet<>(List.of(2,4,6,8,10,12));
|
||||||
|
Set<Integer> races3 = new LinkedHashSet<>(List.of(1,2,3,5,7,8,9,10,11));
|
||||||
|
Set<Integer> races4 = new LinkedHashSet<>(List.of(1,2,3,4,5,6,7,8,10,12,13));
|
||||||
|
|
||||||
|
// create a Venue
|
||||||
|
Set<Set<Integer>> mysRaces = new LinkedHashSet<>();
|
||||||
|
mysRaces.add(races1);
|
||||||
|
mysRaces.add(races2);
|
||||||
|
mysRaces.add(races3);
|
||||||
|
mysRaces.add(races4);
|
||||||
|
RaceVenueRaces raceVenueMYS = new RaceVenueRaces(mysRaces);
|
||||||
|
|
||||||
|
//create a Pool combination
|
||||||
|
Set<Integer> pool1 = new LinkedHashSet<>(List.of(5, 6, 7));
|
||||||
|
Set<Integer> pool2 = new LinkedHashSet<>(List.of(1, 2, 3));
|
||||||
|
|
||||||
|
// pole id to pool combo
|
||||||
|
Map<String, Set<Integer>> mysPools = new LinkedHashMap<>();
|
||||||
|
mysPools.put("TRB2", pool1);
|
||||||
|
mysPools.put("MJP1", pool2);
|
||||||
|
Pools mysPool = new Pools(mysPools);
|
||||||
|
|
||||||
|
RaceCard raceCard = new RaceCard("MYS", date, raceVenueMYS, mysPool);
|
||||||
|
|
||||||
|
return ResponseEntity.status(200).body(raceCard);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user