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
ade1a202
Commit
ade1a202
authored
Jun 17, 2019
by
Prayas Jain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added delete functionality
parent
c1fa3b8d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
911 additions
and
897 deletions
+911
-897
ResourceService.java
...n/java/com/nisum/myteam/service/impl/ResourceService.java
+909
-892
ProjectController.js
src/main/webapp/WEB-INF/controllers/ProjectController.js
+1
-4
projectTeamDetails.html
src/main/webapp/WEB-INF/templates/projectTeamDetails.html
+1
-1
No files found.
src/main/java/com/nisum/myteam/service/impl/ResourceService.java
View file @
ade1a202
...
@@ -50,7 +50,6 @@ public class ResourceService implements IResourceService {
...
@@ -50,7 +50,6 @@ public class ResourceService implements IResourceService {
public
HashMap
<
String
,
Object
>
respMap
=
new
HashMap
<>();
public
HashMap
<
String
,
Object
>
respMap
=
new
HashMap
<>();
private
Resource
getLatestAllocation
(
List
<
Resource
>
resourceAllocList
)
{
private
Resource
getLatestAllocation
(
List
<
Resource
>
resourceAllocList
)
{
Resource
latestAlloc
=
null
;
Resource
latestAlloc
=
null
;
if
(!
resourceAllocList
.
isEmpty
())
{
if
(!
resourceAllocList
.
isEmpty
())
{
...
@@ -71,13 +70,14 @@ public class ResourceService implements IResourceService {
...
@@ -71,13 +70,14 @@ public class ResourceService implements IResourceService {
public
Resource
addResource
(
Resource
resourceReq
,
String
loginEmpId
)
throws
MyTeamException
{
public
Resource
addResource
(
Resource
resourceReq
,
String
loginEmpId
)
throws
MyTeamException
{
List
<
Resource
>
resourceAllocationList
=
resourceRepo
.
findByEmployeeId
(
resourceReq
.
getEmployeeId
());
List
<
Resource
>
resourceAllocationList
=
resourceRepo
.
findByEmployeeId
(
resourceReq
.
getEmployeeId
());
Resource
prevAllocation
=
getLatestAllocation
(
resourceAllocationList
.
stream
().
filter
(
r
->
isAllocationActiveToday
(
r
)).
collect
(
Collectors
.
toList
()));
Resource
prevAllocation
=
getLatestAllocation
(
resourceAllocationList
.
stream
().
filter
(
r
->
isAllocationActiveToday
(
r
)).
collect
(
Collectors
.
toList
()));
Resource
resourcePers
=
null
;
Resource
resourcePers
=
null
;
if
(
prevAllocation
!=
null
)
{
if
(
prevAllocation
!=
null
)
{
prevAllocation
.
setBillingEndDate
(
MyTeamDateUtils
.
getDayLessThanDate
(
resourceReq
.
getBillingStartDate
()));
prevAllocation
.
setBillingEndDate
(
MyTeamDateUtils
.
getDayLessThanDate
(
resourceReq
.
getBillingStartDate
()));
this
.
updateExistedResource
(
prevAllocation
);
//
updateLatestProjectAllocationToEnd
this
.
updateExistedResource
(
prevAllocation
);
//
updateLatestProjectAllocationToEnd
resourcePers
=
resourceRepo
.
save
(
resourceReq
);
//
createNewProjectAllocationtoStart
resourcePers
=
resourceRepo
.
save
(
resourceReq
);
//
createNewProjectAllocationtoStart
}
}
return
resourcePers
;
return
resourcePers
;
}
}
...
@@ -96,7 +96,6 @@ public class ResourceService implements IResourceService {
...
@@ -96,7 +96,6 @@ public class ResourceService implements IResourceService {
return
isExists
;
return
isExists
;
}
}
public
void
updateResourceDetails
(
Resource
resourceReq
,
String
loginEmpId
)
throws
MyTeamException
{
public
void
updateResourceDetails
(
Resource
resourceReq
,
String
loginEmpId
)
throws
MyTeamException
{
// List<Resource> resourceAllocList = resourceRepo.findByEmployeeIdAndProjectId(resourceReq.getEmployeeId(), resourceReq.getProjectId());
// List<Resource> resourceAllocList = resourceRepo.findByEmployeeIdAndProjectId(resourceReq.getEmployeeId(), resourceReq.getProjectId());
...
@@ -127,30 +126,35 @@ public class ResourceService implements IResourceService {
...
@@ -127,30 +126,35 @@ public class ResourceService implements IResourceService {
Resource
resource
=
resourceRepo
.
findById
(
resourceReq
.
getId
());
Resource
resource
=
resourceRepo
.
findById
(
resourceReq
.
getId
());
if
(
resource
!=
null
)
{
if
(
resource
!=
null
)
{
if
(!
resourceReq
.
getStatus
().
equalsIgnoreCase
(
MyTeamUtils
.
RELEASED_STATUS
)){
if
(!
resourceReq
.
getStatus
().
equalsIgnoreCase
(
MyTeamUtils
.
RELEASED_STATUS
))
{
Resource
latestAllocation
=
this
.
getLatestAllocation
(
resourceRepo
.
findByEmployeeId
(
resourceReq
.
getEmployeeId
()));
Resource
latestAllocation
=
this
.
getLatestAllocation
(
resourceRepo
.
findByEmployeeId
(
resourceReq
.
getEmployeeId
()));
if
(
latestAllocation
!=
null
&&
!
latestAllocation
.
getProjectId
().
equalsIgnoreCase
(
resourceReq
.
getProjectId
())&&
if
(
latestAllocation
!=
null
!
latestAllocation
.
getBillingStartDate
().
after
(
resourceReq
.
getBillingEndDate
()))
{
&&
!
latestAllocation
.
getProjectId
().
equalsIgnoreCase
(
resourceReq
.
getProjectId
())
&&
!
latestAllocation
.
getBillingStartDate
().
after
(
resourceReq
.
getBillingEndDate
()))
{
respMap
.
put
(
"statusCode"
,
811
);
respMap
.
put
(
"statusCode"
,
811
);
respMap
.
put
(
"message"
,
"Resource is already allocated after "
+
latestAllocation
.
getBillingStartDate
());
respMap
.
put
(
"message"
,
}
else
{
"Resource is already allocated after "
+
latestAllocation
.
getBillingStartDate
());
}
else
{
if
(
resourceReq
.
getBillingEndDate
().
compareTo
(
new
Date
())
<
0
)
{
if
(
resourceReq
.
getBillingEndDate
().
compareTo
(
new
Date
())
<
0
)
{
resourceReq
.
setStatus
(
MyTeamUtils
.
RELEASED_STATUS
);
//
update Status of allocation
resourceReq
.
setStatus
(
MyTeamUtils
.
RELEASED_STATUS
);
//
update Status of allocation
Resource
resourceBench
=
new
Resource
();
Resource
resourceBench
=
new
Resource
();
resourceBench
.
setProjectId
(
MyTeamUtils
.
BENCH_PROJECT_ID
);
resourceBench
.
setProjectId
(
MyTeamUtils
.
BENCH_PROJECT_ID
);
resourceBench
.
setEmployeeId
(
resourceReq
.
getEmployeeId
());
resourceBench
.
setEmployeeId
(
resourceReq
.
getEmployeeId
());
resourceBench
.
setResourceRole
(
resourceReq
.
getResourceRole
());
resourceBench
.
setResourceRole
(
resourceReq
.
getResourceRole
());
resourceBench
.
setStatus
(
MyTeamUtils
.
RELEASED_STATUS
);
//add alocation status as Released
resourceBench
.
setStatus
(
MyTeamUtils
.
RELEASED_STATUS
);
// add alocation status as Released
resourceBench
.
setBillingStartDate
(
MyTeamDateUtils
.
getDayMoreThanDate
(
resourceReq
.
getBillingEndDate
()));
resourceBench
.
setBillingStartDate
(
resourceBench
.
setBillingEndDate
(
projectService
.
getProjectByProjectId
(
MyTeamUtils
.
BENCH_PROJECT_ID
).
getProjectEndDate
());
MyTeamDateUtils
.
getDayMoreThanDate
(
resourceReq
.
getBillingEndDate
()));
resourceBench
.
setBillingEndDate
(
projectService
.
getProjectByProjectId
(
MyTeamUtils
.
BENCH_PROJECT_ID
).
getProjectEndDate
());
resourceBench
.
setBillableStatus
(
MyTeamUtils
.
BENCH_BILLABILITY_STATUS
);
resourceBench
.
setBillableStatus
(
MyTeamUtils
.
BENCH_BILLABILITY_STATUS
);
resourceBench
.
setAuditFields
(
loginEmpId
,
MyTeamUtils
.
CREATE
);
resourceBench
.
setAuditFields
(
loginEmpId
,
MyTeamUtils
.
CREATE
);
resourceRepo
.
save
(
resourceBench
);
resourceRepo
.
save
(
resourceBench
);
}
}
this
.
updateExistedResource
(
resourceReq
);
this
.
updateExistedResource
(
resourceReq
);
}
}
}
else
{
}
else
{
respMap
.
put
(
"statusCode"
,
811
);
respMap
.
put
(
"statusCode"
,
811
);
respMap
.
put
(
"message"
,
"Resource is already released from you, And you can't update this allocation"
);
respMap
.
put
(
"message"
,
"Resource is already released from you, And you can't update this allocation"
);
}
}
...
@@ -186,7 +190,8 @@ public class ResourceService implements IResourceService {
...
@@ -186,7 +190,8 @@ public class ResourceService implements IResourceService {
public
boolean
validateAllocationAgainstPrevAllocation
(
Resource
resourceReq
)
{
public
boolean
validateAllocationAgainstPrevAllocation
(
Resource
resourceReq
)
{
boolean
isValid
=
true
;
boolean
isValid
=
true
;
List
<
Resource
>
resourceAllocList
=
resourceRepo
.
findByEmployeeIdAndProjectId
(
resourceReq
.
getEmployeeId
(),
resourceReq
.
getProjectId
());
List
<
Resource
>
resourceAllocList
=
resourceRepo
.
findByEmployeeIdAndProjectId
(
resourceReq
.
getEmployeeId
(),
resourceReq
.
getProjectId
());
Resource
prevAllocation
=
this
.
getLatestAllocation
(
resourceAllocList
);
Resource
prevAllocation
=
this
.
getLatestAllocation
(
resourceAllocList
);
if
(
prevAllocation
!=
null
)
{
if
(
prevAllocation
!=
null
)
{
if
(!
prevAllocation
.
getBillingStartDate
().
before
(
resourceReq
.
getBillingStartDate
()))
{
if
(!
prevAllocation
.
getBillingStartDate
().
before
(
resourceReq
.
getBillingStartDate
()))
{
...
@@ -203,7 +208,8 @@ public class ResourceService implements IResourceService {
...
@@ -203,7 +208,8 @@ public class ResourceService implements IResourceService {
return
isValid
;
return
isValid
;
}
}
public
boolean
validateBillingStartEndDateAgainstProjectStartEndDate
(
Resource
resource
,
String
loginEmpId
)
throws
MyTeamException
{
public
boolean
validateBillingStartEndDateAgainstProjectStartEndDate
(
Resource
resource
,
String
loginEmpId
)
throws
MyTeamException
{
boolean
isValid
=
true
;
boolean
isValid
=
true
;
...
@@ -226,7 +232,10 @@ public class ResourceService implements IResourceService {
...
@@ -226,7 +232,10 @@ public class ResourceService implements IResourceService {
log
.
info
(
"ResourceALloc Req::"
+
resource
);
log
.
info
(
"ResourceALloc Req::"
+
resource
);
log
.
info
(
""
+
project
.
getProjectEndDate
().
toString
());
log
.
info
(
""
+
project
.
getProjectEndDate
().
toString
());
//if (!resourceAllocation.getBillingEndDate().before(project.getProjectEndDate())|| !resourceAllocation.getBillingEndDate().equals(project.getProjectEndDate())) {
// if
// (!resourceAllocation.getBillingEndDate().before(project.getProjectEndDate())||
// !resourceAllocation.getBillingEndDate().equals(project.getProjectEndDate()))
// {
if
(!(
resource
.
getBillingEndDate
().
compareTo
(
project
.
getProjectEndDate
())
<=
0
))
{
if
(!(
resource
.
getBillingEndDate
().
compareTo
(
project
.
getProjectEndDate
())
<=
0
))
{
log
.
info
(
"Billing end date should be on or before Project End Date."
);
log
.
info
(
"Billing end date should be on or before Project End Date."
);
respMap
.
put
(
"statusCode"
,
813
);
respMap
.
put
(
"statusCode"
,
813
);
...
@@ -238,7 +247,6 @@ public class ResourceService implements IResourceService {
...
@@ -238,7 +247,6 @@ public class ResourceService implements IResourceService {
return
isValid
;
return
isValid
;
}
}
public
boolean
validateBillingStartDateAgainstDOJ
(
Resource
resource
)
{
public
boolean
validateBillingStartDateAgainstDOJ
(
Resource
resource
)
{
String
message
=
""
;
String
message
=
""
;
boolean
isValid
=
true
;
boolean
isValid
=
true
;
...
@@ -256,51 +264,58 @@ public class ResourceService implements IResourceService {
...
@@ -256,51 +264,58 @@ public class ResourceService implements IResourceService {
return
isValid
;
return
isValid
;
}
}
public
boolean
isResourceAvailable
(
Resource
resourceReq
)
{
public
boolean
isResourceAvailable
(
Resource
resourceReq
)
{
boolean
isAssigned
=
true
;
boolean
isAssigned
=
true
;
String
message
=
""
;
String
message
=
""
;
List
<
Resource
>
resourceAllocList
=
resourceRepo
.
findByEmployeeId
(
resourceReq
.
getEmployeeId
());
//getting all allocations of employee
List
<
Resource
>
resourceAllocList
=
resourceRepo
.
findByEmployeeId
(
resourceReq
.
getEmployeeId
());
// getting all
// allocations
Resource
resourceLatestRecord
=
getLatestAllocation
(
resourceAllocList
.
stream
().
// of employee
filter
(
r
->
r
.
getProjectId
().
equalsIgnoreCase
(
MyTeamUtils
.
BENCH_PROJECT_ID
)).
collect
(
Collectors
.
toList
()));
//getting latest allocation of employee in bench project
Resource
resourceLatestRecord
=
getLatestAllocation
(
if
(
resourceLatestRecord
!=
null
&&
!
isAllocationActiveToday
(
resourceLatestRecord
)){
resourceAllocList
.
stream
().
filter
(
r
->
r
.
getProjectId
().
equalsIgnoreCase
(
MyTeamUtils
.
BENCH_PROJECT_ID
))
Resource
latestProjectResource
=
getLatestAllocation
(
resourceAllocList
.
stream
().
.
collect
(
Collectors
.
toList
()));
// getting latest allocation of employee in bench project
filter
(
r
->
!
r
.
getProjectId
().
equalsIgnoreCase
(
MyTeamUtils
.
BENCH_PROJECT_ID
)).
collect
(
Collectors
.
toList
()));
if
(!
resourceReq
.
getProjectId
().
equalsIgnoreCase
(
latestProjectResource
.
getProjectId
()))
{
if
(
resourceLatestRecord
!=
null
&&
!
isAllocationActiveToday
(
resourceLatestRecord
))
{
Resource
latestProjectResource
=
getLatestAllocation
(
resourceAllocList
.
stream
()
.
filter
(
r
->
!
r
.
getProjectId
().
equalsIgnoreCase
(
MyTeamUtils
.
BENCH_PROJECT_ID
))
.
collect
(
Collectors
.
toList
()));
if
(!
resourceReq
.
getProjectId
().
equalsIgnoreCase
(
latestProjectResource
.
getProjectId
()))
{
message
=
"Resource "
+
latestProjectResource
.
getEmployeeId
()
+
" already Assigned to the "
message
=
"Resource "
+
latestProjectResource
.
getEmployeeId
()
+
" already Assigned to the "
+
projectService
.
getProjectByProjectId
(
latestProjectResource
.
getProjectId
()).
getProjectName
()
+
projectService
.
getProjectByProjectId
(
latestProjectResource
.
getProjectId
()).
getProjectName
()
+
" Project"
+
" from "
+
latestProjectResource
.
getBillingStartDate
()
+
"to "
+
latestProjectResource
.
getBillingEndDate
();
+
" Project"
+
" from "
+
latestProjectResource
.
getBillingStartDate
()
+
"to "
+
latestProjectResource
.
getBillingEndDate
();
isAssigned
=
false
;
isAssigned
=
false
;
respMap
.
put
(
"statusCode"
,
815
);
respMap
.
put
(
"statusCode"
,
815
);
respMap
.
put
(
"message"
,
message
);
respMap
.
put
(
"message"
,
message
);
}
}
}
else
{
}
else
{
if
(!
validateResourceBillingEndDateAgainstBench
(
resourceReq
))
{
if
(!
validateResourceBillingEndDateAgainstBench
(
resourceReq
))
{
isAssigned
=
false
;
isAssigned
=
false
;
}
}
}
}
return
isAssigned
;
return
isAssigned
;
}
}
public
boolean
validateResourceBillingEndDateAgainstBench
(
Resource
resourceReq
)
{
public
boolean
validateResourceBillingEndDateAgainstBench
(
Resource
resourceReq
)
{
boolean
isValid
=
true
;
boolean
isValid
=
true
;
String
message
=
""
;
String
message
=
""
;
List
<
Resource
>
resourceAllocList
=
resourceRepo
.
findByEmployeeIdAndProjectId
(
resourceReq
.
getEmployeeId
(),
MyTeamUtils
.
BENCH_PROJECT_ID
);
List
<
Resource
>
resourceAllocList
=
resourceRepo
.
findByEmployeeIdAndProjectId
(
resourceReq
.
getEmployeeId
(),
MyTeamUtils
.
BENCH_PROJECT_ID
);
Resource
resourceBenchLatestRecord
=
getLatestAllocation
(
resourceAllocList
.
stream
().
Resource
resourceBenchLatestRecord
=
getLatestAllocation
(
filter
(
r
->
r
.
getProjectId
().
equalsIgnoreCase
(
MyTeamUtils
.
BENCH_PROJECT_ID
)).
collect
(
Collectors
.
toList
()));
resourceAllocList
.
stream
().
filter
(
r
->
r
.
getProjectId
().
equalsIgnoreCase
(
MyTeamUtils
.
BENCH_PROJECT_ID
))
.
collect
(
Collectors
.
toList
()));
if
(!
isAllocationActiveToday
(
resourceBenchLatestRecord
))
{
if
(!
isAllocationActiveToday
(
resourceBenchLatestRecord
))
{
isValid
=
false
;
isValid
=
false
;
message
=
"Resource is not available for allocation"
;
message
=
"Resource is not available for allocation"
;
}
else
if
(!(
resourceReq
.
getBillingEndDate
().
before
(
resourceBenchLatestRecord
.
getBillingEndDate
())
&&
}
else
if
(!(
resourceReq
.
getBillingEndDate
().
before
(
resourceBenchLatestRecord
.
getBillingEndDate
())
resourceReq
.
getBillingStartDate
().
after
(
resourceBenchLatestRecord
.
getBillingStartDate
()))){
&&
resourceReq
.
getBillingStartDate
().
after
(
resourceBenchLatestRecord
.
getBillingStartDate
())))
{
message
=
"Resource is available from "
+
resourceBenchLatestRecord
.
getBillingStartDate
()+
" to "
+
resourceBenchLatestRecord
.
getBillingEndDate
();
message
=
"Resource is available from "
+
resourceBenchLatestRecord
.
getBillingStartDate
()
+
" to "
+
resourceBenchLatestRecord
.
getBillingEndDate
();
isValid
=
false
;
isValid
=
false
;
}
}
respMap
.
put
(
"statusCode"
,
810
);
respMap
.
put
(
"statusCode"
,
810
);
...
@@ -308,30 +323,38 @@ public class ResourceService implements IResourceService {
...
@@ -308,30 +323,38 @@ public class ResourceService implements IResourceService {
return
isValid
;
return
isValid
;
}
}
public
boolean
isAllocationActiveToday
(
Resource
resource
)
{
public
boolean
isAllocationActiveToday
(
Resource
resource
)
{
boolean
isActive
=
true
;
boolean
isActive
=
true
;
if
(
resource
.
getBillingStartDate
().
compareTo
(
new
Date
())
<=
0
&&
if
(
resource
.
getBillingStartDate
().
compareTo
(
new
Date
())
<=
0
resource
.
getBillingEndDate
().
compareTo
(
new
Date
())>=
0
)
{
&&
resource
.
getBillingEndDate
().
compareTo
(
new
Date
())
>=
0
)
{
isActive
=
true
;
isActive
=
true
;
}
else
{
}
else
{
isActive
=
false
;
isActive
=
false
;
}
}
return
isActive
;
return
isActive
;
}
}
public
void
deleteResource
(
Resource
resourceReq
,
String
loginEmpId
)
{
public
void
deleteResource
(
Resource
resourceReq
,
String
loginEmpId
)
{
resourceRepo
.
delete
(
resourceReq
);
resourceRepo
.
delete
(
resourceReq
);
}
}
public
void
deleteAndUpdateAllocation
(
Resource
resourceReq
,
String
loginEmpId
)
{
public
void
deleteAndUpdateAllocation
(
Resource
resourceReq
,
String
loginEmpId
)
{
List
<
Resource
>
empAllAllocations
=
resourceRepo
.
findByEmployeeId
(
resourceReq
.
getEmployeeId
());
List
<
Resource
>
empAllAllocations
=
resourceRepo
.
findByEmployeeId
(
resourceReq
.
getEmployeeId
());
Resource
latestAllocation
=
this
.
getLatestAllocation
(
empAllAllocations
.
stream
().
filter
(
r
->
!
r
.
getId
().
equals
(
resourceReq
.
getId
())).
collect
(
Collectors
.
toList
()));
Resource
latestAllocation
=
this
.
getLatestAllocation
(
empAllAllocations
.
stream
()
if
(
latestAllocation
!=
null
&&
latestAllocation
.
getProjectId
().
equalsIgnoreCase
(
MyTeamUtils
.
BENCH_PROJECT_ID
)){
.
filter
(
r
->
!
r
.
getId
().
equals
(
resourceReq
.
getId
())).
collect
(
Collectors
.
toList
()));
latestAllocation
.
setBillingEndDate
(
projectService
.
getProjectByProjectId
(
MyTeamUtils
.
BENCH_PROJECT_ID
).
getProjectEndDate
());
Resource
resource
=
resourceRepo
.
findById
(
resourceReq
.
getId
());
if
(
resource
!=
null
)
{
if
(
latestAllocation
!=
null
&&
latestAllocation
.
getProjectId
().
equalsIgnoreCase
(
MyTeamUtils
.
BENCH_PROJECT_ID
))
{
latestAllocation
.
setBillingEndDate
(
projectService
.
getProjectByProjectId
(
MyTeamUtils
.
BENCH_PROJECT_ID
).
getProjectEndDate
());
this
.
updateExistedResource
(
latestAllocation
);
this
.
updateExistedResource
(
latestAllocation
);
this
.
deleteResource
(
resourceReq
,
loginEmpId
);
}
this
.
deleteResource
(
resourceReq
,
loginEmpId
);
}
else
{
respMap
.
put
(
"statusCode"
,
811
);
respMap
.
put
(
"message"
,
"Record Not Found"
);
}
}
}
}
...
@@ -340,7 +363,6 @@ public class ResourceService implements IResourceService {
...
@@ -340,7 +363,6 @@ public class ResourceService implements IResourceService {
return
resourceRepo
.
findAll
();
return
resourceRepo
.
findAll
();
}
}
public
List
<
ResourceVO
>
getAllResourcesVO
()
{
public
List
<
ResourceVO
>
getAllResourcesVO
()
{
return
getAllResources
().
stream
().
map
(
resource
->
{
return
getAllResources
().
stream
().
map
(
resource
->
{
...
@@ -373,7 +395,8 @@ public class ResourceService implements IResourceService {
...
@@ -373,7 +395,8 @@ public class ResourceService implements IResourceService {
}
}
}
}
//Account account=accountService.getAccountById(domainService.getDomainById(project.getProjectId()).getAccountId());
// Account
// account=accountService.getAccountById(domainService.getDomainById(project.getProjectId()).getAccountId());
resourceVO
.
setBillableStatus
(
resource
.
getBillableStatus
());
resourceVO
.
setBillableStatus
(
resource
.
getBillableStatus
());
resourceVO
.
setBillingStartDate
(
resource
.
getBillingStartDate
());
resourceVO
.
setBillingStartDate
(
resource
.
getBillingStartDate
());
...
@@ -414,7 +437,6 @@ public class ResourceService implements IResourceService {
...
@@ -414,7 +437,6 @@ public class ResourceService implements IResourceService {
return
resourcesList
;
return
resourcesList
;
}
}
public
List
<
ResourceVO
>
prepareProjectTeamMembersList
(
String
projectId
)
{
public
List
<
ResourceVO
>
prepareProjectTeamMembersList
(
String
projectId
)
{
List
<
ResourceVO
>
finalResourcesList
=
new
ArrayList
<>();
List
<
ResourceVO
>
finalResourcesList
=
new
ArrayList
<>();
Employee
employee
=
null
;
Employee
employee
=
null
;
...
@@ -454,7 +476,6 @@ public class ResourceService implements IResourceService {
...
@@ -454,7 +476,6 @@ public class ResourceService implements IResourceService {
return
resourceRepo
.
findByProjectId
(
projectId
);
return
resourceRepo
.
findByProjectId
(
projectId
);
}
}
@Override
@Override
public
List
<
Resource
>
getAllResourcesForAllActiveProjects
()
{
public
List
<
Resource
>
getAllResourcesForAllActiveProjects
()
{
List
<
Resource
>
resourceList
=
new
ArrayList
<>();
List
<
Resource
>
resourceList
=
new
ArrayList
<>();
...
@@ -466,7 +487,6 @@ public class ResourceService implements IResourceService {
...
@@ -466,7 +487,6 @@ public class ResourceService implements IResourceService {
return
resourceList
;
return
resourceList
;
}
}
@Override
@Override
public
List
<
ResourceVO
>
getResourcesForProject
(
String
projectId
,
String
statusFlag
)
{
public
List
<
ResourceVO
>
getResourcesForProject
(
String
projectId
,
String
statusFlag
)
{
List
<
ResourceVO
>
resourcesList
=
new
ArrayList
<>();
List
<
ResourceVO
>
resourcesList
=
new
ArrayList
<>();
...
@@ -478,7 +498,8 @@ public class ResourceService implements IResourceService {
...
@@ -478,7 +498,8 @@ public class ResourceService implements IResourceService {
ResourceVO
resourceVO
=
new
ResourceVO
();
ResourceVO
resourceVO
=
new
ResourceVO
();
resourceVO
.
setId
(
resource
.
getId
());
resourceVO
.
setId
(
resource
.
getId
());
resourceVO
.
setProjectId
(
resource
.
getProjectId
());
resourceVO
.
setProjectId
(
resource
.
getProjectId
());
resourceVO
.
setProjectName
(
projectService
.
getProjectByProjectId
(
resource
.
getProjectId
()).
getProjectName
());
resourceVO
.
setProjectName
(
projectService
.
getProjectByProjectId
(
resource
.
getProjectId
()).
getProjectName
());
resourceVO
.
setResourceRole
(
resource
.
getResourceRole
());
resourceVO
.
setResourceRole
(
resource
.
getResourceRole
());
resourceVO
.
setBillingStartDate
(
resource
.
getBillingStartDate
());
resourceVO
.
setBillingStartDate
(
resource
.
getBillingStartDate
());
resourceVO
.
setBillingEndDate
(
resource
.
getBillingEndDate
());
resourceVO
.
setBillingEndDate
(
resource
.
getBillingEndDate
());
...
@@ -491,12 +512,12 @@ public class ResourceService implements IResourceService {
...
@@ -491,12 +512,12 @@ public class ResourceService implements IResourceService {
resourceVO
.
setEmployeeName
(
employee
.
getEmployeeName
());
resourceVO
.
setEmployeeName
(
employee
.
getEmployeeName
());
resourceVO
.
setDesignation
(
employee
.
getDesignation
());
resourceVO
.
setDesignation
(
employee
.
getDesignation
());
// Active
// Active
if
(
statusFlag
.
equals
(
ResourceStatus
.
ACTIVE
.
getStatus
())
&&
billingEndDate
.
compareTo
(
new
Date
())
>=
0
)
{
if
(
statusFlag
.
equals
(
ResourceStatus
.
ACTIVE
.
getStatus
())
&&
billingEndDate
.
compareTo
(
new
Date
())
>=
0
)
{
resourceVO
.
setResourceStatus
(
ResourceStatus
.
ACTIVE
.
getStatus
());
resourceVO
.
setResourceStatus
(
ResourceStatus
.
ACTIVE
.
getStatus
());
resourcesList
.
add
(
resourceVO
);
resourcesList
.
add
(
resourceVO
);
}
else
if
(
statusFlag
.
equals
(
ResourceStatus
.
IN_ACTIVE
.
getStatus
())
&&
billingEndDate
.
compareTo
(
new
Date
())
<
0
)
{
}
else
if
(
statusFlag
.
equals
(
ResourceStatus
.
IN_ACTIVE
.
getStatus
())
&&
billingEndDate
.
compareTo
(
new
Date
())
<
0
)
{
resourceVO
.
setResourceStatus
(
ResourceStatus
.
IN_ACTIVE
.
getStatus
());
resourceVO
.
setResourceStatus
(
ResourceStatus
.
IN_ACTIVE
.
getStatus
());
resourcesList
.
add
(
resourceVO
);
resourcesList
.
add
(
resourceVO
);
}
else
if
(
statusFlag
.
equals
(
MyTeamUtils
.
BOTH
))
}
else
if
(
statusFlag
.
equals
(
MyTeamUtils
.
BOTH
))
...
@@ -508,7 +529,6 @@ public class ResourceService implements IResourceService {
...
@@ -508,7 +529,6 @@ public class ResourceService implements IResourceService {
return
resourcesList
;
return
resourcesList
;
}
}
@Override
@Override
public
List
<
MyProjectAllocationVO
>
getWorkedProjectsForResource
(
String
empId
)
{
public
List
<
MyProjectAllocationVO
>
getWorkedProjectsForResource
(
String
empId
)
{
...
@@ -520,7 +540,8 @@ public class ResourceService implements IResourceService {
...
@@ -520,7 +540,8 @@ public class ResourceService implements IResourceService {
List
<
Resource
>
resourcesAllocatedList
=
resourceRepo
.
findByEmployeeId
(
empId
);
List
<
Resource
>
resourcesAllocatedList
=
resourceRepo
.
findByEmployeeId
(
empId
);
if
(
null
!=
resourcesAllocatedList
&&
!
resourcesAllocatedList
.
isEmpty
()
&&
MyTeamUtils
.
INT_ZERO
<
resourcesAllocatedList
.
size
())
{
if
(
null
!=
resourcesAllocatedList
&&
!
resourcesAllocatedList
.
isEmpty
()
&&
MyTeamUtils
.
INT_ZERO
<
resourcesAllocatedList
.
size
())
{
for
(
Resource
resourceAlloc
:
resourcesAllocatedList
)
{
for
(
Resource
resourceAlloc
:
resourcesAllocatedList
)
{
project
=
projectService
.
getProjectByProjectId
(
resourceAlloc
.
getProjectId
());
project
=
projectService
.
getProjectByProjectId
(
resourceAlloc
.
getProjectId
());
...
@@ -555,7 +576,6 @@ public class ResourceService implements IResourceService {
...
@@ -555,7 +576,6 @@ public class ResourceService implements IResourceService {
return
myProjectList
;
return
myProjectList
;
}
}
@Override
@Override
public
List
<
Resource
>
getResourcesUnderDeliveryLead
(
String
deliveryLeadId
)
{
public
List
<
Resource
>
getResourcesUnderDeliveryLead
(
String
deliveryLeadId
)
{
List
<
String
>
projectIdsList
=
new
ArrayList
<>();
List
<
String
>
projectIdsList
=
new
ArrayList
<>();
...
@@ -575,15 +595,17 @@ public class ResourceService implements IResourceService {
...
@@ -575,15 +595,17 @@ public class ResourceService implements IResourceService {
}
}
@Override
@Override
public
List
<
ResourceVO
>
getBillingsForEmployee
(
String
empId
)
{
public
List
<
ResourceVO
>
getBillingsForEmployee
(
String
empId
)
{
List
<
ResourceVO
>
finalList
=
new
ArrayList
<>();
List
<
ResourceVO
>
finalList
=
new
ArrayList
<>();
List
<
Resource
>
resourcesList
=
resourceRepo
.
findByEmployeeId
(
empId
);
List
<
Resource
>
resourcesList
=
resourceRepo
.
findByEmployeeId
(
empId
);
if
(
resourcesList
!=
null
&&
resourcesList
.
size
()
>
0
)
{
if
(
resourcesList
!=
null
&&
resourcesList
.
size
()
>
0
)
{
log
.
info
(
"The resources billing list before sorting::"
+
resourcesList
);
log
.
info
(
"The resources billing list before sorting::"
+
resourcesList
);
//return billingsList.stream().sorted(Comparator.comparing(Billing::getCreatedOn).reversed()).collect(Collectors.toList());
// return
List
<
Resource
>
sortedList
=
resourcesList
.
stream
().
sorted
(
Comparator
.
comparing
(
Resource:
:
getBillingStartDate
).
reversed
()).
collect
(
Collectors
.
toList
());
// billingsList.stream().sorted(Comparator.comparing(Billing::getCreatedOn).reversed()).collect(Collectors.toList());
List
<
Resource
>
sortedList
=
resourcesList
.
stream
()
.
sorted
(
Comparator
.
comparing
(
Resource:
:
getBillingStartDate
).
reversed
())
.
collect
(
Collectors
.
toList
());
finalList
=
convertResourcesToResourcesVO
(
sortedList
);
finalList
=
convertResourcesToResourcesVO
(
sortedList
);
}
}
...
@@ -597,13 +619,14 @@ public class ResourceService implements IResourceService {
...
@@ -597,13 +619,14 @@ public class ResourceService implements IResourceService {
if
(
resourcesList
==
null
||
resourcesList
.
size
()
==
0
)
{
if
(
resourcesList
==
null
||
resourcesList
.
size
()
==
0
)
{
return
resourcesList
;
return
resourcesList
;
}
else
{
}
else
{
//return billingsList.stream().sorted(Comparator.comparing(Billing::getCreatedOn).reversed()).collect(Collectors.toList());
// return
return
resourcesList
.
stream
().
sorted
(
Comparator
.
comparing
(
Resource:
:
getBillingStartDate
).
reversed
()).
collect
(
Collectors
.
toList
());
// billingsList.stream().sorted(Comparator.comparing(Billing::getCreatedOn).reversed()).collect(Collectors.toList());
return
resourcesList
.
stream
().
sorted
(
Comparator
.
comparing
(
Resource:
:
getBillingStartDate
).
reversed
())
.
collect
(
Collectors
.
toList
());
}
}
}
}
@Override
@Override
public
List
<
Employee
>
getUnAssignedEmployees
()
{
public
List
<
Employee
>
getUnAssignedEmployees
()
{
...
@@ -625,7 +648,6 @@ public class ResourceService implements IResourceService {
...
@@ -625,7 +648,6 @@ public class ResourceService implements IResourceService {
return
notAssignedEmployees
;
return
notAssignedEmployees
;
}
}
public
void
deleteResourcesUnderProject
(
String
projectId
)
{
public
void
deleteResourcesUnderProject
(
String
projectId
)
{
Query
query
=
new
Query
(
Criteria
.
where
(
"projectId"
).
is
(
projectId
));
Query
query
=
new
Query
(
Criteria
.
where
(
"projectId"
).
is
(
projectId
));
List
<
Resource
>
list
=
mongoTemplate
.
find
(
query
,
Resource
.
class
);
List
<
Resource
>
list
=
mongoTemplate
.
find
(
query
,
Resource
.
class
);
...
@@ -633,7 +655,6 @@ public class ResourceService implements IResourceService {
...
@@ -633,7 +655,6 @@ public class ResourceService implements IResourceService {
resourceRepo
.
delete
(
list
);
resourceRepo
.
delete
(
list
);
}
}
private
List
<
ResourceVO
>
convertResourcesToResourcesVO
(
List
<
Resource
>
resourcesList
)
{
private
List
<
ResourceVO
>
convertResourcesToResourcesVO
(
List
<
Resource
>
resourcesList
)
{
List
<
ResourceVO
>
finalList
=
new
ArrayList
<>();
List
<
ResourceVO
>
finalList
=
new
ArrayList
<>();
...
@@ -668,7 +689,8 @@ public class ResourceService implements IResourceService {
...
@@ -668,7 +689,8 @@ public class ResourceService implements IResourceService {
}
}
}
}
//Account account=accountService.getAccountById(domainService.getDomainById(project.getProjectId()).getAccountId());
// Account
// account=accountService.getAccountById(domainService.getDomainById(project.getProjectId()).getAccountId());
resourceVO
.
setBillableStatus
(
resource
.
getBillableStatus
());
resourceVO
.
setBillableStatus
(
resource
.
getBillableStatus
());
resourceVO
.
setBillingStartDate
(
resource
.
getBillingStartDate
());
resourceVO
.
setBillingStartDate
(
resource
.
getBillingStartDate
());
...
@@ -687,7 +709,6 @@ public class ResourceService implements IResourceService {
...
@@ -687,7 +709,6 @@ public class ResourceService implements IResourceService {
return
finalList
;
return
finalList
;
}
}
@Override
@Override
public
Resource
addResourceToBenchProject
(
Employee
employee
,
String
loginEmpId
)
throws
MyTeamException
{
public
Resource
addResourceToBenchProject
(
Employee
employee
,
String
loginEmpId
)
throws
MyTeamException
{
Resource
resourcePersisted
=
null
;
Resource
resourcePersisted
=
null
;
...
@@ -697,17 +718,18 @@ public class ResourceService implements IResourceService {
...
@@ -697,17 +718,18 @@ public class ResourceService implements IResourceService {
resourceBench
.
setEmployeeId
(
employee
.
getEmployeeId
());
resourceBench
.
setEmployeeId
(
employee
.
getEmployeeId
());
resourceBench
.
setResourceRole
(
employee
.
getRole
());
resourceBench
.
setResourceRole
(
employee
.
getRole
());
resourceBench
.
setStatus
(
MyTeamUtils
.
RELEASED_STATUS
);
resourceBench
.
setStatus
(
MyTeamUtils
.
RELEASED_STATUS
);
resourceBench
.
setBillingStartDate
(
employee
.
getDateOfJoining
()
!=
null
?
employee
.
getDateOfJoining
()
:
new
Date
());
resourceBench
.
setBillingStartDate
(
employee
.
getDateOfJoining
()
!=
null
?
employee
.
getDateOfJoining
()
:
new
Date
());
resourceBench
.
setBillableStatus
(
MyTeamUtils
.
BENCH_BILLABILITY_STATUS
);
resourceBench
.
setBillableStatus
(
MyTeamUtils
.
BENCH_BILLABILITY_STATUS
);
resourceBench
.
setEmployeeId
(
employee
.
getEmployeeId
());
resourceBench
.
setEmployeeId
(
employee
.
getEmployeeId
());
resourceBench
.
setBillingEndDate
(
projectService
.
getProjectByProjectId
(
MyTeamUtils
.
BENCH_PROJECT_ID
).
getProjectEndDate
());
resourceBench
.
setBillingEndDate
(
projectService
.
getProjectByProjectId
(
MyTeamUtils
.
BENCH_PROJECT_ID
).
getProjectEndDate
());
resourcePersisted
=
addResource
(
resourceBench
,
loginEmpId
);
resourcePersisted
=
addResource
(
resourceBench
,
loginEmpId
);
return
resourcePersisted
;
return
resourcePersisted
;
}
}
@Override
@Override
public
List
<
EmployeeShiftsVO
>
getResourcesForShift
(
String
shift
)
{
public
List
<
EmployeeShiftsVO
>
getResourcesForShift
(
String
shift
)
{
List
<
Resource
>
resourcesListPers
=
null
;
List
<
Resource
>
resourcesListPers
=
null
;
...
@@ -742,13 +764,14 @@ public class ResourceService implements IResourceService {
...
@@ -742,13 +764,14 @@ public class ResourceService implements IResourceService {
if
(
employee
!=
null
)
{
if
(
employee
!=
null
)
{
if
(
shift
.
equalsIgnoreCase
(
employee
.
getShift
()))
if
(
shift
.
equalsIgnoreCase
(
employee
.
getShift
()))
resourcesList
.
add
(
shiftsVO
);
resourcesList
.
add
(
shiftsVO
);
else
if
(
employee
.
getShift
()
==
null
&&
Shifts
.
SHIFT1
.
getShiftType
().
equalsIgnoreCase
(
shift
))
else
if
(
employee
.
getShift
()
==
null
&&
Shifts
.
SHIFT1
.
getShiftType
().
equalsIgnoreCase
(
shift
))
resourcesList
.
add
(
shiftsVO
);
resourcesList
.
add
(
shiftsVO
);
}
}
}
}
}
//
for
}
//
for
}
}
}
}
...
@@ -762,7 +785,6 @@ public class ResourceService implements IResourceService {
...
@@ -762,7 +785,6 @@ public class ResourceService implements IResourceService {
}
}
@Override
@Override
public
List
<
Resource
>
getResourcesByBillingStatus
(
String
resourceStatus
)
{
public
List
<
Resource
>
getResourcesByBillingStatus
(
String
resourceStatus
)
{
return
resourceRepo
.
findByBillableStatus
(
resourceStatus
);
return
resourceRepo
.
findByBillableStatus
(
resourceStatus
);
...
@@ -782,12 +804,14 @@ public class ResourceService implements IResourceService {
...
@@ -782,12 +804,14 @@ public class ResourceService implements IResourceService {
for
(
Resource
resource
:
resourcesList
)
{
for
(
Resource
resource
:
resourcesList
)
{
ReserveReportsVO
reserveReportsVO
=
new
ReserveReportsVO
();
ReserveReportsVO
reserveReportsVO
=
new
ReserveReportsVO
();
reserveReportsVO
.
setEmployeeId
(
resource
.
getEmployeeId
());
reserveReportsVO
.
setEmployeeId
(
resource
.
getEmployeeId
());
reserveReportsVO
.
setEmployeeName
(
employeeService
.
getEmployeeById
(
resource
.
getEmployeeId
()).
getEmployeeName
());
reserveReportsVO
.
setEmployeeName
(
employeeService
.
getEmployeeById
(
resource
.
getEmployeeId
()).
getEmployeeName
());
if
(
StringUtils
.
isNotBlank
(
resource
.
getProjectId
()))
{
if
(
StringUtils
.
isNotBlank
(
resource
.
getProjectId
()))
{
project
=
projectService
.
getProjectByProjectId
(
resource
.
getProjectId
());
project
=
projectService
.
getProjectByProjectId
(
resource
.
getProjectId
());
if
(
project
!=
null
)
{
if
(
project
!=
null
)
{
reserveReportsVO
.
setProjectName
(
project
.
getProjectName
());
reserveReportsVO
.
setProjectName
(
project
.
getProjectName
());
reserveReportsVO
.
setAccountName
(
accountService
.
getAccountById
(
project
.
getAccountId
()).
getAccountName
());
reserveReportsVO
.
setAccountName
(
accountService
.
getAccountById
(
project
.
getAccountId
()).
getAccountName
());
}
}
}
}
...
@@ -803,11 +827,10 @@ public class ResourceService implements IResourceService {
...
@@ -803,11 +827,10 @@ public class ResourceService implements IResourceService {
}
}
@Override
@Override
public
List
<
Resource
>
getResourceByProjectId
(
String
projectId
)
{
public
List
<
Resource
>
getResourceByProjectId
(
String
projectId
)
{
return
resourceRepo
.
findByProjectId
(
projectId
);
return
resourceRepo
.
findByProjectId
(
projectId
);
}
}
public
List
<
ChangedResourceVO
>
getChangedResourceByDate
(
String
fromDatestr
,
String
toDatestr
)
{
public
List
<
ChangedResourceVO
>
getChangedResourceByDate
(
String
fromDatestr
,
String
toDatestr
)
{
// List<ChangedResourceVO> changedResourceVOList = new ArrayList();
// List<ChangedResourceVO> changedResourceVOList = new ArrayList();
// SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy");
// SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy");
...
@@ -845,11 +868,9 @@ public class ResourceService implements IResourceService {
...
@@ -845,11 +868,9 @@ public class ResourceService implements IResourceService {
// }catch (Exception e){}
// }catch (Exception e){}
//
//
return
null
;
return
null
;
}
}
public
boolean
validateResourceAllocationStatus
(
ResourceAllocationStatus
resourceStatus
)
{
public
boolean
validateResourceAllocationStatus
(
ResourceAllocationStatus
resourceStatus
)
{
boolean
isValidStatus
=
false
;
boolean
isValidStatus
=
false
;
switch
(
resourceStatus
)
{
switch
(
resourceStatus
)
{
...
@@ -868,7 +889,6 @@ public class ResourceService implements IResourceService {
...
@@ -868,7 +889,6 @@ public class ResourceService implements IResourceService {
return
isValidStatus
;
return
isValidStatus
;
}
}
public
List
<
Resource
>
getResourcesGreaterThanBillingStartDate
(
Date
billingStartDate
)
{
public
List
<
Resource
>
getResourcesGreaterThanBillingStartDate
(
Date
billingStartDate
)
{
return
resourceRepo
.
findByBillingStartDateGreaterThan
(
billingStartDate
);
return
resourceRepo
.
findByBillingStartDateGreaterThan
(
billingStartDate
);
}
}
...
@@ -884,23 +904,26 @@ public class ResourceService implements IResourceService {
...
@@ -884,23 +904,26 @@ public class ResourceService implements IResourceService {
Project
project
=
null
;
Project
project
=
null
;
//
Setting Current Billing details.
//
Setting Current Billing details.
AllocationChangeVO
allocationVO
=
new
AllocationChangeVO
();
AllocationChangeVO
allocationVO
=
new
AllocationChangeVO
();
allocationVO
.
setEmployeeId
(
resource
.
getEmployeeId
());
allocationVO
.
setEmployeeId
(
resource
.
getEmployeeId
());
allocationVO
.
setEmployeeName
(
employeeService
.
getEmployeeById
(
resource
.
getEmployeeId
()).
getEmployeeName
());
allocationVO
.
setEmployeeName
(
employeeService
.
getEmployeeById
(
resource
.
getEmployeeId
()).
getEmployeeName
());
if
(
StringUtils
.
isNotBlank
(
resource
.
getProjectId
()))
{
if
(
StringUtils
.
isNotBlank
(
resource
.
getProjectId
()))
{
project
=
projectService
.
getProjectByProjectId
(
resource
.
getProjectId
());
project
=
projectService
.
getProjectByProjectId
(
resource
.
getProjectId
());
if
(
project
!=
null
)
{
if
(
project
!=
null
)
{
allocationVO
.
setCurrentProjectName
(
project
.
getProjectName
());
allocationVO
.
setCurrentProjectName
(
project
.
getProjectName
());
allocationVO
.
setCurrentAccountName
(
accountService
.
getAccountById
(
project
.
getAccountId
()).
getAccountName
());
allocationVO
.
setCurrentAccountName
(
accountService
.
getAccountById
(
project
.
getAccountId
()).
getAccountName
());
}
}
}
}
allocationVO
.
setCurrentBillingStatus
(
resource
.
getBillableStatus
());
allocationVO
.
setCurrentBillingStatus
(
resource
.
getBillableStatus
());
allocationVO
.
setCurrentBillingStartDate
(
resource
.
getBillingStartDate
());
allocationVO
.
setCurrentBillingStartDate
(
resource
.
getBillingStartDate
());
allocationVO
.
setCurrentBillingEndDate
(
resource
.
getBillingEndDate
());
allocationVO
.
setCurrentBillingEndDate
(
resource
.
getBillingEndDate
());
Resource
prevBilling
=
resourceRepo
.
findOneByEmployeeIdAndBillingEndDate
(
resource
.
getEmployeeId
(),
MyTeamDateUtils
.
getDayLessThanDate
(
resource
.
getBillingStartDate
()));
Resource
prevBilling
=
resourceRepo
.
findOneByEmployeeIdAndBillingEndDate
(
resource
.
getEmployeeId
(),
MyTeamDateUtils
.
getDayLessThanDate
(
resource
.
getBillingStartDate
()));
log
.
info
(
"\n\n\n The prev billing info is::"
+
prevBilling
);
log
.
info
(
"\n\n\n The prev billing info is::"
+
prevBilling
);
if
(
prevBilling
!=
null
)
{
if
(
prevBilling
!=
null
)
{
...
@@ -908,7 +931,8 @@ public class ResourceService implements IResourceService {
...
@@ -908,7 +931,8 @@ public class ResourceService implements IResourceService {
project
=
projectService
.
getProjectByProjectId
(
prevBilling
.
getProjectId
());
project
=
projectService
.
getProjectByProjectId
(
prevBilling
.
getProjectId
());
if
(
project
!=
null
)
{
if
(
project
!=
null
)
{
allocationVO
.
setPrevProjectName
(
project
.
getProjectName
());
allocationVO
.
setPrevProjectName
(
project
.
getProjectName
());
allocationVO
.
setPrevAccountName
(
accountService
.
getAccountById
(
project
.
getAccountId
()).
getAccountName
());
allocationVO
.
setPrevAccountName
(
accountService
.
getAccountById
(
project
.
getAccountId
()).
getAccountName
());
}
}
}
}
allocationVO
.
setPrevBillingStatus
(
prevBilling
.
getBillableStatus
());
allocationVO
.
setPrevBillingStatus
(
prevBilling
.
getBillableStatus
());
...
@@ -929,13 +953,15 @@ public class ResourceService implements IResourceService {
...
@@ -929,13 +953,15 @@ public class ResourceService implements IResourceService {
AllocationChangeVO
allocationVO
=
new
AllocationChangeVO
();
AllocationChangeVO
allocationVO
=
new
AllocationChangeVO
();
allocationVO
.
setEmployeeId
(
resource
.
getEmployeeId
());
allocationVO
.
setEmployeeId
(
resource
.
getEmployeeId
());
allocationVO
.
setEmployeeName
(
employeeService
.
getEmployeeById
(
resource
.
getEmployeeId
()).
getEmployeeName
());
allocationVO
.
setEmployeeName
(
employeeService
.
getEmployeeById
(
resource
.
getEmployeeId
()).
getEmployeeName
());
if
(
StringUtils
.
isNotBlank
(
resource
.
getProjectId
()))
{
if
(
StringUtils
.
isNotBlank
(
resource
.
getProjectId
()))
{
project
=
projectService
.
getProjectByProjectId
(
resource
.
getProjectId
());
project
=
projectService
.
getProjectByProjectId
(
resource
.
getProjectId
());
if
(
project
!=
null
)
{
if
(
project
!=
null
)
{
allocationVO
.
setCurrentProjectName
(
project
.
getProjectName
());
allocationVO
.
setCurrentProjectName
(
project
.
getProjectName
());
allocationVO
.
setCurrentAccountName
(
accountService
.
getAccountById
(
project
.
getAccountId
()).
getAccountName
());
allocationVO
.
setCurrentAccountName
(
accountService
.
getAccountById
(
project
.
getAccountId
()).
getAccountName
());
}
}
}
}
...
@@ -951,13 +977,13 @@ public class ResourceService implements IResourceService {
...
@@ -951,13 +977,13 @@ public class ResourceService implements IResourceService {
return
allocationList
;
return
allocationList
;
}
}
@Override
@Override
public
Set
<
Resource
>
findByBillableStatus
(
String
billableStatus
)
{
public
Set
<
Resource
>
findByBillableStatus
(
String
billableStatus
)
{
return
resourceRepo
.
findByBillableStatus
(
billableStatus
).
stream
().
filter
(
r
->
r
.
getBillingEndDate
().
after
(
new
Date
())).
collect
(
Collectors
.
toSet
());
return
resourceRepo
.
findByBillableStatus
(
billableStatus
).
stream
()
.
filter
(
r
->
r
.
getBillingEndDate
().
after
(
new
Date
())).
collect
(
Collectors
.
toSet
());
}
}
public
Resource
sendResourceToOpenPool
(
Resource
resource
,
String
loginId
)
{
public
Resource
sendResourceToOpenPool
(
Resource
resource
,
String
loginId
)
{
Resource
existingresource
=
resourceRepo
.
findById
(
resource
.
getId
());
Resource
existingresource
=
resourceRepo
.
findById
(
resource
.
getId
());
existingresource
.
setStatus
(
MyTeamUtils
.
RELEASED_STATUS
);
existingresource
.
setStatus
(
MyTeamUtils
.
RELEASED_STATUS
);
this
.
updateExistedResource
(
existingresource
);
this
.
updateExistedResource
(
existingresource
);
...
@@ -969,7 +995,8 @@ public class ResourceService implements IResourceService {
...
@@ -969,7 +995,8 @@ public class ResourceService implements IResourceService {
benchResource
.
setEmployeeId
(
resource
.
getEmployeeId
());
benchResource
.
setEmployeeId
(
resource
.
getEmployeeId
());
benchResource
.
setResourceRole
(
resource
.
getResourceRole
());
benchResource
.
setResourceRole
(
resource
.
getResourceRole
());
benchResource
.
setBillingStartDate
(
MyTeamDateUtils
.
getDayMoreThanDate
(
resource
.
getBillingEndDate
()));
benchResource
.
setBillingStartDate
(
MyTeamDateUtils
.
getDayMoreThanDate
(
resource
.
getBillingEndDate
()));
benchResource
.
setBillingEndDate
(
projectService
.
getProjectByProjectId
(
MyTeamUtils
.
BENCH_PROJECT_ID
).
getProjectEndDate
());
benchResource
.
setBillingEndDate
(
projectService
.
getProjectByProjectId
(
MyTeamUtils
.
BENCH_PROJECT_ID
).
getProjectEndDate
());
benchResource
.
setBillableStatus
(
MyTeamUtils
.
BENCH_BILLABILITY_STATUS
);
benchResource
.
setBillableStatus
(
MyTeamUtils
.
BENCH_BILLABILITY_STATUS
);
benchResource
.
setStatus
(
MyTeamUtils
.
RELEASED_STATUS
);
benchResource
.
setStatus
(
MyTeamUtils
.
RELEASED_STATUS
);
benchResource
.
setAuditFields
(
loginId
,
MyTeamUtils
.
CREATE
);
benchResource
.
setAuditFields
(
loginId
,
MyTeamUtils
.
CREATE
);
...
@@ -981,66 +1008,56 @@ public class ResourceService implements IResourceService {
...
@@ -981,66 +1008,56 @@ public class ResourceService implements IResourceService {
@Override
@Override
public
Resource
getCurrentAllocation
(
String
employeeId
)
{
public
Resource
getCurrentAllocation
(
String
employeeId
)
{
return
resourceRepo
.
findByEmployeeId
(
employeeId
).
stream
().
filter
(
resource
->
isAllocationActiveToday
(
resource
)).
findAny
().
orElse
(
getLatestResourceByEmpId
(
employeeId
));
return
resourceRepo
.
findByEmployeeId
(
employeeId
).
stream
().
filter
(
resource
->
isAllocationActiveToday
(
resource
))
.
findAny
().
orElse
(
getLatestResourceByEmpId
(
employeeId
));
}
}
}
}
//class
//class
/*
* @Override public List<ResourceVO> getActiveResources(String empId) {
* List<ResourceVO> finalResourcesList = new ArrayList<>();
*
/*
* List<Resource> resourceList = resourceRepo.findByEmployeeId(empId); if
@Override
* (resourceList != null && resourceList.size() > 0) {
public List<ResourceVO> getActiveResources(String empId) {
*
List<ResourceVO> finalResourcesList = new ArrayList<>();
* Resource resourceAlloc=resourceList.get(0); }
*
List<Resource> resourceList = resourceRepo.findByEmployeeId(empId);
* for (Resource resource : resourceRepo.findByEmployeeId(empId)) {
if (resourceList != null && resourceList.size() > 0) {
*
* ResourceVO resourceVO=new ResourceVO();
Resource resourceAlloc=resourceList.get(0);
* resourceVO.setEmployeeId(resource.getEmployeeId());
}
*
* Employee employee=employeeService.getEmployeeById(resource.getEmployeeId());
for (Resource resource : resourceRepo.findByEmployeeId(empId)) {
* resourceVO.setEmployeeName(employee.getEmployeeName());
* resourceVO.setDesignation(employee.getDesignation());
ResourceVO resourceVO=new ResourceVO();
* resourceVO.setEmailId(employee.getEmailId());
resourceVO.setEmployeeId(resource.getEmployeeId());
* resourceVO.setMobileNo(employee.getMobileNumber());
*
Employee employee=employeeService.getEmployeeById(resource.getEmployeeId());
* resourceVO.setProjectName(projectService.getProjectByProjectId(resource.
resourceVO.setEmployeeName(employee.getEmployeeName());
* getProjectId()).getProjectName());
resourceVO.setDesignation(employee.getDesignation());
*
resourceVO.setEmailId(employee.getEmailId());
*
resourceVO.setMobileNo(employee.getMobileNumber());
* if (resource.getBillingEndDate().compareTo(new Date()) > 0) {
* finalResourcesList.addAll(getAllResourcesForProject(resource.getProjectId()))
resourceVO.setProjectName(projectService.getProjectByProjectId(resource.getProjectId()).getProjectName());
* ; }
*
*
if (resource.getBillingEndDate().compareTo(new Date()) > 0) {
* } return finalResourcesList; }
finalResourcesList.addAll(getAllResourcesForProject(resource.getProjectId()));
*
}
}
return finalResourcesList;
}
*/
/*
@Override
public List<ResourceVO> getActiveResources(String empId) {
List<ResourceVO> finalResourcesList = new ArrayList<>();
Employee employee = null;
List<Resource> resourceList = resourceRepo.findByEmployeeId(empId);
Optional<Resource> optionalResource = resourceList.stream().filter(resource -> resource.getBillingEndDate().compareTo(new Date()) > 0).findAny();
if (optionalResource.isPresent()) {
finalResourcesList = prepareProjectTeamMembersList(optionalResource.get().getProjectId());
}
return finalResourcesList;
}
*/
*/
/*
*
* @Override public List<ResourceVO> getActiveResources(String empId) {
* List<ResourceVO> finalResourcesList = new ArrayList<>(); Employee employee =
* null;
*
* List<Resource> resourceList = resourceRepo.findByEmployeeId(empId);
* Optional<Resource> optionalResource = resourceList.stream().filter(resource
* -> resource.getBillingEndDate().compareTo(new Date()) > 0).findAny(); if
* (optionalResource.isPresent()) { finalResourcesList =
* prepareProjectTeamMembersList(optionalResource.get().getProjectId()); }
* return finalResourcesList; }
*
*/
src/main/webapp/WEB-INF/controllers/ProjectController.js
View file @
ade1a202
...
@@ -392,7 +392,6 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
...
@@ -392,7 +392,6 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
}
else
if
(
$scope
.
result
==
"Error"
)
{
}
else
if
(
$scope
.
result
==
"Error"
)
{
showAlert
(
'Something went wrong while deleting the role.'
)
showAlert
(
'Something went wrong while deleting the role.'
)
}
}
}
}
function
AddProjectController
(
$scope
,
$mdDialog
,
dataToPass
,
gridOptionsData
,
managers
,
$window
,
$mdSelect
)
{
function
AddProjectController
(
$scope
,
$mdDialog
,
dataToPass
,
gridOptionsData
,
managers
,
$window
,
$mdSelect
)
{
...
@@ -1465,7 +1464,6 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
...
@@ -1465,7 +1464,6 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
}
}
else
{
else
{
updateTeamRecord
(
record
,
action
,
row
);
updateTeamRecord
(
record
,
action
,
row
);
$scope
.
myForm
.
$setPristine
();
}
}
}
}
...
@@ -1616,8 +1614,6 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
...
@@ -1616,8 +1614,6 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
//Startdate: $scope.startDate,
//Startdate: $scope.startDate,
Enddate
:
$scope
.
endDate
Enddate
:
$scope
.
endDate
}
}
console
.
log
(
$scope
.
previousData
)
console
.
log
(
$scope
.
currentData
)
var
predata
=
JSON
.
stringify
(
$scope
.
previousData
);
var
predata
=
JSON
.
stringify
(
$scope
.
previousData
);
var
curdata
=
JSON
.
stringify
(
$scope
.
currentData
);
var
curdata
=
JSON
.
stringify
(
$scope
.
currentData
);
if
(
predata
==
curdata
)
{
if
(
predata
==
curdata
)
{
...
@@ -1839,6 +1835,7 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
...
@@ -1839,6 +1835,7 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
row
.
resourceRole
=
$scope
.
parentData
.
role
;
row
.
resourceRole
=
$scope
.
parentData
.
role
;
row
.
billableStatus
=
$scope
.
parentData
.
billableStatus
;
row
.
billableStatus
=
$scope
.
parentData
.
billableStatus
;
}
}
$scope
.
previousRow
=
angular
.
copy
(
row
);
}
}
},
function
myError
(
response
){
},
function
myError
(
response
){
...
...
src/main/webapp/WEB-INF/templates/projectTeamDetails.html
View file @
ade1a202
...
@@ -40,7 +40,7 @@
...
@@ -40,7 +40,7 @@
</div>
</div>
<div
class=
"form-group col-lg-9 col-md-9 col-sm-9 col-xs-12"
></div>
<div
class=
"form-group col-lg-9 col-md-9 col-sm-9 col-xs-12"
></div>
<div
class=
"row col-lg-12"
style=
"margin-left: 0px;"
>
<div
class=
"row col-lg-12
no-padding
"
style=
"margin-left: 0px;"
>
<input
type=
"radio"
ng-model=
"status"
value=
"Active"
ng-click=
"getTeamMates()"
>
Active
<input
type=
"radio"
ng-model=
"status"
value=
"Active"
ng-click=
"getTeamMates()"
>
Active
<input
type=
"radio"
ng-model=
"status"
value=
"InActive"
ng-click=
"getTeamMates()"
>
Inactive
<input
type=
"radio"
ng-model=
"status"
value=
"InActive"
ng-click=
"getTeamMates()"
>
Inactive
<input
type=
"radio"
ng-model=
"status"
value=
"Proposed"
ng-click=
"getTeamMates()"
>
Proposed
<input
type=
"radio"
ng-model=
"status"
value=
"Proposed"
ng-click=
"getTeamMates()"
>
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