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
276c4723
Commit
276c4723
authored
Jun 18, 2019
by
vikram singh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated Move to bench and updated reports
parent
c64cc99d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
79 additions
and
18 deletions
+79
-18
ReportService.java
...ain/java/com/nisum/myteam/service/impl/ReportService.java
+60
-12
ResourceService.java
...n/java/com/nisum/myteam/service/impl/ResourceService.java
+18
-5
MyTeamUtils.java
src/main/java/com/nisum/myteam/utils/MyTeamUtils.java
+1
-1
No files found.
src/main/java/com/nisum/myteam/service/impl/ReportService.java
View file @
276c4723
...
...
@@ -78,8 +78,9 @@ public class ReportService implements IReportService {
// .getAllEmployees().stream().
// filter(e -> e.getFunctionalGroup().equals(functionalGroup)).collect(Collectors.toList());
for
(
Employee
employee:
employeeList
){
Resource
resource
=
resourceService
.
get
LatestResourceByEmpId
(
employee
.
getEmployeeId
());
Resource
resource
=
resourceService
.
get
CurrentAllocationIfNotReturnNull
(
employee
.
getEmployeeId
());
//getCurrentAllocation
(employee.getEmployeeId());
if
(
resource
!=
null
&&
resource
.
getBillableStatus
().
equals
(
"Billable"
)){
billableC
++;
}
else
if
(
resource
!=
null
&&
resource
.
getBillableStatus
().
equals
(
"Trainee"
))
{
traineeC
++;
...
...
@@ -139,29 +140,76 @@ public class ReportService implements IReportService {
private
List
<
Reports
>
resultantEmployeeWithBillability
(
List
<
Employee
>
employees
,
String
billableStatus
)
{
List
<
Reports
>
resultantEmployees
=
new
ArrayList
<
Reports
>();
for
(
Employee
employee:
employees
)
{
Resource
resourceObj
=
resourceService
.
getLatestResourceByEmpId
(
employee
.
getEmployeeId
());
if
(
resourceObj
.
getBillableStatus
().
equals
(
billableStatus
)
||(
billableStatus
.
equals
(
"Non-Billable"
)
&&
(
resourceObj
.
getBillableStatus
().
equals
(
Shadow
)||
resourceObj
.
getBillableStatus
().
equals
(
Reserved
))))
{
resultantEmployees
.
add
(
mappingReports
(
employee
,
resourceObj
));
}
List
<
Reports
>
billableEmployees
=
new
ArrayList
<
Reports
>();
List
<
Reports
>
nonBillableEmployees
=
new
ArrayList
<
Reports
>();
List
<
Reports
>
trainees
=
new
ArrayList
<
Reports
>();
for
(
Employee
employee:
employees
){
Resource
resource
=
resourceService
.
getCurrentAllocationIfNotReturnNull
(
employee
.
getEmployeeId
());
//getCurrentAllocation(employee.getEmployeeId());
if
(
resource
!=
null
&&
resource
.
getBillableStatus
().
equals
(
"Billable"
)){
billableEmployees
.
add
(
mappingReports
(
employee
,
resource
));
}
else
if
(
resource
!=
null
&&
resource
.
getBillableStatus
().
equals
(
"Trainee"
))
{
trainees
.
add
(
mappingReports
(
employee
,
resource
));
}
else
{
nonBillableEmployees
.
add
(
mappingReports
(
employee
,
resource
));
}
}
if
(
billableStatus
.
equals
(
"Billable"
))
{
return
billableEmployees
;
}
else
if
(
billableStatus
.
equals
(
"Trainee"
))
{
return
trainees
;
}
return
resultantEmployees
;
else
return
nonBillableEmployees
;
// List<Reports> resultantEmployees=new ArrayList<Reports>();
// for(Employee employee:employees) {
// Resource resourceObj=resourceService.getCurrentAllocation(employee.getEmployeeId());
//
// if(resourceObj.getBillableStatus().equals(billableStatus) ||( billableStatus.equals("Non-Billable") && (resourceObj.getBillableStatus().equals(Shadow)||resourceObj.getBillableStatus().equals(Reserved)))) {
//
// resultantEmployees.add(mappingReports(employee,resourceObj));
// }
// }
// return resultantEmployees;
}
// if(!resourceService.isAllocationActiveToday(resourceObj) && billableStatus.equals("Non-Billable")) {
// //resultantEmployees.add((mappingReports)
// }
private
Reports
mappingReports
(
Employee
employee
,
Resource
resourceObj
){
Reports
Reports
=
new
Reports
();
Project
project
=
projectService
.
getProjectByProjectId
(
resourceObj
.
getProjectId
());
Reports
.
setEmployeeId
(
resourceObj
.
getEmployeeId
());
Reports
.
setEmployeeName
(
employee
.
getEmployeeName
());
Reports
.
setEmailId
(
employee
.
getEmailId
());
Reports
.
setFunctionalGroup
(
employee
.
getFunctionalGroup
());
Reports
.
setEmployeeId
(
employee
.
getEmployeeId
());
// Reports.setBillableStatus("BillingEnded");
if
(
resourceObj
!=
null
)
{
Project
project
=
projectService
.
getProjectByProjectId
(
resourceObj
.
getProjectId
());
Reports
.
setProjectName
(
project
.
getProjectName
());
Reports
.
setBillingStartDate
(
resourceObj
.
getBillingStartDate
());
Reports
.
setBillableStatus
(
resourceObj
.
getBillableStatus
());
Reports
.
setBillingEndDate
(
resourceObj
.
getBillingEndDate
());
Reports
.
setFunctionalGroup
(
employee
.
getFunctionalGroup
());
}
return
Reports
;
}
// private Reports mappingReports(Employee employee,Resource resourceObj){
// Reports Reports=new Reports();
// Project project=projectService.getProjectByProjectId(resourceObj.getProjectId());
// Reports.setEmployeeId(resourceObj.getEmployeeId());
// Reports.setEmployeeName(employee.getEmployeeName());
// Reports.setEmailId(employee.getEmailId());
// Reports.setProjectName(project.getProjectName());
// Reports.setBillingStartDate(resourceObj.getBillingStartDate());
// Reports.setBillableStatus(resourceObj.getBillableStatus());
// Reports.setBillingEndDate(resourceObj.getBillingEndDate());
// Reports.setFunctionalGroup(employee.getFunctionalGroup());
// return Reports;
// }
@Override
public
Project
getProjectById
(
String
projectId
)
{
...
...
src/main/java/com/nisum/myteam/service/impl/ResourceService.java
View file @
276c4723
...
...
@@ -127,7 +127,7 @@ public class ResourceService implements IResourceService {
Resource
resource
=
resourceRepo
.
findById
(
resourceReq
.
getId
());
if
(
resource
!=
null
)
{
if
(!
resourceReq
.
getStatus
().
equalsIgnoreCase
(
MyTeamUtils
.
RELEASED_STATUS
)){
if
(!
resourceReq
.
getStatus
().
equalsIgnoreCase
(
MyTeamUtils
.
STATUS_RELEASED
)){
Resource
latestAllocation
=
this
.
getLatestAllocation
(
resourceRepo
.
findByEmployeeId
(
resourceReq
.
getEmployeeId
()));
if
(
latestAllocation
!=
null
&&
!
latestAllocation
.
getProjectId
().
equalsIgnoreCase
(
resourceReq
.
getProjectId
())&&
...
...
@@ -503,7 +503,7 @@ public class ResourceService implements IResourceService {
if
(
statusFlag
.
equals
(
ResourceStatus
.
ACTIVE
.
getStatus
())
&&
resource
.
getStatus
().
equals
(
MyTeamUtils
.
STATUS_ENGAGED
))
{
resourceVO
.
setResourceStatus
(
ResourceStatus
.
ACTIVE
.
getStatus
());
resourcesList
.
add
(
resourceVO
);
}
else
if
(
statusFlag
.
equals
(
ResourceStatus
.
IN_ACTIVE
.
getStatus
())
&&
resource
.
getStatus
().
equals
(
MyTeamUtils
.
RELEASED_STATUS
))
{
}
else
if
(
statusFlag
.
equals
(
ResourceStatus
.
IN_ACTIVE
.
getStatus
())
&&
resource
.
getStatus
().
equals
(
MyTeamUtils
.
STATUS_RELEASED
))
{
resourceVO
.
setResourceStatus
(
ResourceStatus
.
IN_ACTIVE
.
getStatus
());
resourcesList
.
add
(
resourceVO
);
}
else
if
(
statusFlag
.
equals
(
MyTeamUtils
.
STATUS_PROPOSED
)
&&
resource
.
getStatus
().
equals
(
MyTeamUtils
.
STATUS_PROPOSED
)){
...
...
@@ -706,7 +706,7 @@ public class ResourceService implements IResourceService {
resourceBench
.
setProjectId
(
MyTeamUtils
.
BENCH_PROJECT_ID
);
resourceBench
.
setEmployeeId
(
employee
.
getEmployeeId
());
resourceBench
.
setResourceRole
(
employee
.
getRole
());
resourceBench
.
setStatus
(
MyTeamUtils
.
RELEASED_STATUS
);
resourceBench
.
setStatus
(
MyTeamUtils
.
STATUS_RELEASED
);
resourceBench
.
setBillingStartDate
(
employee
.
getDateOfJoining
()
!=
null
?
employee
.
getDateOfJoining
()
:
new
Date
());
resourceBench
.
setBillableStatus
(
MyTeamUtils
.
BENCH_BILLABILITY_STATUS
);
resourceBench
.
setEmployeeId
(
employee
.
getEmployeeId
());
...
...
@@ -968,8 +968,12 @@ public class ResourceService implements IResourceService {
}
public
Resource
sendResourceToOpenPool
(
Resource
resource
,
String
loginId
)
{
Resource
proposedResource
=
resourceRepo
.
findOneByEmployeeIdAndStatus
(
resource
.
getEmployeeId
(),
MyTeamUtils
.
STATUS_PROPOSED
);
Resource
existingresource
=
resourceRepo
.
findById
(
resource
.
getId
());
existingresource
.
setStatus
(
MyTeamUtils
.
RELEASED_STATUS
);
existingresource
.
setStatus
(
MyTeamUtils
.
STATUS_RELEASED
);
this
.
updateExistedResource
(
existingresource
);
// isResourceAvailableinBenchbygraterthanEndDate=
...
...
@@ -979,9 +983,15 @@ public class ResourceService implements IResourceService {
benchResource
.
setEmployeeId
(
resource
.
getEmployeeId
());
benchResource
.
setResourceRole
(
resource
.
getResourceRole
());
benchResource
.
setBillingStartDate
(
MyTeamDateUtils
.
getDayMoreThanDate
(
resource
.
getBillingEndDate
()));
if
(
proposedResource
!=
null
)
{
benchResource
.
setBillingEndDate
(
MyTeamDateUtils
.
getDayLessThanDate
(
proposedResource
.
getBillingStartDate
()));
}
else
{
benchResource
.
setBillingEndDate
(
projectService
.
getProjectByProjectId
(
MyTeamUtils
.
BENCH_PROJECT_ID
).
getProjectEndDate
());
}
benchResource
.
setBillableStatus
(
MyTeamUtils
.
BENCH_BILLABILITY_STATUS
);
benchResource
.
setStatus
(
MyTeamUtils
.
RELEASED_STATUS
);
benchResource
.
setStatus
(
MyTeamUtils
.
STATUS_RELEASED
);
benchResource
.
setAuditFields
(
loginId
,
MyTeamUtils
.
CREATE
);
Resource
resourcePers
=
resourceRepo
.
save
(
benchResource
);
respMap
.
put
(
"statusCode"
,
801
);
...
...
@@ -993,6 +1003,9 @@ public class ResourceService implements IResourceService {
public
Resource
getCurrentAllocation
(
String
employeeId
)
{
return
resourceRepo
.
findByEmployeeId
(
employeeId
).
stream
().
filter
(
resource
->
isAllocationActiveToday
(
resource
)).
findAny
().
orElse
(
getLatestResourceByEmpId
(
employeeId
));
}
public
Resource
getCurrentAllocationIfNotReturnNull
(
String
employeeId
)
{
return
resourceRepo
.
findByEmployeeId
(
employeeId
).
stream
().
filter
(
resource
->
isAllocationActiveToday
(
resource
)).
findAny
().
orElse
(
null
);
}
}
//class
...
...
src/main/java/com/nisum/myteam/utils/MyTeamUtils.java
View file @
276c4723
...
...
@@ -13,7 +13,7 @@ public class MyTeamUtils {
//public final static String driverUrl = "jdbc:ucanaccess://";
//public final static String msdriveUrl ="jdbc:sqlserver://";
public
final
static
String
RELEASED_STATUS
=
"Released"
;
public
final
static
String
STATUS_RELEASED
=
"Released"
;
public
final
static
String
STATUS_ENGAGED
=
"Engaged"
;
public
static
final
String
STATUS_PROPOSED
=
"Proposed"
;
...
...
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