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
c33395f6
Commit
c33395f6
authored
Jun 24, 2019
by
Md Suleman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resource service updates
parent
4fdb4f5f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
20 deletions
+23
-20
ResourceService.java
...n/java/com/nisum/myteam/service/impl/ResourceService.java
+23
-20
No files found.
src/main/java/com/nisum/myteam/service/impl/ResourceService.java
View file @
c33395f6
...
...
@@ -143,31 +143,31 @@ public class ResourceService implements IResourceService {
if
(
resource
!=
null
)
{
if
(!
resource
.
getStatus
().
equalsIgnoreCase
(
MyTeamUtils
.
STATUS_RELEASED
)){
if
(
validateResourceForProposedToEngage
(
resourceReq
)){
this
.
updateExistedResource
(
resourceReq
);
return
;
}
else
{
// return;
}
else
{
if
(
isDatesAvailableForAllocation
(
resourceReq
))
{
Resource
prevAllocation
=
getFirstOfListOrNull
(
resourceRepo
.
findByEmployeeId
(
resourceReq
.
getEmployeeId
()).
stream
().
filter
(
a
->
a
.
getBillingEndDate
().
compareTo
(
MyTeamDateUtils
.
getDayLessThanDate
(
resource
.
getBillingStartDate
()))
==
0
).
collect
(
Collectors
.
toList
()));
Resource
nextAllocation
=
getFirstOfListOrNull
(
resourceRepo
.
findByEmployeeId
(
resourceReq
.
getEmployeeId
()).
stream
().
filter
(
a
->
a
.
getBillingStartDate
().
compareTo
(
MyTeamDateUtils
.
getDayMoreThanDate
(
resource
.
getBillingEndDate
()))
==
0
).
collect
(
Collectors
.
toList
()));
if
(
prevAllocation
!=
null
&&
prevAllocation
.
getProjectId
().
equalsIgnoreCase
(
MyTeamUtils
.
BENCH_PROJECT_ID
))
{
prevAllocation
.
setBillingEndDate
(
MyTeamDateUtils
.
getDayLessThanDate
(
resourceReq
.
getBillingStartDate
()));
this
.
updateExistedResource
(
prevAllocation
);
}
if
(
nextAllocation
!=
null
&&
nextAllocation
.
getProjectId
().
equalsIgnoreCase
(
MyTeamUtils
.
BENCH_PROJECT_ID
))
{
nextAllocation
.
setBillingStartDate
(
MyTeamDateUtils
.
getDayMoreThanDate
(
resourceReq
.
getBillingEndDate
()));
this
.
updateExistedResource
(
nextAllocation
);
}
resource
.
setBillableStatus
(
resourceReq
.
getBillableStatus
());
resource
.
setBillingStartDate
(
resourceReq
.
getBillingStartDate
());
resource
.
setBillingEndDate
(
resourceReq
.
getBillingEndDate
());
this
.
updateExistedResource
(
resource
);
}
if
(
isDatesAvailableForAllocation
(
resourceReq
))
{
Resource
prevAllocation
=
getFirstOfListOrNull
(
resourceRepo
.
findByEmployeeId
(
resourceReq
.
getEmployeeId
()).
stream
().
filter
(
a
->
a
.
getBillingEndDate
().
compareTo
(
MyTeamDateUtils
.
getDayLessThanDate
(
resource
.
getBillingStartDate
()))==
0
).
collect
(
Collectors
.
toList
()));
Resource
nextAllocation
=
getFirstOfListOrNull
(
resourceRepo
.
findByEmployeeId
(
resourceReq
.
getEmployeeId
()).
stream
().
filter
(
a
->
a
.
getBillingStartDate
().
compareTo
(
MyTeamDateUtils
.
getDayMoreThanDate
(
resource
.
getBillingEndDate
()))==
0
).
collect
(
Collectors
.
toList
()));
if
(
prevAllocation
!=
null
&&
prevAllocation
.
getProjectId
().
equalsIgnoreCase
(
MyTeamUtils
.
BENCH_PROJECT_ID
)){
prevAllocation
.
setBillingEndDate
(
MyTeamDateUtils
.
getDayLessThanDate
(
resourceReq
.
getBillingStartDate
()));
this
.
updateExistedResource
(
prevAllocation
);
}
if
(
nextAllocation
!=
null
&&
nextAllocation
.
getProjectId
().
equalsIgnoreCase
(
MyTeamUtils
.
BENCH_PROJECT_ID
)){
nextAllocation
.
setBillingStartDate
(
MyTeamDateUtils
.
getDayMoreThanDate
(
resourceReq
.
getBillingEndDate
()));
this
.
updateExistedResource
(
nextAllocation
);
}
resource
.
setBillableStatus
(
resourceReq
.
getBillableStatus
());
resource
.
setBillingStartDate
(
resourceReq
.
getBillingStartDate
());
resource
.
setBillingEndDate
(
resourceReq
.
getBillingEndDate
());
this
.
updateExistedResource
(
resource
);
}
}
else
{
respMap
.
put
(
"statusCode"
,
811
);
respMap
.
put
(
"message"
,
"Resource is already released from you, And you can't update this allocation"
);
...
...
@@ -184,6 +184,8 @@ public class ResourceService implements IResourceService {
if
(
resource
!=
null
)
{
Resource
resourcePers
=
resourceRepo
.
save
(
resource
);
respMap
.
put
(
"statusCode"
,
801
);
respMap
.
put
(
"message"
,
"Resource updated successfully"
);
respMap
.
put
(
"resourceObj"
,
resourcePers
);
}
...
...
@@ -350,6 +352,7 @@ public class ResourceService implements IResourceService {
if
(
lastAllocation
!=
null
&&
!
lastAllocation
.
getStatus
().
equals
(
MyTeamUtils
.
STATUS_RELEASED
)){
message
=
"Resource is not released form last allocation"
;
}
else
{
message
=
"Resource updated successfully"
;
isValid
=
true
;
}
...
...
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