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
aa1086d2
Commit
aa1086d2
authored
May 16, 2019
by
Md Suleman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated_Manage_Projects_and_team
parent
cc43ba84
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
17 deletions
+35
-17
ResourceAllocationController.java
...nisum/myteam/controller/ResourceAllocationController.java
+13
-10
ProjectService.java
...in/java/com/nisum/myteam/service/impl/ProjectService.java
+3
-0
ResourceAllocationService.java
.../nisum/myteam/service/impl/ResourceAllocationService.java
+19
-7
No files found.
src/main/java/com/nisum/myteam/controller/ResourceAllocationController.java
View file @
aa1086d2
...
@@ -50,14 +50,14 @@ public class ResourceAllocationController {
...
@@ -50,14 +50,14 @@ public class ResourceAllocationController {
if
(
resourceAllocService
.
validateBillingStartEndDateAgainstProjectStartEndDate
(
resourceAllocationReq
,
loginEmpId
))
{
if
(
resourceAllocService
.
validateBillingStartEndDateAgainstProjectStartEndDate
(
resourceAllocationReq
,
loginEmpId
))
{
if
(
resourceAllocService
.
validateBillingStartDateAgainstDOJ
(
resourceAllocationReq
))
{
if
(
resourceAllocService
.
validateBillingStartDateAgainstDOJ
(
resourceAllocationReq
))
{
if
(!
resourceAllocService
.
isResourceAssignedToAnyProject
(
resourceAllocationReq
))
{
if
(!
resourceAllocService
.
isResourceAssignedToAnyProject
(
resourceAllocationReq
))
{
ResourceAllocation
resourcePersisted
=
resourceAllocService
.
addResourceAllocation
(
resourceAllocationReq
,
loginEmpId
);
if
(!
resourceAllocService
.
isResourceExistsForProject
(
resourceAllocationReq
.
getEmployeeId
(),
resourceAllocationReq
.
getProjectId
()))
{
ResourceAllocation
resourcePersisted
=
resourceAllocService
.
addResourceAllocation
(
resourceAllocationReq
,
loginEmpId
);
ResponseDetails
createResponseDetails
=
new
ResponseDetails
(
new
Date
(),
800
,
"Resource has been created"
,
"Resource description"
,
null
,
request
.
getContextPath
(),
"details"
,
resourcePersisted
);
return
new
ResponseEntity
<
ResponseDetails
>(
createResponseDetails
,
HttpStatus
.
OK
);
ResponseDetails
createResponseDetails
=
new
ResponseDetails
(
new
Date
(),
800
,
"Resource has been created"
,
"Resource description"
,
null
,
request
.
getContextPath
(),
"details"
,
resourcePersisted
);
return
new
ResponseEntity
<
ResponseDetails
>(
createResponseDetails
,
HttpStatus
.
OK
);
}
}
}
}
}
}
}
...
@@ -80,12 +80,15 @@ public class ResourceAllocationController {
...
@@ -80,12 +80,15 @@ public class ResourceAllocationController {
resourceAllocationReq
.
setAuditFields
(
loginEmpId
,
MyTeamUtils
.
UPDATE
);
resourceAllocationReq
.
setAuditFields
(
loginEmpId
,
MyTeamUtils
.
UPDATE
);
if
(
resourceAllocService
.
isResourceExistsForProject
(
resourceAllocationReq
.
getEmployeeId
(),
resourceAllocationReq
.
getProjectId
()))
{
if
(
resourceAllocService
.
isResourceExistsForProject
(
resourceAllocationReq
.
getEmployeeId
(),
resourceAllocationReq
.
getProjectId
()))
{
resourceAllocService
.
updatePreviousResource
(
resourceAllocationReq
,
loginEmpId
);
resourceAllocService
.
insertNewResourceAllocWithNewStatus
(
resourceAllocationReq
,
loginEmpId
);
resourceAllocService
.
updateResourceDetails
(
resourceAllocationReq
,
loginEmpId
);
// resourceAllocService.insertNewResourceAllocWithNewStatus(resourceAllocationReq, loginEmpId);
}
}
ResponseDetails
createResponseDetails
=
new
ResponseDetails
(
new
Date
(),
Integer
.
parseInt
(
resourceAllocService
.
respMap
.
get
(
"statusCode"
).
toString
()),
resourceAllocService
.
respMap
.
get
(
"message"
).
toString
(),
ResponseDetails
createResponseDetails
=
new
ResponseDetails
(
new
Date
(),
Integer
.
parseInt
(
resourceAllocService
.
respMap
.
get
(
"statusCode"
).
toString
()),
"Resource description"
,
null
,
request
.
getContextPath
(),
"Resource details"
,
resourceAllocationReq
);
resourceAllocService
.
respMap
.
get
(
"message"
).
toString
(),
"Resource description"
,
null
,
request
.
getContextPath
(),
"Resource details"
,
resourceAllocationReq
);
return
new
ResponseEntity
<
ResponseDetails
>(
createResponseDetails
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<
ResponseDetails
>(
createResponseDetails
,
HttpStatus
.
OK
);
}
}
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
820
,
"Please provide the valid Employee Id"
,
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
820
,
"Please provide the valid Employee Id"
,
...
...
src/main/java/com/nisum/myteam/service/impl/ProjectService.java
View file @
aa1086d2
...
@@ -115,6 +115,9 @@ public class ProjectService implements IProjectService {
...
@@ -115,6 +115,9 @@ public class ProjectService implements IProjectService {
existingProject
.
setProjectEndDate
(
project
.
getProjectEndDate
());
existingProject
.
setProjectEndDate
(
project
.
getProjectEndDate
());
existingProject
.
setAuditFields
(
loginEmpId
,
MyTeamUtils
.
UPDATE
);
existingProject
.
setAuditFields
(
loginEmpId
,
MyTeamUtils
.
UPDATE
);
projectRepo
.
save
(
existingProject
);
projectRepo
.
save
(
existingProject
);
}
else
{
project
.
setId
(
existingProject
.
getId
());
projectRepo
.
save
(
project
);
}
}
return
existingProject
;
return
existingProject
;
}
}
...
...
src/main/java/com/nisum/myteam/service/impl/ResourceAllocationService.java
View file @
aa1086d2
...
@@ -61,7 +61,8 @@ public class ResourceAllocationService implements IResourceAllocationService {
...
@@ -61,7 +61,8 @@ public class ResourceAllocationService implements IResourceAllocationService {
List
<
ResourceAllocation
>
resourceList
=
resourceAllocationRepo
.
findByEmployeeIdAndProjectId
(
employeeId
,
projectId
);
List
<
ResourceAllocation
>
resourceList
=
resourceAllocationRepo
.
findByEmployeeIdAndProjectId
(
employeeId
,
projectId
);
if
(
resourceList
!=
null
&&
resourceList
.
size
()
>
0
)
{
if
(
resourceList
!=
null
&&
resourceList
.
size
()
>
0
)
{
isExists
=
true
;
isExists
=
true
;
respMap
.
put
(
"message"
,
"Resourse is already in the project"
);
return
isExists
;
}
}
respMap
.
put
(
"statusCode"
,
810
);
respMap
.
put
(
"statusCode"
,
810
);
respMap
.
put
(
"message"
,
"Resource Not Found"
);
respMap
.
put
(
"message"
,
"Resource Not Found"
);
...
@@ -71,19 +72,30 @@ public class ResourceAllocationService implements IResourceAllocationService {
...
@@ -71,19 +72,30 @@ public class ResourceAllocationService implements IResourceAllocationService {
public
void
update
PreviousResource
(
ResourceAllocation
resourceAllocReq
,
String
loginEmpId
)
throws
MyTeamException
{
public
void
update
ResourceDetails
(
ResourceAllocation
resourceAllocReq
,
String
loginEmpId
)
throws
MyTeamException
{
List
<
ResourceAllocation
>
resourceAllocList
=
resourceAllocationRepo
.
findByEmployeeIdAndProjectId
(
resourceAllocReq
.
getEmployeeId
(),
resourceAllocReq
.
getProjectId
());
List
<
ResourceAllocation
>
resourceAllocList
=
resourceAllocationRepo
.
findByEmployeeIdAndProjectId
(
resourceAllocReq
.
getEmployeeId
(),
resourceAllocReq
.
getProjectId
());
List
<
ResourceAllocation
>
resourceListWithLatestRecord
=
resourceAllocList
.
stream
().
filter
(
resource
->
resource
.
getBillingEndDate
().
compareTo
(
new
Date
())
>=
0
).
collect
(
Collectors
.
toList
());
List
<
ResourceAllocation
>
resourceListWithLatestRecord
=
resourceAllocList
.
stream
().
filter
(
resource
->
resource
.
getBillingEndDate
().
compareTo
(
new
Date
())
>=
0
).
collect
(
Collectors
.
toList
());
if
(
resourceListWithLatestRecord
!=
null
&&
resourceListWithLatestRecord
.
size
()
>
0
)
{
if
(
resourceListWithLatestRecord
!=
null
&&
resourceListWithLatestRecord
.
size
()
>
0
)
{
ResourceAllocation
resourceAllocPrev
=
resourceListWithLatestRecord
.
get
(
0
);
//latest resource record.
ResourceAllocation
resourceAllocPrev
=
resourceListWithLatestRecord
.
get
(
0
);
//latest resource record.
log
.
info
(
"Requsting Resource Allocation BillingStart Date::::"
+
resourceAllocReq
.
getBillingStartDate
());
log
.
info
(
"Requsting Resource Allocation BillingStart Date::::"
+
resourceAllocReq
.
getBillingStartDate
());
log
.
info
(
"The before date is::"
+
MyTeamDateUtils
.
getDayLessThanDate
(
resourceAllocReq
.
getBillingStartDate
()));
log
.
info
(
"The before date is::"
+
MyTeamDateUtils
.
getDayLessThanDate
(
resourceAllocReq
.
getBillingStartDate
()));
resourceAllocPrev
.
setBillingEndDate
(
MyTeamDateUtils
.
getDayLessThanDate
(
resourceAllocReq
.
getBillingStartDate
()));
//adding resource.
if
(!
resourceAllocPrev
.
getBillableStatus
().
equals
(
resourceAllocReq
.
getBillableStatus
()))
{
//resourceAllocPrev.setBillingEndDate(); //adding resource.
if
(
resourceAllocPrev
.
getBillingEndDate
().
compareTo
(
new
Date
())
==
0
)
{
resourceAllocPrev
.
setBillingEndDate
(
new
Date
());
}
else
{
resourceAllocPrev
.
setBillingEndDate
(
MyTeamDateUtils
.
getDayLessThanDate
(
resourceAllocReq
.
getBillingStartDate
()));
//adding resource.
}
insertNewResourceAllocWithNewStatus
(
resourceAllocReq
,
loginEmpId
);
}
else
{
resourceAllocPrev
.
setResourceRole
(
resourceAllocReq
.
getResourceRole
());
resourceAllocPrev
.
setBillingStartDate
(
resourceAllocReq
.
getBillingStartDate
());
resourceAllocPrev
.
setBillingEndDate
(
resourceAllocReq
.
getBillingEndDate
());
//resourceAllocPrev.setBillingEndDate(); //adding resource.
}
log
.
info
(
"After setting the date:::before saving the Resource::"
+
resourceAllocPrev
);
log
.
info
(
"After setting the date:::before saving the Resource::"
+
resourceAllocPrev
);
this
.
updateExistedResourceAlloc
(
resourceAllocPrev
);
this
.
updateExistedResourceAlloc
(
resourceAllocPrev
);
}
}
...
@@ -95,7 +107,7 @@ public class ResourceAllocationService implements IResourceAllocationService {
...
@@ -95,7 +107,7 @@ public class ResourceAllocationService implements IResourceAllocationService {
if
(
resourceAlloc
!=
null
)
{
if
(
resourceAlloc
!=
null
)
{
ResourceAllocation
resourcePers
=
resourceAllocationRepo
.
save
(
resourceAlloc
);
ResourceAllocation
resourcePers
=
resourceAllocationRepo
.
save
(
resourceAlloc
);
respMap
.
put
(
"statusCode"
,
801
);
respMap
.
put
(
"statusCode"
,
801
);
respMap
.
put
(
"message"
,
"
resource has been updated
"
);
respMap
.
put
(
"message"
,
"
Resource updated successfully
"
);
respMap
.
put
(
"resourceObj"
,
resourcePers
);
respMap
.
put
(
"resourceObj"
,
resourcePers
);
}
}
...
...
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