DashboardComponentResource.buildOrganizationComponent() dá erro de proxy
em PROD
This commit is contained in:
Orlando M Guerreiro 2025-06-21 23:55:23 +01:00
parent 7cfc16e04d
commit 1a1302da46
2 changed files with 20 additions and 11 deletions

View file

@ -33,6 +33,8 @@ import com.oguerreiro.resilient.domain.enumeration.DashboardComponentView;
import com.oguerreiro.resilient.repository.DashboardComponentRepository; import com.oguerreiro.resilient.repository.DashboardComponentRepository;
import com.oguerreiro.resilient.repository.OrganizationRepository; import com.oguerreiro.resilient.repository.OrganizationRepository;
import com.oguerreiro.resilient.service.dto.DashboardComponentDTO; import com.oguerreiro.resilient.service.dto.DashboardComponentDTO;
import com.oguerreiro.resilient.service.dto.DashboardComponentDetailValueDTO;
import com.oguerreiro.resilient.service.mapper.DashboardComponentDetailValueMapper;
import com.oguerreiro.resilient.service.mapper.DashboardComponentMapper; import com.oguerreiro.resilient.service.mapper.DashboardComponentMapper;
/** /**
@ -45,13 +47,25 @@ public class DashboardComponentService
private OrganizationRepository organizationRepository; private OrganizationRepository organizationRepository;
private DashboardComponentMapper dashboardComponentMapper; private DashboardComponentMapper dashboardComponentMapper;
private final DashboardComponentDetailValueMapper dashboardComponentDetailValueMapper;
public DashboardComponentService(DashboardComponentRepository dashboardComponentRepository, public DashboardComponentService(DashboardComponentRepository dashboardComponentRepository,
DashboardComponentMapper dashboardComponentMapper, OrganizationRepository organizationRepository) { DashboardComponentMapper dashboardComponentMapper, OrganizationRepository organizationRepository,
DashboardComponentDetailValueMapper dashboardComponentDetailValueMapper) {
super(DashboardComponent.class, dashboardComponentRepository, dashboardComponentMapper); super(DashboardComponent.class, dashboardComponentRepository, dashboardComponentMapper);
this.organizationRepository = organizationRepository; this.organizationRepository = organizationRepository;
this.dashboardComponentMapper = dashboardComponentMapper; this.dashboardComponentMapper = dashboardComponentMapper;
this.dashboardComponentDetailValueMapper = dashboardComponentDetailValueMapper;
}
public Map<String, List<DashboardComponentDetailValueDTO>> buildDashboardComponentViewDTO(Long organizationId,
Long dashboardComponentId, Long periodVersionId) {
Map<String, List<DashboardComponentDetailValue>> mapValues = buildDashboardComponentView(organizationId,
dashboardComponentId, periodVersionId);
return this.dashboardComponentDetailValueMapper.mapToDto(mapValues);
} }
/* /*

View file

@ -15,13 +15,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.oguerreiro.resilient.domain.DashboardComponent; import com.oguerreiro.resilient.domain.DashboardComponent;
import com.oguerreiro.resilient.domain.DashboardComponentDetailValue;
import com.oguerreiro.resilient.domain.enumeration.DashboardComponentView; import com.oguerreiro.resilient.domain.enumeration.DashboardComponentView;
import com.oguerreiro.resilient.repository.DashboardComponentRepository; import com.oguerreiro.resilient.repository.DashboardComponentRepository;
import com.oguerreiro.resilient.service.DashboardComponentService; import com.oguerreiro.resilient.service.DashboardComponentService;
import com.oguerreiro.resilient.service.dto.DashboardComponentDTO; import com.oguerreiro.resilient.service.dto.DashboardComponentDTO;
import com.oguerreiro.resilient.service.dto.DashboardComponentDetailValueDTO; import com.oguerreiro.resilient.service.dto.DashboardComponentDetailValueDTO;
import com.oguerreiro.resilient.service.mapper.DashboardComponentDetailValueMapper;
/** /**
* REST controller for managing {@link com.oguerreiro.resilient.domain.UnitType}. * REST controller for managing {@link com.oguerreiro.resilient.domain.UnitType}.
@ -32,14 +30,11 @@ public class DashboardComponentResource
extends AbstractResilientResource<DashboardComponent, DashboardComponentDTO, Long> { extends AbstractResilientResource<DashboardComponent, DashboardComponentDTO, Long> {
private static final String ENTITY_NAME = "dashboardComponent"; private static final String ENTITY_NAME = "dashboardComponent";
private final DashboardComponentDetailValueMapper dashboardComponentDetailValueMapper;
private final DashboardComponentService dashboardComponentService; private final DashboardComponentService dashboardComponentService;
public DashboardComponentResource(DashboardComponentRepository dashboardComponentRepository, public DashboardComponentResource(DashboardComponentRepository dashboardComponentRepository,
DashboardComponentService dashboardComponentService, DashboardComponentService dashboardComponentService) {
DashboardComponentDetailValueMapper dashboardComponentDetailValueMapper) {
super(DashboardComponent.class, dashboardComponentRepository, dashboardComponentService); super(DashboardComponent.class, dashboardComponentRepository, dashboardComponentService);
this.dashboardComponentDetailValueMapper = dashboardComponentDetailValueMapper;
this.dashboardComponentService = dashboardComponentService; this.dashboardComponentService = dashboardComponentService;
} }
@ -67,10 +62,10 @@ public class DashboardComponentResource
Optional<DashboardComponentDTO> dashboardComponentDTO = getDashboardComponentService().findOne( Optional<DashboardComponentDTO> dashboardComponentDTO = getDashboardComponentService().findOne(
dashboardComponentId); dashboardComponentId);
Map<String, List<DashboardComponentDetailValue>> values = getDashboardComponentService().buildDashboardComponentView( Map<String, List<DashboardComponentDetailValueDTO>> values = getDashboardComponentService().buildDashboardComponentViewDTO(
null, dashboardComponentId, periodVersionId); null, dashboardComponentId, periodVersionId);
return this.dashboardComponentDetailValueMapper.mapToDto(values); return values;
} }
@GetMapping("/build/{organizationId}/{dashboardComponentId}/{periodVersionId}") @GetMapping("/build/{organizationId}/{dashboardComponentId}/{periodVersionId}")
@ -82,10 +77,10 @@ public class DashboardComponentResource
Optional<DashboardComponentDTO> dashboardComponentDTO = getDashboardComponentService().findOne( Optional<DashboardComponentDTO> dashboardComponentDTO = getDashboardComponentService().findOne(
dashboardComponentId); dashboardComponentId);
Map<String, List<DashboardComponentDetailValue>> values = getDashboardComponentService().buildDashboardComponentView( Map<String, List<DashboardComponentDetailValueDTO>> values = getDashboardComponentService().buildDashboardComponentViewDTO(
organizationId, dashboardComponentId, periodVersionId); organizationId, dashboardComponentId, periodVersionId);
return this.dashboardComponentDetailValueMapper.mapToDto(values); return values;
} }
@GetMapping("/active") @GetMapping("/active")