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
Hide 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;
...
@@ -7,6 +7,7 @@ import com.nisum.myteam.model.dao.Employee;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.Set
;
...
@@ -56,7 +57,7 @@ public interface IEmployeeService {
...
@@ -56,7 +57,7 @@ public interface IEmployeeService {
public
List
<
Employee
>
getEmployeesByEmpStatusAndShift
(
String
empStatus
,
String
shift
);
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
);
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 {
...
@@ -484,10 +484,15 @@ public class EmployeeService implements IEmployeeService {
return
employeeRepo
.
findByEmployeeId
(
employeeId
);
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
));
Query
query
=
new
Query
(
Criteria
.
where
(
"functionalGroup"
).
in
(
functionalGroupList
));
List
<
Employee
>
employeePersistedList
=
mongoTemplate
.
find
(
query
,
Employee
.
class
);
List
<
Employee
>
employeePersistedList
=
mongoTemplate
.
find
(
query
,
Employee
.
class
);
employeePersistedList
.
removeIf
(
e
->
!
filterEmployeesByDate
(
onDate
,
e
));
return
employeePersistedList
;
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 {
...
@@ -65,7 +65,8 @@ public class ReportService implements IReportService {
float
nonBillPer
;
float
nonBillPer
;
List
<
Employee
>
employeeList
=
new
ArrayList
<>();
List
<
Employee
>
employeeList
=
new
ArrayList
<>();
if
(
byType
.
equals
(
"AllFunctionalOrgs"
))
{
if
(
byType
.
equals
(
"AllFunctionalOrgs"
))
{
employeeList
=
getEmployeesByFunctionalGroup
(
category
);
employeeList
=
getEmployeesByFunctionalGroup
(
category
,
onDate
);
}
else
if
(
byType
.
equals
(
"Account"
)){
}
else
if
(
byType
.
equals
(
"Account"
)){
employeeList
=
getEmployeeByAccounts
(
category
,
onDate
);
employeeList
=
getEmployeeByAccounts
(
category
,
onDate
);
}
}
...
@@ -110,8 +111,10 @@ public class ReportService implements IReportService {
...
@@ -110,8 +111,10 @@ public class ReportService implements IReportService {
return
empList
;
return
empList
;
}
}
private
List
<
Employee
>
getEmployeesByFunctionalGroup
(
String
functionalGroup
){
private
List
<
Employee
>
getEmployeesByFunctionalGroup
(
String
functionalGroup
,
Date
onDate
){
return
employeeService
.
getEmployeesByFunctionalGrp
(
functionalGroup
);
List
<
Employee
>
employeeList
=
employeeService
.
getEmployeesByFunctionalGrp
(
functionalGroup
);
employeeList
.
removeIf
(
e
->
!
filterEmployeesByDate
(
onDate
,
e
));
return
employeeList
;
}
}
private
List
<
Employee
>
getEmployeeByAccounts
(
String
accountName
,
Date
onDate
){
private
List
<
Employee
>
getEmployeeByAccounts
(
String
accountName
,
Date
onDate
){
...
@@ -126,14 +129,15 @@ public class ReportService implements IReportService {
...
@@ -126,14 +129,15 @@ public class ReportService implements IReportService {
employeeList
.
add
(
employeeService
.
getEmployeeById
(
r
.
getEmployeeId
()));
employeeList
.
add
(
employeeService
.
getEmployeeById
(
r
.
getEmployeeId
()));
});
});
});
});
employeeList
.
removeIf
(
e
->
!
filterEmployeesByDate
(
onDate
,
e
));
return
employeeList
;
return
employeeList
;
}
}
@Override
@Override
public
List
<
Reports
>
getEmployeeDetailsByFGAndBillability
(
String
fGroup
,
String
billableStatus
,
Date
onDate
)
public
List
<
Reports
>
getEmployeeDetailsByFGAndBillability
(
String
fGroup
,
String
billableStatus
,
Date
onDate
)
throws
MyTeamException
{
throws
MyTeamException
{
List
<
Employee
>
employeesByFG
=
employeeService
.
getEmployeesByFunctionalGrp
(
fGroup
);
List
<
Employee
>
employeesByFG
=
employeeService
.
getEmployeesByFunctionalGrp
(
fGroup
);
employeesByFG
.
removeIf
(
e
->
!
filterEmployeesByDate
(
onDate
,
e
));
return
resultantEmployeeWithBillability
(
employeesByFG
,
billableStatus
,
onDate
);
return
resultantEmployeeWithBillability
(
employeesByFG
,
billableStatus
,
onDate
);
}
}
...
@@ -152,13 +156,13 @@ public class ReportService implements IReportService {
...
@@ -152,13 +156,13 @@ public class ReportService implements IReportService {
@Override
@Override
public
ReportVo
getPieChartReport
(
String
byType
,
Date
onDate
)
throws
MyTeamException
{
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
);
return
preparePieChartData
(
byType
,
onDate
,
employeeList
);
}
}
@Override
@Override
public
List
<
Reports
>
getEmployeeDetailsByBillabilityType
(
String
billabilityType
,
Date
onDate
)
throws
MyTeamException
{
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
);
return
resultantEmployeeWithBillability
(
employeeList
,
billabilityType
,
onDate
);
}
}
...
@@ -256,4 +260,8 @@ public class ReportService implements IReportService {
...
@@ -256,4 +260,8 @@ public class ReportService implements IReportService {
reportVo
.
getSeriesDataList
().
add
(
traineeObj
);
reportVo
.
getSeriesDataList
().
add
(
traineeObj
);
return
reportVo
;
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