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
c09dddb7
Commit
c09dddb7
authored
Feb 13, 2020
by
Ashok Kumar K
Browse files
Options
Browse Files
Download
Plain Diff
implementation of Manage Designation page
parents
2c1ef7be
123699ea
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
225 additions
and
44 deletions
+225
-44
FunctionalGroupController.java
...om/nisum/myteam/controller/FunctionalGroupController.java
+5
-4
ReportsController.java
...n/java/com/nisum/myteam/controller/ReportsController.java
+20
-0
IEmployeeService.java
src/main/java/com/nisum/myteam/service/IEmployeeService.java
+3
-0
IFunctionalGroupService.java
...ava/com/nisum/myteam/service/IFunctionalGroupService.java
+2
-0
IReportService.java
src/main/java/com/nisum/myteam/service/IReportService.java
+4
-0
EmployeeService.java
...n/java/com/nisum/myteam/service/impl/EmployeeService.java
+7
-0
FunctionalGroupService.java
...com/nisum/myteam/service/impl/FunctionalGroupService.java
+15
-0
ReportService.java
...ain/java/com/nisum/myteam/service/impl/ReportService.java
+58
-1
ResourceService.java
...n/java/com/nisum/myteam/service/impl/ResourceService.java
+8
-0
ChartsController.js
src/main/webapp/WEB-INF/controllers/ChartsController.js
+103
-36
index.html
src/main/webapp/WEB-INF/templates/index.html
+0
-3
No files found.
src/main/java/com/nisum/myteam/controller/FunctionalGroupController.java
View file @
c09dddb7
package
com
.
nisum
.
myteam
.
controller
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -27,10 +28,10 @@ public class FunctionalGroupController {
@RequestMapping
(
value
=
"/getAllFunctionalGroups"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<?>
getAllFunctionalGroups
(
HttpServletRequest
request
)
{
List
<
String
>
functionalGroupsList
=
functionalGroupService
.
getAllFunctionalGroups
().
stream
().
filter
(
f
->
!
Arrays
.
asList
(
"IT"
,
"Recruiter"
,
"Admin"
,
"HR"
,
"Accounts"
).
contains
(
f
.
getName
())).
map
(
f
->
f
.
getName
()).
collect
(
Collectors
.
toList
());
List
<
String
>
functionalGroupsList
=
new
ArrayList
<>();
functionalGroupsList
.
add
(
"ALL"
);
functionalGroupsList
.
addAll
(
functionalGroupService
.
getAllFunctionalGroups
().
stream
().
filter
(
f
->
!
Arrays
.
asList
(
"IT"
,
"Recruiter"
,
"Admin"
,
"HR"
,
"Accounts"
).
contains
(
f
.
getName
())).
map
(
f
->
f
.
getName
()).
collect
(
Collectors
.
toList
()));
ResponseDetails
getRespDetails
=
new
ResponseDetails
(
new
Date
(),
905
,
"Retrieved FunctionalGroups successfully"
,
"FunctionalGroups list"
,
functionalGroupsList
,
request
.
getRequestURI
(),
"FunctionalGroups Details: Status"
,
null
);
return
new
ResponseEntity
<
ResponseDetails
>(
getRespDetails
,
HttpStatus
.
OK
);
...
...
src/main/java/com/nisum/myteam/controller/ReportsController.java
View file @
c09dddb7
...
...
@@ -426,5 +426,25 @@ public class ReportsController {
}
return
new
ResponseEntity
<>(
reports
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/getPieChartReport"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ReportVo
allBillabilityReport
(
@RequestParam
(
"byType"
)
String
byType
,
@RequestParam
(
"onDate"
)
@DateTimeFormat
(
iso
=
DateTimeFormat
.
ISO
.
DATE
)
Date
onDate
)
throws
MyTeamException
{
System
.
out
.
println
(
"allBillabilityReport start"
);
return
reportService
.
getPieChartReport
(
byType
,
onDate
);
}
@RequestMapping
(
value
=
"/fetchEmployeesByBillabilityType"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
Reports
>>
getEmployeesByBillabilityType
(
@RequestParam
(
"billableStatus"
)
String
billableStatus
,
@RequestParam
(
"onDate"
)
@DateTimeFormat
(
iso
=
DateTimeFormat
.
ISO
.
DATE
)
Date
onDate
)
throws
MyTeamException
{
List
<
Reports
>
empList
=
null
;
empList
=
reportService
.
getEmployeeDetailsByBillabilityType
(
billableStatus
,
onDate
);
return
new
ResponseEntity
<>(
empList
,
HttpStatus
.
OK
);
}
}
src/main/java/com/nisum/myteam/service/IEmployeeService.java
View file @
c09dddb7
package
com
.
nisum
.
myteam
.
service
;
import
com.nisum.myteam.exception.handler.MyTeamException
;
import
com.nisum.myteam.model.FunctionalGroup
;
import
com.nisum.myteam.model.dao.Account
;
import
com.nisum.myteam.model.dao.Employee
;
import
org.springframework.stereotype.Service
;
...
...
@@ -55,6 +56,8 @@ public interface IEmployeeService {
public
List
<
Employee
>
getEmployeesByEmpStatusAndShift
(
String
empStatus
,
String
shift
);
public
List
<
Employee
>
getAllEmployeeListByFunGrps
(
List
<
String
>
functionalGroupList
);
public
List
<
Employee
>
getEmployeesByDesignation
(
String
designation
);
public
int
getEmployeesCountByDesignation
(
String
designation
);
...
...
src/main/java/com/nisum/myteam/service/IFunctionalGroupService.java
View file @
c09dddb7
...
...
@@ -9,4 +9,6 @@ public interface IFunctionalGroupService {
public
List
<
FunctionalGroup
>
getAllFunctionalGroups
();
public
FunctionalGroup
getFunctionalGroup
(
String
functionalGroupName
);
public
List
<
FunctionalGroup
>
getAllBillableFunctionalGroups
();
}
src/main/java/com/nisum/myteam/service/IReportService.java
View file @
c09dddb7
...
...
@@ -19,5 +19,9 @@ public interface IReportService {
public
Project
getProjectById
(
String
employeeId
);
public
List
<
Reports
>
getEmployeeDetailsByFGAccountAndBillability
(
String
fGroup
,
String
billableStatus
,
String
account
,
Date
onDate
)
throws
MyTeamException
;
public
ReportVo
getPieChartReport
(
String
byType
,
Date
onDate
)
throws
MyTeamException
;
public
List
<
Reports
>
getEmployeeDetailsByBillabilityType
(
String
billabilityType
,
Date
onDate
)
throws
MyTeamException
;
}
\ No newline at end of file
src/main/java/com/nisum/myteam/service/impl/EmployeeService.java
View file @
c09dddb7
package
com
.
nisum
.
myteam
.
service
.
impl
;
import
com.nisum.myteam.exception.handler.MyTeamException
;
import
com.nisum.myteam.model.FunctionalGroup
;
import
com.nisum.myteam.model.dao.Account
;
import
com.nisum.myteam.model.dao.Domain
;
import
com.nisum.myteam.model.dao.Employee
;
...
...
@@ -483,4 +484,10 @@ public class EmployeeService implements IEmployeeService {
return
employeeRepo
.
findByEmployeeIdAndEmpStatus
(
employeeId
,
active
);
}
public
List
<
Employee
>
getAllEmployeeListByFunGrps
(
List
<
String
>
functionalGroupList
){
Query
query
=
new
Query
(
Criteria
.
where
(
"empStatus"
).
is
(
"Active"
).
andOperator
(
Criteria
.
where
(
"functionalGroup"
).
in
(
functionalGroupList
)));
List
<
Employee
>
employeePersistedList
=
mongoTemplate
.
find
(
query
,
Employee
.
class
);
return
employeePersistedList
;
}
}
src/main/java/com/nisum/myteam/service/impl/FunctionalGroupService.java
View file @
c09dddb7
package
com
.
nisum
.
myteam
.
service
.
impl
;
import
com.nisum.myteam.model.FunctionalGroup
;
import
com.nisum.myteam.model.dao.Employee
;
import
com.nisum.myteam.repository.FunctionalGroupRepo
;
import
com.nisum.myteam.service.IFunctionalGroupService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.mongodb.core.MongoTemplate
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.stereotype.Service
;
import
java.util.Arrays
;
import
java.util.List
;
@Service
public
class
FunctionalGroupService
implements
IFunctionalGroupService
{
@Autowired
private
MongoTemplate
mongoTemplate
;
@Autowired
private
FunctionalGroupRepo
functionalGroupRepo
;
...
...
@@ -22,4 +30,11 @@ public class FunctionalGroupService implements IFunctionalGroupService {
public
FunctionalGroup
getFunctionalGroup
(
String
functionalGroupName
)
{
return
functionalGroupRepo
.
findByName
(
functionalGroupName
);
}
@Override
public
List
<
FunctionalGroup
>
getAllBillableFunctionalGroups
()
{
Query
query
=
new
Query
(
Criteria
.
where
(
"name"
).
nin
(
Arrays
.
asList
(
"IT"
,
"Recruiter"
,
"Admin"
,
"HR"
,
"Accounts"
,
"Delivery Org"
,
"Global Mobility"
)));
List
<
FunctionalGroup
>
functionalGroupList
=
mongoTemplate
.
find
(
query
,
FunctionalGroup
.
class
);
return
functionalGroupList
;
}
}
src/main/java/com/nisum/myteam/service/impl/ReportService.java
View file @
c09dddb7
package
com
.
nisum
.
myteam
.
service
.
impl
;
import
com.nisum.myteam.exception.handler.MyTeamException
;
import
com.nisum.myteam.model.FunctionalGroup
;
import
com.nisum.myteam.model.Reports
;
import
com.nisum.myteam.model.dao.Employee
;
import
com.nisum.myteam.model.dao.Project
;
...
...
@@ -149,7 +150,19 @@ public class ReportService implements IReportService {
return
resultantEmployeeWithBillability
(
empList
,
billableStatus
,
onDate
);
}
private
List
<
Reports
>
resultantEmployeeWithBillability
(
List
<
Employee
>
employees
,
@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
())));
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
())));
return
resultantEmployeeWithBillability
(
employeeList
,
billabilityType
,
onDate
);
}
private
List
<
Reports
>
resultantEmployeeWithBillability
(
List
<
Employee
>
employees
,
String
billableStatus
,
Date
ondate
)
throws
MyTeamException
{
List
<
Reports
>
billableEmployees
=
new
ArrayList
<
Reports
>();
...
...
@@ -199,4 +212,48 @@ public class ReportService implements IReportService {
return
projectService
.
getProjectByProjectId
(
projectId
);
}
public
ReportVo
preparePieChartData
(
String
byType
,
Date
onDate
,
List
<
Employee
>
employeeList
)
throws
MyTeamException
{
ReportVo
reportVo
=
new
ReportVo
();
Integer
billableCount
=
0
;
Integer
nonBillableCount
=
0
;
Integer
traineeCount
=
0
;
Integer
allEmployeesSize
=
employeeList
.
size
();
float
traineePer
;
float
billper
;
Map
<
String
,
Object
>
billableObj
=
new
HashMap
();
Map
<
String
,
Object
>
nonBillableObj
=
new
HashMap
();
Map
<
String
,
Object
>
traineeObj
=
new
HashMap
();
float
nonBillPer
;
Map
<
String
,
List
<
Resource
>>
resourceServiceAllocationOfDateMap
=
resourceService
.
getAllocationOfDateMap
(
employeeList
.
stream
().
collect
(
Collectors
.
mapping
(
Employee:
:
getEmployeeId
,
Collectors
.
toList
())),
onDate
);
Map
<
String
,
Integer
>
utilityResourceDataMap
=
new
HashMap
<>();
utilityResourceDataMap
.
put
(
"Billable"
,
billableCount
);
utilityResourceDataMap
.
put
(
"Non-Billable"
,
nonBillableCount
);
utilityResourceDataMap
.
put
(
"Trainee"
,
traineeCount
);
resourceServiceAllocationOfDateMap
.
forEach
((
s
,
resources
)
->
{
Resource
resource
=
resources
.
stream
().
findFirst
().
get
();
if
(
resource
!=
null
&&
resource
.
getBillableStatus
().
equals
(
"Billable"
))
{
utilityResourceDataMap
.
put
(
"Billable"
,
utilityResourceDataMap
.
get
(
"Billable"
)+
1
);
}
else
if
(
resource
!=
null
&&
resource
.
getBillableStatus
().
equals
(
"Trainee"
))
{
utilityResourceDataMap
.
put
(
"Trainee"
,
utilityResourceDataMap
.
get
(
"Trainee"
)+
1
);
}
else
if
(
resource
!=
null
)
{
utilityResourceDataMap
.
put
(
"Non-Billable"
,
utilityResourceDataMap
.
get
(
"Non-Billable"
)+
1
);
}
});
billper
=
((
utilityResourceDataMap
.
get
(
"Billable"
)
/
(
float
)
(
allEmployeesSize
-
utilityResourceDataMap
.
get
(
"Trainee"
)))
*
100
);
nonBillPer
=
utilityResourceDataMap
.
get
(
"Non-Billable"
)
/
(
float
)
(
allEmployeesSize
-
utilityResourceDataMap
.
get
(
"Trainee"
))
*
100
;
traineePer
=
utilityResourceDataMap
.
get
(
"Trainee"
)
/
(
float
)
(
allEmployeesSize
-
(
utilityResourceDataMap
.
get
(
"Billable"
)
+
utilityResourceDataMap
.
get
(
"Non-Billable"
)))
*
100
;
billableObj
.
put
(
"percent"
,
billper
);
billableObj
.
put
(
"y"
,
utilityResourceDataMap
.
get
(
"Billable"
));
billableObj
.
put
(
"name"
,
"Billable"
);
nonBillableObj
.
put
(
"percent"
,
nonBillPer
);
nonBillableObj
.
put
(
"y"
,
utilityResourceDataMap
.
get
(
"Non-Billable"
));
nonBillableObj
.
put
(
"name"
,
"Non-Billable"
);
traineeObj
.
put
(
"y"
,
utilityResourceDataMap
.
get
(
"Trainee"
));
traineeObj
.
put
(
"name"
,
"Trainee"
);
traineeObj
.
put
(
"percent"
,
traineePer
);
reportVo
.
getSeriesDataList
().
add
(
billableObj
);
reportVo
.
getSeriesDataList
().
add
(
nonBillableObj
);
reportVo
.
getSeriesDataList
().
add
(
traineeObj
);
return
reportVo
;
}
}
src/main/java/com/nisum/myteam/service/impl/ResourceService.java
View file @
c09dddb7
...
...
@@ -1161,4 +1161,12 @@ public class ResourceService implements IResourceService {
}
return
null
;
}
public
Map
<
String
,
List
<
Resource
>>
getAllocationOfDateMap
(
List
<
String
>
employeeIdList
,
Date
onDate
){
Query
query
=
new
Query
(
Criteria
.
where
(
"employeeId"
).
in
(
employeeIdList
).
andOperator
(
Criteria
.
where
(
"billingStartDate"
).
lte
(
onDate
),
Criteria
.
where
(
"billingEndDate"
).
gte
(
onDate
)));
List
<
Resource
>
resourceList
=
mongoTemplate
.
find
(
query
,
Resource
.
class
);
Map
<
String
,
List
<
Resource
>>
resourceMap
=
resourceList
.
stream
().
collect
(
Collectors
.
groupingBy
(
Resource:
:
getEmployeeId
,
Collectors
.
toList
()));
System
.
out
.
println
(
resourceMap
);
return
resourceMap
;
}
}
\ No newline at end of file
src/main/webapp/WEB-INF/controllers/ChartsController.js
View file @
c09dddb7
This diff is collapsed.
Click to expand it.
src/main/webapp/WEB-INF/templates/index.html
View file @
c09dddb7
...
...
@@ -32,7 +32,6 @@
<script
src=
"js/pdf/angular-pdf.min.js"
></script>
<script
src=
"js/pdf/print.min.js"
></script>
<link
rel=
"stylesheet"
href=
"css/bootstrap.min.css"
></link>
<!-- <link rel="stylesheet" href="css/default-styles.css"></link> -->
<link
rel=
"stylesheet"
href=
"css/custom-theme.css"
></link>
<script
src=
"js/bootstrap.min.js"
></script>
<script
src=
"js/angular-idle.js"
></script>
...
...
@@ -48,9 +47,7 @@
<link
rel=
"stylesheet"
href=
"http://ui-grid.info/release/ui-grid.css"
type=
"text/css"
>
<!-- <link rel="stylesheet" href="css/leftmenu.css"></link> -->
<link
rel=
"stylesheet"
href=
"css/pdf-viewer.css"
></link>
<!-- <link rel="stylesheet" href="css/user-profile.css"></link> -->
<script
src=
"js/app.js"
></script>
<script
src=
"js/date-text-filter.js"
></script>
<script
src=
"js/ui-grid-edit-datepicker.js"
></script>
...
...
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