Commit e4fcbdc8 authored by Md Suleman's avatar Md Suleman

utilization report fixes

parent 24440c83
......@@ -25,7 +25,7 @@ public class UploadXLController {
@RequestMapping(value = "/employee/fileUpload", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public ResponseEntity<String> exportDataFromFile(@RequestParam(value = "file") MultipartFile file,
@RequestParam(value = "empId") String loginEmpId) throws MyTeamException {
log.info("Uploaded file: {} with size: {}", file.getOriginalFilename(), file.getSize());
log.info("Uploaded file: {} with size: {} By employee: {}", file.getOriginalFilename(), file.getSize(), loginEmpId);
String result = uploadService.importDataFromExcelFile(file, loginEmpId);
return new ResponseEntity<>(result, HttpStatus.OK);
}
......
......@@ -66,10 +66,10 @@ public class ReportService implements IReportService {
if(byType.equals("AllFunctionalOrgs")) {
employeeList = getEmployeesByFunctionalGroup(category);
} else if(byType.equals("Account")){
employeeList = getEmployeeByAccounts(category);
employeeList = getEmployeeByAccounts(category,onDate);
}
else {
employeeList = getEmployeesByAccAndFG(category,byType);
employeeList = getEmployeesByAccAndFG(category,byType,onDate);
}
for(Employee employee:employeeList){
Resource resource = null;
......@@ -103,9 +103,9 @@ public class ReportService implements IReportService {
return reportVo;
}
private List<Employee> getEmployeesByAccAndFG(String account, String functionalGroup) {
private List<Employee> getEmployeesByAccAndFG(String account, String functionalGroup, Date onDate) {
List<Employee> empList;
empList = getEmployeeByAccounts(account).stream().filter(e -> e.getFunctionalGroup().equals(functionalGroup)).collect(Collectors.toList());
empList = getEmployeeByAccounts(account,onDate).stream().filter(e -> e.getFunctionalGroup().equals(functionalGroup)).collect(Collectors.toList());
return empList;
}
......@@ -113,11 +113,12 @@ public class ReportService implements IReportService {
return employeeService.getEmployeesByFunctionalGrp(functionalGroup);
}
private List<Employee> getEmployeeByAccounts(String accountName){
private List<Employee> getEmployeeByAccounts(String accountName,Date onDate){
List<Employee> employeeList = new ArrayList<>();
List<Project> projects = projectService.getProjectsByAccountId(accountService.getAccountByName(accountName).getAccountId());
projects.stream().forEach(p -> {
resourceService.getResourceByProjectId(p.getProjectId()).stream().filter(r -> resourceService.isAllocationActiveToday(r)).
resourceService.getResourceByProjectId(p.getProjectId()).stream().filter(resource -> resource.getBillingStartDate().compareTo(onDate) <=0 &&
resource.getBillingEndDate().compareTo(onDate)>=0 ).
forEach(r ->{
Employee employee= employeeService.findByEmployeeIdAndEmpStatus(MyTeamUtils.ACTIVE,r.getEmployeeId());
if(employee!=null)
......@@ -139,12 +140,12 @@ public class ReportService implements IReportService {
public List<Reports> getEmployeeDetailsByAccountBillability(String accountName, String billabilityStatus,Date onDate)
throws MyTeamException {
return resultantEmployeeWithBillability(getEmployeeByAccounts(accountName),billabilityStatus,onDate);
return resultantEmployeeWithBillability(getEmployeeByAccounts(accountName,onDate),billabilityStatus,onDate);
}
@Override
public List<Reports> getEmployeeDetailsByFGAccountAndBillability(String fGroup, String billableStatus, String account,Date onDate) throws MyTeamException {
List<Employee> empList = getEmployeesByAccAndFG(account,fGroup);
List<Employee> empList = getEmployeesByAccAndFG(account,fGroup,onDate);
return resultantEmployeeWithBillability(empList,billableStatus,onDate);
}
......
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