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
49aabae2
Commit
49aabae2
authored
Jun 04, 2019
by
Md Suleman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bar chart report updated
parent
80af1825
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
152 additions
and
0 deletions
+152
-0
ReportsController.java
...n/java/com/nisum/myteam/controller/ReportsController.java
+37
-0
ResourceController.java
.../java/com/nisum/myteam/controller/ResourceController.java
+8
-0
ChangedResourceVO.java
...ain/java/com/nisum/myteam/model/vo/ChangedResourceVO.java
+26
-0
ReportVo.java
src/main/java/com/nisum/myteam/model/vo/ReportVo.java
+27
-0
IResourceService.java
src/main/java/com/nisum/myteam/service/IResourceService.java
+2
-0
ResourceService.java
...n/java/com/nisum/myteam/service/impl/ResourceService.java
+52
-0
No files found.
src/main/java/com/nisum/myteam/controller/ReportsController.java
View file @
49aabae2
...
...
@@ -6,6 +6,7 @@ import com.nisum.myteam.model.GroupByCount;
import
com.nisum.myteam.model.ReportSeriesRecord
;
import
com.nisum.myteam.model.dao.Employee
;
import
com.nisum.myteam.model.dao.Resource
;
import
com.nisum.myteam.model.vo.ReportVo
;
import
com.nisum.myteam.model.vo.ResourceVO
;
import
com.nisum.myteam.service.IEmployeeService
;
import
com.nisum.myteam.service.IResourceService
;
...
...
@@ -29,6 +30,7 @@ import org.springframework.web.bind.annotation.RestController;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
static
org
.
springframework
.
data
.
mongodb
.
core
.
aggregation
.
Aggregation
.*;
...
...
@@ -372,4 +374,39 @@ public class ReportsController {
return
new
ResponseEntity
<>(
empList
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/billabilityByFunctionalGroup"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ReportVo
billabilityReportByFunctionalGroup
(){
ReportVo
reportVo
=
new
ReportVo
();
Map
<
String
,
Object
>
billableData
=
new
HashMap
();
Map
<
String
,
Object
>
nonBillableData
=
new
HashMap
();
List
<
Integer
>
billableCount
=
new
ArrayList
<>();
List
<
Integer
>
nonBillableCount
=
new
ArrayList
<>();
billableData
.
put
(
"name"
,
"Billable"
);
nonBillableData
.
put
(
"name"
,
"Non Billable"
);
for
(
String
functionalGroup:
reportVo
.
getCategories
()){
Integer
billableC
=
0
;
Integer
nonBillableC
=
0
;
List
<
Employee
>
employeeList
=
employeeService
.
getAllEmployees
().
stream
().
filter
(
e
->
e
.
getFunctionalGroup
().
equals
(
functionalGroup
)).
collect
(
Collectors
.
toList
());
for
(
Employee
employee:
employeeList
){
Resource
resource
=
resourceService
.
getLatestResourceByEmpId
(
employee
.
getEmployeeId
());
if
(
resource
!=
null
&&
resource
.
getBillableStatus
().
equals
(
"Billable"
)){
billableC
++;
}
else
{
nonBillableC
++;
}
}
billableCount
.
add
(
billableC
);
nonBillableCount
.
add
(
nonBillableC
);
}
billableData
.
put
(
"data"
,
billableCount
);
nonBillableData
.
put
(
"data"
,
nonBillableCount
);
reportVo
.
getSeries
().
add
(
billableData
);
reportVo
.
getSeries
().
add
(
nonBillableData
);
return
reportVo
;
}
}
\ No newline at end of file
src/main/java/com/nisum/myteam/controller/ResourceController.java
View file @
49aabae2
...
...
@@ -5,6 +5,7 @@ import com.nisum.myteam.exception.handler.MyTeamException;
import
com.nisum.myteam.exception.handler.ResponseDetails
;
import
com.nisum.myteam.model.dao.Employee
;
import
com.nisum.myteam.model.dao.Resource
;
import
com.nisum.myteam.model.vo.ChangedResourceVO
;
import
com.nisum.myteam.model.vo.EmployeeShiftsVO
;
import
com.nisum.myteam.model.vo.ResourceVO
;
import
com.nisum.myteam.repository.EmployeeVisaRepo
;
...
...
@@ -21,6 +22,7 @@ import org.springframework.http.ResponseEntity;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -258,6 +260,12 @@ public class ResourceController {
}
@RequestMapping
(
value
=
"getResourceAllocation/{fromDate}/{toDate}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<?>
getUpdatedResourceAllocationsByDate
(
@PathVariable
(
""
)
String
fromDate
,
@PathVariable
String
toDate
){
List
<
ChangedResourceVO
>
changedResourceVOList
=
resourceService
.
getChangedResourceByDate
(
fromDate
,
toDate
);
return
null
;
}
}
src/main/java/com/nisum/myteam/model/vo/ChangedResourceVO.java
0 → 100644
View file @
49aabae2
package
com
.
nisum
.
myteam
.
model
.
vo
;
import
lombok.*
;
import
java.util.Date
;
@Setter
@Getter
@NoArgsConstructor
@AllArgsConstructor
@ToString
public
class
ChangedResourceVO
{
private
String
emplyeeId
;
private
String
employeeName
;
private
String
prevBillingStatus
;
private
String
prevClient
;
private
String
prevProject
;
private
Date
prevBillingStartingDate
;
private
Date
prevBillingEndDate
;
private
String
currentBillingStatus
;
private
String
currentClient
;
private
String
currentProject
;
private
Date
currentBillingStartingDate
;
private
Date
currentBillingEndDate
;
}
src/main/java/com/nisum/myteam/model/vo/ReportVo.java
0 → 100644
View file @
49aabae2
package
com
.
nisum
.
myteam
.
model
.
vo
;
import
lombok.Getter
;
import
lombok.Setter
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
@Setter
@Getter
public
class
ReportVo
{
List
<
String
>
categories
=
new
ArrayList
();
List
<
Map
<
String
,
Object
>>
series
=
new
ArrayList
();
public
ReportVo
(){
categories
.
add
(
"ES"
);
categories
.
add
(
"CI"
);
categories
.
add
(
"APPS"
);
categories
.
add
(
"ACI - QE"
);
categories
.
add
(
"ACI - DevOps"
);
categories
.
add
(
"ACI - Support"
);
categories
.
add
(
"I&A"
);
}
}
src/main/java/com/nisum/myteam/service/IResourceService.java
View file @
49aabae2
...
...
@@ -54,6 +54,8 @@ public interface IResourceService {
public
List
<
EmployeeShiftsVO
>
getResourcesForShift
(
String
shift
);
public
Resource
getLatestResourceByEmpId
(
String
employeeId
);
// List<Resource> getAllResourcesForProject(String projectId, String status);
// List<Resource> getResourcesForEmployee(String empId);
...
...
src/main/java/com/nisum/myteam/service/impl/ResourceService.java
View file @
49aabae2
...
...
@@ -2,6 +2,7 @@ package com.nisum.myteam.service.impl;
import
com.nisum.myteam.exception.handler.MyTeamException
;
import
com.nisum.myteam.model.dao.*
;
import
com.nisum.myteam.model.vo.ChangedResourceVO
;
import
com.nisum.myteam.model.vo.EmployeeShiftsVO
;
import
com.nisum.myteam.model.vo.MyProjectAllocationVO
;
import
com.nisum.myteam.model.vo.ResourceVO
;
...
...
@@ -19,6 +20,7 @@ import org.springframework.data.mongodb.core.query.Criteria;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.stereotype.Service
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.stream.Collectors
;
...
...
@@ -689,6 +691,56 @@ public class ResourceService implements IResourceService {
return
resourcesList
;
}
@Override
public
Resource
getLatestResourceByEmpId
(
String
employeeId
){
List
<
Resource
>
resourceList
=
resourceRepo
.
findByEmployeeId
(
employeeId
).
stream
().
filter
(
r
->
r
.
getBillingEndDate
().
after
(
new
Date
())).
collect
(
Collectors
.
toList
());
if
(!
resourceList
.
isEmpty
())
return
resourceList
.
get
(
0
);
else
return
null
;
}
public
List
<
ChangedResourceVO
>
getChangedResourceByDate
(
String
fromDatestr
,
String
toDatestr
){
// List<ChangedResourceVO> changedResourceVOList = new ArrayList();
// SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy");
//
// try {
// final Date fromDate = format.parse(fromDatestr);
// final Date toDate = format.parse(toDatestr);
// resourceRepo.findAll().stream().
// filter(r -> r.getBillingStartDate().before(toDate)&&r.getBillingEndDate().after(fromDate)).forEach(r -> {
// ChangedResourceVO crv = new ChangedResourceVO();
// Project project = projectService.getProjectByProjectId(r.getProjectId());
// Employee emp = employeeService.getEmployeeById(r.getEmployeeId());
// Account account = accountService.getAccountById(project.getAccountId());
//
//
// if(changedResourceVOList.isEmpty()){
// crv.setEmplyeeId(r.getEmployeeId());
// crv.setEmployeeName(emp.getEmployeeName());
// crv.setPrevBillingStatus(r.getBillableStatus());
// crv.setPrevBillingStartingDate(r.getBillingStartDate());
// crv.setPrevBillingEndDate(r.getBillingEndDate());
// crv.setPrevClient(account.getAccountName());
// crv.setPrevProject(project.getProjectName());
// }else {
//
// if(!crvList.isEmpty()){
//
// }else{
//
// }
// }
// changedResourceVOList.add(crv);
// });
//
// }catch (Exception e){}
//
return
null
;
}
...
...
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