use of py.org.fundacionparaguaya.pspserver.surveys.dtos.SnapshotIndicators in project FP-PSP-SERVER by FundacionParaguaya.
the class SnapshotServiceImpl method countSnapshotIndicators.
private SnapshotIndicators countSnapshotIndicators(SnapshotEconomicEntity snapshot) {
SnapshotIndicators indicators = new SnapshotIndicators();
try {
SurveyData properties = indicatorMapper.entityToDto(snapshot.getSnapshotIndicator());
properties.forEach((k, v) -> {
countIndicators(indicators, v);
});
} catch (Exception e) {
LOG.error(e.getMessage(), e);
throw new UnknownResourceException(i18n.translate("snapshot.invalid", snapshot.getId()));
}
return indicators;
}
use of py.org.fundacionparaguaya.pspserver.surveys.dtos.SnapshotIndicators in project FP-PSP-SERVER by FundacionParaguaya.
the class OrganizationServiceImpl method countSnapshotIndicators.
private SnapshotIndicators countSnapshotIndicators(Long organizationId) {
List<FamilyEntity> families = familyService.findByOrganizationId(organizationId);
List<SnapshotEconomicEntity> snapshotEconomics = snapshotEconomicRepo.findByFamilyIn(families);
List<SnapshotIndicatorEntity> entityList = new ArrayList<SnapshotIndicatorEntity>();
for (SnapshotEconomicEntity economics : snapshotEconomics) {
entityList.add(economics.getSnapshotIndicator());
}
SnapshotIndicators indicators = new SnapshotIndicators();
List<SurveyData> listProperties = indicatorMapper.entityListToDtoList(entityList);
for (SurveyData properties : listProperties) {
properties.forEach((k, v) -> {
countIndicators(indicators, v);
});
}
return indicators;
}
Aggregations