Commit 84958702 authored by Md Suleman's avatar Md Suleman

updated dashboard logic

parent 9c90c6a1
...@@ -27,7 +27,7 @@ public class DashboardController { ...@@ -27,7 +27,7 @@ public class DashboardController {
@RequestMapping(value = "/resources/getEmployeesDashBoard", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/resources/getEmployeesDashBoard", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getEmployeesDashBoard(HttpServletRequest request) throws MyTeamException { public ResponseEntity<?> getEmployeesDashBoard(HttpServletRequest request) throws MyTeamException {
List<EmployeeDashboardVO> employeeDashBoardList = dashboardService.getEmployeesDashBoard(); List<EmployeeDashboardVO> employeeDashBoardList = dashboardService.getDashBoardData();
ResponseDetails responseDetails = new ResponseDetails(new Date(), 602, "Resources have been retrieved successfully", ResponseDetails responseDetails = new ResponseDetails(new Date(), 602, "Resources have been retrieved successfully",
"List of Resources for dashboard", employeeDashBoardList, request.getRequestURI(), "Resource details", null); "List of Resources for dashboard", employeeDashBoardList, request.getRequestURI(), "Resource details", null);
......
...@@ -64,8 +64,8 @@ public class Employee implements Serializable { ...@@ -64,8 +64,8 @@ public class Employee implements Serializable {
@ExcelCellName("Primary Skill") @ExcelCellName("Primary Skill")
private String baseTechnology; private String baseTechnology;
@ExcelCellName("Domain") // @ExcelCellName("Domain")
private String domain; // private String domain;
@ExcelCellName("Location") @ExcelCellName("Location")
private String empLocation; private String empLocation;
......
...@@ -6,4 +6,5 @@ import java.util.List; ...@@ -6,4 +6,5 @@ import java.util.List;
public interface IDashboardService { public interface IDashboardService {
public List<EmployeeDashboardVO> getEmployeesDashBoard(); public List<EmployeeDashboardVO> getEmployeesDashBoard();
public List<EmployeeDashboardVO> getDashBoardData();
} }
package com.nisum.myteam.service.impl; package com.nisum.myteam.service.impl;
import com.nisum.myteam.model.dao.Account;
import com.nisum.myteam.model.dao.Domain;
import com.nisum.myteam.model.dao.Employee; import com.nisum.myteam.model.dao.Employee;
import com.nisum.myteam.model.dao.Project; import com.nisum.myteam.model.dao.Project;
import com.nisum.myteam.model.vo.EmployeeDashboardVO; import com.nisum.myteam.model.vo.EmployeeDashboardVO;
...@@ -14,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -14,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
@Service @Service
@Slf4j @Slf4j
...@@ -28,6 +31,12 @@ public class DashboardService implements IDashboardService { ...@@ -28,6 +31,12 @@ public class DashboardService implements IDashboardService {
@Autowired @Autowired
private IProjectService projectService; private IProjectService projectService;
@Autowired
private DomainService domainService;
@Autowired
private AccountService accountService;
@Override @Override
public List<EmployeeDashboardVO> getEmployeesDashBoard() { public List<EmployeeDashboardVO> getEmployeesDashBoard() {
//List<Employee> allEmployees = employeeRepo.findAll(); //List<Employee> allEmployees = employeeRepo.findAll();
...@@ -99,4 +108,37 @@ public class DashboardService implements IDashboardService { ...@@ -99,4 +108,37 @@ public class DashboardService implements IDashboardService {
} }
return employeeDashboard; return employeeDashboard;
} }
@Override
public List<EmployeeDashboardVO> getDashBoardData(){
List<EmployeeDashboardVO> employeeDashboard = new ArrayList<>();
List<Employee> allEmployees = employeeService.getAllEmployees();
List<ResourceVO> resources = resourceService.getAllResourcesVO();
for (Employee employee:allEmployees){
EmployeeDashboardVO employeeDashboardVO = new EmployeeDashboardVO();
BeanUtils.copyProperties(employee, employeeDashboardVO);
employeeDashboard.add(employeeDashboardVO);
}
employeeDashboard.stream().forEach(emp -> {
List<ResourceVO> latestResourceList = resources.stream().
filter(res -> (res.getEmployeeId().equals(emp.getEmployeeId())&&res.getBillingEndDate().after(new Date()))).collect(Collectors.toList());
if(!latestResourceList.isEmpty()){
ResourceVO latestResource = latestResourceList.get(0);
Project resourceProject = projectService.getProjectByProjectId(latestResource.getProjectId());
if(!resourceProject.getStatus().equals("Completed")){
emp.setProjectId(resourceProject.getProjectId());
emp.setProjectName(resourceProject.getProjectName());
emp.setBillingStartDate(latestResource.getBillingStartDate());
emp.setBillingEndDate(latestResource.getBillingEndDate());
Domain domain = domainService.getDomainById(resourceProject.getDomainId());
Account account = accountService.getAccountById(resourceProject.getAccountId());
emp.setAccountName(account.getAccountName());
emp.setDomain(domain.getDomainName());
}
}
});
return employeeDashboard;
}
} }
...@@ -81,7 +81,7 @@ public class EmployeeService implements IEmployeeService { ...@@ -81,7 +81,7 @@ public class EmployeeService implements IEmployeeService {
update.set("empSubStatus", employeeReq.getEmpSubStatus()); update.set("empSubStatus", employeeReq.getEmpSubStatus());
update.set("employmentType", employeeReq.getEmploymentType()); update.set("employmentType", employeeReq.getEmploymentType());
update.set("empLocation", employeeReq.getEmpLocation()); update.set("empLocation", employeeReq.getEmpLocation());
update.set("domain", employeeReq.getDomain()); // update.set("domain", employeeReq.getDomain());
update.set("designation", employeeReq.getDesignation()); update.set("designation", employeeReq.getDesignation());
update.set("dateOfBirth", employeeReq.getDateOfBirth()); update.set("dateOfBirth", employeeReq.getDateOfBirth());
update.set("dateOfJoining", employeeReq.getDateOfJoining()); update.set("dateOfJoining", employeeReq.getDateOfJoining());
......
...@@ -17,8 +17,8 @@ function($mdDateLocaleProvider) { ...@@ -17,8 +17,8 @@ function($mdDateLocaleProvider) {
myApp.constant('appConfig', { myApp.constant('appConfig', {
appName: "MyTime", appName: "MyTime",
appUri: "http://10.3.45.11:8080/myTeam/", //appUri: "http://10.3.45.11:8080/myTeam/",
//appUri: "http://localhost:8080/myTeam/", appUri: "http://localhost:8080/myTeam/",
version:"1.0", version:"1.0",
empStartId:16001, empStartId:16001,
empEndId:99999, empEndId:99999,
......
...@@ -16,7 +16,8 @@ ...@@ -16,7 +16,8 @@
function renderButton() { function renderButton() {
gapi.load('auth2', function () { gapi.load('auth2', function () {
gapi.auth2.init({ gapi.auth2.init({
client_id: "951338644595-32q4i4n2rv4jevvteq77m7jpcq9sbrec.apps.googleusercontent.com", //client_id: "951338644595-32q4i4n2rv4jevvteq77m7jpcq9sbrec.apps.googleusercontent.com",
client_id: "685521475239-ujm7l2hkgrltk7loi8efl0ed702asm2r.apps.googleusercontent.com",
hosted_domain: 'nisum.com' hosted_domain: 'nisum.com'
}); });
}); });
...@@ -33,8 +34,8 @@ ...@@ -33,8 +34,8 @@
</script> </script>
<script src="https://apis.google.com/js/platform.js?onload=renderButton"></script> <script src="https://apis.google.com/js/platform.js?onload=renderButton"></script>
<!--<meta name="google-signin-client_id" content="10230597574-gv1bg8nehm0a63n9hh5mu9um563uqaq1.apps.googleusercontent.com">--> <!--<meta name="google-signin-client_id" content="10230597574-gv1bg8nehm0a63n9hh5mu9um563uqaq1.apps.googleusercontent.com">-->
<!--<meta name="google-signin-client_id" content="685521475239-ujm7l2hkgrltk7loi8efl0ed702asm2r.apps.googleusercontent.com">--> <meta name="google-signin-client_id" content="685521475239-ujm7l2hkgrltk7loi8efl0ed702asm2r.apps.googleusercontent.com">
<meta name="google-signin-client_id" content="951338644595-32q4i4n2rv4jevvteq77m7jpcq9sbrec.apps.googleusercontent.com"> <!--<meta name="google-signin-client_id" content="951338644595-32q4i4n2rv4jevvteq77m7jpcq9sbrec.apps.googleusercontent.com">-->
......
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