fix: make country dashboard backfill atomic

This commit is contained in:
hy001 2026-05-23 12:27:44 +08:00
parent c99542ebe9
commit 35458a674e
2 changed files with 11 additions and 5 deletions

View File

@ -146,15 +146,21 @@ public class DatavRestController extends BaseController {
}
LocalDate parsedStartDate = LocalDate.parse(startDate);
LocalDate parsedEndDate = LocalDate.parse(endDate);
List<String> refreshedTimezones = countryDashboardBackfillLockService.call(
() -> countryDashboardGameMetricService.refreshRange(
parsedStartDate, parsedEndDate, sysOrigin, statTimezones));
Map<String, Object> refreshed = countryDashboardBackfillLockService.call(() -> {
List<String> countryTimezones = countryDashboardDailyMetricService.refreshRange(
parsedStartDate, parsedEndDate, sysOrigin, statTimezones);
List<String> gameTimezones = countryDashboardGameMetricService.refreshRange(
parsedStartDate, parsedEndDate, sysOrigin, statTimezones);
return Map.of(
"countryStatTimezones", countryTimezones,
"gameStatTimezones", gameTimezones);
});
return Map.of(
"status", "success",
"startDate", parsedStartDate.toString(),
"endDate", parsedEndDate.toString(),
"sysOrigin", sysOrigin,
"statTimezones", refreshedTimezones);
"statTimezones", refreshed);
}
private CountryDashboardCO emptyCountryDashboard(CountryDashboardQryCmd cmd) {

View File

@ -292,7 +292,7 @@ public class CountryDashboardServiceImpl implements CountryDashboardService {
limit = Math.min(100, limit);
QueryCondition condition = QueryCondition.of(cmd);
String countryCodes = trimToNull(cmd == null ? null : cmd.getCountryCodes());
String countryCodes = QueryCondition.trimToNull(cmd == null ? null : cmd.getCountryCodes());
long total = safeLong(countryDashboardDAO.countRechargeDetails(
condition.startTime, condition.endTime, condition.countryKeyword, countryCodes,
condition.sysOrigin, condition.storageTimezoneOffset, condition.statTimezoneOffset));