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
f30949f1
Commit
f30949f1
authored
May 13, 2019
by
NISUM
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Provided error codes for resource allocation
parent
74aff0b5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
+13
-5
ResourceAllocationController.java
...nisum/myteam/controller/ResourceAllocationController.java
+5
-5
ResourceAllocationService.java
.../nisum/myteam/service/impl/ResourceAllocationService.java
+8
-0
No files found.
src/main/java/com/nisum/myteam/controller/ResourceAllocationController.java
View file @
f30949f1
...
@@ -52,7 +52,7 @@ public class ResourceAllocationController {
...
@@ -52,7 +52,7 @@ public class ResourceAllocationController {
if
(!
resourceAllocService
.
isResourceAssignedToAnyProject
(
resourceAllocationReq
))
{
if
(!
resourceAllocService
.
isResourceAssignedToAnyProject
(
resourceAllocationReq
))
{
ResourceAllocation
resourcePersisted
=
resourceAllocService
.
addResourceAllocation
(
resourceAllocationReq
,
loginEmpId
);
ResourceAllocation
resourcePersisted
=
resourceAllocService
.
addResourceAllocation
(
resourceAllocationReq
,
loginEmpId
);
ResponseDetails
createResponseDetails
=
new
ResponseDetails
(
new
Date
(),
601
,
"Resource has been created"
,
ResponseDetails
createResponseDetails
=
new
ResponseDetails
(
new
Date
(),
800
,
"Resource has been created"
,
"Resource description"
,
null
,
request
.
getContextPath
(),
"details"
,
resourcePersisted
);
"Resource description"
,
null
,
request
.
getContextPath
(),
"details"
,
resourcePersisted
);
return
new
ResponseEntity
<
ResponseDetails
>(
createResponseDetails
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<
ResponseDetails
>(
createResponseDetails
,
HttpStatus
.
OK
);
...
@@ -61,12 +61,12 @@ public class ResourceAllocationController {
...
@@ -61,12 +61,12 @@ public class ResourceAllocationController {
}
}
}
}
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
resourceAllocService
.
respMap
.
get
(
"message"
).
toString
(),
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
resourceAllocService
.
respMap
.
get
(
"statusCode"
).
toString
()
,
resourceAllocService
.
respMap
.
get
(
"message"
).
toString
(),
"Error message desc"
,
null
,
request
.
getRequestURI
(),
"Resource details"
,
resourceAllocationReq
);
"Error message desc"
,
null
,
request
.
getRequestURI
(),
"Resource details"
,
resourceAllocationReq
);
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
}
}
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Please provide the valid Employee Id"
,
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
820
,
"Please provide the valid Employee Id"
,
"Employee Id is not valid"
,
null
,
request
.
getRequestURI
(),
"Resource details"
,
resourceAllocationReq
);
"Employee Id is not valid"
,
null
,
request
.
getRequestURI
(),
"Resource details"
,
resourceAllocationReq
);
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
...
@@ -85,11 +85,11 @@ public class ResourceAllocationController {
...
@@ -85,11 +85,11 @@ public class ResourceAllocationController {
resourceAllocService
.
updateResource
(
resourceAllocationReq
,
loginEmpId
);
resourceAllocService
.
updateResource
(
resourceAllocationReq
,
loginEmpId
);
}
}
ResponseDetails
createResponseDetails
=
new
ResponseDetails
(
new
Date
(),
601
,
resourceAllocService
.
respMap
.
get
(
"message"
).
toString
(),
ResponseDetails
createResponseDetails
=
new
ResponseDetails
(
new
Date
(),
resourceAllocService
.
respMap
.
get
(
"statusCode"
).
toString
()
,
resourceAllocService
.
respMap
.
get
(
"message"
).
toString
(),
"Resource description"
,
null
,
request
.
getContextPath
(),
"Resource details"
,
resourceAllocationReq
);
"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
(),
602
,
"Please provide the valid Employee Id"
,
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
820
,
"Please provide the valid Employee Id"
,
"Employee Id is not valid"
,
null
,
request
.
getRequestURI
(),
"Resource details"
,
resourceAllocationReq
);
"Employee Id is not valid"
,
null
,
request
.
getRequestURI
(),
"Resource details"
,
resourceAllocationReq
);
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
}
}
...
...
src/main/java/com/nisum/myteam/service/impl/ResourceAllocationService.java
View file @
f30949f1
...
@@ -59,6 +59,7 @@ public class ResourceAllocationService implements IResourceAllocationService {
...
@@ -59,6 +59,7 @@ public class ResourceAllocationService implements IResourceAllocationService {
isExists
=
true
;
isExists
=
true
;
}
}
respMap
.
put
(
"statusCode"
,
810
);
respMap
.
put
(
"message"
,
"Resource Not Found"
);
respMap
.
put
(
"message"
,
"Resource Not Found"
);
return
isExists
;
return
isExists
;
}
}
...
@@ -68,6 +69,7 @@ public class ResourceAllocationService implements IResourceAllocationService {
...
@@ -68,6 +69,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
(
"message"
,
"resource has been updated"
);
respMap
.
put
(
"message"
,
"resource has been updated"
);
respMap
.
put
(
"resourceObj"
,
resourcePers
);
respMap
.
put
(
"resourceObj"
,
resourcePers
);
...
@@ -104,12 +106,14 @@ public class ResourceAllocationService implements IResourceAllocationService {
...
@@ -104,12 +106,14 @@ public class ResourceAllocationService implements IResourceAllocationService {
if
(!
resourceAllocation
.
getBillingStartDate
().
after
(
project
.
getProjectStartDate
()))
{
if
(!
resourceAllocation
.
getBillingStartDate
().
after
(
project
.
getProjectStartDate
()))
{
log
.
info
(
"Billing start date should be after Project start date"
);
log
.
info
(
"Billing start date should be after Project start date"
);
respMap
.
put
(
"statusCode"
,
811
);
respMap
.
put
(
"message"
,
"Billing start date should be after Project start date"
);
respMap
.
put
(
"message"
,
"Billing start date should be after Project start date"
);
isValid
=
false
;
isValid
=
false
;
}
}
if
(!
resourceAllocation
.
getBillingStartDate
().
before
(
resourceAllocation
.
getBillingEndDate
()))
{
if
(!
resourceAllocation
.
getBillingStartDate
().
before
(
resourceAllocation
.
getBillingEndDate
()))
{
log
.
info
(
"Billing start date should be before Billing End Date."
);
log
.
info
(
"Billing start date should be before Billing End Date."
);
respMap
.
put
(
"statusCode"
,
812
);
respMap
.
put
(
"message"
,
"Billing start date should be before Billing End Date."
);
respMap
.
put
(
"message"
,
"Billing start date should be before Billing End Date."
);
isValid
=
false
;
isValid
=
false
;
}
}
...
@@ -118,6 +122,7 @@ public class ResourceAllocationService implements IResourceAllocationService {
...
@@ -118,6 +122,7 @@ public class ResourceAllocationService implements IResourceAllocationService {
if
(!
resourceAllocation
.
getBillingEndDate
().
before
(
project
.
getProjectEndDate
()))
{
if
(!
resourceAllocation
.
getBillingEndDate
().
before
(
project
.
getProjectEndDate
()))
{
log
.
info
(
"Billing end date should be before Project End Date."
);
log
.
info
(
"Billing end date should be before Project End Date."
);
respMap
.
put
(
"statusCode"
,
813
);
respMap
.
put
(
"message"
,
"Billing end date should be before Project End Date."
);
respMap
.
put
(
"message"
,
"Billing end date should be before Project End Date."
);
isValid
=
false
;
isValid
=
false
;
}
}
...
@@ -138,6 +143,7 @@ public class ResourceAllocationService implements IResourceAllocationService {
...
@@ -138,6 +143,7 @@ public class ResourceAllocationService implements IResourceAllocationService {
+
projectService
.
getProjectByProjectId
(
resource
.
getProjectId
()).
getProjectName
()
+
projectService
.
getProjectByProjectId
(
resource
.
getProjectId
()).
getProjectName
()
+
" project should not be before Date of Joining ( "
+
empDoj
+
")."
;
+
" project should not be before Date of Joining ( "
+
empDoj
+
")."
;
isValid
=
false
;
isValid
=
false
;
respMap
.
put
(
"statusCode"
,
814
);
respMap
.
put
(
"message"
,
message
);
respMap
.
put
(
"message"
,
message
);
}
}
return
isValid
;
return
isValid
;
...
@@ -160,6 +166,7 @@ public class ResourceAllocationService implements IResourceAllocationService {
...
@@ -160,6 +166,7 @@ public class ResourceAllocationService implements IResourceAllocationService {
+
projectService
.
getProjectByProjectId
(
resourceAllocPrev
.
getProjectId
()).
getProjectName
()
+
projectService
.
getProjectByProjectId
(
resourceAllocPrev
.
getProjectId
()).
getProjectName
()
+
" Project"
+
" from "
+
resourceAllocPrev
.
getBillingStartDate
()
+
"to "
+
resourceAllocPrev
.
getBillingEndDate
();
+
" Project"
+
" from "
+
resourceAllocPrev
.
getBillingStartDate
()
+
"to "
+
resourceAllocPrev
.
getBillingEndDate
();
isAssigned
=
true
;
isAssigned
=
true
;
respMap
.
put
(
"statusCode"
,
815
);
respMap
.
put
(
"message"
,
message
);
respMap
.
put
(
"message"
,
message
);
}
}
return
isAssigned
;
return
isAssigned
;
...
@@ -168,6 +175,7 @@ public class ResourceAllocationService implements IResourceAllocationService {
...
@@ -168,6 +175,7 @@ public class ResourceAllocationService implements IResourceAllocationService {
public
void
updateResource
(
ResourceAllocation
resourceAllocReq
,
String
loginEmpId
)
throws
MyTeamException
{
public
void
updateResource
(
ResourceAllocation
resourceAllocReq
,
String
loginEmpId
)
throws
MyTeamException
{
ResourceAllocation
resourceAllocationPers
=
resourceAllocationRepo
.
save
(
resourceAllocReq
);
ResourceAllocation
resourceAllocationPers
=
resourceAllocationRepo
.
save
(
resourceAllocReq
);
respMap
.
put
(
"statusCode"
,
801
;
respMap
.
put
(
"message"
,
"Resource updated successfully"
);
respMap
.
put
(
"message"
,
"Resource updated successfully"
);
respMap
.
put
(
"resourceObj"
,
resourceAllocationPers
);
respMap
.
put
(
"resourceObj"
,
resourceAllocationPers
);
...
...
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