Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mytime
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Narendar Vakiti
mytime
Commits
b661afcb
Commit
b661afcb
authored
May 14, 2019
by
Vijay Akula
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed Update Resource issue
parent
a108af67
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
150 additions
and
105 deletions
+150
-105
ReportsController.java
...n/java/com/nisum/myteam/controller/ReportsController.java
+27
-16
ResourceAllocationController.java
...nisum/myteam/controller/ResourceAllocationController.java
+1
-1
IResourceAllocationService.java
.../com/nisum/myteam/service/IResourceAllocationService.java
+19
-16
EmployeeService.java
...n/java/com/nisum/myteam/service/impl/EmployeeService.java
+3
-1
ProjectService.java
...in/java/com/nisum/myteam/service/impl/ProjectService.java
+47
-48
ResourceAllocationService.java
.../nisum/myteam/service/impl/ResourceAllocationService.java
+53
-23
No files found.
src/main/java/com/nisum/myteam/controller/ReportsController.java
View file @
b661afcb
...
@@ -7,7 +7,9 @@ import com.nisum.myteam.model.ReportSeriesRecord;
...
@@ -7,7 +7,9 @@ import com.nisum.myteam.model.ReportSeriesRecord;
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
com.nisum.myteam.model.dao.ResourceAllocation
;
import
com.nisum.myteam.model.dao.ResourceAllocation
;
import
com.nisum.myteam.model.vo.ResourceVO
;
import
com.nisum.myteam.service.IEmployeeService
;
import
com.nisum.myteam.service.IEmployeeService
;
import
com.nisum.myteam.service.IResourceAllocationService
;
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.MongoTemplate
;
import
org.springframework.data.mongodb.core.MongoTemplate
;
...
@@ -44,6 +46,9 @@ public class ReportsController {
...
@@ -44,6 +46,9 @@ public class ReportsController {
@Autowired
@Autowired
private
IEmployeeService
employeeService
;
private
IEmployeeService
employeeService
;
@Autowired
private
IResourceAllocationService
resourceService
;
//Ok Response
//Ok Response
@RequestMapping
(
value
=
"/getEmployeesByFunctionalGroup1"
,
@RequestMapping
(
value
=
"/getEmployeesByFunctionalGroup1"
,
method
=
RequestMethod
.
GET
,
method
=
RequestMethod
.
GET
,
...
@@ -105,12 +110,15 @@ public class ReportsController {
...
@@ -105,12 +110,15 @@ public class ReportsController {
}
}
/*
//Not Ok Response
//Not Ok Response
@RequestMapping(value = "/getBillabilityDetailsByAccount",
@RequestMapping(value = "/getBillabilityDetailsByAccount",
method = RequestMethod.GET,
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<ColumnChartData> getBillabilityDetailsByAccount()
public ResponseEntity<ColumnChartData> getBillabilityDetailsByAccount()
throws MyTeamException {
throws MyTeamException {
ProjectionOperation projectToMatchModel = project()
ProjectionOperation projectToMatchModel = project()
.andExpression("account").as("categories")
.andExpression("account").as("categories")
.andExpression("billableStatus").as("seriesName")
.andExpression("billableStatus").as("seriesName")
...
@@ -122,9 +130,9 @@ public class ReportsController {
...
@@ -122,9 +130,9 @@ public class ReportsController {
.as("count"),
.as("count"),
projectToMatchModel);
projectToMatchModel);
// Convert the aggregation result into a List
// Convert the aggregation result into a List
AggregationResults
<
ColumnChartData
>
groupResults
=
mongoTemplate
AggregationResults<ColumnChartData> groupResults = mongoTemplate.aggregate(aggregate, ResourceAllocation.class,
.
aggregate
(
aggregate
,
ResourceAllocation
.
class
,
ColumnChartData.class);
ColumnChartData.class);
List<ColumnChartData> result = groupResults.getMappedResults();
List<ColumnChartData> result = groupResults.getMappedResults();
List<String> statusList = new ArrayList();
List<String> statusList = new ArrayList();
...
@@ -172,6 +180,7 @@ public class ReportsController {
...
@@ -172,6 +180,7 @@ public class ReportsController {
return new ResponseEntity<>(reportData, HttpStatus.OK);
return new ResponseEntity<>(reportData, HttpStatus.OK);
}
}
*/
//ok response
//ok response
@RequestMapping
(
value
=
"/getBillabilityDetailsByMonth"
,
@RequestMapping
(
value
=
"/getBillabilityDetailsByMonth"
,
...
@@ -312,20 +321,22 @@ public class ReportsController {
...
@@ -312,20 +321,22 @@ public class ReportsController {
return
new
ResponseEntity
<>(
empList
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
empList
,
HttpStatus
.
OK
);
}
}
// @RequestMapping(value = "/fetchEmployeeDetailsByAccountBillability",
@RequestMapping
(
value
=
"/fetchEmployeeDetailsByAccountBillability"
,
// method = RequestMethod.GET,
method
=
RequestMethod
.
GET
,
// produces = MediaType.APPLICATION_JSON_VALUE)
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
// public ResponseEntity<List<ResourceAllocation>> fetchEmployeeDetailsByAccountBillability(
public
ResponseEntity
<
List
<
ResourceVO
>>
fetchEmployeeDetailsByAccountBillability
(
// @RequestParam("account") String account,
@RequestParam
(
"account"
)
String
account
,
// @RequestParam("billabilityStatus") String billabilityStatus)
@RequestParam
(
"billabilityStatus"
)
String
billabilityStatus
)
// throws MyTeamException {
throws
MyTeamException
{
// List<ResourceAllocation> resourcesList = new ArrayList<>();
List
<
ResourceVO
>
resourcesList
=
new
ArrayList
<>();
// if (account != null && !account.isEmpty()) {
if
(
account
!=
null
&&
!
account
.
isEmpty
())
{
// resourcesList = resourceService.findByAccountAndActiveAndBillableStatus(
// account, true, billabilityStatus);
resourcesList
=
resourceService
.
getAllResourcesVO
();
// }
// return new ResponseEntity<>(resourcesList, HttpStatus.OK);
}
// }
return
new
ResponseEntity
<>(
resourcesList
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/fetchEmployeeDetailsByDateBillability"
,
@RequestMapping
(
value
=
"/fetchEmployeeDetailsByDateBillability"
,
method
=
RequestMethod
.
GET
,
method
=
RequestMethod
.
GET
,
...
...
src/main/java/com/nisum/myteam/controller/ResourceAllocationController.java
View file @
b661afcb
...
@@ -82,7 +82,7 @@ public class ResourceAllocationController {
...
@@ -82,7 +82,7 @@ public class ResourceAllocationController {
if
(
resourceAllocService
.
isResourceExistsForProject
(
resourceAllocationReq
.
getEmployeeId
(),
resourceAllocationReq
.
getProjectId
()))
{
if
(
resourceAllocService
.
isResourceExistsForProject
(
resourceAllocationReq
.
getEmployeeId
(),
resourceAllocationReq
.
getProjectId
()))
{
resourceAllocService
.
updatePreviousResource
(
resourceAllocationReq
,
loginEmpId
);
resourceAllocService
.
updatePreviousResource
(
resourceAllocationReq
,
loginEmpId
);
resourceAllocService
.
updateResource
(
resourceAllocationReq
,
loginEmpId
);
resourceAllocService
.
insertNewResourceAllocWithNewStatus
(
resourceAllocationReq
,
loginEmpId
);
}
}
ResponseDetails
createResponseDetails
=
new
ResponseDetails
(
new
Date
(),
Integer
.
parseInt
(
resourceAllocService
.
respMap
.
get
(
"statusCode"
).
toString
()),
resourceAllocService
.
respMap
.
get
(
"message"
).
toString
(),
ResponseDetails
createResponseDetails
=
new
ResponseDetails
(
new
Date
(),
Integer
.
parseInt
(
resourceAllocService
.
respMap
.
get
(
"statusCode"
).
toString
()),
resourceAllocService
.
respMap
.
get
(
"message"
).
toString
(),
...
...
src/main/java/com/nisum/myteam/service/IResourceAllocationService.java
View file @
b661afcb
...
@@ -13,32 +13,19 @@ public interface IResourceAllocationService {
...
@@ -13,32 +13,19 @@ public interface IResourceAllocationService {
ResourceAllocation
addResourceAllocation
(
ResourceAllocation
resourceAllocation
,
String
loginEmpId
)
throws
MyTeamException
;
ResourceAllocation
addResourceAllocation
(
ResourceAllocation
resourceAllocation
,
String
loginEmpId
)
throws
MyTeamException
;
void
updateResource
(
ResourceAllocation
resourceAllocation
,
String
loginEmpId
)
throws
MyTeamException
;
public
void
updateExistedResourceAlloc
(
ResourceAllocation
resourceAlloc
)
throws
MyTeamException
;
void
deleteResource
(
ResourceAllocation
resource
,
String
loginEmpId
)
;
public
void
insertNewResourceAllocWithNewStatus
(
ResourceAllocation
resourceAllocReq
,
String
loginEmpId
)
throws
MyTeamException
;
void
deleteResource
(
ResourceAllocation
resource
,
String
loginEmpId
);
List
<
ResourceAllocation
>
getAllResourcesForAllActiveProjects
();
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
<
ResourceAllocation
>
getResourcesSortByBillingStartDate
(
String
employeeId
);
// List<Resource> getAllResourcesForProject(String projectId, String status);
// List<Resource> getResourcesForEmployee(String empId);
// List<Resource> getAllResourcesForProject(String projectId);
List
<
ResourceVO
>
getActiveResources
(
String
empId
);
List
<
ResourceVO
>
getActiveResources
(
String
empId
);
// List<Resource> getResourcesForShift(String shift);
public
List
<
ResourceVO
>
getResourcesForProject
(
String
projectId
,
String
statusFlag
);
public
List
<
ResourceVO
>
getResourcesForProject
(
String
projectId
,
String
statusFlag
);
public
List
<
ResourceAllocation
>
getResourcesUnderDeliveryLead
(
String
empId
);
public
List
<
ResourceAllocation
>
getResourcesUnderDeliveryLead
(
String
empId
);
...
@@ -61,5 +48,21 @@ public interface IResourceAllocationService {
...
@@ -61,5 +48,21 @@ public interface IResourceAllocationService {
public
void
deleteResourcesUnderProject
(
String
projectId
);
public
void
deleteResourcesUnderProject
(
String
projectId
);
public
ResourceAllocation
addResourceToBenchProject
(
Employee
employee
,
String
loginEmpId
)
throws
MyTeamException
;
// List<Resource> getResourcesForShift(String shift);
// List<Resource> getAllResourcesForProject(String projectId, String status);
// List<Resource> getResourcesForEmployee(String empId);
// List<Resource> getAllResourcesForProject(String projectId);
// Resource save(Resource resource);
// void addResources(Employee employee, String loginEmpId);
// void inactivateResource(Employee employeeReq, Employee employeeUpdated, String loginEmpId);
}
}
src/main/java/com/nisum/myteam/service/impl/EmployeeService.java
View file @
b661afcb
...
@@ -48,6 +48,8 @@ public class EmployeeService implements IEmployeeService {
...
@@ -48,6 +48,8 @@ public class EmployeeService implements IEmployeeService {
@Autowired
@Autowired
private
IEmployeeLocationService
empLocationService
;
private
IEmployeeLocationService
empLocationService
;
@Autowired
private
IResourceAllocationService
resourceService
;
@Override
@Override
public
Employee
createEmployee
(
Employee
employee
,
String
loginEmpId
)
throws
MyTeamException
{
public
Employee
createEmployee
(
Employee
employee
,
String
loginEmpId
)
throws
MyTeamException
{
...
@@ -56,7 +58,7 @@ public class EmployeeService implements IEmployeeService {
...
@@ -56,7 +58,7 @@ public class EmployeeService implements IEmployeeService {
employee
.
setModifiedBy
(
loginEmpId
);
employee
.
setModifiedBy
(
loginEmpId
);
// adding employee to Bench Allocation
// adding employee to Bench Allocation
// projectService.addNewBeanchAllocation
(employee, loginEmpId);
resourceService
.
addResourceToBenchProject
(
employee
,
loginEmpId
);
// Saving employee Location Details.
// Saving employee Location Details.
empLocationService
.
save
(
employee
);
empLocationService
.
save
(
employee
);
...
...
src/main/java/com/nisum/myteam/service/impl/ProjectService.java
View file @
b661afcb
...
@@ -183,9 +183,6 @@ public class ProjectService implements IProjectService {
...
@@ -183,9 +183,6 @@ public class ProjectService implements IProjectService {
}
}
@Override
@Override
public
List
<
EmpLoginData
>
employeeLoginsBasedOnDate
(
long
id
,
public
List
<
EmpLoginData
>
employeeLoginsBasedOnDate
(
long
id
,
String
fromDate
,
String
toDate
)
throws
MyTeamException
{
String
fromDate
,
String
toDate
)
throws
MyTeamException
{
...
@@ -241,12 +238,9 @@ public class ProjectService implements IProjectService {
...
@@ -241,12 +238,9 @@ public class ProjectService implements IProjectService {
@Override
@Override
public
List
<
Project
>
getOnlyActiveProjects
()
{
public
List
<
Project
>
getOnlyActiveProjects
()
{
return
getAllProjects
().
stream
()
return
getAllProjects
().
stream
()
.
filter
(
project
->
!
project
.
getStatus
().
equalsIgnoreCase
(
"Completed"
))
.
filter
(
project
->
!
project
.
getStatus
().
equalsIgnoreCase
(
"Completed"
))
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
}
}
...
@@ -378,16 +372,12 @@ public class ProjectService implements IProjectService {
...
@@ -378,16 +372,12 @@ public class ProjectService implements IProjectService {
}
}
public
List
<
Project
>
getActiveProjects
()
throws
MyTeamException
{
public
List
<
Project
>
getActiveProjects
()
throws
MyTeamException
{
List
<
Project
>
projects
=
projectRepo
.
findAll
();
List
<
Project
>
projects
=
projectRepo
.
findAll
();
return
projects
.
stream
().
filter
(
project
->
project
.
getStatus
().
equalsIgnoreCase
(
MyTeamUtils
.
ACTIVE
)).
collect
(
Collectors
.
toList
());
return
projects
.
stream
().
filter
(
project
->
project
.
getStatus
().
equalsIgnoreCase
(
MyTeamUtils
.
ACTIVE
)).
collect
(
Collectors
.
toList
());
}
}
public
Project
getProjectByProjectId
(
String
projectId
)
{
public
Project
getProjectByProjectId
(
String
projectId
)
{
Project
project
=
null
;
Project
project
=
null
;
if
(
StringUtils
.
isNotBlank
(
projectId
))
{
if
(
StringUtils
.
isNotBlank
(
projectId
))
{
...
@@ -404,10 +394,55 @@ public class ProjectService implements IProjectService {
...
@@ -404,10 +394,55 @@ public class ProjectService implements IProjectService {
}
}
}
}
// public Resource addNewBeanchAllocation(Employee employee, String loginEmpId) {
// ResourceAllocation resourcePersisted = null;
// Resource resourceBench = new Resource();
// resourceBench.setAccount(MyTeamUtils.BENCH_ACCOUNT);
// resourceBench.setBillableStatus(MyTeamUtils.BENCH_BILLABILITY_STATUS);
// resourceBench.setDesignation(employee.getDesignation());
// resourceBench.setEmailId(employee.getEmailId());
// resourceBench.setEmployeeId(employee.getEmployeeId());
// resourceBench.setMobileNumber(employee.getMobileNumber());
//
// resourceBench.setEmployeeName(employee.getEmployeeName());
// resourceBench.setProjectId(MyTeamUtils.BENCH_PROJECT_ID);
// resourceBench.setStartDate(employee.getDateOfJoining() != null ? employee.getDateOfJoining() : new Date());
//
// Project project = projectRepo.findByProjectId(MyTeamUtils.BENCH_PROJECT_ID);
// resourceBench.setProjectName(project.getProjectName());
// resourceBench.setAccountId(project.getAccountId());
// resourceBench.setDomainId(project.getDomainId());
// resourceBench.setShift(employee.getShift());
// resourceBench.setRole(employee.getRole());
//
// if (null != employee.getEmpStatus() && employee.getEmpStatus().trim().equalsIgnoreCase(MyTeamUtils.IN_ACTIVE_SPACE)) {
// resourceBench.setEndDate(employee.getEndDate());
// resourceBench.setActive(false);
// } else {
// employee.setEmpStatus(MyTeamUtils.ACTIVE);
// resourceBench.setEndDate(project.getProjectEndDate());
// resourceBench.setActive(true);
// }
//
// try {
// resourcePersisted = resourceService.addResource(resourceBench, loginEmpId);
// } catch (MyTeamException e) {
// e.printStackTrace();
// }
//
// return resourcePersisted;
// }
//List<Resource> existingTeammates = resourceRepo.findByProjectId(project.getProjectId());
//List<Resource> existingTeammates = resourceRepo.findByProjectId(project.getProjectId());
// for (Resource existingTeammate : existingTeammates) {
// for (Resource existingTeammate : existingTeammates) {
// existingTeammate.setActive(false);
// existingTeammate.setActive(false);
...
@@ -504,41 +539,5 @@ public class ProjectService implements IProjectService {
...
@@ -504,41 +539,5 @@ public class ProjectService implements IProjectService {
// public Resource addNewBeanchAllocation(Employee employee, String loginEmpId) {
// Resource resourcePersisted = null;
// Resource resourceBench = new Resource();
// resourceBench.setAccount(MyTeamUtils.BENCH_ACCOUNT);
// resourceBench.setBillableStatus(MyTeamUtils.BENCH_BILLABILITY_STATUS);
// resourceBench.setDesignation(employee.getDesignation());
// resourceBench.setEmailId(employee.getEmailId());
// resourceBench.setEmployeeId(employee.getEmployeeId());
// resourceBench.setMobileNumber(employee.getMobileNumber());
//
// resourceBench.setEmployeeName(employee.getEmployeeName());
// resourceBench.setProjectId(MyTeamUtils.BENCH_PROJECT_ID);
// resourceBench.setStartDate(employee.getDateOfJoining() != null ? employee.getDateOfJoining() : new Date());
//
// Project project = projectRepo.findByProjectId(MyTeamUtils.BENCH_PROJECT_ID);
// resourceBench.setProjectName(project.getProjectName());
// resourceBench.setAccountId(project.getAccountId());
// resourceBench.setDomainId(project.getDomainId());
// resourceBench.setShift(employee.getShift());
// resourceBench.setRole(employee.getRole());
//
// if (null != employee.getEmpStatus() && employee.getEmpStatus().trim().equalsIgnoreCase(MyTeamUtils.IN_ACTIVE_SPACE)) {
// resourceBench.setEndDate(employee.getEndDate());
// resourceBench.setActive(false);
// } else {
// employee.setEmpStatus(MyTeamUtils.ACTIVE);
// resourceBench.setEndDate(project.getProjectEndDate());
// resourceBench.setActive(true);
// }
//
// try {
// resourcePersisted = resourceService.addResource(resourceBench, loginEmpId);
// } catch (MyTeamException e) {
// e.printStackTrace();
// }
//
// return resourcePersisted;
// }
\ No newline at end of file
src/main/java/com/nisum/myteam/service/impl/ResourceAllocationService.java
View file @
b661afcb
...
@@ -65,17 +65,7 @@ public class ResourceAllocationService implements IResourceAllocationService {
...
@@ -65,17 +65,7 @@ public class ResourceAllocationService implements IResourceAllocationService {
}
}
public
void
updateResourceAlloc
(
ResourceAllocation
resourceAlloc
)
{
if
(
resourceAlloc
!=
null
)
{
ResourceAllocation
resourcePers
=
resourceAllocationRepo
.
save
(
resourceAlloc
);
respMap
.
put
(
"statusCode"
,
801
);
respMap
.
put
(
"message"
,
"resource has been updated"
);
respMap
.
put
(
"resourceObj"
,
resourcePers
);
}
}
public
void
updatePreviousResource
(
ResourceAllocation
resourceAllocReq
,
String
loginEmpId
)
throws
MyTeamException
{
public
void
updatePreviousResource
(
ResourceAllocation
resourceAllocReq
,
String
loginEmpId
)
throws
MyTeamException
{
...
@@ -91,11 +81,32 @@ public class ResourceAllocationService implements IResourceAllocationService {
...
@@ -91,11 +81,32 @@ public class ResourceAllocationService implements IResourceAllocationService {
//resourceAllocPrev.setBillingEndDate(); //adding resource.
//resourceAllocPrev.setBillingEndDate(); //adding resource.
log
.
info
(
"After setting the date:::before saving the Resource::"
+
resourceAllocPrev
);
log
.
info
(
"After setting the date:::before saving the Resource::"
+
resourceAllocPrev
);
this
.
updateResourceAlloc
(
resourceAllocPrev
);
this
.
updateExistedResourceAlloc
(
resourceAllocPrev
);
}
}
public
void
updateExistedResourceAlloc
(
ResourceAllocation
resourceAlloc
)
{
if
(
resourceAlloc
!=
null
)
{
ResourceAllocation
resourcePers
=
resourceAllocationRepo
.
save
(
resourceAlloc
);
respMap
.
put
(
"statusCode"
,
801
);
respMap
.
put
(
"message"
,
"resource has been updated"
);
respMap
.
put
(
"resourceObj"
,
resourcePers
);
}
}
}
}
public
void
insertNewResourceAllocWithNewStatus
(
ResourceAllocation
resourceAllocReq
,
String
loginEmpId
)
throws
MyTeamException
{
resourceAllocReq
.
setId
(
null
);
ResourceAllocation
resourceAllocationPers
=
resourceAllocationRepo
.
insert
(
resourceAllocReq
);
respMap
.
put
(
"statusCode"
,
801
);
respMap
.
put
(
"message"
,
"Resource updated successfully"
);
respMap
.
put
(
"resourceObj"
,
resourceAllocationPers
);
}
public
boolean
validateBillingStartEndDateAgainstProjectStartEndDate
(
ResourceAllocation
resourceAllocation
,
String
loginEmpId
)
throws
MyTeamException
{
public
boolean
validateBillingStartEndDateAgainstProjectStartEndDate
(
ResourceAllocation
resourceAllocation
,
String
loginEmpId
)
throws
MyTeamException
{
...
@@ -162,24 +173,22 @@ public class ResourceAllocationService implements IResourceAllocationService {
...
@@ -162,24 +173,22 @@ public class ResourceAllocationService implements IResourceAllocationService {
if
(
resourceListWithLatestRecord
!=
null
&&
resourceListWithLatestRecord
.
size
()
>
0
)
{
if
(
resourceListWithLatestRecord
!=
null
&&
resourceListWithLatestRecord
.
size
()
>
0
)
{
ResourceAllocation
resourceAllocPrev
=
resourceListWithLatestRecord
.
get
(
0
);
//latest resource record.
ResourceAllocation
resourceAllocPrev
=
resourceListWithLatestRecord
.
get
(
0
);
//latest resource record.
message
=
"Resource "
+
resourceAllocPrev
.
getEmployeeId
()
+
" already Assigned to the "
if
(!
resourceAllocPrev
.
getProjectId
().
equalsIgnoreCase
(
MyTeamUtils
.
BENCH_PROJECT_ID
))
{
+
projectService
.
getProjectByProjectId
(
resourceAllocPrev
.
getProjectId
()).
getProjectName
()
message
=
"Resource "
+
resourceAllocPrev
.
getEmployeeId
()
+
" already Assigned to the "
+
" Project"
+
" from "
+
resourceAllocPrev
.
getBillingStartDate
()
+
"to "
+
resourceAllocPrev
.
getBillingEndDate
();
+
projectService
.
getProjectByProjectId
(
resourceAllocPrev
.
getProjectId
()).
getProjectName
()
isAssigned
=
true
;
+
" Project"
+
" from "
+
resourceAllocPrev
.
getBillingStartDate
()
+
"to "
+
resourceAllocPrev
.
getBillingEndDate
();
respMap
.
put
(
"statusCode"
,
815
);
isAssigned
=
true
;
respMap
.
put
(
"message"
,
message
);
respMap
.
put
(
"statusCode"
,
815
);
respMap
.
put
(
"message"
,
message
);
}
}
}
return
isAssigned
;
return
isAssigned
;
}
}
public
void
updateResource
(
ResourceAllocation
resourceAllocReq
,
String
loginEmpId
)
throws
MyTeamException
{
ResourceAllocation
resourceAllocationPers
=
resourceAllocationRepo
.
save
(
resourceAllocReq
);
respMap
.
put
(
"statusCode"
,
801
);
respMap
.
put
(
"message"
,
"Resource updated successfully"
);
respMap
.
put
(
"resourceObj"
,
resourceAllocationPers
);
}
public
void
deleteResource
(
ResourceAllocation
resourceReq
,
String
loginEmpId
)
{
public
void
deleteResource
(
ResourceAllocation
resourceReq
,
String
loginEmpId
)
{
List
<
ResourceAllocation
>
resourcesList
=
resourceAllocationRepo
.
findByEmployeeIdAndProjectId
(
resourceReq
.
getEmployeeId
(),
resourceReq
.
getProjectId
());
List
<
ResourceAllocation
>
resourcesList
=
resourceAllocationRepo
.
findByEmployeeIdAndProjectId
(
resourceReq
.
getEmployeeId
(),
resourceReq
.
getProjectId
());
...
@@ -538,6 +547,27 @@ public class ResourceAllocationService implements IResourceAllocationService {
...
@@ -538,6 +547,27 @@ public class ResourceAllocationService implements IResourceAllocationService {
}
}
@Override
public
ResourceAllocation
addResourceToBenchProject
(
Employee
employee
,
String
loginEmpId
)
throws
MyTeamException
{
ResourceAllocation
resourcePersisted
=
null
;
ResourceAllocation
resourceBench
=
new
ResourceAllocation
();
resourceBench
.
setProjectId
(
MyTeamUtils
.
BENCH_PROJECT_ID
);
resourceBench
.
setEmployeeId
(
employee
.
getEmployeeId
());
resourceBench
.
setResourceRole
(
employee
.
getRole
());
resourceBench
.
setBillingStartDate
(
employee
.
getDateOfJoining
()
!=
null
?
employee
.
getDateOfJoining
()
:
new
Date
());
resourceBench
.
setBillableStatus
(
MyTeamUtils
.
BENCH_BILLABILITY_STATUS
);
resourceBench
.
setEmployeeId
(
employee
.
getEmployeeId
());
resourceBench
.
setBillingEndDate
(
employee
.
getEndDate
());
resourcePersisted
=
addResourceAllocation
(
resourceBench
,
loginEmpId
);
return
resourcePersisted
;
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment