Commit 7a39c235 authored by Rajeshekar's avatar Rajeshekar

MT-55: FreePool end date issue

parent 1a415bb2
...@@ -97,10 +97,11 @@ public class ReportsController { ...@@ -97,10 +97,11 @@ public class ReportsController {
ProjectionOperation projectToMatchModel = project() ProjectionOperation projectToMatchModel = project()
.andExpression("functionalGroup").as("name").andExpression("y") .andExpression("functionalGroup").as("name").andExpression("y")
.as("y"); .as("y");
MatchOperation matchStage = Aggregation
.match(new Criteria("empStatus").is("Active"));
Aggregation agg = newAggregation( Aggregation agg = newAggregation(
// match(Criteria.where("employeeId").gt(10)), // match(Criteria.where("employeeId").gt(10)),
group("functionalGroup").count().as("y"), matchStage, group("functionalGroup").count().as("y"),
project("y").and("functionalGroup").previousOperation(), project("y").and("functionalGroup").previousOperation(),
projectToMatchModel, projectToMatchModel,
...@@ -287,10 +288,11 @@ public class ReportsController { ...@@ -287,10 +288,11 @@ public class ReportsController {
ProjectionOperation projectToMatchModel = project() ProjectionOperation projectToMatchModel = project()
.andExpression("functionalGroup").as("name").andExpression("y") .andExpression("functionalGroup").as("name").andExpression("y")
.as("y"); .as("y");
MatchOperation matchStage = Aggregation
.match(new Criteria("empStatus").is("Active"));
Aggregation agg = newAggregation( Aggregation agg = newAggregation(
// match(Criteria.where("employeeId").gt(10)), // match(Criteria.where("employeeId").gt(10)),
group("functionalGroup").count().as("y"), matchStage, group("functionalGroup").count().as("y"),
project("y").and("functionalGroup").previousOperation(), project("y").and("functionalGroup").previousOperation(),
projectToMatchModel, projectToMatchModel,
......
...@@ -15,5 +15,6 @@ public interface EmployeeRolesRepo ...@@ -15,5 +15,6 @@ public interface EmployeeRolesRepo
EmployeeRoles findByEmployeeName(String employeeName); EmployeeRoles findByEmployeeName(String employeeName);
List<EmployeeRoles> findByFunctionalGroup(String functionalGroup); List<EmployeeRoles> findByEmpStatusAndFunctionalGroup(String empStatus,
String functionalGroup);
} }
...@@ -177,7 +177,11 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -177,7 +177,11 @@ public class ProjectServiceImpl implements ProjectService {
projectTeamMate.getEmployeeId(), "Nisum0000", true); projectTeamMate.getEmployeeId(), "Nisum0000", true);
if (activeBenchProject != null || activeBenchProject.size() != 0) { if (activeBenchProject != null || activeBenchProject.size() != 0) {
for (ProjectTeamMate pteamMate : activeBenchProject) { for (ProjectTeamMate pteamMate : activeBenchProject) {
Date d = pT.getStartDate() != null ? pT.getStartDate()
: new Date();
d.setDate(d.getDate() - 1);
pteamMate.setActive(false); pteamMate.setActive(false);
pteamMate.setEndDate(d);
projectTeamMatesRepo.save(pteamMate); projectTeamMatesRepo.save(pteamMate);
} }
} }
...@@ -271,8 +275,9 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -271,8 +275,9 @@ public class ProjectServiceImpl implements ProjectService {
existingTeammate.setActive(false); existingTeammate.setActive(false);
existingTeammate.setEndDate(new Date()); existingTeammate.setEndDate(new Date());
BillingDetails billingDetails = new BillingDetails(); BillingDetails billingDetails = new BillingDetails();
billingDetails.setBillableStatus("Bench"); billingDetails.setBillableStatus("Non-Billable");
billingDetails.setBillingStartDate(new Date()); billingDetails.setBillingStartDate(new Date());
billingDetails.setAccount("Nisum");
billingDetails.setActive(true); billingDetails.setActive(true);
billingDetails.setEmployeeId(existingTeammate.getEmployeeId()); billingDetails.setEmployeeId(existingTeammate.getEmployeeId());
billingDetails.setEmployeeName(existingTeammate.getEmployeeName()); billingDetails.setEmployeeName(existingTeammate.getEmployeeName());
...@@ -291,6 +296,21 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -291,6 +296,21 @@ public class ProjectServiceImpl implements ProjectService {
updateEmployeeBilling(billingDetailsExisting); updateEmployeeBilling(billingDetailsExisting);
} }
projectTeamMatesRepo.save(existingTeammate); projectTeamMatesRepo.save(existingTeammate);
ProjectTeamMate newBenchAllocation = new ProjectTeamMate();
newBenchAllocation.setAccount("Nisum");
newBenchAllocation.setBillableStatus("Non-Billable");
newBenchAllocation.setDesignation(existingTeammate.getDesignation());
newBenchAllocation.setEmailId(existingTeammate.getEmailId());
newBenchAllocation.setEmployeeId(existingTeammate.getEmployeeId());
newBenchAllocation.setActive(true);
newBenchAllocation.setEmployeeName(existingTeammate.getEmployeeName());
newBenchAllocation.setProjectId("Nisum0000");
newBenchAllocation.setStartDate(new Date());
Project p = projectRepo.findByProjectId("Nisum0000");
newBenchAllocation.setProjectName(p.getProjectName());
newBenchAllocation.setManagerId(p.getManagerId());
newBenchAllocation.setManagerName(p.getManagerName());
projectTeamMatesRepo.save(newBenchAllocation);
updateShiftDetails(existingTeammate); updateShiftDetails(existingTeammate);
} }
......
...@@ -184,7 +184,7 @@ public class UserServiceImpl implements UserService { ...@@ -184,7 +184,7 @@ public class UserServiceImpl implements UserService {
update.set("dateOfBirth", employeeRoles.getDateOfBirth()); update.set("dateOfBirth", employeeRoles.getDateOfBirth());
update.set("dateOfJoining", employeeRoles.getDateOfJoining()); update.set("dateOfJoining", employeeRoles.getDateOfJoining());
update.set("lastModifiedOn", new Date()); update.set("lastModifiedOn", new Date());
update.set("hasPassort", employeeRoles.getHasPassort()); update.set("hasPassort", employeeRoles.getHasPassort());
update.set("hasB1", employeeRoles.getHasB1()); update.set("hasB1", employeeRoles.getHasB1());
update.set("passportExpiryDate", employeeRoles.getPassportExpiryDate()); update.set("passportExpiryDate", employeeRoles.getPassportExpiryDate());
update.set("b1ExpiryDate", employeeRoles.getB1ExpiryDate()); update.set("b1ExpiryDate", employeeRoles.getB1ExpiryDate());
...@@ -419,7 +419,8 @@ public class UserServiceImpl implements UserService { ...@@ -419,7 +419,8 @@ public class UserServiceImpl implements UserService {
@Override @Override
public List<EmployeeRoles> getEmployeesByFunctionalGrp( public List<EmployeeRoles> getEmployeesByFunctionalGrp(
String functionalGrp) { String functionalGrp) {
return employeeRolesRepo.findByFunctionalGroup(functionalGrp); return employeeRolesRepo.findByEmpStatusAndFunctionalGroup("Active",
functionalGrp);
} }
} }
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