Commit fe57dccc authored by Prayas Jain's avatar Prayas Jain

Add_Teammate_updated

parents 1c8557e3 01fb8bfb
......@@ -16,15 +16,15 @@ import org.springframework.web.filter.CorsFilter;
@SpringBootApplication
@EnableAutoConfiguration
@EnableMongoRepositories(basePackages = { "com.nisum.myteam.repository" })
public class MyTimeApplication extends SpringBootServletInitializer {
public class MyTeamApplication extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(MyTimeApplication.class);
return application.sources(MyTeamApplication.class);
}
public static void main(String[] args) {
SpringApplication.run(MyTimeApplication.class, args);
SpringApplication.run(MyTeamApplication.class, args);
}
@Bean
......
package com.nisum.myteam.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.model.dao.Billing;
import com.nisum.myteam.service.IBillingService;
import lombok.extern.slf4j.Slf4j;
@RestController
@Slf4j
public class BillingController {
@Autowired
private IBillingService billingService;
// @RequestMapping(value = "/addEmployeeBilling"
@RequestMapping(value = "/billing", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Billing> addEmployeeBilling(@RequestBody Billing billing,
@RequestParam(value = "loginEmpId") String loginEmpId) throws MyTeamException {
Billing billingList = billingService.addBilling(billing, loginEmpId);
return new ResponseEntity<>(billingList, HttpStatus.OK);
}
// @RequestMapping(value = "/updateEmployeeBilling",
@RequestMapping(value = "/billing", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Billing> updateEmployeeBilling(@RequestBody Billing billing,
@RequestParam(value = "loginEmpId") String loginEmpId) throws MyTeamException {
Billing billingList = billingService.updateBilling(billing, loginEmpId);
return new ResponseEntity<>(billingList, HttpStatus.OK);
}
// @RequestMapping(value = "/deleteEmployeeBilling"
@RequestMapping(value = "/billing", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Billing> deleteEmployeeBilling(@RequestBody Billing billing) throws MyTeamException {
billingService.deleteBilling(billing);
return new ResponseEntity<>(null, HttpStatus.OK);
}
// @RequestMapping(value = "/getEmployeeBillingDetailsAll"
@RequestMapping(value = "/billing", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Billing>> getAllBillingsForEmployee(@RequestParam("employeeId") String employeeId)
throws MyTeamException {
List<Billing> billingList = billingService.getBillingsForEmployee(employeeId);
return new ResponseEntity<>(billingList, HttpStatus.OK);
}
// @RequestMapping(value = "/getEmployeeBillingDetails"
@RequestMapping(value = "/billing/project/{projectId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Billing>> getBillingsForProject(@PathVariable("projectId") String projectId,
@RequestParam("employeeId") String employeeId) throws MyTeamException {
List<Billing> billingList = billingService.getBillingsForProject(employeeId, projectId);
return new ResponseEntity<>(billingList, HttpStatus.OK);
}
}
//package com.nisum.myteam.controller;
//
//import java.util.List;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.http.HttpStatus;
//import org.springframework.http.MediaType;
//import org.springframework.http.ResponseEntity;
//import org.springframework.web.bind.annotation.PathVariable;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.bind.annotation.RestController;
//import com.nisum.myteam.exception.handler.MyTeamException;
//import com.nisum.myteam.model.dao.Billing;
//import com.nisum.myteam.service.IBillingService;
//import lombok.extern.slf4j.Slf4j;
//
//@RestController
//@Slf4j
//public class BillingController {
//
// @Autowired
// private IBillingService billingService;
//
// // @RequestMapping(value = "/addEmployeeBilling"
// @RequestMapping(value = "/billing", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
// public ResponseEntity<Billing> addEmployeeBilling(@RequestBody Billing billing,
// @RequestParam(value = "loginEmpId") String loginEmpId) throws MyTeamException {
// Billing billingList = billingService.addBilling(billing, loginEmpId);
//
// return new ResponseEntity<>(billingList, HttpStatus.OK);
// }
//
// // @RequestMapping(value = "/updateEmployeeBilling",
// @RequestMapping(value = "/billing", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
// public ResponseEntity<Billing> updateEmployeeBilling(@RequestBody Billing billing,
// @RequestParam(value = "loginEmpId") String loginEmpId) throws MyTeamException {
// Billing billingList = billingService.updateBilling(billing, loginEmpId);
// return new ResponseEntity<>(billingList, HttpStatus.OK);
// }
//
// // @RequestMapping(value = "/deleteEmployeeBilling"
// @RequestMapping(value = "/billing", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
// public ResponseEntity<Billing> deleteEmployeeBilling(@RequestBody Billing billing) throws MyTeamException {
// billingService.deleteBilling(billing);
// return new ResponseEntity<>(null, HttpStatus.OK);
// }
//
//
//
// // @RequestMapping(value = "/getEmployeeBillingDetailsAll"
// @RequestMapping(value = "/billing", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
// public ResponseEntity<List<Billing>> getAllBillingsForEmployee(@RequestParam("employeeId") String employeeId)
// throws MyTeamException {
// List<Billing> billingList = billingService.getBillingsForEmployee(employeeId);
// return new ResponseEntity<>(billingList, HttpStatus.OK);
// }
//
// // @RequestMapping(value = "/getEmployeeBillingDetails"
// @RequestMapping(value = "/billing/project/{projectId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
// public ResponseEntity<List<Billing>> getBillingsForProject(@PathVariable("projectId") String projectId,
// @RequestParam("employeeId") String employeeId) throws MyTeamException {
// List<Billing> billingList = billingService.getBillingsForProject(employeeId, projectId);
// return new ResponseEntity<>(billingList, HttpStatus.OK);
// }
//
//}
package com.nisum.myteam.controller;
import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.exception.handler.ResponseDetails;
import com.nisum.myteam.model.vo.EmployeeDashboardVO;
import com.nisum.myteam.service.IDashboardService;
import com.nisum.myteam.service.impl.DashboardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;
@RestController
@RequestMapping
public class DashboardController {
@Autowired
private IDashboardService dashboardService;
@RequestMapping(value = "/resources/getEmployeesDashBoard", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getEmployeesDashBoard(HttpServletRequest request) throws MyTeamException {
List<EmployeeDashboardVO> employeeDashBoardList = dashboardService.getEmployeesDashBoard();
ResponseDetails responseDetails = new ResponseDetails(new Date(), 602, "Resources have been retrieved successfully",
"List of Resources for dashboard", employeeDashBoardList, request.getRequestURI(), "Resource details", null);
return new ResponseEntity<ResponseDetails>(responseDetails, HttpStatus.OK);
}
}
package com.nisum.myteam.controller;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.exception.handler.ResponseDetails;
import com.nisum.myteam.model.dao.Domain;
import com.nisum.myteam.service.IDomainService;
import com.nisum.myteam.statuscodes.DomainStatus;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author Vijay
*
*/
@RestController
@Slf4j
public class DomainController {
@Autowired
private IDomainService domainService;
@RequestMapping(value = "/domains", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> createDomain(@RequestBody Domain domain, HttpServletRequest request)
throws MyTeamException {
log.info("Domain Creation");
if (!domainService.isDomainExists(domain)) {
Domain domainPeristed = domainService.create(domain);
@Autowired
private IDomainService domainService;
ResponseDetails createRespDetails = new ResponseDetails(new Date(), 801, "Domain has been created",
"Domain Creation", null, "", "details", domainPeristed);
return new ResponseEntity<ResponseDetails>(createRespDetails, HttpStatus.OK);
}
log.info("A domain is already existed with the requested name" + domain.getDomainName());
@RequestMapping(value = "/domains", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> createDomain(@RequestBody Domain domain, HttpServletRequest request)
throws MyTeamException {
ResponseDetails responseDetails = new ResponseDetails(new Date(), 802, "Domain is already existed",
"Choose the different domain name", null, request.getRequestURI(), "Domain details", domain);
log.info("Domain Creation");
return new ResponseEntity<ResponseDetails>(responseDetails, HttpStatus.OK);
if (!domainService.isDomainExists(domain)) {
Domain domainPeristed = domainService.create(domain);
}
ResponseDetails createRespDetails = new ResponseDetails(new Date(), DomainStatus.CREATE.getCode(), DomainStatus.CREATE.getMessage(),
"Domain Creation", null, "", "details", domainPeristed);
return new ResponseEntity<ResponseDetails>(createRespDetails, HttpStatus.OK);
}
log.info("A domain is already existed with the requested name" + domain.getDomainName());
ResponseDetails responseDetails = new ResponseDetails(new Date(), DomainStatus.ALREADY_EXISTED.getCode(), DomainStatus.ALREADY_EXISTED.getMessage(),
"Choose the different domain name", null, request.getRequestURI(), "Domain details", domain);
@RequestMapping(value = "/domains", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> updateDomain(@RequestBody Domain domain, HttpServletRequest request)
throws MyTeamException {
return new ResponseEntity<ResponseDetails>(responseDetails, HttpStatus.OK);
boolean isDomainExists = domainService.isDomainExists(domain);
if (isDomainExists == true) {
Domain domainPersisted = domainService.update(domain);
ResponseDetails updateRespDetails = new ResponseDetails(new Date(), 802, "Domain has been updated",
"Domain Updation", null, request.getRequestURI(), "Updation Domain details", domainPersisted);
}
return new ResponseEntity<ResponseDetails>(updateRespDetails, HttpStatus.OK);
}
ResponseDetails responseDetails = new ResponseDetails(new Date(), 803, "Domain is Not found",
"Choose the correct updating domain name", null, request.getRequestURI(), "details", domain);
return new ResponseEntity<ResponseDetails>(responseDetails, HttpStatus.OK);
}
@RequestMapping(value = "/domains", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> updateDomain(@RequestBody Domain domain, HttpServletRequest request)
throws MyTeamException {
@RequestMapping(value = "/domains/{domainId}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> deleteDomain(@PathVariable String domainId, HttpServletRequest request)
throws MyTeamException {
domainService.delete(domainId);
boolean isDomainExists = domainService.isDomainExists(domain);
if (isDomainExists == true) {
Domain domainPersisted = domainService.update(domain);
ResponseDetails updateRespDetails = new ResponseDetails(new Date(), DomainStatus.UPDATE.getCode(), DomainStatus.UPDATE.getMessage(),
"Domain Updation", null, request.getRequestURI(), "Updation Domain details", domainPersisted);
ResponseDetails deleteRespDetails = new ResponseDetails(new Date(), 804, "Domain has been deleted",
"Domain Deletion", null, request.getRequestURI(), "Deletion Domain details", domainId);
return new ResponseEntity<ResponseDetails>(updateRespDetails, HttpStatus.OK);
}
ResponseDetails responseDetails = new ResponseDetails(new Date(), 803, "Domain is Not found",
"Choose the correct updating domain name", null, request.getRequestURI(), "details", domain);
return new ResponseEntity<ResponseDetails>(responseDetails, HttpStatus.OK);
return new ResponseEntity<ResponseDetails>(deleteRespDetails, HttpStatus.OK);
}
}
@RequestMapping(value = "/domains/{domainId}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> deleteDomain(@PathVariable String domainId, HttpServletRequest request)
throws MyTeamException {
domainService.delete(domainId);
ResponseDetails deleteRespDetails = new ResponseDetails(new Date(), 804, "Domain has been deleted",
"Domain Deletion", null, request.getRequestURI(), "Deletion Domain details", domainId);
return new ResponseEntity<ResponseDetails>(deleteRespDetails, HttpStatus.OK);
@RequestMapping(value = "/domains", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getDomains(HttpServletRequest request) throws MyTeamException {
}
ResponseDetails getRespDetails = new ResponseDetails(new Date(), 804, "Retrieved the domains successfully",
"Domains list", domainService.getDomainsList(), request.getRequestURI(), "details", null);
return new ResponseEntity<ResponseDetails>(getRespDetails, HttpStatus.OK);
}
@RequestMapping(value = "/domains", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getDomains(HttpServletRequest request) throws MyTeamException {
//getting domains list under accountId which is an active.
@RequestMapping(value = "/domains/{accountId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Domain>> getDomains(@PathVariable("accountId") String accountId) throws MyTeamException {
List<Domain> domains = domainService.getDomainsUnderAccount(accountId).stream()
.filter(e -> "Active".equalsIgnoreCase(e.getStatus())).collect(Collectors.toList());
return new ResponseEntity<>(domains, HttpStatus.OK);
}
ResponseDetails getRespDetails = new ResponseDetails(new Date(), DomainStatus.GET_DOMIAINS.getCode(), DomainStatus.GET_DOMIAINS.getMessage(),
"Domains list", domainService.getDomainsList(), request.getRequestURI(), "details", null);
return new ResponseEntity<ResponseDetails>(getRespDetails, HttpStatus.OK);
}
//getting domains list under accountId which is an active.
@RequestMapping(value = "/domains/{accountId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Domain>> getDomains(@PathVariable("accountId") String accountId) throws MyTeamException {
List<Domain> domains = domainService.getDomainsUnderAccount(accountId).stream()
.filter(e -> "Active".equalsIgnoreCase(e.getStatus())).collect(Collectors.toList());
return new ResponseEntity<>(domains, HttpStatus.OK);
}
}
\ No newline at end of file
......@@ -8,6 +8,8 @@ import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import com.nisum.myteam.model.dao.EmployeeVisa;
import com.nisum.myteam.repository.EmployeeVisaRepo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
......@@ -38,11 +40,15 @@ public class EmployeeController {
@Autowired
private IEmployeeRoleService employeeRoleService;
@Autowired
private EmployeeVisaRepo employeeVisaRepo;
@RequestMapping(value = "/employees/{empId}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> createEmployee( @RequestBody Employee employeeReq,
@PathVariable(value = "empId") String loginEmpId, HttpServletRequest request) throws MyTeamException {
if (empService.isEmployeeExistsById(loginEmpId)) {
if (!empService.isEmployeeExistsById(loginEmpId)) {
Employee employeePersisted = empService.createEmployee(employeeReq, loginEmpId);
ResponseDetails createRespDetails = new ResponseDetails(new Date(), 901, "Employee has been created",
......@@ -227,6 +233,43 @@ public class EmployeeController {
return new ResponseEntity<>(employeesList, HttpStatus.OK);
}
@RequestMapping(value = "/getEmployeesHavingVisa", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getEmployeesHavingVisa(@RequestParam("visa") String passport,HttpServletRequest request)
throws MyTeamException {
List<Employee> employees = new ArrayList<>();
if (passport != null && !"passport".equalsIgnoreCase(passport)) {
List<EmployeeVisa> employeeVisas = employeeVisaRepo.findByVisaName(passport);
List<String> employeeIds = null;
if (employeeVisas != null) {
employeeIds = employeeVisas.stream().map(EmployeeVisa::getEmployeeId).collect(Collectors.toList());
}
if (employeeIds != null && !employeeIds.isEmpty()) {
List<Employee> emps = empService.getActiveEmployees();
for (Employee emp : emps) {
if (employeeIds.contains(emp.getEmployeeId())) {
employees.add(emp);
}
}
}
} else {
if (empService.getActiveEmployees() != null) {
employees = empService.getActiveEmployees().stream()
.sorted((o1, o2) -> o1.getEmployeeName().compareTo(o2.getEmployeeName()))
.collect(Collectors.toList());
}
}
ResponseDetails responseDetails = new ResponseDetails(new Date(), 602, "Resources have been retrieved successfully",
"List of Resources who has visa", employees, request.getRequestURI(), "Resource details", null);
return new ResponseEntity<ResponseDetails>(responseDetails, HttpStatus.OK);
}
}
\ No newline at end of file
......@@ -7,6 +7,7 @@ import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import org.bson.types.ObjectId;
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.NotBlank;
import org.springframework.data.annotation.Id;
......@@ -31,7 +32,7 @@ public class Employee implements Serializable {
private static final long serialVersionUID = 1L;
@Id
private String id;
private ObjectId id;
@NotBlank(message="Employee Id cannot be blank")
......
......@@ -32,7 +32,6 @@ public class Project extends AuditFields implements Serializable {
private String projectId;
private String projectName;
private String domainId;
private String domain;
private String accountId;
private String status;
private List<String> employeeIds;
......
package com.nisum.myteam.model.dao;
import com.nisum.myteam.model.AuditFields;
import lombok.*;
import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.format.annotation.DateTimeFormat.ISO;
import java.io.Serializable;
import java.util.Date;
@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ToString
@Document(collection = "resourceAllocation")
public class ResourceAllocation extends AuditFields implements Serializable {
private static final long serialVersionUID = 1L;
@Id
private ObjectId id;
private String employeeId;
private String projectId;
//private String projectName;
@DateTimeFormat(iso = ISO.DATE)
private String billableStatus;
@DateTimeFormat(iso = ISO.DATE, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSX")
private Date billingStartDate;
@DateTimeFormat(iso = ISO.DATE, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSX")
private Date billingEndDate;
// private boolean active;
private String resourceRole;
}
package com.nisum.myteam.model.vo;
import lombok.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@Getter
@Setter
@ToString
@AllArgsConstructor
@NoArgsConstructor
public class MyProjectAllocationVO {
private String projectName;
private String accountName;
private String billableStatus;
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE)
private Date billingStartDate;
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE)
private Date billingEndDate;
private String shift;
private String resourceStatus;
private List<HashMap<String, String>> deliverLeadIds;
}
package com.nisum.myteam.model.vo;
import lombok.*;
import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@Getter
@Setter
@ToString
@AllArgsConstructor
@NoArgsConstructor
public class ResourceVO {
@Id
private ObjectId id;
private String employeeId;
private String employeeName;
private String designation;
private String emailId;
private String projectId;
private String projectName;
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE)
private String billableStatus;
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSX")
private Date billingStartDate;
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSX")
private Date billingEndDate;
private String resourceStatus;
private String resourceRole;
}
package com.nisum.myteam.repository;
import com.nisum.myteam.model.dao.Resource;
import com.nisum.myteam.model.dao.ResourceAllocation;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.MongoRepository;
import java.util.List;
public interface ResourceAllocationRepo
extends MongoRepository<ResourceAllocation, String> {
List<ResourceAllocation> findByProjectId(String projectId);
List<ResourceAllocation> findByEmployeeId(String employeeId);
ResourceAllocation findById(ObjectId id);
List<ResourceAllocation> findByEmployeeIdAndProjectId(String employeeId, String projectId);
// List<Resource> findByEmployeeIdAndActive(String employeeId, boolean status);
// List<Resource> findByEmployeeIdAndProjectIdAndActive(String employeeId, String projectId, boolean status);
// List<Resource> findByAccountAndActiveAndBillableStatus(String account, boolean status, String billableStatus);
}
......@@ -24,6 +24,6 @@ public interface ResourceRepo
List<Resource> findByEmployeeIdAndProjectIdAndActive(String employeeId, String projectId, boolean status);
List<Resource> findByAccountAndActiveAndBillableStatus( String account, boolean status, String billableStatus);
Optional<List<Resource>> findByActiveAndShiftLikeOrderByEmployeeIdDesc( boolean active, String shift);
}
package com.nisum.myteam.service;
import com.nisum.myteam.model.vo.EmployeeDashboardVO;
import java.util.List;
public interface IDashboardService {
public List<EmployeeDashboardVO> getEmployeesDashBoard();
}
package com.nisum.myteam.service;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
import org.springframework.stereotype.Service;
import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.model.dao.Account;
import com.nisum.myteam.model.dao.Employee;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
@Service
public interface IEmployeeService {
boolean isEmployeeExistsById(String employeeId);
boolean isEmployeeExistsById(String employeeId);
Employee createEmployee(Employee employeeRoles, String empId) throws MyTeamException;
Employee updateEmployee(Employee employeeRoles, String empId);
Employee createEmployee(Employee employeeRoles, String empId) throws MyTeamException;
Employee deleteEmployee(String empId);
Employee updateEmployee(Employee employeeRoles, String empId);
Employee updateProfile(Employee employeeRoles) throws MyTeamException;
Employee deleteEmployee(String empId);
Employee getEmployeeById(String empId);
Employee updateProfile(Employee employeeRoles) throws MyTeamException;
Employee getEmployeeByEmaillId(String emailId);
Employee getEmployeeById(String empId);
List<Employee> getManagers() throws MyTeamException;
Employee getEmployeeByEmaillId(String emailId);
List<Employee> getActiveEmployees() throws MyTeamException;
List<Employee> getManagers() throws MyTeamException;
List<Employee> getEmployeesByStatus(String status);
List<Employee> getActiveEmployees() throws MyTeamException;
List<Account> getAccounts() throws MyTeamException;
List<Employee> getEmployeesByStatus(String status);
Employee getEmployeeRoleDataForSearchCriteria(String searchId, String searchAttribute);
List<Account> getAccounts() throws MyTeamException;
List<String> getEmployeeDetailsForAutocomplete();
Employee getEmployeeRoleDataForSearchCriteria(String searchId, String searchAttribute);
List<HashMap<String, String>> getDeliveryLeads(String domainId);
List<String> getEmployeeDetailsForAutocomplete();
List<Employee> getEmployeesByFunctionalGrp(String functionalGrp);
List<HashMap<String, String>> getDeliveryLeads(String domainId);
boolean verifyEmployeeRole(String empId, String roleName);
List<Employee> getEmployeesByFunctionalGrp(String functionalGrp);
List<Employee> getEmployeesFromList(Set<String> empIdsSet);
boolean verifyEmployeeRole(String empId, String roleName);
List<HashMap<String, String>> getDeliveryManagerMap(List deliveryManagerIdsList);
List<Employee> getEmployeesFromList(Set<String> empIdsSet);
List<HashMap<String, String>> getDeliveryManagerMap(List deliveryManagerIdsList);
public List<Employee> getAllEmployees();
public List<Employee> getAllEmployees();
}
package com.nisum.myteam.service;
public interface IEmployeeVisaService {
}
......@@ -16,10 +16,22 @@ public interface IProjectService {
void deleteProject(String projectId);
List<Project> getProjectsUnderDomain(String domainId);
public boolean isProjectExistsByName(String projectName);
public boolean isProjectExistsById(String projectId);
public Project getProjectByProjectId(String projectId);
public long getProjectsCount();
public List<Project> getAllProjects();
List<HashMap<Object, Object>> getProjects() throws MyTeamException;
public List<Project> getOnlyActiveProjects();
List<Project> getProjectsUnderDomain(String domainId);
List<Project> getProjectsUnderDeliveryLead(String managerId) throws MyTeamException;
public Resource addNewBeanchAllocation(Employee employee, String loginEmpId);
......@@ -28,34 +40,27 @@ public interface IProjectService {
String generatePdfReport(long id, String fromDate, String toDate) throws MyTeamException;
List<Resource> getResourcesUnderProject(String empId);
List<Employee> getUnAssignedEmployees();
public List<EmployeeDashboardVO> getEmployeesDashBoard();
public HashMap<String,Object> addProjectTeamMateWithCheck(Resource projectTeamMate, String loginEmpId) throws MyTeamException;
public List<HashMap<Object, Object>> getProjectsForEmployee(String empId);
//public List<HashMap<Object, Object>> getProjectsForEmployee(String empId);
public Set<String> accountsAssignedToDl(String empId);
public List<HashMap<Object, Object>> deliveryLeadProjects(String empId) throws MyTeamException;
public List<Project> getAllProjects();
public boolean isProjectExists(String projectName);
public boolean isProjectExistsById(String projectId);
public long getProjectsCount();
public Account getProjectAccount(String accountId);
public Account updateProjSeqinAccount(Account account) throws MyTeamException;
public List<HashMap<Object, Object>> getRoleBasedProjects(String empId) throws MyTeamException;
public List<HashMap<Object, Object>> getProjectsInsteadOfRole() throws MyTeamException;
public List<Project> getActiveProjects() throws MyTeamException;
public List<Project> getProjectsForDeliveryLead(String deliveryLeadId);
List<Resource> getResourcesUnderProject(String empId);
}
package com.nisum.myteam.service;
import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.model.dao.Employee;
import com.nisum.myteam.model.dao.Resource;
import com.nisum.myteam.model.dao.ResourceAllocation;
import com.nisum.myteam.model.vo.MyProjectAllocationVO;
import com.nisum.myteam.model.vo.ResourceVO;
import org.bson.types.ObjectId;
import java.util.HashMap;
import java.util.List;
public interface IResourceAllocationService {
ResourceAllocation addResourceAllocation(ResourceAllocation resourceAllocation, String loginEmpId) throws MyTeamException;
void updateResource(ResourceAllocation resourceAllocation, String loginEmpId) throws MyTeamException;
void deleteResource(ResourceAllocation resource, String loginEmpId);
List<ResourceAllocation> getAllResourcesForAllActiveProjects();
// Resource save(Resource resource);
// void addResources(Employee employee, String loginEmpId);
// void inactivateResource(Employee employeeReq, Employee employeeUpdated, String loginEmpId);
List<ResourceAllocation> getResourcesSortByBillingStartDate(String employeeId);
// List<Resource> getAllResourcesForProject(String projectId, String status);
// List<Resource> getResourcesForEmployee(String empId);
// List<Resource> getAllResourcesForProject(String projectId);
List<ResourceAllocation> getActiveResources(String empId);
// List<Resource> getResourcesForShift(String shift);
public List<ResourceVO> getResourcesForProject(String projectId, String statusFlag);
public List<ResourceAllocation> getResourcesUnderDeliveryLead(String empId);
public List<ResourceAllocation> getBillingsForEmployee(String empId);
public List<ResourceAllocation> getBillingsForProject(String empId, String projectId);
public List<MyProjectAllocationVO> getWorkedProjectsForResource(String empId);
public List<Employee> getUnAssignedEmployees();
public List<ResourceAllocation> getAllResources();
}
package com.nisum.myteam.service;
import java.util.List;
import org.bson.types.ObjectId;
import org.springframework.stereotype.Service;
import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.model.dao.Employee;
import com.nisum.myteam.model.dao.Resource;
import org.bson.types.ObjectId;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
@Service
public interface IResourceService {
Resource addResource(Resource projectTeamMate, String loginEmpId) throws MyTeamException;
Resource addResource(Resource projectTeamMate, String loginEmpId) throws MyTeamException;
String updateResource(Resource projectTeamMate, String loginEmpId) throws MyTeamException;
Resource deleteResource(String empId, String projectId, ObjectId id, String loginEmpId);
Resource save(Resource resource);
void addResources(Employee employee, String loginEmpId);
String updateResource(Resource projectTeamMate, String loginEmpId) throws MyTeamException;
void inactivateResource(Employee employeeReq, Employee employeeUpdated, String loginEmpId);
Resource deleteResource(String empId, String projectId, ObjectId id, String loginEmpId);
List<Resource> findByAccountAndActiveAndBillableStatus(String account, boolean status, String billableStatus);
Resource save(Resource resource);
List<Resource> getResourcesSortByStartDate(String employeeId);
void addResources(Employee employee, String loginEmpId);
List<Resource> getResourcesForProject(String projectId, String status);
void inactivateResource(Employee employeeReq, Employee employeeUpdated, String loginEmpId);
List<Resource> getResourcesForEmployee(String empId);
List<Resource> findByAccountAndActiveAndBillableStatus(String account, boolean status, String billableStatus);
List<Resource> getResourcesForProject(String projectId);
List<Resource> getResourcesSortByStartDate(String employeeId);
List<Resource> getActiveResources(String empId);
List<Resource> getResourcesForProject(String projectId, String status);
List<Resource> getResourcesForActiveProjects();
List<Resource> getResourcesForEmployee(String empId);
List<Resource> getResourcesForShift(String shift);
List<Resource> getResourcesForProject(String projectId);
public List<Resource> getResourcesUnderDeliveryLead(String empId);
List<Resource> getActiveResources(String empId);
public HashMap<String, Object> verifyResourceAssignedToAnyProject(Resource projectTeamMate, String loginEmpId) throws MyTeamException;
List<Resource> getResourcesForActiveProjects();
List<Resource> getResourcesForShift(String shift);
public List<Resource> getResourcesUnderDeliveryLead(String empId);
}
package com.nisum.myteam.service.impl;
import com.nisum.myteam.model.dao.Employee;
import com.nisum.myteam.model.dao.Project;
import com.nisum.myteam.model.dao.ResourceAllocation;
import com.nisum.myteam.model.vo.EmployeeDashboardVO;
import com.nisum.myteam.service.IDashboardService;
import com.nisum.myteam.service.IEmployeeService;
import com.nisum.myteam.service.IProjectService;
import com.nisum.myteam.service.IResourceAllocationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
@Service
@Slf4j
public class DashboardService implements IDashboardService {
@Autowired
private IEmployeeService employeeService;
@Autowired
private IResourceAllocationService resourceService;
@Autowired
private IProjectService projectService;
@Override
public List<EmployeeDashboardVO> getEmployeesDashBoard() {
//List<Employee> allEmployees = employeeRepo.findAll();
List<Employee> allEmployees = employeeService.getAllEmployees();
List<EmployeeDashboardVO> employeeDashboard = new ArrayList<>();
Map<String, Object> teamMatesMap = new HashMap();
Map<String, Object> teamMatesStatusMap = new HashMap();
// Find all active employees
List<ResourceAllocation> resources = resourceService.getAllResources();
for (ResourceAllocation resource : resources) {
//if (resource.isActive()) {
if (resource.getBillingEndDate().compareTo(new Date())>0) {
Project project = projectService.getProjectByProjectId(resource.getProjectId());
if (project != null && project.getStatus() != null
&& !"Completed".equalsIgnoreCase(project.getStatus())) {
Object projectTeamMate = teamMatesMap
.get(resource.getEmployeeId());
if (projectTeamMate == null) {
List listOfObjects = new ArrayList<>();
listOfObjects.add(resource);
// A person can have multiple active projects with billability
teamMatesMap.put(resource.getEmployeeId(), listOfObjects);
} else {
List existingRecordsInMap = (List) teamMatesMap
.get(resource.getEmployeeId());
existingRecordsInMap.add(resource);
teamMatesMap.put(resource.getEmployeeId(),
existingRecordsInMap);
}
}
}
}
for (Employee emp : allEmployees) {
if (teamMatesMap.containsKey(emp.getEmployeeId())) {
Object value = teamMatesMap.get(emp.getEmployeeId());
if (value instanceof List) {
List listOfTeamMates = (List) value;
String billableStatus = "NA";
for (Object obj : listOfTeamMates) {
ResourceAllocation projectTeamMate = (ResourceAllocation) obj;
String status = projectTeamMate.getBillableStatus();
if (status == null) {
status = "NA";
}
EmployeeDashboardVO empVo = new EmployeeDashboardVO();
BeanUtils.copyProperties(emp, empVo);
BeanUtils.copyProperties(projectTeamMate, empVo,
"employeeId", "employeeName", "emailId", "role",
"designation", "mobileNumber");
employeeDashboard.add(empVo);
}
}
} else {
EmployeeDashboardVO empVo = new EmployeeDashboardVO();
BeanUtils.copyProperties(emp, empVo);
empVo.setBillableStatus("UA");
empVo.setProjectAssigned(false);
employeeDashboard.add(empVo);
}
}
return employeeDashboard;
}
}
......@@ -158,6 +158,23 @@ public class DomainService implements IDomainService {
return domainVOS;
}
public Domain getDomainById(String domainId) {
Domain domain = null;
if (domainId != null && domainId.length() > 0) {
domain = domainRepo.findByDomainId(domainId);
}
return domain;
}
@Override
public List<Domain> getDomainsUnderAccount(String accountId) throws MyTeamException {
List<Domain> domains = domainRepo.findByAccountId(accountId);
return domains;
}
@Override
public WriteResult delete(String domainId) throws MyTeamException {
List<String> domEmpIds = new ArrayList<String>();
......@@ -243,22 +260,7 @@ public class DomainService implements IDomainService {
return accIdsSet;
}
public Domain getDomainById(String domainId) {
Domain domain = null;
if (domainId != null && domainId.length() > 0) {
domain = domainRepo.findByDomainId(domainId);
}
return domain;
}
@Override
public List<Domain> getDomainsUnderAccount(String accountId) throws MyTeamException {
List<Domain> domains = domainRepo.findByAccountId(accountId);
return domains;
}
}
\ No newline at end of file
......@@ -32,13 +32,10 @@ public class EmployeeEffortsService implements IEmployeeEffortsService {
@Override
public List<EmployeeEfforts> getEmployeeEffortsReport(String fromDate, String toDate)
throws MyTeamException, SQLException {
System.out.println("######################################");
String query = null;
query = MyTeamUtils.EMPLOYEE_EFFORTS_QUERY + "'" + fromDate.replace("-", "/") + "'"
+ MyTeamUtils.EMPLOYEE_EFFORTS_QUERY1 + "'" + toDate.replace("-", "/") + "'"
+ MyTeamUtils.EMPLOYEE_EFFORTS_QUERY2;
System.out.println(query);
+ MyTeamUtils.EMPLOYEE_EFFORTS_QUERY2;
List<EmployeeEfforts> listOfEmpEffortsData = getEmployeeEfforts(query);
return listOfEmpEffortsData;
......
......@@ -8,7 +8,9 @@ import com.nisum.myteam.model.dao.Resource;
import com.nisum.myteam.repository.EmployeeRepo;
import com.nisum.myteam.service.*;
import com.nisum.myteam.utils.MyTeamUtils;
import com.nisum.myteam.utils.constants.ApplicationRole;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.core.FindAndModifyOptions;
......@@ -297,7 +299,7 @@ public class EmployeeService implements IEmployeeService {
}
@Override
public boolean verifyEmployeeRole(String empId, String roleName) {
public boolean verifyEmployeeRole(String empId, String roleIdReq) {
boolean flag = false;
log.info("The employeeId::" + empId);
......@@ -305,23 +307,29 @@ public class EmployeeService implements IEmployeeService {
Employee employee = getEmployeeById(empId);
log.info("Employee::::in EmployeeService::" + employee);
String role = employee.getRole();
log.info("The employee role::" + role);
if (null != role && "" != role && !"Admin".equalsIgnoreCase(role)) {
String roleName = employee.getRole();
log.info("The employee role::" + roleName);
if (StringUtils.isNotBlank(roleName) && !ApplicationRole.ADMIN.getRoleName().equalsIgnoreCase(roleName)) {
if ("FM".equalsIgnoreCase(role) || "Delivery Lead".equalsIgnoreCase(role)) {
if (ApplicationRole.FUNCTIONAL_MANAGER.getRoleName().equalsIgnoreCase(roleName) ||
ApplicationRole.DELIVERY_LEAD.getRoleName().equalsIgnoreCase(roleName)) {
flag = true;
log.info("in if block");
} else {
log.info("in else block");
Set<String> roleSet = employeeRoleService.empRolesMapInfoByEmpId(empId);
if (null != roleSet && !roleSet.isEmpty() && MyTeamUtils.INT_ZERO < roleSet.size()) {
if (roleSet.contains(roleName)) {
if (roleSet.contains(roleIdReq)) {
flag = true;
}
}
}
}
log.info("before return flag::"+flag);
return flag;
}
......
package com.nisum.myteam.service.impl;
import com.nisum.myteam.service.IEmployeeVisaService;
import org.springframework.stereotype.Service;
@Service
public class EmployeeVisaService implements IEmployeeVisaService {
//
// public getEmployeeVisaByName(String passport)
//
// employeeVisaRepo.findByVisaName(passport);
}
package com.nisum.myteam.service.impl;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
......@@ -66,7 +61,7 @@ public class ResourceService implements IResourceService {
private ProjectService projectService;
@Autowired
private EmployeeRepo employeeRoleRepo;
private EmployeeRepo employeeRepo;
public Resource save(Resource resource) {
return resourceRepo.save(resource);
......@@ -81,7 +76,7 @@ public class ResourceService implements IResourceService {
resourceReq.setAuditFields(loginEmpId, MyTeamUtils.CREATE);
Resource resourcePersisted = resourceRepo.save(resourceReq);
// Get Active billings for Nisum Bench Project.
List<Billing> listBD = billingService.getActiveBillings(resourcePersisted.getEmployeeId(), "Nisum0000");
......@@ -311,11 +306,11 @@ public class ResourceService implements IResourceService {
empShiftService.updateEmployeeShift(existingResource, loginEmpId);
existingResource.setShift(resourceReq.getShift());
Employee employeeDB = employeeRoleRepo.findByEmployeeId(resourceReq.getEmployeeId());
Employee employeeDB = employeeRepo.findByEmployeeId(resourceReq.getEmployeeId());
employeeDB.setShift(resourceReq.getShift());
employeeDB.setModifiedBy(loginEmpId);
employeeDB.setLastModifiedOn(new Date());
employeeRoleRepo.save(employeeDB);
employeeRepo.save(employeeDB);
}
existingResource.setAuditFields(loginEmpId, MyTeamUtils.UPDATE);// Setting
// audit
......@@ -340,15 +335,6 @@ public class ResourceService implements IResourceService {
return response;
}
private String validateAgainstDOJ(Resource resource) {
String response = null;
Date empDoj = employeeRoleRepo.findByEmployeeId(resource.getEmployeeId()).getDateOfJoining();
if (resource.getNewBillingStartDate().compareTo(empDoj) < 0) {
response = "Resource Start Date (" + resource.getNewBillingStartDate() + " ) in "
+ resource.getProjectName() + " project should not be before Date of Joining ( " + empDoj + ").";
}
return response;
}
@Override
public Resource deleteResource(String empId, String projectId, ObjectId id, String loginEmpId) {
......@@ -600,23 +586,23 @@ public class ResourceService implements IResourceService {
return resourcesList;
}
@Override
public List<Resource> getResourcesUnderDeliveryLead(String deliveryLeadId) {
List<String> projectIdsList = new ArrayList<>();
List<Resource> resourcesList = new ArrayList<>();
List<Project> projectsList = projectRepo.findByDeliveryLeadIds(deliveryLeadId);
for (Project project : projectsList)
projectIdsList.add(project.getProjectId());
Query query = new Query(Criteria.where("projectId").in(projectIdsList));
List<Resource> resourcesListPersisted = mongoTemplate.find(query, Resource.class);
for (Resource resource : resourcesListPersisted) {
if (!resource.getEmployeeId().equals(deliveryLeadId))
resourcesList.add(resource);
......@@ -624,4 +610,77 @@ public class ResourceService implements IResourceService {
return resourcesList;
}
@Override
public HashMap<String,Object> verifyResourceAssignedToAnyProject(Resource resourceReq, String loginEmpId) throws MyTeamException {
boolean flag = false;
String projectName = null;
String fromDate = null;
String toDate = null;
String result = null;
HashMap<String, Object> responseMap = new HashMap<>();
Resource resourcePersisted = null;
List<Resource> resourceList = resourceRepo.findByEmployeeId(resourceReq.getEmployeeId()).stream()
.filter(e -> !("Nisum0000".equalsIgnoreCase(e.getProjectId())))
.sorted(Comparator.comparing(Resource::getEndDate).reversed())
.collect(Collectors.toList());
// Checking, if resource has existing project assignment.
for (Resource resource : resourceList) {
log.info("Resource::" + resource);
if (resource.getEndDate() != null && (resource.getEndDate().compareTo(new Date()) > 0)) {
flag = true;
projectName = resource.getProjectName();
fromDate = resource.getStartDate().toString();
toDate = resource.getEndDate().toString();
break;
}
}
if (flag) {// If yes, error thrown to user.
result = "Resource " + resourceReq.getEmployeeId() + " already Assigned to the " + projectName
+ " Project" + " from " + fromDate + "to " + toDate;
} else {// If no, validating new project assignment start date against previous project end date.
result = validateNewProjectAssignmentStartDate(resourceList, resourceReq);
if (result == null) {
resourcePersisted = this.addResource(resourceReq, loginEmpId);
result = "TeamMate added successfuly";
}
}
responseMap.put("message", result);
responseMap.put("resourceObj", resourcePersisted);
return responseMap;
}
private String validateNewProjectAssignmentStartDate(List<Resource> resourceList, Resource resourceReq) {
String response = null;
if (resourceList != null && resourceList.size() > 0) {
Resource resource = resourceList.get(0);
if (resourceReq.getNewBillingStartDate().compareTo(resource.getEndDate()) <= 0) {
response = "Resource Start Date (" + resourceReq.getNewBillingStartDate() +" ) in " + resourceReq.getProjectName()
+ " project should be after " + resource.getProjectName() + " project End Date ( " + resource.getEndDate() + ").";
}
} else {
response = validateAgainstDOJ(resourceReq);
}
return response;
}
private String validateAgainstDOJ(Resource resource) {
String response = null;
Date empDoj = employeeRepo.findByEmployeeId(resource.getEmployeeId()).getDateOfJoining();
if (resource.getNewBillingStartDate().compareTo(empDoj) < 0) {
response = "Resource Start Date (" + resource.getNewBillingStartDate() + " ) in "
+ resource.getProjectName() + " project should not be before Date of Joining ( " + empDoj + ").";
}
return response;
}
}
......@@ -2,8 +2,11 @@ package com.nisum.myteam.statuscodes;
public enum DomainStatus {
CREATE(600, "Account has been created"),
UPDATE(601, "Account has been updated");
CREATE(610, "Domain has been created"),
UPDATE(611, "Domain has been updated"),
ALREADY_EXISTED(612,"Domain is already existed"),
IS_NOT_FOUND(613,"Domain is Not found"),
GET_DOMIAINS(614,"Retrieved the domains successfully");
private int code;
private String message;
......
package com.nisum.myteam.statuscodes;
public class ProjectStatus {
public enum ProjectStatus {
CREATE(700, "Project has been created"),
UPDATE(701, "Project has been updated"),
DELETE(702, "Project has been deleted successfully"),
ALREADY_EXISTED(703, "Project is already existed"),
PROJECTID_IS_NOT_EXISTS(704,"Project Id is not existed"),
PROJECT_NAME_IS_NOT_EXISTS(705,"Project is not existed"),
IS_NOT_FOUND(706, "Domain is Not found"),
GET_DOMIAINS(707, "Retrieved the domains successfully");
private int code;
private String message;
private ProjectStatus(int code, String message) {
this.code = code;
this.message = message;
}
public int getCode() {
return this.code;
}
public String getMessage() {
return this.message;
}
}
package com.nisum.myteam.statuscodes;
public class ResourceStatus {
public enum ResourceStatus {
ACTIVE("Active"), IN_ACTIVE("InActive");
private String status;
private ResourceStatus(String status) {
this.status = status;
}
public String getStatus() {
return this.status;
}
}
package com.nisum.myteam.utils;
import java.util.Calendar;
import java.util.Date;
public class MyTeamDateUtils {
public static Date getYesterdayDate() {
final Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, -1);
return cal.getTime();
}
}
......@@ -166,11 +166,18 @@ public class MyTeamUtils {
public final static String UPDATE ="UPDATE";
public static final String SHIFT1="Shift 1(9:00 AM - 6:00 PM)";
public static final String SHIFT2="Shift-2(2:00 PM - 11:00 PM)";
public static final String SHIFT3="Shift 3(10:00 PM - 6:00 AM)";
public static final String SHIFT4="Shift 4(7:30 AM - 3:30 PM)";
public static final String SHIFT5="Shift 5(11:30 AM - 7:30 PM)";
public final static String PROJECT_START_DATE="ProjectStartDate";
public final static String PROJECT_END_DATE="ProjectEndDate";
public final static String BILLING_START_DATE="billingStartDate";
public final static String BILLING_END_DATE="billingEndDate";
}
package com.nisum.myteam.utils.constants;
public enum ApplicationRole {
FUNCTIONAL_MANAGER("", "FM"), ADMIN("", "Admin"), DIRECTOR("", "Director"), DELIVERY_MANAGER("DM", "Delivery Manager"), DELIVERY_LEAD("DL", "Delivery Lead"), LEAD("L", "Lead"),
EMPLOYEE("", "Employee"), HR("", "Hr");
private String roleId;
private String roleName;
private ApplicationRole(String roleId, String roleName) {
this.roleId = roleId;
this.roleName = roleName;
}
public String getRoleId() {
return this.roleId;
}
public String getRoleName() {
return this.roleName;
}
}
package com.nisum.myteam.utils.constants;
public enum RoleEnum {
ADMIN("admin"),DIRECTOR("Director"),DELIVERY_MANAGER("Delivery Manager"), DELIVERY_LEAD("Delivery Lead"), LEAD("Lead"),
EMPLOYEE("Employee"),HR("hr");
private String role;
private RoleEnum(String role) {
this.role = role;
}
public String getRole() {
return this.role;
}
}
......@@ -142,7 +142,7 @@ myApp.controller("dashboardController", function($scope, $http, myFactory,export
$scope.getEmployeesDashBoardData = function(){
$http({
method : "GET",
url : appConfig.appUri + "getEmployeesDashBoard"
url : appConfig.appUri + "resources/getEmployeesDashBoard"
}).then(function mySuccess(response) {
//alert("response"+response);
// alert("response"+response.data);
......@@ -203,7 +203,7 @@ myApp.controller("dashboardController", function($scope, $http, myFactory,export
pageSize:10,
columnDefs : [
{field : 'projectName',displayName: 'Project', enableColumnMenu: true, enableSorting: true,minWidth : 100,width: 150},
{field : 'account',displayName: 'Account', enableColumnMenu: false, enableSorting: false,minWidth : 100,width: 150},
{field : 'accountName',displayName: 'Account', enableColumnMenu: false, enableSorting: false,minWidth : 100,width: 150},
{field : 'managerName',displayName: 'Manager Name', enableColumnMenu: false, enableSorting: false,minWidth : 100,width: 150},
{field : 'billableStatus',displayName: 'Billability', enableColumnMenu: false, enableSorting: false,minWidth : 100,width: 150},
{field : 'projectStartDate',displayName: 'Start Date', enableColumnMenu: false, enableSorting: false, cellFilter: 'date:"dd-MMM-yyyy"',minWidth : 100,width: 150},
......@@ -273,7 +273,7 @@ myApp.controller("dashboardController", function($scope, $http, myFactory,export
};
$http({
method : "GET",
url : appConfig.appUri + "billing?employeeId="+$scope.profile.employeeId
url : appConfig.appUri + "resources/billing?employeeId="+$scope.profile.employeeId
}).then(function mySuccess(response) {
//alert("response"+response);
// alert("response"+response.data);
......@@ -283,7 +283,7 @@ myApp.controller("dashboardController", function($scope, $http, myFactory,export
});
$http({
method : "GET",
url : appConfig.appUri + "getMyProjectAllocations?employeeId="+$scope.profile.employeeId
url : appConfig.appUri + "resources/getMyProjectAllocations?employeeId="+$scope.profile.employeeId
}).then(function mySuccess(response) {
//alert("response"+response);
// alert("response"+response.data);
......
......@@ -623,7 +623,8 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
{ field: 'designation', displayName: 'Designation ', enableColumnMenu: false, enableSorting: false,enableFiltering:false },
// { field: 'active', displayName: 'Status ', enableColumnMenu: false, enableSorting: false, cellTemplate: getCellActiveTemplate },
{ field: 'billableStatus', displayName: 'Billability ', enableColumnMenu: false, enableSorting: false ,enableFiltering:false},
{ field: 'endDate', displayName: 'Billability End Date ', enableColumnMenu: false, enableSorting: false , cellFilter:'date:"dd-MMM-yyyy"',enableFiltering:false},
{ field: 'billingStartDate', displayName: 'Start Date ', enableColumnMenu: false, enableSorting: false , cellFilter:'date:"dd-MMM-yyyy"',enableFiltering:false},
{ field: 'billingEndDate', displayName: 'End Date ', enableColumnMenu: false, enableSorting: false , cellFilter:'date:"dd-MMM-yyyy"',enableFiltering:false},
{name : 'Actions', displayName: 'Actions',cellTemplate: getCellTemplate1, enableColumnMenu: false, enableSorting: false, width:100,enableFiltering: false}
]
};
......@@ -1183,9 +1184,6 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
}else if($scope.employeeRole == undefined){
$scope.alertMsg = "Please select a employee role";
angular.element(document.getElementById('empRole')).focus();
}else if($scope.employeeShift == undefined){
$scope.alertMsg = "Please select a employee shift";
angular.element(document.getElementById('empShift')).focus();
}
else if($scope.empBillableStatus == undefined){
$scope.alertMsg = "Please select a billable status";
......@@ -1217,7 +1215,7 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
else {
$scope.id = $scope.id ? $scope.id : $scope.objectId;
$scope.alertMsg = "";
var record = {"id":$scope.id,"employeeId":employeeModel.employeeId, "employeeName":employeeModel.employeeName, "emailId": employeeModel.emailId, "designation":employeeModel.designation,"projectId":project,"projectName":projectName,"managerId":managerId,"managerName":managerName,"mobileNumber":employeeModel.mobileNumber,"active":true,"billableStatus":$scope.empBillableStatus,"startDate":$scope.startDate,"endDate":$scope.endDate,"account":account,"role":$scope.employeeRole,"newBillingStartDate":newBillingStartDate,"accountId":$scope.accountId,"domainId":$scope.domainId,"shift":$scope.employeeShift,"projectStartDate":$scope.startDate,"projectEndDate":$scope.endDate};
var record = {"id":$scope.id,"employeeId":employeeModel.employeeId,"projectId":project,"billableStatus":$scope.empBillableStatus,"billingEndDate":$scope.endDate,"resourceRole":$scope.employeeRole,"billingStartDate":newBillingStartDate};
if(action == "Add"){
addRecord(record,action);
$scope.myForm.$setPristine();
......@@ -1504,7 +1502,7 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
function addRecord(record, action){
var urlRequest = "";
var loginEmpId = myFactory.getEmpId();
urlRequest = appConfig.appUri+ "addEmployeeToTeamWithCheck?loginEmpId="+loginEmpId;
urlRequest = appConfig.appUri+ "resources?loginEmpId="+loginEmpId;
var req = {
method : 'POST',
url : urlRequest,
......
......@@ -100,10 +100,10 @@
</md-select>
</td>
</tr>
<tr>
<!-- <tr>
<td class="Employee">Employee Name : </td>
<td>{{employeeModel.employeeName}}</td>
</tr>
</tr> -->
<tr>
<td class="Employee"> Employee Id :</td>
<td>{{employeeModel.employeeId}}</td>
......@@ -126,7 +126,7 @@
</md-select>
</td>
</tr>
<tr>
<!-- <tr>
<td class="Employee">Shift</td>
<td>
<md-select ng-model="employeeShift" md-selected-text="getSelectedEmpShift()" id="empShift">
......@@ -135,7 +135,7 @@
</md-optgroup>
</md-select>
</td>
</tr>
</tr> -->
<tr>
<td class="Employee">Billability Status</td>
<td>
......@@ -153,16 +153,16 @@
md-max-date="maxDate " onkeydown="return false " ng-change="currentBillabilityDateChange()" name="newBillingStartDate"></md-datepicker>
</td>
</tr>
<tr>
<!-- <tr>
<td class="Employee">Start Date</td>
<td>
<md-datepicker ng-model="startDate" ng-disabled = "true" md-placeholder="Please select Date" id="startDate " md-min-date="minDate " md-max-date="maxDate "
onkeydown="return false " name="startDate"></md-datepicker>
</td>
</tr>
</tr> -->
<tr>
<td class="Employee">End Date</td>
<tr ng-show="empBillableStatus">
<td class="Employee">{{empBillableStatus}} End Date</td>
<td>
<md-datepicker ng-model="endDate" md-placeholder="Please select Date" id="endDate " md-min-date="minDate " md-max-date="maxDate "
onkeydown="return false " name="endDate"></md-datepicker>
......
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