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
Hide 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
...
@@ -27,77 +27,76 @@ import java.util.stream.Collectors;
...
@@ -27,77 +27,76 @@ import java.util.stream.Collectors;
@Slf4j
@Slf4j
public
class
ResourceService
implements
IResourceService
{
public
class
ResourceService
implements
IResourceService
{
@Autowired
@Autowired
private
MongoTemplate
mongoTemplate
;
private
MongoTemplate
mongoTemplate
;
@Autowired
@Autowired
private
ResourceRepo
resourceRepo
;
private
ResourceRepo
resourceRepo
;
@Autowired
@Autowired
private
IAccountService
accountService
;
private
IAccountService
accountService
;
@Autowired
@Autowired
private
IDomainService
domainService
;
private
IDomainService
domainService
;
@Autowired
@Autowired
private
IProjectService
projectService
;
private
IProjectService
projectService
;
@Autowired
@Autowired
private
IEmployeeService
employeeService
;
private
IEmployeeService
employeeService
;
@Autowired
@Autowired
private
IEmployeeShiftService
empShiftService
;
private
IEmployeeShiftService
empShiftService
;
public
HashMap
<
String
,
Object
>
respMap
=
new
HashMap
<>();
public
HashMap
<
String
,
Object
>
respMap
=
new
HashMap
<>();
private
Resource
getLatestAllocation
(
List
<
Resource
>
resourceAllocList
)
{
Resource
latestAlloc
=
null
;
if
(!
resourceAllocList
.
isEmpty
())
{
latestAlloc
=
resourceAllocList
.
get
(
0
);
for
(
Resource
resource
:
resourceAllocList
)
{
if
(
latestAlloc
.
getBillingEndDate
().
before
(
resource
.
getBillingEndDate
()))
latestAlloc
=
resource
;
}
}
return
latestAlloc
;
}
private
Resource
getLatestAllocation
(
List
<
Resource
>
resourceAllocList
)
{
public
List
<
Resource
>
getResourcesByEmployeeId
(
String
employeeId
)
{
Resource
latestAlloc
=
null
;
return
resourceRepo
.
findByEmployeeId
(
employeeId
);
if
(!
resourceAllocList
.
isEmpty
())
{
latestAlloc
=
resourceAllocList
.
get
(
0
);
for
(
Resource
resource
:
resourceAllocList
)
{
if
(
latestAlloc
.
getBillingEndDate
().
before
(
resource
.
getBillingEndDate
()))
latestAlloc
=
resource
;
}
}
return
latestAlloc
;
}
public
List
<
Resource
>
getResourcesByEmployeeId
(
String
employeeId
)
{
return
resourceRepo
.
findByEmployeeId
(
employeeId
);
}
public
Resource
addResource
(
Resource
resourceReq
,
String
loginEmpId
)
throws
MyTeamException
{
List
<
Resource
>
resourceAllocationList
=
resourceRepo
.
findByEmployeeId
(
resourceReq
.
getEmployeeId
());
}
Resource
prevAllocation
=
getLatestAllocation
(
resourceAllocationList
.
stream
().
filter
(
r
->
isAllocationActiveToday
(
r
)).
collect
(
Collectors
.
toList
()));
Resource
resourcePers
=
null
;
if
(
prevAllocation
!=
null
){
public
Resource
addResource
(
Resource
resourceReq
,
String
loginEmpId
)
throws
MyTeamException
{
prevAllocation
.
setBillingEndDate
(
MyTeamDateUtils
.
getDayLessThanDate
(
resourceReq
.
getBillingStartDate
()));
this
.
updateExistedResource
(
prevAllocation
);
//updateLatestProjectAllocationToEnd
resourcePers
=
resourceRepo
.
save
(
resourceReq
);
//createNewProjectAllocationtoStart
}
return
resourcePers
;
}
public
boolean
isResourceExistsForProject
(
String
employeeId
,
String
projectId
)
{
List
<
Resource
>
resourceAllocationList
=
resourceRepo
.
findByEmployeeId
(
resourceReq
.
getEmployeeId
());
boolean
isExists
=
false
;
Resource
prevAllocation
=
getLatestAllocation
(
resourceAllocationList
.
stream
().
filter
(
r
->
isAllocationActiveToday
(
r
)).
collect
(
Collectors
.
toList
()));
Resource
resourcePers
=
null
;
List
<
Resource
>
resourceList
=
resourceRepo
.
findByEmployeeIdAndProjectId
(
employeeId
,
projectId
);
if
(
prevAllocation
!=
null
)
{
if
(
resourceList
!=
null
&&
resourceList
.
size
()
>
0
)
{
prevAllocation
.
setBillingEndDate
(
MyTeamDateUtils
.
getDayLessThanDate
(
resourceReq
.
getBillingStartDate
()));
isExists
=
true
;
this
.
updateExistedResource
(
prevAllocation
);
// updateLatestProjectAllocationToEnd
respMap
.
put
(
"message"
,
"Resourse is already in the project"
);
resourcePers
=
resourceRepo
.
save
(
resourceReq
);
// createNewProjectAllocationtoStart
return
isExists
;
}
}
return
resourcePers
;
respMap
.
put
(
"statusCode"
,
810
);
}
respMap
.
put
(
"message"
,
"Resource Not Found"
);
return
isExists
;
}
public
boolean
isResourceExistsForProject
(
String
employeeId
,
String
projectId
)
{
boolean
isExists
=
false
;
List
<
Resource
>
resourceList
=
resourceRepo
.
findByEmployeeIdAndProjectId
(
employeeId
,
projectId
);
if
(
resourceList
!=
null
&&
resourceList
.
size
()
>
0
)
{
isExists
=
true
;
respMap
.
put
(
"message"
,
"Resourse is already in the project"
);
return
isExists
;
}
respMap
.
put
(
"statusCode"
,
810
);
respMap
.
put
(
"message"
,
"Resource Not Found"
);
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());
//
//
...
@@ -124,601 +123,624 @@ public class ResourceService implements IResourceService {
...
@@ -124,601 +123,624 @@ public class ResourceService implements IResourceService {
// log.info("After setting the date:::before saving the Resource::" + resourcePrev);
// log.info("After setting the date:::before saving the Resource::" + resourcePrev);
// this.updateExistedResource(resourcePrev);
// this.updateExistedResource(resourcePrev);
// }
// }
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
())&&
!
latestAllocation
.
getBillingStartDate
().
after
(
resourceReq
.
getBillingEndDate
()))
{
if
(
latestAllocation
!=
null
respMap
.
put
(
"statusCode"
,
811
);
&&
!
latestAllocation
.
getProjectId
().
equalsIgnoreCase
(
resourceReq
.
getProjectId
())
respMap
.
put
(
"message"
,
"Resource is already allocated after "
+
latestAllocation
.
getBillingStartDate
());
&&
!
latestAllocation
.
getBillingStartDate
().
after
(
resourceReq
.
getBillingEndDate
()))
{
}
else
{
respMap
.
put
(
"statusCode"
,
811
);
if
(
resourceReq
.
getBillingEndDate
().
compareTo
(
new
Date
())
<
0
)
{
respMap
.
put
(
"message"
,
resourceReq
.
setStatus
(
MyTeamUtils
.
RELEASED_STATUS
);
//update Status of allocation
"Resource is already allocated after "
+
latestAllocation
.
getBillingStartDate
());
Resource
resourceBench
=
new
Resource
();
}
else
{
resourceBench
.
setProjectId
(
MyTeamUtils
.
BENCH_PROJECT_ID
);
if
(
resourceReq
.
getBillingEndDate
().
compareTo
(
new
Date
())
<
0
)
{
resourceBench
.
setEmployeeId
(
resourceReq
.
getEmployeeId
());
resourceReq
.
setStatus
(
MyTeamUtils
.
RELEASED_STATUS
);
// update Status of allocation
resourceBench
.
setResourceRole
(
resourceReq
.
getResourceRole
());
Resource
resourceBench
=
new
Resource
();
resourceBench
.
setStatus
(
MyTeamUtils
.
RELEASED_STATUS
);
//add alocation status as Released
resourceBench
.
setProjectId
(
MyTeamUtils
.
BENCH_PROJECT_ID
);
resourceBench
.
setBillingStartDate
(
MyTeamDateUtils
.
getDayMoreThanDate
(
resourceReq
.
getBillingEndDate
()));
resourceBench
.
setEmployeeId
(
resourceReq
.
getEmployeeId
());
resourceBench
.
setBillingEndDate
(
projectService
.
getProjectByProjectId
(
MyTeamUtils
.
BENCH_PROJECT_ID
).
getProjectEndDate
());
resourceBench
.
setResourceRole
(
resourceReq
.
getResourceRole
());
resourceBench
.
setBillableStatus
(
MyTeamUtils
.
BENCH_BILLABILITY_STATUS
);
resourceBench
.
setStatus
(
MyTeamUtils
.
RELEASED_STATUS
);
// add alocation status as Released
resourceBench
.
setAuditFields
(
loginEmpId
,
MyTeamUtils
.
CREATE
);
resourceBench
.
setBillingStartDate
(
resourceRepo
.
save
(
resourceBench
);
MyTeamDateUtils
.
getDayMoreThanDate
(
resourceReq
.
getBillingEndDate
()));
}
resourceBench
.
setBillingEndDate
(
this
.
updateExistedResource
(
resourceReq
);
projectService
.
getProjectByProjectId
(
MyTeamUtils
.
BENCH_PROJECT_ID
).
getProjectEndDate
());
}
resourceBench
.
setBillableStatus
(
MyTeamUtils
.
BENCH_BILLABILITY_STATUS
);
}
else
{
resourceBench
.
setAuditFields
(
loginEmpId
,
MyTeamUtils
.
CREATE
);
respMap
.
put
(
"statusCode"
,
811
);
resourceRepo
.
save
(
resourceBench
);
respMap
.
put
(
"message"
,
"Resource is already released from you, And you can't update this allocation"
);
}
}
this
.
updateExistedResource
(
resourceReq
);
}
}
else
{
}
else
{
respMap
.
put
(
"statusCode"
,
811
);
respMap
.
put
(
"statusCode"
,
811
);
respMap
.
put
(
"message"
,
"Record Not Found"
);
respMap
.
put
(
"message"
,
"Resource is already released from you, And you can't update this allocation"
);
}
}
}
}
else
{
respMap
.
put
(
"statusCode"
,
811
);
public
void
updateExistedResource
(
Resource
resource
)
{
respMap
.
put
(
"message"
,
"Record Not Found"
);
}
if
(
resource
!=
null
)
{
Resource
resourcePers
=
resourceRepo
.
save
(
resource
);
}
respMap
.
put
(
"statusCode"
,
801
);
respMap
.
put
(
"message"
,
"Resource updated successfully"
);
public
void
updateExistedResource
(
Resource
resource
)
{
respMap
.
put
(
"resourceObj"
,
resourcePers
);
if
(
resource
!=
null
)
{
}
Resource
resourcePers
=
resourceRepo
.
save
(
resource
);
respMap
.
put
(
"statusCode"
,
801
);
}
respMap
.
put
(
"message"
,
"Resource updated successfully"
);
respMap
.
put
(
"resourceObj"
,
resourcePers
);
public
void
insertNewResourceWithNewStatus
(
Resource
resourceReq
,
String
loginEmpId
)
throws
MyTeamException
{
}
resourceReq
.
setId
(
null
);
Resource
resourcePers
=
resourceRepo
.
insert
(
resourceReq
);
}
respMap
.
put
(
"statusCode"
,
801
);
respMap
.
put
(
"message"
,
"Resource updated successfully"
);
public
void
insertNewResourceWithNewStatus
(
Resource
resourceReq
,
String
loginEmpId
)
throws
MyTeamException
{
respMap
.
put
(
"resourceObj"
,
resourcePers
);
resourceReq
.
setId
(
null
);
}
Resource
resourcePers
=
resourceRepo
.
insert
(
resourceReq
);
respMap
.
put
(
"statusCode"
,
801
);
public
boolean
validateAllocationAgainstPrevAllocation
(
Resource
resourceReq
)
{
respMap
.
put
(
"message"
,
"Resource updated successfully"
);
boolean
isValid
=
true
;
respMap
.
put
(
"resourceObj"
,
resourcePers
);
List
<
Resource
>
resourceAllocList
=
resourceRepo
.
findByEmployeeIdAndProjectId
(
resourceReq
.
getEmployeeId
(),
resourceReq
.
getProjectId
());
Resource
prevAllocation
=
this
.
getLatestAllocation
(
resourceAllocList
);
}
if
(
prevAllocation
!=
null
)
{
if
(!
prevAllocation
.
getBillingStartDate
().
before
(
resourceReq
.
getBillingStartDate
()))
{
public
boolean
validateAllocationAgainstPrevAllocation
(
Resource
resourceReq
)
{
respMap
.
put
(
"statusCode"
,
811
);
boolean
isValid
=
true
;
respMap
.
put
(
"message"
,
"Billing start date should be after previous allocation start date"
);
List
<
Resource
>
resourceAllocList
=
resourceRepo
.
findByEmployeeIdAndProjectId
(
resourceReq
.
getEmployeeId
(),
isValid
=
false
;
resourceReq
.
getProjectId
());
}
Resource
prevAllocation
=
this
.
getLatestAllocation
(
resourceAllocList
);
if
(
prevAllocation
.
getBillableStatus
().
equalsIgnoreCase
(
resourceReq
.
getBillableStatus
()))
{
if
(
prevAllocation
!=
null
)
{
respMap
.
put
(
"statusCode"
,
811
);
if
(!
prevAllocation
.
getBillingStartDate
().
before
(
resourceReq
.
getBillingStartDate
()))
{
respMap
.
put
(
"message"
,
"Resource is already in "
+
prevAllocation
.
getBillableStatus
()
+
" status only"
);
respMap
.
put
(
"statusCode"
,
811
);
isValid
=
false
;
respMap
.
put
(
"message"
,
"Billing start date should be after previous allocation start date"
);
}
isValid
=
false
;
}
}
return
isValid
;
if
(
prevAllocation
.
getBillableStatus
().
equalsIgnoreCase
(
resourceReq
.
getBillableStatus
()))
{
}
respMap
.
put
(
"statusCode"
,
811
);
respMap
.
put
(
"message"
,
"Resource is already in "
+
prevAllocation
.
getBillableStatus
()
+
" status only"
);
public
boolean
validateBillingStartEndDateAgainstProjectStartEndDate
(
Resource
resource
,
String
loginEmpId
)
throws
MyTeamException
{
isValid
=
false
;
}
boolean
isValid
=
true
;
}
return
isValid
;
Project
project
=
projectService
.
getProjectByProjectId
(
resource
.
getProjectId
());
}
log
.
info
(
"Project::"
+
project
);
public
boolean
validateBillingStartEndDateAgainstProjectStartEndDate
(
Resource
resource
,
String
loginEmpId
)
if
(!
resource
.
getBillingStartDate
().
after
(
project
.
getProjectStartDate
()))
{
throws
MyTeamException
{
log
.
info
(
"Billing start date should be after Project start date"
);
respMap
.
put
(
"statusCode"
,
811
);
boolean
isValid
=
true
;
respMap
.
put
(
"message"
,
"Billing start date should be after Project start date"
);
isValid
=
false
;
Project
project
=
projectService
.
getProjectByProjectId
(
resource
.
getProjectId
());
}
log
.
info
(
"Project::"
+
project
);
if
(!
resource
.
getBillingStartDate
().
before
(
resource
.
getBillingEndDate
()))
{
if
(!
resource
.
getBillingStartDate
().
after
(
project
.
getProjectStartDate
()))
{
log
.
info
(
"Billing start date should be before Billing End Date."
);
log
.
info
(
"Billing start date should be after Project start date"
);
respMap
.
put
(
"statusCode"
,
812
);
respMap
.
put
(
"statusCode"
,
811
);
respMap
.
put
(
"message"
,
"Billing start date should be before Billing End Date."
);
respMap
.
put
(
"message"
,
"Billing start date should be after Project start date"
);
isValid
=
false
;
isValid
=
false
;
}
}
log
.
info
(
"ResourceALloc Req::"
+
resource
);
log
.
info
(
""
+
project
.
getProjectEndDate
().
toString
());
if
(!
resource
.
getBillingStartDate
().
before
(
resource
.
getBillingEndDate
()))
{
log
.
info
(
"Billing start date should be before Billing End Date."
);
//if (!resourceAllocation.getBillingEndDate().before(project.getProjectEndDate())|| !resourceAllocation.getBillingEndDate().equals(project.getProjectEndDate())) {
respMap
.
put
(
"statusCode"
,
812
);
if
(!(
resource
.
getBillingEndDate
().
compareTo
(
project
.
getProjectEndDate
())
<=
0
))
{
respMap
.
put
(
"message"
,
"Billing start date should be before Billing End Date."
);
log
.
info
(
"Billing end date should be on or before Project End Date."
);
isValid
=
false
;
respMap
.
put
(
"statusCode"
,
813
);
}
respMap
.
put
(
"message"
,
"Billing end date should be before Project End Date."
);
log
.
info
(
"ResourceALloc Req::"
+
resource
);
isValid
=
false
;
log
.
info
(
""
+
project
.
getProjectEndDate
().
toString
());
}
// if
respMap
.
put
(
"resourceObj"
,
resource
);
// (!resourceAllocation.getBillingEndDate().before(project.getProjectEndDate())||
return
isValid
;
// !resourceAllocation.getBillingEndDate().equals(project.getProjectEndDate()))
}
// {
if
(!(
resource
.
getBillingEndDate
().
compareTo
(
project
.
getProjectEndDate
())
<=
0
))
{
log
.
info
(
"Billing end date should be on or before Project End Date."
);
public
boolean
validateBillingStartDateAgainstDOJ
(
Resource
resource
)
{
respMap
.
put
(
"statusCode"
,
813
);
String
message
=
""
;
respMap
.
put
(
"message"
,
"Billing end date should be before Project End Date."
);
boolean
isValid
=
true
;
isValid
=
false
;
}
Employee
employee
=
employeeService
.
getEmployeeById
(
resource
.
getEmployeeId
());
Date
empDoj
=
employeeService
.
getEmployeeById
(
resource
.
getEmployeeId
()).
getDateOfJoining
();
respMap
.
put
(
"resourceObj"
,
resource
);
if
(
resource
.
getBillingStartDate
().
compareTo
(
empDoj
)
<
0
)
{
return
isValid
;
message
=
"Resource Billing Start Date ("
+
resource
.
getBillingStartDate
()
+
" ) in "
}
+
projectService
.
getProjectByProjectId
(
resource
.
getProjectId
()).
getProjectName
()
+
" project should not be before Date of Joining ( "
+
empDoj
+
")."
;
public
boolean
validateBillingStartDateAgainstDOJ
(
Resource
resource
)
{
isValid
=
false
;
String
message
=
""
;
respMap
.
put
(
"statusCode"
,
814
);
boolean
isValid
=
true
;
respMap
.
put
(
"message"
,
message
);
}
Employee
employee
=
employeeService
.
getEmployeeById
(
resource
.
getEmployeeId
());
return
isValid
;
Date
empDoj
=
employeeService
.
getEmployeeById
(
resource
.
getEmployeeId
()).
getDateOfJoining
();
}
if
(
resource
.
getBillingStartDate
().
compareTo
(
empDoj
)
<
0
)
{
message
=
"Resource Billing Start Date ("
+
resource
.
getBillingStartDate
()
+
" ) in "
+
projectService
.
getProjectByProjectId
(
resource
.
getProjectId
()).
getProjectName
()
public
boolean
isResourceAvailable
(
Resource
resourceReq
)
{
+
" project should not be before Date of Joining ( "
+
empDoj
+
")."
;
isValid
=
false
;
boolean
isAssigned
=
true
;
respMap
.
put
(
"statusCode"
,
814
);
String
message
=
""
;
respMap
.
put
(
"message"
,
message
);
List
<
Resource
>
resourceAllocList
=
resourceRepo
.
findByEmployeeId
(
resourceReq
.
getEmployeeId
());
//getting all allocations of employee
}
return
isValid
;
Resource
resourceLatestRecord
=
getLatestAllocation
(
resourceAllocList
.
stream
().
}
filter
(
r
->
r
.
getProjectId
().
equalsIgnoreCase
(
MyTeamUtils
.
BENCH_PROJECT_ID
)).
collect
(
Collectors
.
toList
()));
//getting latest allocation of employee in bench project
public
boolean
isResourceAvailable
(
Resource
resourceReq
)
{
if
(
resourceLatestRecord
!=
null
&&
!
isAllocationActiveToday
(
resourceLatestRecord
)){
Resource
latestProjectResource
=
getLatestAllocation
(
resourceAllocList
.
stream
().
boolean
isAssigned
=
true
;
filter
(
r
->
!
r
.
getProjectId
().
equalsIgnoreCase
(
MyTeamUtils
.
BENCH_PROJECT_ID
)).
collect
(
Collectors
.
toList
()));
String
message
=
""
;
if
(!
resourceReq
.
getProjectId
().
equalsIgnoreCase
(
latestProjectResource
.
getProjectId
()))
{
List
<
Resource
>
resourceAllocList
=
resourceRepo
.
findByEmployeeId
(
resourceReq
.
getEmployeeId
());
// getting all
message
=
"Resource "
+
latestProjectResource
.
getEmployeeId
()
+
" already Assigned to the "
// allocations
+
projectService
.
getProjectByProjectId
(
latestProjectResource
.
getProjectId
()).
getProjectName
()
// of employee
+
" Project"
+
" from "
+
latestProjectResource
.
getBillingStartDate
()
+
"to "
+
latestProjectResource
.
getBillingEndDate
();
isAssigned
=
false
;
Resource
resourceLatestRecord
=
getLatestAllocation
(
respMap
.
put
(
"statusCode"
,
815
);
resourceAllocList
.
stream
().
filter
(
r
->
r
.
getProjectId
().
equalsIgnoreCase
(
MyTeamUtils
.
BENCH_PROJECT_ID
))
respMap
.
put
(
"message"
,
message
);
.
collect
(
Collectors
.
toList
()));
// getting latest allocation of employee in bench project
}
}
else
{
if
(
resourceLatestRecord
!=
null
&&
!
isAllocationActiveToday
(
resourceLatestRecord
))
{
if
(!
validateResourceBillingEndDateAgainstBench
(
resourceReq
)){
Resource
latestProjectResource
=
getLatestAllocation
(
resourceAllocList
.
stream
()
isAssigned
=
false
;
.
filter
(
r
->
!
r
.
getProjectId
().
equalsIgnoreCase
(
MyTeamUtils
.
BENCH_PROJECT_ID
))
}
.
collect
(
Collectors
.
toList
()));
}
if
(!
resourceReq
.
getProjectId
().
equalsIgnoreCase
(
latestProjectResource
.
getProjectId
()))
{
return
isAssigned
;
message
=
"Resource "
+
latestProjectResource
.
getEmployeeId
()
+
" already Assigned to the "
}
+
projectService
.
getProjectByProjectId
(
latestProjectResource
.
getProjectId
()).
getProjectName
()
+
" Project"
+
" from "
+
latestProjectResource
.
getBillingStartDate
()
+
"to "
public
boolean
validateResourceBillingEndDateAgainstBench
(
Resource
resourceReq
){
+
latestProjectResource
.
getBillingEndDate
();
boolean
isValid
=
true
;
isAssigned
=
false
;
String
message
=
""
;
respMap
.
put
(
"statusCode"
,
815
);
respMap
.
put
(
"message"
,
message
);
List
<
Resource
>
resourceAllocList
=
resourceRepo
.
findByEmployeeIdAndProjectId
(
resourceReq
.
getEmployeeId
(),
MyTeamUtils
.
BENCH_PROJECT_ID
);
}
}
else
{
Resource
resourceBenchLatestRecord
=
getLatestAllocation
(
resourceAllocList
.
stream
().
if
(!
validateResourceBillingEndDateAgainstBench
(
resourceReq
))
{
filter
(
r
->
r
.
getProjectId
().
equalsIgnoreCase
(
MyTeamUtils
.
BENCH_PROJECT_ID
)).
collect
(
Collectors
.
toList
()));
isAssigned
=
false
;
}
if
(!
isAllocationActiveToday
(
resourceBenchLatestRecord
)){
}
isValid
=
false
;
return
isAssigned
;
message
=
"Resource is not available for allocation"
;
}
}
else
if
(!(
resourceReq
.
getBillingEndDate
().
before
(
resourceBenchLatestRecord
.
getBillingEndDate
())
&&
public
boolean
validateResourceBillingEndDateAgainstBench
(
Resource
resourceReq
)
{
resourceReq
.
getBillingStartDate
().
after
(
resourceBenchLatestRecord
.
getBillingStartDate
()))){
boolean
isValid
=
true
;
message
=
"Resource is available from "
+
resourceBenchLatestRecord
.
getBillingStartDate
()+
" to "
+
resourceBenchLatestRecord
.
getBillingEndDate
();
String
message
=
""
;
isValid
=
false
;
}
List
<
Resource
>
resourceAllocList
=
resourceRepo
.
findByEmployeeIdAndProjectId
(
resourceReq
.
getEmployeeId
(),
respMap
.
put
(
"statusCode"
,
810
);
MyTeamUtils
.
BENCH_PROJECT_ID
);
respMap
.
put
(
"message"
,
message
);
return
isValid
;
Resource
resourceBenchLatestRecord
=
getLatestAllocation
(
}
resourceAllocList
.
stream
().
filter
(
r
->
r
.
getProjectId
().
equalsIgnoreCase
(
MyTeamUtils
.
BENCH_PROJECT_ID
))
.
collect
(
Collectors
.
toList
()));
public
boolean
isAllocationActiveToday
(
Resource
resource
){
boolean
isActive
=
true
;
if
(!
isAllocationActiveToday
(
resourceBenchLatestRecord
))
{
if
(
resource
.
getBillingStartDate
().
compareTo
(
new
Date
())
<=
0
&&
isValid
=
false
;
resource
.
getBillingEndDate
().
compareTo
(
new
Date
())>=
0
){
message
=
"Resource is not available for allocation"
;
isActive
=
true
;
}
else
{
}
else
if
(!(
resourceReq
.
getBillingEndDate
().
before
(
resourceBenchLatestRecord
.
getBillingEndDate
())
isActive
=
false
;
&&
resourceReq
.
getBillingStartDate
().
after
(
resourceBenchLatestRecord
.
getBillingStartDate
())))
{
}
message
=
"Resource is available from "
+
resourceBenchLatestRecord
.
getBillingStartDate
()
+
" to "
return
isActive
;
+
resourceBenchLatestRecord
.
getBillingEndDate
();
}
isValid
=
false
;
}
respMap
.
put
(
"statusCode"
,
810
);
public
void
deleteResource
(
Resource
resourceReq
,
String
loginEmpId
)
{
respMap
.
put
(
"message"
,
message
);
resourceRepo
.
delete
(
resourceReq
);
return
isValid
;
}
}
public
boolean
isAllocationActiveToday
(
Resource
resource
)
{
public
void
deleteAndUpdateAllocation
(
Resource
resourceReq
,
String
loginEmpId
){
boolean
isActive
=
true
;
List
<
Resource
>
empAllAllocations
=
resourceRepo
.
findByEmployeeId
(
resourceReq
.
getEmployeeId
());
if
(
resource
.
getBillingStartDate
().
compareTo
(
new
Date
())
<=
0
Resource
latestAllocation
=
this
.
getLatestAllocation
(
empAllAllocations
.
stream
().
filter
(
r
->
!
r
.
getId
().
equals
(
resourceReq
.
getId
())).
collect
(
Collectors
.
toList
()));
&&
resource
.
getBillingEndDate
().
compareTo
(
new
Date
())
>=
0
)
{
if
(
latestAllocation
!=
null
&&
latestAllocation
.
getProjectId
().
equalsIgnoreCase
(
MyTeamUtils
.
BENCH_PROJECT_ID
)){
isActive
=
true
;
latestAllocation
.
setBillingEndDate
(
projectService
.
getProjectByProjectId
(
MyTeamUtils
.
BENCH_PROJECT_ID
).
getProjectEndDate
());
}
else
{
this
.
updateExistedResource
(
latestAllocation
);
isActive
=
false
;
this
.
deleteResource
(
resourceReq
,
loginEmpId
);
}
}
return
isActive
;
}
}
@Override
public
void
deleteResource
(
Resource
resourceReq
,
String
loginEmpId
)
{
public
List
<
Resource
>
getAllResources
()
{
resourceRepo
.
delete
(
resourceReq
);
return
resourceRepo
.
findAll
();
}
}
public
void
deleteAndUpdateAllocation
(
Resource
resourceReq
,
String
loginEmpId
)
{
public
List
<
ResourceVO
>
getAllResourcesVO
()
{
List
<
Resource
>
empAllAllocations
=
resourceRepo
.
findByEmployeeId
(
resourceReq
.
getEmployeeId
());
Resource
latestAllocation
=
this
.
getLatestAllocation
(
empAllAllocations
.
stream
()
return
getAllResources
().
stream
().
map
(
resource
->
{
.
filter
(
r
->
!
r
.
getId
().
equals
(
resourceReq
.
getId
())).
collect
(
Collectors
.
toList
()));
Resource
resource
=
resourceRepo
.
findById
(
resourceReq
.
getId
());
ResourceVO
resourceVO
=
new
ResourceVO
();
if
(
resource
!=
null
)
{
resourceVO
.
setId
(
resource
.
getId
());
if
(
latestAllocation
!=
null
resourceVO
.
setProjectId
(
resource
.
getProjectId
());
&&
latestAllocation
.
getProjectId
().
equalsIgnoreCase
(
MyTeamUtils
.
BENCH_PROJECT_ID
))
{
resourceVO
.
setEmployeeId
(
resource
.
getEmployeeId
());
latestAllocation
.
setBillingEndDate
(
resourceVO
.
setStatus
(
resource
.
getStatus
());
projectService
.
getProjectByProjectId
(
MyTeamUtils
.
BENCH_PROJECT_ID
).
getProjectEndDate
());
this
.
updateExistedResource
(
latestAllocation
);
Employee
employee
=
employeeService
.
getEmployeeById
(
resource
.
getEmployeeId
());
}
if
(
employee
!=
null
)
{
this
.
deleteResource
(
resourceReq
,
loginEmpId
);
resourceVO
.
setEmployeeName
(
employee
.
getEmployeeName
());
}
else
{
resourceVO
.
setDesignation
(
employee
.
getDesignation
());
respMap
.
put
(
"statusCode"
,
811
);
resourceVO
.
setEmailId
(
employee
.
getEmailId
());
respMap
.
put
(
"message"
,
"Record Not Found"
);
resourceVO
.
setMobileNo
(
employee
.
getMobileNumber
());
}
}
}
Project
project
=
projectService
.
getProjectByProjectId
(
resource
.
getProjectId
());
@Override
if
(
project
!=
null
)
{
public
List
<
Resource
>
getAllResources
()
{
resourceVO
.
setProjectName
(
project
.
getProjectName
());
return
resourceRepo
.
findAll
();
resourceVO
.
setProjectStartDate
(
project
.
getProjectStartDate
());
}
resourceVO
.
setProjectEndDate
(
project
.
getProjectEndDate
());
resourceVO
.
setProjectStatus
(
project
.
getStatus
());
public
List
<
ResourceVO
>
getAllResourcesVO
()
{
if
(
project
.
getAccountId
()
!=
null
)
{
Account
account
=
accountService
.
getAccountById
(
project
.
getAccountId
());
return
getAllResources
().
stream
().
map
(
resource
->
{
if
(
account
!=
null
)
{
resourceVO
.
setAccountName
(
account
.
getAccountName
());
ResourceVO
resourceVO
=
new
ResourceVO
();
}
resourceVO
.
setId
(
resource
.
getId
());
}
resourceVO
.
setProjectId
(
resource
.
getProjectId
());
}
resourceVO
.
setEmployeeId
(
resource
.
getEmployeeId
());
resourceVO
.
setStatus
(
resource
.
getStatus
());
//Account account=accountService.getAccountById(domainService.getDomainById(project.getProjectId()).getAccountId());
Employee
employee
=
employeeService
.
getEmployeeById
(
resource
.
getEmployeeId
());
resourceVO
.
setBillableStatus
(
resource
.
getBillableStatus
());
if
(
employee
!=
null
)
{
resourceVO
.
setBillingStartDate
(
resource
.
getBillingStartDate
());
resourceVO
.
setEmployeeName
(
employee
.
getEmployeeName
());
resourceVO
.
setBillingEndDate
(
resource
.
getBillingEndDate
());
resourceVO
.
setDesignation
(
employee
.
getDesignation
());
resourceVO
.
setResourceRole
(
resource
.
getResourceRole
());
resourceVO
.
setEmailId
(
employee
.
getEmailId
());
if
(
resource
.
getBillingEndDate
().
compareTo
(
new
Date
())
>
0
)
{
resourceVO
.
setMobileNo
(
employee
.
getMobileNumber
());
resourceVO
.
setResourceStatus
(
ResourceStatus
.
ACTIVE
.
getStatus
());
}
}
else
{
resourceVO
.
setResourceStatus
(
ResourceStatus
.
IN_ACTIVE
.
getStatus
());
Project
project
=
projectService
.
getProjectByProjectId
(
resource
.
getProjectId
());
}
if
(
project
!=
null
)
{
return
resourceVO
;
resourceVO
.
setProjectName
(
project
.
getProjectName
());
resourceVO
.
setProjectStartDate
(
project
.
getProjectStartDate
());
}).
collect
(
Collectors
.
toList
());
resourceVO
.
setProjectEndDate
(
project
.
getProjectEndDate
());
resourceVO
.
setProjectStatus
(
project
.
getStatus
());
}
if
(
project
.
getAccountId
()
!=
null
)
{
Account
account
=
accountService
.
getAccountById
(
project
.
getAccountId
());
public
List
<
Resource
>
getResourcesSortByBillingStartDate
(
String
employeeId
)
{
if
(
account
!=
null
)
{
Query
query
=
prepareQuery
(
employeeId
,
MyTeamUtils
.
BILLING_START_DATE
);
resourceVO
.
setAccountName
(
account
.
getAccountName
());
return
mongoTemplate
.
find
(
query
,
Resource
.
class
);
}
}
}
}
private
Query
prepareQuery
(
String
employeeId
,
String
dateColumn
)
{
Query
query
=
new
Query
();
// Account
query
.
addCriteria
(
Criteria
.
where
(
MyTeamUtils
.
EMPLOYEE_ID
).
is
(
employeeId
));
// account=accountService.getAccountById(domainService.getDomainById(project.getProjectId()).getAccountId());
query
.
limit
(
MyTeamUtils
.
ONE
);
query
.
with
(
new
Sort
(
Sort
.
Direction
.
DESC
,
dateColumn
));
resourceVO
.
setBillableStatus
(
resource
.
getBillableStatus
());
return
query
;
resourceVO
.
setBillingStartDate
(
resource
.
getBillingStartDate
());
}
resourceVO
.
setBillingEndDate
(
resource
.
getBillingEndDate
());
resourceVO
.
setResourceRole
(
resource
.
getResourceRole
());
@Override
if
(
resource
.
getBillingEndDate
().
compareTo
(
new
Date
())
>
0
)
{
public
List
<
ResourceVO
>
getActiveResources
(
String
empId
)
{
resourceVO
.
setResourceStatus
(
ResourceStatus
.
ACTIVE
.
getStatus
());
List
<
ResourceVO
>
resourcesList
=
new
ArrayList
<>();
}
else
{
for
(
Resource
resource
:
resourceRepo
.
findByEmployeeId
(
empId
))
{
resourceVO
.
setResourceStatus
(
ResourceStatus
.
IN_ACTIVE
.
getStatus
());
if
(
resource
.
getBillingEndDate
().
compareTo
(
new
Date
())
>
0
)
{
}
resourcesList
.
addAll
(
prepareProjectTeamMembersList
(
resource
.
getProjectId
()));
return
resourceVO
;
}
}
}).
collect
(
Collectors
.
toList
());
return
resourcesList
;
}
}
public
List
<
Resource
>
getResourcesSortByBillingStartDate
(
String
employeeId
)
{
public
List
<
ResourceVO
>
prepareProjectTeamMembersList
(
String
projectId
)
{
Query
query
=
prepareQuery
(
employeeId
,
MyTeamUtils
.
BILLING_START_DATE
);
List
<
ResourceVO
>
finalResourcesList
=
new
ArrayList
<>();
return
mongoTemplate
.
find
(
query
,
Resource
.
class
);
Employee
employee
=
null
;
}
for
(
Resource
resource
:
getAllResourcesForProject
(
projectId
))
{
private
Query
prepareQuery
(
String
employeeId
,
String
dateColumn
)
{
Query
query
=
new
Query
();
ResourceVO
resourceVO
=
new
ResourceVO
();
query
.
addCriteria
(
Criteria
.
where
(
MyTeamUtils
.
EMPLOYEE_ID
).
is
(
employeeId
));
resourceVO
.
setId
(
resource
.
getId
());
query
.
limit
(
MyTeamUtils
.
ONE
);
resourceVO
.
setProjectId
(
resource
.
getProjectId
());
query
.
with
(
new
Sort
(
Sort
.
Direction
.
DESC
,
dateColumn
));
resourceVO
.
setEmployeeId
(
resource
.
getEmployeeId
());
return
query
;
resourceVO
.
setStatus
(
resource
.
getStatus
());
}
employee
=
employeeService
.
getEmployeeById
(
resource
.
getEmployeeId
());
@Override
resourceVO
.
setEmployeeName
(
employee
.
getEmployeeName
());
public
List
<
ResourceVO
>
getActiveResources
(
String
empId
)
{
resourceVO
.
setDesignation
(
employee
.
getDesignation
());
List
<
ResourceVO
>
resourcesList
=
new
ArrayList
<>();
resourceVO
.
setEmailId
(
employee
.
getEmailId
());
for
(
Resource
resource
:
resourceRepo
.
findByEmployeeId
(
empId
))
{
resourceVO
.
setMobileNo
(
employee
.
getMobileNumber
());
if
(
resource
.
getBillingEndDate
().
compareTo
(
new
Date
())
>
0
)
{
resourcesList
.
addAll
(
prepareProjectTeamMembersList
(
resource
.
getProjectId
()));
resourceVO
.
setProjectName
(
projectService
.
getProjectByProjectId
(
resource
.
getProjectId
()).
getProjectName
());
}
resourceVO
.
setBillableStatus
(
resource
.
getBillableStatus
());
}
resourceVO
.
setBillingStartDate
(
resource
.
getBillingStartDate
());
return
resourcesList
;
resourceVO
.
setBillingEndDate
(
resource
.
getBillingEndDate
());
}
resourceVO
.
setResourceRole
(
resource
.
getResourceRole
());
if
(
resource
.
getBillingEndDate
().
compareTo
(
new
Date
())
>
0
)
{
public
List
<
ResourceVO
>
prepareProjectTeamMembersList
(
String
projectId
)
{
resourceVO
.
setResourceStatus
(
ResourceStatus
.
ACTIVE
.
getStatus
());
List
<
ResourceVO
>
finalResourcesList
=
new
ArrayList
<>();
}
else
{
Employee
employee
=
null
;
resourceVO
.
setResourceStatus
(
ResourceStatus
.
IN_ACTIVE
.
getStatus
());
}
for
(
Resource
resource
:
getAllResourcesForProject
(
projectId
))
{
finalResourcesList
.
add
(
resourceVO
);
ResourceVO
resourceVO
=
new
ResourceVO
();
resourceVO
.
setId
(
resource
.
getId
());
}
resourceVO
.
setProjectId
(
resource
.
getProjectId
());
return
finalResourcesList
;
resourceVO
.
setEmployeeId
(
resource
.
getEmployeeId
());
}
resourceVO
.
setStatus
(
resource
.
getStatus
());
public
List
<
Resource
>
getAllResourcesForProject
(
String
projectId
)
{
employee
=
employeeService
.
getEmployeeById
(
resource
.
getEmployeeId
());
return
resourceRepo
.
findByProjectId
(
projectId
);
resourceVO
.
setEmployeeName
(
employee
.
getEmployeeName
());
}
resourceVO
.
setDesignation
(
employee
.
getDesignation
());
resourceVO
.
setEmailId
(
employee
.
getEmailId
());
resourceVO
.
setMobileNo
(
employee
.
getMobileNumber
());
@Override
public
List
<
Resource
>
getAllResourcesForAllActiveProjects
()
{
resourceVO
.
setProjectName
(
projectService
.
getProjectByProjectId
(
resource
.
getProjectId
()).
getProjectName
());
List
<
Resource
>
resourceList
=
new
ArrayList
<>();
resourceVO
.
setBillableStatus
(
resource
.
getBillableStatus
());
resourceVO
.
setBillingStartDate
(
resource
.
getBillingStartDate
());
for
(
Project
activeProject
:
projectService
.
getOnlyActiveProjects
())
{
resourceVO
.
setBillingEndDate
(
resource
.
getBillingEndDate
());
resourceList
.
addAll
(
getAllResourcesForProject
(
activeProject
.
getProjectId
()));
resourceVO
.
setResourceRole
(
resource
.
getResourceRole
());
}
if
(
resource
.
getBillingEndDate
().
compareTo
(
new
Date
())
>
0
)
{
resourceVO
.
setResourceStatus
(
ResourceStatus
.
ACTIVE
.
getStatus
());
return
resourceList
;
}
else
{
}
resourceVO
.
setResourceStatus
(
ResourceStatus
.
IN_ACTIVE
.
getStatus
());
}
@Override
finalResourcesList
.
add
(
resourceVO
);
public
List
<
ResourceVO
>
getResourcesForProject
(
String
projectId
,
String
statusFlag
)
{
List
<
ResourceVO
>
resourcesList
=
new
ArrayList
<>();
}
return
finalResourcesList
;
for
(
Resource
resource
:
resourceRepo
.
findByProjectId
(
projectId
))
{
}
Date
billingEndDate
=
resource
.
getBillingEndDate
();
if
(
billingEndDate
!=
null
)
{
public
List
<
Resource
>
getAllResourcesForProject
(
String
projectId
)
{
return
resourceRepo
.
findByProjectId
(
projectId
);
ResourceVO
resourceVO
=
new
ResourceVO
();
}
resourceVO
.
setId
(
resource
.
getId
());
resourceVO
.
setProjectId
(
resource
.
getProjectId
());
@Override
resourceVO
.
setProjectName
(
projectService
.
getProjectByProjectId
(
resource
.
getProjectId
()).
getProjectName
());
public
List
<
Resource
>
getAllResourcesForAllActiveProjects
()
{
resourceVO
.
setResourceRole
(
resource
.
getResourceRole
());
List
<
Resource
>
resourceList
=
new
ArrayList
<>();
resourceVO
.
setBillingStartDate
(
resource
.
getBillingStartDate
());
resourceVO
.
setBillingEndDate
(
resource
.
getBillingEndDate
());
for
(
Project
activeProject
:
projectService
.
getOnlyActiveProjects
())
{
resourceVO
.
setBillableStatus
(
resource
.
getBillableStatus
());
resourceList
.
addAll
(
getAllResourcesForProject
(
activeProject
.
getProjectId
()));
resourceVO
.
setEmployeeId
(
resource
.
getEmployeeId
());
}
resourceVO
.
setStatus
(
resource
.
getStatus
());
return
resourceList
;
Employee
employee
=
employeeService
.
getEmployeeById
(
resource
.
getEmployeeId
());
}
resourceVO
.
setEmailId
(
employee
.
getEmailId
());
resourceVO
.
setEmployeeName
(
employee
.
getEmployeeName
());
@Override
resourceVO
.
setDesignation
(
employee
.
getDesignation
());
public
List
<
ResourceVO
>
getResourcesForProject
(
String
projectId
,
String
statusFlag
)
{
List
<
ResourceVO
>
resourcesList
=
new
ArrayList
<>();
// Active
for
(
Resource
resource
:
resourceRepo
.
findByProjectId
(
projectId
))
{
if
(
statusFlag
.
equals
(
ResourceStatus
.
ACTIVE
.
getStatus
())
&&
billingEndDate
.
compareTo
(
new
Date
())
>=
0
)
{
Date
billingEndDate
=
resource
.
getBillingEndDate
();
resourceVO
.
setResourceStatus
(
ResourceStatus
.
ACTIVE
.
getStatus
());
if
(
billingEndDate
!=
null
)
{
resourcesList
.
add
(
resourceVO
);
}
else
if
(
statusFlag
.
equals
(
ResourceStatus
.
IN_ACTIVE
.
getStatus
())
&&
billingEndDate
.
compareTo
(
new
Date
())
<
0
)
{
ResourceVO
resourceVO
=
new
ResourceVO
();
resourceVO
.
setResourceStatus
(
ResourceStatus
.
IN_ACTIVE
.
getStatus
());
resourceVO
.
setId
(
resource
.
getId
());
resourcesList
.
add
(
resourceVO
);
resourceVO
.
setProjectId
(
resource
.
getProjectId
());
}
else
if
(
statusFlag
.
equals
(
MyTeamUtils
.
BOTH
))
resourceVO
resourcesList
.
add
(
resourceVO
);
.
setProjectName
(
projectService
.
getProjectByProjectId
(
resource
.
getProjectId
()).
getProjectName
());
resourceVO
.
setResourceRole
(
resource
.
getResourceRole
());
}
resourceVO
.
setBillingStartDate
(
resource
.
getBillingStartDate
());
resourceVO
.
setBillingEndDate
(
resource
.
getBillingEndDate
());
}
resourceVO
.
setBillableStatus
(
resource
.
getBillableStatus
());
return
resourcesList
;
resourceVO
.
setEmployeeId
(
resource
.
getEmployeeId
());
}
resourceVO
.
setStatus
(
resource
.
getStatus
());
Employee
employee
=
employeeService
.
getEmployeeById
(
resource
.
getEmployeeId
());
@Override
resourceVO
.
setEmailId
(
employee
.
getEmailId
());
public
List
<
MyProjectAllocationVO
>
getWorkedProjectsForResource
(
String
empId
)
{
resourceVO
.
setEmployeeName
(
employee
.
getEmployeeName
());
resourceVO
.
setDesignation
(
employee
.
getDesignation
());
Project
project
=
null
;
Account
account
=
null
;
// Active
Domain
domain
=
null
;
if
(
statusFlag
.
equals
(
ResourceStatus
.
ACTIVE
.
getStatus
())
&&
billingEndDate
.
compareTo
(
new
Date
())
>=
0
)
{
Employee
employee
=
null
;
resourceVO
.
setResourceStatus
(
ResourceStatus
.
ACTIVE
.
getStatus
());
List
<
MyProjectAllocationVO
>
myProjectList
=
new
ArrayList
<>();
resourcesList
.
add
(
resourceVO
);
}
else
if
(
statusFlag
.
equals
(
ResourceStatus
.
IN_ACTIVE
.
getStatus
())
List
<
Resource
>
resourcesAllocatedList
=
resourceRepo
.
findByEmployeeId
(
empId
);
&&
billingEndDate
.
compareTo
(
new
Date
())
<
0
)
{
resourceVO
.
setResourceStatus
(
ResourceStatus
.
IN_ACTIVE
.
getStatus
());
if
(
null
!=
resourcesAllocatedList
&&
!
resourcesAllocatedList
.
isEmpty
()
&&
MyTeamUtils
.
INT_ZERO
<
resourcesAllocatedList
.
size
())
{
resourcesList
.
add
(
resourceVO
);
for
(
Resource
resourceAlloc
:
resourcesAllocatedList
)
{
}
else
if
(
statusFlag
.
equals
(
MyTeamUtils
.
BOTH
))
resourcesList
.
add
(
resourceVO
);
project
=
projectService
.
getProjectByProjectId
(
resourceAlloc
.
getProjectId
());
account
=
accountService
.
getAccountById
(
project
.
getAccountId
());
}
domain
=
domainService
.
getDomainById
(
project
.
getDomainId
());
employee
=
employeeService
.
getEmployeeById
(
resourceAlloc
.
getEmployeeId
());
}
return
resourcesList
;
MyProjectAllocationVO
myProject
=
new
MyProjectAllocationVO
();
}
myProject
.
setProjectId
(
project
.
getProjectId
());
myProject
.
setProjectName
(
project
.
getProjectName
());
@Override
myProject
.
setProjectStartDate
(
project
.
getProjectStartDate
());
public
List
<
MyProjectAllocationVO
>
getWorkedProjectsForResource
(
String
empId
)
{
myProject
.
setProjectEndDate
(
project
.
getProjectEndDate
());
myProject
.
setProjectStatus
(
project
.
getStatus
());
Project
project
=
null
;
myProject
.
setAccountName
(
account
.
getAccountName
());
Account
account
=
null
;
Domain
domain
=
null
;
myProject
.
setBillableStatus
(
resourceAlloc
.
getBillableStatus
());
Employee
employee
=
null
;
myProject
.
setBillingStartDate
(
resourceAlloc
.
getBillingStartDate
());
List
<
MyProjectAllocationVO
>
myProjectList
=
new
ArrayList
<>();
myProject
.
setBillingEndDate
(
resourceAlloc
.
getBillingEndDate
());
myProject
.
setShift
(
employee
.
getShift
());
List
<
Resource
>
resourcesAllocatedList
=
resourceRepo
.
findByEmployeeId
(
empId
);
if
(
resourceAlloc
.
getBillingEndDate
().
compareTo
(
new
Date
())
>
0
)
{
myProject
.
setResourceStatus
(
ResourceStatus
.
ACTIVE
.
getStatus
());
if
(
null
!=
resourcesAllocatedList
&&
!
resourcesAllocatedList
.
isEmpty
()
}
else
{
&&
MyTeamUtils
.
INT_ZERO
<
resourcesAllocatedList
.
size
())
{
myProject
.
setResourceStatus
(
ResourceStatus
.
IN_ACTIVE
.
getStatus
());
for
(
Resource
resourceAlloc
:
resourcesAllocatedList
)
{
}
project
=
projectService
.
getProjectByProjectId
(
resourceAlloc
.
getProjectId
());
if
(
project
.
getDeliveryLeadIds
()
!=
null
)
{
account
=
accountService
.
getAccountById
(
project
.
getAccountId
());
myProject
.
setDeliveryLeadIds
(
employeeService
.
getDeliveryManagerMap
(
project
.
getDeliveryLeadIds
()));
domain
=
domainService
.
getDomainById
(
project
.
getDomainId
());
}
employee
=
employeeService
.
getEmployeeById
(
resourceAlloc
.
getEmployeeId
());
myProjectList
.
add
(
myProject
);
}
MyProjectAllocationVO
myProject
=
new
MyProjectAllocationVO
();
}
myProject
.
setProjectId
(
project
.
getProjectId
());
return
myProjectList
;
myProject
.
setProjectName
(
project
.
getProjectName
());
}
myProject
.
setProjectStartDate
(
project
.
getProjectStartDate
());
myProject
.
setProjectEndDate
(
project
.
getProjectEndDate
());
myProject
.
setProjectStatus
(
project
.
getStatus
());
@Override
myProject
.
setAccountName
(
account
.
getAccountName
());
public
List
<
Resource
>
getResourcesUnderDeliveryLead
(
String
deliveryLeadId
)
{
List
<
String
>
projectIdsList
=
new
ArrayList
<>();
myProject
.
setBillableStatus
(
resourceAlloc
.
getBillableStatus
());
List
<
Resource
>
resourcesList
=
new
ArrayList
<>();
myProject
.
setBillingStartDate
(
resourceAlloc
.
getBillingStartDate
());
myProject
.
setBillingEndDate
(
resourceAlloc
.
getBillingEndDate
());
for
(
Project
project
:
projectService
.
getProjectsForDeliveryLead
(
deliveryLeadId
))
myProject
.
setShift
(
employee
.
getShift
());
projectIdsList
.
add
(
project
.
getProjectId
());
if
(
resourceAlloc
.
getBillingEndDate
().
compareTo
(
new
Date
())
>
0
)
{
myProject
.
setResourceStatus
(
ResourceStatus
.
ACTIVE
.
getStatus
());
Query
query
=
new
Query
(
Criteria
.
where
(
"projectId"
).
in
(
projectIdsList
));
}
else
{
List
<
Resource
>
resourcesListPersisted
=
mongoTemplate
.
find
(
query
,
Resource
.
class
);
myProject
.
setResourceStatus
(
ResourceStatus
.
IN_ACTIVE
.
getStatus
());
}
for
(
Resource
resourceAlloc
:
resourcesListPersisted
)
{
if
(!
resourceAlloc
.
getEmployeeId
().
equals
(
deliveryLeadId
))
if
(
project
.
getDeliveryLeadIds
()
!=
null
)
{
resourcesList
.
add
(
resourceAlloc
);
myProject
.
setDeliveryLeadIds
(
employeeService
.
getDeliveryManagerMap
(
project
.
getDeliveryLeadIds
()));
}
}
return
resourcesList
;
myProjectList
.
add
(
myProject
);
}
}
}
return
myProjectList
;
}
@Override
public
List
<
ResourceVO
>
getBillingsForEmployee
(
String
empId
)
{
@Override
List
<
ResourceVO
>
finalList
=
new
ArrayList
<>();
public
List
<
Resource
>
getResourcesUnderDeliveryLead
(
String
deliveryLeadId
)
{
List
<
Resource
>
resourcesList
=
resourceRepo
.
findByEmployeeId
(
empId
);
List
<
String
>
projectIdsList
=
new
ArrayList
<>();
if
(
resourcesList
!=
null
&&
resourcesList
.
size
()
>
0
)
{
List
<
Resource
>
resourcesList
=
new
ArrayList
<>();
log
.
info
(
"The resources billing list before sorting::"
+
resourcesList
);
//return billingsList.stream().sorted(Comparator.comparing(Billing::getCreatedOn).reversed()).collect(Collectors.toList());
for
(
Project
project
:
projectService
.
getProjectsForDeliveryLead
(
deliveryLeadId
))
List
<
Resource
>
sortedList
=
resourcesList
.
stream
().
sorted
(
Comparator
.
comparing
(
Resource:
:
getBillingStartDate
).
reversed
()).
collect
(
Collectors
.
toList
());
projectIdsList
.
add
(
project
.
getProjectId
());
finalList
=
convertResourcesToResourcesVO
(
sortedList
);
Query
query
=
new
Query
(
Criteria
.
where
(
"projectId"
).
in
(
projectIdsList
));
}
List
<
Resource
>
resourcesListPersisted
=
mongoTemplate
.
find
(
query
,
Resource
.
class
);
return
finalList
;
}
for
(
Resource
resourceAlloc
:
resourcesListPersisted
)
{
if
(!
resourceAlloc
.
getEmployeeId
().
equals
(
deliveryLeadId
))
@Override
resourcesList
.
add
(
resourceAlloc
);
public
List
<
Resource
>
getBillingsForProject
(
String
empId
,
String
projectId
)
{
}
List
<
Resource
>
resourcesList
=
resourceRepo
.
findByEmployeeIdAndProjectId
(
empId
,
projectId
);
return
resourcesList
;
if
(
resourcesList
==
null
||
resourcesList
.
size
()
==
0
)
{
}
return
resourcesList
;
}
else
{
@Override
//return billingsList.stream().sorted(Comparator.comparing(Billing::getCreatedOn).reversed()).collect(Collectors.toList());
public
List
<
ResourceVO
>
getBillingsForEmployee
(
String
empId
)
{
return
resourcesList
.
stream
().
sorted
(
Comparator
.
comparing
(
Resource:
:
getBillingStartDate
).
reversed
()).
collect
(
Collectors
.
toList
());
List
<
ResourceVO
>
finalList
=
new
ArrayList
<>();
}
List
<
Resource
>
resourcesList
=
resourceRepo
.
findByEmployeeId
(
empId
);
if
(
resourcesList
!=
null
&&
resourcesList
.
size
()
>
0
)
{
}
log
.
info
(
"The resources billing list before sorting::"
+
resourcesList
);
// return
// billingsList.stream().sorted(Comparator.comparing(Billing::getCreatedOn).reversed()).collect(Collectors.toList());
@Override
List
<
Resource
>
sortedList
=
resourcesList
.
stream
()
public
List
<
Employee
>
getUnAssignedEmployees
()
{
.
sorted
(
Comparator
.
comparing
(
Resource:
:
getBillingStartDate
).
reversed
())
.
collect
(
Collectors
.
toList
());
List
<
Employee
>
notAssignedEmployees
=
new
ArrayList
<>();
List
<
String
>
resourceIdsList
=
new
ArrayList
<>();
finalList
=
convertResourcesToResourcesVO
(
sortedList
);
}
for
(
Resource
resource
:
this
.
getAllResources
())
{
return
finalList
;
Project
project
=
projectService
.
getProjectByProjectId
(
resource
.
getProjectId
());
}
if
(
project
!=
null
&&
project
.
getStatus
()
!=
null
&&
!
"Completed"
.
equalsIgnoreCase
(
project
.
getStatus
()))
{
resourceIdsList
.
add
(
resource
.
getEmployeeId
());
@Override
}
public
List
<
Resource
>
getBillingsForProject
(
String
empId
,
String
projectId
)
{
}
List
<
Resource
>
resourcesList
=
resourceRepo
.
findByEmployeeIdAndProjectId
(
empId
,
projectId
);
for
(
Employee
employee
:
employeeService
.
getAllEmployees
())
{
if
(!
resourceIdsList
.
contains
(
employee
.
getEmployeeId
()))
{
if
(
resourcesList
==
null
||
resourcesList
.
size
()
==
0
)
{
notAssignedEmployees
.
add
(
employee
);
return
resourcesList
;
}
}
else
{
}
// return
// billingsList.stream().sorted(Comparator.comparing(Billing::getCreatedOn).reversed()).collect(Collectors.toList());
return
notAssignedEmployees
;
return
resourcesList
.
stream
().
sorted
(
Comparator
.
comparing
(
Resource:
:
getBillingStartDate
).
reversed
())
}
.
collect
(
Collectors
.
toList
());
}
public
void
deleteResourcesUnderProject
(
String
projectId
)
{
}
Query
query
=
new
Query
(
Criteria
.
where
(
"projectId"
).
is
(
projectId
));
List
<
Resource
>
list
=
mongoTemplate
.
find
(
query
,
Resource
.
class
);
@Override
public
List
<
Employee
>
getUnAssignedEmployees
()
{
resourceRepo
.
delete
(
list
);
}
List
<
Employee
>
notAssignedEmployees
=
new
ArrayList
<>();
List
<
String
>
resourceIdsList
=
new
ArrayList
<>();
private
List
<
ResourceVO
>
convertResourcesToResourcesVO
(
List
<
Resource
>
resourcesList
)
{
for
(
Resource
resource
:
this
.
getAllResources
())
{
Project
project
=
projectService
.
getProjectByProjectId
(
resource
.
getProjectId
());
List
<
ResourceVO
>
finalList
=
new
ArrayList
<>();
if
(
project
!=
null
&&
project
.
getStatus
()
!=
null
&&
!
"Completed"
.
equalsIgnoreCase
(
project
.
getStatus
()))
{
if
(
resourcesList
!=
null
&&
resourcesList
.
size
()
>
0
)
{
resourceIdsList
.
add
(
resource
.
getEmployeeId
());
finalList
=
resourcesList
.
stream
().
map
(
resource
->
{
}
}
ResourceVO
resourceVO
=
new
ResourceVO
();
for
(
Employee
employee
:
employeeService
.
getAllEmployees
())
{
resourceVO
.
setId
(
resource
.
getId
());
if
(!
resourceIdsList
.
contains
(
employee
.
getEmployeeId
()))
{
resourceVO
.
setProjectId
(
resource
.
getProjectId
());
notAssignedEmployees
.
add
(
employee
);
resourceVO
.
setEmployeeId
(
resource
.
getEmployeeId
());
}
resourceVO
.
setStatus
(
resource
.
getStatus
());
}
Employee
employee
=
employeeService
.
getEmployeeById
(
resource
.
getEmployeeId
());
return
notAssignedEmployees
;
if
(
employee
!=
null
)
{
}
resourceVO
.
setEmployeeName
(
employee
.
getEmployeeName
());
resourceVO
.
setDesignation
(
employee
.
getDesignation
());
public
void
deleteResourcesUnderProject
(
String
projectId
)
{
resourceVO
.
setEmailId
(
employee
.
getEmailId
());
Query
query
=
new
Query
(
Criteria
.
where
(
"projectId"
).
is
(
projectId
));
resourceVO
.
setMobileNo
(
employee
.
getMobileNumber
());
List
<
Resource
>
list
=
mongoTemplate
.
find
(
query
,
Resource
.
class
);
}
resourceRepo
.
delete
(
list
);
Project
project
=
projectService
.
getProjectByProjectId
(
resource
.
getProjectId
());
}
if
(
project
!=
null
)
{
resourceVO
.
setProjectName
(
project
.
getProjectName
());
private
List
<
ResourceVO
>
convertResourcesToResourcesVO
(
List
<
Resource
>
resourcesList
)
{
resourceVO
.
setProjectStartDate
(
project
.
getProjectStartDate
());
resourceVO
.
setProjectEndDate
(
project
.
getProjectEndDate
());
List
<
ResourceVO
>
finalList
=
new
ArrayList
<>();
resourceVO
.
setProjectStatus
(
project
.
getStatus
());
if
(
resourcesList
!=
null
&&
resourcesList
.
size
()
>
0
)
{
if
(
project
.
getAccountId
()
!=
null
)
{
finalList
=
resourcesList
.
stream
().
map
(
resource
->
{
Account
account
=
accountService
.
getAccountById
(
project
.
getAccountId
());
if
(
account
!=
null
)
{
ResourceVO
resourceVO
=
new
ResourceVO
();
resourceVO
.
setAccountName
(
account
.
getAccountName
());
resourceVO
.
setId
(
resource
.
getId
());
}
resourceVO
.
setProjectId
(
resource
.
getProjectId
());
}
resourceVO
.
setEmployeeId
(
resource
.
getEmployeeId
());
}
resourceVO
.
setStatus
(
resource
.
getStatus
());
//Account account=accountService.getAccountById(domainService.getDomainById(project.getProjectId()).getAccountId());
Employee
employee
=
employeeService
.
getEmployeeById
(
resource
.
getEmployeeId
());
if
(
employee
!=
null
)
{
resourceVO
.
setBillableStatus
(
resource
.
getBillableStatus
());
resourceVO
.
setEmployeeName
(
employee
.
getEmployeeName
());
resourceVO
.
setBillingStartDate
(
resource
.
getBillingStartDate
());
resourceVO
.
setDesignation
(
employee
.
getDesignation
());
resourceVO
.
setBillingEndDate
(
resource
.
getBillingEndDate
());
resourceVO
.
setEmailId
(
employee
.
getEmailId
());
resourceVO
.
setResourceRole
(
resource
.
getResourceRole
());
resourceVO
.
setMobileNo
(
employee
.
getMobileNumber
());
if
(
resource
.
getBillingEndDate
().
compareTo
(
new
Date
())
>
0
)
{
}
resourceVO
.
setResourceStatus
(
ResourceStatus
.
ACTIVE
.
getStatus
());
}
else
{
Project
project
=
projectService
.
getProjectByProjectId
(
resource
.
getProjectId
());
resourceVO
.
setResourceStatus
(
ResourceStatus
.
IN_ACTIVE
.
getStatus
());
if
(
project
!=
null
)
{
}
resourceVO
.
setProjectName
(
project
.
getProjectName
());
return
resourceVO
;
resourceVO
.
setProjectStartDate
(
project
.
getProjectStartDate
());
resourceVO
.
setProjectEndDate
(
project
.
getProjectEndDate
());
}).
collect
(
Collectors
.
toList
());
resourceVO
.
setProjectStatus
(
project
.
getStatus
());
}
if
(
project
.
getAccountId
()
!=
null
)
{
Account
account
=
accountService
.
getAccountById
(
project
.
getAccountId
());
return
finalList
;
if
(
account
!=
null
)
{
}
resourceVO
.
setAccountName
(
account
.
getAccountName
());
}
}
@Override
}
public
Resource
addResourceToBenchProject
(
Employee
employee
,
String
loginEmpId
)
throws
MyTeamException
{
Resource
resourcePersisted
=
null
;
// Account
// account=accountService.getAccountById(domainService.getDomainById(project.getProjectId()).getAccountId());
Resource
resourceBench
=
new
Resource
();
resourceBench
.
setProjectId
(
MyTeamUtils
.
BENCH_PROJECT_ID
);
resourceVO
.
setBillableStatus
(
resource
.
getBillableStatus
());
resourceBench
.
setEmployeeId
(
employee
.
getEmployeeId
());
resourceVO
.
setBillingStartDate
(
resource
.
getBillingStartDate
());
resourceBench
.
setResourceRole
(
employee
.
getRole
());
resourceVO
.
setBillingEndDate
(
resource
.
getBillingEndDate
());
resourceBench
.
setStatus
(
MyTeamUtils
.
RELEASED_STATUS
);
resourceVO
.
setResourceRole
(
resource
.
getResourceRole
());
resourceBench
.
setBillingStartDate
(
employee
.
getDateOfJoining
()
!=
null
?
employee
.
getDateOfJoining
()
:
new
Date
());
if
(
resource
.
getBillingEndDate
().
compareTo
(
new
Date
())
>
0
)
{
resourceBench
.
setBillableStatus
(
MyTeamUtils
.
BENCH_BILLABILITY_STATUS
);
resourceVO
.
setResourceStatus
(
ResourceStatus
.
ACTIVE
.
getStatus
());
resourceBench
.
setEmployeeId
(
employee
.
getEmployeeId
());
}
else
{
resourceBench
.
setBillingEndDate
(
projectService
.
getProjectByProjectId
(
MyTeamUtils
.
BENCH_PROJECT_ID
).
getProjectEndDate
());
resourceVO
.
setResourceStatus
(
ResourceStatus
.
IN_ACTIVE
.
getStatus
());
resourcePersisted
=
addResource
(
resourceBench
,
loginEmpId
);
}
return
resourceVO
;
return
resourcePersisted
;
}).
collect
(
Collectors
.
toList
());
}
}
return
finalList
;
@Override
}
public
List
<
EmployeeShiftsVO
>
getResourcesForShift
(
String
shift
)
{
List
<
Resource
>
resourcesListPers
=
null
;
@Override
List
<
EmployeeShiftsVO
>
resourcesList
=
new
ArrayList
<>();
public
Resource
addResourceToBenchProject
(
Employee
employee
,
String
loginEmpId
)
throws
MyTeamException
{
Resource
resourcePersisted
=
null
;
List
<
Project
>
projects
=
projectService
.
getAllProjects
();
for
(
Project
project
:
projects
)
{
Resource
resourceBench
=
new
Resource
();
if
(
"Active"
.
equalsIgnoreCase
(
project
.
getStatus
()))
{
resourceBench
.
setProjectId
(
MyTeamUtils
.
BENCH_PROJECT_ID
);
resourcesListPers
=
getAllResourcesForProject
(
project
.
getProjectId
());
resourceBench
.
setEmployeeId
(
employee
.
getEmployeeId
());
resourceBench
.
setResourceRole
(
employee
.
getRole
());
for
(
Resource
resource
:
resourcesListPers
)
{
resourceBench
.
setStatus
(
MyTeamUtils
.
RELEASED_STATUS
);
resourceBench
.
setBillingStartDate
(
employee
.
getDateOfJoining
()
!=
null
?
employee
.
getDateOfJoining
()
:
new
Date
());
resourceBench
.
setBillableStatus
(
MyTeamUtils
.
BENCH_BILLABILITY_STATUS
);
resourceBench
.
setEmployeeId
(
employee
.
getEmployeeId
());
resourceBench
.
setBillingEndDate
(
projectService
.
getProjectByProjectId
(
MyTeamUtils
.
BENCH_PROJECT_ID
).
getProjectEndDate
());
resourcePersisted
=
addResource
(
resourceBench
,
loginEmpId
);
return
resourcePersisted
;
}
@Override
public
List
<
EmployeeShiftsVO
>
getResourcesForShift
(
String
shift
)
{
List
<
Resource
>
resourcesListPers
=
null
;
List
<
EmployeeShiftsVO
>
resourcesList
=
new
ArrayList
<>();
List
<
Project
>
projects
=
projectService
.
getAllProjects
();
for
(
Project
project
:
projects
)
{
if
(
"Active"
.
equalsIgnoreCase
(
project
.
getStatus
()))
{
resourcesListPers
=
getAllResourcesForProject
(
project
.
getProjectId
());
for
(
Resource
resource
:
resourcesListPers
)
{
// EmployeeShift empShift = empShiftService.getEmployeeShift(resource.getEmployeeId());
// EmployeeShift empShift = empShiftService.getEmployeeShift(resource.getEmployeeId());
// if (empShift != null) {
// if (empShift != null) {
...
@@ -729,86 +751,87 @@ public class ResourceService implements IResourceService {
...
@@ -729,86 +751,87 @@ public class ResourceService implements IResourceService {
//
//
// }
// }
if
(
resource
.
getBillingEndDate
().
compareTo
(
new
Date
())
>=
0
)
{
if
(
resource
.
getBillingEndDate
().
compareTo
(
new
Date
())
>=
0
)
{
Employee
employee
=
employeeService
.
getEmployeeById
(
resource
.
getEmployeeId
());
Employee
employee
=
employeeService
.
getEmployeeById
(
resource
.
getEmployeeId
());
EmployeeShiftsVO
shiftsVO
=
new
EmployeeShiftsVO
();
EmployeeShiftsVO
shiftsVO
=
new
EmployeeShiftsVO
();
shiftsVO
.
setEmployeeId
(
employee
.
getEmployeeId
());
shiftsVO
.
setEmployeeId
(
employee
.
getEmployeeId
());
shiftsVO
.
setEmployeeName
(
employee
.
getEmployeeName
());
shiftsVO
.
setEmployeeName
(
employee
.
getEmployeeName
());
shiftsVO
.
setEmailId
(
employee
.
getEmailId
());
shiftsVO
.
setEmailId
(
employee
.
getEmailId
());
shiftsVO
.
setMobileNo
(
employee
.
getMobileNumber
());
shiftsVO
.
setMobileNo
(
employee
.
getMobileNumber
());
shiftsVO
.
setProjectName
(
project
.
getProjectName
());
shiftsVO
.
setProjectName
(
project
.
getProjectName
());
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
resourcesList
.
add
(
shiftsVO
);
&&
Shifts
.
SHIFT1
.
getShiftType
().
equalsIgnoreCase
(
shift
))
resourcesList
.
add
(
shiftsVO
);
}
}
}
}
}
//
for
}
//
for
}
}
}
}
return
resourcesList
;
return
resourcesList
;
}
}
@Override
public
Resource
getLatestResourceByEmpId
(
String
employeeId
)
{
return
getLatestAllocation
(
resourceRepo
.
findByEmployeeId
(
employeeId
));
}
@Override
public
List
<
Resource
>
getResourcesByBillingStatus
(
String
resourceStatus
)
{
return
resourceRepo
.
findByBillableStatus
(
resourceStatus
);
}
@Override
public
List
<
ReserveReportsVO
>
getResourceReportsByBillingStatus
(
String
resourceStatus
)
{
return
prepareReserveReports
(
getResourcesByBillingStatus
(
resourceStatus
));
}
@Override
public
List
<
ReserveReportsVO
>
prepareReserveReports
(
List
<
Resource
>
resourcesList
)
{
List
<
ReserveReportsVO
>
reserveReportsList
=
new
ArrayList
<>();
@Override
if
(
resourcesList
!=
null
&&
resourcesList
.
size
()
>
0
)
{
public
Resource
getLatestResourceByEmpId
(
String
employeeId
)
{
Project
project
=
null
;
return
getLatestAllocation
(
resourceRepo
.
findByEmployeeId
(
employeeId
));
for
(
Resource
resource
:
resourcesList
)
{
ReserveReportsVO
reserveReportsVO
=
new
ReserveReportsVO
();
reserveReportsVO
.
setEmployeeId
(
resource
.
getEmployeeId
());
reserveReportsVO
.
setEmployeeName
(
employeeService
.
getEmployeeById
(
resource
.
getEmployeeId
()).
getEmployeeName
());
if
(
StringUtils
.
isNotBlank
(
resource
.
getProjectId
()))
{
project
=
projectService
.
getProjectByProjectId
(
resource
.
getProjectId
());
if
(
project
!=
null
)
{
reserveReportsVO
.
setProjectName
(
project
.
getProjectName
());
reserveReportsVO
.
setAccountName
(
accountService
.
getAccountById
(
project
.
getAccountId
()).
getAccountName
());
}
}
}
reserveReportsVO
.
setBillingStartDate
(
resource
.
getBillingStartDate
());
reserveReportsVO
.
setBillingEndDate
(
resource
.
getBillingEndDate
());
reserveReportsList
.
add
(
reserveReportsVO
);
@Override
}
public
List
<
Resource
>
getResourcesByBillingStatus
(
String
resourceStatus
)
{
}
return
resourceRepo
.
findByBillableStatus
(
resourceStatus
);
}
return
reserveReportsList
;
@Override
public
List
<
ReserveReportsVO
>
getResourceReportsByBillingStatus
(
String
resourceStatus
)
{
return
prepareReserveReports
(
getResourcesByBillingStatus
(
resourceStatus
));
}
}
@Override
public
List
<
ReserveReportsVO
>
prepareReserveReports
(
List
<
Resource
>
resourcesList
)
{
List
<
ReserveReportsVO
>
reserveReportsList
=
new
ArrayList
<>();
if
(
resourcesList
!=
null
&&
resourcesList
.
size
()
>
0
)
{
Project
project
=
null
;
for
(
Resource
resource
:
resourcesList
)
{
ReserveReportsVO
reserveReportsVO
=
new
ReserveReportsVO
();
reserveReportsVO
.
setEmployeeId
(
resource
.
getEmployeeId
());
reserveReportsVO
.
setEmployeeName
(
employeeService
.
getEmployeeById
(
resource
.
getEmployeeId
()).
getEmployeeName
());
if
(
StringUtils
.
isNotBlank
(
resource
.
getProjectId
()))
{
project
=
projectService
.
getProjectByProjectId
(
resource
.
getProjectId
());
if
(
project
!=
null
)
{
reserveReportsVO
.
setProjectName
(
project
.
getProjectName
());
reserveReportsVO
.
setAccountName
(
accountService
.
getAccountById
(
project
.
getAccountId
()).
getAccountName
());
}
}
reserveReportsVO
.
setBillingStartDate
(
resource
.
getBillingStartDate
());
reserveReportsVO
.
setBillingEndDate
(
resource
.
getBillingEndDate
());
reserveReportsList
.
add
(
reserveReportsVO
);
}
}
return
reserveReportsList
;
@Override
}
public
List
<
Resource
>
getResourceByProjectId
(
String
projectId
){
return
resourceRepo
.
findByProjectId
(
projectId
);
}
@Override
public
List
<
Resource
>
getResourceByProjectId
(
String
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,202 +868,196 @@ public class ResourceService implements IResourceService {
...
@@ -845,202 +868,196 @@ public class ResourceService implements IResourceService {
// }catch (Exception e){}
// }catch (Exception e){}
//
//
return
null
;
}
return
null
;
public
boolean
validateResourceAllocationStatus
(
ResourceAllocationStatus
resourceStatus
)
{
}
boolean
isValidStatus
=
false
;
switch
(
resourceStatus
)
{
public
boolean
validateResourceAllocationStatus
(
ResourceAllocationStatus
resourceStatus
)
{
boolean
isValidStatus
=
false
;
switch
(
resourceStatus
)
{
case
TRAINEE:
case
TRAINEE:
case
BILLABLE:
case
BILLABLE:
case
NON_BILLABLE:
case
NON_BILLABLE:
case
RESERVED:
case
RESERVED:
isValidStatus
=
true
;
isValidStatus
=
true
;
break
;
break
;
}
}
return
isValidStatus
;
return
isValidStatus
;
}
public
List
<
Resource
>
getResourcesGreaterThanBillingStartDate
(
Date
billingStartDate
)
{
return
resourceRepo
.
findByBillingStartDateGreaterThan
(
billingStartDate
);
}
public
List
<
Resource
>
getResourcesBetweenBillingStartDates
(
Date
fromDate
,
Date
toDate
)
{
return
resourceRepo
.
findByBillingStartDateBetween
(
fromDate
,
toDate
);
}
public
List
<
AllocationChangeVO
>
getAllocationReports
(
Date
fromDate
,
Date
toDate
)
{
return
getResourcesBetweenBillingStartDates
(
fromDate
,
toDate
).
stream
()
.
filter
(
resource
->
resource
.
getBillingEndDate
().
compareTo
(
new
Date
())
>=
0
).
map
(
resource
->
{
Project
project
=
null
;
//Setting Current Billing details.
AllocationChangeVO
allocationVO
=
new
AllocationChangeVO
();
allocationVO
.
setEmployeeId
(
resource
.
getEmployeeId
());
allocationVO
.
setEmployeeName
(
employeeService
.
getEmployeeById
(
resource
.
getEmployeeId
()).
getEmployeeName
());
if
(
StringUtils
.
isNotBlank
(
resource
.
getProjectId
()))
{
project
=
projectService
.
getProjectByProjectId
(
resource
.
getProjectId
());
if
(
project
!=
null
)
{
allocationVO
.
setCurrentProjectName
(
project
.
getProjectName
());
allocationVO
.
setCurrentAccountName
(
accountService
.
getAccountById
(
project
.
getAccountId
()).
getAccountName
());
}
}
allocationVO
.
setCurrentBillingStatus
(
resource
.
getBillableStatus
());
allocationVO
.
setCurrentBillingStartDate
(
resource
.
getBillingStartDate
());
allocationVO
.
setCurrentBillingEndDate
(
resource
.
getBillingEndDate
());
Resource
prevBilling
=
resourceRepo
.
findOneByEmployeeIdAndBillingEndDate
(
resource
.
getEmployeeId
(),
MyTeamDateUtils
.
getDayLessThanDate
(
resource
.
getBillingStartDate
()));
log
.
info
(
"\n\n\n The prev billing info is::"
+
prevBilling
);
if
(
prevBilling
!=
null
)
{
if
(
StringUtils
.
isNotBlank
(
prevBilling
.
getProjectId
()))
{
project
=
projectService
.
getProjectByProjectId
(
prevBilling
.
getProjectId
());
if
(
project
!=
null
)
{
allocationVO
.
setPrevProjectName
(
project
.
getProjectName
());
allocationVO
.
setPrevAccountName
(
accountService
.
getAccountById
(
project
.
getAccountId
()).
getAccountName
());
}
}
allocationVO
.
setPrevBillingStatus
(
prevBilling
.
getBillableStatus
());
allocationVO
.
setPrevBillingStartDate
(
prevBilling
.
getBillingStartDate
());
allocationVO
.
setPrevBillingEndDate
(
prevBilling
.
getBillingEndDate
());
}
return
allocationVO
;
}).
collect
(
Collectors
.
toList
());
}
public
List
<
AllocationChangeVO
>
prepareAllocationResources
(
List
<
Resource
>
resourcesList
)
{
List
<
AllocationChangeVO
>
allocationList
=
new
ArrayList
<>();
if
(
resourcesList
!=
null
&&
resourcesList
.
size
()
>
0
)
{
Project
project
=
null
;
for
(
Resource
resource
:
resourcesList
)
{
AllocationChangeVO
allocationVO
=
new
AllocationChangeVO
();
allocationVO
.
setEmployeeId
(
resource
.
getEmployeeId
());
allocationVO
.
setEmployeeName
(
employeeService
.
getEmployeeById
(
resource
.
getEmployeeId
()).
getEmployeeName
());
if
(
StringUtils
.
isNotBlank
(
resource
.
getProjectId
()))
{
project
=
projectService
.
getProjectByProjectId
(
resource
.
getProjectId
());
if
(
project
!=
null
)
{
allocationVO
.
setCurrentProjectName
(
project
.
getProjectName
());
allocationVO
.
setCurrentAccountName
(
accountService
.
getAccountById
(
project
.
getAccountId
()).
getAccountName
());
}
}
allocationVO
.
setCurrentBillingStatus
(
resource
.
getBillableStatus
());
allocationVO
.
setCurrentBillingStartDate
(
resource
.
getBillingStartDate
());
allocationVO
.
setCurrentBillingEndDate
(
resource
.
getBillingEndDate
());
allocationList
.
add
(
allocationVO
);
}
}
return
allocationList
;
}
@Override
public
Set
<
Resource
>
findByBillableStatus
(
String
billableStatus
)
{
return
resourceRepo
.
findByBillableStatus
(
billableStatus
).
stream
().
filter
(
r
->
r
.
getBillingEndDate
().
after
(
new
Date
())).
collect
(
Collectors
.
toSet
());
}
public
Resource
sendResourceToOpenPool
(
Resource
resource
,
String
loginId
)
{
Resource
existingresource
=
resourceRepo
.
findById
(
resource
.
getId
());
existingresource
.
setStatus
(
MyTeamUtils
.
RELEASED_STATUS
);
this
.
updateExistedResource
(
existingresource
);
// isResourceAvailableinBenchbygraterthanEndDate=
Resource
benchResource
=
new
Resource
();
benchResource
.
setProjectId
(
MyTeamUtils
.
BENCH_PROJECT_ID
);
benchResource
.
setEmployeeId
(
resource
.
getEmployeeId
());
benchResource
.
setResourceRole
(
resource
.
getResourceRole
());
benchResource
.
setBillingStartDate
(
MyTeamDateUtils
.
getDayMoreThanDate
(
resource
.
getBillingEndDate
()));
benchResource
.
setBillingEndDate
(
projectService
.
getProjectByProjectId
(
MyTeamUtils
.
BENCH_PROJECT_ID
).
getProjectEndDate
());
benchResource
.
setBillableStatus
(
MyTeamUtils
.
BENCH_BILLABILITY_STATUS
);
benchResource
.
setStatus
(
MyTeamUtils
.
RELEASED_STATUS
);
benchResource
.
setAuditFields
(
loginId
,
MyTeamUtils
.
CREATE
);
Resource
resourcePers
=
resourceRepo
.
save
(
benchResource
);
respMap
.
put
(
"statusCode"
,
801
);
respMap
.
put
(
"message"
,
"Resource is moved to Bench Successfully"
);
return
resourcePers
;
}
}
@Override
public
List
<
Resource
>
getResourcesGreaterThanBillingStartDate
(
Date
billingStartDate
)
{
public
Resource
getCurrentAllocation
(
String
employeeId
)
{
return
resourceRepo
.
findByBillingStartDateGreaterThan
(
billingStartDate
);
return
resourceRepo
.
findByEmployeeId
(
employeeId
).
stream
().
filter
(
resource
->
isAllocationActiveToday
(
resource
)).
findAny
().
orElse
(
getLatestResourceByEmpId
(
employeeId
));
}
}
}
//class
public
List
<
Resource
>
getResourcesBetweenBillingStartDates
(
Date
fromDate
,
Date
toDate
)
{
return
resourceRepo
.
findByBillingStartDateBetween
(
fromDate
,
toDate
);
}
public
List
<
AllocationChangeVO
>
getAllocationReports
(
Date
fromDate
,
Date
toDate
)
{
return
getResourcesBetweenBillingStartDates
(
fromDate
,
toDate
).
stream
()
.
filter
(
resource
->
resource
.
getBillingEndDate
().
compareTo
(
new
Date
())
>=
0
).
map
(
resource
->
{
Project
project
=
null
;
// Setting Current Billing details.
AllocationChangeVO
allocationVO
=
new
AllocationChangeVO
();
allocationVO
.
setEmployeeId
(
resource
.
getEmployeeId
());
allocationVO
.
setEmployeeName
(
employeeService
.
getEmployeeById
(
resource
.
getEmployeeId
()).
getEmployeeName
());
if
(
StringUtils
.
isNotBlank
(
resource
.
getProjectId
()))
{
project
=
projectService
.
getProjectByProjectId
(
resource
.
getProjectId
());
if
(
project
!=
null
)
{
allocationVO
.
setCurrentProjectName
(
project
.
getProjectName
());
allocationVO
.
setCurrentAccountName
(
accountService
.
getAccountById
(
project
.
getAccountId
()).
getAccountName
());
}
}
allocationVO
.
setCurrentBillingStatus
(
resource
.
getBillableStatus
());
allocationVO
.
setCurrentBillingStartDate
(
resource
.
getBillingStartDate
());
allocationVO
.
setCurrentBillingEndDate
(
resource
.
getBillingEndDate
());
Resource
prevBilling
=
resourceRepo
.
findOneByEmployeeIdAndBillingEndDate
(
resource
.
getEmployeeId
(),
MyTeamDateUtils
.
getDayLessThanDate
(
resource
.
getBillingStartDate
()));
log
.
info
(
"\n\n\n The prev billing info is::"
+
prevBilling
);
if
(
prevBilling
!=
null
)
{
if
(
StringUtils
.
isNotBlank
(
prevBilling
.
getProjectId
()))
{
project
=
projectService
.
getProjectByProjectId
(
prevBilling
.
getProjectId
());
if
(
project
!=
null
)
{
allocationVO
.
setPrevProjectName
(
project
.
getProjectName
());
allocationVO
.
setPrevAccountName
(
accountService
.
getAccountById
(
project
.
getAccountId
()).
getAccountName
());
}
}
allocationVO
.
setPrevBillingStatus
(
prevBilling
.
getBillableStatus
());
allocationVO
.
setPrevBillingStartDate
(
prevBilling
.
getBillingStartDate
());
allocationVO
.
setPrevBillingEndDate
(
prevBilling
.
getBillingEndDate
());
}
return
allocationVO
;
}).
collect
(
Collectors
.
toList
());
/*
}
@Override
public List<ResourceVO> getActiveResources(String empId) {
List<ResourceVO> finalResourcesList = new ArrayList<>();
List<Resource> resourceList = resourceRepo.findByEmployeeId(empId);
if (resourceList != null && resourceList.size() > 0) {
Resource resourceAlloc=resourceList.get(0);
}
for (Resource resource : resourceRepo.findByEmployeeId(empId)) {
ResourceVO resourceVO=new ResourceVO();
resourceVO.setEmployeeId(resource.getEmployeeId());
Employee employee=employeeService.getEmployeeById(resource.getEmployeeId());
resourceVO.setEmployeeName(employee.getEmployeeName());
resourceVO.setDesignation(employee.getDesignation());
resourceVO.setEmailId(employee.getEmailId());
resourceVO.setMobileNo(employee.getMobileNumber());
resourceVO.setProjectName(projectService.getProjectByProjectId(resource.getProjectId()).getProjectName());
public
List
<
AllocationChangeVO
>
prepareAllocationResources
(
List
<
Resource
>
resourcesList
)
{
List
<
AllocationChangeVO
>
allocationList
=
new
ArrayList
<>();
if
(
resourcesList
!=
null
&&
resourcesList
.
size
()
>
0
)
{
Project
project
=
null
;
for
(
Resource
resource
:
resourcesList
)
{
if (resource.getBillingEndDate().compareTo(new Date()) > 0) {
AllocationChangeVO
allocationVO
=
new
AllocationChangeVO
();
finalResourcesList.addAll(getAllResourcesForProject(resource.getProjectId()));
allocationVO
.
setEmployeeId
(
resource
.
getEmployeeId
());
}
allocationVO
.
setEmployeeName
(
employeeService
.
getEmployeeById
(
resource
.
getEmployeeId
()).
getEmployeeName
());
if
(
StringUtils
.
isNotBlank
(
resource
.
getProjectId
()))
{
project
=
projectService
.
getProjectByProjectId
(
resource
.
getProjectId
());
if
(
project
!=
null
)
{
allocationVO
.
setCurrentProjectName
(
project
.
getProjectName
());
allocationVO
.
setCurrentAccountName
(
accountService
.
getAccountById
(
project
.
getAccountId
()).
getAccountName
());
}
}
}
return finalResourcesList;
allocationVO
.
setCurrentBillingStatus
(
resource
.
getBillableStatus
());
}
allocationVO
.
setCurrentBillingStartDate
(
resource
.
getBillingStartDate
());
allocationVO
.
setCurrentBillingEndDate
(
resource
.
getBillingEndDate
());
*/
allocationList
.
add
(
allocationVO
);
}
/*
}
@Override
return
allocationList
;
public List<ResourceVO> getActiveResources(String empId) {
}
List<ResourceVO> finalResourcesList = new ArrayList<>();
Employee employee = null;
List<Resource> resourceList = resourceRepo.findByEmployeeId(empId);
@Override
Optional<Resource> optionalResource = resourceList.stream().filter(resource -> resource.getBillingEndDate().compareTo(new Date()) > 0).findAny();
public
Set
<
Resource
>
findByBillableStatus
(
String
billableStatus
)
{
if (optionalResource.isPresent()) {
return
resourceRepo
.
findByBillableStatus
(
billableStatus
).
stream
()
finalResourcesList = prepareProjectTeamMembersList(optionalResource.get().getProjectId());
.
filter
(
r
->
r
.
getBillingEndDate
().
after
(
new
Date
())).
collect
(
Collectors
.
toSet
());
}
}
return finalResourcesList;
}
*/
public
Resource
sendResourceToOpenPool
(
Resource
resource
,
String
loginId
)
{
Resource
existingresource
=
resourceRepo
.
findById
(
resource
.
getId
());
existingresource
.
setStatus
(
MyTeamUtils
.
RELEASED_STATUS
);
this
.
updateExistedResource
(
existingresource
);
// isResourceAvailableinBenchbygraterthanEndDate=
Resource
benchResource
=
new
Resource
();
benchResource
.
setProjectId
(
MyTeamUtils
.
BENCH_PROJECT_ID
);
benchResource
.
setEmployeeId
(
resource
.
getEmployeeId
());
benchResource
.
setResourceRole
(
resource
.
getResourceRole
());
benchResource
.
setBillingStartDate
(
MyTeamDateUtils
.
getDayMoreThanDate
(
resource
.
getBillingEndDate
()));
benchResource
.
setBillingEndDate
(
projectService
.
getProjectByProjectId
(
MyTeamUtils
.
BENCH_PROJECT_ID
).
getProjectEndDate
());
benchResource
.
setBillableStatus
(
MyTeamUtils
.
BENCH_BILLABILITY_STATUS
);
benchResource
.
setStatus
(
MyTeamUtils
.
RELEASED_STATUS
);
benchResource
.
setAuditFields
(
loginId
,
MyTeamUtils
.
CREATE
);
Resource
resourcePers
=
resourceRepo
.
save
(
benchResource
);
respMap
.
put
(
"statusCode"
,
801
);
respMap
.
put
(
"message"
,
"Resource is moved to Bench Successfully"
);
return
resourcePers
;
}
@Override
public
Resource
getCurrentAllocation
(
String
employeeId
)
{
return
resourceRepo
.
findByEmployeeId
(
employeeId
).
stream
().
filter
(
resource
->
isAllocationActiveToday
(
resource
))
.
findAny
().
orElse
(
getLatestResourceByEmpId
(
employeeId
));
}
}
//class
/*
* @Override public List<ResourceVO> getActiveResources(String empId) {
* List<ResourceVO> finalResourcesList = new ArrayList<>();
*
* List<Resource> resourceList = resourceRepo.findByEmployeeId(empId); if
* (resourceList != null && resourceList.size() > 0) {
*
* Resource resourceAlloc=resourceList.get(0); }
*
* for (Resource resource : resourceRepo.findByEmployeeId(empId)) {
*
* ResourceVO resourceVO=new ResourceVO();
* resourceVO.setEmployeeId(resource.getEmployeeId());
*
* Employee employee=employeeService.getEmployeeById(resource.getEmployeeId());
* resourceVO.setEmployeeName(employee.getEmployeeName());
* resourceVO.setDesignation(employee.getDesignation());
* resourceVO.setEmailId(employee.getEmailId());
* resourceVO.setMobileNo(employee.getMobileNumber());
*
* resourceVO.setProjectName(projectService.getProjectByProjectId(resource.
* getProjectId()).getProjectName());
*
*
* if (resource.getBillingEndDate().compareTo(new Date()) > 0) {
* 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; }
*
*/
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