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
c0b5dfaa
Commit
c0b5dfaa
authored
Feb 14, 2020
by
Mallikarjun Yerrabothu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pie chart related changes
parent
d07ece5c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
9 deletions
+23
-9
IEmployeeService.java
src/main/java/com/nisum/myteam/service/IEmployeeService.java
+2
-1
EmployeeService.java
...n/java/com/nisum/myteam/service/impl/EmployeeService.java
+6
-1
ReportService.java
...ain/java/com/nisum/myteam/service/impl/ReportService.java
+15
-7
No files found.
src/main/java/com/nisum/myteam/service/IEmployeeService.java
View file @
c0b5dfaa
...
...
@@ -7,6 +7,7 @@ import com.nisum.myteam.model.dao.Employee;
import
org.springframework.stereotype.Service
;
import
java.text.ParseException
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Set
;
...
...
@@ -56,7 +57,7 @@ public interface IEmployeeService {
public
List
<
Employee
>
getEmployeesByEmpStatusAndShift
(
String
empStatus
,
String
shift
);
public
List
<
Employee
>
getAllEmployeeListByFunGrps
(
List
<
String
>
functionalGroupList
);
public
List
<
Employee
>
getAllEmployeeListByFunGrps
(
List
<
String
>
functionalGroupList
,
Date
onDate
);
public
List
<
Employee
>
getEmployeesByDesignation
(
String
designation
);
...
...
src/main/java/com/nisum/myteam/service/impl/EmployeeService.java
View file @
c0b5dfaa
...
...
@@ -484,10 +484,15 @@ public class EmployeeService implements IEmployeeService {
return
employeeRepo
.
findByEmployeeId
(
employeeId
);
}
public
List
<
Employee
>
getAllEmployeeListByFunGrps
(
List
<
String
>
functionalGroupList
){
public
List
<
Employee
>
getAllEmployeeListByFunGrps
(
List
<
String
>
functionalGroupList
,
Date
onDate
){
Query
query
=
new
Query
(
Criteria
.
where
(
"functionalGroup"
).
in
(
functionalGroupList
));
List
<
Employee
>
employeePersistedList
=
mongoTemplate
.
find
(
query
,
Employee
.
class
);
employeePersistedList
.
removeIf
(
e
->
!
filterEmployeesByDate
(
onDate
,
e
));
return
employeePersistedList
;
}
private
boolean
filterEmployeesByDate
(
Date
onDate
,
Employee
e
)
{
return
onDate
.
after
(
e
.
getDateOfJoining
())
&&
Optional
.
ofNullable
(
e
.
getEndDate
()).
isPresent
()
?
onDate
.
before
(
e
.
getEndDate
()):
true
;
}
}
src/main/java/com/nisum/myteam/service/impl/ReportService.java
View file @
c0b5dfaa
...
...
@@ -65,7 +65,8 @@ public class ReportService implements IReportService {
float
nonBillPer
;
List
<
Employee
>
employeeList
=
new
ArrayList
<>();
if
(
byType
.
equals
(
"AllFunctionalOrgs"
))
{
employeeList
=
getEmployeesByFunctionalGroup
(
category
);
employeeList
=
getEmployeesByFunctionalGroup
(
category
,
onDate
);
}
else
if
(
byType
.
equals
(
"Account"
)){
employeeList
=
getEmployeeByAccounts
(
category
,
onDate
);
}
...
...
@@ -110,8 +111,10 @@ public class ReportService implements IReportService {
return
empList
;
}
private
List
<
Employee
>
getEmployeesByFunctionalGroup
(
String
functionalGroup
){
return
employeeService
.
getEmployeesByFunctionalGrp
(
functionalGroup
);
private
List
<
Employee
>
getEmployeesByFunctionalGroup
(
String
functionalGroup
,
Date
onDate
){
List
<
Employee
>
employeeList
=
employeeService
.
getEmployeesByFunctionalGrp
(
functionalGroup
);
employeeList
.
removeIf
(
e
->
!
filterEmployeesByDate
(
onDate
,
e
));
return
employeeList
;
}
private
List
<
Employee
>
getEmployeeByAccounts
(
String
accountName
,
Date
onDate
){
...
...
@@ -126,7 +129,7 @@ public class ReportService implements IReportService {
employeeList
.
add
(
employeeService
.
getEmployeeById
(
r
.
getEmployeeId
()));
});
});
employeeList
.
removeIf
(
e
->
!
filterEmployeesByDate
(
onDate
,
e
));
return
employeeList
;
}
...
...
@@ -134,6 +137,7 @@ public class ReportService implements IReportService {
public
List
<
Reports
>
getEmployeeDetailsByFGAndBillability
(
String
fGroup
,
String
billableStatus
,
Date
onDate
)
throws
MyTeamException
{
List
<
Employee
>
employeesByFG
=
employeeService
.
getEmployeesByFunctionalGrp
(
fGroup
);
employeesByFG
.
removeIf
(
e
->
!
filterEmployeesByDate
(
onDate
,
e
));
return
resultantEmployeeWithBillability
(
employeesByFG
,
billableStatus
,
onDate
);
}
...
...
@@ -152,13 +156,13 @@ public class ReportService implements IReportService {
@Override
public
ReportVo
getPieChartReport
(
String
byType
,
Date
onDate
)
throws
MyTeamException
{
List
<
Employee
>
employeeList
=
employeeService
.
getAllEmployeeListByFunGrps
(
functionalGroupService
.
getAllBillableFunctionalGroups
().
stream
().
collect
(
Collectors
.
mapping
(
FunctionalGroup:
:
getName
,
Collectors
.
toList
())));
List
<
Employee
>
employeeList
=
employeeService
.
getAllEmployeeListByFunGrps
(
functionalGroupService
.
getAllBillableFunctionalGroups
().
stream
().
collect
(
Collectors
.
mapping
(
FunctionalGroup:
:
getName
,
Collectors
.
toList
()))
,
onDate
);
return
preparePieChartData
(
byType
,
onDate
,
employeeList
);
}
@Override
public
List
<
Reports
>
getEmployeeDetailsByBillabilityType
(
String
billabilityType
,
Date
onDate
)
throws
MyTeamException
{
List
<
Employee
>
employeeList
=
employeeService
.
getAllEmployeeListByFunGrps
(
functionalGroupService
.
getAllBillableFunctionalGroups
().
stream
().
collect
(
Collectors
.
mapping
(
FunctionalGroup:
:
getName
,
Collectors
.
toList
())));
List
<
Employee
>
employeeList
=
employeeService
.
getAllEmployeeListByFunGrps
(
functionalGroupService
.
getAllBillableFunctionalGroups
().
stream
().
collect
(
Collectors
.
mapping
(
FunctionalGroup:
:
getName
,
Collectors
.
toList
()))
,
onDate
);
return
resultantEmployeeWithBillability
(
employeeList
,
billabilityType
,
onDate
);
}
...
...
@@ -256,4 +260,8 @@ public class ReportService implements IReportService {
reportVo
.
getSeriesDataList
().
add
(
traineeObj
);
return
reportVo
;
}
private
boolean
filterEmployeesByDate
(
Date
onDate
,
Employee
e
)
{
//System.out.println(e.getEndDate() + " : Empty Value : "+ Optional.ofNullable(e.getEndDate()).isPresent()+ " Emp "+e);
return
onDate
.
after
(
e
.
getDateOfJoining
())
&&
Optional
.
ofNullable
(
e
.
getEndDate
()).
isPresent
()
?
onDate
.
before
(
e
.
getEndDate
()):
true
;
}
}
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