Commit 65cd588a authored by vikram singh's avatar vikram singh

"MT - 5 code changes implementation of showing employee data by

clicking on grid."
parent 75c2d0cc
......@@ -342,16 +342,41 @@ public class EmployeeService implements IEmployeeService {
return employeeRepo.findByEmployeeIdIn(empIdsSet);
}
@Override
public List<BillableEmployee> getEmployeeDetailsByFGAndBillability(String fGroup, String billableStatus) {
Map<String,Resource> resourceMap=resourceService.findByBillableStatus(billableStatus).stream().collect(Collectors.toMap(e->e.getEmployeeId(), e->e));
return employeeRepo.findByEmpStatusAndFunctionalGroup(ResourceStatus.ACTIVE.getStatus(), fGroup).stream().filter(e->resourceMap.keySet().contains(e.getEmployeeId())).map(e-> mappingBillableEmployee(e,fGroup,resourceMap)).collect(Collectors.toList());
}
private BillableEmployee mappingBillableEmployee(Employee e,String fGroup,Map<String,Resource> resourceMap ) {
Resource resource=resourceMap.get(e.getEmployeeId());
Project project=projectService.getProjectByProjectId(resource.getProjectId());
return new BillableEmployee(e.getEmployeeId(),e.getEmployeeName(),e.getEmailId(),project.getProjectName(),resource.getBillableStatus(),resource.getBillingStartDate(),resource.getBillingEndDate(),fGroup);
}
@Override
public List<BillableEmployee> getEmployeeDetailsByFGAndBillability(String fGroup, String billableStatus) {
BillableEmployee billableEmployee=new BillableEmployee();
List<BillableEmployee> resultantEmployees=new ArrayList<BillableEmployee>();
List<Employee> employeesByFG=employeeRepo.findByEmpStatusAndFunctionalGroup(ResourceStatus.ACTIVE.getStatus(), fGroup);
for(Employee employee:employeesByFG) {
Resource resourceObj=resourceService.getLatestResourceByEmpId(employee.getEmployeeId());
if(resourceObj!=null && resourceObj.getBillableStatus().equals(billableStatus)) {
Project project=projectService.getProjectByProjectId(resourceObj.getProjectId());
billableEmployee.setEmployeeId(resourceObj.getEmployeeId());
billableEmployee.setEmployeeName(employee.getEmployeeName());
billableEmployee.setEmailId(employee.getEmailId());
billableEmployee.setProjectName(project.getProjectName());
billableEmployee.setBillingStartDate(resourceObj.getBillingStartDate());
billableEmployee.setBillableStatus(resourceObj.getBillableStatus());
billableEmployee.setBillingEndDate(resourceObj.getBillingEndDate());
billableEmployee.setFunctionalGroup(fGroup);
resultantEmployees.add(billableEmployee );
}
// else if(resourceObj==null ) {
// billableEmployee.setEmployeeId(employee.getEmployeeId());
// billableEmployee.setEmployeeName(employee.getEmployeeName());
// billableEmployee.setEmailId(employee.getEmailId());
// billableEmployee.setFunctionalGroup(fGroup);
// resultantEmployees.add(billableEmployee);
//
// }
}
return resultantEmployees;
//Map<String,Resource> resourceMap=resourceService.findByBillableStatus(billableStatus).stream().collect(Collectors.toMap(e->e.getEmployeeId(), e->e));
//return employeeRepo.findByEmpStatusAndFunctionalGroup(ResourceStatus.ACTIVE.getStatus(), fGroup).stream().filter(e->resourceMap.keySet().contains(e.getEmployeeId())).map(e-> mappingBillableEmployee(e,fGroup,resourceMap)).collect(Collectors.toList());
}
}
package com.nisum.myteam.service.impl;
import com.nisum.myteam.exception.handler.MyTeamException;
......@@ -886,11 +887,14 @@ public class ResourceService implements IResourceService {
return allocationList;
}
@Override
public Set<Resource> findByBillableStatus(String billableStatus) {
return resourceRepo.findByBillableStatus(billableStatus).stream().filter(r -> r.getBillingEndDate().after(new Date())).collect(Collectors.toSet());
}
}//class
......@@ -949,4 +953,6 @@ public class ResourceService implements IResourceService {
return finalResourcesList;
}
*/
\ No newline at end of file
*/
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