Unverified Commit 39f155fb authored by mshaik-nisum-com's avatar mshaik-nisum-com Committed by GitHub

Merge pull request #193 from...

Merge pull request #193 from nisum-inc/FEATURE/MT-70_AuditFiledsAddedToTeams_ProjectTeamMates_BillingDetails_ShifTDetails

MT-70 :SNS :: AuditFiledsAddedToTeams_ProjectTeamMates_BillingDetails…
parents 3cd9ee2f 68970794
...@@ -37,6 +37,7 @@ public class ProjectController { ...@@ -37,6 +37,7 @@ public class ProjectController {
private AccountRepo accountRepo; private AccountRepo accountRepo;
@Autowired @Autowired
private ProjectRepo projectRepo; private ProjectRepo projectRepo;
@RequestMapping(value = "/employee", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/employee", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<EmployeeRoles> getEmployeeRole(@RequestParam("emailId") String emailId) public ResponseEntity<EmployeeRoles> getEmployeeRole(@RequestParam("emailId") String emailId)
throws MyTimeException { throws MyTimeException {
...@@ -45,22 +46,21 @@ public class ProjectController { ...@@ -45,22 +46,21 @@ public class ProjectController {
} }
@RequestMapping(value = "/addProject", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/addProject", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> addProject(@RequestBody Project projectAdded) throws MyTimeException { public ResponseEntity<?> addProject(@RequestBody Project projectAdded,
@RequestParam(value = "loginEmpId") String loginEmpId) throws MyTimeException {
// checking project duplicateName // checking project duplicateName
int projectNameCount=0; int projectNameCount=0;
if (projectAdded.getAccountId() != null) { if (projectAdded.getAccountId() != null) {
List<Project> projects = projectRepo.findByDomainId(projectAdded.getDomainId()); List<Project> projects = projectRepo.findByDomainId(projectAdded.getDomainId());
for (Project existproject : projects) { for (Project existproject : projects) {
if (projectAdded.getProjectName().equalsIgnoreCase(existproject.getProjectName())) if (projectAdded.getProjectName().equalsIgnoreCase(existproject.getProjectName()))
projectNameCount++; } projectNameCount++;
}
} }
if (projectNameCount>0) if (projectNameCount > MyTimeUtils.INT_ZERO){
{
MyTimeException myTimeException= new MyTimeException("Project name already exist !!! try with new"); MyTimeException myTimeException= new MyTimeException("Project name already exist !!! try with new");
return new ResponseEntity<>(myTimeException, HttpStatus.OK); return new ResponseEntity<>(myTimeException, HttpStatus.OK);
} }else{
else
{
String accountName=""; String accountName="";
String accountId=projectAdded.getAccountId(); String accountId=projectAdded.getAccountId();
// String accountName=projectAdded.getAccount(); // String accountName=projectAdded.getAccount();
...@@ -69,16 +69,18 @@ public class ProjectController { ...@@ -69,16 +69,18 @@ public class ProjectController {
accountName=account.getAccountName(); accountName=account.getAccountName();
int sequenceNumber= account.getAccountProjectSequence(); int sequenceNumber= account.getAccountProjectSequence();
account.setAccountProjectSequence(sequenceNumber+1); account.setAccountProjectSequence(sequenceNumber+1);
//account.setAuditFields(loginEmpId, MyTimeUtils.UPDATE);
accountRepo.save(account); accountRepo.save(account);
String projectId= accountName+String.format("%04d", sequenceNumber+1); String projectId= accountName+String.format("%04d", sequenceNumber+1);
projectAdded.setProjectId(projectId); projectAdded.setProjectId(projectId);
Project project = projectService.addProject(projectAdded); Project project = projectService.addProject(projectAdded, loginEmpId);
return new ResponseEntity<>(project, HttpStatus.OK); return new ResponseEntity<>(project, HttpStatus.OK);
} }
} }
@RequestMapping(value = "/updateProject", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/updateProject", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> updateEmployeeRole(@RequestBody Project project) throws MyTimeException { public ResponseEntity<?> updateProject(@RequestBody Project project,
@RequestParam(value = "loginEmpId") String loginEmpId) throws MyTimeException {
// checking project duplicateName // checking project duplicateName
int projectNameCount=0; int projectNameCount=0;
if (project.getAccountId() != null) { if (project.getAccountId() != null) {
...@@ -95,7 +97,7 @@ public class ProjectController { ...@@ -95,7 +97,7 @@ public class ProjectController {
MyTimeException myTimeException= new MyTimeException("Project name already exist !!! try with new"); MyTimeException myTimeException= new MyTimeException("Project name already exist !!! try with new");
return new ResponseEntity<>(myTimeException, HttpStatus.OK); return new ResponseEntity<>(myTimeException, HttpStatus.OK);
} }
Project updatedProject = projectService.updateProject(project); Project updatedProject = projectService.updateProject(project, loginEmpId);
return new ResponseEntity<>(updatedProject, HttpStatus.OK); return new ResponseEntity<>(updatedProject, HttpStatus.OK);
} }
......
...@@ -40,9 +40,6 @@ public class ProjectTeamController { ...@@ -40,9 +40,6 @@ public class ProjectTeamController {
@Autowired @Autowired
private EmployeeVisaRepo employeeVisaRepo; private EmployeeVisaRepo employeeVisaRepo;
@Autowired
private ProjectController projectController;
@RequestMapping(value = "/employee", method = RequestMethod.GET, @RequestMapping(value = "/employee", method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE) produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<EmployeeRoles> getEmployeeRole( public ResponseEntity<EmployeeRoles> getEmployeeRole(
...@@ -55,17 +52,17 @@ public class ProjectTeamController { ...@@ -55,17 +52,17 @@ public class ProjectTeamController {
produces = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE,
consumes = MediaType.APPLICATION_JSON_VALUE) consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Project> addProject( public ResponseEntity<Project> addProject(
@RequestBody Project employeeRoles) throws MyTimeException { @RequestBody Project projectObj, @RequestParam(value="loginEmpId") String loginEmpId) throws MyTimeException {
Project project = projectService.addProject(employeeRoles); Project project = projectService.addProject(projectObj, loginEmpId);
return new ResponseEntity<>(project, HttpStatus.OK); return new ResponseEntity<>(project, HttpStatus.OK);
} }
@RequestMapping(value = "/updateEmployeeRole", method = RequestMethod.POST, @RequestMapping(value = "/updateEmployeeRole", method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE,
consumes = MediaType.APPLICATION_JSON_VALUE) consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<EmployeeRoles> updateEmployeeRole(@RequestBody EmployeeRoles employeeRoles, public ResponseEntity<EmployeeRoles> updateEmployeeRole(@RequestBody EmployeeRoles emp,
@RequestParam(value="empId") String loginEmpId) throws MyTimeException { @RequestParam(value="empId") String loginEmpId) throws MyTimeException {
EmployeeRoles employeeRole = userService.updateEmployeeRole(employeeRoles, loginEmpId); EmployeeRoles employeeRole = userService.updateEmployeeRole(emp, loginEmpId);
return new ResponseEntity<>(employeeRole, HttpStatus.OK); return new ResponseEntity<>(employeeRole, HttpStatus.OK);
} }
...@@ -124,29 +121,20 @@ public class ProjectTeamController { ...@@ -124,29 +121,20 @@ public class ProjectTeamController {
produces = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE,
consumes = MediaType.APPLICATION_JSON_VALUE) consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<ProjectTeamMate> addEmployeeToTeam( public ResponseEntity<ProjectTeamMate> addEmployeeToTeam(
@RequestBody ProjectTeamMate teamMate) throws MyTimeException { @RequestBody ProjectTeamMate teamMate, @RequestParam(value="loginEmpId", required = false) String loginEmpId) throws MyTimeException {
teamMate.setActive(true); teamMate.setActive(true);
// teamMate.setStartDate(new Date()); teamMate.setAuditFields(loginEmpId, MyTimeUtils.CREATE);
/*if (teamMate.getRole()!= null && teamMate.getRole().equals("Lead")) { ProjectTeamMate teamMateDB = projectService.addProjectTeamMate(teamMate, loginEmpId);
Project project = new Project();
project.setProjectName(teamMate.getProjectName());
project.setManagerIds(Arrays.asList(teamMate.getEmployeeId()));
project.setAccountId(teamMate.getAccountId());
project.setDomainId(teamMate.getDomainId());
project.setStatus("Active");
projectController.addProject(project);
}*/
ProjectTeamMate teamMateDB = projectService.addProjectTeamMate(teamMate);
return new ResponseEntity<>(teamMateDB, HttpStatus.OK); return new ResponseEntity<>(teamMateDB, HttpStatus.OK);
} }
@RequestMapping(value = "/updateTeammate", method = RequestMethod.POST, @RequestMapping(value = "/updateTeammate", method = RequestMethod.POST,
produces = MediaType.TEXT_PLAIN_VALUE, produces = MediaType.TEXT_PLAIN_VALUE,
consumes = MediaType.APPLICATION_JSON_VALUE) consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> updateTeammate(@RequestBody ProjectTeamMate projectTeamMate) public ResponseEntity<String> updateTeammate(@RequestBody ProjectTeamMate projectTeamMate, @RequestParam(value = "loginEmpId") String loginEmpId)
throws MyTimeException { throws MyTimeException {
String response = projectService.updateTeammate(projectTeamMate); projectTeamMate.setAuditFields(loginEmpId, MyTimeUtils.UPDATE);
String response = projectService.updateTeammate(projectTeamMate, loginEmpId);
return new ResponseEntity<>(response, HttpStatus.OK); return new ResponseEntity<>(response, HttpStatus.OK);
} }
...@@ -154,10 +142,10 @@ public class ProjectTeamController { ...@@ -154,10 +142,10 @@ public class ProjectTeamController {
produces = MediaType.TEXT_PLAIN_VALUE, produces = MediaType.TEXT_PLAIN_VALUE,
consumes = MediaType.APPLICATION_JSON_VALUE) consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> deleteTeammate( public ResponseEntity<String> deleteTeammate(
@RequestBody ProjectTeamMate projectTeamMate) @RequestBody ProjectTeamMate projectTeamMate, @RequestParam(value = "loginEmpId") String loginEmpId)
throws MyTimeException { throws MyTimeException {
projectService.deleteTeammate(projectTeamMate.getEmployeeId(), projectService.deleteTeammate(projectTeamMate.getEmployeeId(),
projectTeamMate.getProjectId(), projectTeamMate.getId()); projectTeamMate.getProjectId(), projectTeamMate.getId(), loginEmpId);
return new ResponseEntity<>("Success", HttpStatus.OK); return new ResponseEntity<>("Success", HttpStatus.OK);
} }
...@@ -259,9 +247,9 @@ public class ProjectTeamController { ...@@ -259,9 +247,9 @@ public class ProjectTeamController {
produces = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE,
consumes = MediaType.APPLICATION_JSON_VALUE) consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<BillingDetails> addEmployeeBilling( public ResponseEntity<BillingDetails> addEmployeeBilling(
@RequestBody BillingDetails teamMate) throws MyTimeException { @RequestBody BillingDetails billingDetails, @RequestParam(value = "loginEmpId") String loginEmpId) throws MyTimeException {
BillingDetails billings = projectService BillingDetails billings = projectService
.addEmployeeBillingDetails(teamMate); .addEmployeeBillingDetails(billingDetails, loginEmpId);
return new ResponseEntity<>(billings, HttpStatus.OK); return new ResponseEntity<>(billings, HttpStatus.OK);
} }
...@@ -271,9 +259,9 @@ public class ProjectTeamController { ...@@ -271,9 +259,9 @@ public class ProjectTeamController {
produces = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE,
consumes = MediaType.APPLICATION_JSON_VALUE) consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<BillingDetails> updateEmployeeBilling( public ResponseEntity<BillingDetails> updateEmployeeBilling(
@RequestBody BillingDetails teamMate) throws MyTimeException { @RequestBody BillingDetails billingDetails, @RequestParam(value = "loginEmpId") String loginEmpId) throws MyTimeException {
BillingDetails billings = projectService BillingDetails billings = projectService
.updateEmployeeBilling(teamMate); .updateEmployeeBilling(billingDetails, loginEmpId);
return new ResponseEntity<>(billings, HttpStatus.OK); return new ResponseEntity<>(billings, HttpStatus.OK);
} }
...@@ -301,12 +289,12 @@ public class ProjectTeamController { ...@@ -301,12 +289,12 @@ public class ProjectTeamController {
method = RequestMethod.GET, method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE) produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<EmployeeRoles>> getEmployeesHavingVisa( public ResponseEntity<List<EmployeeRoles>> getEmployeesHavingVisa(
@RequestParam("visa") String visa) throws MyTimeException { @RequestParam("visa") String passport) throws MyTimeException {
if (visa != null && !"passport".equalsIgnoreCase(visa)) { List<EmployeeRoles> employees = new ArrayList<>();
if (passport != null && !"passport".equalsIgnoreCase(passport)) {
List<EmployeeVisa> employeeVisas = employeeVisaRepo List<EmployeeVisa> employeeVisas = employeeVisaRepo
.findByVisaName(visa); .findByVisaName(passport);
List<String> employeeIds = null; List<String> employeeIds = null;
List<EmployeeRoles> employeesRoles = new ArrayList<>();
if (employeeVisas != null) { if (employeeVisas != null) {
employeeIds = employeeVisas.stream() employeeIds = employeeVisas.stream()
.map(EmployeeVisa::getEmployeeId) .map(EmployeeVisa::getEmployeeId)
...@@ -314,22 +302,22 @@ public class ProjectTeamController { ...@@ -314,22 +302,22 @@ public class ProjectTeamController {
} }
if (employeeIds != null && !employeeIds.isEmpty()) { if (employeeIds != null && !employeeIds.isEmpty()) {
List<EmployeeRoles> emps = userService.getEmployeeRoles(); List<EmployeeRoles> emps = userService.getEmployeeRoles();
for (EmployeeRoles e : emps) { for (EmployeeRoles emp : emps) {
if (employeeIds.contains(e.getEmployeeId())) { if (employeeIds.contains(emp.getEmployeeId())) {
employeesRoles.add(e); employees.add(emp);
} }
} }
} }
return new ResponseEntity<>(employeesRoles, HttpStatus.OK); return new ResponseEntity<>(employees, HttpStatus.OK);
} else { } else {
List<EmployeeRoles> employeesRoles = new ArrayList<>(); //List<EmployeeRoles> employees = new ArrayList<>();
if (userService.getEmployeeRoles() != null) { if (userService.getEmployeeRoles() != null) {
employeesRoles = userService.getEmployeeRoles().stream() employees = userService.getEmployeeRoles().stream()
.sorted((o1, o2) -> o1.getEmployeeName() .sorted((o1, o2) -> o1.getEmployeeName()
.compareTo(o2.getEmployeeName())) .compareTo(o2.getEmployeeName()))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
return new ResponseEntity<>(employeesRoles, HttpStatus.OK); return new ResponseEntity<>(employees, HttpStatus.OK);
} }
} }
...@@ -338,10 +326,8 @@ public class ProjectTeamController { ...@@ -338,10 +326,8 @@ public class ProjectTeamController {
produces = MediaType.TEXT_PLAIN_VALUE, produces = MediaType.TEXT_PLAIN_VALUE,
consumes = MediaType.APPLICATION_JSON_VALUE) consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> addEmployeeToTeamWithCheck( public ResponseEntity<String> addEmployeeToTeamWithCheck(
@RequestBody ProjectTeamMate teamMate) throws MyTimeException { @RequestBody ProjectTeamMate teamMate, @RequestParam(value = "loginEmpId") String loginEmpId) throws MyTimeException {
String response = projectService.addProjectTeamMateWithCheck(teamMate); String response = projectService.addProjectTeamMateWithCheck(teamMate, loginEmpId);
return new ResponseEntity<>(response, HttpStatus.OK); return new ResponseEntity<>(response, HttpStatus.OK);
} }
} }
\ No newline at end of file
package com.nisum.mytime.model;
import java.util.Date;
import com.nisum.mytime.utils.MyTimeUtils;
import lombok.Getter;
import lombok.Setter;
@Setter
@Getter
public class AuditFields {
String createdBy;
String modifiedBy;
Date createdOn;
Date lastModifiedOn;
public void setAuditFields(String loginEmpId, String action) {
Date currentDate = new Date();
if (MyTimeUtils.CREATE.equals(action)) {
this.createdBy = loginEmpId;
this.createdOn = currentDate;
}
this.modifiedBy = loginEmpId;
this.lastModifiedOn = currentDate;
}
}
...@@ -21,7 +21,7 @@ import lombok.ToString; ...@@ -21,7 +21,7 @@ import lombok.ToString;
@NoArgsConstructor @NoArgsConstructor
@ToString @ToString
@Document(collection = "BillingDetails") @Document(collection = "BillingDetails")
public class BillingDetails implements Serializable { public class BillingDetails extends AuditFields implements Serializable {
public Date getBillingEndDate() { public Date getBillingEndDate() {
return billingEndDate; return billingEndDate;
...@@ -43,7 +43,7 @@ public class BillingDetails implements Serializable { ...@@ -43,7 +43,7 @@ public class BillingDetails implements Serializable {
private Date billingEndDate; private Date billingEndDate;
private String comments; private String comments;
private boolean active; private boolean active;
@DateTimeFormat(pattern = "dd-MM-yyyy") //@DateTimeFormat(pattern = "dd-MM-yyyy")
private Date createDate; // private Date createDate;
} }
package com.nisum.mytime.model; package com.nisum.mytime.model;
import java.util.Date;
import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document; import org.springframework.data.mongodb.core.mapping.Document;
...@@ -17,15 +15,15 @@ import lombok.ToString; ...@@ -17,15 +15,15 @@ import lombok.ToString;
@NoArgsConstructor @NoArgsConstructor
@ToString @ToString
@Document(collection = "EmpShiftDetails") @Document(collection = "EmpShiftDetails")
public class EmpShiftDetails { public class EmpShiftDetails extends AuditFields {
@Id @Id
private String id; private String id;
private String employeeId; private String employeeId;
private String employeeName; private String employeeName;
private String shift; private String shift;
private Date createDate; //private Date createDate;
private Date updatedDate; //private Date updatedDate;
private boolean active; private boolean active;
} }
...@@ -22,7 +22,7 @@ import lombok.ToString; ...@@ -22,7 +22,7 @@ import lombok.ToString;
@NoArgsConstructor @NoArgsConstructor
@ToString @ToString
@Document(collection = "Teams") @Document(collection = "Teams")
public class Project implements Serializable { public class Project extends AuditFields implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -30,12 +30,7 @@ public class Project implements Serializable { ...@@ -30,12 +30,7 @@ public class Project implements Serializable {
private ObjectId id; private ObjectId id;
private String projectId; private String projectId;
private String projectName; private String projectName;
/*
* After Ui Integration this below commented code will be removed
*/
//private String managerId;
// private String managerName;
// private String account;
private String domain; private String domain;
private String status; private String status;
private List<String> employeeIds; private List<String> employeeIds;
...@@ -47,5 +42,4 @@ public class Project implements Serializable { ...@@ -47,5 +42,4 @@ public class Project implements Serializable {
@DateTimeFormat(iso = ISO.DATE) @DateTimeFormat(iso = ISO.DATE)
private Date projectEndDate; private Date projectEndDate;
private List<String> deliveryLeadIds; private List<String> deliveryLeadIds;
} }
...@@ -21,7 +21,7 @@ import lombok.ToString; ...@@ -21,7 +21,7 @@ import lombok.ToString;
@NoArgsConstructor @NoArgsConstructor
@ToString @ToString
@Document(collection = "TeamDetails") @Document(collection = "TeamDetails")
public class ProjectTeamMate implements Serializable { public class ProjectTeamMate extends AuditFields implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -35,8 +35,7 @@ public class ProjectTeamMate implements Serializable { ...@@ -35,8 +35,7 @@ public class ProjectTeamMate implements Serializable {
private String projectId; private String projectId;
private String projectName; private String projectName;
private String account; private String account;
//private String managerId;
//private String managerName;
private String experience; private String experience;
private String designation; private String designation;
private String billableStatus; private String billableStatus;
...@@ -48,8 +47,7 @@ public class ProjectTeamMate implements Serializable { ...@@ -48,8 +47,7 @@ public class ProjectTeamMate implements Serializable {
@DateTimeFormat(iso = ISO.DATE) @DateTimeFormat(iso = ISO.DATE)
private Date newBillingStartDate; private Date newBillingStartDate;
private boolean active; private boolean active;
//private List<String> managerIds;
private String accountId; private String accountId;
private String domainId; private String domainId;
} }
...@@ -21,7 +21,7 @@ public interface ProjectService { ...@@ -21,7 +21,7 @@ public interface ProjectService {
List<HashMap<Object, Object>> getProjects() throws MyTimeException; List<HashMap<Object, Object>> getProjects() throws MyTimeException;
Project addProject(Project project) throws MyTimeException; Project addProject(Project project, String loginEmpId) throws MyTimeException;
String generatePdfReport(long id, String fromDate, String toDate) String generatePdfReport(long id, String fromDate, String toDate)
throws MyTimeException; throws MyTimeException;
...@@ -30,7 +30,7 @@ public interface ProjectService { ...@@ -30,7 +30,7 @@ public interface ProjectService {
void deleteProject(String projectId); void deleteProject(String projectId);
Project updateProject(Project project)throws MyTimeException; Project updateProject(Project project, String loginEmpId)throws MyTimeException;
EmployeeRoles getEmployeesRoleData(String empId); EmployeeRoles getEmployeesRoleData(String empId);
...@@ -39,12 +39,12 @@ public interface ProjectService { ...@@ -39,12 +39,12 @@ public interface ProjectService {
//MT-72 //MT-72
List<ProjectTeamMate> getProjectInfo(String empId); List<ProjectTeamMate> getProjectInfo(String empId);
public ProjectTeamMate addProjectTeamMate(ProjectTeamMate projectTeamMate) public ProjectTeamMate addProjectTeamMate(ProjectTeamMate projectTeamMate, String loginEmpId)
throws MyTimeException; throws MyTimeException;
String updateTeammate(ProjectTeamMate projectTeamMate) throws MyTimeException; String updateTeammate(ProjectTeamMate projectTeamMate, String loginEmpId) throws MyTimeException;
void deleteTeammate(String empId, String projectId, ObjectId id); void deleteTeammate(String empId, String projectId, ObjectId id, String loginEmpId);
List<Project> getProjects(String managerId) throws MyTimeException; List<Project> getProjects(String managerId) throws MyTimeException;
...@@ -63,9 +63,9 @@ public interface ProjectService { ...@@ -63,9 +63,9 @@ public interface ProjectService {
List<BillingDetails> getEmployeeBillingDetails(String empId, List<BillingDetails> getEmployeeBillingDetails(String empId,
String projectId); String projectId);
BillingDetails addEmployeeBillingDetails(BillingDetails teamMate); BillingDetails addEmployeeBillingDetails(BillingDetails billingDetails, String loginEmpId);
BillingDetails updateEmployeeBilling(BillingDetails teamMate); BillingDetails updateEmployeeBilling(BillingDetails billingDetails, String loginEmpId);
void deleteEmployeeBilling(BillingDetails teamMate); void deleteEmployeeBilling(BillingDetails teamMate);
...@@ -78,14 +78,14 @@ public interface ProjectService { ...@@ -78,14 +78,14 @@ public interface ProjectService {
List<BillingDetails> getEmployeeBillingDetailsAll(String empId); List<BillingDetails> getEmployeeBillingDetailsAll(String empId);
public void updateShiftDetails(ProjectTeamMate existingTeammate); public void updateShiftDetails(ProjectTeamMate existingTeammate, String loginEmpId);
public void addShiftDetails(ProjectTeamMate projectTeamMate); public void addShiftDetails(ProjectTeamMate projectTeamMate, String loginEmpId);
List<ProjectTeamMate> findByAccountAndActiveAndBillableStatus( List<ProjectTeamMate> findByAccountAndActiveAndBillableStatus(
String account, boolean status, String billableStatus); String account, boolean status, String billableStatus);
public String addProjectTeamMateWithCheck(ProjectTeamMate projectTeamMate) public String addProjectTeamMateWithCheck(ProjectTeamMate projectTeamMate, String loginEmpId)
throws MyTimeException; throws MyTimeException;
public List<HashMap<Object, Object>> projectsInfoByEmpId(String empId); public List<HashMap<Object, Object>> projectsInfoByEmpId(String empId);
......
...@@ -155,7 +155,7 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -155,7 +155,7 @@ public class ProjectServiceImpl implements ProjectService {
} }
@Override @Override
public Project addProject(Project project) throws MyTimeException { public Project addProject(Project project, String loginEmpId) throws MyTimeException {
if (project.getDomainId() == null) { if (project.getDomainId() == null) {
Domains domain = new Domains(); Domains domain = new Domains();
domain.setAccountId(project.getAccountId()); domain.setAccountId(project.getAccountId());
...@@ -169,7 +169,7 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -169,7 +169,7 @@ public class ProjectServiceImpl implements ProjectService {
project.setDomainId(savedDomain.getDomainId()); project.setDomainId(savedDomain.getDomainId());
project.setDomain(savedDomain.getDomainName()); project.setDomain(savedDomain.getDomainName());
} }
project.setAuditFields(loginEmpId, MyTimeUtils.CREATE);
return projectRepo.save(project); return projectRepo.save(project);
} }
...@@ -190,7 +190,7 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -190,7 +190,7 @@ public class ProjectServiceImpl implements ProjectService {
} }
@Override @Override
public Project updateProject(Project project) throws MyTimeException { public Project updateProject(Project project, String loginEmpId) throws MyTimeException {
//Inactivate the Project based on endDate //Inactivate the Project based on endDate
Project existingProject = projectRepo.findByProjectId(project.getProjectId()); Project existingProject = projectRepo.findByProjectId(project.getProjectId());
List<ProjectTeamMate> existingTeammates = projectTeamMatesRepo.findByProjectId(project.getProjectId()); List<ProjectTeamMate> existingTeammates = projectTeamMatesRepo.findByProjectId(project.getProjectId());
...@@ -200,11 +200,14 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -200,11 +200,14 @@ public class ProjectServiceImpl implements ProjectService {
existingProject.setStatus(MyTimeUtils.IN_ACTIVE); existingProject.setStatus(MyTimeUtils.IN_ACTIVE);
existingProject.setProjectEndDate(project.getProjectEndDate()); existingProject.setProjectEndDate(project.getProjectEndDate());
existingProject.setAuditFields(loginEmpId, MyTimeUtils.UPDATE);
projectRepo.save(existingProject); projectRepo.save(existingProject);
for (ProjectTeamMate existingTeammate : existingTeammates) { for (ProjectTeamMate existingTeammate : existingTeammates) {
existingTeammate.setActive(false); existingTeammate.setActive(false);
existingTeammate.setEndDate(project.getProjectEndDate()); existingTeammate.setEndDate(project.getProjectEndDate());
existingTeammate.setAuditFields(loginEmpId, MyTimeUtils.UPDATE);
projectTeamMatesRepo.save(existingTeammate); projectTeamMatesRepo.save(existingTeammate);
BillingDetails billingDetails = new BillingDetails(); BillingDetails billingDetails = new BillingDetails();
ProjectTeamMate newBenchAllocation = new ProjectTeamMate(); ProjectTeamMate newBenchAllocation = new ProjectTeamMate();
billingDetails.setBillableStatus(MyTimeUtils.BENCH_BILLABILITY_STATUS); billingDetails.setBillableStatus(MyTimeUtils.BENCH_BILLABILITY_STATUS);
...@@ -214,7 +217,7 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -214,7 +217,7 @@ public class ProjectServiceImpl implements ProjectService {
BillingDetails billingDetailsExisting = listBD.get(0); BillingDetails billingDetailsExisting = listBD.get(0);
billingDetailsExisting.setBillingEndDate(project.getProjectEndDate()); billingDetailsExisting.setBillingEndDate(project.getProjectEndDate());
billingDetailsExisting.setActive(false); billingDetailsExisting.setActive(false);
updateEmployeeBilling(billingDetailsExisting); updateEmployeeBilling(billingDetailsExisting, loginEmpId);
} }
Project benchProject = projectRepo.findByProjectId(MyTimeUtils.BENCH_PROJECT_ID); Project benchProject = projectRepo.findByProjectId(MyTimeUtils.BENCH_PROJECT_ID);
Date sd = project.getProjectEndDate(); Date sd = project.getProjectEndDate();
...@@ -223,7 +226,7 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -223,7 +226,7 @@ public class ProjectServiceImpl implements ProjectService {
billingDetails.setActive(true); billingDetails.setActive(true);
billingDetails.setEmployeeId(existingTeammate.getEmployeeId()); billingDetails.setEmployeeId(existingTeammate.getEmployeeId());
billingDetails.setEmployeeName(existingTeammate.getEmployeeName()); billingDetails.setEmployeeName(existingTeammate.getEmployeeName());
billingDetails.setCreateDate(new Date()); //billingDetails.setCreateDate(new Date());// Commented as added common audit fields
billingDetails.setProjectId(MyTimeUtils.BENCH_PROJECT_ID); billingDetails.setProjectId(MyTimeUtils.BENCH_PROJECT_ID);
billingDetails.setProjectName(MyTimeUtils.FREE_POLL); billingDetails.setProjectName(MyTimeUtils.FREE_POLL);
if (benchProject != null) { if (benchProject != null) {
...@@ -233,7 +236,7 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -233,7 +236,7 @@ public class ProjectServiceImpl implements ProjectService {
newBenchAllocation.setDomainId(benchProject.getDomainId()); newBenchAllocation.setDomainId(benchProject.getDomainId());
newBenchAllocation.setEndDate(benchProject.getProjectEndDate()); newBenchAllocation.setEndDate(benchProject.getProjectEndDate());
} }
addEmployeeBillingDetails(billingDetails); addEmployeeBillingDetails(billingDetails,loginEmpId);
newBenchAllocation.setRole(existingTeammate.getRole()); newBenchAllocation.setRole(existingTeammate.getRole());
newBenchAllocation.setAccount(MyTimeUtils.BENCH_ACCOUNT); newBenchAllocation.setAccount(MyTimeUtils.BENCH_ACCOUNT);
...@@ -246,8 +249,9 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -246,8 +249,9 @@ public class ProjectServiceImpl implements ProjectService {
newBenchAllocation.setEmployeeName(existingTeammate.getEmployeeName()); newBenchAllocation.setEmployeeName(existingTeammate.getEmployeeName());
newBenchAllocation.setProjectId(MyTimeUtils.BENCH_PROJECT_ID); newBenchAllocation.setProjectId(MyTimeUtils.BENCH_PROJECT_ID);
newBenchAllocation.setStartDate(sd); newBenchAllocation.setStartDate(sd);
newBenchAllocation.setAuditFields(loginEmpId, MyTimeUtils.CREATE);
projectTeamMatesRepo.save(newBenchAllocation); projectTeamMatesRepo.save(newBenchAllocation);
updateShiftDetails(existingTeammate); updateShiftDetails(existingTeammate,loginEmpId);
} }
return existingProject; return existingProject;
...@@ -275,20 +279,25 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -275,20 +279,25 @@ public class ProjectServiceImpl implements ProjectService {
update.set("projectStartDate", project.getProjectStartDate()); update.set("projectStartDate", project.getProjectStartDate());
update.set("projectEndDate", project.getProjectEndDate()); update.set("projectEndDate", project.getProjectEndDate());
FindAndModifyOptions options = new FindAndModifyOptions(); FindAndModifyOptions options = new FindAndModifyOptions();
//Setting audit fileds
update.set("modifiedBy", loginEmpId);
update.set("lastModifiedOn", new Date());
options.returnNew(true); options.returnNew(true);
options.upsert(true); options.upsert(true);
Project projectDB = mongoTemplate.findAndModify(query, update, options, Project.class); Project projectDB = mongoTemplate.findAndModify(query, update, options, Project.class);
List<ProjectTeamMate> employeeDetails = projectTeamMatesRepo.findByProjectId(project.getProjectId()); List<ProjectTeamMate> employeeDetails = projectTeamMatesRepo.findByProjectId(project.getProjectId());
if (employeeDetails != null && projectDB != null) { if (employeeDetails != null && projectDB != null) {
for (ProjectTeamMate emp : employeeDetails) { for (ProjectTeamMate teamMate : employeeDetails) {
// emp.setManagerId(projectDB.getManagerId()); // emp.setManagerId(projectDB.getManagerId());
// emp.setManagerName(projectDB.getManagerName()); // emp.setManagerName(projectDB.getManagerName());
emp.setAccountId(projectDB.getAccountId()); teamMate.setAccountId(projectDB.getAccountId());
emp.setProjectName(projectDB.getProjectName()); teamMate.setProjectName(projectDB.getProjectName());
// MT-79:Maintatin the managerids in List // MT-79:Maintatin the managerids in List
// emp.setManagerIds(projectDB.getManagerIds()); // emp.setManagerIds(projectDB.getManagerIds());
emp.setEndDate(projectDB.getProjectEndDate()); teamMate.setEndDate(projectDB.getProjectEndDate());
projectTeamMatesRepo.save(emp); teamMate.setAuditFields(loginEmpId, MyTimeUtils.UPDATE);//Setting audit fields
projectTeamMatesRepo.save(teamMate);
} }
} }
return projectDB; return projectDB;
...@@ -327,8 +336,9 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -327,8 +336,9 @@ public class ProjectServiceImpl implements ProjectService {
} }
@Override @Override
public ProjectTeamMate addProjectTeamMate(ProjectTeamMate projectTeamMate) throws MyTimeException { public ProjectTeamMate addProjectTeamMate(ProjectTeamMate projectTeamMate, String loginEmpId) throws MyTimeException {
updateProjectEndDateInProjectTeamMate(projectTeamMate); updateProjectEndDateInProjectTeamMate(projectTeamMate, loginEmpId);
projectTeamMate.setAuditFields(loginEmpId, MyTimeUtils.CREATE);
ProjectTeamMate pT = projectTeamMatesRepo.save(projectTeamMate); ProjectTeamMate pT = projectTeamMatesRepo.save(projectTeamMate);
List<BillingDetails> listBD = getEmployeeActiveNisumBench(pT.getEmployeeId()); List<BillingDetails> listBD = getEmployeeActiveNisumBench(pT.getEmployeeId());
Date startDate = pT.getStartDate() != null ? pT.getStartDate() : new Date(); Date startDate = pT.getStartDate() != null ? pT.getStartDate() : new Date();
...@@ -340,7 +350,7 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -340,7 +350,7 @@ public class ProjectServiceImpl implements ProjectService {
bDetails.setBillingEndDate(startDate); bDetails.setBillingEndDate(startDate);
} }
bDetails.setActive(false); bDetails.setActive(false);
updateEmployeeBilling(bDetails); updateEmployeeBilling(bDetails, loginEmpId);
} }
BillingDetails billings = new BillingDetails(); BillingDetails billings = new BillingDetails();
billings.setEmployeeId(pT.getEmployeeId()); billings.setEmployeeId(pT.getEmployeeId());
...@@ -358,27 +368,15 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -358,27 +368,15 @@ public class ProjectServiceImpl implements ProjectService {
if (pT.getEndDate() != null) { if (pT.getEndDate() != null) {
billings.setBillingEndDate(DateUtils.truncate(pT.getEndDate(), Calendar.DATE)); billings.setBillingEndDate(DateUtils.truncate(pT.getEndDate(), Calendar.DATE));
} }
billings.setCreateDate(new Date()); //billings.setCreateDate(new Date()); //commented as we have added audit fields
//updateProjectEndDateInBillingDetails(projectTeamMate.getNewBillingStartDate(), billings); //updateProjectEndDateInBillingDetails(projectTeamMate.getNewBillingStartDate(), billings);
addEmployeeBillingDetails(billings); addEmployeeBillingDetails(billings, loginEmpId);
addShiftDetails(projectTeamMate); addShiftDetails(projectTeamMate, loginEmpId);
/*if (projectTeamMate.getProjectId() != null && !projectTeamMate.getProjectId().equalsIgnoreCase("Nisum0000")) { addOrUpdateTeamMateRole(projectTeamMate.getRole(), projectTeamMate.getProjectId(), projectTeamMate.getEmployeeId(), false, loginEmpId);
List<ProjectTeamMate> activeBenchProject = projectTeamMatesRepo
.findByEmployeeIdAndProjectIdAndActive(projectTeamMate.getEmployeeId(), "Nisum0000", true);
if (activeBenchProject != null && activeBenchProject.size() != 0) {
for (ProjectTeamMate pteamMate : activeBenchProject) {
Date d = (pT.getStartDate() != null) ? pT.getStartDate() : new Date();
pteamMate.setActive(false);
pteamMate.setEndDate(DateUtils.truncate(DateUtils.addDays(d, -1), Calendar.DATE));
projectTeamMatesRepo.save(pteamMate);
}
}
}*/
addOrUpdateTeamMateRole(projectTeamMate.getRole(), projectTeamMate.getProjectId(), projectTeamMate.getEmployeeId(), false);
return pT; return pT;
} }
private void addOrUpdateTeamMateRole(String role, String projectId, String empId, boolean isUpdate) throws MyTimeException { private void addOrUpdateTeamMateRole(String role, String projectId, String empId, boolean isUpdate, String loginEmpId) throws MyTimeException {
Project project = projectRepo.findByProjectId(projectId); Project project = projectRepo.findByProjectId(projectId);
int operationType = 0; //0 = No Operation, 1 = Added, 2 = Removed int operationType = 0; //0 = No Operation, 1 = Added, 2 = Removed
if (role != null && role.equals("Lead")) { if (role != null && role.equals("Lead")) {
...@@ -394,6 +392,7 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -394,6 +392,7 @@ public class ProjectServiceImpl implements ProjectService {
operationType = 2; operationType = 2;
} }
if (operationType > 0) { if (operationType > 0) {
project.setAuditFields(loginEmpId, MyTimeUtils.UPDATE);//setting audit fields
projectRepo.save(project); projectRepo.save(project);
Query query = new Query(Criteria.where("employeeId").is(empId).and("role").is("Lead")); Query query = new Query(Criteria.where("employeeId").is(empId).and("role").is("Lead"));
List<ProjectTeamMate> projectMates = mongoTemplate.find(query, ProjectTeamMate.class); List<ProjectTeamMate> projectMates = mongoTemplate.find(query, ProjectTeamMate.class);
...@@ -407,7 +406,7 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -407,7 +406,7 @@ public class ProjectServiceImpl implements ProjectService {
} }
@Override @Override
public String updateTeammate(ProjectTeamMate projectTeamMate) throws MyTimeException { public String updateTeammate(ProjectTeamMate projectTeamMate, String loginEmpId) throws MyTimeException {
//String result = null; //String result = null;
MyTeamResultDTO myResultDto = new MyTeamResultDTO(); MyTeamResultDTO myResultDto = new MyTeamResultDTO();
myResultDto.setResultCode(MyTeamResultDTO.SUCCESS_CODE); myResultDto.setResultCode(MyTeamResultDTO.SUCCESS_CODE);
...@@ -425,7 +424,7 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -425,7 +424,7 @@ public class ProjectServiceImpl implements ProjectService {
Date actualEndDate = resEndDate; Date actualEndDate = resEndDate;
billingDetailsExisting.setBillingEndDate(actualEndDate); billingDetailsExisting.setBillingEndDate(actualEndDate);
billingDetailsExisting.setActive(false); billingDetailsExisting.setActive(false);
updateEmployeeBilling(billingDetailsExisting); updateEmployeeBilling(billingDetailsExisting, loginEmpId);
} }
Project project = projectRepo.findByProjectId(MyTimeUtils.BENCH_PROJECT_ID); Project project = projectRepo.findByProjectId(MyTimeUtils.BENCH_PROJECT_ID);
ProjectTeamMate newBenchAllocation = new ProjectTeamMate(); ProjectTeamMate newBenchAllocation = new ProjectTeamMate();
...@@ -436,7 +435,7 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -436,7 +435,7 @@ public class ProjectServiceImpl implements ProjectService {
billingDetails.setActive(true); billingDetails.setActive(true);
billingDetails.setEmployeeId(existingTeammate.getEmployeeId()); billingDetails.setEmployeeId(existingTeammate.getEmployeeId());
billingDetails.setEmployeeName(existingTeammate.getEmployeeName()); billingDetails.setEmployeeName(existingTeammate.getEmployeeName());
billingDetails.setCreateDate(new Date()); //billingDetails.setCreateDate(new Date());// Commented as added common audit fields
billingDetails.setProjectId(MyTimeUtils.BENCH_PROJECT_ID); billingDetails.setProjectId(MyTimeUtils.BENCH_PROJECT_ID);
billingDetails.setProjectName(MyTimeUtils.FREE_POLL); billingDetails.setProjectName(MyTimeUtils.FREE_POLL);
if(project != null) { if(project != null) {
...@@ -446,7 +445,7 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -446,7 +445,7 @@ public class ProjectServiceImpl implements ProjectService {
newBenchAllocation.setProjectName(project.getProjectName()); newBenchAllocation.setProjectName(project.getProjectName());
newBenchAllocation.setEndDate(project.getProjectEndDate()); newBenchAllocation.setEndDate(project.getProjectEndDate());
} }
addEmployeeBillingDetails(billingDetails); addEmployeeBillingDetails(billingDetails, loginEmpId);
newBenchAllocation.setBillableStatus(MyTimeUtils.BENCH_BILLABILITY_STATUS); newBenchAllocation.setBillableStatus(MyTimeUtils.BENCH_BILLABILITY_STATUS);
newBenchAllocation.setDesignation(existingTeammate.getDesignation()); newBenchAllocation.setDesignation(existingTeammate.getDesignation());
...@@ -464,7 +463,7 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -464,7 +463,7 @@ public class ProjectServiceImpl implements ProjectService {
newBenchAllocation.setStartDate(DateUtils.truncate(cal.getTime(), Calendar.DATE)); newBenchAllocation.setStartDate(DateUtils.truncate(cal.getTime(), Calendar.DATE));
newBenchAllocation.setNewBillingStartDate(DateUtils.truncate(cal.getTime(), Calendar.DATE)); newBenchAllocation.setNewBillingStartDate(DateUtils.truncate(cal.getTime(), Calendar.DATE));
newBenchAllocation.setAuditFields(loginEmpId, MyTimeUtils.CREATE);//Setting audit fields
projectTeamMatesRepo.save(newBenchAllocation); projectTeamMatesRepo.save(newBenchAllocation);
myResultDto.setResultCode(MyTeamResultDTO.SUCCESS_CODE); myResultDto.setResultCode(MyTeamResultDTO.SUCCESS_CODE);
...@@ -493,7 +492,7 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -493,7 +492,7 @@ public class ProjectServiceImpl implements ProjectService {
billingDetails.setBillingEndDate(DateUtils.truncate(cal.getTime(), Calendar.DATE)); billingDetails.setBillingEndDate(DateUtils.truncate(cal.getTime(), Calendar.DATE));
} }
billingDetails.setActive(false); billingDetails.setActive(false);
updateEmployeeBilling(billingDetails); updateEmployeeBilling(billingDetails, loginEmpId);
} }
BillingDetails billings = new BillingDetails(); BillingDetails billings = new BillingDetails();
billings.setEmployeeId(projectTeamMate.getEmployeeId()); billings.setEmployeeId(projectTeamMate.getEmployeeId());
...@@ -505,8 +504,8 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -505,8 +504,8 @@ public class ProjectServiceImpl implements ProjectService {
billings.setActive(true); billings.setActive(true);
billings.setBillingStartDate(DateUtils.truncate(projectTeamMate.getNewBillingStartDate(), Calendar.DATE)); billings.setBillingStartDate(DateUtils.truncate(projectTeamMate.getNewBillingStartDate(), Calendar.DATE));
billings.setBillingEndDate(DateUtils.truncate(resEndDate, Calendar.DATE)); billings.setBillingEndDate(DateUtils.truncate(resEndDate, Calendar.DATE));
billings.setCreateDate(new Date()); //billings.setCreateDate(new Date());// Commented as added common audit fields
addEmployeeBillingDetails(billings); addEmployeeBillingDetails(billings,loginEmpId);
existingTeammate.setBillableStatus(projectTeamMate.getBillableStatus()); existingTeammate.setBillableStatus(projectTeamMate.getBillableStatus());
existingTeammate.setNewBillingStartDate(DateUtils.truncate(projectTeamMate.getNewBillingStartDate(), Calendar.DATE)); existingTeammate.setNewBillingStartDate(DateUtils.truncate(projectTeamMate.getNewBillingStartDate(), Calendar.DATE));
...@@ -529,13 +528,13 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -529,13 +528,13 @@ public class ProjectServiceImpl implements ProjectService {
} else { } else {
preBillingDetails.setBillingEndDate(DateUtils.truncate(cal.getTime(), Calendar.DATE)); preBillingDetails.setBillingEndDate(DateUtils.truncate(cal.getTime(), Calendar.DATE));
} }
updateEmployeeBilling(preBillingDetails); updateEmployeeBilling(preBillingDetails, loginEmpId);
} }
if (listBD != null && !listBD.isEmpty()) { if (listBD != null && !listBD.isEmpty()) {
BillingDetails billingDetails = listBD.get(0); BillingDetails billingDetails = listBD.get(0);
billingDetails.setBillingStartDate(DateUtils.truncate(projectTeamMate.getNewBillingStartDate(), Calendar.DATE)); billingDetails.setBillingStartDate(DateUtils.truncate(projectTeamMate.getNewBillingStartDate(), Calendar.DATE));
billingDetails.setBillingEndDate(DateUtils.truncate(resEndDate, Calendar.DATE)); billingDetails.setBillingEndDate(DateUtils.truncate(resEndDate, Calendar.DATE));
addEmployeeBillingDetails(billingDetails); addEmployeeBillingDetails(billingDetails, loginEmpId);
} }
existingTeammate.setNewBillingStartDate(DateUtils.truncate(projectTeamMate.getNewBillingStartDate(), Calendar.DATE)); existingTeammate.setNewBillingStartDate(DateUtils.truncate(projectTeamMate.getNewBillingStartDate(), Calendar.DATE));
} }
...@@ -549,17 +548,20 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -549,17 +548,20 @@ public class ProjectServiceImpl implements ProjectService {
if ((existingTeammate.getRole() != null && !existingTeammate.getRole().equalsIgnoreCase(projectTeamMate.getRole())) if ((existingTeammate.getRole() != null && !existingTeammate.getRole().equalsIgnoreCase(projectTeamMate.getRole()))
|| (projectTeamMate.getRole() != null) && !projectTeamMate.getRole().equalsIgnoreCase(existingTeammate.getRole())) { || (projectTeamMate.getRole() != null) && !projectTeamMate.getRole().equalsIgnoreCase(existingTeammate.getRole())) {
existingTeammate.setRole(projectTeamMate.getRole()); existingTeammate.setRole(projectTeamMate.getRole());
addOrUpdateTeamMateRole(projectTeamMate.getRole(), projectTeamMate.getProjectId(), projectTeamMate.getEmployeeId(), true); addOrUpdateTeamMateRole(projectTeamMate.getRole(), projectTeamMate.getProjectId(), projectTeamMate.getEmployeeId(), true, loginEmpId);
} }
//Handling Shift change //Handling Shift change
if ((existingTeammate.getShift() != null && !existingTeammate.getShift().equalsIgnoreCase(projectTeamMate.getShift())) if ((existingTeammate.getShift() != null && !existingTeammate.getShift().equalsIgnoreCase(projectTeamMate.getShift()))
|| (projectTeamMate.getShift() != null) && !projectTeamMate.getShift().equalsIgnoreCase(existingTeammate.getShift())) { || (projectTeamMate.getShift() != null) && !projectTeamMate.getShift().equalsIgnoreCase(existingTeammate.getShift())) {
updateShiftDetails(existingTeammate); updateShiftDetails(existingTeammate, loginEmpId);
existingTeammate.setShift(projectTeamMate.getShift()); existingTeammate.setShift(projectTeamMate.getShift());
EmployeeRoles employeeDB = employeeRolesRepo.findByEmployeeId(projectTeamMate.getEmployeeId()); EmployeeRoles employeeDB = employeeRolesRepo.findByEmployeeId(projectTeamMate.getEmployeeId());
employeeDB.setShift(projectTeamMate.getShift()); employeeDB.setShift(projectTeamMate.getShift());
employeeDB.setModifiedBy(loginEmpId);
employeeDB.setLastModifiedOn(new Date());
employeeRolesRepo.save(employeeDB); employeeRolesRepo.save(employeeDB);
} }
existingTeammate.setAuditFields(loginEmpId, MyTimeUtils.UPDATE);//Setting audit fields
projectTeamMatesRepo.save(existingTeammate); projectTeamMatesRepo.save(existingTeammate);
} }
return myResultDto.getResultData()[myResultDto.getDataArrayCounter()]; return myResultDto.getResultData()[myResultDto.getDataArrayCounter()];
...@@ -580,7 +582,8 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -580,7 +582,8 @@ public class ProjectServiceImpl implements ProjectService {
return response; return response;
} }
public void updateShiftDetails(ProjectTeamMate existingTeammate) { @Override
public void updateShiftDetails(ProjectTeamMate existingTeammate, String loginEmpId) {
Query getQuery = new Query(); Query getQuery = new Query();
getQuery.addCriteria(new Criteria().andOperator(Criteria.where("active").is(true), getQuery.addCriteria(new Criteria().andOperator(Criteria.where("active").is(true),
Criteria.where("employeeId").is(existingTeammate.getEmployeeId()))); Criteria.where("employeeId").is(existingTeammate.getEmployeeId())));
...@@ -589,24 +592,27 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -589,24 +592,27 @@ public class ProjectServiceImpl implements ProjectService {
EmpShiftDetails existingShift = mongoTemplate.findOne(getQuery, EmpShiftDetails.class); EmpShiftDetails existingShift = mongoTemplate.findOne(getQuery, EmpShiftDetails.class);
if (existingShift != null) { if (existingShift != null) {
existingShift.setActive(false); existingShift.setActive(false);
existingShift.setUpdatedDate(new Date()); //existingShift.setUpdatedDate(new Date());// Commented as added common audit fields
existingShift.setAuditFields(loginEmpId, MyTimeUtils.UPDATE);//Setting audit fields
mongoTemplate.save(existingShift); mongoTemplate.save(existingShift);
} }
} }
public void addShiftDetails(ProjectTeamMate projectTeamMate) { @Override
public void addShiftDetails(ProjectTeamMate projectTeamMate, String loginEmpId) {
EmpShiftDetails empShiftDetails = new EmpShiftDetails(); EmpShiftDetails empShiftDetails = new EmpShiftDetails();
empShiftDetails.setCreateDate(new Date()); //empShiftDetails.setCreateDate(new Date());// Commented as added common audit fields
empShiftDetails.setUpdatedDate(new Date()); //empShiftDetails.setUpdatedDate(new Date());// Commented as added common audit fields
empShiftDetails.setEmployeeName(projectTeamMate.getEmployeeName()); empShiftDetails.setEmployeeName(projectTeamMate.getEmployeeName());
empShiftDetails.setEmployeeId(projectTeamMate.getEmployeeId()); empShiftDetails.setEmployeeId(projectTeamMate.getEmployeeId());
empShiftDetails.setShift(projectTeamMate.getShift()); empShiftDetails.setShift(projectTeamMate.getShift());
empShiftDetails.setActive(projectTeamMate.isActive()); empShiftDetails.setActive(projectTeamMate.isActive());
empShiftDetails.setAuditFields(loginEmpId, MyTimeUtils.CREATE);//Setting audit fields
empShiftDetailsRepo.save(empShiftDetails); empShiftDetailsRepo.save(empShiftDetails);
} }
@Override @Override
public void deleteTeammate(String empId, String projectId, ObjectId id) { public void deleteTeammate(String empId, String projectId, ObjectId id, String loginEmpId) {
ProjectTeamMate existingTeammate = projectTeamMatesRepo.findById(id); ProjectTeamMate existingTeammate = projectTeamMatesRepo.findById(id);
existingTeammate.setActive(false); existingTeammate.setActive(false);
existingTeammate.setEndDate(new Date()); existingTeammate.setEndDate(new Date());
...@@ -617,10 +623,10 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -617,10 +623,10 @@ public class ProjectServiceImpl implements ProjectService {
billingDetails.setActive(true); billingDetails.setActive(true);
billingDetails.setEmployeeId(existingTeammate.getEmployeeId()); billingDetails.setEmployeeId(existingTeammate.getEmployeeId());
billingDetails.setEmployeeName(existingTeammate.getEmployeeName()); billingDetails.setEmployeeName(existingTeammate.getEmployeeName());
billingDetails.setCreateDate(new Date()); // billingDetails.setCreateDate(new Date());// Commented as added common audit fields
billingDetails.setProjectId("Nisum0000"); billingDetails.setProjectId("Nisum0000");
billingDetails.setProjectName(MyTimeUtils.FREE_POLL); billingDetails.setProjectName(MyTimeUtils.FREE_POLL);
addEmployeeBillingDetails(billingDetails); addEmployeeBillingDetails(billingDetails, loginEmpId);
List<BillingDetails> listBD = getEmployeeActiveBillingDetails(empId, List<BillingDetails> listBD = getEmployeeActiveBillingDetails(empId,
projectId); projectId);
if (listBD != null && !listBD.isEmpty()) { if (listBD != null && !listBD.isEmpty()) {
...@@ -629,8 +635,9 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -629,8 +635,9 @@ public class ProjectServiceImpl implements ProjectService {
d.setDate(d.getDate() - 1); d.setDate(d.getDate() - 1);
billingDetailsExisting.setBillingEndDate(d); billingDetailsExisting.setBillingEndDate(d);
billingDetailsExisting.setActive(false); billingDetailsExisting.setActive(false);
updateEmployeeBilling(billingDetailsExisting); updateEmployeeBilling(billingDetailsExisting, loginEmpId);
} }
existingTeammate.setAuditFields(loginEmpId, MyTimeUtils.UPDATE);//Setting audit fields
projectTeamMatesRepo.save(existingTeammate); projectTeamMatesRepo.save(existingTeammate);
ProjectTeamMate newBenchAllocation = new ProjectTeamMate(); ProjectTeamMate newBenchAllocation = new ProjectTeamMate();
newBenchAllocation.setAccount("Nisum"); newBenchAllocation.setAccount("Nisum");
...@@ -646,8 +653,9 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -646,8 +653,9 @@ public class ProjectServiceImpl implements ProjectService {
newBenchAllocation.setProjectName(p.getProjectName()); newBenchAllocation.setProjectName(p.getProjectName());
// newBenchAllocation.setManagerId(p.getManagerId()); // newBenchAllocation.setManagerId(p.getManagerId());
// newBenchAllocation.setManagerName(p.getManagerName()); // newBenchAllocation.setManagerName(p.getManagerName());
newBenchAllocation.setAuditFields(loginEmpId, MyTimeUtils.CREATE);//Setting audit fields
projectTeamMatesRepo.save(newBenchAllocation); projectTeamMatesRepo.save(newBenchAllocation);
updateShiftDetails(existingTeammate); updateShiftDetails(existingTeammate,loginEmpId);
} }
@Override @Override
...@@ -769,7 +777,7 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -769,7 +777,7 @@ public class ProjectServiceImpl implements ProjectService {
List<BillingDetails> billingsSorted = billings; List<BillingDetails> billingsSorted = billings;
try { try {
billingsSorted = (billings == null || billings.size() == 0) ? billings : billings.stream().sorted( billingsSorted = (billings == null || billings.size() == 0) ? billings : billings.stream().sorted(
Comparator.comparing(BillingDetails::getCreateDate).reversed()).collect(Collectors.toList()); Comparator.comparing(BillingDetails::getCreatedOn).reversed()).collect(Collectors.toList());
} catch (Exception e) { } catch (Exception e) {
} }
return billingsSorted; return billingsSorted;
...@@ -781,7 +789,7 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -781,7 +789,7 @@ public class ProjectServiceImpl implements ProjectService {
List<BillingDetails> billingsSorted = billings; List<BillingDetails> billingsSorted = billings;
try { try {
billingsSorted = (billings == null || billings.size() == 0) ? billings : billings.stream().sorted( billingsSorted = (billings == null || billings.size() == 0) ? billings : billings.stream().sorted(
Comparator.comparing(BillingDetails::getCreateDate).reversed()).collect(Collectors.toList()); Comparator.comparing(BillingDetails::getCreatedOn).reversed()).collect(Collectors.toList());
} catch (Exception e) { } catch (Exception e) {
} }
return billingsSorted; return billingsSorted;
...@@ -820,24 +828,19 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -820,24 +828,19 @@ public class ProjectServiceImpl implements ProjectService {
} }
@Override @Override
public BillingDetails addEmployeeBillingDetails(BillingDetails teamMate) { public BillingDetails addEmployeeBillingDetails(BillingDetails billingDetails, String loginEmpId) {
/* billingDetails.setAuditFields(loginEmpId, MyTimeUtils.CREATE);//Setting audit fields
* List<BillingDetails> billingsPast = getEmployeeBillingDetails( return teamMatesBillingRepo.save(billingDetails);
* teamMate.getEmployeeId(), teamMate.getProjectId());
*/ /*
* for (BillingDetails tB : billingsPast) { tB.setActive(false);
* teamMatesBillingRepo.save(tB); }
*/
return teamMatesBillingRepo.save(teamMate);
} }
@Override @Override
public BillingDetails updateEmployeeBilling(BillingDetails teamMate) { public BillingDetails updateEmployeeBilling(BillingDetails billingDetails, String loginEmpId) {
return teamMatesBillingRepo.save(teamMate); billingDetails.setAuditFields(loginEmpId, MyTimeUtils.UPDATE);//Setting audit fields
return teamMatesBillingRepo.save(billingDetails);
} }
// Update ProjectEndDate column data in ProjectTeamMate. // Update ProjectEndDate column data in ProjectTeamMate.
private void updateProjectEndDateInProjectTeamMate(ProjectTeamMate projectTeamMate) { private void updateProjectEndDateInProjectTeamMate(ProjectTeamMate projectTeamMate, String loginEmpId) {
List<ProjectTeamMate> projectTeamMateList = mongoTemplate List<ProjectTeamMate> projectTeamMateList = mongoTemplate
.find(getQuery(projectTeamMate.getEmployeeId(), MyTimeUtils.ENDDATE_COLUMN), ProjectTeamMate.class); .find(getQuery(projectTeamMate.getEmployeeId(), MyTimeUtils.ENDDATE_COLUMN), ProjectTeamMate.class);
if (!CollectionUtils.isEmpty(projectTeamMateList)) { if (!CollectionUtils.isEmpty(projectTeamMateList)) {
...@@ -854,6 +857,7 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -854,6 +857,7 @@ public class ProjectServiceImpl implements ProjectService {
teamMate.setEndDate(DateUtils.truncate(oneDayLess, Calendar.DATE)); teamMate.setEndDate(DateUtils.truncate(oneDayLess, Calendar.DATE));
} }
teamMate.setActive(false); teamMate.setActive(false);
teamMate.setAuditFields(loginEmpId, MyTimeUtils.UPDATE);//Setting audit fields
projectTeamMatesRepo.save(teamMate); projectTeamMatesRepo.save(teamMate);
} }
...@@ -909,32 +913,31 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -909,32 +913,31 @@ public class ProjectServiceImpl implements ProjectService {
@Override @Override
public List<EmployeeDashboardVO> getEmployeesDashBoard() { public List<EmployeeDashboardVO> getEmployeesDashBoard() {
List<EmployeeRoles> allEmployees = employeeRolesRepo.findAll(); List<EmployeeRoles> allEmployees = employeeRolesRepo.findAll();
List<EmployeeRoles> notAssignedEmployees = new ArrayList<>();
List<EmployeeDashboardVO> employeeDashboard = new ArrayList<>(); List<EmployeeDashboardVO> employeeDashboard = new ArrayList<>();
Map<String, Object> teamMatesMap = new HashMap(); Map<String, Object> teamMatesMap = new HashMap();
Map<String, Object> teamMatesStatusMap = new HashMap(); Map<String, Object> teamMatesStatusMap = new HashMap();
// Find all active employees // Find all active employees
List<ProjectTeamMate> empRecords = projectTeamMatesRepo.findAll(); List<ProjectTeamMate> teamMates = projectTeamMatesRepo.findAll();
for (ProjectTeamMate pt : empRecords) { for (ProjectTeamMate teamMate : teamMates) {
if (pt.isActive()) { if (teamMate.isActive()) {
Project project = projectRepo Project project = projectRepo
.findByProjectId(pt.getProjectId()); .findByProjectId(teamMate.getProjectId());
if (project != null && project.getStatus() != null if (project != null && project.getStatus() != null
&& !"Completed".equalsIgnoreCase(project.getStatus())) { && !"Completed".equalsIgnoreCase(project.getStatus())) {
Object projectTeamMate = teamMatesMap Object projectTeamMate = teamMatesMap
.get(pt.getEmployeeId()); .get(teamMate.getEmployeeId());
if (projectTeamMate == null) { if (projectTeamMate == null) {
List listOfObjects = new ArrayList<>(); List listOfObjects = new ArrayList<>();
listOfObjects.add(pt); listOfObjects.add(teamMate);
// A person can have multiple active projects with billability // A person can have multiple active projects with billability
teamMatesMap.put(pt.getEmployeeId(), listOfObjects); teamMatesMap.put(teamMate.getEmployeeId(), listOfObjects);
} else { } else {
List existingRecordsInMap = (List) teamMatesMap List existingRecordsInMap = (List) teamMatesMap
.get(pt.getEmployeeId()); .get(teamMate.getEmployeeId());
existingRecordsInMap.add(pt); existingRecordsInMap.add(teamMate);
teamMatesMap.put(pt.getEmployeeId(), teamMatesMap.put(teamMate.getEmployeeId(),
existingRecordsInMap); existingRecordsInMap);
} }
...@@ -995,7 +998,7 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -995,7 +998,7 @@ public class ProjectServiceImpl implements ProjectService {
} }
@Override @Override
public String addProjectTeamMateWithCheck(ProjectTeamMate projectTeamMate) throws MyTimeException { public String addProjectTeamMateWithCheck(ProjectTeamMate projectTeamMate, String loginEmpId) throws MyTimeException {
boolean flag = false; boolean flag = false;
String projectName = null; String projectName = null;
String fromDate = null; String fromDate = null;
...@@ -1021,7 +1024,7 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -1021,7 +1024,7 @@ public class ProjectServiceImpl implements ProjectService {
} else {// If no, validating new project assignment start date against previous project end date. } else {// If no, validating new project assignment start date against previous project end date.
result = validateNewProjectAssignmentStartDate(teamMateList, projectTeamMate); result = validateNewProjectAssignmentStartDate(teamMateList, projectTeamMate);
if (result == null) { if (result == null) {
addProjectTeamMate(projectTeamMate); addProjectTeamMate(projectTeamMate, loginEmpId);
result = "TeamMate added successfuly"; result = "TeamMate added successfuly";
} }
} }
......
...@@ -146,11 +146,11 @@ public class UserServiceImpl implements UserService { ...@@ -146,11 +146,11 @@ public class UserServiceImpl implements UserService {
} }
@Override @Override
public EmployeeRoles assigingEmployeeRole(EmployeeRoles employeeRoles, String empId) public EmployeeRoles assigingEmployeeRole(EmployeeRoles employeeRoles, String loginEmpId)
throws MyTimeException { throws MyTimeException {
employeeRoles.setCreatedOn(new Date()); employeeRoles.setCreatedOn(new Date());
employeeRoles.setCreatedBy(empId); employeeRoles.setCreatedBy(loginEmpId);
employeeRoles.setModifiedBy(empId); employeeRoles.setModifiedBy(loginEmpId);
ProjectTeamMate newBenchAllocation = new ProjectTeamMate(); ProjectTeamMate newBenchAllocation = new ProjectTeamMate();
newBenchAllocation.setAccount(MyTimeUtils.BENCH_ACCOUNT); newBenchAllocation.setAccount(MyTimeUtils.BENCH_ACCOUNT);
...@@ -180,7 +180,7 @@ public class UserServiceImpl implements UserService { ...@@ -180,7 +180,7 @@ public class UserServiceImpl implements UserService {
} }
try { try {
projectService.addProjectTeamMate(newBenchAllocation); projectService.addProjectTeamMate(newBenchAllocation, loginEmpId);
} catch (MyTimeException e) { } catch (MyTimeException e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -201,7 +201,7 @@ public class UserServiceImpl implements UserService { ...@@ -201,7 +201,7 @@ public class UserServiceImpl implements UserService {
} }
@Override @Override
public EmployeeRoles updateEmployeeRole(EmployeeRoles employeeRoles, String empId) { public EmployeeRoles updateEmployeeRole(EmployeeRoles employeeRoles, String loginEmpId) {
// update all emp details to inactive if employee is inactive // update all emp details to inactive if employee is inactive
Query query = new Query(Criteria.where("employeeId").is(employeeRoles.getEmployeeId())); Query query = new Query(Criteria.where("employeeId").is(employeeRoles.getEmployeeId()));
Update update = new Update(); Update update = new Update();
...@@ -223,7 +223,7 @@ public class UserServiceImpl implements UserService { ...@@ -223,7 +223,7 @@ public class UserServiceImpl implements UserService {
update.set("passportExpiryDate", employeeRoles.getPassportExpiryDate()); update.set("passportExpiryDate", employeeRoles.getPassportExpiryDate());
update.set("b1ExpiryDate", employeeRoles.getB1ExpiryDate()); update.set("b1ExpiryDate", employeeRoles.getB1ExpiryDate());
update.set("modifiedBy", empId); update.set("modifiedBy", loginEmpId);
if(employeeRoles.getEmpStatus().equalsIgnoreCase(MyTimeUtils.IN_ACTIVE_SPACE)) { if(employeeRoles.getEmpStatus().equalsIgnoreCase(MyTimeUtils.IN_ACTIVE_SPACE)) {
update.set("endDate", employeeRoles.getEndDate()); update.set("endDate", employeeRoles.getEndDate());
...@@ -278,8 +278,9 @@ public class UserServiceImpl implements UserService { ...@@ -278,8 +278,9 @@ public class UserServiceImpl implements UserService {
billingDetailsExisting.setActive(false); billingDetailsExisting.setActive(false);
teamMatesBillingRepo.save(billingDetailsExisting); teamMatesBillingRepo.save(billingDetailsExisting);
} }
teamMate.setAuditFields(loginEmpId, MyTimeUtils.UPDATE);
projectTeamMatesRepo.save(teamMate); projectTeamMatesRepo.save(teamMate);
updateShiftDetails(teamMate); updateShiftDetails(teamMate, loginEmpId);
} }
} }
} catch (Exception e) { } catch (Exception e) {
...@@ -522,7 +523,7 @@ public class UserServiceImpl implements UserService { ...@@ -522,7 +523,7 @@ public class UserServiceImpl implements UserService {
return billingsSorted; return billingsSorted;
} }
public void updateShiftDetails(ProjectTeamMate existingTeammate) { public void updateShiftDetails(ProjectTeamMate existingTeammate, String loginEmpId) {
Query getQuery = new Query(); Query getQuery = new Query();
getQuery.addCriteria(new Criteria().andOperator(Criteria.where("active").is(true), getQuery.addCriteria(new Criteria().andOperator(Criteria.where("active").is(true),
Criteria.where("employeeId").is(existingTeammate.getEmployeeId()))); Criteria.where("employeeId").is(existingTeammate.getEmployeeId())));
...@@ -531,7 +532,8 @@ public class UserServiceImpl implements UserService { ...@@ -531,7 +532,8 @@ public class UserServiceImpl implements UserService {
EmpShiftDetails existingShift = mongoTemplate.findOne(getQuery, EmpShiftDetails.class); EmpShiftDetails existingShift = mongoTemplate.findOne(getQuery, EmpShiftDetails.class);
if (existingShift != null) { if (existingShift != null) {
existingShift.setActive(false); existingShift.setActive(false);
existingShift.setUpdatedDate(new Date()); //existingShift.setUpdatedDate(new Date());// Commented as added common audit fields
existingShift.setAuditFields(loginEmpId, MyTimeUtils.UPDATE);
mongoTemplate.save(existingShift); mongoTemplate.save(existingShift);
} }
} }
......
...@@ -148,4 +148,7 @@ public class MyTimeUtils { ...@@ -148,4 +148,7 @@ public class MyTimeUtils {
public final static String FULL_TIME ="Full Time"; public final static String FULL_TIME ="Full Time";
public final static String CAMA = ","; public final static String CAMA = ",";
public final static String CREATE ="CREATE";
public final static String UPDATE ="UPDATE";
} }
...@@ -288,8 +288,8 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS ...@@ -288,8 +288,8 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
function deleteTeam(record){ function deleteTeam(record){
var urlRequest = ""; var urlRequest = "";
var loginEmpId = myFactory.getEmpId();
urlRequest = appConfig.appUri+ "/projectTeam/deleteTeammate"; urlRequest = appConfig.appUri+ "/projectTeam/deleteTeammate?loginEmpId="+loginEmpId;
var req = { var req = {
method : 'POST', method : 'POST',
url : urlRequest, url : urlRequest,
...@@ -1436,8 +1436,8 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS ...@@ -1436,8 +1436,8 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
function addRecord(record, action){ function addRecord(record, action){
var urlRequest = ""; var urlRequest = "";
var loginEmpId = myFactory.getEmpId();
urlRequest = appConfig.appUri+ "projectTeam/addEmployeeToTeamWithCheck"; urlRequest = appConfig.appUri+ "projectTeam/addEmployeeToTeamWithCheck?loginEmpId="+loginEmpId;
var req = { var req = {
method : 'POST', method : 'POST',
url : urlRequest, url : urlRequest,
...@@ -1494,8 +1494,8 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS ...@@ -1494,8 +1494,8 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
} }
function updateTeamRecord(record, action){ function updateTeamRecord(record, action){
var urlRequest = ""; var urlRequest = "";
var loginEmpId = myFactory.getEmpId();
urlRequest = appConfig.appUri+ "/projectTeam/updateTeammate"; urlRequest = appConfig.appUri+ "/projectTeam/updateTeammate?loginEmpId="+loginEmpId;
var req = { var req = {
method : 'POST', method : 'POST',
url : urlRequest, url : urlRequest,
...@@ -1529,10 +1529,11 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS ...@@ -1529,10 +1529,11 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
function addOrUpdateProject(record, action) { function addOrUpdateProject(record, action) {
var urlRequest = ""; var urlRequest = "";
var loginEmpId = myFactory.getEmpId();
if (action == "Assign") { if (action == "Assign") {
urlRequest = appConfig.appUri + "project/addProject"; urlRequest = appConfig.appUri + "project/addProject?loginEmpId="+loginEmpId;
} else if (action == "Update") { } else if (action == "Update") {
urlRequest = appConfig.appUri + "project/updateProject"; urlRequest = appConfig.appUri + "project/updateProject?loginEmpId="+loginEmpId;
} }
var req = { var req = {
method: 'POST', method: 'POST',
......
...@@ -386,8 +386,9 @@ myApp.controller("projectMyTeamController",function($scope, myFactory, $mdDialog ...@@ -386,8 +386,9 @@ myApp.controller("projectMyTeamController",function($scope, myFactory, $mdDialog
function addOrUpdateRole(record, action){ function addOrUpdateRole(record, action){
var urlRequest = ""; var urlRequest = "";
var loginEmpId = myFactory.getEmpId();
if(action == "Assign"){ if(action == "Assign"){
urlRequest = appConfig.appUri+ "projectTeam/addEmployeeToTeam"; urlRequest = appConfig.appUri+ "projectTeam/addEmployeeToTeam?loginEmpId="+loginEmpId;
}else if(action == "Update"){ }else if(action == "Update"){
urlRequest = appConfig.appUri+ "user/updateEmployeeRole"; urlRequest = appConfig.appUri+ "user/updateEmployeeRole";
} }
......
...@@ -24,6 +24,7 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog, ...@@ -24,6 +24,7 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
}; };
$scope.employees = []; $scope.employees = [];
$scope.projects = []; $scope.projects = [];
var getCellTemplate = '<p class="col-lg-12"><i class="fa fa-pencil-square-o fa-2x" aria-hidden="true" style="font-size:1.5em;margin-top:3px;cursor:pointer;" ng-click="grid.appScope.getRowData(row,\'Update\')"></i>'+ var getCellTemplate = '<p class="col-lg-12"><i class="fa fa-pencil-square-o fa-2x" aria-hidden="true" style="font-size:1.5em;margin-top:3px;cursor:pointer;" ng-click="grid.appScope.getRowData(row,\'Update\')"></i>'+
'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i class="fa fa-minus-circle fa-2x" aria-hidden="true" style="font-size:1.5em;margin-top:3px;cursor:pointer;" ng-click="grid.appScope.getRowData(row,\'Delete\')"></i></p>'; '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i class="fa fa-minus-circle fa-2x" aria-hidden="true" style="font-size:1.5em;margin-top:3px;cursor:pointer;" ng-click="grid.appScope.getRowData(row,\'Delete\')"></i></p>';
var getCellTemplate1='<div ng-show="COL_FIELD!=\'Employee\' && COL_FIELD!=\'HR\' "><p class="col-lg-12">{{COL_FIELD}} <i class="fa fa-sitemap fa-2x" aria-hidden="true" style="font-size:1.5em;color:blue;margin-top:3px;cursor:pointer;" ng-click="grid.appScope.getRowData(row,\'ViewTeamDetail\')"></i></p></div><div ng-show="COL_FIELD==\'Employee\' || COL_FIELD==\'HR\'"><p class="col-lg-12">{{COL_FIELD}}</p></div>' var getCellTemplate1='<div ng-show="COL_FIELD!=\'Employee\' && COL_FIELD!=\'HR\' "><p class="col-lg-12">{{COL_FIELD}} <i class="fa fa-sitemap fa-2x" aria-hidden="true" style="font-size:1.5em;color:blue;margin-top:3px;cursor:pointer;" ng-click="grid.appScope.getRowData(row,\'ViewTeamDetail\')"></i></p></div><div ng-show="COL_FIELD==\'Employee\' || COL_FIELD==\'HR\'"><p class="col-lg-12">{{COL_FIELD}}</p></div>'
...@@ -256,7 +257,8 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog, ...@@ -256,7 +257,8 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
var record = {"id":id,"employeeId":empId,"projectId":projectId}; var record = {"id":id,"employeeId":empId,"projectId":projectId};
var req = { var req = {
method : 'POST', method : 'POST',
url : appConfig.appUri+ "projectTeam/deleteTeammate", var loginEmpId = myFactory.getEmpId();
url : appConfig.appUri+ "projectTeam/deleteTeammate?loginEmpId="+loginEmpId,
headers : { headers : {
"Content-type" : "application/json" "Content-type" : "application/json"
}, },
...@@ -445,10 +447,11 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog, ...@@ -445,10 +447,11 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
}; };
function addOrUpdateBilling(record, action){ function addOrUpdateBilling(record, action){
var urlRequest = ""; var urlRequest = "";
var loginEmpId = myFactory.getEmpId();
if(action == "Add"){ if(action == "Add"){
urlRequest = appConfig.appUri+ "projectTeam/addEmployeeBilling"; urlRequest = appConfig.appUri+ "projectTeam/addEmployeeBilling?loginEmpId="+loginEmpId;
}else if(action == "Update"){ }else if(action == "Update"){
urlRequest = appConfig.appUri+ "projectTeam/updateEmployeeBilling"; urlRequest = appConfig.appUri+ "projectTeam/updateEmployeeBilling?loginEmpId="+loginEmpId;
} }
else if(action == "Delete"){ else if(action == "Delete"){
...@@ -829,10 +832,11 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog, ...@@ -829,10 +832,11 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
function addOrUpdateRole(record, action){ function addOrUpdateRole(record, action){
var urlRequest = ""; var urlRequest = "";
var loginEmpId = myFactory.getEmpId();
if(action == "Add"){ if(action == "Add"){
urlRequest = appConfig.appUri+ "projectTeam/addEmployeeToTeam"; urlRequest = appConfig.appUri+ "projectTeam/addEmployeeToTeam?loginEmpId="+loginEmpId;
}else if(action == "Update"){ }else if(action == "Update"){
urlRequest = appConfig.appUri+ "projectTeam/updateTeammate"; urlRequest = appConfig.appUri+ "projectTeam/updateTeammate?loginEmpId="+loginEmpId;
} }
var req = { var req = {
method : 'POST', method : 'POST',
......
...@@ -533,10 +533,11 @@ myApp.controller("viewProjectController",function($scope, myFactory,exportUiGrid ...@@ -533,10 +533,11 @@ myApp.controller("viewProjectController",function($scope, myFactory,exportUiGrid
function addOrUpdateProject(record, action){ function addOrUpdateProject(record, action){
var urlRequest = ""; var urlRequest = "";
var loginEmpId = myFactory.getEmpId();
if(action == "Assign"){ if(action == "Assign"){
urlRequest = appConfig.appUri+ "project/addProject"; urlRequest = appConfig.appUri+ "project/addProject?loginEmpId="+loginEmpId;
}else if(action == "Update"){ }else if(action == "Update"){
urlRequest = appConfig.appUri+ "project/updateProject"; urlRequest = appConfig.appUri+ "project/updateProject?loginEmpId="+loginEmpId;
} }
var req = { var req = {
method : 'POST', method : 'POST',
......
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