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
099feaf1
Commit
099feaf1
authored
Jun 07, 2019
by
vikram singh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
"UIReport Service implemented"
parent
6574f8fd
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
1906 additions
and
1803 deletions
+1906
-1803
ReportsController.java
...n/java/com/nisum/myteam/controller/ReportsController.java
+450
-439
BillableEmployee.java
src/main/java/com/nisum/myteam/model/BillableEmployee.java
+30
-0
IEmployeeService.java
src/main/java/com/nisum/myteam/service/IEmployeeService.java
+58
-55
IResourceService.java
src/main/java/com/nisum/myteam/service/IResourceService.java
+82
-80
EmployeeService.java
...n/java/com/nisum/myteam/service/impl/EmployeeService.java
+382
-329
ResourceService.java
...n/java/com/nisum/myteam/service/impl/ResourceService.java
+904
-900
No files found.
src/main/java/com/nisum/myteam/controller/ReportsController.java
View file @
099feaf1
package
com
.
nisum
.
myteam
.
controller
;
import
com.nisum.myteam.exception.handler.MyTeamException
;
import
com.nisum.myteam.exception.handler.ResponseDetails
;
import
com.nisum.myteam.model.ColumnChartData
;
import
com.nisum.myteam.model.GroupByCount
;
import
com.nisum.myteam.model.ReportSeriesRecord
;
import
com.nisum.myteam.model.dao.Account
;
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.IAccountService
;
import
com.nisum.myteam.service.IEmployeeService
;
import
com.nisum.myteam.service.IResourceService
;
import
static
org
.
springframework
.
data
.
mongodb
.
core
.
aggregation
.
Aggregation
.
group
;
import
static
org
.
springframework
.
data
.
mongodb
.
core
.
aggregation
.
Aggregation
.
newAggregation
;
import
static
org
.
springframework
.
data
.
mongodb
.
core
.
aggregation
.
Aggregation
.
project
;
import
static
org
.
springframework
.
data
.
mongodb
.
core
.
aggregation
.
Aggregation
.
sort
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.data.mongodb.core.MongoTemplate
;
...
...
@@ -25,15 +27,24 @@ import org.springframework.data.mongodb.core.query.Query;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletRequest
;
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
.*;
import
com.nisum.myteam.exception.handler.MyTeamException
;
import
com.nisum.myteam.model.BillableEmployee
;
import
com.nisum.myteam.model.ColumnChartData
;
import
com.nisum.myteam.model.GroupByCount
;
import
com.nisum.myteam.model.ReportSeriesRecord
;
import
com.nisum.myteam.model.dao.Account
;
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.IAccountService
;
import
com.nisum.myteam.service.IEmployeeService
;
import
com.nisum.myteam.service.IResourceService
;
//import com.nisum.myteam.model.dao.Resource;
...
...
@@ -245,13 +256,13 @@ public class ReportsController {
return
new
ResponseEntity
<>(
list
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/fetchEmployeeDetailsByFG
"
,
@RequestMapping
(
value
=
"/fetchEmployeeDetailsByFG
AndBillability"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
Employee
>>
getEmployeesByFG
(
@RequestParam
(
"fGroup"
)
String
fGroup
)
throws
MyTeamException
{
List
<
Employee
>
empList
=
new
ArrayList
<>();
empList
=
employeeService
.
getEmployee
sByFunctionalGrp
(
fGroup
);
public
ResponseEntity
<
List
<
BillableEmployee
>>
getEmployeesByFGAndBillability
(
@RequestParam
(
"fGroup"
)
String
fGroup
,
@RequestParam
(
"billableStatus"
)
String
billableStatus
)
throws
MyTeamException
{
List
<
BillableEmployee
>
empList
=
new
ArrayList
<>();
empList
=
employeeService
.
getEmployee
DetailsByFGAndBillability
(
fGroup
,
billableStatus
);
return
new
ResponseEntity
<>(
empList
,
HttpStatus
.
OK
);
}
...
...
src/main/java/com/nisum/myteam/model/BillableEmployee.java
0 → 100644
View file @
099feaf1
package
com
.
nisum
.
myteam
.
model
;
import
java.io.Serializable
;
import
java.util.Date
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.ToString
;
@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ToString
public
class
BillableEmployee
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
String
employeeId
;
private
String
employeeName
;
private
String
emailId
;
private
String
projectName
;
private
String
billableStatus
;
private
Date
billingStartDate
;
private
Date
billingEndDate
;
private
String
functionalGroup
;
}
src/main/java/com/nisum/myteam/service/IEmployeeService.java
View file @
099feaf1
package
com
.
nisum
.
myteam
.
service
;
import
com.nisum.myteam.exception.handler.MyTeamException
;
import
com.nisum.myteam.model.BillableEmployee
;
import
com.nisum.myteam.model.dao.Account
;
import
com.nisum.myteam.model.dao.Employee
;
import
org.springframework.stereotype.Service
;
...
...
@@ -52,4 +53,6 @@ public interface IEmployeeService {
public
List
<
Employee
>
getEmployeesByEmpStatusAndShift
(
String
empStatus
,
String
shift
);
List
<
BillableEmployee
>
getEmployeeDetailsByFGAndBillability
(
String
fGroup
,
String
billableStatus
);
}
src/main/java/com/nisum/myteam/service/IResourceService.java
View file @
099feaf1
...
...
@@ -64,6 +64,8 @@ public interface IResourceService {
public
List
<
ReserveReportsVO
>
getResourceReportsByBillingStatus
(
String
resourceStatus
);
List
<
Resource
>
findByBillableStatus
(
String
billableStatus
);
// List<Resource> getAllResourcesForProject(String projectId, String status);
...
...
src/main/java/com/nisum/myteam/service/impl/EmployeeService.java
View file @
099feaf1
package
com
.
nisum
.
myteam
.
service
.
impl
;
import
com.nisum.myteam.exception.handler.MyTeamException
;
import
com.nisum.myteam.model.dao.Account
;
import
com.nisum.myteam.model.dao.Domain
;
import
com.nisum.myteam.model.dao.Employee
;
import
com.nisum.myteam.repository.EmployeeRepo
;
import
com.nisum.myteam.service.*
;
import
com.nisum.myteam.utils.MyTeamUtils
;
import
com.nisum.myteam.utils.constants.ApplicationRole
;
import
com.nisum.myteam.utils.constants.RoleConstant
;
import
lombok.extern.slf4j.Slf4j
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Sort
;
...
...
@@ -20,8 +18,27 @@ import org.springframework.data.mongodb.core.query.Query;
import
org.springframework.data.mongodb.core.query.Update
;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
com.nisum.myteam.exception.handler.MyTeamException
;
import
com.nisum.myteam.model.BillableEmployee
;
import
com.nisum.myteam.model.dao.Account
;
import
com.nisum.myteam.model.dao.Domain
;
import
com.nisum.myteam.model.dao.Employee
;
import
com.nisum.myteam.model.dao.Project
;
import
com.nisum.myteam.model.dao.Resource
;
import
com.nisum.myteam.repository.EmployeeRepo
;
import
com.nisum.myteam.service.IAccountService
;
import
com.nisum.myteam.service.IDomainService
;
import
com.nisum.myteam.service.IEmployeeLocationService
;
import
com.nisum.myteam.service.IEmployeeRoleService
;
import
com.nisum.myteam.service.IEmployeeService
;
import
com.nisum.myteam.service.IProjectService
;
import
com.nisum.myteam.service.IResourceService
;
import
com.nisum.myteam.statuscodes.ResourceStatus
;
import
com.nisum.myteam.utils.MyTeamUtils
;
import
com.nisum.myteam.utils.constants.ApplicationRole
;
import
com.nisum.myteam.utils.constants.RoleConstant
;
import
lombok.extern.slf4j.Slf4j
;
@Service
@Slf4j
...
...
@@ -324,6 +341,42 @@ public class EmployeeService implements IEmployeeService {
return
employeeRepo
.
findByEmployeeIdIn
(
empIdsSet
);
}
@Override
public
List
<
BillableEmployee
>
getEmployeeDetailsByFGAndBillability
(
String
fGroup
,
String
billableStatus
)
{
List
<
Resource
>
resources
=
resourceService
.
findByBillableStatus
(
billableStatus
);
return
getBillableEmployeeByfunctionalGroup
(
fGroup
,
resources
);
}
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
;
}
}
src/main/java/com/nisum/myteam/service/impl/ResourceService.java
View file @
099feaf1
...
...
@@ -842,6 +842,10 @@ public class ResourceService implements IResourceService {
return
allocationList
;
}
@Override
public
List
<
Resource
>
findByBillableStatus
(
String
billableStatus
)
{
return
resourceRepo
.
findByBillableStatus
(
billableStatus
);
}
}
//class
...
...
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