fix(console): parse dashboard backfill dates

This commit is contained in:
hy001 2026-05-07 15:09:21 +08:00
parent ab515c122c
commit 3a65d1b46e

View File

@ -17,7 +17,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@ -66,14 +65,16 @@ public class DatavRestController extends BaseController {
@PostMapping("/country-dashboard/backfill") @PostMapping("/country-dashboard/backfill")
public Map<String, Object> backfillCountryDashboard( public Map<String, Object> backfillCountryDashboard(
@RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate startDate, @RequestParam String startDate,
@RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate endDate, @RequestParam String endDate,
@RequestParam(value = "sysOrigin", defaultValue = "LIKEI") String sysOrigin) { @RequestParam(value = "sysOrigin", defaultValue = "LIKEI") String sysOrigin) {
countryDashboardDailyMetricService.refreshRange(startDate, endDate, sysOrigin); LocalDate parsedStartDate = LocalDate.parse(startDate);
LocalDate parsedEndDate = LocalDate.parse(endDate);
countryDashboardDailyMetricService.refreshRange(parsedStartDate, parsedEndDate, sysOrigin);
return Map.of( return Map.of(
"status", "success", "status", "success",
"startDate", startDate.toString(), "startDate", parsedStartDate.toString(),
"endDate", endDate.toString(), "endDate", parsedEndDate.toString(),
"sysOrigin", sysOrigin); "sysOrigin", sysOrigin);
} }