Commit e6847920 authored by vikram singh's avatar vikram singh

"Code changes for showing current Allocation on DashBoard."

parent 728a1070
......@@ -69,6 +69,8 @@ public interface IResourceService {
public List<Resource> getResourceByProjectId(String projectId);
Resource getCurrentAllocation(String employeeId);
// List<Resource> getAllResourcesForProject(String projectId, String status);
......
......@@ -148,7 +148,7 @@ public class DashboardService implements IDashboardService {
public List<EmployeeDashboardVO> getDashBoardData() throws MyTeamException {
List<EmployeeDashboardVO> employeeDashboard = new ArrayList<>();
List<Employee> allEmployees = employeeService.getActiveEmployees();
List<ResourceVO> resources = resourceService.getAllResourcesVO();
// List<ResourceVO> resources = resourceService.getAllResourcesVO();
for (Employee employee:allEmployees){
EmployeeDashboardVO employeeDashboardVO = new EmployeeDashboardVO();
......@@ -157,7 +157,8 @@ public class DashboardService implements IDashboardService {
}
employeeDashboard.stream().forEach(emp -> {
Resource resource=resourceService.getLatestResourceByEmpId(emp.getEmployeeId());
Resource resource=resourceService.getCurrentAllocation(emp.getEmployeeId());
//resourceService.getLatestResourceByEmpId(emp.getEmployeeId());
Project resourceProject = projectService.getProjectByProjectId(resource.getProjectId());
if(!resourceProject.getStatus().equals("Completed")){
emp.setProjectId(resourceProject.getProjectId());
......
......@@ -969,6 +969,11 @@ public class ResourceService implements IResourceService {
respMap.put("message", "Resource is moved to Bench Successfully");
return resourcePers;
}
@Override
public Resource getCurrentAllocation(String employeeId) {
return resourceRepo.findByEmployeeId(employeeId).stream().filter(resource-> isAllocationActiveToday(resource)).findAny().orElse(getLatestResourceByEmpId(employeeId));
}
}
//class
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment