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
570708e6
Commit
570708e6
authored
Jun 10, 2019
by
vikram singh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated Report By FG service
parent
099feaf1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
35 deletions
+17
-35
ResourceRepo.java
src/main/java/com/nisum/myteam/repository/ResourceRepo.java
+3
-0
IResourceService.java
src/main/java/com/nisum/myteam/service/IResourceService.java
+2
-1
EmployeeService.java
...n/java/com/nisum/myteam/service/impl/EmployeeService.java
+9
-32
ResourceService.java
...n/java/com/nisum/myteam/service/impl/ResourceService.java
+3
-2
No files found.
src/main/java/com/nisum/myteam/repository/ResourceRepo.java
View file @
570708e6
...
...
@@ -7,6 +7,7 @@ import org.springframework.data.mongodb.repository.MongoRepository;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Set
;
public
interface
ResourceRepo
extends
MongoRepository
<
Resource
,
String
>
{
...
...
@@ -24,6 +25,8 @@ public interface ResourceRepo
List
<
Resource
>
findByBillingStartDateGreaterThan
(
Date
billingStartDate
);
List
<
Resource
>
findByBillingStartDateBetween
(
Date
fromDate
,
Date
toDate
);
//Set<Resource> findByBillableStatus(String resourceAllocationStatus);
// List<Resource> findByEmployeeIdAndActive(String employeeId, boolean status);
...
...
src/main/java/com/nisum/myteam/service/IResourceService.java
View file @
570708e6
...
...
@@ -10,6 +10,7 @@ import com.nisum.myteam.model.vo.ResourceVO;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Set
;
public
interface
IResourceService
{
...
...
@@ -64,7 +65,7 @@ public interface IResourceService {
public
List
<
ReserveReportsVO
>
getResourceReportsByBillingStatus
(
String
resourceStatus
);
Lis
t
<
Resource
>
findByBillableStatus
(
String
billableStatus
);
Se
t
<
Resource
>
findByBillableStatus
(
String
billableStatus
);
// List<Resource> getAllResourcesForProject(String projectId, String status);
...
...
src/main/java/com/nisum/myteam/service/impl/EmployeeService.java
View file @
570708e6
...
...
@@ -5,6 +5,7 @@ import java.util.Comparator;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
...
...
@@ -343,40 +344,16 @@ public class EmployeeService implements IEmployeeService {
}
@Override
public
List
<
BillableEmployee
>
getEmployeeDetailsByFGAndBillability
(
String
fGroup
,
String
billableStatus
)
{
List
<
Resource
>
resources
=
resourceService
.
findByBillableStatus
(
billableStatus
);
return
getBillableEmployeeByfunctionalGroup
(
fGroup
,
resources
);
Map
<
String
,
Resource
>
resourceMap
=
resourceService
.
findByBillableStatus
(
billableStatus
).
stream
().
collect
(
Collectors
.
toMap
(
e
->
e
.
getEmployeeId
(),
e
->
e
));
return
employeeRepo
.
findByEmpStatusAndFunctionalGroup
(
ResourceStatus
.
ACTIVE
.
getStatus
(),
fGroup
).
stream
().
filter
(
e
->
resourceMap
.
keySet
().
contains
(
e
.
getEmployeeId
())).
map
(
e
->
mappingBillableEmployee
(
e
,
fGroup
,
resourceMap
)).
collect
(
Collectors
.
toList
());
}
private
List
<
BillableEmployee
>
getBillableEmployeeByfunctionalGroup
(
String
fGroup
,
List
<
Resource
>
resources
)
{
List
<
BillableEmployee
>
employeesForUI
=
new
ArrayList
<>();
List
<
Employee
>
employeeswithFG
=
employeeRepo
.
findByEmpStatusAndFunctionalGroup
(
ResourceStatus
.
ACTIVE
.
getStatus
(),
fGroup
);
for
(
Resource
resourceObj:
resources
)
{
Project
project
=
projectService
.
getProjectByProjectId
(
resourceObj
.
getProjectId
());
for
(
Employee
employee:
employeeswithFG
)
{
if
(
employee
.
getEmployeeId
().
equals
(
resourceObj
.
getEmployeeId
()))
{
BillableEmployee
billableEmployee
=
new
BillableEmployee
();
billableEmployee
.
setEmployeeId
(
resourceObj
.
getEmployeeId
());
billableEmployee
.
setEmployeeName
(
employee
.
getEmployeeName
());
billableEmployee
.
setEmailId
(
employee
.
getEmailId
());
billableEmployee
.
setProjectName
(
project
.
getProjectName
());
billableEmployee
.
setBillingStartDate
(
resourceObj
.
getBillingStartDate
());
billableEmployee
.
setBillableStatus
(
resourceObj
.
getBillableStatus
());
billableEmployee
.
setBillingEndDate
(
resourceObj
.
getBillingEndDate
());
billableEmployee
.
setFunctionalGroup
(
fGroup
);
employeesForUI
.
add
(
billableEmployee
);
}
}
}
return
employeesForUI
;
private
BillableEmployee
mappingBillableEmployee
(
Employee
e
,
String
fGroup
,
Map
<
String
,
Resource
>
resourceMap
)
{
Resource
resource
=
resourceMap
.
get
(
e
.
getEmployeeId
());
Project
project
=
projectService
.
getProjectByProjectId
(
resource
.
getProjectId
());
return
new
BillableEmployee
(
e
.
getEmployeeId
(),
e
.
getEmployeeName
(),
e
.
getEmailId
(),
project
.
getProjectName
(),
resource
.
getBillableStatus
(),
resource
.
getBillingStartDate
(),
resource
.
getBillingEndDate
(),
fGroup
);
}
}
src/main/java/com/nisum/myteam/service/impl/ResourceService.java
View file @
570708e6
...
...
@@ -843,8 +843,9 @@ public class ResourceService implements IResourceService {
return
allocationList
;
}
@Override
public
List
<
Resource
>
findByBillableStatus
(
String
billableStatus
)
{
return
resourceRepo
.
findByBillableStatus
(
billableStatus
);
public
Set
<
Resource
>
findByBillableStatus
(
String
billableStatus
)
{
List
<
String
>
uniqueEmployeeIds
=
new
ArrayList
<>();
return
resourceRepo
.
findByBillableStatus
(
billableStatus
).
stream
().
filter
(
e
->!
uniqueEmployeeIds
.
contains
(
e
.
getEmployeeId
())).
map
(
e
->{
uniqueEmployeeIds
.
add
(
e
.
getEmployeeId
());
return
e
;}).
collect
(
Collectors
.
toSet
());
}
...
...
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