This commit is contained in:
@@ -108,7 +108,8 @@ public class DockViewFileHandler implements RequestHandler {
|
|||||||
null);
|
null);
|
||||||
}
|
}
|
||||||
|
|
||||||
DockViewStatsResponse totalStats = dockViewService.getTotalStatsByFileIds(fileIds);
|
DockViewStatsResponse totalStats = dockViewService.getTotalStatsByFileIds(fileIds,
|
||||||
|
docViewerRequest.getLocale());
|
||||||
|
|
||||||
return new BaseResponse(request.getMsgId(),
|
return new BaseResponse(request.getMsgId(),
|
||||||
MessageCode.SUCCESS.getCode(),
|
MessageCode.SUCCESS.getCode(),
|
||||||
|
|||||||
@@ -53,10 +53,10 @@ public class DockViewService {
|
|||||||
return saved;
|
return saved;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DockViewStatsResponse getTotalStatsByFileIds(List<String> fileIds) {
|
public DockViewStatsResponse getTotalStatsByFileIds(List<String> fileIds, String locale) {
|
||||||
List<Object[]> statsList = dockViewRepository.findTotalViewsStatsByFileIds(fileIds);
|
List<Object[]> statsList = dockViewRepository.findTotalViewsStatsByFileIds(fileIds);
|
||||||
List<String> allViewerIps = dockViewRepository.findAllViewerIps(fileIds);
|
List<String> allViewerIps = dockViewRepository.findAllViewerIps(fileIds);
|
||||||
Map<String, Integer> uniqueGeoCount = geoCountryService.getUniqueGeoCount(allViewerIps);
|
Map<String, Integer> uniqueGeoCount = geoCountryService.getUniqueGeoCount(allViewerIps, locale);
|
||||||
|
|
||||||
if (statsList.isEmpty()) {
|
if (statsList.isEmpty()) {
|
||||||
return DockViewStatsResponse.builder()
|
return DockViewStatsResponse.builder()
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class GeoCountryService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Integer> getUniqueGeoCount(List<String> ipList) {
|
public Map<String, Integer> getUniqueGeoCount(List<String> ipList, String locale) {
|
||||||
Set<String> uniqueCountries = new HashSet<>();
|
Set<String> uniqueCountries = new HashSet<>();
|
||||||
Set<String> uniqueCountryCodes = new HashSet<>();
|
Set<String> uniqueCountryCodes = new HashSet<>();
|
||||||
Set<String> uniqueCities = new HashSet<>();
|
Set<String> uniqueCities = new HashSet<>();
|
||||||
@@ -53,7 +53,7 @@ public class GeoCountryService {
|
|||||||
if (ipList != null) {
|
if (ipList != null) {
|
||||||
for (String ip : ipList) {
|
for (String ip : ipList) {
|
||||||
try {
|
try {
|
||||||
String country = getCountryByIp(ip);
|
String country = getCountryByIp(ip, locale);
|
||||||
if (!"UNKNOWN".equals(country)) {
|
if (!"UNKNOWN".equals(country)) {
|
||||||
uniqueCountries.add(country);
|
uniqueCountries.add(country);
|
||||||
}
|
}
|
||||||
@@ -63,7 +63,7 @@ public class GeoCountryService {
|
|||||||
uniqueCountryCodes.add(countryCode);
|
uniqueCountryCodes.add(countryCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
String city = getCityByIp(ip);
|
String city = getCityByIp(ip, locale);
|
||||||
if (!"UNKNOWN".equals(city)) {
|
if (!"UNKNOWN".equals(city)) {
|
||||||
uniqueCities.add(city);
|
uniqueCities.add(city);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user