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; ...@@ -16,15 +16,15 @@ import org.springframework.web.filter.CorsFilter;
@SpringBootApplication @SpringBootApplication
@EnableAutoConfiguration @EnableAutoConfiguration
@EnableMongoRepositories(basePackages = { "com.nisum.myteam.repository" }) @EnableMongoRepositories(basePackages = { "com.nisum.myteam.repository" })
public class MyTimeApplication extends SpringBootServletInitializer { public class MyTeamApplication extends SpringBootServletInitializer {
@Override @Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(MyTimeApplication.class); return application.sources(MyTeamApplication.class);
} }
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(MyTimeApplication.class, args); SpringApplication.run(MyTeamApplication.class, args);
} }
@Bean @Bean
......
package com.nisum.myteam.controller; //package com.nisum.myteam.controller;
//
import java.util.List; //import java.util.List;
//import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.http.HttpStatus;
import org.springframework.http.HttpStatus; //import org.springframework.http.MediaType;
import org.springframework.http.MediaType; //import org.springframework.http.ResponseEntity;
import org.springframework.http.ResponseEntity; //import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PathVariable; //import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestBody; //import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMapping; //import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestMethod; //import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestParam; //import org.springframework.web.bind.annotation.RestController;
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.exception.handler.MyTeamException; //import com.nisum.myteam.service.IBillingService;
import com.nisum.myteam.model.dao.Billing; //import lombok.extern.slf4j.Slf4j;
import com.nisum.myteam.service.IBillingService; //
//@RestController
import lombok.extern.slf4j.Slf4j; //@Slf4j
//public class BillingController {
@RestController //
@Slf4j // @Autowired
public class BillingController { // private IBillingService billingService;
//
@Autowired // // @RequestMapping(value = "/addEmployeeBilling"
private IBillingService billingService; // @RequestMapping(value = "/billing", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
// public ResponseEntity<Billing> addEmployeeBilling(@RequestBody Billing billing,
// @RequestMapping(value = "/addEmployeeBilling" // @RequestParam(value = "loginEmpId") String loginEmpId) throws MyTeamException {
@RequestMapping(value = "/billing", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) // Billing billingList = billingService.addBilling(billing, loginEmpId);
public ResponseEntity<Billing> addEmployeeBilling(@RequestBody Billing billing, //
@RequestParam(value = "loginEmpId") String loginEmpId) throws MyTeamException { // return new ResponseEntity<>(billingList, HttpStatus.OK);
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,
// @RequestMapping(value = "/updateEmployeeBilling", // @RequestParam(value = "loginEmpId") String loginEmpId) throws MyTeamException {
@RequestMapping(value = "/billing", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) // Billing billingList = billingService.updateBilling(billing, loginEmpId);
public ResponseEntity<Billing> updateEmployeeBilling(@RequestBody Billing billing, // return new ResponseEntity<>(billingList, HttpStatus.OK);
@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 {
// @RequestMapping(value = "/deleteEmployeeBilling" // billingService.deleteBilling(billing);
@RequestMapping(value = "/billing", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) // return new ResponseEntity<>(null, HttpStatus.OK);
public ResponseEntity<Billing> deleteEmployeeBilling(@RequestBody Billing billing) throws MyTeamException { // }
billingService.deleteBilling(billing); //
return new ResponseEntity<>(null, HttpStatus.OK); //
} //
// // @RequestMapping(value = "/getEmployeeBillingDetailsAll"
// @RequestMapping(value = "/getEmployeeBillingDetailsAll" // @RequestMapping(value = "/billing", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/billing", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) // public ResponseEntity<List<Billing>> getAllBillingsForEmployee(@RequestParam("employeeId") String employeeId)
public ResponseEntity<List<Billing>> getAllBillingsForEmployee(@RequestParam("employeeId") String employeeId) // throws MyTeamException {
throws MyTeamException { // List<Billing> billingList = billingService.getBillingsForEmployee(employeeId);
List<Billing> billingList = billingService.getBillingsForEmployee(employeeId); // return new ResponseEntity<>(billingList, HttpStatus.OK);
return new ResponseEntity<>(billingList, HttpStatus.OK); // }
} //
// // @RequestMapping(value = "/getEmployeeBillingDetails"
// @RequestMapping(value = "/getEmployeeBillingDetails" // @RequestMapping(value = "/billing/project/{projectId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/billing/project/{projectId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) // public ResponseEntity<List<Billing>> getBillingsForProject(@PathVariable("projectId") String projectId,
public ResponseEntity<List<Billing>> getBillingsForProject(@PathVariable("projectId") String projectId, // @RequestParam("employeeId") String employeeId) throws MyTeamException {
@RequestParam("employeeId") String employeeId) throws MyTeamException { // List<Billing> billingList = billingService.getBillingsForProject(employeeId, projectId);
List<Billing> billingList = billingService.getBillingsForProject(employeeId, projectId); // return new ResponseEntity<>(billingList, HttpStatus.OK);
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; 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.MyTeamException;
import com.nisum.myteam.exception.handler.ResponseDetails; import com.nisum.myteam.exception.handler.ResponseDetails;
import com.nisum.myteam.model.dao.Domain; import com.nisum.myteam.model.dao.Domain;
import com.nisum.myteam.service.IDomainService; import com.nisum.myteam.service.IDomainService;
import com.nisum.myteam.statuscodes.DomainStatus;
import lombok.extern.slf4j.Slf4j; 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 * @author Vijay
*
*/ */
@RestController @RestController
@Slf4j @Slf4j
...@@ -45,13 +36,13 @@ public class DomainController { ...@@ -45,13 +36,13 @@ public class DomainController {
if (!domainService.isDomainExists(domain)) { if (!domainService.isDomainExists(domain)) {
Domain domainPeristed = domainService.create(domain); Domain domainPeristed = domainService.create(domain);
ResponseDetails createRespDetails = new ResponseDetails(new Date(), 801, "Domain has been created", ResponseDetails createRespDetails = new ResponseDetails(new Date(), DomainStatus.CREATE.getCode(), DomainStatus.CREATE.getMessage(),
"Domain Creation", null, "", "details", domainPeristed); "Domain Creation", null, "", "details", domainPeristed);
return new ResponseEntity<ResponseDetails>(createRespDetails, HttpStatus.OK); return new ResponseEntity<ResponseDetails>(createRespDetails, HttpStatus.OK);
} }
log.info("A domain is already existed with the requested name" + domain.getDomainName()); log.info("A domain is already existed with the requested name" + domain.getDomainName());
ResponseDetails responseDetails = new ResponseDetails(new Date(), 802, "Domain is already existed", 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); "Choose the different domain name", null, request.getRequestURI(), "Domain details", domain);
return new ResponseEntity<ResponseDetails>(responseDetails, HttpStatus.OK); return new ResponseEntity<ResponseDetails>(responseDetails, HttpStatus.OK);
...@@ -66,7 +57,7 @@ public class DomainController { ...@@ -66,7 +57,7 @@ public class DomainController {
boolean isDomainExists = domainService.isDomainExists(domain); boolean isDomainExists = domainService.isDomainExists(domain);
if (isDomainExists == true) { if (isDomainExists == true) {
Domain domainPersisted = domainService.update(domain); Domain domainPersisted = domainService.update(domain);
ResponseDetails updateRespDetails = new ResponseDetails(new Date(), 802, "Domain has been updated", ResponseDetails updateRespDetails = new ResponseDetails(new Date(), DomainStatus.UPDATE.getCode(), DomainStatus.UPDATE.getMessage(),
"Domain Updation", null, request.getRequestURI(), "Updation Domain details", domainPersisted); "Domain Updation", null, request.getRequestURI(), "Updation Domain details", domainPersisted);
return new ResponseEntity<ResponseDetails>(updateRespDetails, HttpStatus.OK); return new ResponseEntity<ResponseDetails>(updateRespDetails, HttpStatus.OK);
...@@ -90,11 +81,10 @@ public class DomainController { ...@@ -90,11 +81,10 @@ public class DomainController {
} }
@RequestMapping(value = "/domains", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/domains", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getDomains(HttpServletRequest request) throws MyTeamException { public ResponseEntity<?> getDomains(HttpServletRequest request) throws MyTeamException {
ResponseDetails getRespDetails = new ResponseDetails(new Date(), 804, "Retrieved the domains successfully", ResponseDetails getRespDetails = new ResponseDetails(new Date(), DomainStatus.GET_DOMIAINS.getCode(), DomainStatus.GET_DOMIAINS.getMessage(),
"Domains list", domainService.getDomainsList(), request.getRequestURI(), "details", null); "Domains list", domainService.getDomainsList(), request.getRequestURI(), "details", null);
return new ResponseEntity<ResponseDetails>(getRespDetails, HttpStatus.OK); return new ResponseEntity<ResponseDetails>(getRespDetails, HttpStatus.OK);
...@@ -109,6 +99,4 @@ public class DomainController { ...@@ -109,6 +99,4 @@ public class DomainController {
} }
} }
\ No newline at end of file
...@@ -8,6 +8,8 @@ import java.util.stream.Collectors; ...@@ -8,6 +8,8 @@ import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest; 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.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
...@@ -38,11 +40,15 @@ public class EmployeeController { ...@@ -38,11 +40,15 @@ public class EmployeeController {
@Autowired @Autowired
private IEmployeeRoleService employeeRoleService; private IEmployeeRoleService employeeRoleService;
@Autowired
private EmployeeVisaRepo employeeVisaRepo;
@RequestMapping(value = "/employees/{empId}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/employees/{empId}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> createEmployee( @RequestBody Employee employeeReq, public ResponseEntity<?> createEmployee( @RequestBody Employee employeeReq,
@PathVariable(value = "empId") String loginEmpId, HttpServletRequest request) throws MyTeamException { @PathVariable(value = "empId") String loginEmpId, HttpServletRequest request) throws MyTeamException {
if (empService.isEmployeeExistsById(loginEmpId)) { if (!empService.isEmployeeExistsById(loginEmpId)) {
Employee employeePersisted = empService.createEmployee(employeeReq, loginEmpId); Employee employeePersisted = empService.createEmployee(employeeReq, loginEmpId);
ResponseDetails createRespDetails = new ResponseDetails(new Date(), 901, "Employee has been created", ResponseDetails createRespDetails = new ResponseDetails(new Date(), 901, "Employee has been created",
...@@ -228,5 +234,42 @@ public class EmployeeController { ...@@ -228,5 +234,42 @@ public class EmployeeController {
} }
@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; ...@@ -7,6 +7,7 @@ import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern; import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import org.bson.types.ObjectId;
import org.hibernate.validator.constraints.Email; import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.NotBlank; import org.hibernate.validator.constraints.NotBlank;
import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Id;
...@@ -31,7 +32,7 @@ public class Employee implements Serializable { ...@@ -31,7 +32,7 @@ public class Employee implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
private String id; private ObjectId id;
@NotBlank(message="Employee Id cannot be blank") @NotBlank(message="Employee Id cannot be blank")
......
...@@ -32,7 +32,6 @@ public class Project extends AuditFields implements Serializable { ...@@ -32,7 +32,6 @@ public class Project extends AuditFields implements Serializable {
private String projectId; private String projectId;
private String projectName; private String projectName;
private String domainId; private String domainId;
private String domain;
private String accountId; private String accountId;
private String status; private String status;
private List<String> employeeIds; 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);
}
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; 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.exception.handler.MyTeamException;
import com.nisum.myteam.model.dao.Account; import com.nisum.myteam.model.dao.Account;
import com.nisum.myteam.model.dao.Employee; 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 @Service
public interface IEmployeeService { public interface IEmployeeService {
......
package com.nisum.myteam.service;
public interface IEmployeeVisaService {
}
...@@ -16,10 +16,22 @@ public interface IProjectService { ...@@ -16,10 +16,22 @@ public interface IProjectService {
void deleteProject(String projectId); 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; List<HashMap<Object, Object>> getProjects() throws MyTeamException;
public List<Project> getOnlyActiveProjects();
List<Project> getProjectsUnderDomain(String domainId);
List<Project> getProjectsUnderDeliveryLead(String managerId) throws MyTeamException; List<Project> getProjectsUnderDeliveryLead(String managerId) throws MyTeamException;
public Resource addNewBeanchAllocation(Employee employee, String loginEmpId); public Resource addNewBeanchAllocation(Employee employee, String loginEmpId);
...@@ -28,34 +40,27 @@ public interface IProjectService { ...@@ -28,34 +40,27 @@ public interface IProjectService {
String generatePdfReport(long id, String fromDate, String toDate) throws MyTeamException; 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 Set<String> accountsAssignedToDl(String empId);
public List<HashMap<Object, Object>> deliveryLeadProjects(String empId) throws MyTeamException; 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 getProjectAccount(String accountId);
public Account updateProjSeqinAccount(Account account) throws MyTeamException; public Account updateProjSeqinAccount(Account account) throws MyTeamException;
public List<HashMap<Object, Object>> getRoleBasedProjects(String empId) throws MyTeamException; public List<HashMap<Object, Object>> getRoleBasedProjects(String empId) throws MyTeamException;
public List<HashMap<Object, Object>> getProjectsInsteadOfRole() throws MyTeamException; public List<HashMap<Object, Object>> getProjectsInsteadOfRole() throws MyTeamException;
public List<Project> getActiveProjects() 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; 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.exception.handler.MyTeamException;
import com.nisum.myteam.model.dao.Employee; import com.nisum.myteam.model.dao.Employee;
import com.nisum.myteam.model.dao.Resource; 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 @Service
public interface IResourceService { public interface IResourceService {
...@@ -42,4 +42,7 @@ public interface IResourceService { ...@@ -42,4 +42,7 @@ public interface IResourceService {
public List<Resource> getResourcesUnderDeliveryLead(String empId); public List<Resource> getResourcesUnderDeliveryLead(String empId);
public HashMap<String, Object> verifyResourceAssignedToAnyProject(Resource projectTeamMate, String loginEmpId) throws MyTeamException;
} }
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 { ...@@ -158,6 +158,23 @@ public class DomainService implements IDomainService {
return domainVOS; 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 @Override
public WriteResult delete(String domainId) throws MyTeamException { public WriteResult delete(String domainId) throws MyTeamException {
List<String> domEmpIds = new ArrayList<String>(); List<String> domEmpIds = new ArrayList<String>();
...@@ -243,21 +260,6 @@ public class DomainService implements IDomainService { ...@@ -243,21 +260,6 @@ public class DomainService implements IDomainService {
return accIdsSet; 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;
}
......
...@@ -32,13 +32,10 @@ public class EmployeeEffortsService implements IEmployeeEffortsService { ...@@ -32,13 +32,10 @@ public class EmployeeEffortsService implements IEmployeeEffortsService {
@Override @Override
public List<EmployeeEfforts> getEmployeeEffortsReport(String fromDate, String toDate) public List<EmployeeEfforts> getEmployeeEffortsReport(String fromDate, String toDate)
throws MyTeamException, SQLException { throws MyTeamException, SQLException {
System.out.println("######################################");
String query = null; String query = null;
query = MyTeamUtils.EMPLOYEE_EFFORTS_QUERY + "'" + fromDate.replace("-", "/") + "'" query = MyTeamUtils.EMPLOYEE_EFFORTS_QUERY + "'" + fromDate.replace("-", "/") + "'"
+ MyTeamUtils.EMPLOYEE_EFFORTS_QUERY1 + "'" + toDate.replace("-", "/") + "'" + MyTeamUtils.EMPLOYEE_EFFORTS_QUERY1 + "'" + toDate.replace("-", "/") + "'"
+ MyTeamUtils.EMPLOYEE_EFFORTS_QUERY2; + MyTeamUtils.EMPLOYEE_EFFORTS_QUERY2;
System.out.println(query);
List<EmployeeEfforts> listOfEmpEffortsData = getEmployeeEfforts(query); List<EmployeeEfforts> listOfEmpEffortsData = getEmployeeEfforts(query);
return listOfEmpEffortsData; return listOfEmpEffortsData;
......
...@@ -8,7 +8,9 @@ import com.nisum.myteam.model.dao.Resource; ...@@ -8,7 +8,9 @@ import com.nisum.myteam.model.dao.Resource;
import com.nisum.myteam.repository.EmployeeRepo; import com.nisum.myteam.repository.EmployeeRepo;
import com.nisum.myteam.service.*; import com.nisum.myteam.service.*;
import com.nisum.myteam.utils.MyTeamUtils; import com.nisum.myteam.utils.MyTeamUtils;
import com.nisum.myteam.utils.constants.ApplicationRole;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.core.FindAndModifyOptions; import org.springframework.data.mongodb.core.FindAndModifyOptions;
...@@ -297,7 +299,7 @@ public class EmployeeService implements IEmployeeService { ...@@ -297,7 +299,7 @@ public class EmployeeService implements IEmployeeService {
} }
@Override @Override
public boolean verifyEmployeeRole(String empId, String roleName) { public boolean verifyEmployeeRole(String empId, String roleIdReq) {
boolean flag = false; boolean flag = false;
log.info("The employeeId::" + empId); log.info("The employeeId::" + empId);
...@@ -305,23 +307,29 @@ public class EmployeeService implements IEmployeeService { ...@@ -305,23 +307,29 @@ public class EmployeeService implements IEmployeeService {
Employee employee = getEmployeeById(empId); Employee employee = getEmployeeById(empId);
log.info("Employee::::in EmployeeService::" + employee); log.info("Employee::::in EmployeeService::" + employee);
String role = employee.getRole(); String roleName = employee.getRole();
log.info("The employee role::" + role); log.info("The employee role::" + roleName);
if (null != role && "" != role && !"Admin".equalsIgnoreCase(role)) { 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; flag = true;
log.info("in if block");
} else { } else {
log.info("in else block");
Set<String> roleSet = employeeRoleService.empRolesMapInfoByEmpId(empId); Set<String> roleSet = employeeRoleService.empRolesMapInfoByEmpId(empId);
if (null != roleSet && !roleSet.isEmpty() && MyTeamUtils.INT_ZERO < roleSet.size()) { if (null != roleSet && !roleSet.isEmpty() && MyTeamUtils.INT_ZERO < roleSet.size()) {
if (roleSet.contains(roleName)) { if (roleSet.contains(roleIdReq)) {
flag = true; flag = true;
} }
} }
} }
} }
log.info("before return flag::"+flag);
return 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; package com.nisum.myteam.service.impl;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort;
...@@ -66,7 +61,7 @@ public class ResourceService implements IResourceService { ...@@ -66,7 +61,7 @@ public class ResourceService implements IResourceService {
private ProjectService projectService; private ProjectService projectService;
@Autowired @Autowired
private EmployeeRepo employeeRoleRepo; private EmployeeRepo employeeRepo;
public Resource save(Resource resource) { public Resource save(Resource resource) {
return resourceRepo.save(resource); return resourceRepo.save(resource);
...@@ -311,11 +306,11 @@ public class ResourceService implements IResourceService { ...@@ -311,11 +306,11 @@ public class ResourceService implements IResourceService {
empShiftService.updateEmployeeShift(existingResource, loginEmpId); empShiftService.updateEmployeeShift(existingResource, loginEmpId);
existingResource.setShift(resourceReq.getShift()); existingResource.setShift(resourceReq.getShift());
Employee employeeDB = employeeRoleRepo.findByEmployeeId(resourceReq.getEmployeeId()); Employee employeeDB = employeeRepo.findByEmployeeId(resourceReq.getEmployeeId());
employeeDB.setShift(resourceReq.getShift()); employeeDB.setShift(resourceReq.getShift());
employeeDB.setModifiedBy(loginEmpId); employeeDB.setModifiedBy(loginEmpId);
employeeDB.setLastModifiedOn(new Date()); employeeDB.setLastModifiedOn(new Date());
employeeRoleRepo.save(employeeDB); employeeRepo.save(employeeDB);
} }
existingResource.setAuditFields(loginEmpId, MyTeamUtils.UPDATE);// Setting existingResource.setAuditFields(loginEmpId, MyTeamUtils.UPDATE);// Setting
// audit // audit
...@@ -340,15 +335,6 @@ public class ResourceService implements IResourceService { ...@@ -340,15 +335,6 @@ public class ResourceService implements IResourceService {
return response; 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 @Override
public Resource deleteResource(String empId, String projectId, ObjectId id, String loginEmpId) { public Resource deleteResource(String empId, String projectId, ObjectId id, String loginEmpId) {
...@@ -624,4 +610,77 @@ public class ResourceService implements IResourceService { ...@@ -624,4 +610,77 @@ public class ResourceService implements IResourceService {
return resourcesList; 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; ...@@ -2,8 +2,11 @@ package com.nisum.myteam.statuscodes;
public enum DomainStatus { public enum DomainStatus {
CREATE(600, "Account has been created"), CREATE(610, "Domain has been created"),
UPDATE(601, "Account has been updated"); 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 int code;
private String message; private String message;
......
package com.nisum.myteam.statuscodes; 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; 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 { ...@@ -166,11 +166,18 @@ public class MyTeamUtils {
public final static String UPDATE ="UPDATE"; public final static String UPDATE ="UPDATE";
public static final String SHIFT1="Shift 1(9:00 AM - 6:00 PM)"; 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 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 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 SHIFT4="Shift 4(7:30 AM - 3:30 PM)";
public static final String SHIFT5="Shift 5(11:30 AM - 7: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 ...@@ -142,7 +142,7 @@ myApp.controller("dashboardController", function($scope, $http, myFactory,export
$scope.getEmployeesDashBoardData = function(){ $scope.getEmployeesDashBoardData = function(){
$http({ $http({
method : "GET", method : "GET",
url : appConfig.appUri + "getEmployeesDashBoard" url : appConfig.appUri + "resources/getEmployeesDashBoard"
}).then(function mySuccess(response) { }).then(function mySuccess(response) {
//alert("response"+response); //alert("response"+response);
// alert("response"+response.data); // alert("response"+response.data);
...@@ -203,7 +203,7 @@ myApp.controller("dashboardController", function($scope, $http, myFactory,export ...@@ -203,7 +203,7 @@ myApp.controller("dashboardController", function($scope, $http, myFactory,export
pageSize:10, pageSize:10,
columnDefs : [ columnDefs : [
{field : 'projectName',displayName: 'Project', enableColumnMenu: true, enableSorting: true,minWidth : 100,width: 150}, {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 : '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 : '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}, {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 ...@@ -273,7 +273,7 @@ myApp.controller("dashboardController", function($scope, $http, myFactory,export
}; };
$http({ $http({
method : "GET", method : "GET",
url : appConfig.appUri + "billing?employeeId="+$scope.profile.employeeId url : appConfig.appUri + "resources/billing?employeeId="+$scope.profile.employeeId
}).then(function mySuccess(response) { }).then(function mySuccess(response) {
//alert("response"+response); //alert("response"+response);
// alert("response"+response.data); // alert("response"+response.data);
...@@ -283,7 +283,7 @@ myApp.controller("dashboardController", function($scope, $http, myFactory,export ...@@ -283,7 +283,7 @@ myApp.controller("dashboardController", function($scope, $http, myFactory,export
}); });
$http({ $http({
method : "GET", method : "GET",
url : appConfig.appUri + "getMyProjectAllocations?employeeId="+$scope.profile.employeeId url : appConfig.appUri + "resources/getMyProjectAllocations?employeeId="+$scope.profile.employeeId
}).then(function mySuccess(response) { }).then(function mySuccess(response) {
//alert("response"+response); //alert("response"+response);
// alert("response"+response.data); // alert("response"+response.data);
......
...@@ -623,7 +623,8 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS ...@@ -623,7 +623,8 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
{ field: 'designation', displayName: 'Designation ', enableColumnMenu: false, enableSorting: false,enableFiltering:false }, { field: 'designation', displayName: 'Designation ', enableColumnMenu: false, enableSorting: false,enableFiltering:false },
// { field: 'active', displayName: 'Status ', enableColumnMenu: false, enableSorting: false, cellTemplate: getCellActiveTemplate }, // { field: 'active', displayName: 'Status ', enableColumnMenu: false, enableSorting: false, cellTemplate: getCellActiveTemplate },
{ field: 'billableStatus', displayName: 'Billability ', enableColumnMenu: false, enableSorting: false ,enableFiltering:false}, { 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} {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 ...@@ -1183,9 +1184,6 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
}else if($scope.employeeRole == undefined){ }else if($scope.employeeRole == undefined){
$scope.alertMsg = "Please select a employee role"; $scope.alertMsg = "Please select a employee role";
angular.element(document.getElementById('empRole')).focus(); 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){ else if($scope.empBillableStatus == undefined){
$scope.alertMsg = "Please select a billable status"; $scope.alertMsg = "Please select a billable status";
...@@ -1217,7 +1215,7 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS ...@@ -1217,7 +1215,7 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
else { else {
$scope.id = $scope.id ? $scope.id : $scope.objectId; $scope.id = $scope.id ? $scope.id : $scope.objectId;
$scope.alertMsg = ""; $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"){ if(action == "Add"){
addRecord(record,action); addRecord(record,action);
$scope.myForm.$setPristine(); $scope.myForm.$setPristine();
...@@ -1504,7 +1502,7 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS ...@@ -1504,7 +1502,7 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
function addRecord(record, action){ function addRecord(record, action){
var urlRequest = ""; var urlRequest = "";
var loginEmpId = myFactory.getEmpId(); var loginEmpId = myFactory.getEmpId();
urlRequest = appConfig.appUri+ "addEmployeeToTeamWithCheck?loginEmpId="+loginEmpId; urlRequest = appConfig.appUri+ "resources?loginEmpId="+loginEmpId;
var req = { var req = {
method : 'POST', method : 'POST',
url : urlRequest, url : urlRequest,
......
...@@ -100,10 +100,10 @@ ...@@ -100,10 +100,10 @@
</md-select> </md-select>
</td> </td>
</tr> </tr>
<tr> <!-- <tr>
<td class="Employee">Employee Name : </td> <td class="Employee">Employee Name : </td>
<td>{{employeeModel.employeeName}}</td> <td>{{employeeModel.employeeName}}</td>
</tr> </tr> -->
<tr> <tr>
<td class="Employee"> Employee Id :</td> <td class="Employee"> Employee Id :</td>
<td>{{employeeModel.employeeId}}</td> <td>{{employeeModel.employeeId}}</td>
...@@ -126,7 +126,7 @@ ...@@ -126,7 +126,7 @@
</md-select> </md-select>
</td> </td>
</tr> </tr>
<tr> <!-- <tr>
<td class="Employee">Shift</td> <td class="Employee">Shift</td>
<td> <td>
<md-select ng-model="employeeShift" md-selected-text="getSelectedEmpShift()" id="empShift"> <md-select ng-model="employeeShift" md-selected-text="getSelectedEmpShift()" id="empShift">
...@@ -135,7 +135,7 @@ ...@@ -135,7 +135,7 @@
</md-optgroup> </md-optgroup>
</md-select> </md-select>
</td> </td>
</tr> </tr> -->
<tr> <tr>
<td class="Employee">Billability Status</td> <td class="Employee">Billability Status</td>
<td> <td>
...@@ -153,16 +153,16 @@ ...@@ -153,16 +153,16 @@
md-max-date="maxDate " onkeydown="return false " ng-change="currentBillabilityDateChange()" name="newBillingStartDate"></md-datepicker> md-max-date="maxDate " onkeydown="return false " ng-change="currentBillabilityDateChange()" name="newBillingStartDate"></md-datepicker>
</td> </td>
</tr> </tr>
<tr> <!-- <tr>
<td class="Employee">Start Date</td> <td class="Employee">Start Date</td>
<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 " <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> onkeydown="return false " name="startDate"></md-datepicker>
</td> </td>
</tr> </tr> -->
<tr> <tr ng-show="empBillableStatus">
<td class="Employee">End Date</td> <td class="Employee">{{empBillableStatus}} End Date</td>
<td> <td>
<md-datepicker ng-model="endDate" md-placeholder="Please select Date" id="endDate " md-min-date="minDate " md-max-date="maxDate " <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> 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