Arreglar generar un reporte de Horas Trabajadas
This commit is contained in:
parent
9c1921df9a
commit
dc1881ffed
@ -11,5 +11,6 @@ public interface EmployeeRepository extends JpaRepository<Employee, UUID> {
|
|||||||
Optional<Employee> findByUsername(String username);
|
Optional<Employee> findByUsername(String username);
|
||||||
Optional<Employee> findByPersonalEmail(String personalEmail);
|
Optional<Employee> findByPersonalEmail(String personalEmail);
|
||||||
List<Employee> findAllByTeamId(UUID teamId);
|
List<Employee> findAllByTeamId(UUID teamId);
|
||||||
|
Optional<Employee> findByTeamIdAndLeadManagerTrue(UUID teamId);
|
||||||
List<Employee> findByTeamName(String teamName);
|
List<Employee> findByTeamName(String teamName);
|
||||||
}
|
}
|
@ -50,12 +50,7 @@ public class EmployeeService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getTeamLeadName(final UUID teamId) {
|
public String getTeamLeadName(final UUID teamId) {
|
||||||
// Encuentra al empleado con el rol de lead_manager en el equipo especificado
|
Optional<Employee> leadManager = employeeRepository.findByTeamIdAndLeadManagerTrue(teamId);
|
||||||
List<Employee> teamMembers = employeeRepository.findAllByTeamId(teamId);
|
|
||||||
Optional<Employee> leadManager = teamMembers.stream()
|
|
||||||
.filter(e -> Strings.isNullOrEmpty(e.getLeadManager()))
|
|
||||||
.findFirst();
|
|
||||||
|
|
||||||
return leadManager.map(employee -> employee.getFirstName() + " " + employee.getLastName())
|
return leadManager.map(employee -> employee.getFirstName() + " " + employee.getLastName())
|
||||||
.orElse("No asignado");
|
.orElse("No asignado");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user