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
773f36fc
Commit
773f36fc
authored
May 14, 2019
by
Vijay Akula
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Provided the details required for MyTeam Page
parent
bc7eee70
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
97 additions
and
6 deletions
+97
-6
ResourceAllocationController.java
...nisum/myteam/controller/ResourceAllocationController.java
+1
-1
ResourceVO.java
src/main/java/com/nisum/myteam/model/vo/ResourceVO.java
+2
-0
IResourceAllocationService.java
.../com/nisum/myteam/service/IResourceAllocationService.java
+1
-1
ResourceAllocationService.java
.../nisum/myteam/service/impl/ResourceAllocationService.java
+93
-4
No files found.
src/main/java/com/nisum/myteam/controller/ResourceAllocationController.java
View file @
773f36fc
...
...
@@ -190,7 +190,7 @@ public class ResourceAllocationController {
public
ResponseEntity
<?>
getActiveResources
(
@RequestParam
(
value
=
"employeeId"
,
required
=
false
)
String
employeeId
,
HttpServletRequest
request
)
throws
MyTeamException
{
if
(
StringUtils
.
isNotBlank
(
employeeId
))
{
List
<
Resource
Allocation
>
employeesRoles
=
resourceAllocService
.
getActiveResources
(
employeeId
);
List
<
Resource
VO
>
employeesRoles
=
resourceAllocService
.
getActiveResources
(
employeeId
);
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Resources have been retrieved successfully"
,
"List of Resources who are active in the projects"
,
employeesRoles
,
request
.
getRequestURI
(),
"Resource List details"
,
null
);
...
...
src/main/java/com/nisum/myteam/model/vo/ResourceVO.java
View file @
773f36fc
...
...
@@ -35,4 +35,6 @@ public class ResourceVO {
private
String
resourceStatus
;
private
String
resourceRole
;
private
String
mobileNo
;
}
src/main/java/com/nisum/myteam/service/IResourceAllocationService.java
View file @
773f36fc
...
...
@@ -36,7 +36,7 @@ public interface IResourceAllocationService {
// List<Resource> getAllResourcesForProject(String projectId);
List
<
Resource
Allocation
>
getActiveResources
(
String
empId
);
List
<
Resource
VO
>
getActiveResources
(
String
empId
);
...
...
src/main/java/com/nisum/myteam/service/impl/ResourceAllocationService.java
View file @
773f36fc
...
...
@@ -207,17 +207,53 @@ public class ResourceAllocationService implements IResourceAllocationService {
}
@Override
public
List
<
Resource
Allocation
>
getActiveResources
(
String
empId
)
{
List
<
Resource
Allocation
>
resourcesList
=
new
ArrayList
<>();
public
List
<
Resource
VO
>
getActiveResources
(
String
empId
)
{
List
<
Resource
VO
>
resourcesList
=
new
ArrayList
<>();
for
(
ResourceAllocation
resource
:
resourceAllocationRepo
.
findByEmployeeId
(
empId
))
{
//if (resource.isActive()) {
if
(
resource
.
getBillingEndDate
().
compareTo
(
new
Date
())
>
0
)
{
resourcesList
.
addAll
(
getAllResourcesForProjec
t
(
resource
.
getProjectId
()));
resourcesList
.
addAll
(
prepareProjectTeamMembersLis
t
(
resource
.
getProjectId
()));
}
}
return
resourcesList
;
}
public
List
<
ResourceVO
>
prepareProjectTeamMembersList
(
String
projectId
)
{
List
<
ResourceVO
>
finalResourcesList
=
new
ArrayList
<>();
Employee
employee
=
null
;
for
(
ResourceAllocation
resource
:
getAllResourcesForProject
(
projectId
))
{
ResourceVO
resourceVO
=
new
ResourceVO
();
resourceVO
.
setId
(
resource
.
getId
());
resourceVO
.
setProjectId
(
resource
.
getProjectId
());
resourceVO
.
setEmployeeId
(
resource
.
getEmployeeId
());
employee
=
employeeService
.
getEmployeeById
(
resource
.
getEmployeeId
());
resourceVO
.
setEmployeeName
(
employee
.
getEmployeeName
());
resourceVO
.
setDesignation
(
employee
.
getDesignation
());
resourceVO
.
setEmailId
(
employee
.
getEmailId
());
resourceVO
.
setMobileNo
(
employee
.
getMobileNumber
());
resourceVO
.
setProjectName
(
projectService
.
getProjectByProjectId
(
resource
.
getProjectId
()).
getProjectName
());
resourceVO
.
setBillableStatus
(
resource
.
getBillableStatus
());
resourceVO
.
setBillingStartDate
(
resource
.
getBillingStartDate
());
resourceVO
.
setBillingEndDate
(
resource
.
getBillingEndDate
());
resourceVO
.
setResourceRole
(
resource
.
getResourceRole
());
if
(
resource
.
getBillingEndDate
().
compareTo
(
new
Date
())>
0
)
{
resourceVO
.
setResourceStatus
(
ResourceStatus
.
ACTIVE
.
getStatus
());
}
else
{
resourceVO
.
setResourceStatus
(
ResourceStatus
.
IN_ACTIVE
.
getStatus
());
}
finalResourcesList
.
add
(
resourceVO
);
}
return
finalResourcesList
;
}
public
List
<
ResourceAllocation
>
getAllResourcesForProject
(
String
projectId
)
{
return
resourceAllocationRepo
.
findByProjectId
(
projectId
);
}
...
...
@@ -400,3 +436,56 @@ public class ResourceAllocationService implements IResourceAllocationService {
}
// @Override
// public List<ResourceVO> getActiveResources(String empId) {
// List<ResourceVO> finalResourcesList = new ArrayList<>();
//
// List<ResourceAllocation> resourceList = resourceAllocationRepo.findByEmployeeId(empId);
// if (resourceList != null && resourceList.size() > 0) {
//
// ResourceAllocation resourceAlloc=resourceList.get(0);
//
//
//
//
// }
//
// for (ResourceAllocation resource : resourceAllocationRepo.findByEmployeeId(empId)) {
//
// ResourceVO resourceVO=new ResourceVO();
// resourceVO.setEmployeeId(resource.getEmployeeId());
//
// Employee employee=employeeService.getEmployeeById(resource.getEmployeeId());
// resourceVO.setEmployeeName(employee.getEmployeeName());
// resourceVO.setDesignation(employee.getDesignation());
// resourceVO.setEmailId(employee.getEmailId());
// resourceVO.setMobileNo(employee.getMobileNumber());
//
// resourceVO.setProjectName(projectService.getProjectByProjectId(resource.getProjectId()).getProjectName());
//
//
// if (resource.getBillingEndDate().compareTo(new Date()) > 0) {
// finalResourcesList.addAll(getAllResourcesForProject(resource.getProjectId()));
// }
//
//
// }
// return finalResourcesList;
// }
// @Override
// public List<ResourceVO> getActiveResources(String empId) {
// List<ResourceVO> finalResourcesList = new ArrayList<>();
// Employee employee = null;
//
// List<ResourceAllocation> resourceList = resourceAllocationRepo.findByEmployeeId(empId);
// Optional<ResourceAllocation> optionalResource = resourceList.stream().filter(resource -> resource.getBillingEndDate().compareTo(new Date()) > 0).findAny();
// if (optionalResource.isPresent()) {
// finalResourcesList = prepareProjectTeamMembersList(optionalResource.get().getProjectId());
// }
// return finalResourcesList;
// }
\ No newline at end of file
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